I am developing a 32 bit OS and I need to be able to set up NEW data segments/stack segments for programs. However I can not find ANY good information about how to use these segment registers in protected mode. I really need to be able to set up a new stack segment so my programs are not sharing the same stack as the kernel.
In x86 protected mode the segment registers points to GDT selectors.
1 . So we need to setup the proper selectors for each segments expecially for cs, ds, ss before far jump to protected mode. 2 . Selectors are 8byte length, which defines the base, limit and access permissions. Please see the below link for your reference http://en.wikibooks.org/wiki/X86_Assembly/Global_Descriptor_Table, http://www.jamesmolloy.co.uk/tutorial_html/4.-The%20GDT%20and%20IDT.html, http://en.wikipedia.org/wiki/Global_Descriptor_Table. 3 . If you need more on this please reply me, i can show you my simple OS code which sets the proper the GDT and enter into protected mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With