From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZePAI-0002G0-ES for qemu-devel@nongnu.org; Tue, 22 Sep 2015 11:07:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZePAH-0001C4-HY for qemu-devel@nongnu.org; Tue, 22 Sep 2015 11:07:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60306) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZePAH-0001By-D3 for qemu-devel@nongnu.org; Tue, 22 Sep 2015 11:07:29 -0400 From: Paolo Bonzini Date: Tue, 22 Sep 2015 17:05:54 +0200 Message-Id: <1442934371-12567-32-git-send-email-pbonzini@redhat.com> In-Reply-To: <1442934371-12567-1-git-send-email-pbonzini@redhat.com> References: <1442934371-12567-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 31/48] elf: Update EM_MOXIE definition List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Green , Peter Crosthwaite From: 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. Cc: Anthony Green Reviewed-by: Richard Henderson Signed-off-by: Peter Crosthwaite Signed-off-by: Paolo Bonzini --- 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 a3d1a1b..4e98c20 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 79859f0..66add81 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 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 15ca15b..7d47e0d 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 -- 2.5.0