Bochs/VMWare problems - weird results
Posted: Thu Jun 16, 2011 12:42 am
My basic setup right now uses pxe to load a kernel and switch to long mode. Long mode is where things are getting truly bizarre for me. I switch directly from 16-bit to long mode
without using 32-bit pmode in between (as explained in a forum post by Brendan and a few articles in the wiki). This is working fine on a live machine and all runs exactly as expected.
When I run on either bochs/etherboot or VMWare player I get truly bizarre differences. Since either is extremely convenient to use for development I would love to figure out what exactly I'm doing wrong to freak them out so bad. Here's what they're doing:
VMWare Player: So far this is the best pxe support I've found in a VM environment. But after I enter long mode I have a really weird GPF (exception 13) happening when I try to ret from a function call. I've enabled an IDT with all exception handlers and so know it's a GPF, but no other exceptions (like paging) beforehand to give any clues. I'm identity mapping the first 2mb of ram and from what I can tell it is setup correctly (i.e. works on real machine). Just no clue why I get a GPF on a ret. If I hand code a print routine (without using calls) it works fine. My first suspicion was a stack problem, but I can push/pop over 100 qwords and no stack exceptions. I've double checked the code to make sure all push/pop are matched as well.
After that I tried using bochs with etherboot (gpxe). This is kludgy as hell using the PCI pseudo-nic but it does load a kernel. First weird thing is that even with interrupts disabled and PXE unloaded the pseudo-nic sends interrupts. Weird thing the second, as soon as I try to set cr4 in my paging setup code it locks the vm. I can ctrl-c out and quit, but am unable to step to see where the problem is.
Any thoughts on this? I'd also love to find out what you guys use as a setup for VM type things for testing. Since I use pxe that sort of limits me from what I can tell, but having the debugger around in bochs is definitely useful. Basically I'm just looking for advice to prevent having to reboot all the time.
Thanks!
Mike
without using 32-bit pmode in between (as explained in a forum post by Brendan and a few articles in the wiki). This is working fine on a live machine and all runs exactly as expected.
When I run on either bochs/etherboot or VMWare player I get truly bizarre differences. Since either is extremely convenient to use for development I would love to figure out what exactly I'm doing wrong to freak them out so bad. Here's what they're doing:
VMWare Player: So far this is the best pxe support I've found in a VM environment. But after I enter long mode I have a really weird GPF (exception 13) happening when I try to ret from a function call. I've enabled an IDT with all exception handlers and so know it's a GPF, but no other exceptions (like paging) beforehand to give any clues. I'm identity mapping the first 2mb of ram and from what I can tell it is setup correctly (i.e. works on real machine). Just no clue why I get a GPF on a ret. If I hand code a print routine (without using calls) it works fine. My first suspicion was a stack problem, but I can push/pop over 100 qwords and no stack exceptions. I've double checked the code to make sure all push/pop are matched as well.
After that I tried using bochs with etherboot (gpxe). This is kludgy as hell using the PCI pseudo-nic but it does load a kernel. First weird thing is that even with interrupts disabled and PXE unloaded the pseudo-nic sends interrupts. Weird thing the second, as soon as I try to set cr4 in my paging setup code it locks the vm. I can ctrl-c out and quit, but am unable to step to see where the problem is.
Any thoughts on this? I'd also love to find out what you guys use as a setup for VM type things for testing. Since I use pxe that sort of limits me from what I can tell, but having the debugger around in bochs is definitely useful. Basically I'm just looking for advice to prevent having to reboot all the time.
Thanks!
Mike