Ring 0 Vs Ring 3

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.
Unlink

Re:Ring 0 Vs Ring 3

Post 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 ?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Ring 0 Vs Ring 3

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
kataklinger
Member
Member
Posts: 381
Joined: Fri Nov 04, 2005 12:00 am
Location: Serbia

Re:Ring 0 Vs Ring 3

Post by kataklinger »

Save yourself from troubles and don't set it. :D

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.
Post Reply