Subject: Re: linux emulation problem
To: None <port-i386@NetBSD.ORG>
From: Michael Richardson <mcr@sandelman.ottawa.on.ca>
List: port-i386
Date: 12/19/1996 21:41:44
>>>>> "Jason" == Jason Thorpe <thorpej@nas.nasa.gov> writes:

    Jason> On Thu, 19 Dec 1996 17:34:43 -0500 Michael Richardson
    Jason> <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?

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

  I see. Interesting. I suppose the assumption is that everyone that
does ELF is going to converge on the SVR4 ABI. The only people that
could have messed that up would have been SCO, but with Gemini, they
are now solidly in the SVR4 camp. (As opposed to SVR3.2 Version 4 fap)

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

  I guess Linus is assuming that there won't be another ELF ABI other
than SVR4 and Linux. How do we distinguish NetBSD ELF from other ELF?
  [a ghost of M-Buf Kenobi says: "Use the source luke!"...
kern/exec_elf32.c, compat/linux/linux_exec.c later. Nice ELFNAME()
macros... real readable :-)]
  Oh. We *depend* on the gcc already even with just EMUL_LINUX.
  How is it that we don't always probe true on NetBSD/ELF binaries?

#ifdef notyet
		/*
		 * We should really use a signature in our native binaries
		 * and have our own probe function for matching binaries,
		 * before trying the emulations. For now, if the emulation
		 * probes failed we default to native.
		 */
		if (error)
			goto bad;
#endif

  Is there planned time when this will happen? Oh. no. We don't have
any ELF executables in the stock 1.2 distribution yet? 

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

  This I see as the major problem.

    Jason> could be avoided by the Linux folks agreeing to some method
    Jason> of "marking" executables.  However, the last time I
    Jason> discussed this with Linus, he was somewhat less than

  Okay. Let's mark the executables ourselves. We'll have to mark
NetBSD/i386 ELF in some way anyway.

   :!mcr!:            |  Network security consulting and 
   Michael Richardson |      contract programming
 WWW: mcr@sandelman.ottawa.on.ca. PGP key available.