qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v1 00/21]  Multi-arch queue
@ 2015-09-11  5:44 Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 01/21] linux_user: elfload: Default ELF_MACHINE to ELF_ARCH Peter Crosthwaite
                   ` (20 more replies)
  0 siblings, 21 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Peter Crosthwaite, peter.maydell

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(-)

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 01/21] linux_user: elfload: Default ELF_MACHINE to ELF_ARCH
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 02/21] linux-user: elfload: Provide default for elf_check_arch Peter Crosthwaite
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Peter Crosthwaite, peter.maydell

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.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 linux-user/elfload.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 9c999ac..518ff05 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 02/21] linux-user: elfload: Provide default for elf_check_arch
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 01/21] linux_user: elfload: Default ELF_MACHINE to ELF_ARCH Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 03/21] elf_ops: Fix coding style for EM alias case statement Peter Crosthwaite
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Peter Crosthwaite, peter.maydell

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.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 linux-user/elfload.c | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 518ff05..1f4c054 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 03/21] elf_ops: Fix coding style for EM alias case statement
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 01/21] linux_user: elfload: Default ELF_MACHINE to ELF_ARCH Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 02/21] linux-user: elfload: Provide default for elf_check_arch Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 04/21] elf: Update EM_MOXIE definition Peter Crosthwaite
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Peter Crosthwaite, peter.maydell

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

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 include/hw/elf_ops.h | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
index bd71968..0d41f24 100644
--- a/include/hw/elf_ops.h
+++ b/include/hw/elf_ops.h
@@ -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) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 04/21] elf: Update EM_MOXIE definition
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (2 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 03/21] elf_ops: Fix coding style for EM alias case statement Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 05/21] arm: Remove ELF_MACHINE from cpu.h Peter Crosthwaite
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Anthony Green, Peter Crosthwaite, peter.maydell

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.

Cc: Anthony Green <green@moxielogic.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 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(-)

diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
index 80bcc5b..537e25e 100644
--- a/hw/moxie/moxiesim.c
+++ b/hw/moxie/moxiesim.c
@@ -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
 
diff --git a/include/elf.h b/include/elf.h
index 4afd474..295a6ea 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -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
diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
index 0d41f24..0010c44 100644
--- a/include/hw/elf_ops.h
+++ b/include/hw/elf_ops.h
@@ -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;
diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h
index 29572aa..7bb1ed9 100644
--- a/target-moxie/cpu.h
+++ b/target-moxie/cpu.h
@@ -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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 05/21] arm: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (3 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 04/21] elf: Update EM_MOXIE definition Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 06/21] mb: " Peter Crosthwaite
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Peter Crosthwaite, Peter Crosthwaite, peter.maydell

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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.

Cc: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 hw/arm/armv7m.c      | 2 +-
 linux-user/elfload.c | 4 ++--
 target-arm/cpu.h     | 2 --
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index c6eab6d..ad89073 100644
--- a/hw/arm/armv7m.c
+++ b/hw/arm/armv7m.c
@@ -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;
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 1f4c054..49791a8 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -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"
 
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 4bd5dc8..ff9964a 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 06/21] mb: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (4 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 05/21] arm: Remove ELF_MACHINE from cpu.h Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 07/21] m68k: " Peter Crosthwaite
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, Peter Crosthwaite, Peter Crosthwaite, Edgar E. Iglesias,
	peter.maydell

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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.

Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 hw/microblaze/boot.c    | 4 ++--
 target-microblaze/cpu.h | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
index 3e8820f..d7eaa1f 100644
--- a/hw/microblaze/boot.c
+++ b/hw/microblaze/boot.c
@@ -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;
diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h
index 7e20e59..b49dcf4 100644
--- a/target-microblaze/cpu.h
+++ b/target-microblaze/cpu.h
@@ -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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 07/21] m68k: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (5 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 06/21] mb: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 08/21] cris: " Peter Crosthwaite
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, Peter Crosthwaite, Laurent Vivier,
	Peter Crosthwaite, Greg Ungerer, pbonzini

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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.

Cc: Laurent Vivier <laurent@vivier.eu>
Cc: Greg Ungerer <gerg@uclinux.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Reviewed-by: Greg Ungerer <gerg@uclinux.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 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(-)

diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c
index f63ab2b..59e89fe 100644
--- a/hw/m68k/an5206.c
+++ b/hw/m68k/an5206.c
@@ -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,
diff --git a/hw/m68k/dummy_m68k.c b/hw/m68k/dummy_m68k.c
index 5b77d93..3463913 100644
--- a/hw/m68k/dummy_m68k.c
+++ b/hw/m68k/dummy_m68k.c
@@ -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,
diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index 326a42d..cb57cf9 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -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,
diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h
index 9a62f6c..ebbbeef 100644
--- a/target-m68k/cpu.h
+++ b/target-m68k/cpu.h
@@ -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.  */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 08/21] cris: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (6 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 07/21] m68k: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 09/21] moxie: " Peter Crosthwaite
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, Peter Crosthwaite, Peter Crosthwaite, Edgar E. Iglesias,
	peter.maydell

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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.

Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 hw/cris/boot.c    | 2 +-
 target-cris/cpu.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/cris/boot.c b/hw/cris/boot.c
index 622f353..1cfa339 100644
--- a/hw/cris/boot.c
+++ b/hw/cris/boot.c
@@ -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.  */
diff --git a/target-cris/cpu.h b/target-cris/cpu.h
index d422e35..c22d16c 100644
--- a/target-cris/cpu.h
+++ b/target-cris/cpu.h
@@ -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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 09/21] moxie: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (7 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 08/21] cris: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 10/21] unicore: " Peter Crosthwaite
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, Peter Crosthwaite, Peter Crosthwaite, Anthony Green,
	peter.maydell

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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

This removes another architecture specific definition from the global
namespace.

Cc: Anthony Green <green@moxielogic.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
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(-)

diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
index 537e25e..83b45f1 100644
--- a/hw/moxie/moxiesim.c
+++ b/hw/moxie/moxiesim.c
@@ -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",
diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h
index 7bb1ed9..e27a6a3 100644
--- a/target-moxie/cpu.h
+++ b/target-moxie/cpu.h
@@ -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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 10/21] unicore: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (8 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 09/21] moxie: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 12/21] or32: " Peter Crosthwaite
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, Peter Crosthwaite, Guan Xuetao, Peter Crosthwaite,
	peter.maydell

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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.

Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 target-unicore32/cpu.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/target-unicore32/cpu.h b/target-unicore32/cpu.h
index 45e31e5..3c06996 100644
--- a/target-unicore32/cpu.h
+++ b/target-unicore32/cpu.h
@@ -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"
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 12/21] or32: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (9 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 10/21] unicore: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 13/21] tricore: " Peter Crosthwaite
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, Peter Crosthwaite, Peter Crosthwaite, Jia Liu,
	peter.maydell

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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.

Cc: Jia Liu <proljc@gmail.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 hw/openrisc/openrisc_sim.c | 2 +-
 target-openrisc/cpu.h      | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index 1da0657..fb6d8ea 100644
--- a/hw/openrisc/openrisc_sim.c
+++ b/hw/openrisc/openrisc_sim.c
@@ -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,
diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h
index 36c4f20..ac8b969 100644
--- a/target-openrisc/cpu.h
+++ b/target-openrisc/cpu.h
@@ -21,7 +21,6 @@
 #define CPU_OPENRISC_H
 
 #define TARGET_LONG_BITS 32
-#define ELF_MACHINE    EM_OPENRISC
 
 #define CPUArchState struct CPUOpenRISCState
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 13/21] tricore: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (10 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 12/21] or32: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 14/21] xtensa: " Peter Crosthwaite
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, Peter Crosthwaite, Bastian Koppelmann,
	Peter Crosthwaite, peter.maydell

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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

This removes another architecture specific definition from the global
namespace.

Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Acked-By: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 hw/tricore/tricore_testboard.c | 2 +-
 target-tricore/cpu.h           | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c
index a059a20..62b406b 100644
--- a/hw/tricore/tricore_testboard.c
+++ b/hw/tricore/tricore_testboard.c
@@ -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);
diff --git a/target-tricore/cpu.h b/target-tricore/cpu.h
index 916ee27..a72a7d8 100644
--- a/target-tricore/cpu.h
+++ b/target-tricore/cpu.h
@@ -25,8 +25,6 @@
 #include "exec/cpu-defs.h"
 #include "fpu/softfloat.h"
 
-#define ELF_MACHINE     EM_TRICORE
-
 #define CPUArchState struct CPUTriCoreState
 
 struct CPUTriCoreState;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 14/21] xtensa: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (11 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 13/21] tricore: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 15/21] sh4: " Peter Crosthwaite
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Max Filippov, pbonzini, Peter Crosthwaite, Peter Crosthwaite,
	peter.maydell

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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

This removes another architecture specific definition from the global
namespace.

Cc: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 hw/xtensa/sim.c     | 4 ++--
 hw/xtensa/xtfpga.c  | 2 +-
 target-xtensa/cpu.h | 1 -
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c
index 328d209..8bd0c22 100644
--- a/hw/xtensa/sim.c
+++ b/hw/xtensa/sim.c
@@ -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;
diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index ab4d0e4..ba67035 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -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 {
diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h
index 96bfc82..4ec005e 100644
--- a/target-xtensa/cpu.h
+++ b/target-xtensa/cpu.h
@@ -30,7 +30,6 @@
 
 #define ALIGNED_ONLY
 #define TARGET_LONG_BITS 32
-#define ELF_MACHINE EM_XTENSA
 
 #define CPUArchState struct CPUXtensaState
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 15/21] sh4: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (12 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 14/21] xtensa: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 16/21] s390: " Peter Crosthwaite
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, Peter Crosthwaite, Peter Crosthwaite, Aurelien Jarno,
	peter.maydell

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 target-sh4/cpu.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h
index 34bb3d7..e2913b8 100644
--- a/target-sh4/cpu.h
+++ b/target-sh4/cpu.h
@@ -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)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 16/21] s390: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (13 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 15/21] sh4: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 17/21] sparc: " Peter Crosthwaite
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, Peter Crosthwaite, Alexander Graf,
	Peter Crosthwaite, pbonzini, Richard Henderson

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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

This removes another architecture specific definition from the global
namespace.

Cc: Richard Henderson <rth@twiddle.net>
Cc: Alexander Graf <agraf@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 hw/s390x/ipl.c     | 4 ++--
 target-s390x/cpu.h | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index 2e0a8b6..31473e7 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -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);
         }
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index b650890..6ff0bae 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -27,7 +27,6 @@
 
 #define TARGET_LONG_BITS 64
 
-#define ELF_MACHINE	EM_S390
 #define ELF_MACHINE_UNAME "S390X"
 
 #define CPUArchState struct CPUS390XState
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 17/21] sparc: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (14 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 16/21] s390: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 18/21] mips: " Peter Crosthwaite
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, Peter Crosthwaite, Peter Crosthwaite, Mark Cave-Ayland,
	peter.maydell

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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.

Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 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(-)

diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index 7f5dcd6..2d7ec76 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -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);
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 68ac4d8..6eb7ef8 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -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);
         }
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 30cfa0e..d359cb8 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -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);
         }
diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h
index 0522b65..b5ff644 100644
--- a/target-sparc/cpu.h
+++ b/target-sparc/cpu.h
@@ -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 */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 18/21] mips: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (15 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 17/21] sparc: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 19/21] alpha: " Peter Crosthwaite
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, Peter Crosthwaite, Peter Crosthwaite, pbonzini,
	Leon Alrae, Aurelien Jarno

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 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(-)

diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index dea941a..a6c746a 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -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);
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 3082e75..bf477b6 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -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);
diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c
index 61f74a6..b08667d 100644
--- a/hw/mips/mips_mipssim.c
+++ b/hw/mips/mips_mipssim.c
@@ -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;
diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
index f4dcacd..239a9fd 100644
--- a/hw/mips/mips_r4k.c
+++ b/hw/mips/mips_r4k.c
@@ -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;
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index c91883d..258cccd 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -5,8 +5,6 @@
 
 #define ALIGNED_ONLY
 
-#define ELF_MACHINE	EM_MIPS
-
 #define CPUArchState struct CPUMIPSState
 
 #include "config.h"
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 19/21] alpha: Remove ELF_MACHINE from cpu.h
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (16 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 18/21] mips: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 20/21] i386: Rename ELF_MACHINE to be x86 specific Peter Crosthwaite
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, Peter Crosthwaite, Richard Henderson, Peter Crosthwaite,
	peter.maydell

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

ELF_MACHINE is unused by target alpha.

Cc: Richard Henderson <rth@twiddle.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 target-alpha/cpu.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h
index 3f1ece3..b9e9907 100644
--- a/target-alpha/cpu.h
+++ b/target-alpha/cpu.h
@@ -32,8 +32,6 @@
 
 #include "fpu/softfloat.h"
 
-#define ELF_MACHINE     EM_ALPHA
-
 #define ICACHE_LINE_SIZE 32
 #define DCACHE_LINE_SIZE 32
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 20/21] i386: Rename ELF_MACHINE to be x86 specific
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (17 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 19/21] alpha: " Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 21/21] ppc: Rename ELF_MACHINE to be PPC specific Peter Crosthwaite
  2015-09-11  9:31 ` [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Maydell
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, Eduardo Habkost, Peter Crosthwaite,
	Peter Crosthwaite, pbonzini, Richard Henderson

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 hw/i386/multiboot.c | 2 +-
 target-i386/cpu.h   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
index 1adbe9e..6774a19 100644
--- a/hw/i386/multiboot.c
+++ b/hw/i386/multiboot.c
@@ -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);
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 74b674d..bec5e72 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -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
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Qemu-devel] [PULL v1 21/21] ppc: Rename ELF_MACHINE to be PPC specific
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (18 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 20/21] i386: Rename ELF_MACHINE to be x86 specific Peter Crosthwaite
@ 2015-09-11  5:44 ` Peter Crosthwaite
  2015-09-11  9:31 ` [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Maydell
  20 siblings, 0 replies; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11  5:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, Peter Crosthwaite, Alexander Graf,
	Peter Crosthwaite, qemu-ppc, pbonzini

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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).

