From: YunQiang Su <syq@debian.org>
So here we need to detect the version of binaries and set
cpu_model for it.
[lv: original patch modified to move code into get_cpu_model()]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
Notes:
YunQiang Su, please add your Signed-off-by that was
missing in your original patch.
include/elf.h | 4 ++++
linux-user/main.c | 10 ++++++++++
2 files changed, 14 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/main.c b/linux-user/main.c
index 2fc2267fd4..3229ef079e 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4285,9 +4285,19 @@ static const char *get_cpu_model(int fd)
return "Fujitsu MB86904";
#endif
#elif defined(TARGET_MIPS)
+ int ret;
+ uint32_t eflags;
+
+ ret = get_elf_eflags(fd, &eflags);
#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
+ if (ret == 0 && (eflags & EF_MIPS_ARCH_64R6) != 0) {
+ return "I6400";
+ }
return "5KEf";
#else
+ if (ret == 0 && (eflags & EF_MIPS_ARCH_32R6) != 0) {
+ return "mips32r6-generic";
+ }
return "24Kf";
#endif
#elif defined TARGET_OPENRISC
--
2.14.3
On Sat, Jan 13, 2018 at 10:48 PM, Laurent Vivier <laurent@vivier.eu> wrote:
> From: YunQiang Su <syq@debian.org>
>
> So here we need to detect the version of binaries and set
> cpu_model for it.
>
> [lv: original patch modified to move code into get_cpu_model()]
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>
> Notes:
> YunQiang Su, please add your Signed-off-by that was
> missing in your original patch.
How to add Signed-off-by? Send a v2 for my version of patch?
>
> include/elf.h | 4 ++++
> linux-user/main.c | 10 ++++++++++
> 2 files changed, 14 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/main.c b/linux-user/main.c
> index 2fc2267fd4..3229ef079e 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -4285,9 +4285,19 @@ static const char *get_cpu_model(int fd)
> return "Fujitsu MB86904";
> #endif
> #elif defined(TARGET_MIPS)
> + int ret;
> + uint32_t eflags;
> +
> + ret = get_elf_eflags(fd, &eflags);
> #if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
> + if (ret == 0 && (eflags & EF_MIPS_ARCH_64R6) != 0) {
> + return "I6400";
> + }
> return "5KEf";
> #else
> + if (ret == 0 && (eflags & EF_MIPS_ARCH_32R6) != 0) {
> + return "mips32r6-generic";
> + }
> return "24Kf";
> #endif
> #elif defined TARGET_OPENRISC
> --
> 2.14.3
>
Le 17/01/2018 à 03:26, YunQiang Su a écrit : > On Sat, Jan 13, 2018 at 10:48 PM, Laurent Vivier <laurent@vivier.eu> wrote: >> From: YunQiang Su <syq@debian.org> >> >> So here we need to detect the version of binaries and set >> cpu_model for it. >> >> [lv: original patch modified to move code into get_cpu_model()] >> Signed-off-by: Laurent Vivier <laurent@vivier.eu> >> --- >> >> Notes: >> YunQiang Su, please add your Signed-off-by that was >> missing in your original patch. > > How to add Signed-off-by? Send a v2 for my version of patch? You can reply to your original patch with your "Signed-off-by". And as I did some changes in the following series, it would be good to reply with a "Reviewed-by" to the new patches if you agree with the changes. Thanks, Laurent
Le 17/01/2018 à 03:26, YunQiang Su a écrit : > On Sat, Jan 13, 2018 at 10:48 PM, Laurent Vivier <laurent@vivier.eu> wrote: >> From: YunQiang Su <syq@debian.org> >> >> So here we need to detect the version of binaries and set >> cpu_model for it. >> >> [lv: original patch modified to move code into get_cpu_model()] >> Signed-off-by: Laurent Vivier <laurent@vivier.eu> >> --- >> >> Notes: >> YunQiang Su, please add your Signed-off-by that was >> missing in your original patch. > > How to add Signed-off-by? Send a v2 for my version of patch? > Could you reply to you original patch with your Signed-off-by? Thanks, Laurent
© 2016 - 2026 Red Hat, Inc.