summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Crosthwaite <crosthwaite.peter@gmail.com>2015-08-29 12:07:50 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2015-09-25 12:04:43 +0200
commit98dbe5aca8c328b40a0598d6ab478d9b869d1b5c (patch)
tree485550bc960aa2d754ebac060da4bfc70cdf463f
parent7cc472218c807ef85714ec71b161c39ee29d634e (diff)
downloadfocaccia-qemu-98dbe5aca8c328b40a0598d6ab478d9b869d1b5c.tar.gz
focaccia-qemu-98dbe5aca8c328b40a0598d6ab478d9b869d1b5c.zip
elf: Update EM_MOXIE definition
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>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--hw/moxie/moxiesim.c1
-rw-r--r--include/elf.h3
-rw-r--r--include/hw/elf_ops.h8
-rw-r--r--target-moxie/cpu.h2
4 files changed, 13 insertions, 1 deletions
diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
index a3d1a1ba2a..4e98c20f23 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 79859f0cd8..66add810df 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -135,6 +135,9 @@ typedef int64_t  Elf64_Sxword;
 
 #define EM_TILEGX   191 /* TILE-Gx */
 
+#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 0d41f249a0..0010c441d9 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 15ca15bf53..7d47e0d956 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