Difference between VirtualBox, VMWare and bochs and pc

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Srowen
Member
Member
Posts: 60
Joined: Thu Feb 26, 2009 2:31 pm
Location: Genova, ITALY

Difference between VirtualBox, VMWare and bochs and pc

Post 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!
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Difference between VirtualBox, VMWare and bochs and pc

Post 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
Srowen
Member
Member
Posts: 60
Joined: Thu Feb 26, 2009 2:31 pm
Location: Genova, ITALY

Re: Difference between VirtualBox, VMWare and bochs and pc

Post 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..
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Difference between VirtualBox, VMWare and bochs and pc

Post 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
Srowen
Member
Member
Posts: 60
Joined: Thu Feb 26, 2009 2:31 pm
Location: Genova, ITALY

Re: Difference between VirtualBox, VMWare and bochs and pc

Post by Srowen »

I've deleted the sti instruction everywhere but nothing has changed... Same message from bochs..
Srowen
Member
Member
Posts: 60
Joined: Thu Feb 26, 2009 2:31 pm
Location: Genova, ITALY

Re: Difference between VirtualBox, VMWare and bochs and pc

Post 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..
User avatar
alethiophile
Member
Member
Posts: 90
Joined: Sat May 30, 2009 10:28 am

Re: Difference between VirtualBox, VMWare and bochs and pc

Post 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.
If I had an OS, there would be a link here.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Difference between VirtualBox, VMWare and bochs and pc

Post 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.
If a trainstation is where trains stop, what is a workstation ?
Post Reply