7 ms·
Even x86's model of handling CPL (privilege level) isn't ideal. Because each was retrofitted, each protection ring in x86, from -1 to 3, works differently. Whe
by Animats 9y ago
Even x86's model of handling CPL (privilege level) isn't ideal.
Because each was retrofitted, each protection ring in x86, from -1 to 3, works differently. When IBM originally invented virtualization (IBM 360/67, late 1960s), they got it right; all the layers work the same, and you can run VM on VM on VM until you run out of memory. That's been continued into today's IBM mainframes.
- bogomipz 9y agoI'm not following the connection, IBM used more than two protections and thats why we have the two unused rings in x86? Can you elaborate?
- amluto 9y agoI'm not talking about the fact that the privilege level is two bits instead of one bit. What I mean is: the privilege level is more or less duplicated in quite a few different pieces of CPU state. There's CPL, CS.RPL, CS.DPL, SS.RPL, and SS.DPL, not to mention CR0.PE. The one that matters is CPL, but CPL itself isn't an architecturally visible register except (I think) on AMD systems with SVM -- it's merely a concept. CS.RPL, CS.DPL, SS.RPL, and SS.DPL all usually match CPL, but I think that all four equalities have nasty corner case exceptions. This results in a bunch of overhead when you change privilege: the CPU needs to update CPL, CS.RPL, CS.DPL, SS.RPL, and SS.DPL. This means that you need to change two of these nasty large legacy registers, the values of which barely matter for practical purposes, every time you enter or exit user mode. Saying there's a ring -1 is a red herring here. There's SMM, which is a mode of execution that's more privileged than ring 0, but it doesn't have a number -1 associated with it, nor is it part of CPL. Similarly, ring 0 is split into root and non-root when virtualization is in play, but that's also a bit beside the point. [1] Check out the Linux commit message for ae9fedc793c4d98aa9bb298585b2b9246096ce65 if you want to see a bit of how nasty this is.