Multitasking with protection

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

Multitasking with protection

Post by Jeko »

I implemented the multitasking in my os. Now I want to implement the protection. Must I implement the GDT if I want protection?
Have you any tutorial or guide?
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Post by Legend »

First you need to decide if you want to use segmentation or paging for protection. Looking those terms up will answer a lot of other questions that may pop up, too.
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

Post by Jeko »

I want to use paging
mrkaktus
Member
Member
Posts: 102
Joined: Thu Jan 06, 2005 12:00 am
Location: Poland - Gdansk
Contact:

Post by mrkaktus »

Good choice :).
So you need to read about page directories (PD), page tables (PT) and pages. You will be creating paging structure for every process so they won't see each other, you can also write then memory sharing mechanism etc. I recommend Intel Software Developers Manuals as a basic lecture.
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

Post by Jeko »

can I use paging without GDTs?
mrkaktus
Member
Member
Posts: 102
Joined: Thu Jan 06, 2005 12:00 am
Location: Poland - Gdansk
Contact:

Post by mrkaktus »

No you always need to have minimum 3 gdt entrys:

-null entry
-data entry all 4gb of space
-code entry all 4gb of space

And in most OSes you will use 6/7:

-null entry
-data entry all 4gb of space in dpl0 (kernel)
-code entry all 4gb of space in dpl0
-stack entry in dpl0
(OPTIONAL - if you want to have physical maped kernel stack)
-data entry all 4gb of space in dpl3 (apps)
-code entry all 4gb of space in dpl3
(app stack is maped on end of ram normally)
-tss segment
(needed minimum one, even if you use software task-switch)
Post Reply