X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/bd504ef0e0b883cdd7917b73b3574eb9ce669905..39236c6e673c41db228275375ab7fdb0f837b292:/bsd/dev/i386/systemcalls.c diff --git a/bsd/dev/i386/systemcalls.c b/bsd/dev/i386/systemcalls.c index e8494ca4e..77ecfba3a 100644 --- a/bsd/dev/i386/systemcalls.c +++ b/bsd/dev/i386/systemcalls.c @@ -66,9 +66,6 @@ extern void unix_syscall(x86_saved_state_t *); extern void unix_syscall64(x86_saved_state_t *); extern void *find_user_regs(thread_t); -extern void x86_toggle_sysenter_arg_store(thread_t thread, boolean_t valid); -extern boolean_t x86_sysenter_arg_store_isvalid(thread_t thread); - /* dynamically generated at build time based on syscalls.master */ extern const char *syscallnames[]; @@ -101,7 +98,6 @@ unix_syscall(x86_saved_state_t *state) struct proc *p; struct uthread *uthread; x86_saved_state32_t *regs; - boolean_t args_in_uthread; boolean_t is_vfork; assert(is_saved_state32(state)); @@ -132,7 +128,6 @@ unix_syscall(x86_saved_state_t *state) code = regs->eax & I386_SYSCALL_NUMBER_MASK; DEBUG_KPRINT_SYSCALL_UNIX("unix_syscall: code=%d(%s) eip=%u\n", code, syscallnames[code >= NUM_SYSENT ? 63 : code], (uint32_t)regs->eip); - args_in_uthread = ((regs->eax & I386_SYSCALL_ARG_BYTES_MASK) != 0) && x86_sysenter_arg_store_isvalid(thread); params = (vm_offset_t) (regs->uesp + sizeof (int)); regs->efl &= ~(EFL_CF); @@ -146,22 +141,20 @@ unix_syscall(x86_saved_state_t *state) } vt = (void *)uthread->uu_arg; + uthread->uu_ap = vt; if (callp->sy_arg_bytes != 0) { sy_munge_t *mungerp; + uint32_t nargs; assert((unsigned) callp->sy_arg_bytes <= sizeof (uthread->uu_arg)); - if (!args_in_uthread) - { - uint32_t nargs; - nargs = callp->sy_arg_bytes; - error = copyin((user_addr_t) params, (char *) vt, nargs); - if (error) { - regs->eax = error; - regs->efl |= EFL_CF; - thread_exception_return(); - /* NOTREACHED */ - } + nargs = callp->sy_arg_bytes; + error = copyin((user_addr_t) params, (char *) vt, nargs); + if (error) { + regs->eax = error; + regs->efl |= EFL_CF; + thread_exception_return(); + /* NOTREACHED */ } if (__probable(code != 180)) { @@ -255,7 +248,7 @@ unix_syscall(x86_saved_state_t *state) * delay in order to mitigate the impact of this * task on the normal operation of the system */ - throttle_lowpri_io(TRUE); + throttle_lowpri_io(1); } if (__probable(code != 180)) KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE, @@ -326,6 +319,7 @@ unix_syscall64(x86_saved_state_t *state) uargp = (void *)(®s->rsi); args_in_regs = 5; } + uthread->uu_ap = uargp; if (callp->sy_narg != 0) { if (code != 180) { @@ -350,18 +344,10 @@ unix_syscall64(x86_saved_state_t *state) /* NOTREACHED */ } } - /* - * XXX Turn 64 bit unsafe calls into nosys() - */ - if (__improbable(callp->sy_flags & UNSAFE_64BIT)) { - callp = &sysent[63]; - goto unsafe; - } } else KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE, BSDDBG_CODE(DBG_BSD_EXCP_SC, code) | DBG_FUNC_START, 0, 0, 0, 0, 0); -unsafe: /* * Delayed binding of thread credential to process credential, if we @@ -455,7 +441,7 @@ unsafe: * delay in order to mitigate the impact of this * task on the normal operation of the system */ - throttle_lowpri_io(TRUE); + throttle_lowpri_io(1); } if (__probable(code != 180)) KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE, @@ -602,7 +588,7 @@ unix_syscall_return(int error) * delay in order to mitigate the impact of this * task on the normal operation of the system */ - throttle_lowpri_io(TRUE); + throttle_lowpri_io(1); } if (code != 180) KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE, @@ -613,46 +599,3 @@ unix_syscall_return(int error) /* NOTREACHED */ } -void -munge_wwwlww( - __unused const void *in32, - void *out64) -{ - uint32_t *arg32; - uint64_t *arg64; - - /* we convert in place in out64 */ - arg32 = (uint32_t *) out64; - arg64 = (uint64_t *) out64; - - arg64[5] = arg32[6]; /* wwwlwW */ - arg64[4] = arg32[5]; /* wwwlWw */ - arg32[7] = arg32[4]; /* wwwLww (hi) */ - arg32[6] = arg32[3]; /* wwwLww (lo) */ - arg64[2] = arg32[2]; /* wwWlww */ - arg64[1] = arg32[1]; /* wWwlww */ - arg64[0] = arg32[0]; /* Wwwlww */ -} - - -void -munge_wwlwww( - __unused const void *in32, - void *out64) -{ - uint32_t *arg32; - uint64_t *arg64; - - /* we convert in place in out64 */ - arg32 = (uint32_t *) out64; - arg64 = (uint64_t *) out64; - - arg64[5] = arg32[6]; /* wwlwwW */ - arg64[4] = arg32[5]; /* wwlwWw */ - arg64[3] = arg32[4]; /* wwlWww */ - arg32[5] = arg32[3]; /* wwLwww (hi) */ - arg32[4] = arg32[2]; /* wwLwww (lo) */ - arg64[1] = arg32[1]; /* wWlwww */ - arg64[0] = arg32[0]; /* Wwlwww */ -} -