Cc: Alexander Graf <agraf@suse.de>
Cc: qemu-ppc@nongnu.org
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-By: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---

 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(-)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index d300846..8b45bf6 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -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
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 77d5c81..81d744c 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -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,
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 06fdbaf..00cb080 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -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,
diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
index 032fa80..c54f79d 100644
--- a/hw/ppc/ppc440_bamboo.c
+++ b/hw/ppc/ppc440_bamboo.c
@@ -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;
         }
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 45b5f62..b421bff 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -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);
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index bf0c64f..4500497 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -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) {
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index de86f7c..d3cf437 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -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) {
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 49791a8..8c11d81 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -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)
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 6f76674..2bb3934 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -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
 
 /*****************************************************************************/
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [Qemu-devel] [PULL v1 00/21] Multi-arch queue
  2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
                   ` (19 preceding siblings ...)
  2015-09-11  5:44 ` [Qemu-devel] [PULL v1 21/21] ppc: Rename ELF_MACHINE to be PPC specific Peter Crosthwaite
@ 2015-09-11  9:31 ` Peter Maydell
  2015-09-11 14:45   ` Peter Crosthwaite
  20 siblings, 1 reply; 25+ messages in thread
From: Peter Maydell @ 2015-09-11  9:31 UTC (permalink / raw)
  To: Peter Crosthwaite; +Cc: Paolo Bonzini, QEMU Developers, Peter Crosthwaite

