From patchwork Sun Feb 25 17:59:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 877583 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zqCS82sCHz9s1l for ; Mon, 26 Feb 2018 05:00:55 +1100 (AEDT) Received: from localhost ([::1]:55394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq0bV-0002Fi-QH for incoming@patchwork.ozlabs.org; Sun, 25 Feb 2018 13:00:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq0aS-0002Dx-BL for qemu-devel@nongnu.org; Sun, 25 Feb 2018 12:59:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eq0aR-0002oJ-8r for qemu-devel@nongnu.org; Sun, 25 Feb 2018 12:59:48 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:41673) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eq0aQ-0002nH-Vj for qemu-devel@nongnu.org; Sun, 25 Feb 2018 12:59:47 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MPGl6-1elajt2JzE-004Tt5; Sun, 25 Feb 2018 18:59:33 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Sun, 25 Feb 2018 18:59:28 +0100 Message-Id: <20180225175928.13101-5-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180225175928.13101-1-laurent@vivier.eu> References: <20180225175928.13101-1-laurent@vivier.eu> X-Provags-ID: V03:K0:kJiunCKCoBSlbBTHqfC0T4sEhoEafRkpk5oKijTVE2g7p+5xYPt 8NJLfv0bjdoIytfL15o3IdO1mS0Bx81UfaiNjrySqUuucp3YEM831Fczta4UkelIX+l0oB9 EO5ggRR3OWGgJrX2RyqlI9oAnrCNBDg3K306zP4tijBNxDFoLMYToRo2lDoUfWcrEKGRs/T Ynbb61jLhtor/+38BqjnA== X-UI-Out-Filterresults: notjunk:1; V01:K0:c8LBr1WzIZ8=:r3rHy6eUik4spOBgfBy9Jj IJahNviuy6stLwIVsdCpfDZa5huj4RB+0ft3vAiiXY+flZP1b4fPHpH7boxPBC4XA6W4sGohb 9WQWWZp+3vqTl2ql2V+nHV42IVez4xDoVuOlGCbiDNnIWik7xNeM56OCq9WxuEu/FAGbi9Fq4 4/1BCyO23ezv6mztKLtnSqKW+AEhKF6OjQ9PYPFqJqRMQQn3XbKb3GI8ot27KpnYYaozzKPDA xFZ+KCcs5rBsr7OUJ1G4MwCM/+iWzNl+J5Y0XlEgnYfcspbwbvG5YKYr60E1BZ54siEJ/EkfO jTFBkACA+KLSx3oRczmhGNTw5NFpE8q0hOINbyYuAMHYOKHd/9+YOhSBuvJe2KjWGx+BO75LQ W8kw/uNaveMIof/k5kHNKBpgGY/0Jv5T0XYKmKS+z0I9Tx2V4riNvpZCeFDyZWfRJuRSH3EaO qCpNb8FS/4HM11FVE7HalKuEx686tg2MK0KorlYYmd3vly9r1PYXI0sVzBBxbPh2s8bfx6GsQ KWlflSBaFK9rIX8JmYow0N4kRpfrRZmyWtrZunwvg7BGwQQvm3xw0G6h+dlJVA61aCmMH86xL 74PrLFdgc7eTRHuNsRhlPMx2EyOZUKnt/6IlgLrQO4TMPAx6CC/2jPuNpe1ieUL2/kSv/drN9 kBw8LRKzUfQ1IbftCCQxaOmriurIb+Jb5d9A2O223X5UMDIIUOE62D0nLskIvueDuBzk+y36P 4KMwCkHS3t9nyOH2VhEHNF8pD904VCbHK1KKDg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.73 Subject: [Qemu-devel] [PULL 4/4] linux-user: MIPS set cpu to r6 CPU if binary is R6 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: YunQiang Su , Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: YunQiang Su So here we need to detect the version of binaries and set cpu_model for it. Signed-off-by: YunQiang Su [lv: original patch modified to move code into cpu_get_model()] Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20180220173307.25125-5-laurent@vivier.eu> --- include/elf.h | 7 +++++++ linux-user/mips/target_elf.h | 3 +++ linux-user/mips64/target_elf.h | 3 +++ 3 files changed, 13 insertions(+) diff --git a/include/elf.h b/include/elf.h index ca9a419043..943ee21171 100644 --- a/include/elf.h +++ b/include/elf.h @@ -33,6 +33,9 @@ typedef int64_t Elf64_Sxword; /* Flags in the e_flags field of the header */ /* MIPS architecture level. */ +#define EF_MIPS_ARCH 0xf0000000 + +/* Legal values for MIPS architecture level. */ #define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ #define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ #define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ @@ -40,6 +43,10 @@ typedef int64_t Elf64_Sxword; #define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ #define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */ #define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */ +#define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32r2 code. */ +#define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64r2 code. */ +#define EF_MIPS_ARCH_32R6 0x90000000 /* MIPS32r6 code. */ +#define EF_MIPS_ARCH_64R6 0xa0000000 /* MIPS64r6 code. */ /* The ABI of a file. */ #define EF_MIPS_ABI_O32 0x00001000 /* O32 ABI. */ diff --git a/linux-user/mips/target_elf.h b/linux-user/mips/target_elf.h index bed0b43259..fa5d30bf99 100644 --- a/linux-user/mips/target_elf.h +++ b/linux-user/mips/target_elf.h @@ -9,6 +9,9 @@ #define MIPS_TARGET_ELF_H static inline const char *cpu_get_model(uint32_t eflags) { + if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_32R6) { + return "mips32r6-generic"; + } return "24Kf"; } #endif diff --git a/linux-user/mips64/target_elf.h b/linux-user/mips64/target_elf.h index 5b6f4692e0..ec55d8542a 100644 --- a/linux-user/mips64/target_elf.h +++ b/linux-user/mips64/target_elf.h @@ -9,6 +9,9 @@ #define MIPS64_TARGET_ELF_H static inline const char *cpu_get_model(uint32_t eflags) { + if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_64R6) { + return "I6400"; + } return "5KEf"; } #endif