VMX: modify CPUID emulation to return APIC ID in ebx
authorGan Shun <ganshun@gmail.com>
Tue, 24 Jan 2017 18:12:44 +0000 (10:12 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 25 Jan 2017 20:07:36 +0000 (15:07 -0500)
Signed-off-by: Gan Shun <ganshun@gmail.com>
Change-Id: I90b9a22d351080957b37b38320b4096bbcecd221
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/arch/x86/trap.c

index d21f0b2..78b165d 100644 (file)
@@ -894,6 +894,10 @@ static bool handle_vmexit_cpuid(struct vm_trapframe *tf)
                        /* Unset the perf capability bit so that the guest does not try
                         * to turn it on. */
                        ecx &= ~(1 << 15);
+
+                       /* Set the guest pcore id into the apic ID field in CPUID. */
+                       ebx &= 0x00ffffff;
+                       ebx |= tf->tf_guest_pcoreid << 24;
                        break;
                case 0x0A:
                        eax = 0;