Page 1 of 1

Bochs Works, Real PC Doesn't

Posted: Fri Nov 15, 2002 6:39 am
by PlayOS
Hi,

Just wondering if anyone knew why bochs would work, and a real PC will not?

I have just attempted to run my OS on a real PC and it failed to work. I have been developing it for a while and testing in bochs, but for some reason bochs allows what my PC doesn't.

Re:Bochs Works, Real PC Doesn't

Posted: Fri Nov 15, 2002 6:50 am
by Pype.Clicker
for the same kind of reason it could work on real PC #A and not on real PC #B, including (but not limited to):
  • bios aren't same, so one could have extension the other hasn't
  • clocks or cycles per instruction aren't same, so timings of CPU vs I/O aren't conserved and some I/O device might go wrong. For instance, some code i wrote for Pentium that used a short jmp to wait for I/O cycle completion didn't work on my new AMD K6-II because that computer had some jump-anticipation hardware that prevented it to flush its pipeline.
  • one of the PC don't have a standard hardware (laptops, mostly)
  • one has a bug the other hasn't...
welcome to the real world :-/

Re:Bochs Works, Real PC Doesn't

Posted: Fri Nov 15, 2002 6:54 am
by PlayOS
In my code I go into unreal mode, could this be the problem code?

I am going to test this, however I though maybe you have experienced this.

Re:Bochs Works, Real PC Doesn't

Posted: Fri Nov 15, 2002 7:16 am
by PlayOS
OK, this was the problem, now I need to know this (not really need, but more I want to know) how does GRUB get the kernel at 1MB+.

I have looked for the sources for GRUB and this site http://www.gnu.org/software/grub says that it is not realesed to the public yet.

So does anyone know how to get the kernel at or above 1MB, I was thinking that GRUB would read the floppy directly, but that would require alot of code, is this how it does it?

thanks.

Re:Bochs Works, Real PC Doesn't

Posted: Fri Nov 15, 2002 7:56 am
by Pype.Clicker
PlayOS wrote: In my code I go into unreal mode, could this be the problem code?
unreal mode is usually well-supported (though undocumented) by processors ... however, you should not expect your BIOS loads sectors beyond 1Mb barrier successfuly: you need a 2-steps code (first load from floppy using bios into a low-memory area and then move it above 1MB either with the help of unreal mode or through the high-mem-copy feature of BIOS INT15h ...

Re:Bochs Works, Real PC Doesn't

Posted: Fri Nov 15, 2002 8:26 am
by PlayOS
Yeah, I will probably try INT15 because I was loading the kernel in below 1MB and then copying it above so I dont know why it was failing.

Re:Bochs Works, Real PC Doesn't

Posted: Fri Nov 15, 2002 8:35 am
by Pype.Clicker
maybe you can also try to find a program that _do_ use unreal mode and see if it runs on your machine ...

Re:Bochs Works, Real PC Doesn't

Posted: Sat Nov 16, 2002 1:55 am
by K.J.
GRUB switches from PMode to Real Mode over and over again in it's code so that it can use BIOS interrupts yet still get the OS loaded @ the 1MB mark. You can see the code for GRUB here:
http://savannah.gnu.org/cgi-bin/viewcvs/grub/grub/

K.J.

Re:Bochs Works, Real PC Doesn't

Posted: Mon Nov 18, 2002 1:18 am
by Pype.Clicker
oh, and just to mention ... My own OS works pretty fine on real hardware, but on BOCHS (unknown version - about 4 monthes aged ?), it just freezes the main processing task once the CLOCK has been pushed to 1KHz !??

any clue ? do someone know how i could see where the hang occurs ? the keyboard IRQ are still processed ... maybe i just asked for a too fast clock and have no time to process anything else (would be weird, though ...)

Re:Bochs Works, Real PC Doesn't

Posted: Mon Nov 18, 2002 10:28 am
by Tom
Well...my FritzOS won't EVEN boot with bochs...a Linux Seg Fault happens just when it starts reading the floppy...

I can't wait for Bochs 2...

Re:Bochs Works, Real PC Doesn't

Posted: Mon Nov 18, 2002 6:34 pm
by Tom
YES YEA!!!!!!

Bochs Pre 2 boots FritzOS!!!!!!!!!!!

Never mind whatever I said about bochs!

2 is wonderful!!!!!

No more reboot -f's!!!!!

;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D