Glen Herrmannsfeldt wrote:

>This would seem to me to be similar to what CMS does when running
>MVS object or load modules.  One requirement is to emulate
>the system SVC's.  Two things are needed:  that Linux doesn't use the
>required SVC's (or can pretend not to), and that an interface is
>available for a user program to trap an SVC, do the required
>processing and return.
>
>Well, that would be for user mode emulation.  It could be done
>with kernel emulation of the SVC's, again much easier if the
>required SVC's weren't being used by L/390.

Well, Linux uses all SVCs (not literally, but all are reserved
for future use, at least).  However, this doesn't really matter.
There are two ways to implement the sort of system call
emulation you are talking about.

First, you could do an emulation in user mode by running your
target process as client under ptrace () with PTRACE_SYSCALL.
The tracing process gets control every time the client performs
a syscall (i.e. SVC).  The parent can emulate the intended
behaviour, and nullify the orignal syscall before continuing.
(This is done e.g. by User Mode Linux.)

The second option would be to implement system call emulation
in kernel space.  Linux has the notion of 'personalities'
that modify the system call ABI as presented to user space.
One example of this is the Solaris personality that allows
to run Solaris binaries on Linux/sparc.  Another is the
31-bit personality that allows to run S/390 (31-bit) binaries
on Linux for zSeries (64-bit).  To implement this, you'd have
to add a new personality, and add code to select the proper
system call table to the first level SVC handler (entry.S).

While I'm not at all familiar with MVS and its SVCs,
I do forsee difficulties in implementing the calls, though.
(What about ASCII/EBCDIC for example?)

Bye,
Ulrich

--
  Dr. Ulrich Weigand
  [EMAIL PROTECTED]

Reply via email to