From patchwork Fri Sep 11 05:44:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 516569 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5305E140271 for ; Fri, 11 Sep 2015 15:46:10 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=yrGnVnr2; dkim-atps=neutral Received: from localhost ([::1]:54033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaHA0-0000wD-8I for incoming@patchwork.ozlabs.org; Fri, 11 Sep 2015 01:46:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaH95-0007wG-3m for qemu-devel@nongnu.org; Fri, 11 Sep 2015 01:45:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaH90-00083r-2r for qemu-devel@nongnu.org; Fri, 11 Sep 2015 01:45:11 -0400 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:36797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaH8z-00082I-Rc for qemu-devel@nongnu.org; Fri, 11 Sep 2015 01:45:06 -0400 Received: by padhk3 with SMTP id hk3so64768540pad.3 for ; Thu, 10 Sep 2015 22:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=bGMsKGJUolWwl4itbpADt4wSYAjZXUfhREOkgy8+Ktw=; b=yrGnVnr2r2KXmWmCHPamVevpfzmPvkcON1xJVoHxBMcMLADHFS17tfxdTJp8wsCmrG LjHDrQp/SIl1E7rimIsAD8a8SmW7pHeFCX+eqBoVsd65LK4rCziLHugH4kN+xgOaWkty L62R1HH32JL3sU9ZwzCcLFJov8eZgfkI7EakIY8GiWgZNKaTdj8fpOuzl1aMkIEW7vAl YrC9aL3aV8Xq+B5uDZLCmmXMcEkmFcJHK70ClYFSwVpDqrs9+trqRHCejjXyodzYU/Dt IMWZfjNjJUz0C7bzYU3uhSbbLwiT/TSlPYz3zl3wHtsYE1E/+H3NHMyy1OmIq6mmqxcv 0jmQ== X-Received: by 10.68.192.9 with SMTP id hc9mr92099363pbc.57.1441950305204; Thu, 10 Sep 2015 22:45:05 -0700 (PDT) Received: from localhost.localdomain (mobile-166-171-248-052.mycingular.net. [166.171.248.52]) by smtp.gmail.com with ESMTPSA id lg7sm15385993pbc.1.2015.09.10.22.45.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Sep 2015 22:45:04 -0700 (PDT) From: Peter Crosthwaite X-Google-Original-From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Thu, 10 Sep 2015 22:44:26 -0700 Message-Id: <392be5669c4a46463188f5a753ea13c3479fcac2.1441695816.git.crosthwaite.peter@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::235 Cc: pbonzini@redhat.com, Anthony Green , Peter Crosthwaite , peter.maydell@linaro.org Subject: [Qemu-devel] [PULL v1 04/21] elf: Update EM_MOXIE definition X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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