qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] i386 return APIC ID with cpuid
@ 2007-03-20 22:18 Bernhard Kauer
  0 siblings, 0 replies; only message in thread
From: Bernhard Kauer @ 2007-03-20 22:18 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 116 bytes --]

Hi,

cpuid(01H) on i386 does not return the initial APIC id.
The following patch correct this.


    Bernhard Kauer

[-- Attachment #2: qemu2.diff --]
[-- Type: text/plain, Size: 1659 bytes --]

Index: hw/apic.c
===================================================================
RCS file: /sources/qemu/qemu/hw/apic.c,v
retrieving revision 1.12
diff -u -r1.12 apic.c
--- hw/apic.c	31 Jan 2007 12:22:18 -0000	1.12
+++ hw/apic.c	20 Mar 2007 22:13:09 -0000
@@ -816,6 +816,7 @@
     env->apic_state = s;
     apic_init_ipi(s);
     s->id = last_apic_id++;
+    env->cpuid_apic_id = s->id;
     s->cpu_env = env;
     s->apicbase = 0xfee00000 | 
         (s->id ? 0 : MSR_IA32_APICBASE_BSP) | MSR_IA32_APICBASE_ENABLE;
Index: target-i386/cpu.h
===================================================================
RCS file: /sources/qemu/qemu/target-i386/cpu.h,v
retrieving revision 1.41
diff -u -r1.41 cpu.h
--- target-i386/cpu.h	5 Feb 2007 22:06:27 -0000	1.41
+++ target-i386/cpu.h	20 Mar 2007 22:13:09 -0000
@@ -529,6 +529,7 @@
     uint32_t cpuid_xlevel;
     uint32_t cpuid_model[12];
     uint32_t cpuid_ext2_features;
+    uint32_t cpuid_apic_id;
     
 #ifdef USE_KQEMU
     int kqemu_enabled;
Index: target-i386/helper.c
===================================================================
RCS file: /sources/qemu/qemu/target-i386/helper.c,v
retrieving revision 1.74
diff -u -r1.74 helper.c
--- target-i386/helper.c	1 Feb 2007 22:12:19 -0000	1.74
+++ target-i386/helper.c	20 Mar 2007 22:13:10 -0000
@@ -1614,7 +1614,7 @@
         break;
     case 1:
         EAX = env->cpuid_version;
-        EBX = 8 << 8; /* CLFLUSH size in quad words, Linux wants it. */
+        EBX = (env->cpuid_apic_id << 24) | 8 << 8; /* CLFLUSH size in quad words, Linux wants it. */
         ECX = env->cpuid_ext_features;
         EDX = env->cpuid_features;
         break;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-03-20 22:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-20 22:18 [Qemu-devel] [PATCH] i386 return APIC ID with cpuid Bernhard Kauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).