Hi! I've followed and completed the Bran tutorial which was incredible! I have everything working as it shoud with a few modifications - the most notabily is I'm using the grub stage2_eltorito and run my kernel using qemu -cdrom - this ment I had to use the elf format on the nasm parts because else grub complained about not beeing able to read the binary.
After finishing the tutorial I am left with a just one questions which I can not seem to get the grip on and I am hoping someone here would like to enlighten me with their brilliance!
Question: Since I don't have a scheduler yet I just want to load a function called init() into userland. How do I setup userland and how do I load a function into it? I guess it is alot I need to do but just a hint in the right direction would be fine as well.
Thank you!
What to do about userland?
Hi,
My advice would be to initially get software task switching working in your kernel. Do this by specifying test() or init() or whatever you want to call the function in your kernel, and give that as the entry point to the new thread. Once you have ring 0 --> ring 0 thread switching working, then worry about privilege level changes.
The problem is, if you only get a single ring 3 task to run with no scheduler written, you'll never get back to ring 0 again (!).
Also, before task switching works, you will need reliable memory management (the wiki and osdever.net have good resources on this).
Cheers,
Adam
My advice would be to initially get software task switching working in your kernel. Do this by specifying test() or init() or whatever you want to call the function in your kernel, and give that as the entry point to the new thread. Once you have ring 0 --> ring 0 thread switching working, then worry about privilege level changes.
The problem is, if you only get a single ring 3 task to run with no scheduler written, you'll never get back to ring 0 again (!).
Also, before task switching works, you will need reliable memory management (the wiki and osdever.net have good resources on this).
Cheers,
Adam