Page 1 of 1

Basic OS information?

Posted: Fri Aug 15, 2003 11:00 pm
by Aphrodisias
Hi, I am pretty experienced with x86 asm, now I want to write an OS.  I know only the raw basics about how OSes work.  So I had some questions.

First, if someone intends to eventually use C to write programs for their OS, I suppose one would have to write their own runtime library?  

Second, how do you deal with drivers for your OS?  Or do you interface with the BIOS?  I know, in DOS, how to call int 10h, etc, but how does interfacing with the BIOS work in ring 0 in protected mode?

Third, do you use a simulator?  Or do you have another machine you use to test your OS?

And last, has anyone written networking capabilities for your OS?  How difficult was it?  After all, what good is a machine if it can't talk to other machines :-)

THANKS!

RE:Basic OS information?

Posted: Sat Aug 16, 2003 11:00 pm
by Xenos
Writing a C runtime library is necessary to tell user programs how to access your OS and other things. The most important functions are malloc() and printf(), they are really the basics...

Drivers in PMode is something tricky. Interfacing the BIOS is not possible in general, so you have do deal with raw port I/O. Decoding keyboard scancodes, setting graphics registers and talking to the floppy controller can become very interesting. You will need lots of information about those ports and what's beneath.

Bochs (bochs.sourceforge.net) is said to be a good simulator, but I have never tested it (next week I will). You don't really need one, but it can be useful.
I normally use at least two PCs for OS development - I strictly separate host and target machine. Unfortunately my host machine doesn't have a floppy drive, so I copy my files via network to a target machine running Win98, which doesn't take too much time to reboot...

Network capabilities make the whole thing interesting. One computer is nice, two are better, a cluster is best. I haven't done this yet, but it will be one of the main features of XenOS, where 'n' means 'network'.

RE:Basic OS information?

Posted: Sat Aug 16, 2003 11:00 pm
by Brill
Running your OS on a actual machine is a pain in the @$$. Using an emulator in most cases just requires pressing a few buttons on screen or a commmand to run.

Bochs is free but not 100% completish and not necessarily user friendly.
Vmware is not free but its pretty much complete and works on linux too.
And theres simics. Simics is a (supposidly) really good simulator (not an emulator, like bochs/vmware) but its big. It also costs a bundle unless you can get a student license which requires some kind of student email address (so they can email you to prove you're a student).
The good side to Simics is you can create multiple processor platforms on almost any architecture plus a lot more. According to what i've read on their sites product pages it can trace interrupts and show it all in graphs of data of some kind or another. Would be very good for debugging.

Brill.

RE:Basic OS information?

Posted: Mon Aug 25, 2003 11:00 pm
by Dragon88
I've found Bochs to be quite easy to use, and I _think_ that it does have a linux binary distro. It's an awesome emulator, and on top of that it's free (like u said). Personally I would go with free ;).

Cheers,
Rambo

RE:Basic OS information?

Posted: Tue Aug 26, 2003 11:00 pm
by Legend
You can interface the BIOS by using a v86 monitor task, but then it is easier to write your own drivers anyway (and they are faster then the BIOS ...)