From nobody Wed May 1 22:48:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516828536243363.98291491087514; Wed, 24 Jan 2018 13:15:36 -0800 (PST) Received: from localhost ([::1]:46714 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeSON-0000eQ-Fj for importer@patchew.org; Wed, 24 Jan 2018 16:15:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeSMV-0007pN-3H for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeSMS-0006XR-Nd for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:39 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:55822) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeSMS-0006X1-69 for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:36 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.183]) with ESMTPSA (Nemesis) id 0Ls9b5-1emk600CJb-013uKg; Wed, 24 Jan 2018 22:13:07 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 24 Jan 2018 22:12:58 +0100 Message-Id: <20180124211301.10095-2-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180124211301.10095-1-laurent@vivier.eu> References: <20180124211301.10095-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:G+7VOANSjW3hCXfYVufaJ3OmulDNcvaTHFIOaNaK9qmHlpOeWPV 3fqKX/dFZtTvHXZbeuzUf9kttuyXXdBBUt/oZ9+sLF3A/4ISyMw9XcVcquIAN/rWAJIt8gQ rz0EWZRSV8CV55KbnRb98rLS8YEN7iBFjcKZzEVSpQCUmc6P13IGglWcKxedKMQit9CVx/P JJ87JhXMHcZoAQMEQNCqg== X-UI-Out-Filterresults: notjunk:1;V01:K0:tbWX7GLsPe4=:ACJhoNkdipaZQ1sN0lijBH mZtzaHduM2Hb+XHQuvf567D9QhIkWU4QQSYeBjjwKuD2xeTtLX6UTmInUTT7EcHTW0GUpPhds /wYaLpJvSRD7qumt9nLDp5ow6eUcIVappiUhuuWBu7+v60TzGSGd8DqxpdpSXZDm3QsDJag+5 rCymSlcmkYyKBmt9oBMMoMaY8Lmqx9JYnRqlBNs1/hlrf/XPUVWN16y0myuLHQcre30q7eqHZ JnXTVg1c9l6O0UQS2GlsneLdUE5p1Cmx85KEUbkw0q7eo0w7CTQKeMYUL0afIYYZqYZj6BwTX R03G+ZLcBT8li6MiCibhtj1IsqWF38x902Y6W3D3KhpkymDwxkXzZoIMJBZAP8+Zhuzon5uZT 2627p273zcv6F+gqaqErz1Nyr6NNz/eYb6zvAHwTEuYIUhlu7nqh9eG+d4ujTEQPeZZ7gEGkg iW0yurapquAGXDqGZyXxyllGCKIDiPuqZjGayZC5UlpDCTME5ZZ6fmvjVw8BFWti6BhsO4BtY ImFnIVJIv3Mv/6a+dXJNTdAUhq6+HpdgkKGCndJGRG8DT77eelzqUxvuueEqk3hUs3Am7EPXo sm3x4ZPmceAOU1NPuGbk/xImYSTBceokzUHSgX274bTPA+7nEfPTzq0cz2MnYf67nRUJOz07+ HnCRWkuFSRYT/38cLae9q/GScsUaCYL6XW8j8xRd6WHKUKoewGoFqbPox7jJvzgITlO4n7Q1h NZi3FhjXpMmvxdq9LqwT4A/XKWGHXt3vpsjaOYOhjqLeg57JmjbN5H4TvRM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.10 Subject: [Qemu-devel] [PATCH v4 1/4] linux-user: Move CPU type name selection to a function 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=20Mathieu-Daud=C3=A9?= , Laurent Vivier , Igor Mammedov , Aaron Sierra Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Instead of a sequence of "#if ... #endif" move the selection to a function in linux-user/*/target_elf.h We can't add them in linux-user/*/target_cpu.h because we will need to include "elf.h" to use ELF flags with eflags, and including "elf.h" in "target_cpu.h" introduces some conflicts in elfload.c Suggested-by: Richard Henderson Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/aarch64/target_elf.h | 14 +++++++++++++ linux-user/alpha/target_elf.h | 14 +++++++++++++ linux-user/arm/target_elf.h | 14 +++++++++++++ linux-user/cris/target_elf.h | 14 +++++++++++++ linux-user/hppa/target_elf.h | 14 +++++++++++++ linux-user/i386/target_elf.h | 14 +++++++++++++ linux-user/m68k/target_elf.h | 14 +++++++++++++ linux-user/main.c | 41 ++--------------------------------= ---- linux-user/microblaze/target_elf.h | 14 +++++++++++++ linux-user/mips/target_elf.h | 14 +++++++++++++ linux-user/mips64/target_elf.h | 14 +++++++++++++ linux-user/nios2/target_elf.h | 14 +++++++++++++ linux-user/openrisc/target_elf.h | 14 +++++++++++++ linux-user/ppc/target_elf.h | 18 +++++++++++++++++ linux-user/s390x/target_elf.h | 14 +++++++++++++ linux-user/sh4/target_elf.h | 14 +++++++++++++ linux-user/sparc/target_elf.h | 14 +++++++++++++ linux-user/sparc64/target_elf.h | 14 +++++++++++++ linux-user/tilegx/target_elf.h | 14 +++++++++++++ linux-user/unicore32/target_elf.h | 14 +++++++++++++ linux-user/x86_64/target_elf.h | 14 +++++++++++++ 21 files changed, 286 insertions(+), 39 deletions(-) create mode 100644 linux-user/aarch64/target_elf.h create mode 100644 linux-user/alpha/target_elf.h create mode 100644 linux-user/arm/target_elf.h create mode 100644 linux-user/cris/target_elf.h create mode 100644 linux-user/hppa/target_elf.h create mode 100644 linux-user/i386/target_elf.h create mode 100644 linux-user/m68k/target_elf.h create mode 100644 linux-user/microblaze/target_elf.h create mode 100644 linux-user/mips/target_elf.h create mode 100644 linux-user/mips64/target_elf.h create mode 100644 linux-user/nios2/target_elf.h create mode 100644 linux-user/openrisc/target_elf.h create mode 100644 linux-user/ppc/target_elf.h create mode 100644 linux-user/s390x/target_elf.h create mode 100644 linux-user/sh4/target_elf.h create mode 100644 linux-user/sparc/target_elf.h create mode 100644 linux-user/sparc64/target_elf.h create mode 100644 linux-user/tilegx/target_elf.h create mode 100644 linux-user/unicore32/target_elf.h create mode 100644 linux-user/x86_64/target_elf.h diff --git a/linux-user/aarch64/target_elf.h b/linux-user/aarch64/target_el= f.h new file mode 100644 index 0000000000..a7eb962fba --- /dev/null +++ b/linux-user/aarch64/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef AARCH64_TARGET_ELF_H +#define AARCH64_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/alpha/target_elf.h b/linux-user/alpha/target_elf.h new file mode 100644 index 0000000000..344e9f4d39 --- /dev/null +++ b/linux-user/alpha/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef ALPHA_TARGET_ELF_H +#define ALPHA_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/arm/target_elf.h b/linux-user/arm/target_elf.h new file mode 100644 index 0000000000..58ff6a0986 --- /dev/null +++ b/linux-user/arm/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef ARM_TARGET_ELF_H +#define ARM_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/cris/target_elf.h b/linux-user/cris/target_elf.h new file mode 100644 index 0000000000..99eb4ec704 --- /dev/null +++ b/linux-user/cris/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef CRIS_TARGET_ELF_H +#define CRIS_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/hppa/target_elf.h b/linux-user/hppa/target_elf.h new file mode 100644 index 0000000000..82b4e9535e --- /dev/null +++ b/linux-user/hppa/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef HPPA_TARGET_ELF_H +#define HPPA_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/i386/target_elf.h b/linux-user/i386/target_elf.h new file mode 100644 index 0000000000..1c6142e7da --- /dev/null +++ b/linux-user/i386/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef I386_TARGET_ELF_H +#define I386_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "qemu32"; +} +#endif diff --git a/linux-user/m68k/target_elf.h b/linux-user/m68k/target_elf.h new file mode 100644 index 0000000000..df375ad5d3 --- /dev/null +++ b/linux-user/m68k/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef M68K_TARGET_ELF_H +#define M68K_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/main.c b/linux-user/main.c index 450eb3ce65..3954e8996b 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -35,6 +35,7 @@ #include "elf.h" #include "exec/log.h" #include "trace/control.h" +#include "target_elf.h" =20 char *exec_path; =20 @@ -4319,45 +4320,7 @@ int main(int argc, char **argv, char **envp) init_qemu_uname_release(); =20 if (cpu_model =3D=3D NULL) { -#if defined(TARGET_I386) -#ifdef TARGET_X86_64 - cpu_model =3D "qemu64"; -#else - cpu_model =3D "qemu32"; -#endif -#elif defined(TARGET_ARM) - cpu_model =3D "any"; -#elif defined(TARGET_UNICORE32) - cpu_model =3D "any"; -#elif defined(TARGET_M68K) - cpu_model =3D "any"; -#elif defined(TARGET_SPARC) -#ifdef TARGET_SPARC64 - cpu_model =3D "TI UltraSparc II"; -#else - cpu_model =3D "Fujitsu MB86904"; -#endif -#elif defined(TARGET_MIPS) -#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64) - cpu_model =3D "5KEf"; -#else - cpu_model =3D "24Kf"; -#endif -#elif defined TARGET_OPENRISC - cpu_model =3D "or1200"; -#elif defined(TARGET_PPC) -# ifdef TARGET_PPC64 - cpu_model =3D "POWER8"; -# else - cpu_model =3D "750"; -# endif -#elif defined TARGET_SH4 - cpu_model =3D "sh7785"; -#elif defined TARGET_S390X - cpu_model =3D "qemu"; -#else - cpu_model =3D "any"; -#endif + cpu_model =3D cpu_get_model(0); } tcg_exec_init(0); /* NOTE: we need to init the CPU at this stage to get diff --git a/linux-user/microblaze/target_elf.h b/linux-user/microblaze/tar= get_elf.h new file mode 100644 index 0000000000..8a8f1debff --- /dev/null +++ b/linux-user/microblaze/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef MICROBLAZE_TARGET_ELF_H +#define MICROBLAZE_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/mips/target_elf.h b/linux-user/mips/target_elf.h new file mode 100644 index 0000000000..bed0b43259 --- /dev/null +++ b/linux-user/mips/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef MIPS_TARGET_ELF_H +#define MIPS_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "24Kf"; +} +#endif diff --git a/linux-user/mips64/target_elf.h b/linux-user/mips64/target_elf.h new file mode 100644 index 0000000000..5b6f4692e0 --- /dev/null +++ b/linux-user/mips64/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef MIPS64_TARGET_ELF_H +#define MIPS64_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "5KEf"; +} +#endif diff --git a/linux-user/nios2/target_elf.h b/linux-user/nios2/target_elf.h new file mode 100644 index 0000000000..801e20afaf --- /dev/null +++ b/linux-user/nios2/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef NIOS2_TARGET_ELF_H +#define NIOS2_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/openrisc/target_elf.h b/linux-user/openrisc/target_= elf.h new file mode 100644 index 0000000000..40ceb025c9 --- /dev/null +++ b/linux-user/openrisc/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef OPENRISC_TARGET_ELF_H +#define OPENRISC_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "or1200"; +} +#endif diff --git a/linux-user/ppc/target_elf.h b/linux-user/ppc/target_elf.h new file mode 100644 index 0000000000..576a5b9959 --- /dev/null +++ b/linux-user/ppc/target_elf.h @@ -0,0 +1,18 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef PPC_TARGET_ELF_H +#define PPC_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ +#ifdef TARGET_PPC64 + return "POWER8"; +#else + return "750"; +#endif +} +#endif diff --git a/linux-user/s390x/target_elf.h b/linux-user/s390x/target_elf.h new file mode 100644 index 0000000000..8114b59c1d --- /dev/null +++ b/linux-user/s390x/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef S390X_TARGET_ELF_H +#define S390X_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "qemu"; +} +#endif diff --git a/linux-user/sh4/target_elf.h b/linux-user/sh4/target_elf.h new file mode 100644 index 0000000000..f485e0cef2 --- /dev/null +++ b/linux-user/sh4/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef SH4_TARGET_ELF_H +#define SH4_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "sh7785"; +} +#endif diff --git a/linux-user/sparc/target_elf.h b/linux-user/sparc/target_elf.h new file mode 100644 index 0000000000..31d508c0df --- /dev/null +++ b/linux-user/sparc/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef SPARC_TARGET_ELF_H +#define SPARC_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "Fujitsu MB86904"; +} +#endif diff --git a/linux-user/sparc64/target_elf.h b/linux-user/sparc64/target_el= f.h new file mode 100644 index 0000000000..d6e388f1cf --- /dev/null +++ b/linux-user/sparc64/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef SPARC64_TARGET_ELF_H +#define SPARC64_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "TI UltraSparc II"; +} +#endif diff --git a/linux-user/tilegx/target_elf.h b/linux-user/tilegx/target_elf.h new file mode 100644 index 0000000000..7197bb0005 --- /dev/null +++ b/linux-user/tilegx/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef TILEGX_TARGET_ELF_H +#define TILEGX_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/unicore32/target_elf.h b/linux-user/unicore32/targe= t_elf.h new file mode 100644 index 0000000000..e2bfcb2ca3 --- /dev/null +++ b/linux-user/unicore32/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef UNICORE32_TARGET_ELF_H +#define UNICORE32_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/x86_64/target_elf.h b/linux-user/x86_64/target_elf.h new file mode 100644 index 0000000000..7b76a90de8 --- /dev/null +++ b/linux-user/x86_64/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef X86_64_TARGET_ELF_H +#define X86_64_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "qemu64"; +} +#endif --=20 2.14.3 From nobody Wed May 1 22:48:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516828638993449.73718343396047; Wed, 24 Jan 2018 13:17:18 -0800 (PST) Received: from localhost ([::1]:46852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeSQ2-0001yw-BY for importer@patchew.org; Wed, 24 Jan 2018 16:17:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeSMO-0007kA-2N for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeSMJ-0006TZ-3e for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:32 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:51758) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeSMI-0006Sx-QE for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:27 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MT82Y-1eFb8M0USc-00S5bf; Wed, 24 Jan 2018 22:13:08 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 24 Jan 2018 22:12:59 +0100 Message-Id: <20180124211301.10095-3-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180124211301.10095-1-laurent@vivier.eu> References: <20180124211301.10095-1-laurent@vivier.eu> X-Provags-ID: V03:K0:8Nm42/X18t0AXnox5BU/EezUinZRhANvgsvOIi2Ebes5R/sDvlq teFrJElEHKFswU+JrNY4IJyOMb8UdebfM2SmRYpwHjoxtCQH+dO7XQAYFVz5MTxeFR82GOJ /ewt5cxa2mozHsxMfVkZO3Hz1lUSjIUzF6ThSiCvUQ/8ISFx4Uitl+9XX7UkMdOc7wkyHYw 89C11xAujGwhDVXJw2zGQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:VkUO6sdzyOw=:Oo7YWK77Rn+MFg6QkDpR7d YkEkOmTnVm3tmUgceSHyylrC+8tTRQmyUuzU74xW3d9AGARR1yo377YVPbr1Pc2r26sm1CJhP JGl/EN53qtxPSXF+wULx8DQAH2WxJbuQex6bGV5CBUS9pAzBcetum24KVo7Aa8L7Oll3gKqnG e46EZ1Zs4QrMfXjWmz+QKgubBgVymG9qKbTyvDANEUeOTw7EZzIbH+1a3tSPce9I1ofWVzWeL 4jII26AkeYDsCFf9lLpl1lYvyX5+x6fi87HRS/rsWCuj3q5xWI7g82Z9qoj6KaKtZVlkFvChh /+P3reUht4RIW36+r45yKpxxiBe57JJOGxvcvqEFMK2nN88kJ0Z2Lt8SS9oi6zDZ2+V50Dbyq 0fXq0dXZpI2/psyi/mlr1xoiICzRKPQ/0oBP5FgmqdAZidR1SmNZZxZYyLC4BFUJmtnKYUubA lxDqcg1tMH1nhdToPyq/+cXA2Rcpj51irK9DmDHKFK32NKmBp6uPsBgaAjtyq7I/5kpip9x+p 5nk+il7JByNdf6hTV1vZ6VOlwLbvmAsS2zixpa8dPUQp6/GnZ8iSBIdrhusGeFK9cHmSnQ7bV ANQ5E0xI5JH7e2bhqX3p5sCTMVXgW7/e81u7Yb+5wcZOUi1ppPOoUAQNimaGbNsFNOGivvm2L be9nMBGLAl+WMylHh6u3RvmrHJbB5698VZ034nqWVVUx3HY2oLFkCHCBaUCgF4+NqZR9ul6Ky oK05nvELP3Er6zl1X7gvrnt+6As650JhINyVBw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.74 Subject: [Qemu-devel] [PATCH v4 2/4] linux-user: introduce functions to detect CPU type 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=20Mathieu-Daud=C3=A9?= , Laurent Vivier , Igor Mammedov , Aaron Sierra Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: YunQiang Su Add a function to return ELF e_flags and use it to select the CPU model. Signed-off-by: YunQiang Su [lv: split the patch and some cleanup in get_elf_eflags()] Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- linux-user/elfload.c | 35 +++++++++++++++++++++++++++++++++++ linux-user/main.c | 20 ++++++++++---------- linux-user/qemu.h | 1 + 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 20f3d8c2c3..67e2425ac6 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2376,6 +2376,41 @@ give_up: g_free(syms); } =20 +uint32_t get_elf_eflags(int fd) +{ + struct elfhdr ehdr; + off_t offset; + int ret; + + /* Read ELF header */ + offset =3D lseek(fd, 0, SEEK_SET); + if (offset =3D=3D (off_t) -1) { + return 0; + } + ret =3D read(fd, &ehdr, sizeof(ehdr)); + if (ret < sizeof(ehdr)) { + return 0; + } + offset =3D lseek(fd, offset, SEEK_SET); + if (offset =3D=3D (off_t) -1) { + return 0; + } + + /* Check ELF signature */ + if (!elf_check_ident(&ehdr)) { + return 0; + } + + /* check header */ + bswap_ehdr(&ehdr); + if (!elf_check_ehdr(&ehdr)) { + return 0; + } + + /* return architecture id */ + return ehdr.e_flags; +} + int load_elf_binary(struct linux_binprm *bprm, struct image_info *info) { struct image_info interp_info; diff --git a/linux-user/main.c b/linux-user/main.c index 3954e8996b..6845b56030 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -4319,8 +4319,17 @@ int main(int argc, char **argv, char **envp) =20 init_qemu_uname_release(); =20 + execfd =3D qemu_getauxval(AT_EXECFD); + if (execfd =3D=3D 0) { + execfd =3D open(filename, O_RDONLY); + if (execfd < 0) { + printf("Error while loading %s: %s\n", filename, strerror(errn= o)); + _exit(EXIT_FAILURE); + } + } + if (cpu_model =3D=3D NULL) { - cpu_model =3D cpu_get_model(0); + cpu_model =3D cpu_get_model(get_elf_eflags(execfd)); } tcg_exec_init(0); /* NOTE: we need to init the CPU at this stage to get @@ -4413,15 +4422,6 @@ int main(int argc, char **argv, char **envp) cpu->opaque =3D ts; task_settid(ts); =20 - execfd =3D qemu_getauxval(AT_EXECFD); - if (execfd =3D=3D 0) { - execfd =3D open(filename, O_RDONLY); - if (execfd < 0) { - printf("Error while loading %s: %s\n", filename, strerror(errn= o)); - _exit(EXIT_FAILURE); - } - } - ret =3D loader_exec(execfd, filename, target_argv, target_environ, reg= s, info, &bprm); if (ret !=3D 0) { diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 4edd7d0c08..47ca71159c 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -188,6 +188,7 @@ int loader_exec(int fdexec, const char *filename, char = **argv, char **envp, struct target_pt_regs * regs, struct image_info *infop, struct linux_binprm *); =20 +uint32_t get_elf_eflags(int fd); int load_elf_binary(struct linux_binprm *bprm, struct image_info *info); int load_flt_binary(struct linux_binprm *bprm, struct image_info *info); =20 --=20 2.14.3 From nobody Wed May 1 22:48:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516828744784658.6162645232339; Wed, 24 Jan 2018 13:19:04 -0800 (PST) Received: from localhost ([::1]:46909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeSRj-0002uT-S7 for importer@patchew.org; Wed, 24 Jan 2018 16:19:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeSMQ-0007kl-1w for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeSML-0006Uu-JG for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:34 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:51511) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeSML-0006U7-8n for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:29 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.183]) with ESMTPSA (Nemesis) id 0LtWNA-1eo6s43ubc-010sC1; Wed, 24 Jan 2018 22:13:09 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 24 Jan 2018 22:13:00 +0100 Message-Id: <20180124211301.10095-4-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180124211301.10095-1-laurent@vivier.eu> References: <20180124211301.10095-1-laurent@vivier.eu> X-Provags-ID: V03:K0:7nmAab6ICNO16VZ/cbsTtEycfxd5gJh95HH6cnrqMigxlSWRY2h KbNTnRnCfUKeHXP5BsRTDezKzQKm9H/7D79JiKLvj3amAQQru0L/1EkcsLGfoyS61zT/IIH 4/7ybx08HnYq1/kN3RPrxAEyvHv9VxEUJUdMY7SqXWQt28TEg+ex6yxoavSE5G3nq4qM37k sJis7iAgVU56IJIdlMyCQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:Y0v29EPUNEs=:MIZAxfQofviVF4LZEdpo4D F90067G8bGNxyDGzmEKiGc784U6/SZWxNr9hNihFTB5iR2mEs3nRBqSrM1EYGMliHYnfZRTKs VPh/JH5PEQ/4E/oX98MG9qdalhIFYm1ROQzPo6W6+lQTZslfpG6PmdG1KbO76vS++X7znoLTC OzAs97MIy1K0+R2a8v9dWsw8FobzgXRyVAtSMGmVpE5PeFkAF26P8D8z6GkI+ukIGdKyz2Jjk khnUiZt/eC5gyqH2Fhg5/tDFLlo1ItbNAuZJJSKb2ocMycNrmZhxdA7ngPJ7S2Ts1dIscXRM+ BefOg9/8VJiX+Zm39B3RypGnK+JQlTnhs28BjCPCk3LztnNFUKcrq4HFz6yzGkHfrHR2lLZ/P +AK3Mtzy3dexZBT8dkj/QUrngILGO/N8vphOJ5GbnaqVsXFR9UaXg+xQWY692n2H/Y3aXtWmr PbwQtCxrSXOfijeyRvdEbC/363lFAcgJWTACMe9sv4IRDHAdYJJ+H0sGOuHReOojfvguuKBmF 08zb3Oq8xARkS5E/5crRtzwOBI/CdLC4uP6In0FyRLnOG6ww72bM4QcmOwSnAwrFySUMMxIqX EZTcmRnqxDVTOJCQ3eyAHjj3XqBh98VCvUMlQUdQHMXDiXsADZbThf1GKu9ueg2F8MywN/Qvf e9OMPQx48Xl3dkNLvTT5celMG9xE9h9aMusk+TIMnW471+5QLpWmkESz6DQKrsiAjjpJ5E1xM ZCnvsUWJ6ZM+6JF9hGj7mzD/FgrK9vgqhUq1sg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.10 Subject: [Qemu-devel] [PATCH v4 3/4] linux-user, m68k: select CPU according to ELF header values 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=20Mathieu-Daud=C3=A9?= , Laurent Vivier , Igor Mammedov , Aaron Sierra Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" M680x0 doesn't support the same set of instructions as ColdFire, so we can't use "any" CPU type to execute m68020 instructions. We select CPU type ("m68040" or "any" for ColdFire) according to the ELF header. If we can't, we use by default the value used until now: "any". Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- include/elf.h | 28 ++++++++++++++++++++++++++++ linux-user/m68k/target_elf.h | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/include/elf.h b/include/elf.h index e8a515ce3d..ca9a419043 100644 --- a/include/elf.h +++ b/include/elf.h @@ -537,6 +537,34 @@ typedef struct { #define HWCAP_S390_HIGH_GPRS 512 #define HWCAP_S390_TE 1024 =20 +/* M68K specific definitions. */ +/* We use the top 24 bits to encode information about the + architecture variant. */ +#define EF_M68K_CPU32 0x00810000 +#define EF_M68K_M68000 0x01000000 +#define EF_M68K_CFV4E 0x00008000 +#define EF_M68K_FIDO 0x02000000 +#define EF_M68K_ARCH_MASK \ + (EF_M68K_M68000 | EF_M68K_CPU32 | EF_M68K_CFV4E | EF_M68K_FIDO) + +/* We use the bottom 8 bits to encode information about the + coldfire variant. If we use any of these bits, the top 24 bits are + either 0 or EF_M68K_CFV4E. */ +#define EF_M68K_CF_ISA_MASK 0x0F /* Which ISA */ +#define EF_M68K_CF_ISA_A_NODIV 0x01 /* ISA A except for div */ +#define EF_M68K_CF_ISA_A 0x02 +#define EF_M68K_CF_ISA_A_PLUS 0x03 +#define EF_M68K_CF_ISA_B_NOUSP 0x04 /* ISA_B except for USP */ +#define EF_M68K_CF_ISA_B 0x05 +#define EF_M68K_CF_ISA_C 0x06 +#define EF_M68K_CF_ISA_C_NODIV 0x07 /* ISA C except for div */ +#define EF_M68K_CF_MAC_MASK 0x30 +#define EF_M68K_CF_MAC 0x10 /* MAC */ +#define EF_M68K_CF_EMAC 0x20 /* EMAC */ +#define EF_M68K_CF_EMAC_B 0x30 /* EMAC_B */ +#define EF_M68K_CF_FLOAT 0x40 /* Has float insns */ +#define EF_M68K_CF_MASK 0xFF + /* * 68k ELF relocation types */ diff --git a/linux-user/m68k/target_elf.h b/linux-user/m68k/target_elf.h index df375ad5d3..998fe0fe2f 100644 --- a/linux-user/m68k/target_elf.h +++ b/linux-user/m68k/target_elf.h @@ -9,6 +9,12 @@ #define M68K_TARGET_ELF_H static inline const char *cpu_get_model(uint32_t eflags) { + if (eflags =3D=3D 0 || (eflags & EF_M68K_M68000)) { + /* 680x0 */ + return "m68040"; + } + + /* Coldfire */ return "any"; } #endif --=20 2.14.3 From nobody Wed May 1 22:48:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516828528493637.3334991684367; Wed, 24 Jan 2018 13:15:28 -0800 (PST) Received: from localhost ([::1]:46705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeSO8-0000SV-JK for importer@patchew.org; Wed, 24 Jan 2018 16:15:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeSMO-0007kC-3L for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeSML-0006Un-HH for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:32 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:65502) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeSML-0006U6-7z for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:29 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.183]) with ESMTPSA (Nemesis) id 0LdVQI-1f5EJj39Iw-00in4x; Wed, 24 Jan 2018 22:13:10 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 24 Jan 2018 22:13:01 +0100 Message-Id: <20180124211301.10095-5-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180124211301.10095-1-laurent@vivier.eu> References: <20180124211301.10095-1-laurent@vivier.eu> X-Provags-ID: V03:K0:IVygD7HgiiOnWn1Ki8jvEljPT2C1jDWhgIcxr1fyGIXOiHM4EE4 2qjF1PJkI222RftgA4o3x7s8aGv2lNjdlAwZ8i18Oyn1Az4jRbzLgGlL6uDdbFAwEvHE0ge AeGGtKrXdxhdnerdZSXbeGrC7Qxi9SazIKsLZhog66ItCJabpJ6zH1H0L1CTj0NmcVaG53T AtjFGsNq3CcT+Shc2/jJQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:Ht2nFvOwOrM=:0HfIjYzoXKO9dNUQbkjGAV Vzl65MP5r1kkYBkV3qMsmgebNyGrthBh2TTR8TFGw66IXZJBBrJeM3FPZgJO6om6e1/LgAjyd MMMdjN5W6srakT1kikR9hCe5HpEJu/Fwx8oOaqZ/gUURr6lIMZMrsKoWuFfpM4IHoBKA+GzuV SLIDXF4XWc2ttrBPzUYgIQtBxhSvdQldJT4uphoGlwRWtXuefU7XwJBIoJi8rZQz+GFQro0I4 UZJjM8qHxBCQbA1t9YI8IeZyr2xCpAjaWdRfdRdHkHDQJbONLccuAB+p94i7if3CPUtlFEccZ fPhjDrXzdpJInJ6oc0ddsVGKDbPMtE393dyH0YNuXlg5rqO3rn2/94l2Jl0ef2wYs/Rrd5APW M212P5CBzQ+82UhrKR9oE3w7RJENT3PbsLg4/wMaJm4cJ9prjEL91pSQ5FwHQ915dtqB63yX0 Dav1IuP6pqZLtQ0Hb2CO0+L/sNOIQgNm4fDYWl9KrLAkHNXpfPbe5OxD1peW1UuPevmAjTfxi x9XLOYYgbZMpczy0QXr2uAFQtWcQgb2yLHH6k7UePVIlRpnqNQYgZg7ZDKAAQFQLF7JpZEaYe 3dZJZvGa7ZefsTqBa06al0Q0/QVGk0JW9O1SiedWeScPkuwQ1UVxW7YVoAutsuUIVv43QljVj 3I6R4w4Rd1a9kHsF8bCCjDKJK8mdsgmOZO6+jkkon8KUMOKFlWxpWLwjJmNKtggfYdg5qs9Gh mOpeygWfIgwPFguQoXsbw+91uMkQs6nk/Y6TCQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.13 Subject: [Qemu-devel] [PATCH v4 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=20Mathieu-Daud=C3=A9?= , Laurent Vivier , Igor Mammedov , Aaron Sierra Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- include/elf.h | 4 ++++ linux-user/mips/target_elf.h | 3 +++ linux-user/mips64/target_elf.h | 3 +++ 3 files changed, 10 insertions(+) diff --git a/include/elf.h b/include/elf.h index ca9a419043..746b6d393b 100644 --- a/include/elf.h +++ b/include/elf.h @@ -40,6 +40,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. */ =20 /* 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..14b53d7469 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_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..ae14b38bfa 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_64R6) { + return "I6400"; + } return "5KEf"; } #endif --=20 2.14.3