Skip to contentSkip to conversation

linux-user/uname: Return correct uname string for x86_64

PATCH In review Peter Maydell 2 participants 5 messages May 10, 2014 – Jun 6, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user/uname: Return correct uname string for x86_64

We were returning the incorrect uname string (with a hyphen, not an underscore) for x86_64. Fix this by removing the x86_64 special case, since the default "just use UNAME_MACHINE" behaviour suffices. This leaves cpu_to_uname_machine() special cases for only those architectures which need to vary the string based on runtime CPU features.

---
 linux-user/uname.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
linux-user/uname.c +1 -3
index f5d4c66..1e6560d 100644
@@ -52,9 +52,7 @@ const char *cpu_to_uname_machine(void *cpu_env)
     /* earliest emulated CPU is ARMv5TE; qemu can emulate the 1026, but not its
      * Jazelle support */
     return "armv5te" utsname_suffix;
-#elif defined(TARGET_X86_64)
-    return "x86-64";
-#elif defined(TARGET_I386)
+#elif defined(TARGET_I386) && !defined(TARGET_X86_64)
     /* see arch/x86/kernel/cpu/bugs.c: check_bugs(), 386, 486, 586, 686 */
     CPUState *cpu = ENV_GET_CPU((CPUX86State *)cpu_env);
     int family = object_property_get_int(OBJECT(cpu), "family", NULL);
Signature · 1 line
1.9.2
#1 lore raw

Ping!

thanks
-- PMM

Quoted 31 lines · Peter Maydell

We were returning the incorrect uname string (with a hyphen, not an underscore) for x86_64. Fix this by removing the x86_64 special case, since the default "just use UNAME_MACHINE" behaviour suffices. This leaves cpu_to_uname_machine() special cases for only those architectures which need to vary the string based on runtime CPU features.

---
 linux-user/uname.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
linux-user/uname.c +1 -4
index f5d4c66..1e6560d 100644
@@ -52,9 +52,7 @@ const char *cpu_to_uname_machine(void *cpu_env)
     /* earliest emulated CPU is ARMv5TE; qemu can emulate the 1026, but not its
      * Jazelle support */
     return "armv5te" utsname_suffix;
-#elif defined(TARGET_X86_64)
-    return "x86-64";
-#elif defined(TARGET_I386)
+#elif defined(TARGET_I386) && !defined(TARGET_X86_64)
     /* see arch/x86/kernel/cpu/bugs.c: check_bugs(), 386, 486, 586, 686 */
     CPUState *cpu = ENV_GET_CPU((CPUX86State *)cpu_env);
     int family = object_property_get_int(OBJECT(cpu), "family", NULL);
--

1.9.2

#2 lore raw

Hi,

Quoted 1 line · Peter Maydell

Ping!

Looks good, I'll collect this and other linux-user patches and submit linux-user update by tomorrow.

Riku

Quoted 35 lines

thanks
-- PMM

Quoted 31 lines · Peter Maydell

We were returning the incorrect uname string (with a hyphen, not an underscore) for x86_64. Fix this by removing the x86_64 special case, since the default "just use UNAME_MACHINE" behaviour suffices. This leaves cpu_to_uname_machine() special cases for only those architectures which need to vary the string based on runtime CPU features.

---
 linux-user/uname.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
linux-user/uname.c +1 -4
index f5d4c66..1e6560d 100644
@@ -52,9 +52,7 @@ const char *cpu_to_uname_machine(void *cpu_env)
     /* earliest emulated CPU is ARMv5TE; qemu can emulate the 1026, but not its
      * Jazelle support */
     return "armv5te" utsname_suffix;
-#elif defined(TARGET_X86_64)
-    return "x86-64";
-#elif defined(TARGET_I386)
+#elif defined(TARGET_I386) && !defined(TARGET_X86_64)
     /* see arch/x86/kernel/cpu/bugs.c: check_bugs(), 386, 486, 586, 686 */
     CPUState *cpu = ENV_GET_CPU((CPUX86State *)cpu_env);
     int family = object_property_get_int(OBJECT(cpu), "family", NULL);
--

1.9.2

#3 lore raw
Quoted 7 lines · Riku Voipio

Hi,

Quoted 1 line · Peter Maydell

Ping!

Looks good, I'll collect this and other linux-user patches and submit linux-user update by tomorrow.

Does that include the set you did fixing gcc 4.9 compiles? I forget whether that had issues that needed a v2 or not.

thanks
-- PMM

#4 lore raw
Quoted 11 lines · Peter Maydell
Quoted 7 lines · Riku Voipio

Hi,

Quoted 1 line · Peter Maydell

Ping!

Looks good, I'll collect this and other linux-user patches and submit linux-user update by tomorrow.

Does that include the set you did fixing gcc 4.9 compiles? I forget whether that had issues that needed a v2 or not.

The only issue is that nobody reviewed it. I've updated the patchset a bit with better description and replaced ifdeffing of restore_fpu_state with removin the lines. I'll send it on the list again so people have another chance to look at the patches.

Riku