Subject: Re: Emulation extension
To: None <tech-kern@NetBSD.ORG>
From: Christos Zoulas <christos@nyc.deshaw.com>
List: tech-kern
Date: 03/05/1997 20:54:39
  by netbsd1.cygnus.com with SMTP; 8 Sep 1996 00:00:50 -0000
Date: Sat, 7 Sep 1996 20:00:08 -0400 (EDT)
Message-Id: <199609080000.UAA11147@zygorthian-space-raiders.MIT.EDU>
From: "Charles M. Hannum" <mycroft@mit.edu>
To: thorpej@NetBSD.ORG, christos@NetBSD.ORG, mrg@NetBSD.ORG,
        explorer@NetBSD.ORG
Subject: emulations, syscalls, etc.
Status: OR


While talking with dorquej (Jason B-)) about COMPAT_M68K4K, a few
things occured to me:

* We should migrate much of the syscall code (copying in arguments,
calling the functions, etc.) into emulation_machdep.c files, and
simply have a pointer to the function in struct emul.  This would
eliminate a number of #ifdefs, and would probably even make the code
faster.  Ideally, this would remove e_errno, e_nosys, e_nsysent,
e_sysent, and e_syscallnames from struct emul.

* e_sigcode and e_esigcode should not be in struct emul; they should
be handled by the emulation-specific setregs function.  Possibly
e_copyargs could also be combined.  None of these pointers should even
be in struct emul; they should be in the exec package.

* The SO_BROADCAST hack for COMPAT_SUNOS could easily be migrated into
the compat/sunos code.  It does not need to be in uipc_socket.c.

* With just a little work, all the other emulation-specific #ifdefs
(other than initializing the switch tables) could just go away.

* At this point, you have e_name and e_sendsig left in struct emul.
e_sendsig could just go in struct proc, and struct emul could go away
completely.

Not only would this be an architectural win, but it would make
building emulation LKMs trivial.

So, does someone want to do this?  Please?