aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/linux/linux_sysvec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386/linux/linux_sysvec.c')
-rw-r--r--sys/i386/linux/linux_sysvec.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index 70ebfc123e2c..e3e65e9bfc53 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysent.h>
#include <sys/sysproto.h>
#include <sys/vnode.h>
+#include <sys/eventhandler.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@@ -105,6 +106,18 @@ static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);
static void exec_linux_setregs(struct thread *td, u_long entry,
u_long stack, u_long ps_strings);
+extern void linux_proc_exit(void *, struct proc *, struct image_params *);
+extern void linux_proc_exec(void *, struct proc *, struct image_params *);
+extern void linux_schedtail(void *, struct proc *);
+extern LIST_HEAD(futex_list, futex) futex_list;
+extern struct sx emul_shared_lock;
+extern struct sx emul_lock;
+extern struct mtx futex_mtx;
+
+static eventhandler_tag linux_exit_tag;
+static eventhandler_tag linux_schedtail_tag;
+static eventhandler_tag linux_exec_tag;
+
/*
* Linux syscalls return negative errno's, we do positive and map them
* Reference:
@@ -804,7 +817,7 @@ exec_linux_setregs(struct thread *td, u_long entry,
struct sysentvec linux_sysvec = {
LINUX_SYS_MAXSYSCALL,
linux_sysent,
- 0xff,
+ 0,
LINUX_SIGTBLSZ,
bsd_to_linux_signal,
ELAST + 1,
@@ -833,7 +846,7 @@ struct sysentvec linux_sysvec = {
struct sysentvec elf_linux_sysvec = {
LINUX_SYS_MAXSYSCALL,
linux_sysent,
- 0xff,
+ 0,
LINUX_SIGTBLSZ,
bsd_to_linux_signal,
ELAST + 1,
@@ -908,6 +921,16 @@ linux_elf_modevent(module_t mod, int type, void *data)
linux_ioctl_register_handler(*lihp);
SET_FOREACH(ldhp, linux_device_handler_set)
linux_device_register_handler(*ldhp);
+ sx_init(&emul_lock, "emuldata lock");
+ sx_init(&emul_shared_lock, "emuldata->shared lock");
+ LIST_INIT(&futex_list);
+ mtx_init(&futex_mtx, "futex protection lock", NULL, MTX_DEF);
+ linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit,
+ NULL, 1000);
+ linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail, linux_schedtail,
+ NULL, 1000);
+ linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec,
+ NULL, 1000);
if (bootverbose)
printf("Linux ELF exec handler installed\n");
} else
@@ -929,6 +952,12 @@ linux_elf_modevent(module_t mod, int type, void *data)
linux_ioctl_unregister_handler(*lihp);
SET_FOREACH(ldhp, linux_device_handler_set)
linux_device_unregister_handler(*ldhp);
+ sx_destroy(&emul_lock);
+ sx_destroy(&emul_shared_lock);
+ mtx_destroy(&futex_mtx);
+ EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
+ EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag);
+ EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
if (bootverbose)
printf("Linux ELF exec handler removed\n");
} else