Subject: Re: linux emulation problem
To: Michael Richardson <mcr@sandelman.ottawa.on.ca>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-i386
Date: 12/19/1996 14:53:58
On Thu, 19 Dec 1996 17:34:43 -0500 
 Michael Richardson <mcr@sandelman.ottawa.on.ca> wrote:

 >   Linux has iBCS support. Does it also have SVR4 support? If so, how
 > does it distinguish things? Or has the Linux ELF ABI simply become a
 > superset of SVR4 ABI?

Linux does something... very horrible.  By default, Linux ELF executables
start up in SVR4 emulation mode... However, a native Linux executable
then executes a sys_personality() system call to tell the kernel that
it's a native Linux executable.

"Gee, nothing like optimizing for the corner case."

NetBSD _could_ look for the call to sys_personality()... however, there
are a few problems with this:

	(a) We just have to hope that the system call number for
	    Linux's sys_personality() doesn't conflict with a syscall
	    that might be used by some other ELF ABI.

	(b) We'd need to include the Linux glue in every other
	    ELF ABI we support.

	(c) We'd need to re-work our emulation code somewhat to
	    allow us to change the emulation structure of a process
	    "hot".

In short, "there has to be a better way".  I personally consider the
method Linux uses a fairly awful hack which could be avoided by the
Linux folks agreeing to some method of "marking" executables.  However,
the last time I discussed this with Linus, he was somewhat less than
receptive to the idea, and thought that all other free OSs should just
adopt the Linux ABI (which is unacceptable from a kernel design standpoint
for several reasons).

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939