diff options
Diffstat (limited to 'sys/i386/linux/linux_sysvec.c')
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 3f0c6f4100e6..364cc0cdcd8d 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -102,8 +102,6 @@ static int linux_fixup(register_t **stack_base, struct image_params *iparams); static int elf_linux_fixup(register_t **stack_base, struct image_params *iparams); -static void linux_prepsyscall(struct trapframe *tf, int *args, u_int *code, - caddr_t *params); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); static void exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack); @@ -864,19 +862,33 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) return (EJUSTRETURN); } -/* - * MPSAFE - */ -static void -linux_prepsyscall(struct trapframe *tf, int *args, u_int *code, caddr_t *params) +static int +linux_fetch_syscall_args(struct thread *td, struct syscall_args *sa) { - args[0] = tf->tf_ebx; - args[1] = tf->tf_ecx; - args[2] = tf->tf_edx; - args[3] = tf->tf_esi; - args[4] = tf->tf_edi; - args[5] = tf->tf_ebp; /* Unconfirmed */ - *params = NULL; /* no copyin */ + struct proc *p; + struct trapframe *frame; + + p = td->td_proc; + frame = td->td_frame; + + sa->code = frame->tf_eax; + sa->args[0] = frame->tf_ebx; + sa->args[1] = frame->tf_ecx; + sa->args[2] = frame->tf_edx; + sa->args[3] = frame->tf_esi; + sa->args[4] = frame->tf_edi; + sa->args[5] = frame->tf_ebp; /* Unconfirmed */ + + if (sa->code >= p->p_sysent->sv_size) + sa->callp = &p->p_sysent->sv_table[0]; + else + sa->callp = &p->p_sysent->sv_table[sa->code]; + sa->narg = sa->callp->sy_narg; + + td->td_retval[0] = 0; + td->td_retval[1] = frame->tf_edx; + + return (0); } /* @@ -972,7 +984,7 @@ struct sysentvec linux_sysvec = { .sv_sendsig = linux_sendsig, .sv_sigcode = linux_sigcode, .sv_szsigcode = &linux_szsigcode, - .sv_prepsyscall = linux_prepsyscall, + .sv_prepsyscall = NULL, .sv_name = "Linux a.out", .sv_coredump = NULL, .sv_imgact_try = exec_linux_imgact_try, @@ -987,7 +999,10 @@ struct sysentvec linux_sysvec = { .sv_setregs = exec_linux_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, - .sv_flags = SV_ABI_LINUX | SV_AOUT | SV_IA32 | SV_ILP32 + .sv_flags = SV_ABI_LINUX | SV_AOUT | SV_IA32 | SV_ILP32, + .sv_set_syscall_retval = cpu_set_syscall_retval, + .sv_fetch_syscall_args = linux_fetch_syscall_args, + .sv_syscallnames = NULL, }; struct sysentvec elf_linux_sysvec = { @@ -1003,7 +1018,7 @@ struct sysentvec elf_linux_sysvec = { .sv_sendsig = linux_sendsig, .sv_sigcode = linux_sigcode, .sv_szsigcode = &linux_szsigcode, - .sv_prepsyscall = linux_prepsyscall, + .sv_prepsyscall = NULL, .sv_name = "Linux ELF", .sv_coredump = elf32_coredump, .sv_imgact_try = exec_linux_imgact_try, @@ -1018,7 +1033,10 @@ struct sysentvec elf_linux_sysvec = { .sv_setregs = exec_linux_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, - .sv_flags = SV_ABI_LINUX | SV_IA32 | SV_ILP32 + .sv_flags = SV_ABI_LINUX | SV_IA32 | SV_ILP32, + .sv_set_syscall_retval = cpu_set_syscall_retval, + .sv_fetch_syscall_args = linux_fetch_syscall_args, + .sv_syscallnames = NULL, }; static char GNU_ABI_VENDOR[] = "GNU"; |