Bochs Works, Real PC Doesn't

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
PlayOS

Bochs Works, Real PC Doesn't

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Bochs Works, Real PC Doesn't

Post 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 :-/
PlayOS

Re:Bochs Works, Real PC Doesn't

Post 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.
PlayOS

Re:Bochs Works, Real PC Doesn't

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Bochs Works, Real PC Doesn't

Post 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 ...
PlayOS

Re:Bochs Works, Real PC Doesn't

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Bochs Works, Real PC Doesn't

Post 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 ...
K.J.

Re:Bochs Works, Real PC Doesn't

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Bochs Works, Real PC Doesn't

Post 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 ...)
Tom

Re:Bochs Works, Real PC Doesn't

Post 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...
Tom

Re:Bochs Works, Real PC Doesn't

Post 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
Post Reply