Subject: emulations and syscall handlers
To: None <tech-kern@netbsd.org>
From: Charles M. Hannum <root@ihack.net>
List: tech-kern
Date: 12/11/2000 04:02:27
If anyone is working on doing the HAS_SEPARATED_SYSCALL thing for
non-i386 platforms... please hold off for a bit. I'm in the process
of changing this interface.
Basically, instead of having an e_syscall, I now have
e_syscall_intern, which is called at exec time when the emulation is
set, or when certain properties are changed (e.g. ktrace is enabled or
disabled, etc.). On i386, I'm going to use this to have 2 versions of
the system call handler -- one `plain' version that doesn't do a lot
of the extra cruft, and one `fancy' version which handles ktrace, etc.
Where the pointer to the syscall handler is stored becomes completely
machine-dependent. On i386, I put it in struct mdproc. There are a
few reasons for this:
* The dispatch to the handler is all MD, so it doesn't even need to be
a proper C function.
* It's possible that there may be more than one handler -- e.g. using
different traps to automatically copy in different length arguments
lists, or whatever. There's no reason to restrict what the MD code
can do here.
* Putting the pointer in struct emul causes an additional indirection,
and doesn't allow for the `plain'/`fancy' split.
I'm expecting ports to switch to this method wholesale, so I have all
the code switch on __HAVE_SYSCALL_INTERN, which you can put in the MD
types.h, as with other __HAVE_* macros.