Page 1 of 1

Difference between VirtualBox, VMWare and bochs and pc

Posted: Fri Aug 27, 2010 1:57 am
by Srowen
Until last two days I test my os on VirtualBox VMWare and Parallels (I'm under osx 10.6). My os works great without any problem.
But now I've tested it on my real pc (a pentium 4) and in bochs and i've got a general protection fault immediately after when I call the fork exactly when the new process is scheduled. I have to say that I've tested my os in real pc some times ago and it works and only now that i do some upgrades I've got this error.
Bochs says this:

Code: Select all

00014697850e[CPU  ] load_seg_reg: GDT: GS: index(0f22) > limit(000023)
It seems that i'm trying to load a wrong value in the GS register. Track down this error isn't easy also because my os works in the other 3 virtual machines. So, maybe it could be easier to do if someone know some difference between VirtualBox VMWare and Parallels and Bochs and a real PC.
Thank's for the answers!

Re: Difference between VirtualBox, VMWare and bochs and pc

Posted: Fri Aug 27, 2010 2:43 am
by AJ
Hi,

I can't give you an exact solution on this, but the cause seems to be that your stack is becoming corrupted somewhere in your task switching code. When you execute POP GS, you are actually popping the value of EFLAGS or the return IP.

Could it be that in bochs or on real hardware you have somehow received a hardware interrupt during your task switching code?

Cheers,
Adam

Re: Difference between VirtualBox, VMWare and bochs and pc

Posted: Fri Aug 27, 2010 2:51 am
by Srowen
AJ wrote:Hi,

I can't give you an exact solution on this, but the cause seems to be that your stack is becoming corrupted somewhere in your task switching code. When you execute POP GS, you are actually popping the value of EFLAGS or the return IP.

Could it be that in bochs or on real hardware you have somehow received a hardware interrupt during your task switching code?

Cheers,
Adam
When an interrupt comes, the first think that i do is to execute the cli instruction and before the iret I use the sti instruction..so no interrupt should come during the task switch..

Re: Difference between VirtualBox, VMWare and bochs and pc

Posted: Fri Aug 27, 2010 3:22 am
by AJ
When an interrupt comes, the first think that i do is to execute the cli instruction and before the iret I use the sti instruction..so no interrupt should come during the task switch..
There's one potential problem. IRET enables interrupts, so you shouldn't need to manually do this. It is certainly possible for a timer interrupt to occur between the time you STI and IRET. You shouldn't need the CLI, either.

Cheers,
Adam

Re: Difference between VirtualBox, VMWare and bochs and pc

Posted: Fri Aug 27, 2010 3:28 am
by Srowen
I've deleted the sti instruction everywhere but nothing has changed... Same message from bochs..

Re: Difference between VirtualBox, VMWare and bochs and pc

Posted: Fri Aug 27, 2010 2:49 pm
by Srowen
I've track down the problem. There was a bug copying a page in an another page. Now it is fixed and it works.

P.S.: I think that Bochs is the best emulator for the os dev..

Re: Difference between VirtualBox, VMWare and bochs and pc

Posted: Tue Aug 31, 2010 10:26 pm
by alethiophile
I've also had persistent bugs in Bochs that haven't shown up in Qemu or on hardware. At the moment I'm more or less disregarding them; maybe someday I'll get around to fixing them. It could be that Bochs is catching the worst-possible-case of some obscure concurrency bug every time, which is a good thing, or it could be that Bochs is just overly sensitive.

Re: Difference between VirtualBox, VMWare and bochs and pc

Posted: Wed Sep 01, 2010 1:29 am
by gerryg400
I use vmware for initial tests and real hardware after that. One big difference I've noticed is that on real hardware, physical memory is not always zeroed. Perhaps the bios, or grub, left some data in some pages. Anyway, I had a codepath in my memory manager that in some cases failed to zero new pagetables. This caused random crashes on real hardware that I never saw in vmware.