-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kvm: native LDT updates #988
Comments
I just went over the changelog the other day and noticed the LDT emulation you wrote to support win31. Maybe I should look for more notes that like that :) |
Sure thing! |
So what about native DPMI through KVM? ;) |
Why does Win 3.11 modify the LDT so much? Is that how it implements task switching? |
hdpmi.exe (or maybe cwsdpmi.exe + https://github.com/stsp/pmdapi).
I think so, but this is only a guess. |
There is a winos2 kernel that has the
|
OS2WIN31.ZIP |
You can certainly give Windows direct access to the LDT with KVM. I am just not sure then where the dirty log comes in. Do you want it to use it to know that a specific page of the LDT has been written to and then sanitize it from garbage sometime after? As for native DPMI under KVM, this should be possible if dosemu implements VCPI. I actually wrote a draft patch for that some time ago, but to do it properly I first need to finish my IDT work, namely handling IRQs properly by injecting the actual hardware interrupts into the VM, instead of the workaround we have in place now. |
Windows not only writes garbage to LDT to
Which is why I thought PML is the simplest solution.
... and someone explicitly disables DPMI in config? |
Mm, point 2 does not stand, as with KVM we don't |
With VCPI mentioned I will also ask the next question. Could that not be handled natively? If I understand correctly this would entail being able to support ring 0 execution via KVM... |
No, only natively. |
But ring 0 does work in QEMU? Is there some documentation on the difference with DOSEMU2 there? |
DOSEMU2 could in principle support ring0 but it's presently not set up for that, it would be a fair amount of work at least. There are many places that assume ring3 or vm86, I just don't know how bad it is. When I first added KVM it was booting in real mode which confused some applications (with the CPU EFLAGS register) and made it impossible to trap software INTs. Some DPMI applications when run in real mode assume that you can enter protected mode manually (using neither dosemu's DPMI nor trying to use VCPI) and that then crashes. |
dosemu2 does not have tcg to emulate |
And dosbox have reverse-engineered run286, |
And Windows 9x I guess. |
Oh, I wouldn't bet on that. |
Windows 9x can use any filesystem that works in DOS. There will be a warning somewhere "Drive C: does not use 32-bit access" or something like that, but it works fine. This was used by SCO Merge/Netraverse Win4Lin. As for hardware, I would say the existing hardware emulation takes care of it. (Side note: even many Windows 3.1 drivers can be installed in Windows 9x. See for instance the second screenshot here: http://toastytech.com/guis/misc2.html)
I think the ring 0 usage of some bits is really the biggest problem. Win4Lin includes a set of patches that it applies on some Windows system files, probably to take care of (some of) this. |
Does local fs work in win95 under dosbox? |
Who told you exactly that win4lin allowed a ring-0 access? |
The limitation that dosbox has is that it doesn't have any boot loader code to load an external DOS. If you want to use any DOS other than the built-in DOS, you have to use an hdimage with a proper boot sector that can load the DOS that's on it. Using a hdimage in dosbox disables its local fs support even in plain DOS.
I have no idea whether win4lin allowed ring-0 access and I don't think it did. I know they patched out some calls which I guess were ring-0 and they also used some memory relocation tricks. If you want I can upload the patch files (they're hex patches I think). Also the changes they made to the Linux kernel and their kernel module contain a lot of comments on how everything worked. I can upload this as well. (One of the original authors of Merge/Win4Lin was Gerald J. Popek. He was one of the authors of a paper that laid out the requirements that CPUs needed to fulfill to enable efficient virtualization. These were implemented by Intel/AMD in VT-x/AMD-V.) |
And we are talking about VCPI, that does. |
It seems you are correct. I just searched through the Win4Lin patches and they do not refer to ring-0 (or any ring) at all! |
What scares me in that whole idea is |
Your thoughts make sense. My proposals were also intended to trigger a thinking process. One point I think that's relevant is that win95 is not running stably in QEMU with KVM. Maybe dosemu2 with VCPI would let win95 be more stable than any other way of virtualizing it. Win4Lin was also known to be more stable than pure win95. I think a better first goal would be an alternative for the vxd emulation and possibly win32s support. |
I gave the os2win files a try but could not find a performance difference in winbench compared to the originals. |
There is something even more |
I could try, but I'll have to find a Windows 95 installed in QEMU :) Btw. you have time to check KVM on my notebook? |
Thanks. :( |
It seems Windows 9x has bugs that are triggered on newer CPUs: Maybe Windows 3.x also has issues like this? |
That ticket refers to the vmware site, but |
Which URL doesn't work for you? These both work for me and seem to detail the problem: If skipping the Windows ring0 kernel means that these bugs are avoided, I would say that's quite a big feature to boast about!!! Furthermore could this be a reason why Windows 9x appears to run more stable in Merge/Win4Lin? Except for VMware and maybe Parallels, it seems other hypervisors gave up on virtualizing non-NT Windows. |
Thanks, the second link is good. |
The group of people with interest seems relatively small and not so knowledgeable, otherwise Windows 98 would also be in a better state on KVM+QEMU. I'm also surprised about the interest in DOSEMU2 compared to DOSBox. I think it's a matter of power user versus simple user. Maybe you could create a binary patch for this ;) |
If its not possible w/o patching windows, then not.
Could you please share your observations?
I want dosemu2 to be friendly to any user.
No, I can't even test it on dosemu2. :) |
The sources of older VirtualBox versions should have the ring 0->1 patching for win9x.
DOSBox actively discourages any non-gaming use/features and caters even to people that have never used DOS as their main OS but who are interested in older games.
I know, but today this is the divider.
:D
That would be amazing yeah! It seems nobody else is thinking of this. |
Yes, but KVM is not.
... and has lots of forks that do not do this
If you have particular URLs in mind, please share.
You mean its still user-unfriendly?
Me too, don't hold your breathe. |
You can search on Reddit for instance and see the comments on the project.
Not at all!
Fame! Once there is a release showing up on Slashdot and similar sites, that will change.
I think someone who did it already for win31 knows :D |
Not sure.
That was basically me and Japheth, and I am |
And DPMIONE, but its author doesn't seem interested anymore. Possibly Merge/Win4Lin as well... it seemed to have some debugging hooks. I also thought it might be possible to port the Merge Kernel Interface adapter to KVM. That would allow using their binaries again. |
Even qdpmi can run win31, but yes, |
It seems it became very hard to find the Win4Lin Linux patches and binaries online, so I'll provide them here: A working license can be found here: |
A book which has some info on vwin32: http://tkiel.free.fr/doc/Windows%2095%20Programming%20Secrets.pdf |
Photocopied versions of Unauthorized Windows 95 to be viewed with an account: |
While Schulman's book is not a
Not a very encouraging description |
Wow! |
Please find the "another book" mentioned |
A short article by the same Matt Pietrek: https://web.archive.org/web/20070312044227/http://www.microsoft.com/msj/archive/S2CE.aspx A book on Windows 95 file system stuff (non-trivial to access): https://www.scribd.com/document/383387667/Inside-the-Windows95-File-System Some older books from Pietrek and Schulman: Wine also has a reference to Pietrek's book: I don't see any other related books listed for PIetrek, so I don't think he worked out the other book :) |
Well, then we should |
Another book, probably more general knowledge: https://archive.org/details/systemsprogrammi00oney |
Pietrek's book in The Internet Archive: https://archive.org/details/windows95systemp00matt It's also possible to search inside multiple books at the same time: https://archive.org/search.php?query=vwin32&sin=TXT |
@jschwartzenberg Do you have working win4lin setup? it's pretty hard to find it nowadays. It looks like you've shared 'server' version, but publically available keys are for 'desktop'. EDIT: I've found a way to register it. A few notes if somebody will try to setup it:
|
You can run Win4Lin inside a QEMU/KVM VM. The easiest way is to take a distribution that has its default kernel already patched for Win4Lin such as LindowsOS/Linspire or Xandros. |
As pointed in #982, this can give some speed-up
to win31. Since dosemu2 is all about speed, we
probably should not miss such possibility.
I think using PML for tracking updates would be
optimal. And #198 have most of the needed code
in.
There is a suggestion to make MAPPING_LOG_DIRTY
generic, but that would probably mean too much work.
Instead we can make it to return failure if not supported,
so that the subsystem can apply some fall-back.
The text was updated successfully, but these errors were encountered: