diff options
author | netchild <netchild@FreeBSD.org> | 2006-08-15 12:54:30 +0000 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2006-08-15 12:54:30 +0000 |
commit | ec2ba5d85d7c127eef674f77e45cc0bea81d8850 (patch) | |
tree | eefd61a061ceacbae59d210a958f6ea28f9d2b34 /sys/i386/linux/linux_sysvec.c | |
parent | e8cb5b55782d998cb82d772021c355c69edfaf5e (diff) | |
download | FreeBSD-src-ec2ba5d85d7c127eef674f77e45cc0bea81d8850.zip FreeBSD-src-ec2ba5d85d7c127eef674f77e45cc0bea81d8850.tar.gz |
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
Diffstat (limited to 'sys/i386/linux/linux_sysvec.c')
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 70ebfc1..e3e65e9 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 |