Cpuid leaf 0x1, ebx, was reporting the number of logical processors from
the host OS.  We should be reporting the number of guest cores.

Similarly, I added a masking of the APIC core id to one byte, in the off
chance that would cause a problem.

Signed-off-by: Barret Rhoden <[email protected]>
---
 kern/arch/x86/trap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kern/arch/x86/trap.c b/kern/arch/x86/trap.c
index 3e7e5b779622..aa73e6e4dd42 100644
--- a/kern/arch/x86/trap.c
+++ b/kern/arch/x86/trap.c
@@ -896,8 +896,9 @@ static bool handle_vmexit_cpuid(struct vm_trapframe *tf)
                        ecx &= ~(1 << 15);
 
                        /* Set the guest pcore id into the apic ID field in 
CPUID. */
-                       ebx &= 0x00ffffff;
-                       ebx |= tf->tf_guest_pcoreid << 24;
+                       ebx &= 0x0000ffff;
+                       ebx |= (current->vmm.nr_guest_pcores & 0xff) << 16;
+                       ebx |= (tf->tf_guest_pcoreid & 0xff) << 24;
                        break;
                case 0x0A:
                        eax = 0;
-- 
2.12.2.762.g0e3151a226-goog

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to