Skip to contentSkip to conversation

Multi-arch queue

GIT PULL Peter Crosthwaite 3 participants 25 messages Sep 11, 2015 – Sep 22, 2015

lore
Share & tools
lore
#0 lore raw

Flush of multi-arch pre-requisite work.

----------------------------------------
multi-arch queue:
* add EM_MOXIE
* Cleanup ELF_MACHINE and remove from cpu.h
----------------------------------------

The following changes since commit 9d34158a5af734e8de0b42b0a7228200c426a8d0:

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20150907' into staging (2015-09-07 16:07:47 +0100)

are available in the git repository at:

git://github.com/pcrost/qemu multi-arch.1.2015.09.07

for you to fetch changes up to f4290e0cf89fa512df44e607f239d46e73d46576:

ppc: Rename ELF_MACHINE to be PPC specific (2015-09-07 23:59:28 -0700)

----------------------------------------------------------------
Peter Crosthwaite (21):
linux_user: elfload: Default ELF_MACHINE to ELF_ARCH
linux-user: elfload: Provide default for elf_check_arch
elf_ops: Fix coding style for EM alias case statement
elf: Update EM_MOXIE definition
arm: Remove ELF_MACHINE from cpu.h
mb: Remove ELF_MACHINE from cpu.h
m68k: Remove ELF_MACHINE from cpu.h
cris: Remove ELF_MACHINE from cpu.h
moxie: Remove ELF_MACHINE from cpu.h
unicore: Remove ELF_MACHINE from cpu.h
lm32: Remove ELF_MACHINE from cpu.h
or32: Remove ELF_MACHINE from cpu.h
tricore: Remove ELF_MACHINE from cpu.h
xtensa: Remove ELF_MACHINE from cpu.h
sh4: Remove ELF_MACHINE from cpu.h
s390: Remove ELF_MACHINE from cpu.h
sparc: Remove ELF_MACHINE from cpu.h
mips: Remove ELF_MACHINE from cpu.h
alpha: Remove ELF_MACHINE from cpu.h
i386: Rename ELF_MACHINE to be x86 specific
ppc: Rename ELF_MACHINE to be PPC specific

 hw/arm/armv7m.c                |  2 +-
 hw/cris/boot.c                 |  2 +-
 hw/i386/multiboot.c            |  2 +-
 hw/lm32/lm32_boards.c          |  4 ++--
 hw/lm32/milkymist.c            |  2 +-
 hw/m68k/an5206.c               |  2 +-
 hw/m68k/dummy_m68k.c           |  2 +-
 hw/m68k/mcf5208.c              |  2 +-
 hw/microblaze/boot.c           |  4 ++--
 hw/mips/mips_fulong2e.c        |  2 +-
 hw/mips/mips_malta.c           |  2 +-
 hw/mips/mips_mipssim.c         |  2 +-
 hw/mips/mips_r4k.c             |  2 +-
 hw/moxie/moxiesim.c            |  4 ++--
 hw/openrisc/openrisc_sim.c     |  2 +-
 hw/ppc/e500.c                  |  2 +-
 hw/ppc/mac_newworld.c          |  4 ++--
 hw/ppc/mac_oldworld.c          |  4 ++--
 hw/ppc/ppc440_bamboo.c         |  2 +-
 hw/ppc/prep.c                  |  2 +-
 hw/ppc/spapr.c                 |  4 ++--
 hw/ppc/virtex_ml507.c          |  2 +-
 hw/s390x/ipl.c                 |  4 ++--
 hw/sparc/leon3.c               |  2 +-
 hw/sparc/sun4m.c               |  4 ++--
 hw/sparc64/sun4u.c             |  4 ++--
 hw/tricore/tricore_testboard.c |  2 +-
 hw/xtensa/sim.c                |  4 ++--
 hw/xtensa/xtfpga.c             |  2 +-
 include/elf.h                  |  3 +++
 include/hw/elf_ops.h           | 23 +++++++++++++++++------
 linux-user/elfload.c           | 37 +++++++++++--------------------------
 target-alpha/cpu.h             |  2 --
 target-arm/cpu.h               |  2 --
 target-cris/cpu.h              |  2 --
 target-i386/cpu.h              |  4 ++--
 target-lm32/cpu.h              |  2 --
 target-m68k/cpu.h              |  2 --
 target-microblaze/cpu.h        |  2 --
 target-mips/cpu.h              |  2 --
 target-moxie/cpu.h             |  2 --
 target-openrisc/cpu.h          |  1 -
 target-ppc/cpu.h               |  4 ++--
 target-s390x/cpu.h             |  1 -
 target-sh4/cpu.h               |  2 --
 target-sparc/cpu.h             |  6 ------
 target-tricore/cpu.h           |  2 --
 target-unicore32/cpu.h         |  2 --
 target-xtensa/cpu.h            |  1 -
 49 files changed, 74 insertions(+), 106 deletions(-)
#1 lore raw

[Qemu-devel] [PULL v1 01/21] linux_user: elfload: Default ELF_MACHINE to ELF_ARCH

In most (but not all) cases, ELF_MACHINE and ELF_ARCH are safely the same. Default ELF_MACHINE to ELF_ARCH. This makes defining ELF_MACHINE optional for target-*/cpu.h when they are known to match.

---

 linux-user/elfload.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/elfload.c +4 -0
index 9c999ac..518ff05 100644
@@ -1222,6 +1222,10 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
 #define ELF_PLATFORM (NULL)
 #endif
 
+#ifndef ELF_MACHINE
+#define ELF_MACHINE ELF_ARCH
+#endif
+
 #ifndef ELF_HWCAP
 #define ELF_HWCAP 0
 #endif
Signature · 1 line
1.9.1
#2 lore raw

[Qemu-devel] [PULL v1 03/21] elf_ops: Fix coding style for EM alias case statement

In reply to Peter Crosthwaite

Fix the coding style for these cases as per CODING_STYLE. Reverse the Yoda conditions and add missing if braces.

---

 include/hw/elf_ops.h | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
