                          Xenix 286 Emulation
                          (under development)



* Copyright

Copyright 1994  Mike Jagdis (jaggy@purplet.demon.co.uk)

This isn't finished. If enough is there to be useful to you go ahead.
I do, however, disclaim all responsibility for any bad fortune that
befalls you whether caused by this emulation code or not.

The Xenix 286 emulator is copyright. It is not public domain. It is
not under a GNU Public Licence. It simply is. All I ask is that you
give the usual credits where appropriate.


* Theory

The Xenix 286 emulator is implemented as a "magic" shared library that
is known to the x.out binary loader contained in the iBCS emulator
kernel module. When the x.out loader encounters a binary built for a
286 or lower it maps /lib/x286emul into the process' memory, maps the
actual binary higher in memory building the LDT as it goes and then
starts the process by entering the *library* rather than the actual
binary. The x286emul library initialises its environment and then enters
the 286 binary. When the 286 binary attempts a system call it causes a
segmentation fault which is trapped by x286emul and reprocessed as a
normal 386 system call. Note that x286emul may sometimes use a normal
Linux call and sometimes an iBCS lcall7. Use of lcall7 avoids the
need to copy code from the iBCS module to x286emul in order to map
values between the iBCS and Linux domains.