On 11 September 2015 at 06:44, Peter Crosthwaite
<crosthwaitepeter@gmail.com> wrote:
> 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)

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

thanks
-- PMM

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Qemu-devel] [PULL v1 00/21] Multi-arch queue
  2015-09-11  9:31 ` [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Maydell
@ 2015-09-11 14:45   ` Peter Crosthwaite
  2015-09-22 13:58     ` Paolo Bonzini
  0 siblings, 1 reply; 25+ messages in thread
From: Peter Crosthwaite @ 2015-09-11 14:45 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, QEMU Developers, Peter Crosthwaite

On Fri, Sep 11, 2015 at 2:31 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 11 September 2015 at 06:44, Peter Crosthwaite
> <crosthwaitepeter@gmail.com> wrote:
>> 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)
>
> Hi. This looks like it's a branch, not a gpg signed tag?
> I only take signed pullreqs these days...
>

OK

Regards,
Peter

> thanks
> -- PMM

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Qemu-devel] [PULL v1 00/21] Multi-arch queue
  2015-09-11 14:45   ` Peter Crosthwaite
@ 2015-09-22 13:58     ` Paolo Bonzini
  2015-09-22 14:12       ` Peter Maydell
  0 siblings, 1 reply; 25+ messages in thread
From: Paolo Bonzini @ 2015-09-22 13:58 UTC (permalink / raw)
  To: Peter Crosthwaite, Peter Maydell; +Cc: QEMU Developers, Peter Crosthwaite



