Newsgroups: comp.os.linux
From: lautner@dec16.informatik.uni-wuerzburg.de (Matthias Lautner)
Subject: dos emulator
Organization: University of Wuerzburg, Germany
Date: Thu, 23 Apr 1992 15:29:54 GMT
Hi!
I'm working on a dos emulator for linux. I created a new system call for
this purpose. It devotes a 4 MB memory area of virtual process memory to dos
and keeps the 8086 register set in a struct. Starting the vm86 system call,
the registers are transferred to the cpu and the process is running in
virtual 8086 mode using the specified memory area until a fault (eg. general
protection) happens or a signal is caught. Then the registers are stored back
to the struct and the system call returns as usual. The result of the call
shows up the reason for interrupting.
Whith this call it is possible to write a dos emulator. Any interrupt
statement or io machine code will result in a general protection trap an can
be emulated.
Very simple masm generated dos programs are allready running.
If someone is interested in helping me to implement the functions of the
dos int 0x21 it would be grate. I'm currently working with 0.95c.
Matthias
--
*****************************************************************************
Matthias Lautner Carl-Vornberger-Str. 21, 8701 Randersacker, Germany
lautner@informatik.uni-wuerzburg.de
*****************************************************************************
From: drew@kinglear.cs.colorado.edu (Drew Eckhardt)
Newsgroups: comp.os.linux
Subject: Re: dos emulator
Date: 23 Apr 92 16:33:51 GMT
Organization: University of Colorado at Boulder
Nntp-Posting-Host: kinglear.cs.colorado.edu
In article <1992Apr23.152954.14286@informatik.uni-wuerzburg.de> lautner@dec16.informatik.uni-wuerzburg.de (Matthias Lautner) writes:
>Hi!
>
>I'm working on a dos emulator for linux. I created a new system call for
>this purpose. It devotes a 4 MB memory area of virtual process memory to dos
>and keeps the 8086 register set in a struct. Starting the vm86 system call,
>the registers are transferred to the cpu and the process is running in
>virtual 8086 mode using the specified memory area until a fault (eg. general
>protection) happens or a signal is caught. Then the registers are stored back
>to the struct and the system call returns as usual. The result of the call
>shows up the reason for interrupting.
>
>Whith this call it is possible to write a dos emulator. Any interrupt
>statement or io machine code will result in a general protection trap an can
>be emulated.
>
>Very simple masm generated dos programs are allready running.
>
>If someone is interested in helping me to implement the functions of the
>dos int 0x21 it would be grate. I'm currently working with 0.95c.
>
The following questions are hypothetical :
1. How many documented DOS calls are there?
2. How many undocumented DOS calls are there?
The answer is "many". The DOS kernel is ~50K of machine code. You
don't want to duplicate that. Instead, you emulate what DOS runs on,
and catch all of the programs that run there too, and run a *REAL*
dos.
DOS runs on BIOS. Question : how many BIOS calls are there?
Again, the answer is "many", so you don't emulate BIOS, use the
real thing, and emulate the underlying hardware where
possible.
Something that runs simple MASM programs is sort of interesting,
and lets you see how 386 virtual mode works. Something that is 100%
MSDOS compatable is like a Tandy 2000 or DEC rainbow - it runs
MSDOS - but it's not compatable. A few small programs will
run, but none of the programs that make me keep DOS on my
hard disk. Something that is 100% BIOS compatable is getting
there, and I can run many programs - but anything that does
direct screen I/O is out - which rules out MOST of
the programs out there.
Certain BIOS calls *should* be emulated, such as disk accesses,
which should be redirected out to unix devices. Others, such
as most video routines, which read/write to your remapped
video buffer are OK.
Newsgroups: comp.os.linux
From: tytso@ATHENA.MIT.EDU (Theodore Ts'o)
Subject: Re: dos emulator
Reply-To: tytso@athena.mit.edu
Organization: The Internet
Date: Thu, 23 Apr 1992 20:20:06 GMT
From: drew@kinglear.cs.colorado.edu (Drew Eckhardt)
Date: 23 Apr 92 16:33:51 GMT
1. How many documented DOS calls are there?
The answer is "many". The DOS kernel is ~50K of machine code. You
don't want to duplicate that. Instead, you emulate what DOS runs on,
and catch all of the programs that run there too, and run a *REAL*
dos.
Actually, what I would do is emulate DOS by mapping the DOS filesystem
calls into Unix filesystem calls. That should simply things quite a
bit. Of course, you will still have to emulate the BIOS calls, since
many programs call direct to the BIOS. But if you emulate the BIOS
calls and the DOS 2.11 calls, you'd be surprised how many DOS programs
will actually run correctly.
One question about your (Matthias's) technique however; as I recall, the
386 virtual memory mode requires that the task use *virtual memory*
addresses from 0k to 640k, where the kernel is currently located. You
can fix this by actually swapping the page maps in and out, but that's
much more significant than just changing the segment registers. Are you
actually playing page map games to make this work? And if so, how are
you doing this?
- Ted
|