include/hw/elf_ops.h +9 -6
index bd71968..0d41f24 100644
@@ -282,25 +282,28 @@ static int glue(load_elf, SZ)(const char *name, int fd,
 
     switch (elf_machine) {
         case EM_PPC64:
-            if (EM_PPC64 != ehdr.e_machine)
-                if (EM_PPC != ehdr.e_machine) {
+            if (ehdr.e_machine != EM_PPC64) {
+                if (ehdr.e_machine != EM_PPC) {
                     ret = ELF_LOAD_WRONG_ARCH;
                     goto fail;
                 }
+            }
             break;
         case EM_X86_64:
-            if (EM_X86_64 != ehdr.e_machine)
-                if (EM_386 != ehdr.e_machine) {
+            if (ehdr.e_machine != EM_X86_64) {
+                if (ehdr.e_machine != EM_386) {
                     ret = ELF_LOAD_WRONG_ARCH;
                     goto fail;
                 }
+            }
             break;
         case EM_MICROBLAZE:
-            if (EM_MICROBLAZE != ehdr.e_machine)
-                if (EM_MICROBLAZE_OLD != ehdr.e_machine) {
+            if (ehdr.e_machine != EM_MICROBLAZE) {
+                if (ehdr.e_machine != EM_MICROBLAZE_OLD) {
                     ret = ELF_LOAD_WRONG_ARCH;
                     goto fail;
                 }
+            }
             break;
         default:
             if (elf_machine != ehdr.e_machine) {
Signature · 1 line
1.9.1
#3 lore raw

[Qemu-devel] [PULL v1 02/21] linux-user: elfload: Provide default for elf_check_arch

In reply to Peter Crosthwaite

For many arch's this macro is defined as the predicatable behaviour of checking the argument for eqaulity against ELF_ARCH. Provide a default define as such, so only archs with special handling (usually allowing multiple EM values) need to provide a def.

Arches that do any of:

1: provide this def exactly the same way as the new default

        (alpha, x86_64)
2: check against ELF_MACHINE while defining ELF_ARCH == ELF_MACHINE
        (arm, aarch64)
3: check against EM_FOO directly while defining ELF_ARCH == EM_FOO
        (unicore32, sparc32, ppc32, mips, openrisc, sh4, cris, m86k)

have their elf_check_arch removed as the default will provide the correct behaviour.

---

 linux-user/elfload.c | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)
linux-user/elfload.c +4 -24
index 518ff05..1f4c054 100644
@@ -145,7 +145,6 @@ static uint32_t get_elf_hwcap(void)
 
 #ifdef TARGET_X86_64
 #define ELF_START_MMAP 0x2aaaaab000ULL
-#define elf_check_arch(x) ( ((x) == ELF_ARCH) )
 
 #define ELF_CLASS      ELFCLASS64
 #define ELF_ARCH       EM_X86_64
@@ -273,8 +272,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUX86State *en
 
 #define ELF_START_MMAP 0x80000000
 
-#define elf_check_arch(x) ((x) == ELF_MACHINE)
-
 #define ELF_ARCH        ELF_MACHINE
 #define ELF_CLASS       ELFCLASS32
 
@@ -481,8 +478,6 @@ static uint32_t get_elf_hwcap2(void)
 /* 64 bit ARM definitions */
 #define ELF_START_MMAP 0x80000000
 
-#define elf_check_arch(x) ((x) == ELF_MACHINE)
-
 #define ELF_ARCH        ELF_MACHINE
 #define ELF_CLASS       ELFCLASS64
 #define ELF_PLATFORM    "aarch64"
@@ -556,8 +551,6 @@ static uint32_t get_elf_hwcap(void)
 
 #define ELF_START_MMAP          0x80000000
 
-#define elf_check_arch(x)       ((x) == EM_UNICORE32)
-
 #define ELF_CLASS               ELFCLASS32
 #define ELF_DATA                ELFDATA2LSB
 #define ELF_ARCH                EM_UNICORE32
@@ -666,7 +659,6 @@ static inline void init_thread(struct target_pt_regs *regs,
 #define ELF_START_MMAP 0x80000000
 #define ELF_HWCAP  (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | HWCAP_SPARC_SWAP \
                     | HWCAP_SPARC_MULDIV)
-#define elf_check_arch(x) ( (x) == EM_SPARC )
 
 #define ELF_CLASS   ELFCLASS32
 #define ELF_ARCH    EM_SPARC
@@ -696,8 +688,6 @@ static inline void init_thread(struct target_pt_regs *regs,
 
 #else
 
-#define elf_check_arch(x) ( (x) == EM_PPC )
-
 #define ELF_CLASS       ELFCLASS32
 
 #endif
@@ -875,8 +865,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUPPCState *en
 
 #define ELF_START_MMAP 0x80000000
 
-#define elf_check_arch(x) ( (x) == EM_MIPS )
-
 #ifdef TARGET_MIPS64
 #define ELF_CLASS   ELFCLASS64
 #else
@@ -985,8 +973,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMBState *env
 
 #define ELF_START_MMAP 0x08000000
 
-#define elf_check_arch(x) ((x) == EM_OPENRISC)
-
 #define ELF_ARCH EM_OPENRISC
 #define ELF_CLASS ELFCLASS32
 #define ELF_DATA  ELFDATA2MSB
@@ -1026,8 +1012,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
 
 #define ELF_START_MMAP 0x80000000
 
-#define elf_check_arch(x) ( (x) == EM_SH )
-
 #define ELF_CLASS ELFCLASS32
 #define ELF_ARCH  EM_SH
 
@@ -1110,8 +1094,6 @@ static uint32_t get_elf_hwcap(void)
 
 #define ELF_START_MMAP 0x80000000
 
-#define elf_check_arch(x) ( (x) == EM_CRIS )
-
 #define ELF_CLASS ELFCLASS32
 #define ELF_ARCH  EM_CRIS
 
@@ -1129,8 +1111,6 @@ static inline void init_thread(struct target_pt_regs *regs,
 
 #define ELF_START_MMAP 0x80000000
 
-#define elf_check_arch(x) ( (x) == EM_68K )
-
 #define ELF_CLASS       ELFCLASS32
 #define ELF_ARCH        EM_68K
 
@@ -1182,8 +1162,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUM68KState *e
 
 #define ELF_START_MMAP (0x30000000000ULL)
 
-#define elf_check_arch(x) ( (x) == ELF_ARCH )
-
 #define ELF_CLASS      ELFCLASS64
 #define ELF_ARCH       EM_ALPHA
 
@@ -1203,8 +1181,6 @@ static inline void init_thread(struct target_pt_regs *regs,
 
 #define ELF_START_MMAP (0x20000000000ULL)
 
-#define elf_check_arch(x) ( (x) == ELF_ARCH )
-
 #define ELF_CLASS	ELFCLASS64
 #define ELF_DATA	ELFDATA2MSB
 #define ELF_ARCH	EM_S390
@@ -1226,6 +1202,10 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
 #define ELF_MACHINE ELF_ARCH
 #endif
 
+#ifndef elf_check_arch
+#define elf_check_arch(x) ((x) == ELF_ARCH)
+#endif
+
 #ifndef ELF_HWCAP
 #define ELF_HWCAP 0
 #endif
Signature · 1 line
1.9.1
#4 lore raw

[Qemu-devel] [PULL v1 04/21] elf: Update EM_MOXIE definition

In reply to Peter Crosthwaite

EM_MOXIE now has a proper assigned elf code. Use it. Register the old interim value as EM_MOXIE_OLD and accept either in elf loading.

---

 hw/moxie/moxiesim.c  | 1 +
 include/elf.h        | 3 +++
 include/hw/elf_ops.h | 8 ++++++++
 target-moxie/cpu.h   | 2 +-
 4 files changed, 13 insertions(+), 1 deletion(-)
hw/moxie/moxiesim.c +1 -0
index 80bcc5b..537e25e 100644
@@ -34,6 +34,7 @@
 #include "hw/loader.h"
 #include "hw/char/serial.h"
 #include "exec/address-spaces.h"
+#include "elf.h"
 
 #define PHYS_MEM_BASE 0x80000000
 
include/elf.h +3 -0
index 4afd474..295a6ea 100644
@@ -133,6 +133,9 @@ typedef int64_t  Elf64_Sxword;
 
 #define EM_AARCH64  183
 
+#define EM_MOXIE           223     /* Moxie processor family */
+#define EM_MOXIE_OLD       0xFEED
+
 /* This is the info that is needed to parse the dynamic section of the file */
 #define DT_NULL		0
 #define DT_NEEDED	1
include/hw/elf_ops.h +8 -0
index 0d41f24..0010c44 100644
@@ -305,6 +305,14 @@ static int glue(load_elf, SZ)(const char *name, int fd,
                 }
             }
             break;
+        case EM_MOXIE:
+            if (ehdr.e_machine != EM_MOXIE) {
+                if (ehdr.e_machine != EM_MOXIE_OLD) {
+                    ret = ELF_LOAD_WRONG_ARCH;
+                    goto fail;
+                }
+            }
+            break;
         default:
             if (elf_machine != ehdr.e_machine) {
                 ret = ELF_LOAD_WRONG_ARCH;
target-moxie/cpu.h +1 -1
index 29572aa..7bb1ed9 100644
@@ -26,7 +26,7 @@
 
 #define CPUArchState struct CPUMoxieState
 
-#define ELF_MACHINE     0xFEED /* EM_MOXIE */
+#define ELF_MACHINE     EM_MOXIE
 
 #define MOXIE_EX_DIV0        0
 #define MOXIE_EX_BAD         1
Signature · 1 line
1.9.1
#5 lore raw

[Qemu-devel] [PULL v1 05/21] arm: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The only generic code relying on this is linux-user. Linux user already has a lot of #ifdef TARGET_ customisation so instead, define ELF_ARCH as either EM_ARM or EM_AARCH64 appropriately.

The armv7m bootloader can just pass EM_ARM directly, as that is architecture specific code. Note that arm_boot already has its own logic selecting an arm specific elf machine so this makes V7M more consistent with arm_boot.

This removes another architecture specific definition from the global namespace.

---

 hw/arm/armv7m.c      | 2 +-
 linux-user/elfload.c | 4 ++--
 target-arm/cpu.h     | 2 --
 3 files changed, 3 insertions(+), 5 deletions(-)
hw/arm/armv7m.c +1 -1
index c6eab6d..ad89073 100644
@@ -215,7 +215,7 @@ qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq,
 
     if (kernel_filename) {
         image_size = load_elf(kernel_filename, NULL, NULL, &entry, &lowaddr,
-                              NULL, big_endian, ELF_MACHINE, 1);
+                              NULL, big_endian, EM_ARM, 1);
         if (image_size < 0) {
             image_size = load_image_targphys(kernel_filename, 0, mem_size);
             lowaddr = 0;
linux-user/elfload.c +2 -2
index 1f4c054..49791a8 100644
@@ -272,7 +272,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUX86State *en
 
 #define ELF_START_MMAP 0x80000000
 
-#define ELF_ARCH        ELF_MACHINE
+#define ELF_ARCH        EM_ARM
 #define ELF_CLASS       ELFCLASS32
 
 static inline void init_thread(struct target_pt_regs *regs,
@@ -478,7 +478,7 @@ static uint32_t get_elf_hwcap2(void)
 /* 64 bit ARM definitions */
 #define ELF_START_MMAP 0x80000000
 
-#define ELF_ARCH        ELF_MACHINE
+#define ELF_ARCH        EM_AARCH64
 #define ELF_CLASS       ELFCLASS64
 #define ELF_PLATFORM    "aarch64"
 
target-arm/cpu.h +0 -2
index 4bd5dc8..ff9964a 100644
@@ -26,10 +26,8 @@
 #if defined(TARGET_AARCH64)
   /* AArch64 definitions */
 #  define TARGET_LONG_BITS 64
-#  define ELF_MACHINE EM_AARCH64
 #else
 #  define TARGET_LONG_BITS 32
-#  define ELF_MACHINE EM_ARM
 #endif
 
 #define TARGET_IS_BIENDIAN 1
Signature · 1 line
1.9.1
#6 lore raw

[Qemu-devel] [PULL v1 06/21] mb: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The only generic code relying on this is linux-user, but linux-users' default behaviour or setting ELF_MACHINE to ELF_ARCH will handle this.

The microblaze bootloader can just pass EM_MICROBLAZE directly, as that is architecture specific code.

This removes another architecture specific definition from the global namespace.

---

 hw/microblaze/boot.c    | 4 ++--
 target-microblaze/cpu.h | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)
hw/microblaze/boot.c +2 -2
index 3e8820f..d7eaa1f 100644
@@ -141,12 +141,12 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base,
         /* Boots a kernel elf binary.  */
         kernel_size = load_elf(kernel_filename, NULL, NULL,
                                &entry, &low, &high,
-                               big_endian, ELF_MACHINE, 0);
+                               big_endian, EM_MICROBLAZE, 0);
         base32 = entry;
         if (base32 == 0xc0000000) {
             kernel_size = load_elf(kernel_filename, translate_kernel_address,
                                    NULL, &entry, NULL, NULL,
-                                   big_endian, ELF_MACHINE, 0);
+                                   big_endian, EM_MICROBLAZE, 0);
         }
         /* Always boot into physical ram.  */
         boot_info.bootstrap_pc = (uint32_t)entry;
target-microblaze/cpu.h +0 -2
index 7e20e59..b49dcf4 100644
@@ -34,8 +34,6 @@ typedef struct CPUMBState CPUMBState;
 #include "mmu.h"
 #endif
 
-#define ELF_MACHINE	EM_MICROBLAZE
-
 #define EXCP_MMU        1
 #define EXCP_IRQ        2
 #define EXCP_BREAK      3
Signature · 1 line
1.9.1
#7 lore raw

[Qemu-devel] [PULL v1 07/21] m68k: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The only generic code relying on this is linux-user, but linux users' default behaviour of defaulting ELF_MACHINE to ELF_ARCH will handle this.

The machine model bootloaders can just pass EM_68K directly, as that is architecture specific code.

This removes another architecture specific definition from the global namespace.

---

 hw/m68k/an5206.c     | 2 +-
 hw/m68k/dummy_m68k.c | 2 +-
 hw/m68k/mcf5208.c    | 2 +-
 target-m68k/cpu.h    | 2 --
 4 files changed, 3 insertions(+), 5 deletions(-)
hw/m68k/an5206.c +1 -1
index f63ab2b..59e89fe 100644
@@ -70,7 +70,7 @@ static void an5206_init(MachineState *machine)
     }
 
     kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
-                           NULL, NULL, 1, ELF_MACHINE, 0);
+                           NULL, NULL, 1, EM_68K, 0);
     entry = elf_entry;
     if (kernel_size < 0) {
         kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL,
hw/m68k/dummy_m68k.c +1 -1
index 5b77d93..3463913 100644
@@ -49,7 +49,7 @@ static void dummy_m68k_init(MachineState *machine)
     /* Load kernel.  */
     if (kernel_filename) {
         kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
-                               NULL, NULL, 1, ELF_MACHINE, 0);
+                               NULL, NULL, 1, EM_68K, 0);
         entry = elf_entry;
         if (kernel_size < 0) {
             kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL,
hw/m68k/mcf5208.c +1 -1
index 326a42d..cb57cf9 100644
@@ -275,7 +275,7 @@ static void mcf5208evb_init(MachineState *machine)
     }
 
     kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
-                           NULL, NULL, 1, ELF_MACHINE, 0);
+                           NULL, NULL, 1, EM_68K, 0);
     entry = elf_entry;
     if (kernel_size < 0) {
         kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL,
target-m68k/cpu.h +0 -2
index 9a62f6c..ebbbeef 100644
@@ -32,8 +32,6 @@
 
 #define MAX_QREGS 32
 
-#define ELF_MACHINE	EM_68K
-
 #define EXCP_ACCESS         2   /* Access (MMU) error.  */
 #define EXCP_ADDRESS        3   /* Address error.  */
 #define EXCP_ILLEGAL        4   /* Illegal instruction.  */
Signature · 1 line
1.9.1
#8 lore raw

[Qemu-devel] [PULL v1 08/21] cris: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The only generic code relying on this is linux-user, but linux users' default behaviour of defaulting ELF_MACHINE to ELF_ARCH will handle this.

The bootloader can just pass EM_CRIS directly, as that is architecture specific code.

This removes another architecture specific definition from the global namespace.

---

 hw/cris/boot.c    | 2 +-
 target-cris/cpu.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
hw/cris/boot.c +1 -1
index 622f353..1cfa339 100644
@@ -72,7 +72,7 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info *li)
     /* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis 
        devboard SDK.  */
     image_size = load_elf(li->image_filename, translate_kernel_address, NULL,
-                          &entry, NULL, &high, 0, ELF_MACHINE, 0);
+                          &entry, NULL, &high, 0, EM_CRIS, 0);
     li->entry = entry;
     if (image_size < 0) {
         /* Takes a kimage from the axis devboard SDK.  */
target-cris/cpu.h +0 -2
index d422e35..c22d16c 100644
@@ -29,8 +29,6 @@
 
 #include "exec/cpu-defs.h"
 
-#define ELF_MACHINE	EM_CRIS
-
 #define EXCP_NMI        1
 #define EXCP_GURU       2
 #define EXCP_BUSFAULT   3
Signature · 1 line
1.9.1
#9 lore raw

[Qemu-devel] [PULL v1 09/21] moxie: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The bootloader can just pass EM_MOXIE directly, as that is architecture specific code.

This removes another architecture specific definition from the global namespace.

---
Changed since V1
Use EM_MOXIE macro (rth) review

 hw/moxie/moxiesim.c | 3 +--
 target-moxie/cpu.h  | 2 --
 2 files changed, 1 insertion(+), 4 deletions(-)
hw/moxie/moxiesim.c +1 -2
index 537e25e..83b45f1 100644
@@ -53,8 +53,7 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params)
     ram_addr_t initrd_offset;
 
     kernel_size = load_elf(loader_params->kernel_filename,  NULL, NULL,
-                           &entry, &kernel_low, &kernel_high, 1,
-                           ELF_MACHINE, 0);
+                           &entry, &kernel_low, &kernel_high, 1, EM_MOXIE, 0);
 
     if (kernel_size <= 0) {
         fprintf(stderr, "qemu: could not load kernel '%s'\n",
target-moxie/cpu.h +0 -2
index 7bb1ed9..e27a6a3 100644
@@ -26,8 +26,6 @@
 
 #define CPUArchState struct CPUMoxieState
 
-#define ELF_MACHINE     EM_MOXIE
-
 #define MOXIE_EX_DIV0        0
 #define MOXIE_EX_BAD         1
 #define MOXIE_EX_IRQ         2
Signature · 1 line
1.9.1
#10 lore raw

[Qemu-devel] [PULL v1 10/21] unicore: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The only generic code relying on this is linux-user, but linux users' default behaviour of defaulting ELF_MACHINE to ELF_ARCH will handle this.

This removes another architecture specific definition from the global namespace.

---

 target-unicore32/cpu.h | 2 --
 1 file changed, 2 deletions(-)
target-unicore32/cpu.h +0 -2
index 45e31e5..3c06996 100644
@@ -17,8 +17,6 @@
 #define TARGET_PHYS_ADDR_SPACE_BITS     32
 #define TARGET_VIRT_ADDR_SPACE_BITS     32
 
-#define ELF_MACHINE             EM_UNICORE32
-
 #define CPUArchState                struct CPUUniCore32State
 
 #include "config.h"
Signature · 1 line
1.9.1
#11 lore raw

[Qemu-devel] [PULL v1 12/21] or32: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The only generic code relying on this is linux-user, but linux users' default behaviour of defaulting ELF_MACHINE to ELF_ARCH will handle this.

The bootloader can just pass EM_OPENRISC directly, as that is architecture specific code.

This removes another architecture specific definition from the global namespace.

---

 hw/openrisc/openrisc_sim.c | 2 +-
 target-openrisc/cpu.h      | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
hw/openrisc/openrisc_sim.c +1 -1
index 1da0657..fb6d8ea 100644
@@ -68,7 +68,7 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,
 
     if (kernel_filename && !qtest_enabled()) {
         kernel_size = load_elf(kernel_filename, NULL, NULL,
-                               &elf_entry, NULL, NULL, 1, ELF_MACHINE, 1);
+                               &elf_entry, NULL, NULL, 1, EM_OPENRISC, 1);
         entry = elf_entry;
         if (kernel_size < 0) {
             kernel_size = load_uimage(kernel_filename,
target-openrisc/cpu.h +0 -1
index 36c4f20..ac8b969 100644
@@ -21,7 +21,6 @@
 #define CPU_OPENRISC_H
 
 #define TARGET_LONG_BITS 32
-#define ELF_MACHINE    EM_OPENRISC
 
 #define CPUArchState struct CPUOpenRISCState
 
Signature · 1 line
1.9.1
#12 lore raw

[Qemu-devel] [PULL v1 13/21] tricore: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The bootloader can just pass EM_TRICORE directly, as that is architecture specific code.

This removes another architecture specific definition from the global namespace.

---

 hw/tricore/tricore_testboard.c | 2 +-
 target-tricore/cpu.h           | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
hw/tricore/tricore_testboard.c +1 -1
index a059a20..62b406b 100644
@@ -44,7 +44,7 @@ static void tricore_load_kernel(CPUTriCoreState *env)
     kernel_size = load_elf(tricoretb_binfo.kernel_filename, NULL,
                            NULL, (uint64_t *)&entry, NULL,
                            NULL, 0,
-                           ELF_MACHINE, 1);
+                           EM_TRICORE, 1);
     if (kernel_size <= 0) {
         error_report("qemu: no kernel file '%s'",
                 tricoretb_binfo.kernel_filename);
target-tricore/cpu.h +0 -2
index 916ee27..a72a7d8 100644
@@ -25,8 +25,6 @@
 #include "exec/cpu-defs.h"
 #include "fpu/softfloat.h"
 
-#define ELF_MACHINE     EM_TRICORE
-
 #define CPUArchState struct CPUTriCoreState
 
 struct CPUTriCoreState;
Signature · 1 line
1.9.1
#13 lore raw

[Qemu-devel] [PULL v1 14/21] xtensa: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The bootloaders can just pass EM_XTENSA directly, as that is architecture specific code.

This removes another architecture specific definition from the global namespace.

---

 hw/xtensa/sim.c     | 4 ++--
 hw/xtensa/xtfpga.c  | 2 +-
 target-xtensa/cpu.h | 1 -
 3 files changed, 3 insertions(+), 4 deletions(-)
hw/xtensa/sim.c +2 -2
index 328d209..8bd0c22 100644
@@ -93,10 +93,10 @@ static void xtensa_sim_init(MachineState *machine)
         uint64_t elf_lowaddr;
 #ifdef TARGET_WORDS_BIGENDIAN
         int success = load_elf(kernel_filename, translate_phys_addr, cpu,
-                &elf_entry, &elf_lowaddr, NULL, 1, ELF_MACHINE, 0);
+                &elf_entry, &elf_lowaddr, NULL, 1, EM_XTENSA, 0);
 #else
         int success = load_elf(kernel_filename, translate_phys_addr, cpu,
-                &elf_entry, &elf_lowaddr, NULL, 0, ELF_MACHINE, 0);
+                &elf_entry, &elf_lowaddr, NULL, 0, EM_XTENSA, 0);
 #endif
         if (success > 0) {
             env->pc = elf_entry;
hw/xtensa/xtfpga.c +1 -1
index ab4d0e4..ba67035 100644
@@ -340,7 +340,7 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)
         uint64_t elf_entry;
         uint64_t elf_lowaddr;
         int success = load_elf(kernel_filename, translate_phys_addr, cpu,
-                &elf_entry, &elf_lowaddr, NULL, be, ELF_MACHINE, 0);
+                &elf_entry, &elf_lowaddr, NULL, be, EM_XTENSA, 0);
         if (success > 0) {
             entry_point = elf_entry;
         } else {
target-xtensa/cpu.h +0 -1
index 96bfc82..4ec005e 100644
@@ -30,7 +30,6 @@
 
 #define ALIGNED_ONLY
 #define TARGET_LONG_BITS 32
-#define ELF_MACHINE EM_XTENSA
 
 #define CPUArchState struct CPUXtensaState
 
Signature · 1 line
1.9.1
#14 lore raw

[Qemu-devel] [PULL v1 15/21] sh4: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The only generic code relying on this is linux-user, but linux users' default behaviour of defaulting ELF_MACHINE to ELF_ARCH will handle this.

This removes another architecture specific definition from the global namespace.

---

 target-sh4/cpu.h | 2 --
 1 file changed, 2 deletions(-)
target-sh4/cpu.h +0 -2
index 34bb3d7..e2913b8 100644
@@ -24,8 +24,6 @@
 
 #define TARGET_LONG_BITS 32
 
-#define ELF_MACHINE	EM_SH
-
 /* CPU Subtypes */
 #define SH_CPU_SH7750  (1 << 0)
 #define SH_CPU_SH7750S (1 << 1)
Signature · 1 line
1.9.1
#15 lore raw

[Qemu-devel] [PULL v1 16/21] s390: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The bootloader can just pass EM_S390 directly, as that is architecture specific code.

This removes another architecture specific definition from the global namespace.

---

 hw/s390x/ipl.c     | 4 ++--
 target-s390x/cpu.h | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
hw/s390x/ipl.c +2 -2
index 2e0a8b6..31473e7 100644
@@ -132,7 +132,7 @@ static int s390_ipl_init(SysBusDevice *dev)
 
         bios_size = load_elf(bios_filename, bios_translate_addr, &fwbase,
                              &ipl->bios_start_addr, NULL, NULL, 1,
-                             ELF_MACHINE, 0);
+                             EM_S390, 0);
         if (bios_size > 0) {
             /* Adjust ELF start address to final location */
             ipl->bios_start_addr += fwbase;
@@ -154,7 +154,7 @@ static int s390_ipl_init(SysBusDevice *dev)
 
     if (ipl->kernel) {
         kernel_size = load_elf(ipl->kernel, NULL, NULL, &pentry, NULL,
-                               NULL, 1, ELF_MACHINE, 0);
+                               NULL, 1, EM_S390, 0);
         if (kernel_size < 0) {
             kernel_size = load_image_targphys(ipl->kernel, 0, ram_size);
         }
target-s390x/cpu.h +0 -1
index b650890..6ff0bae 100644
@@ -27,7 +27,6 @@
 
 #define TARGET_LONG_BITS 64
 
-#define ELF_MACHINE	EM_S390
 #define ELF_MACHINE_UNAME "S390X"
 
 #define CPUArchState struct CPUS390XState
Signature · 1 line
1.9.1
#16 lore raw

[Qemu-devel] [PULL v1 17/21] sparc: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The bootloaders can just pass EM_SPARC or EM_SPARCV9 directly, as they are architecture specific code (to one or the other).

This removes another architecture specific definition from the global namespace.

---

 hw/sparc/leon3.c   | 2 +-
 hw/sparc/sun4m.c   | 4 ++--
 hw/sparc64/sun4u.c | 4 ++--
 target-sparc/cpu.h | 6 ------
 4 files changed, 5 insertions(+), 11 deletions(-)
hw/sparc/leon3.c +1 -1
index 7f5dcd6..2d7ec76 100644
@@ -193,7 +193,7 @@ static void leon3_generic_hw_init(MachineState *machine)
         uint64_t entry;
 
         kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL,
-                               1 /* big endian */, ELF_MACHINE, 0);
+                               1 /* big endian */, EM_SPARC, 0);
         if (kernel_size < 0) {
             fprintf(stderr, "qemu: could not load kernel '%s'\n",
                     kernel_filename);
hw/sparc/sun4m.c +2 -2
index 68ac4d8..6eb7ef8 100644
@@ -300,7 +300,7 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
         bswap_needed = 0;
 #endif
         kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
-                               NULL, NULL, NULL, 1, ELF_MACHINE, 0);
+                               NULL, NULL, NULL, 1, EM_SPARC, 0);
         if (kernel_size < 0)
             kernel_size = load_aout(kernel_filename, KERNEL_LOAD_ADDR,
                                     RAM_size - KERNEL_LOAD_ADDR, bswap_needed,
@@ -744,7 +744,7 @@ static void prom_init(hwaddr addr, const char *bios_name)
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
     if (filename) {
         ret = load_elf(filename, translate_prom_address, &addr, NULL,
-                       NULL, NULL, 1, ELF_MACHINE, 0);
+                       NULL, NULL, 1, EM_SPARC, 0);
         if (ret < 0 || ret > PROM_SIZE_MAX) {
             ret = load_image_targphys(filename, addr, PROM_SIZE_MAX);
         }
hw/sparc64/sun4u.c +2 -2
index 30cfa0e..d359cb8 100644
@@ -208,7 +208,7 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename,
         bswap_needed = 0;
 #endif
         kernel_size = load_elf(kernel_filename, NULL, NULL, kernel_entry,
-                               kernel_addr, &kernel_top, 1, ELF_MACHINE, 0);
+                               kernel_addr, &kernel_top, 1, EM_SPARCV9, 0);
         if (kernel_size < 0) {
             *kernel_addr = KERNEL_LOAD_ADDR;
             *kernel_entry = KERNEL_LOAD_ADDR;
@@ -671,7 +671,7 @@ static void prom_init(hwaddr addr, const char *bios_name)
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
     if (filename) {
         ret = load_elf(filename, translate_prom_address, &addr,
-                       NULL, NULL, NULL, 1, ELF_MACHINE, 0);
+                       NULL, NULL, NULL, 1, EM_SPARCV9, 0);
         if (ret < 0 || ret > PROM_SIZE_MAX) {
             ret = load_image_targphys(filename, addr, PROM_SIZE_MAX);
         }
target-sparc/cpu.h +0 -6
index 0522b65..b5ff644 100644
@@ -31,12 +31,6 @@
 
 #include "fpu/softfloat.h"
 
-#if !defined(TARGET_SPARC64)
-#define ELF_MACHINE     EM_SPARC
-#else
-#define ELF_MACHINE     EM_SPARCV9
-#endif
-
 /*#define EXCP_INTERRUPT 0x100*/
 
 /* trap definitions */
Signature · 1 line
1.9.1
#17 lore raw

[Qemu-devel] [PULL v1 18/21] mips: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

The only generic code relying on this is linux-user, but linux users' default behaviour of defaulting ELF_MACHINE to ELF_ARCH will handle this.

The bootloaders can just pass EM_MIPS directly, as that is architecture specific code.

This removes another architecture specific definition from the global namespace.

---

 hw/mips/mips_fulong2e.c | 2 +-
 hw/mips/mips_malta.c    | 2 +-
 hw/mips/mips_mipssim.c  | 2 +-
 hw/mips/mips_r4k.c      | 2 +-
 target-mips/cpu.h       | 2 --
 5 files changed, 4 insertions(+), 6 deletions(-)
hw/mips/mips_fulong2e.c +1 -1
index dea941a..a6c746a 100644
@@ -116,7 +116,7 @@ static int64_t load_kernel (CPUMIPSState *env)
 
     if (load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, NULL,
                  (uint64_t *)&kernel_entry, (uint64_t *)&kernel_low,
-                 (uint64_t *)&kernel_high, 0, ELF_MACHINE, 1) < 0) {
+                 (uint64_t *)&kernel_high, 0, EM_MIPS, 1) < 0) {
         fprintf(stderr, "qemu: could not load kernel '%s'\n",
                 loaderparams.kernel_filename);
         exit(1);
hw/mips/mips_malta.c +1 -1
index 3082e75..bf477b6 100644
@@ -795,7 +795,7 @@ static int64_t load_kernel (void)
 
     if (load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, NULL,
                  (uint64_t *)&kernel_entry, NULL, (uint64_t *)&kernel_high,
-                 big_endian, ELF_MACHINE, 1) < 0) {
+                 big_endian, EM_MIPS, 1) < 0) {
         fprintf(stderr, "qemu: could not load kernel '%s'\n",
                 loaderparams.kernel_filename);
         exit(1);
hw/mips/mips_mipssim.c +1 -1
index 61f74a6..b08667d 100644
@@ -69,7 +69,7 @@ static int64_t load_kernel(void)
     kernel_size = load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys,
                            NULL, (uint64_t *)&entry, NULL,
                            (uint64_t *)&kernel_high, big_endian,
-                           ELF_MACHINE, 1);
+                           EM_MIPS, 1);
     if (kernel_size >= 0) {
         if ((entry & ~0x7fffffffULL) == 0x80000000)
             entry = (int32_t)entry;
hw/mips/mips_r4k.c +1 -1
index f4dcacd..239a9fd 100644
@@ -87,7 +87,7 @@ static int64_t load_kernel(void)
     kernel_size = load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys,
                            NULL, (uint64_t *)&entry, NULL,
                            (uint64_t *)&kernel_high, big_endian,
-                           ELF_MACHINE, 1);
+                           EM_MIPS, 1);
     if (kernel_size >= 0) {
         if ((entry & ~0x7fffffffULL) == 0x80000000)
             entry = (int32_t)entry;
target-mips/cpu.h +0 -2
index c91883d..258cccd 100644
@@ -5,8 +5,6 @@
 
 #define ALIGNED_ONLY
 
-#define ELF_MACHINE	EM_MIPS
-
 #define CPUArchState struct CPUMIPSState
 
 #include "config.h"
Signature · 1 line
1.9.1
#18 lore raw

[Qemu-devel] [PULL v1 19/21] alpha: Remove ELF_MACHINE from cpu.h

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

ELF_MACHINE is unused by target alpha.

---

 target-alpha/cpu.h | 2 --
 1 file changed, 2 deletions(-)
target-alpha/cpu.h +0 -2
index 3f1ece3..b9e9907 100644
@@ -32,8 +32,6 @@
 
 #include "fpu/softfloat.h"
 
-#define ELF_MACHINE     EM_ALPHA
-
 #define ICACHE_LINE_SIZE 32
 #define DCACHE_LINE_SIZE 32
 
Signature · 1 line
1.9.1
#19 lore raw

[Qemu-devel] [PULL v1 20/21] i386: Rename ELF_MACHINE to be x86 specific

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

Rename ELF_MACHINE to be I386 specific. This is used as-is by the multiboot loader.

Linux-user previously used this definition but will not anymore, falling back to the default bahaviour of using ELF_ARCH as ELF_MACHINE.

This removes another architecture specific definition from the global namespace.

---

 hw/i386/multiboot.c | 2 +-
 target-i386/cpu.h   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
hw/i386/multiboot.c +1 -1
index 1adbe9e..6774a19 100644
@@ -195,7 +195,7 @@ int load_multiboot(FWCfgState *fw_cfg,
         }
 
         kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
-                               &elf_low, &elf_high, 0, ELF_MACHINE, 0);
+                               &elf_low, &elf_high, 0, I386_ELF_MACHINE, 0);
         if (kernel_size < 0) {
             fprintf(stderr, "Error while loading elf kernel\n");
             exit(1);
target-i386/cpu.h +2 -2
index 74b674d..bec5e72 100644
@@ -36,10 +36,10 @@
 #define TARGET_HAS_PRECISE_SMC
 
 #ifdef TARGET_X86_64
-#define ELF_MACHINE     EM_X86_64
+#define I386_ELF_MACHINE  EM_X86_64
 #define ELF_MACHINE_UNAME "x86_64"
 #else
-#define ELF_MACHINE     EM_386
+#define I386_ELF_MACHINE  EM_386
 #define ELF_MACHINE_UNAME "i686"
 #endif
 
Signature · 1 line
1.9.1
#20 lore raw

[Qemu-devel] [PULL v1 21/21] ppc: Rename ELF_MACHINE to be PPC specific

In reply to Peter Crosthwaite

From: Peter Crosthwaite <[email protected]>

Rename ELF_MACHINE to be PPC specific. This is used as-is by the various PPC bootloaders and is locally defined to ELF_MACHINE in linux user in PPC specific ifdeffery.

This removes another architecture specific definition from the global namespace (as desired by multi-arch).

---

 hw/ppc/e500.c          | 2 +-
 hw/ppc/mac_newworld.c  | 4 ++--
 hw/ppc/mac_oldworld.c  | 4 ++--
 hw/ppc/ppc440_bamboo.c | 2 +-
 hw/ppc/prep.c          | 2 +-
 hw/ppc/spapr.c         | 4 ++--
 hw/ppc/virtex_ml507.c  | 2 +-
 linux-user/elfload.c   | 1 +
 target-ppc/cpu.h       | 4 ++--
 9 files changed, 13 insertions(+), 12 deletions(-)
hw/ppc/e500.c +1 -1
index d300846..8b45bf6 100644
@@ -1017,7 +1017,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
 
     bios_size = load_elf(filename, NULL, NULL, &bios_entry, &loadaddr, NULL,
-                         1, ELF_MACHINE, 0);
+                         1, PPC_ELF_MACHINE, 0);
     if (bios_size < 0) {
         /*
          * Hrm. No ELF image? Try a uImage, maybe someone is giving us an
hw/ppc/mac_newworld.c +2 -2
index 77d5c81..81d744c 100644
@@ -219,7 +219,7 @@ static void ppc_core99_init(MachineState *machine)
     /* Load OpenBIOS (ELF) */
     if (filename) {
         bios_size = load_elf(filename, NULL, NULL, NULL,
-                             NULL, NULL, 1, ELF_MACHINE, 0);
+                             NULL, NULL, 1, PPC_ELF_MACHINE, 0);
 
         g_free(filename);
     } else {
@@ -242,7 +242,7 @@ static void ppc_core99_init(MachineState *machine)
         kernel_base = KERNEL_LOAD_ADDR;
 
         kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
-                               NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0);
+                               NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE, 0);
         if (kernel_size < 0)
             kernel_size = load_aout(kernel_filename, kernel_base,
                                     ram_size - kernel_base, bswap_needed,
hw/ppc/mac_oldworld.c +2 -2
index 06fdbaf..00cb080 100644
@@ -147,7 +147,7 @@ static void ppc_heathrow_init(MachineState *machine)
     /* Load OpenBIOS (ELF) */
     if (filename) {
         bios_size = load_elf(filename, 0, NULL, NULL, NULL, NULL,
-                             1, ELF_MACHINE, 0);
+                             1, PPC_ELF_MACHINE, 0);
         g_free(filename);
     } else {
         bios_size = -1;
@@ -168,7 +168,7 @@ static void ppc_heathrow_init(MachineState *machine)
 #endif
         kernel_base = KERNEL_LOAD_ADDR;
         kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
-                               NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0);
+                               NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE, 0);
         if (kernel_size < 0)
             kernel_size = load_aout(kernel_filename, kernel_base,
                                     ram_size - kernel_base, bswap_needed,
hw/ppc/ppc440_bamboo.c +1 -1
index 032fa80..c54f79d 100644
@@ -256,7 +256,7 @@ static void bamboo_init(MachineState *machine)
                               NULL, NULL);
         if (success < 0) {
             success = load_elf(kernel_filename, NULL, NULL, &elf_entry,
-                               &elf_lowaddr, NULL, 1, ELF_MACHINE, 0);
+                               &elf_lowaddr, NULL, 1, PPC_ELF_MACHINE, 0);
             entry = elf_entry;
             loadaddr = elf_lowaddr;
         }
