flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Segments in PMode

Author
Thread Post new topic Reply to topic
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER
Hi everyone!
I read Intel docs and thing that im not getting - Priviligies Level in segment registers, what do I have to put there? current priviligies level, priviligies of segment, that im going to access or something else?
Code:
;15______________________3_________________2________0
;|the num of record in gdt|table GDT or LDT |PRIVL   |
;|________________________|_________________|________|
;                                                    this one   
;                                                    is what i'm 
;                                                    asking 
;                                                    about 
    
[/b]

_________________
_______________________________
NSOS
Post 01 Jun 2011, 10:13
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

the privilege of segment that i'm going to access
(greater than or equal)

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 01 Jun 2011, 10:51
View user's profile Send private message Send e-mail Reply with quote
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER
ouadji wrote:

the privilege of segment that i'm going to access
(greater than or equal)

so, if i have gdt table

GDT:
RECORD1
RECORD2
RECORD3

then if i want DS to point at RECORD2 i will have to put privl level of RECORD2 into ds???

_________________
_______________________________
NSOS
Post 01 Jun 2011, 11:35
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
privilege levels is a different part of segmentation, something you don't have to manage for the moment.

lets go for every PL=0 for the moment, the rings feature is really complex, it is a lot of security, and will not help you to code the gdt and the kernel.

after, when you will have a kernel, you will have to play with rings to protect the kernel from applications.
Post 01 Jun 2011, 12:58
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

I was wrong, sorry. Embarassed

It's not "the privilege of the descriptor that i'm going to access (DPL)",
but the "current privilege level" (CPL)
RPL <--- CPL (intel doc 3A/5.5)

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 01 Jun 2011, 13:05
View user's profile Send private message Send e-mail Reply with quote
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER
ouadji wrote:

I was wrong, sorry. Embarassed

It's not "the privilege of the descriptor that i'm going to access (DPL)",
but the "current privilege level" (CPL)
RPL <--- CPL (intel doc 3A/5.5)

but what if i make far jump to segment with another DPL, and then trying to access data through segment register which contains old CPL. what will happen?

_________________
_______________________________
NSOS
Post 01 Jun 2011, 13:23
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
CPL is from 0 to 3
0 is high level (say skylab zone)
3 is low level (say green hill zone)

level means the power, permissions, etc...
the more the level is, the more permission you have, and for this, you need a lower CPL.

this is the first ambiguity in PL (RPL, CPL, IOPL) feature.

after, if a code from high level calls a code from low level, error, because the caller is what set the CPU PL.
if the CPU PL is high than target PL, error, because cpu protection is not activated for high levels.
and RTFM please.
Post 01 Jun 2011, 13:38
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji
Quote:

but what if i make far jump to segment with another DPL,
and then trying to access data through segment register which contains old CPL.
What will happen?
intel 3A/5.6
PRIVILEGE LEVEL CHECKING WHEN ACCESSING DATA SEGMENTS
The processor loads the segment selector into the segment register if the DPL is numerically greater than or equal to both the CPL and the RPL.
Otherwise, a general-protection fault is generated and the segment register is not loaded.

Interrupt 13—General Protection Exception (#GP)---> BSOD Wink

You should read the intel doc, really, all is Within.

@edfed
"... cpu protection is not activated for high levels" (???)
Je ne comprends réellement pas ce que tu veux dire par là.
Que ce soit en ring0 ou en ring3, le mode protégé est activé.
désolé de pointer ce petit morceau de phrase.
et CPU PL, kesako ? ... le niveau de privilège du processeur ?
Ooups, le raccourci me semble fort risqué.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 01 Jun 2011, 15:15
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.