提交 98dbe5ac 编写于 作者: P Peter Crosthwaite 提交者: Paolo Bonzini

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: NRichard Henderson <rth@twiddle.net>
Signed-off-by: NPeter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 7cc47221
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "hw/loader.h" #include "hw/loader.h"
#include "hw/char/serial.h" #include "hw/char/serial.h"
#include "exec/address-spaces.h" #include "exec/address-spaces.h"
#include "elf.h"
#define PHYS_MEM_BASE 0x80000000 #define PHYS_MEM_BASE 0x80000000
......
...@@ -135,6 +135,9 @@ typedef int64_t Elf64_Sxword; ...@@ -135,6 +135,9 @@ typedef int64_t Elf64_Sxword;
#define EM_TILEGX 191 /* TILE-Gx */ #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 */ /* This is the info that is needed to parse the dynamic section of the file */
#define DT_NULL 0 #define DT_NULL 0
#define DT_NEEDED 1 #define DT_NEEDED 1
......
...@@ -305,6 +305,14 @@ static int glue(load_elf, SZ)(const char *name, int fd, ...@@ -305,6 +305,14 @@ static int glue(load_elf, SZ)(const char *name, int fd,
} }
} }
break; 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: default:
if (elf_machine != ehdr.e_machine) { if (elf_machine != ehdr.e_machine) {
ret = ELF_LOAD_WRONG_ARCH; ret = ELF_LOAD_WRONG_ARCH;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#define CPUArchState struct CPUMoxieState #define CPUArchState struct CPUMoxieState
#define ELF_MACHINE 0xFEED /* EM_MOXIE */ #define ELF_MACHINE EM_MOXIE
#define MOXIE_EX_DIV0 0 #define MOXIE_EX_DIV0 0
#define MOXIE_EX_BAD 1 #define MOXIE_EX_BAD 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册