3 ms·
The thing I found most interesting was "supervisory mode execution protection (SMEP)", AKA rings, available in 64 bit as well as 32 bit modes. This is somethin
by hga 15y ago
The thing I found most interesting was "supervisory mode execution protection (SMEP)", AKA rings, available in 64 bit as well as 32 bit modes. This is something that AMD punted in their 64 bit macroarchitecture (which Intel was then forced to copy) and is sorely missed for various low level stuff. Unfortunately the long 64 bits interregnum without rings means it will be a long time before you can depend on others being able to run software depending on it.
- marshray 15y agoWhat's an example of something that depends on this?
- hga 15y agoI remember that some things depended upon it before AMD came out with their 64 bit architecture, but not what they are. One thing I do know it's useful for is allowing your GC to run in an intermediate level of privilege between user and supervisor code. Also, if you do it right (i.e. Multics) a system call can be much cheaper because the supervisor isn't running in its own address space etc. Instead, your user level code calls a carefully vetted bit of system gateway code that has a foot in both rings.
- bdonlan 15y agoAt least on Linux, there is no address space change when you make a syscall - entering ring 0 _grants access_ to the top half of the address space, where kernel code and data lies, but there's no change in page tables (with all the overhead that implies). As for code having a foot in both rings, Linux has its VDSO (and Windows has ntdll) running at a user privilege level; I don't really see how having an additional intermediate level would help much.
- marshray 15y agoI'm not the world's expert on this kind of thing but I don't think I've seen anything much more complicated than the basic 'supervisor mode bit' get much use in practice. Even the venerable 286 (yes 2 not 386) had this four ring model and 'tasks' which continue to exist as vestigial organs of the architecture. Not used by anything I'm aware of.
- hga 15y agoWell, I think it's fair to mention that more than a few of us are appalled by how ... conservative the systems development community is. E.g. people persist in building systems that are less advanced than e.g. Multics and ITS (notice some of the comments on BeOS and IO). E.g. the biggest action here other than hypervisors (which are a pretty old concept, it's been a long time since an IBM OS could run on bare metal) and perhaps smartphones (an area I'm just not familiar with) is Linux, which ... foundationally in't very advanced. The base concepts are straight from the early '60s (pre-Multics). This was true for languages as well; at least at the beginning of the last decade I noted that nothing seriously popular was based on concepts that had been developed any earlier than the '60s or maybe early '70s depending on how your scored OOP (Simula vs. say Smalltalk). Don't know if this applied to Ruby, though, or really even Python, languages with I don't know. Fortunately that Dark Age didn't last long (I suspect because the dot.com crash forced companies to "work smarter, not harder" because of resource constraints). As for the 286, using it as anything more than fast 8086 was so painful, so crippled and so slow few bothered (OS/2 is the famous and famously not successful exception). Remember the hack with the keyboard controller to get back to real mode? If you didn't need to do that (mostly a device driver issue), it still was extremely expensive to switch segments in protected mode which were still limited to 64KB.
- marshray 15y agopeople persist in building systems that are less advanced than e.g. Multics and ITS [and] hypervisors I find it interesting that the VMware-style hypervisors were originally implemented not using, but in spite of all the virtualizaton features of the CPU. Yet today VM virtualization is considered the most reliable security boundary on shared hardware. No large security-conscious company would share user accounts on a Windows instance with untrusted parties, yet they will share virtual private servers. I think what it says it that chip designers are lousy at developing what OS developers want and OS designers are lousy at developing what customers want. 286 Remember, this chip was designed before anyone realized that DOS (and DOS-based device drives) was going to take over the world. They never imagined anyone would want to switch from protected mode back to the obviously-inferior real mode. :-) They were darn lucky IBM thought to put that auxiliary keyboard controller there to do a reset on the main CPU.
- hga 15y agoI think the GC example is helpful, I know Azul uses it on their custom hardware and they've also said that they're very glad they decided to go with a standard operating system arrangement, no doubt because their main user program is Hotspot, a by now very gnarly monster of a C++ program. The idea is that it's good to have something below you to pick up the pieces, and for fast/Pauseless GC it's good to give your GC code supervisor level access to stuff like the CPUs virtual memory (Pauseless maps and unmaps VM at a furious rate). But you're otherwise correct in that to my knowledge no one has found another really good use of intermediate privilege. On Multics, after they got 8 rings in hardware, user code ran in ring 4, the email system ran in an intermediate ring but that wasn't critical and a very few people built systems with sandboxes in ring 5. Ah, sandboxes could be another example. Wikipedia says the Google Native Client overhead (presumably on x86_32) is 5%, although I seem to remember a higher figure. But of course you need to be running on an operating system that uses rings and Linus didn't take advantage of the 386's ring system (which turned out to be very good for portability, as noted even to x86_64).