- thread_act_t thread;
- volatile int *rval;
- struct i386_saved_state *regs;
- struct proc *p;
- struct proc *current_proc();
- unsigned short code;
- vm_offset_t params;
- struct sysent *callp;
- extern int nsysent;
-
- thread = current_act();
- rval = (int *)get_bsduthreadrval(thread);
- p = current_proc();
-
- regs = USER_REGS(thread);
-
- /* reconstruct code for tracing before blasting eax */
- code = regs->eax;
- params = (vm_offset_t) ((caddr_t)regs->uesp + sizeof (int));
- callp = (code >= nsysent) ? &sysent[63] : &sysent[code];
- if (callp == sysent) {
- code = fuword(params);
+ int argc;
+ int call_number;
+ mach_call_t mach_call;
+ kern_return_t retval;
+ struct mach_call_args args = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ x86_saved_state32_t *regs;
+
+ struct uthread *ut = get_bsdthread_info(current_thread());
+ uthread_reset_proc_refcount(ut);
+
+ assert(is_saved_state32(state));
+ regs = saved_state32(state);
+
+ call_number = -(regs->eax);
+
+ DEBUG_KPRINT_SYSCALL_MACH(
+ "mach_call_munger: code=%d(%s)\n",
+ call_number, mach_syscall_name_table[call_number]);
+#if DEBUG_TRACE
+ kprintf("mach_call_munger(0x%08x) code=%d\n", regs, call_number);
+#endif
+
+ if (call_number < 0 || call_number >= mach_trap_count) {
+ i386_exception(EXC_SYSCALL, call_number, 1);
+ /* NOTREACHED */