Page 2 of 2
Re:Ring 0 Vs Ring 3
Posted: Sun Jan 15, 2006 1:19 am
by Unlink
the 6-byte the bit number 3 from right, which is used to select data or stack segment in data segments, i read that when it is disabled in code segments the cpu will not check the RPL or DPL i don't remember. but all i know is that enabling it cause troubles
can u figure out what is this bit in the code segments ?
Re:Ring 0 Vs Ring 3
Posted: Sun Jan 15, 2006 1:57 am
by Brendan
Hi,
Unlink wrote:
the 6-byte the bit number 3 from right, which is used to select data or stack segment in data segments, i read that when it is disabled in code segments the cpu will not check the RPL or DPL i don't remember. but all i know is that enabling it cause troubles
can u figure out what is this bit in the code segments ?
This is the 'C' bit which makes the code segment "conforming". For a conforming code segment, the DPL is still checked when the segment is loaded into CS but the RPL isn't changed (i.e. the current privilege level isn't changed).
This allows you to have some code (in a conforming code segment) that can be used at any privilege level. For example, kernel code could use it and still be operating at CPL=0 and user-level code could also use it (but still operate at CPL=3). In this way the code conforms to the privilege level of who-ever called it.
It's possibly useful for shared code - for example, imagine you've got some code to convert strings into numbers and numbers into strings that is in it's own code segment. The kernel could use it to convert strings stored in kernel space, and user-level code could use it to convert strings stored in user-space (but if user-level code tried to convert strings that are stored in kernel space it'd cause a general protection fault).
Cheers,
Brendan
Re:Ring 0 Vs Ring 3
Posted: Sun Jan 15, 2006 4:21 am
by kataklinger
Save yourself from troubles and don't set it.
But if you had a LOT of code which can be shared between kernel and user's tasks then maybe you could think about it.
To do that you'll have to make extra code segment descriptors.