Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Mar 1996 14:35:54 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        amurai@spec.co.jp
Cc:        sos@freebsd.org, current@freebsd.org
Subject:   Re: Native & Linux ELF support finally there...
Message-ID:  <199603122135.OAA06630@phaeton.artisoft.com>
In-Reply-To: <199603120235.LAA02530@tama.spec.co.jp> from "Atsushi Murai" at Mar 12, 96 11:35:34 am

next in thread | previous in thread | raw e-mail | index | archive | help
> > After a hectic week, Peter Wemm and I are proud to announce that
> > FreeBSD-current now has ELF support. This means that we are now
> > able to run native FreeBSD ELF binaries (generated with John
> > Polstras Elfkit-1.0.1) and Linux ELF binaries, and yes Linux
> > QUAKE finally works, at least as far as Peter & I has tried it
> > (Hey I dont have time to play)
> 
> Sounds great! But is there any way/plan to exclude this support code
> during a compiling kernel(i.e options COMPAT_LINUX) ? It's will be
> helpful for optimizing a size of kernel under the restricted memory ;-)

The "COMPAT_LINUX" flag crap strikes me as just that: *crap*.

It affects 4 files:

1)	i386/i386/exception.s

	This small amount of code is here because someone didn't
	inline it or put it in a .s for the Linux ABI module itself.
	It should be possible to put this anywhere, including a file
	that is ld -r'ed into the single Linux ABI module.

2)	i386/i386/trap.c

	This code is the code that is called by the exception.s code;
	there is exception.s code at all because it wasn't inlined as
	a naked function here (ie: no normal C preamble/postamble,
	but still C code).

3)	i386/i386/machdep.c

	This code is two lines: one external declaration for the
	functions that could be dynamically assigned via function
	pointer, if nothing else, like the NFS loadable module
	functions (which are also bogusly wired his way for the lease
	code).  The line is a "setidt".  It should be possible to
	set/unset idt's from the LKM init/deinit routines.

4)	kern/imgact_aout.c    

	This is here because the image activators are bogusly called
	to look at magic numbers (my original LKM design had the
	magic numbers in a list and the lookup taking place in
	the list to hit the image activator).  Using the original
	design, adding Linux image activation would be done by adding
	a list item that listed the magic numbers for Linux images
	and referenced the same activation function.  This would
	also be removed when the module was unloaded.

	At worst, the activator chould be a stub that diddles the
	magic number then calls the a.out activator (this really
	would be silly because of NetBSD and BSDI and NetBSD's
	alternate platform support being usable using processor
	emulation environments that cause a loader to mmap the
	program image into an emulation space... ie SPARC or MIPS
	or PPC binaries on FreeBSD, or vice versa).

The upshot of all this is that the COMPAT_LINUX flag should go away;
it's a pain in the ass to have to rebuild a kernel in order to run
Linux binary compatability.

The change of the magic lookup would have the pleasent side-effect
of not coring Linux program when the ABI module wasn't loaded, as
is currently the case.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603122135.OAA06630>