From d30e84112a87337209ea45237f3d9b12e29abaa9 Mon Sep 17 00:00:00 2001 From: dchagin Date: Sat, 9 Jan 2016 16:08:22 +0000 Subject: MFC r283421: Introduce a new module linux_common.ko which is intended for the following primary purposes: 1. Remove the dependency of linsysfs and linprocfs modules from linux.ko, which will be architecture specific on amd64. 2. Incorporate into linux_common.ko general code for platforms on which we'll support two Linuxulator modules (for both instruction set - 32 & 64 bit). 3. Move malloc(9) declaration to linux_common.ko, to enable getting memory usage statistics properly. Currently linux_common.ko incorporates a code from linux_mib.c and linux_util.c and linprocfs, linsysfs and linux kernel modules depend on linux_common.ko. Temporarily remove dtrace garbage from linux_mib.c and linux_util.c --- sys/amd64/linux32/linux.h | 4 ---- sys/amd64/linux32/linux32_sysvec.c | 18 ++++++++---------- 2 files changed, 8 insertions(+), 14 deletions(-) (limited to 'sys/amd64/linux32') diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 5fcf8df..aec74a3 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -46,10 +46,6 @@ extern u_char linux_debug_map[]; (long)td->td_proc->p_pid, (long)td->td_tid #define LINUX_DTRACE linuxulator32 -#ifdef MALLOC_DECLARE -MALLOC_DECLARE(M_LINUX); -#endif - #define LINUX32_MAXUSER ((1ul << 32) - PAGE_SIZE) #define LINUX32_SHAREDPAGE (LINUX32_MAXUSER - PAGE_SIZE) #define LINUX32_USRSTACK LINUX32_SHAREDPAGE diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index a57257b..aa98c96 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -87,8 +87,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux, 1); -MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures"); - #define AUXARGS_ENTRY_32(pos, id, val) \ do { \ suword32(pos++, id); \ @@ -120,7 +118,6 @@ extern char _binary_linux32_locore_o_end; extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL]; SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); -SET_DECLARE(linux_device_handler_set, struct linux_device_handler); static int elf_linux_fixup(register_t **stack_base, struct image_params *iparams); @@ -976,6 +973,13 @@ static u_long linux32_maxvmem = LINUX32_MAXVMEM; SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxvmem, CTLFLAG_RW, &linux32_maxvmem, 0, ""); +#if defined(DEBUG) +SYSCTL_PROC(_compat_linux32, OID_AUTO, debug, + CTLTYPE_STRING | CTLFLAG_RW, + 0, 0, linux_sysctl_debug, "A", + "Linux debugging control"); +#endif + static void linux32_fixlimit(struct rlimit *rl, int which) { @@ -1152,7 +1156,6 @@ linux_elf_modevent(module_t mod, int type, void *data) Elf32_Brandinfo **brandinfo; int error; struct linux_ioctl_handler **lihp; - struct linux_device_handler **ldhp; error = 0; @@ -1165,8 +1168,6 @@ linux_elf_modevent(module_t mod, int type, void *data) if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_register_handler(*lihp); - SET_FOREACH(ldhp, linux_device_handler_set) - linux_device_register_handler(*ldhp); LIST_INIT(&futex_list); mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, @@ -1175,7 +1176,6 @@ linux_elf_modevent(module_t mod, int type, void *data) linux_proc_exec, NULL, 1000); linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); - linux_osd_jail_register(); stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux ELF exec handler installed\n"); @@ -1196,13 +1196,10 @@ linux_elf_modevent(module_t mod, int type, void *data) if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_unregister_handler(*lihp); - SET_FOREACH(ldhp, linux_device_handler_set) - linux_device_unregister_handler(*ldhp); mtx_destroy(&futex_mtx); EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag); EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag); - linux_osd_jail_deregister(); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else @@ -1221,3 +1218,4 @@ static moduledata_t linux_elf_mod = { }; DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); +MODULE_DEPEND(linuxelf, linux_common, 1, 1, 1); -- cgit v1.1