mattrix wrote:
I'm confused.
I'm not sure if this is a question about memory or CPU modes or just how Dos works.
As far as I can tell Himem puts dos into "unreal" mode and allows dos code to be loaded into HMA.
No. Himem does manage the HMA, but it uses straight real mode or v86 mode to do it. Unreal mode is a kludge that some DOS application programs used, but was generally not used by system software (although I have heard that many BIOSes used it quite extensively).
Quote:
EMM386 runs dos in VM86 mode and allows devices to be loaded into UMB using 386 paging. EMM386 requires Himem to be loaded first.
Presumably EMM386 itself runs in ring0? And is effectively managing DOS, ie DOS runs on top of EMM386?
Yes, more or less, though the relationship between DOS and an EMM (such as EMM386) or DPMI host was rather incestuous, as your EMM would make calls to DOS for system services as well.
Quote:
Now my problem,
Can you access more than 1 MB in VM86 mode? If not youve just lost the kernel.
You can access up to 1 MB + 64kB - 16B (look up the A20 line for more information). That 64kB - 16B above the 1 MB mark is the HMA.
Quote:
If DOS switches back to "unreal" mode, won't that break the paging, and devices will disappear?
As I've said, unreal mode was generally not used by system software. In any case, unreal mode involved fiddling around with segmentation, so I don't think it would have screwed up paging.
Quote:
How do these play with each other?
And how does DPMI fit into all this? I assume DPMI also wants to run in ring0 and control the GDT and TSS etc
DPMI was an API to allow protected mode programs to make calls back to DOS (which has to run in real or v86 mode). A program called a DPMI server would serve as the go-between bridging DOS and the application. EMM386 contained a DPMI server, but many DOS applications contained a built-in DPMI server so that they could run if there wasn't already a DPMI server running.