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.
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:
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!
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?
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..
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.
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.
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 ?