Page 1 of 1

Suggestions for my os

Posted: Wed Oct 26, 2005 9:42 am
by saravn02
Hi All,
I am planning to start writing my own OS. I had a look into the Higher Half bare bones present in the OS-FAQ wiki and felt that was a good starting point.

I have a few questions in the bare bones code.
Is paging enabled in that code?.I am still confused with identity-mapping mentioned there if someone could explain the same in detail it would be great.

If i start building from the bare bone code, do i have to define my own gdt and stuff and load it?.What are the other immediate things i need to code to start off in the bare bone main routine code.

Help is appreciated

Thanks
Jay

Re:Suggestions for my os

Posted: Wed Oct 26, 2005 11:07 am
by OZ
Hi,
if I got it right then paging is indeed enabled to let the kernel appear at 3 gb virtual addressing.
For the identity mapping that you mentioned - it is like the first 4 mb of physical memory mapped a two different virtual memory locations. The first 4 mb phys can be accessed after seting the cr0 bit at 0x00 - 0x300000 and at 0xC0000000 - 0xC0300000
That is because if you only map it starting the 3 gb location it would crash immediately if you enable paging. This is because the addresses in the registers would still point to the area starting at 0x00 (e.g. eip wouldn't point to a valid instruction as there is no mem mapped there >> pagefault) therefore the phys mem needs to be accessable at both 'addressareas' at first until you fix it with the jmp.

You will have to define your own gdt and stuff - as far as you aren't satiesfied by the structures already setup by the bootloader which will rarely be the case.
check this tutorial out http://www.osdever.net/bkerndev/index.php?the_id=90
there you have all the stuff explained you'll need but you will have to change it a bit I think due to your upperhalf adressing.
hope it helps.