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/gnu/i386/fpemul/fpu_entry.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'sys/gnu/i386') diff --git a/sys/gnu/i386/fpemul/fpu_entry.c b/sys/gnu/i386/fpemul/fpu_entry.c index 1d8b44d..bde2ef6 100644 --- a/sys/gnu/i386/fpemul/fpu_entry.c +++ b/sys/gnu/i386/fpemul/fpu_entry.c @@ -55,7 +55,7 @@ * * W. Metzenthen June 1994. * - * $Id: fpu_entry.c,v 1.13 1997/07/20 08:46:23 bde Exp $ + * $Id: fpu_entry.c,v 1.14 1998/08/16 01:21:48 bde Exp $ * */ @@ -515,15 +515,35 @@ gnufpu_mod(struct lkm_table *lkmtp, int cmd, int ver) } #else /* !LKM */ -static void -gnufpu_init(void *unused) +static int +gnufpu_modevent(module_t mod, modeventtype_t type, void *unused) { - if (pmath_emulate) - printf("Another Math emulator already present\n"); - else - pmath_emulate = math_emulate; + switch (type) { + case MOD_LOAD: + if (pmath_emulate) { + printf("Another Math emulator already present\n"); + return EACCES; + } else + pmath_emulate = math_emulate; + break; + case MOD_UNLOAD: + if (pmath_emulate != math_emulate) { + printf("Cannot unload another math emulator\n"); + return EACCES; + } + pmath_emulate = 0; + break; + default: + break; + } + return 0; + } - -SYSINIT(gnufpu, SI_SUB_CPU, SI_ORDER_ANY, gnufpu_init, NULL); +moduledata_t gnufpumod = { + "gnufpu", + gnufpu_modevent, + 0 +}; +DECLARE_MODULE(gnufpu, gnufpu_modevent, SI_SUB_PSEUDO, SI_ORDER_ANY); #endif /* LKM */ -- cgit v1.1