i am new to this whole os prorgramming thing but i think one of the concepts finally just hit me. Global Descriptor tables.
Someone let me know if i have this right. This GDT can help provide memory protection to your OS. For example if i load my OS in memory from 0 to 16MB, then i can set up a selector that ranges from 0 to, well max if it is for the OS and so that any memomory i reference wont be translated to physical memory as they will be the same address....ie 0x01234567 will map directly to physical address 0x01234567
now i set up a selector for all my user programs to run in. I say set the base at 16MB and then max as the limit. In this case there is some translation to physical memory. when they say 0x00000000 it will map to physical memory location 16MB right ? so that they cant access the physical memory that my os is stored in.
I understand in my example that if all the user programs use that same selector they can mess with each others memory but i am not worried about that right yet.
Do I have the right idea about selectors now ?
Also, how do I change selectors. Like if I am doing multi-tasking and my operating system is running for part of the time slice, then user programs are running the other part.....how do i switch between the two selectors ?
i think i may have figured it out
Re:i think i may have figured it out
Looks like you have the right idea.
To switch between selectors, put different selectors in cs, es, and ds(possibly fs and gs if you use them). Put a code selector in cs and a data selector in es and ds.
K.J.
To switch between selectors, put different selectors in cs, es, and ds(possibly fs and gs if you use them). Put a code selector in cs and a data selector in es and ds.
K.J.
Re:i think i may have figured it out
I didn't have the time to read through your text, but I think, http://www.inet-sec.org/~abless/segment.html should help...