hw/ppc/prep.c +1 -1
index 45b5f62..b421bff 100644
@@ -610,7 +610,7 @@ static void ppc_prep_init(MachineState *machine)
         bios_name = BIOS_FILENAME;
     }
     qdev_prop_set_string(dev, "bios-name", bios_name);
-    qdev_prop_set_uint32(dev, "elf-machine", ELF_MACHINE);
+    qdev_prop_set_uint32(dev, "elf-machine", PPC_ELF_MACHINE);
     pcihost = PCI_HOST_BRIDGE(dev);
     object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev), NULL);
     qdev_init_nofail(dev);
hw/ppc/spapr.c +2 -2
index bf0c64f..4500497 100644
@@ -1636,11 +1636,11 @@ static void ppc_spapr_init(MachineState *machine)
         uint64_t lowaddr = 0;
 
         kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
-                               NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0);
+                               NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE, 0);
         if (kernel_size == ELF_LOAD_WRONG_ENDIAN) {
             kernel_size = load_elf(kernel_filename,
                                    translate_kernel_address, NULL,
-                                   NULL, &lowaddr, NULL, 0, ELF_MACHINE, 0);
+                                   NULL, &lowaddr, NULL, 0, PPC_ELF_MACHINE, 0);
             kernel_le = kernel_size > 0;
         }
         if (kernel_size < 0) {
hw/ppc/virtex_ml507.c +1 -1
index de86f7c..d3cf437 100644
@@ -257,7 +257,7 @@ static void virtex_init(MachineState *machine)
 
         /* Boots a kernel elf binary.  */
         kernel_size = load_elf(kernel_filename, NULL, NULL,
-                               &entry, &low, &high, 1, ELF_MACHINE, 0);
+                               &entry, &low, &high, 1, PPC_ELF_MACHINE, 0);
         boot_info.bootstrap_pc = entry & 0x00ffffff;
 
         if (kernel_size < 0) {
linux-user/elfload.c +1 -0
index 49791a8..8c11d81 100644
@@ -678,6 +678,7 @@ static inline void init_thread(struct target_pt_regs *regs,
 
 #ifdef TARGET_PPC
 
+#define ELF_MACHINE    PPC_ELF_MACHINE
 #define ELF_START_MMAP 0x80000000
 
 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
target-ppc/cpu.h +2 -2
index 6f76674..2bb3934 100644
@@ -81,9 +81,9 @@
 #include "fpu/softfloat.h"
 
 #if defined (TARGET_PPC64)
-#define ELF_MACHINE     EM_PPC64
+#define PPC_ELF_MACHINE     EM_PPC64
 #else
-#define ELF_MACHINE     EM_PPC
+#define PPC_ELF_MACHINE     EM_PPC
 #endif
 
 /*****************************************************************************/
Signature · 1 line
1.9.1
#21 lore raw
In reply to Peter Crosthwaite
Quoted 12 lines · Peter Crosthwaite

Flush of multi-arch pre-requisite work.

----------------------------------------
multi-arch queue:
* add EM_MOXIE
* Cleanup ELF_MACHINE and remove from cpu.h
----------------------------------------

The following changes since commit 9d34158a5af734e8de0b42b0a7228200c426a8d0:

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20150907' into staging (2015-09-07 16:07:47 +0100)

Quoted 8 lines

are available in the git repository at:

git://github.com/pcrost/qemu multi-arch.1.2015.09.07

for you to fetch changes up to f4290e0cf89fa512df44e607f239d46e73d46576:

ppc: Rename ELF_MACHINE to be PPC specific (2015-09-07 23:59:28 -0700)

Hi. This looks like it's a branch, not a gpg signed tag? I only take signed pullreqs these days...

thanks
-- PMM

#22 lore raw
Quoted 17 lines · Peter Maydell
Quoted 15 lines · Peter Crosthwaite

Flush of multi-arch pre-requisite work.

----------------------------------------
multi-arch queue:
* add EM_MOXIE
* Cleanup ELF_MACHINE and remove from cpu.h
----------------------------------------

The following changes since commit 9d34158a5af734e8de0b42b0a7228200c426a8d0:

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20150907' into staging (2015-09-07 16:07:47 +0100)

are available in the git repository at:

Quoted 9 lines
Quoted 5 lines

git://github.com/pcrost/qemu multi-arch.1.2015.09.07

for you to fetch changes up to f4290e0cf89fa512df44e607f239d46e73d46576:

ppc: Rename ELF_MACHINE to be PPC specific (2015-09-07 23:59:28 -0700)

Hi. This looks like it's a branch, not a gpg signed tag? I only take signed pullreqs these days...

OK

Regards,
Peter

Quoted 2 lines

thanks
-- PMM

#23 lore raw
Quoted 4 lines · Peter Crosthwaite
Quoted 2 lines

Hi. This looks like it's a branch, not a gpg signed tag? I only take signed pullreqs these days...

OK

I'll take these patches then until you sort out the GPG signing (I see you have created a GPG key 96CF610A).

Paolo

#24 lore raw
Quoted 10 lines · Paolo Bonzini
Quoted 4 lines · Peter Crosthwaite
Quoted 2 lines

Hi. This looks like it's a branch, not a gpg signed tag? I only take signed pullreqs these days...

OK

I'll take these patches then until you sort out the GPG signing (I see you have created a GPG key 96CF610A).

Note that my current requirement is that the pull be a signed tag, but not (yet) that the key used to sign it have a trust path from me to it...

(As it happens I expect to be able to sign Peter C's key today.)

-- PMM