View Single Post
Old 07-16-2022, 02:52 PM   #159
NullNix
Guru
NullNix ought to be getting tired of karma fortunes by now.NullNix ought to be getting tired of karma fortunes by now.NullNix ought to be getting tired of karma fortunes by now.NullNix ought to be getting tired of karma fortunes by now.NullNix ought to be getting tired of karma fortunes by now.NullNix ought to be getting tired of karma fortunes by now.NullNix ought to be getting tired of karma fortunes by now.NullNix ought to be getting tired of karma fortunes by now.NullNix ought to be getting tired of karma fortunes by now.NullNix ought to be getting tired of karma fortunes by now.NullNix ought to be getting tired of karma fortunes by now.
 
Posts: 929
Karma: 15576314
Join Date: Jan 2013
Location: Ely, Cambridgeshire, UK
Device: Kindle Oasis 3, Kindle Oasis 1
Quote:
Originally Posted by DNSB View Post
Perhaps since DOS was 16 bit and Windows on Windows only supports 1 generation back (i.e. 32 bit supports 16 bit, 64 bit supports 32 bit), there might be a reason that DOS did not run on 64 bit Windows.
Some of this is hardware. When an x86-64 CPU is in long mode ("64 bit") it can no longer operate in virtual 8086 (V86) mode, which means it cannot emulate an 8086 and more or less all 16-bit stuff isn't going to work, including DOS boxes (which always worked via V86).

This is a fundamental limitation, not an arbitrary "we can't be bothered with backward compatibility" thing. V86 mode, just like real mode on 80386 and above, is a remarkable hack in which the CPU actually behaves almost identically to how it does in 32-bit protected mode except for the changed semantics of segment registers: and even there, the only difference is that they automatically refer to appropriate selectors created by the hardware: all the 32-bit protected mode access control and the like is actually still being carried out, even in real mode. The full 32-bit instruction set is available: you can even use 32-bit wide registers like EAX etc and it actually works! (It takes more care and evil tricks to use things like task gates and call gates in real mode, but nobody really uses those at all in any CPU mode unless they have to). This was heavily used back in the early 90s by various 386-only games, running in real mode only with atypical selectors in force to make more memory available: they often called this "unreal mode".

But in 64-bit long mode this clever CPU trickery cannot work: selectors in long mode are always 0-based (and have other limitations) and cannot be used to simulate real mode segment registers any more, since those can have almost arbitrary bases and limits. So the CPU cannot implement V86 mode, and won't even let you try. The only way to implement V86 mode atop long mode is to run a virtual CPU using the VMX virtual machine extensions and transition that virtual CPU to 32-bit protected mode and then set up V86 mode in that. (And there are plenty of long-mode-capable Intel CPUs with no VMX extensions, since they decided to use that for market segmentation, so you can't rely on that working.)
NullNix is offline   Reply With Quote