Subject: emul LKM hooks (was Re: Linux emulation for SPARC?)
To: None <current-users@NetBSD.ORG>
From: Todd Vierling <>
List: current-users
Date: 11/04/1997 21:32:17
[pulled from port-sparc]

On Tue, 4 Nov 1997, Jim Wise wrote:

: Simple.  By having a central dispatch point for emulation type, NetBSD
: can not only easily support multiple emulations per platform, but can
: provide emulations easily after the fact, even in an LKM.  All while
: keeping the NetBSD execution environment identical between ports.

Well, we can't quite make emulation LKM's, yet, but that can be fixed.  I'd
like a concensus opinion for something.  The big problem with LKM'ifying
emulations is that emulations often require a little bit of code in locore,
which can't quite be brought in by LKM.

So, what about emulation hooks that are linked in from libcompat.a when an
emulation is not compiled in by default?  These hooks can be intercepted by
an emulation LKM, and would be no-ops or error-ops if the LKM is not loaded. 
The LKM could also be unloaded if the refcnt for that emulation is 0, and
the hooks would then be released.   The hooks could be completely eliminated
(or actually, the locore code would be eliminated, removing references to
the code in libcompat) if an option were not specified in kernel config,
say, "EMUL_SVR4_HOOKS".  The locore code could be included whether the hooks
or full-blown emulation were compiled in.

Thought about this while doing all my svr4 and linux fiddling... it would be
_so_ much easier to be able to unload an emulation LKM and reload it (under
options INSECURE) while fiddling with it, versus rebooting all the time.

== Todd Vierling (Personal; Business
== I know you like the Internet, Bobby.  Now go eat your Frosted Flakes.