Re: Using Linux+dosemu to install Windows

Patrick J. LoPresti
2002-07-26T16:06:34Z

Stas Sergeev <stssppnn@yahoo.com> writes:

> Good investigation but actually you are hacking the wrong place.
> These instructions are handled in handle_vm86_fault() which is in
> /usr/src/linux/arch/i386/kernel/vm86.c The attached patch must be a
> good start for fixing the problem.

Ah, so the problem is that the kernel's emulation does not account for
multiple prefix bytes?

Will you submit your patch to Alan Cox? It would be nice to get this
fixed in the long run.

One more thing. How precise should the emuluation be? According to
this:

http://webster.cs.ucr.edu/Page_TechDocs/Doc386/popf.html

The popfd instruction should not modify the VM or RF bits. (Not to
mention any bits which are reserved in the current revision of the
CPU.) Or does the kernel already take care of these concerns?

> No, it tries to alter the AC flag which is a bit 2 of the higher
> word of eflags.

Yup, my mistake.

> But dosemu explicitly clears this flag because due to some unknown
> bugs it sometimes sets spuriously. grep the do_vm86.c for the
> string "BUG:" and comment the relevant code, then winnt.exe will
> work.

Thank you!

I believe clearing those flags is a bad idea. They are both used
routinely to detect the CPU version:

http://people.freebsd.org/~kato/cpuident.html

(Similar sample code can be found all over the Web.)

I suggest removing the BUG: stuff from the dosemu source code, then
figuring out what the real problem is and fixing it properly.

What do you think?

- Pat