Page 1 of 1

VMware problem with AP bootup and POPF

Posted: Tue Aug 26, 2008 12:57 pm
by xyzzy
I've come across an interesting problem when testing my SMP support in VMware. In both my BSP and AP bootup code, I clear EFLAGS by doing the following:

Code: Select all

push $0
popf
This works fine in both cases in QEMU, and on 2 real machines. In VMware, however, it works fine in the BSP case, but not on the AP, instead it causes a triple fault on the POPF. Even this faults:

Code: Select all

pushf
popf
Unfortunately I can't see exactly what exception it's causing, but am I missing something obvious here? I have a stack set up correctly and a GDT, and all segment registers are set correctly. Anyone know what could be causing this?

Re: VMware problem with AP bootup and POPF

Posted: Tue Aug 26, 2008 1:07 pm
by xyzzy
Eeek, I feel such an idiot now! Minutes after I posted this I realised that I'd allocated the AP's stack using the kernel heap, and then attempted to convert the allocated address to a physical address as if it were an address in the physical map area. That's what I get for coding while tired :roll:

Re: VMware problem with AP bootup and POPF

Posted: Tue Aug 26, 2008 1:34 pm
by Stevo14
The scary part is that the code worked fine in Qemu and on two real machines with that bug in it... :? weird.

Re: VMware problem with AP bootup and POPF

Posted: Tue Aug 26, 2008 1:42 pm
by xyzzy
I assume it was because the address I was ending up with was free physical memory, whereas VMware was probably using it for special purposes (i.e. it wasn't usable memory, and instead some memory-mapped I/O or something).