The first I use instruction RETF from 0 ring to 3 ring,then I use calling gate
from ring 3 to ring 0,I want to know:
(1) These code segments are 32-bit segments,
so the stack segments must be 32-bit segmnet,is my opinion right?
(2) The DPL of calling gate is 3,its RPL must be 3,
is my opinion right?
To ask questions about priviledge change
-
- Member
- Posts: 70
- Joined: Fri Nov 19, 2010 6:54 pm
Re: To ask questions about priviledge change
Yes. And esp value should be multiple of 4 bytes.leetow2003 wrote:(1) These code segments are 32-bit segments, so the stack segments must be 32-bit segmnet,is my opinion right?
No. Here the same rule applies as for data access: Max(CPL, RPL) <= DPL (usually CPL=RPL). I.e. you can use same gate to transfer control to the kernel from any privilege level if its DPL=3.leetow2003 wrote:(2) The DPL of calling gate is 3,its RPL must be 3, is my opinion right?
If you have seen bad English in my words, tell me what's wrong, please.
Re: To ask questions about priviledge change
No. A 32-bit application can have a 16-bit kernel stack (for instance). The bitness of the stack segment only determines if the processor uses SP or ESP.egos wrote:Yes. And esp value should be multiple of 4 bytes.leetow2003 wrote:(1) These code segments are 32-bit segments, so the stack segments must be 32-bit segmnet,is my opinion right?
A segmented, 32-bit, application could also theoretically have a 16-bit stack segment. The code would not be dependent on this. Size for pushes are determined by code segment bitness, not stack segment bitness.