From patchwork Tue Feb 20 17:33:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 875550 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=) 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 3zm77M4s6Rz9sY7 for ; Wed, 21 Feb 2018 04:35:43 +1100 (AEDT) Received: from localhost ([::1]:56803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoBo5-0006lW-KJ for incoming@patchwork.ozlabs.org; Tue, 20 Feb 2018 12:34:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoBnM-0006kn-1O for qemu-devel@nongnu.org; Tue, 20 Feb 2018 12:33:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoBnJ-0003u4-4H for qemu-devel@nongnu.org; Tue, 20 Feb 2018 12:33:36 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:50853) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eoBnI-0003tE-RJ for qemu-devel@nongnu.org; Tue, 20 Feb 2018 12:33:33 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.167]) with ESMTPSA (Nemesis) id 0Lf3TU-1eQ8Vm3NMW-00opQq; Tue, 20 Feb 2018 18:33:15 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 20 Feb 2018 18:33:07 +0100 Message-Id: <20180220173307.25125-5-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180220173307.25125-1-laurent@vivier.eu> References: <20180220173307.25125-1-laurent@vivier.eu> X-Provags-ID: V03:K0:PlNc1UNZEKhpV6ZpUvEufRjpHqGrX8d+I3fgc7fcnbFxLQvlhDH WQ+pZl6ne1w3c6ClT8FZ1OFK5H0ojmBc3HVaUbwYjdrkY3wYQ45yW1YbyukKaBYIdHDs4I1 mDBSMkdvENnbfPM8Onm/pJ96AZi8dLTdIjlHmfImweY43stroirXjhjJh6uk7xC5ybI7aan v4eu3sLP7LFR68jwxUBww== X-UI-Out-Filterresults: notjunk:1; V01:K0:brNzjOs5WaU=:vNP4gSoYKZ6ijxb8RCBaVM 7lNzM2ErUix97vn/PMYC9P3djYnJhvJ/X4jkABT77UGGjsMK8Wb5Uxun5Rqm0d8NJ9XBO2zJy VWUYKzL8Ap5yj0dy+CmmYMY69N60PGVXl3SDUkrMCNEijPRmODPgOSRIbtD24Ztn7oh1d07F/ hjzkMJAvKyROxecz0ZF1VvscsfhuNUFnETbNVLMZTgoRdSKyI+f5mThQ3z4hRSwboeqnRho8x AsgfRyl6id/JFkSuEUdpIWW+jWfyyDm2Bk6QP1M1zifvnRKtXFSCrtWaFEEyGvXOqTvLWosUZ cQ/QsVaR5gGFKK5hwCC5sGdenxgRiPRSijcluyp2XNKXowTHeZMZ3wP+7W1QluTOJ4zqwJJLv jqsjbiEsj03TVBzBL6XzaKYxTiLxnTnIs2Y/CFdUNTVKpxjvCyamWILMcNwd+popr7JKAOGHT 1YhhKk1imOL2xxihrcW4Lmv4tUpYoqbTPOfzIF9G+GO5p9gaclDc8m1q8uwq+cbZcckfASUB4 cbCLcSdul3x3gZThZQii9ImQSVyPUmqdP/I5V7LkJktJmlQbfeA6uScUdrSM07YsPsbvtp6Xv 6r58kURge8BaKtS76k++hXuEu9gQcByV0pWhHKofc4DPffhzq9L2fs94Imd0GB6obCGL1Lcza ddBd3xsloslLeXWTIHEaYBUUofU35KxeDHCrCSeccl97mclwbv7nZ4B4AdhocM7cjPNE5Ci7w z7eIh8M1zcQPifPOX8pfP8hHle6BPqP6MC2LWQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.130 Subject: [Qemu-devel] [PATCH v5 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: Peter Maydell , YunQiang Su , Riku Voipio , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Igor Mammedov , Aaron Sierra 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 --- Notes: v5: Use EF_MIPS_ARCH mask to read MIPS architecture flags -> removed Richard's R-b because of this change v4: add YunQiang Su's Signed-off-by v3: fix code indent problem reported by patchew remove useless "!= 0" v2: call cpu_get_model() with the result of get_elf_eflags() 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