3 ms·
> I don't know how anyone can look at the list of one-byte opcodes and conclude that x86 isn't a mess. Or heck, even just the fact that real mode is still a th
by pcwalton 7y ago
> I don't know how anyone can look at the list of one-byte opcodes and conclude that x86 isn't a mess.
Or heck, even just the fact that real mode is still a thing.
- dfox 7y agoThe CPU contains essentially no hardware that is there only to support real mode, which is simply an documented combination of configurations of various protected mode relevant mechanism plus changed behavior of exactly one microarchitectural operation, which involves replacing bunch of nontrivial microcoded logic with simple 4 bit left shift.
- bonzini 7y agoThere is hardware that is there only to support v86-mode and v86 mode extensions though. V86 mode really really should go away...
- dfox 7y agoIn fact there isn't any hardware to speak of (3 bits worth of architectural registers and bunch of trivial logic related to that?) to support vm86 mode, and that is to some extent the consequence of how true real mode is implemented. The combination of paging enabled (which is not strictly necessary), protected mode enabled, 16b code segment and real mode style segment loads gets you vm86 mode (complete with weird stuff on stack of exception handler vectors), in fact when you look at vm86 entry gate descriptor, this is exactly what it does. The microarchitecture essentially does not care about that. edit: there is no documented direct way to flip the segment/selector bit, which is the reason why you need documented vm86 mode. The hardware always calculate the linear address according to whatever is in shadow descriptor of segment/selector register, difference between real/vm86 and protected mode is what happens when you store something into there.
- PopePompus 7y agoBut it's not just a matter of wasting transistors and silicon. The ancient x86 modes are like old legacy code in a software package you have to maintain. They add complexity. Intel hasn't exactly been cranking out an endless series of bug-free chips lately. It might behoove them to make a line of chips which are pure x86-64.
- tedunangst 7y agoHow many of the recent intel vulnerabilities would have been prevented by jettisoning real mode?
- bogomipz 7y agoCould you elaborate on this a little more? What exactly is "the changed behavior of exactly one microarchitectural operation"? Which operation?
- skissane 7y agoIt is still a useful feature for people who want (or need) to run legacy apps or OS versions under virtualisation (VirtualBox etc). Forcing that use case to use CPU emulation would have a performance cost. Although, they could disable real mode support in some CPUs as a market segmentation mechanism. Running a 64-bit OS with EFI boot, most users probably don’t really need real mode support.
- pcwalton 7y agoHow many people need to run DOS apps at 2020 processor speeds? I get that there are legacy systems at banks and power plants running DOS, but practically by definition they don't need 2020 speeds.
- skissane 7y agoIt’s not just DOS apps. Booting any OS using legacy BIOS boot (as opposed to EFI) needs real mode support, even if it never uses real mode again after the boot process completes. (Theoretically, you might be able to build a hypervisor which uses CPU emulation for real mode and hardware-based virtualisation in protected mode, but no such thing exists yet.) So if someone has a legacy app running in a Windows XP/Vista/2003/etc VM, that VM needs real mode to boot.