On 11/09/2015 16:45, Peter Crosthwaite wrote:
> > 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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Qemu-devel] [PULL v1 00/21] Multi-arch queue
  2015-09-22 13:58     ` Paolo Bonzini
@ 2015-09-22 14:12       ` Peter Maydell
  0 siblings, 0 replies; 25+ messages in thread
From: Peter Maydell @ 2015-09-22 14:12 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Peter Crosthwaite, QEMU Developers, Peter Crosthwaite

On 22 September 2015 at 06:58, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 11/09/2015 16:45, Peter Crosthwaite wrote:
>> > 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

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2015-09-22 14:12 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-11  5:44 [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 01/21] linux_user: elfload: Default ELF_MACHINE to ELF_ARCH Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 02/21] linux-user: elfload: Provide default for elf_check_arch Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 03/21] elf_ops: Fix coding style for EM alias case statement Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 04/21] elf: Update EM_MOXIE definition Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 05/21] arm: Remove ELF_MACHINE from cpu.h Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 06/21] mb: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 07/21] m68k: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 08/21] cris: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 09/21] moxie: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 10/21] unicore: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 12/21] or32: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 13/21] tricore: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 14/21] xtensa: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 15/21] sh4: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 16/21] s390: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 17/21] sparc: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 18/21] mips: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 19/21] alpha: " Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 20/21] i386: Rename ELF_MACHINE to be x86 specific Peter Crosthwaite
2015-09-11  5:44 ` [Qemu-devel] [PULL v1 21/21] ppc: Rename ELF_MACHINE to be PPC specific Peter Crosthwaite
2015-09-11  9:31 ` [Qemu-devel] [PULL v1 00/21] Multi-arch queue Peter Maydell
2015-09-11 14:45   ` Peter Crosthwaite
2015-09-22 13:58     ` Paolo Bonzini
2015-09-22 14:12       ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).