Bootstraping and Loading the Kernel

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
Dumboo

Bootstraping and Loading the Kernel

Post by Dumboo »

Hi there
I m a complete newbie with the creating OS stuff,
I have written a bootstrap code, which uses BIOS API Calls to load the kernel from a predefined sectors, but the problem is,

Previously i have written my small OS kernel in ASM(NASM) and was able to sucessfully load it, but now I have written the same code in C, using Turbo C++ 3.0 compiler i created a tiny model (*.com) file, and copied on the predefined sector, but this time i was not getting the expectd output, i know that the kernel was loadeed in the memory, but i dont know where i did mistake :-/

Also i have been first time to this newsgroup, and was not able to read it using Outlook Express, any sugessions on how to configure OE ?
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:Bootstraping and Loading the Kernel

Post by Pype.Clicker »

Dumboo wrote: now I have written the same code in C, using Turbo C++ 3.0 compiler i created a tiny model (*.com) file, and copied on the predefined sector, but this time i was not getting the expectd output, i know that the kernel was loadeed in the memory, but i dont know where i did mistake :-/
First, the tiny model expects the loader to provide a special structure (i guess it's the PSP, not sure anymore) where it can find several things like available memory count etc. to be located at CS:0 while the program itself starts at CS:100. If your program doesn't respect this convention it will likely fail to load.

Moreover, did you make sure that Turbo C wasn't trying to use some DOS interrupts without telling you about it ?
Also i have been first time to this newsgroup, and was not able to read it using Outlook Express, any sugessions on how to configure OE ?
This is *not* a newsgroup, but a forum ... so i don't think you could use it through Outlook Express ...
Dumboo

Re:Bootstraping and Loading the Kernel

Post by Dumboo »

I wanted to write the OS kernel in C, using Turbo C++ 3.0 compiler, instead of ASM, any suggestions what should i do next ? ::)

-Dumboo
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:Bootstraping and Loading the Kernel

Post by Pype.Clicker »

you should disassemble the Turbo-C produced code and check there's nothing unexpected in it (like dos calls). Also check TurboC documentation and make sure you don't need to add something like "-ffreestanding" to force the compiler to make a standalone file.
Dumboo

Re:Bootstraping and Loading the Kernel

Post by Dumboo »

Can you guide me, means what step should i take, to actually Create a loadable kernel in C, i tried disassembling the file, also, i tried with the dpcumentation, but it looks as if I m lost :-\

can you help me with some simple, steps or direct me towards some nice online tutorials or references :)

thanks
-Dumboo
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:Bootstraping and Loading the Kernel

Post by Pype.Clicker »

Dumboo wrote: can you help me with some simple, steps or direct me towards some nice online tutorials or references :)
sorry, i can't offer support for TurboC as i don't own a copy of it myself (or at least not the docs, just some abandonware i found ...) .
I don't know if you plan to make a real-mode OS or a protected-mode one, i assume you'll use realmode as it's the only thing TurboC can generate (afaik).

For a good step-by-step tutorial on starting a pmode OS using GNU tools, you can check http://www.mega-tokyo.com/os/os-faq.html
Dumboo

Re:Bootstraping and Loading the Kernel

Post by Dumboo »

Thanks for that tutorial its a nice one :)

-Dumboo
Post Reply