Subject: Re: emulation initialization
To: None <sommerfeld@netbsd.org>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: tech-kern
Date: 12/22/2002 20:02:19
Bill Sommerfeld wrote:
> > The best way I thought about it would be to add a e_init field
> > to struct emul. e_init would point to a function called at system boot
> > time.
>
> Another case to worry about is modloaded emulations..
A LKM can call appropriate ini/fini function from the
compat_*_lkmentry() function.
> BTW, if you want to allow unloading of emulations, we'd need an e_fini.
Definitely.
There is no compat_mach LKM at the moment; to have one working,
it's necessary to destroy the pools before the LKM would be removed
(this precise problem - stale pools on LKM unload - was adressed
by introduction of vfs op vfs_done).
> Note that we already have another mechanism to allow "generic"
> subsystems to register constructors at kernel link time: pseudo-device
> attach routines.
This sounds kinda kludgy to use pseudo-device for compat code
purposes ...
I think the mach_cold thing is sufficient for Mach emulation.
Nothing besides compat/mach needs the structures initialized, so I think it's
better to allocate resources for mach compat when first mach
process is executed.
That said, it would be good to have some generic way to
have random init code run on boot. AFAIK FreeBSD adressed this
with introduction of the SYSINIT()/mi_startup() thing.
Jaromir