Hi,
motosftos wrote:
Hello, i am developing an Operating System.
Please don't get this the wrong way, but you are clearly not up to the task. Do yourself a favour, and start with some smaller projects first. Do experiments on each component, and when you're okay with them, only then try to put everything together into an OS. And learn. There's extremely huge amount of theory behind OSdev you must be familiar with. It is said that OSdev is the most difficult task a programmer can do, and they say that for a good reason.
motosftos wrote:
I have no idea on the code. Can anyone please help me with the code?
No. You must have at least an idea what you want to do, nobody can help you with that. When the idea is clear, then, and only then you can start coding. These things are not magic, nobody is able to code something without knowing what and how it supposed to do. (And in that I don't mean "load the OS", I mean how it should exactly work to the smallest detail.)
A simple thing that loading the kernel can be divided into many steps:
1. how your initializer code gets loaded by the firmware (first sector? EFI executable? to which address? in which CPU mode?)
2. how can you use the available environment to load a file from disk (can you use interrupts? do you need to load raw sectors or does the firmware provide file abstraction?)
3. how to parse that file (is it a PE or ELF executable at all? does it have more segments? what's phdr and bss?)
4. how to set up the environment for that executable (does it need stack? special mapping? is it position independent?)
5. how to pass control to that executable (what ABI? does it differ to the usual one? Linux kernel for example has a special kernel entry ABI, and GRUB gives you another.)
So many things to figure out and solve, and let me remind you, all of the above is needed and must be 100% correct before the CPU could start executing the first instruction at _osstart: label. And I haven't spoken about how to create that kernel executable (which is different to normal user space applications) before you could save it to disk for your loader to find. And everything I wrote so far are totally independent to in which language your kernel was written in. Could be Assembly, or could be C. I've even seen some (pretty good may I add) kernels written in Pascal.
Cheers,
bzt