From nobody Mon Feb 9 11:50:59 2026 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 1519581870047298.2866785432167; Sun, 25 Feb 2018 10:04:30 -0800 (PST) Received: from localhost ([::1]:55419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq0eu-0005Jx-Rh for importer@patchew.org; Sun, 25 Feb 2018 13:04:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq0aS-0002Dw-AC for qemu-devel@nongnu.org; Sun, 25 Feb 2018 12:59:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eq0aO-0002lX-Gk for qemu-devel@nongnu.org; Sun, 25 Feb 2018 12:59:48 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:45073) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eq0aO-0002i7-39 for qemu-devel@nongnu.org; Sun, 25 Feb 2018 12:59:44 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MIw2b-1esTQQ37Or-002Z98; Sun, 25 Feb 2018 18:59:32 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Sun, 25 Feb 2018 18:59:25 +0100 Message-Id: <20180225175928.13101-2-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> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:WO8AKM9RApa1lcoKyW7aWjz4mCl01cyMtqVBJwyD2AaeRTGLYVe sZDp+v8GGnwAmR7NLN0gLTqtGA7+DPBQ4hwxjrLMpgxgBymkejuqZ32WZiGbtuJP0QVGCuQ shn2Z5Oo8FeYuXLDo3rtrzqW/KK0+K8Bn5/AbCF00ztkkjzHuKChDzwcxk7RXg7ngwtVczm wTk2WNaQEDNAseKEcO+kA== X-UI-Out-Filterresults: notjunk:1;V01:K0:KiX1aHFDax0=:XAqd8964JZ5EncFLuSmUss kasEKIGvI8+K5zzvVMijeNN+cYvv0uITkTo6vx9aIpSMI3i/qSuUVU/5UFTqTjs7FtTRicj1r 3QPmZpqOk3W2dGAtSfraT6C44O1sPhpswlozc3pGmtbnGfYMbwVH8ePTGHucc+2ESwgqy035p DPuahmkAG8/bHKfivmgh0oQLjOAl1gLiwEyMqag5whLnZOnacP0vNFoO6GOTJqJDEfU/O40Gx gZAJHgSKGgLW/3Es+iLFAeXQj6r9vXI5n/bKLYK+qdFvzhOZy2/gxqQiNIMCsX60mpAFEljvC Ord7qUirdXmtfyAL85GMV6g+kUcTf7db1ZZpVClHyeYT7aAESyWha+iR7KM+4Z7TLS3SFRycU 5EbmuLdquOaJvhMXA5pG6bT88wJgZcLaXY3Hj2VmU2zanXWUC/PwX4fBWSNnRe+pI535gYEXR c8IlIXke1UZZ6IWVenFjjXsamTGcTdEN9hj9Tl5ZTR+8kimRhgRbNvNmzEmd+cK8EnN6C7K5I X9EWLGPqfCV+2RYDQNCFVX1dKa/IhMOFwikXI64uZ9i6+P1b9BOA5jCjjcAqjbaRkMZV/eWyP IffErjY/UcLeZLBJUeG1s2i9zhyEFdoMDK9adAv6zO/n7vpXoQQH9ch9+WDScz7AOv+FDOYsm nJRPd30qVbTcRLZmXO4QTd2nrsCuF/exAg/UyMiE7BKPJa9LRJhR058WR4PfyuSg55SsOsCgF EWLYDAAQpg72r6FiwHBsB194974aiI6XojlQcYydbtin+nTbirbR03rGia4= 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 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: Riku Voipio , Laurent Vivier 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 Message-Id: <20180220173307.25125-2-laurent@vivier.eu> --- 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 | 18 +++++++++++++++++ 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, 290 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 fd7900628b..079b98235b 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 @@ -4344,45 +4345,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..a510ceb612 --- /dev/null +++ b/linux-user/sparc/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 SPARC_TARGET_ELF_H +#define SPARC_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ +#ifdef TARGET_SPARC64 + return "TI UltraSparc II"; +#else + return "Fujitsu MB86904"; +#endif +} +#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 Mon Feb 9 11:50:59 2026 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 1519581753599115.12082140210896; Sun, 25 Feb 2018 10:02:33 -0800 (PST) Received: from localhost ([::1]:55405 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq0d5-0003cg-Rp for importer@patchew.org; Sun, 25 Feb 2018 13:02:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq0aS-0002Dy-DP 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 1eq0aO-0002lc-Gx for qemu-devel@nongnu.org; Sun, 25 Feb 2018 12:59:48 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:40195) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eq0aO-0002jP-3H for qemu-devel@nongnu.org; Sun, 25 Feb 2018 12:59:44 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.183]) with ESMTPSA (Nemesis) id 0LdVUQ-1eOtF82ZD0-00ioqP; Sun, 25 Feb 2018 18:59:32 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Sun, 25 Feb 2018 18:59:26 +0100 Message-Id: <20180225175928.13101-3-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:hum1MFg+xJ1BuSucb8pQNsaj84QoBdAXMB0QH+5tb2d++Mt+I7l LHlg9Mh/Kdnfd9HW2Ht0cEqQRQgmQz5/DrzrFcYC8Hfve8g6gEaSx+Ui46x9aZZ7Wk7sHE0 8jL+hfR5ZTZ0f3so+/RA7qUjkFeujgokjRcHGLATr6zp+4pLhDFrdK1zQ2LMypCIMTIcqWF wZ8PRueWQsyQb4meDqqDA== X-UI-Out-Filterresults: notjunk:1;V01:K0:ylU58OR1hPw=:q7IJ4Y3BMF8IKZScqs5N1F OUqPUPa1q/YT6WT2rFJ6hwh60P7/XIRL9Oz8Rhd5VyrScoXng/ZLN44oFO9r0H40E7sNSj7pB urobJzWvIFPE9QB/vvdMuSC9U4vRSq5RhbKLhL/dh3nTuepaWG+Grc+VdWPdKrTd5noQQQbbF 8gzAvB//9c20LTIZwuz9jz8J6TkIyvbt+Xfl/+PbNoaWbGWZPYcHronUvSI5DVjz6TGRAg7PG kuAm0dQjXeTHXzvyIVfWFk3HiYLrpxeYb5Pc7lnT6ozIcQ8ddy4QLqudSos2T4502Yav6csBA C4S35AcMTg77XbJh1qJTWz5FblB4CYHj9SDhK21t7zeOmywTdhyImDXUdSEHs7MjG7w+dAWBo aBDT8+bH7JyXbF+PXqQwar5D6J7IkXKFOd4HOxR7EFTK1Hly24oLAhB13A6uGsMZjem0aWdhy Xjh1GqwJFUMll0y1B3yklUcRTaMWbP8PiQ0VEiAPgnPZrKY7CoMvrl8EkENe3YoNpSFQMbfO7 7Ij1bEv/Y6w1sMIxl/BWJYQJnKQH0dDuc//wwyEMoLgSG2yck1H4QIoRUEAYM8MLjlf+uxa3k zu3pT77/RtxAsqpR/7U6eciRECQCS5eee9a7xnBiwpK1nKSPaFl99sWFBwyDIUMbIHDS4yX14 omHMJicxRIPq558Vt/29NlekBhjD2YDFCOCX6eHHANGrTz02ni7kFp9jpOQMlwDlXCIuJuhcT 6twbjXbbbk461fINnk4Pvh18DPRM6yOwX1Zstw== 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] [PULL 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: YunQiang Su , Riku Voipio , Laurent Vivier 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 Message-Id: <20180220173307.25125-3-laurent@vivier.eu> --- 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 8bb9a2c3e8..0208022445 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2396,6 +2396,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 079b98235b..bbeb78fb89 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -4344,8 +4344,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 @@ -4438,15 +4447,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 bc4bf35036..f4b4ca72ad 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -186,6 +186,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 Mon Feb 9 11:50:59 2026 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 1519581753659812.1382758509685; Sun, 25 Feb 2018 10:02:33 -0800 (PST) Received: from localhost ([::1]:55403 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq0d2-0003b2-Ku for importer@patchew.org; Sun, 25 Feb 2018 13:02:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq0aS-0002Dv-9W 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 1eq0aO-0002lG-Dp for qemu-devel@nongnu.org; Sun, 25 Feb 2018 12:59:48 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:50767) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eq0aO-0002i0-3R for qemu-devel@nongnu.org; Sun, 25 Feb 2018 12:59:44 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MQwFa-1fJ3Gd0Fby-00UIlR; Sun, 25 Feb 2018 18:59:33 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Sun, 25 Feb 2018 18:59:27 +0100 Message-Id: <20180225175928.13101-4-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:TJ1S+0U5GBPnVmlBVdYLK9gmYscaNxxoSZqhnhei810XCCZfnVd t2iwjkSRTNLHtARh2rvQEiWIY2P8NcIvv7XeizeaGF5XFoFYXdiGd+c0dOCWZxBxoEjUzgg sAzwBCSCsI7j1yh99/ARVxxB2WR8GwUYdQmbr/IcuCHd76rC3l3KapNJyZWW9m24ipwXVwa VO8ZtU5ufvMdBzhYzl0dw== X-UI-Out-Filterresults: notjunk:1;V01:K0:6cZn7yNbwd8=:4zulO9G/pEMiiqjhdibD2C apFSebQq/Z8ShjDqb1juBuZCoL/Vld8Tgxn69MgVgTd29mXojLkUOFRnBb/3CNMpod8tK4LhR 0gYjjvT0kUPErmUbquPAHlP5k+zEI97BWwOsf2a/Mp/zv6DcqWJdfCIIoYRYZTscz/k2eDdJo VGdGcohghDXF7erewaaK1/OzO9Z5A/V1DFCdkiE4cqlnoswg2LJPlP3KSh9GsM0dOYcIdaWlT BNWK+1DSYwv8FQ9bP5uirBTw+6cCpGcDvWG9cQAXTOnwIsagdb/DMGrFYC4bsRt7JXLr5Y9ss LIFBMlxgK8zEC/tNtIEgV3AtnrUuEMQYtVROYYd2ABoSAnDtazK4MzhdBccv/DItK/7fbX3tU k5aW4ofhVgEVVIgXsVJHQq9AOtOM5Qa+NQ8pHzbzQCrB/jwL7grHDyHBTzKmCA8pW0eNYIrSK mTBWhX2d9KwAczrwuoM3jMoAMlU+tTPA/cb3Y+8pWRzDrzU1j+i5b509IKc0ENNJJ4Odqd7xA J/5C+ubzjhL1m73JOmIGzLNCy24xMr+9NSKwb/25T++JTGDCWj63r6F+wNHbI8n58dT3clscs W+GaGsYq8MbNWBhnRr6bwZLWQqHJ5xmyaWm/muJiLwwaDTiLeRD1vz2lSu5Q0koaat7T2vHQn sGBna5fE/pWVJUGoTE/to1pP4zmG4O8VKy58+P70k/AS4nETK7vUknRh/QpoYti8iNsJbwzBU /acPtKVPP7KksMCt66ogeR3qPXQ15cvyaOCPNg== 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 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: Riku Voipio , Laurent Vivier 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 Message-Id: <20180220173307.25125-4-laurent@vivier.eu> --- 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 Mon Feb 9 11:50:59 2026 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 1519581755459663.6288722276786; Sun, 25 Feb 2018 10:02:35 -0800 (PST) Received: from localhost ([::1]:55406 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq0d7-0003eH-FO for importer@patchew.org; Sun, 25 Feb 2018 13:02:33 -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+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 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; =20 /* 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. */ =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..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) =3D=3D 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) =3D=3D EF_MIPS_ARCH_64R6) { + return "I6400"; + } return "5KEf"; } #endif --=20 2.14.3