Page 1 of 1

x86 protection rings

Posted: Fri May 15, 2009 1:11 pm
by AlfaOmega08
Usually we use Ring 0 for the kernel and Ring 3 for user programs. Some drivers uses Ring 0, some other Ring 3.
But what about Rings 1 and 2?

I've read (from an unreliable source) that the Vista kernel runs some drivers in Ring 1, to have more stability than Ring 0 and more speed than Ring 3. Is this true?

How can this be realized? IIRC if I use paging I can only use segments with Ring 0 for Kernel page or Ring 3 for User page.

What are the differences between the 4 rings? In Ring 0 you are allowed to run any instruction, while in Ring 3 you cannot run many privileged instructions such as CLI/STI/HLT LGDT/LIDT/LTR and so. Ring 1 and 2 have the possibility to run such instructions?

Thanks

Re: x86 protection rings

Posted: Fri May 15, 2009 1:43 pm
by stlw
AlfaOmega08 wrote:Usually we use Ring 0 for the kernel and Ring 3 for user programs. Some drivers uses Ring 0, some other Ring 3.
But what about Rings 1 and 2?

I've read (from an unreliable source) that the Vista kernel runs some drivers in Ring 1, to have more stability than Ring 0 and more speed than Ring 3. Is this true?

How can this be realized? IIRC if I use paging I can only use segments with Ring 0 for Kernel page or Ring 3 for User page.

What are the differences between the 4 rings? In Ring 0 you are allowed to run any instruction, while in Ring 3 you cannot run many privileged instructions such as CLI/STI/HLT LGDT/LIDT/LTR and so. Ring 1 and 2 have the possibility to run such instructions?

Thanks
There is not too much difference between Rings above zero in x86 architecture. In Ring 1 you can't run priviledged instructions the same way as in Ring 3.
The only gain is protection - the Ring 1 segments will be accessable from Ring 3 and Ring 0 from Ring 1.
But all this only if you using segments for protections which already nobody does ...

Stanislav

Re: x86 protection rings

Posted: Fri May 15, 2009 8:00 pm
by Colonel Kernel
Vista runs some drivers in ring 3 for stability, not ring 1. However, Virtual PC runs guest OS kernels in ring 1 (a technique called "ring compression"), but this is an old technique that isn't necessary for CPUs that have the VT extensions.