Subject: Re: A possible problem with a dos emulator...need help
To: Brett Lymn <>
From: John Brezak <>
List: netbsd-ports
Date: 03/18/1994 11:11:40
> Hello,
>         When I get the time I am hacking away at a dos emulator.  It
> has come time to seriously think about implementation issues for the
> emulator itself.  One thing that has me worried at the moment (not the
> only thing...;-) is the fact that the DOS land is going to occupy the
> bottom 1Meg of the emulator address space.  I can see some problems
> with this:
> 1) The unix exit code of the process will be overwritten by the DOS
> stuff
> 2) I think the first couple of pages of the process are protected so
> that dereferencing a null pointer will produce a SIGSEGV.
> My current thinking is that I can spelunk the crt0.c to make a special
> one for the emulator so that the exit code is shifted to above the
> 1Meg+64K magic limit that DOS knows about.  Linux dosemu got around
> the problem by using the shared libraries and linking their code to an
> address about the Magic Barrier (tm) - if I used 'current could I do
> the same trick?  I would prefer this to hacking crt0 because it is an
> ugly hack (hey, IMHO running MS-DOS is pretty ugly :-).  If I can use
> the shared libraries to fix the MB (tm) how can I do this?
> As for point 2, I am not sure how I can get around this.  I must have
> these pages r/w as DOS will insist on it.
> Please tell me I am worrying about nothing ;-)  if not any
> suggestions/pointers?
Try using !ZMAGIC (maybe NMAGIC) and use the "-T" flag to ld to specify
a higher (1M) text start point.

 John Brezak                    UUCP:     uunet!apollo.hp!brezak
 Hewlett Packard/Apollo         Internet:
 300 Apollo Drive               Phone:    (508) 436-4915
 Chelmsford, Massachusetts      Fax:      (508) 436-5122