From patchwork Tue Jan 16 17:25:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 861802 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 3zLcgM12xLz9sRm for ; Wed, 17 Jan 2018 04:30:23 +1100 (AEDT) Received: from localhost ([::1]:50888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebV41-0003og-6X for incoming@patchwork.ozlabs.org; Tue, 16 Jan 2018 12:30:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebUzR-00007v-8d for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebUzO-0001PH-5Q for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:37 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:62379) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebUzN-0001O0-FF for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:33 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.167]) with ESMTPSA (Nemesis) id 0Ll1qT-1fA0K73vVt-00apEa; Tue, 16 Jan 2018 18:25:15 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 18:25:07 +0100 Message-Id: <20180116172510.28878-2-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180116172510.28878-1-laurent@vivier.eu> References: <20180116172510.28878-1-laurent@vivier.eu> X-Provags-ID: V03:K0:r18X9qdjoA3nqRc14eLiHqmayNMWD0bPdwHaGfSrGTVuzUMGS4G FUydcpnpjqrvWdtAwIJZxsEjZu3Q/OYUoE3cAj/Z2OKITRsWLbw1SkrkTfnnhZYD6oiHYnu iSNELNvtH0JVa99rpEIV6NHJ+TqrWVr8uFU0edDhY/Edtpomt6ETRi4uHHLyZeC1dj5eYjl lYv7XqpjsdXZx5yppyB7A== X-UI-Out-Filterresults: notjunk:1; V01:K0:l47QjMxR9OI=:I3Wn7ZNYmQVoeezSBv8XBd jCjc5WpB4th3Hrd2IjsOzbrHyeFD8xjeYcYS6lcyCDW7tFblhz3g2FxDHzVuf2AYog1YnXCCD JHCV2Eo7cwANzMh3JQi1YzxGFrXCzDYrK/LJ5l4GbJXLS4KA5fzHTNNNCLXq2ZW4CVhIiFpzc Vw8gtyP8IEmjFOauu6etTTapk65X2AQg3MsVKBhjXo0DToPjS5NAKaJ1F51DMiUP/spBMHcYV Kw+SSkZMbTp4g9WF8bNlrC1ze6lz/aUCBPCVIqkb4iJ4Db2YNwn0Vf5kNTODYSyy2bxF/8eMq ayQPVvA5Gw9Wp+aU3cxITKDgN/H3zjDJ3pzN9qhBZDf4IhA15xYSENRZBUWAIRbZi5pTYNoSq 7wipkdjHag/xhBzzWREu/u3w75X4CI7J4x7PA+0cUcMRlarEcaxECXayDDdfm2jqPYy5NvHyL /fYAA05o3am7yUz9X35AH0wzy5dz8qMjokDa6NK+ILp3t0A3GdLOn2Ngu10ZLmO3Zdjh8jm2s FoX3NbFmTBODV6BOPCRO+LI3aTpEeYdGmSa4ReBbynA5MCNAlIb62XaNQ85CUrNrAFqsMF/8Q VUDSgNBj0JgcMVYgfZI5T6H7bvPVhAv+UbVBBj+gVuwiLLfWA4qv2c7N/nLzlaM8IEy4eXJL/ gkmCqOrA/Md4g8IiCtWmoloi6IireB/9L+prvUiqreLLXWklzdn0gna4lOY51cWcCPMKpXfNz TmmtJVgEO4rylav75H54/MBQR2//M+C/w3qjzA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.135 Subject: [Qemu-devel] [PATCH v2 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_Mathieu-Daud=C3=A9?= , Laurent Vivier , Aaron Sierra Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 conflic in elfload.c Suggested-by: Richard Henderson Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- Notes: v2: new patch in the series 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 | 21 +++++++++++++++++++ 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, 289 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_elf.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" char *exec_path; @@ -4319,45 +4320,7 @@ int main(int argc, char **argv, char **envp) init_qemu_uname_release(); if (cpu_model == NULL) { -#if defined(TARGET_I386) -#ifdef TARGET_X86_64 - cpu_model = "qemu64"; -#else - cpu_model = "qemu32"; -#endif -#elif defined(TARGET_ARM) - cpu_model = "any"; -#elif defined(TARGET_UNICORE32) - cpu_model = "any"; -#elif defined(TARGET_M68K) - cpu_model = "any"; -#elif defined(TARGET_SPARC) -#ifdef TARGET_SPARC64 - cpu_model = "TI UltraSparc II"; -#else - cpu_model = "Fujitsu MB86904"; -#endif -#elif defined(TARGET_MIPS) -#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64) - cpu_model = "5KEf"; -#else - cpu_model = "24Kf"; -#endif -#elif defined TARGET_OPENRISC - cpu_model = "or1200"; -#elif defined(TARGET_PPC) -# ifdef TARGET_PPC64 - cpu_model = "POWER8"; -# else - cpu_model = "750"; -# endif -#elif defined TARGET_SH4 - cpu_model = "sh7785"; -#elif defined TARGET_S390X - cpu_model = "qemu"; -#else - cpu_model = "any"; -#endif + cpu_model = 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/target_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..f72f63a53c --- /dev/null +++ b/linux-user/ppc/target_elf.h @@ -0,0 +1,21 @@ +/* + * 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 +#ifdef TARGET_PPC64 +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "POWER8"; +} +#else +static inline const char *cpu_get_model(uint32_t eflags) +{ + 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_elf.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/target_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 From patchwork Tue Jan 16 17:25:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 861799 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 3zLcZc3mpnz9sQm for ; Wed, 17 Jan 2018 04:26:16 +1100 (AEDT) Received: from localhost ([::1]:50764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebV02-0000Df-JD for incoming@patchwork.ozlabs.org; Tue, 16 Jan 2018 12:26:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebUzV-0000Aj-86 for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebUzR-0001Rj-CQ for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:41 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:53531) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebUzR-0001Qs-1S for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:37 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.167]) with ESMTPSA (Nemesis) id 0M2HkO-1esCSN46Jo-00s58X; Tue, 16 Jan 2018 18:25:16 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 18:25:08 +0100 Message-Id: <20180116172510.28878-3-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180116172510.28878-1-laurent@vivier.eu> References: <20180116172510.28878-1-laurent@vivier.eu> X-Provags-ID: V03:K0:PZqPfo3/tpaZKKS0yG6IhNk8hB45MD5r/wDklPZ2kF92eejf+/6 tIrVg+uXtef2JS+WYtj299MnYmZvZupBwa2oefPyw3DfswHDz+5BAcD+qwszX8+jN9KqDot F5oMJY4OkOdhhr2WaqFH53oAI47nrvigwjDv1f6cMTOOx/nI46jyECBlmAxz5a5HhaGwfS6 B2ff+/OSY3ZY+QEaVpNzQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:TSHAGhvCx7g=:id6nfakILOKJvdhvPPXNIN 12VKatT+FglitKUVimEgkX2HcwttDnccq/tZt+KwFh8gar1Qxyy1ikLQFG6Ibr9YgbVZWwzTz Z0PACBCz8reUEmmhez37csOU96u/hewWcxL6rokw+OUXFBEZCtsZ/BU7tI1Q0it+fJ6E3mBwP MbeKbpB1xoSkwe9rg5CQsVsn76Uo9fu8EAlDtiInaKyxmPyJvhRYI4E12rJNbRjyusToR4CsV 3/zrL4kSHtPHLKwmETyrOHWC2w1htUlaRM1PuN/R/VJ1HcaM96avw1xkohgsxo7h3/7jsbjNa 93cqa0uBWyHi+uNWDUEZp9YR9nhXqKQbVSZb0efkeU8Uyo8g1mFj8WQu866G15/K5a0sIllsW breiZmj8DRI1rc5yseEYjqTZ+MhBCjDzlDtg6Ji3n48DVXdXq8quzWx7TI+gO1pPHHsynB4bz D4XayMf/5ZMNk2nhF2PMXUHk/qnRNLle/Xz5jFxs22YBWPmgMVHSsMuS86vnu6kHUM+Iguacs ePhESZtDRDGaCdjxB8sMRfMOcQBD3WGa+zDByoi6EU5HN43zyhDdGrBZveHQov4TpUfV6SaDC K94UIh6jnCl2o9pw2tE/oQNnNQjelrvjQ+d291bqvSbQ2hD6iLrBjw8IDvxJXqlucjUD6VL89 /soANj5D9GOGIMkVvN7qGfgLvTPCqIkeiDhhOYVMQpNOWdSmNkK9CFuwAIzuHDey6pzC/rIjX sVV1tJMYvJQUlUwbR0yJunDwaXwpt9VqJGTWxQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.131 Subject: [Qemu-devel] [PATCH v2 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_Mathieu-Daud=C3=A9?= , Laurent Vivier , Aaron Sierra Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: YunQiang Su Add a function to return ELF e_flags and use it to select the CPU model. [lv: split the patch and some cleanup in get_elf_eflags()] Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- Notes: YunQiang Su, please add your Signed-off-by that was missing in your original patch. v2: call cpu_get_model() with the result of get_elf_eflags() 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); } +uint32_t get_elf_eflags(int fd) +{ + struct elfhdr ehdr; + off_t offset; + int ret; + + /* Read ELF header */ + offset = lseek(fd, 0, SEEK_SET); + if (offset == (off_t) -1) { + return 0; + } + ret = read(fd, &ehdr, sizeof(ehdr)); + if (ret < sizeof(ehdr)) { + return 0; + } + offset = lseek(fd, offset, SEEK_SET); + if (offset == (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) init_qemu_uname_release(); + execfd = qemu_getauxval(AT_EXECFD); + if (execfd == 0) { + execfd = open(filename, O_RDONLY); + if (execfd < 0) { + printf("Error while loading %s: %s\n", filename, strerror(errno)); + _exit(EXIT_FAILURE); + } + } + if (cpu_model == NULL) { - cpu_model = cpu_get_model(0); + cpu_model = 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 = ts; task_settid(ts); - execfd = qemu_getauxval(AT_EXECFD); - if (execfd == 0) { - execfd = open(filename, O_RDONLY); - if (execfd < 0) { - printf("Error while loading %s: %s\n", filename, strerror(errno)); - _exit(EXIT_FAILURE); - } - } - ret = loader_exec(execfd, filename, target_argv, target_environ, regs, info, &bprm); if (ret != 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 *); +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); From patchwork Tue Jan 16 17:25:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 861798 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 3zLcZV2K52z9sR8 for ; Wed, 17 Jan 2018 04:26:09 +1100 (AEDT) Received: from localhost ([::1]:50759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebUzu-00008o-8u for incoming@patchwork.ozlabs.org; Tue, 16 Jan 2018 12:26:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebUzR-00007q-7d for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebUzO-0001P7-54 for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:37 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:64350) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebUzN-0001Ny-GX for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:33 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.167]) with ESMTPSA (Nemesis) id 0LeyNP-1fBc4R30Fr-00qkb0; Tue, 16 Jan 2018 18:25:16 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 18:25:09 +0100 Message-Id: <20180116172510.28878-4-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180116172510.28878-1-laurent@vivier.eu> References: <20180116172510.28878-1-laurent@vivier.eu> X-Provags-ID: V03:K0:jKv9j/8VNDYsTAzJhTZujKkfSYX+D2C3Y4MzGTjnxkSSrG1CsY9 qn6JB6zStdH/bWn4qjmykFMx1ICSXRYtjFsZ8vAw/8u/0wyfkb5Fhgtx5Dr7hh6Kn4T2N3D MIoGb3u5ukDh7AdB6gqaIi76asY8vtAJIoS6MycfGzE4DMqQHKXAac5inaCiKaRkWP+Kci7 QC7/cCU9yfKqItDaXAQCA== X-UI-Out-Filterresults: notjunk:1; V01:K0:rqNknZuqkZU=:g8D8j6j+fen1sb3EnfAN6m TSfmvBJ+yWNYa+6SUJn8mhsBhJsUR1p7LDiczRLi3euxo0yZwzTm59f/Jra9BF2GtYkCr8QmH u8dWVX1Q/ne3DtDnOTGYRynA+Y7CID38TePTD9Pu3u+BDbDURZEQ66gU5Jw2g9z1xqdM6nDDY Gau7Kz9ReBExzSUIZD26yPOTHV6tSkr+gIvj+xblks3edcENV9vgZh8Mkig7IQcXYbcdDvQ4c Q8+SngiHyyzPIHW2zaz7QbK/EKO8ObK9neMc8Lohf55bFb7sZx4zC6bFuCKWk96BKnS1auc/K Kz7SdrJtbJ9YKxuuDwiGiNgKuKC/nlyEAzZLXhxuc48mKyWgnyLTJzahJlRyfFsaMtOiwgT1B yG5U/AOxIRJ/kDZxXuXufXEKm7IGyXx7JTS4Zfi6Fy0xD2/AFIMNaFly5l+7NGdSg1r8Itwcp 3nS1MsECymm1+v5vfFPwU2E3LiWxPozcFfwDg11En6cjWTjGW0JTNT0QgIgyZQ5w2jFUx9Isq DerJ3jdbFDZdmKNXkI2OpH/EtKWUJ5tKctuH0w5Tdwn84JGbaYF9jQUM0T2Oc/EEV3qwXcMyk eJG2ViAvRS+88F2aMcqXpoCkR+odVibVaq2a4B3yZG7qx3gyWBBfAjYCJOIKrhdaTqvVOWFVg l6qfs1VeUQIAKO1HzocdvmvFbIceaBkGkcEbS+hR8aCybUrRI0PWYgcGU//fytWS2R8iWygOQ PiKb8rygpxNyRWLGwoikYpH36ns2zz6SIQhKmg== 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 v2 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_Mathieu-Daud=C3=A9?= , Laurent Vivier , Aaron Sierra Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 ("m68020" 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 --- Notes: v2: call cpu_get_model() with the result of get_elf_eflags() linux-user/m68k/target_elf.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux-user/m68k/target_elf.h b/linux-user/m68k/target_elf.h index df375ad5d3..946b90f342 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 == 0) { + /* 680x0 */ + return "m68020"; + } + + /* Coldfire */ return "any"; } #endif From patchwork Tue Jan 16 17:25:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 861800 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 3zLcd51QQ3z9sRm for ; Wed, 17 Jan 2018 04:28:25 +1100 (AEDT) Received: from localhost ([::1]:50816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebV27-0001ni-95 for incoming@patchwork.ozlabs.org; Tue, 16 Jan 2018 12:28:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebUzS-00008E-2d for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebUzO-0001PC-53 for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:38 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:50578) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebUzN-0001Nx-EX for qemu-devel@nongnu.org; Tue, 16 Jan 2018 12:25:33 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.167]) with ESMTPSA (Nemesis) id 0LdZry-1fJ3GR1s3O-00ilRj; Tue, 16 Jan 2018 18:25:17 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 18:25:10 +0100 Message-Id: <20180116172510.28878-5-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180116172510.28878-1-laurent@vivier.eu> References: <20180116172510.28878-1-laurent@vivier.eu> X-Provags-ID: V03:K0:OA1d0sb3PUoR1gJFOKLgLHnvV7xJRzEFiYC5CsOnk8x9CJOxA4X HczkfU87u4k4jFWKet16D3JIVuQAYGmxok9rHXYRHu9G8yZnBkZEYFeY2/1rF5IKA7vV6b9 umvX/tHCY3yXVjB7AGkcFw/HZnwYBIer8V/TzHz7Kd4a+JdfLIYb4hFkIwajXKBhG9MCTKR 2RZOSUu3w9Py7sfvPMgLw== X-UI-Out-Filterresults: notjunk:1; V01:K0:3Blvu7RG5dc=:ya3Us2/IFvnvWbhqod2F4W frapH6rGbVSDhsAUIezyBv5Fdea1iF0vyqjJMqUJYa1msagj0aZ+6KsnQebVaryXcLCgTwZOF 3xu9s4CvIgr0opuIqHHasWZoWNiix1aRAUzmIqp14QbsRPmmTn873n1OL/SreBAx3X7gw7k1a JDttAsAJ/d4OGdsVd+R1xFmMLfj+erk9R8aUEpePBtD9Xls/O4bPPFg8y3ybXMterxJ8lD22h tq8i1hX8LcCvYx/2oVGgShOpwq/8h8Z+s3P4ekBygpTPZ8IeJY74hm/wtsrs0Owt8BtsUBkyY /ZJonm093M09YKxMluUw5ss3NopoFazvmmX3/8yvYPiOexLr7F/mugayMQbqU+VPSafpPMqnP /TPf/a1TSgbnCW/JLb+5s3I7m23eTveIeRFLcsCzI5v0pqyeKWIieIcKvwyxm7LYyzcWsjFUB U1/IAwuqeLcs4h6urddGmXpkVG1ueDodlkIQqNNpFUhWpJEDO3AxMz2lDHmRLsqV5Tjrv2krW 9zW3zksdMcJiAWmjKmK/B/fb7npHUUio34S7Ewy5ChLH6O7wd85aT2SxsS7k2G2aXIe3rhHHW /bypnoRmJXbF5jIjfcL5ZFv5VyGNu76KOHQjpQrwsIpOXps1QU9V5iJlGvqPVjTMx1Vj4FtBF oYW7RlHEs7tKQHvVXLUkMJ8B1YVaRd9gWcQ/gHSmB/+R5t8h3YLsl7/i/oMz0qbwdBn/g2fvJ lBFgQs5ZM4xEqB+HnaxejBscIC1AbL7qVBW7YA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.135 Subject: [Qemu-devel] [PATCH v2 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 , 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. [lv: original patch modified to move code into cpu_get_model()] Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- Notes: YunQiang Su, please add your Signed-off-by that was missing in your original patch. v2: call cpu_get_model() with the result of get_elf_eflags() 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 e8a515ce3d..f2104809b1 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. */ /* 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..ac14f99ac5 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) != 0) { + return "mips32r6-generic"; + } return "24Kf"; } #endif diff --git a/linux-user/mips64/target_elf.h b/linux-user/mips64/target_elf.h index 5b6f4692e0..6cda7ae435 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) != 0) { + return "I6400"; + } return "5KEf"; } #endif