From 464de37ce6099f409aa233200a94ac38216aa211 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 16 Oct 1998 03:55:01 +0000 Subject: *gulp*. Jordan specifically OK'ed this.. This is the bulk of the support for doing kld modules. Two linker_sets were replaced by SYSINIT()'s. VFS's and exec handlers are self registered. kld is now a superset of lkm. I have converted most of them, they will follow as a seperate commit as samples. This all still works as a static a.out kernel using LKM's. --- sys/alpha/linux/linux_sysvec.c | 53 ++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 17 deletions(-) (limited to 'sys/alpha/linux/linux_sysvec.c') diff --git a/sys/alpha/linux/linux_sysvec.c b/sys/alpha/linux/linux_sysvec.c index 5600111..cf8c021 100644 --- a/sys/alpha/linux/linux_sysvec.c +++ b/sys/alpha/linux/linux_sysvec.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_sysvec.c,v 1.35 1998/10/05 16:37:36 jfieber Exp $ + * $Id: linux_sysvec.c,v 1.36 1998/10/11 21:08:02 alex Exp $ */ /* XXX we use functions that might not exist. */ @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -447,31 +448,49 @@ Elf32_Brandinfo *linux_brandlist[] = { NULL }; -#ifndef LKM /* * XXX: this is WRONG, it needs to be SI_SUB_EXEC, but this is just at the * "proof of concept" stage and will be fixed shortly */ -static void linux_elf_init __P((void *dummy)); +static int linux_elf_modevent __P((module_t mod, modeventtype_t type, void *data)); -static void -linux_elf_init(dummy) - void *dummy; +static int +linux_elf_modevent(module_t mod, modeventtype_t type, void *data) { Elf32_Brandinfo **brandinfo; int error; error = 0; - for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; ++brandinfo) - if (elf_insert_brand_entry(*brandinfo) < 0) - error = 1; - - if (error) - printf("cannot insert Linux elf brand handler\n"); - else if (bootverbose) - printf("Linux-ELF exec handler installed\n"); + switch(type) { + case MOD_LOAD: + for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; + ++brandinfo) + if (elf_insert_brand_entry(*brandinfo) < 0) + error = EINVAL; + if (error) + printf("cannot insert Linux elf brand handler\n"); + else if (bootverbose) + printf("Linux-ELF exec handler installed\n"); + break; + case MOD_UNLOAD: + for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; + ++brandinfo) + if (elf_remove_brand_entry(*brandinfo) < 0) + error = EINVAL; + if (error) + printf("Could not deinstall ELF interpreter entry\n"); + else if (bootverbose) + printf("Linux-elf exec handler removed\n"); + break; + default: + break; + } + return error; } - -SYSINIT(linuxelf, SI_SUB_VFS, SI_ORDER_ANY, linux_elf_init, NULL); -#endif +static moduledata_t linux_elf_mod = { + "linuxelf", + linux_elf_modevent, + 0 +}; +DECLARE_MODULE(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); -- cgit v1.1