Page 1 of 1
Multitasking with protection
Posted: Thu Sep 14, 2006 1:30 am
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?
Posted: Thu Sep 14, 2006 2:18 am
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.
Posted: Fri Sep 15, 2006 3:15 am
by Jeko
I want to use paging
Posted: Fri Sep 15, 2006 3:30 am
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.
Posted: Fri Sep 15, 2006 3:35 am
by Jeko
can I use paging without GDTs?
Posted: Fri Sep 15, 2006 4:25 am
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)