Subject: Emulations as LKMs
To: None <tech-kern@netbsd.org>
From: Jaromír Dolecek <dolecek@ibis.cz>
List: tech-kern
Date: 11/06/2000 23:48:49
Hi,
it's getting unpleasant that the emulation code is not loadable
via LKM. Developing new code, testing and debugging is quite
difficult - having to compile new kernel and to reboot is very
time consuming. Currently, it makes me think it would actually
safe me quite some time to implement better emulation LKM logic
than to continue working the traditional way.
There is some LM_EXEC-related code in sys/kern/kern_lkm.c, but that doesn't
seem to be working ATM and would probably need some more work to glue
the emulation properly into running system.
What I think needs to be done (in no particular order):
- split binary format and emulation so that we can have single emulation
structure for all supported binary formats of that particular emulation
- add some functions to make it possible to add/remove emulations dynamically
as well as having them compiled in
- add refcnt to emulation and binary format structures, so that it's possible
to find out if it's safe to unload it
- add an easy way to check for type of process emulation;
current practice of
#ifdef COMPAT_FOO_OS
if (0
#ifdef EXEC_AOUT
|| p->emul == &emul_FOO_OS_aout)
#endif
#ifdef EXEC_ELF32
|| p->emul == &emul_FOO_OS_elf32)
#endif
) { do_stuff; }
#endif /* COMPAT_FOO_OS */
.. should die and become something like:
#if defined(COMPAT_LINUX) || defined(LKM)
if (emul_is_equal(p->emul, EMUL_LINUX) {
do_stuff;
}
#endif
(would be good to find out how FreeBSD folks solved this)
- there are probably more - feel free to comment :)
Can anyone comment if the LM_EXEC stuff would be potentially usable?
It would surely be good if the thing would not need to be rewritten
from scratch :)
Jaromir
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.ics.muni.cz/~dolecek/
@@@@ Wanna a real operating system ? Go and get NetBSD, damn! @@@@