2 * Copyright (C) 1994, David Greenman
3 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.
6 * This code is derived from software contributed to Berkeley by
7 * the University of Utah, and William Jolitz.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the University of
20 * California, Berkeley and its contributors.
21 * 4. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
40 #include <sys/cdefs.h>
41 __FBSDID("$FreeBSD$");
44 * AMD64 Trap and System call handling
47 #include "opt_clock.h"
49 #include "opt_hwpmc_hooks.h"
52 #include "opt_kdtrace.h"
54 #include <sys/param.h>
56 #include <sys/systm.h>
58 #include <sys/pioctl.h>
59 #include <sys/ptrace.h>
61 #include <sys/kernel.h>
64 #include <sys/mutex.h>
65 #include <sys/resourcevar.h>
66 #include <sys/signalvar.h>
67 #include <sys/syscall.h>
68 #include <sys/sysctl.h>
69 #include <sys/sysent.h>
71 #include <sys/vmmeter.h>
73 #include <sys/pmckern.h>
77 #include <vm/vm_param.h>
79 #include <vm/vm_kern.h>
80 #include <vm/vm_map.h>
81 #include <vm/vm_page.h>
82 #include <vm/vm_extern.h>
84 #include <machine/cpu.h>
85 #include <machine/intr_machdep.h>
87 #include <machine/md_var.h>
88 #include <machine/pcb.h>
90 #include <machine/smp.h>
92 #include <machine/tss.h>
95 #include <sys/dtrace_bsd.h>
98 * This is a hook which is initialised by the dtrace module
99 * to handle traps which might occur during DTrace probe
102 dtrace_trap_func_t dtrace_trap_func;
104 dtrace_doubletrap_func_t dtrace_doubletrap_func;
107 * This is a hook which is initialised by the systrace module
108 * when it is loaded. This keeps the DTrace syscall provider
109 * implementation opaque.
111 systrace_probe_func_t systrace_probe_func;
114 * These hooks are necessary for the pid, usdt and fasttrap providers.
116 dtrace_fasttrap_probe_ptr_t dtrace_fasttrap_probe_ptr;
117 dtrace_pid_probe_ptr_t dtrace_pid_probe_ptr;
118 dtrace_return_probe_ptr_t dtrace_return_probe_ptr;
121 extern void trap(struct trapframe *frame);
122 extern void syscall(struct trapframe *frame);
123 void dblfault_handler(struct trapframe *frame);
125 static int trap_pfault(struct trapframe *, int);
126 static void trap_fatal(struct trapframe *, vm_offset_t);
128 #define MAX_TRAP_MSG 30
129 static char *trap_msg[] = {
131 "privileged instruction fault", /* 1 T_PRIVINFLT */
133 "breakpoint instruction fault", /* 3 T_BPTFLT */
136 "arithmetic trap", /* 6 T_ARITHTRAP */
139 "general protection fault", /* 9 T_PROTFLT */
140 "trace trap", /* 10 T_TRCTRAP */
142 "page fault", /* 12 T_PAGEFLT */
144 "alignment fault", /* 14 T_ALIGNFLT */
148 "integer divide fault", /* 18 T_DIVIDE */
149 "non-maskable interrupt trap", /* 19 T_NMI */
150 "overflow trap", /* 20 T_OFLOW */
151 "FPU bounds check fault", /* 21 T_BOUND */
152 "FPU device not available", /* 22 T_DNA */
153 "double fault", /* 23 T_DOUBLEFLT */
154 "FPU operand fetch fault", /* 24 T_FPOPFLT */
155 "invalid TSS fault", /* 25 T_TSSFLT */
156 "segment not present fault", /* 26 T_SEGNPFLT */
157 "stack fault", /* 27 T_STKFLT */
158 "machine check trap", /* 28 T_MCHK */
159 "SIMD floating-point exception", /* 29 T_XMMFLT */
160 "reserved (unknown) fault", /* 30 T_RESERVED */
164 static int kdb_on_nmi = 1;
165 SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RW,
166 &kdb_on_nmi, 0, "Go to KDB on NMI");
167 TUNABLE_INT("machdep.kdb_on_nmi", &kdb_on_nmi);
169 static int panic_on_nmi = 1;
170 SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RW,
171 &panic_on_nmi, 0, "Panic on NMI");
172 TUNABLE_INT("machdep.panic_on_nmi", &panic_on_nmi);
173 static int prot_fault_translation = 0;
174 SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW,
175 &prot_fault_translation, 0, "Select signal to deliver on protection fault");
178 * Exception, fault, and trap interface to the FreeBSD kernel.
179 * This common code is called from assembly language IDT gate entry
180 * routines that prepare a suitable stack frame, and restore this
181 * frame after the exception has been processed.
185 trap(struct trapframe *frame)
187 struct thread *td = curthread;
188 struct proc *p = td->td_proc;
189 int i = 0, ucode = 0, code;
194 PCPU_INC(cnt.v_trap);
195 type = frame->tf_trapno;
198 /* Handler for NMI IPIs used for stopping CPUs. */
200 if (ipi_nmi_handler() == 0)
212 if (type == T_RESERVED) {
213 trap_fatal(frame, 0);
219 * CPU PMCs interrupt using an NMI. If the PMC module is
220 * active, pass the 'rip' value to the PMC module's interrupt
221 * handler. A return value of '1' from the handler means that
222 * the NMI was handled by it and we can return immediately.
224 if (type == T_NMI && pmc_intr &&
225 (*pmc_intr)(PCPU_GET(cpuid), frame))
229 if (type == T_MCHK) {
231 trap_fatal(frame, 0);
237 * A trap can occur while DTrace executes a probe. Before
238 * executing the probe, DTrace blocks re-scheduling and sets
239 * a flag in it's per-cpu flags to indicate that it doesn't
240 * want to fault. On returning from the probe, the no-fault
241 * flag is cleared and finally re-scheduling is enabled.
243 * If the DTrace kernel module has registered a trap handler,
244 * call it and if it returns non-zero, assume that it has
245 * handled the trap and modified the trap frame so that this
246 * function can return normally.
248 if (dtrace_trap_func != NULL)
249 if ((*dtrace_trap_func)(frame, type))
251 if (type == T_DTRACE_PROBE || type == T_DTRACE_RET ||
255 fill_frame_regs(frame, ®s);
256 if (type == T_DTRACE_PROBE &&
257 dtrace_fasttrap_probe_ptr != NULL &&
258 dtrace_fasttrap_probe_ptr(®s) == 0)
260 if (type == T_BPTFLT &&
261 dtrace_pid_probe_ptr != NULL &&
262 dtrace_pid_probe_ptr(®s) == 0)
264 if (type == T_DTRACE_RET &&
265 dtrace_return_probe_ptr != NULL &&
266 dtrace_return_probe_ptr(®s) == 0)
272 if ((frame->tf_rflags & PSL_I) == 0) {
274 * Buggy application or kernel code has disabled
275 * interrupts and then trapped. Enabling interrupts
276 * now is wrong, but it is better than running with
277 * interrupts disabled until they are accidentally
280 if (ISPL(frame->tf_cs) == SEL_UPL)
282 "pid %ld (%s): trap %d with interrupts disabled\n",
283 (long)curproc->p_pid, curthread->td_name, type);
284 else if (type != T_NMI && type != T_BPTFLT &&
287 * XXX not quite right, since this may be for a
288 * multiple fault in user mode.
290 printf("kernel trap %d with interrupts disabled\n",
294 * We shouldn't enable interrupts while holding a
297 if (td->td_md.md_spinlock_count == 0)
302 code = frame->tf_err;
303 if (type == T_PAGEFLT) {
305 * If we get a page fault while in a critical section, then
306 * it is most likely a fatal kernel page fault. The kernel
307 * is already going to panic trying to get a sleep lock to
308 * do the VM lookup, so just consider it a fatal trap so the
309 * kernel can print out a useful trap message and even get
312 * If we get a page fault while holding a non-sleepable
313 * lock, then it is most likely a fatal kernel page fault.
314 * If WITNESS is enabled, then it's going to whine about
315 * bogus LORs with various VM locks, so just skip to the
316 * fatal trap handling directly.
318 if (td->td_critnest != 0 ||
319 WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK, NULL,
320 "Kernel page fault") != 0)
321 trap_fatal(frame, frame->tf_addr);
324 if (ISPL(frame->tf_cs) == SEL_UPL) {
328 td->td_frame = frame;
329 addr = frame->tf_rip;
330 if (td->td_ucred != p->p_ucred)
331 cred_update_thread(td);
334 case T_PRIVINFLT: /* privileged instruction fault */
339 case T_BPTFLT: /* bpt instruction fault */
340 case T_TRCTRAP: /* trace trap */
342 frame->tf_rflags &= ~PSL_T;
344 ucode = (type == T_TRCTRAP ? TRAP_TRACE : TRAP_BRKPT);
347 case T_ARITHTRAP: /* arithmetic trap */
354 case T_PROTFLT: /* general protection fault */
358 case T_STKFLT: /* stack fault */
359 case T_SEGNPFLT: /* segment not present fault */
363 case T_TSSFLT: /* invalid TSS fault */
367 case T_DOUBLEFLT: /* double fault */
373 case T_PAGEFLT: /* page fault */
374 addr = frame->tf_addr;
375 i = trap_pfault(frame, TRUE);
384 if (prot_fault_translation == 0) {
387 * This check also covers the images
388 * without the ABI-tag ELF note.
390 if (SV_CURPROC_ABI() == SV_ABI_FREEBSD
391 && p->p_osrel >= P_OSREL_SIGSEGV) {
396 ucode = BUS_PAGE_FAULT;
398 } else if (prot_fault_translation == 1) {
400 * Always compat mode.
403 ucode = BUS_PAGE_FAULT;
406 * Always SIGSEGV mode.
414 case T_DIVIDE: /* integer divide fault */
421 /* machine/parity/power fail/"kitchen sink" faults */
422 if (isa_nmi(code) == 0) {
425 * NMI can be hooked up to a pushbutton
429 printf ("NMI ... going to debugger\n");
430 kdb_trap(type, 0, frame);
434 } else if (panic_on_nmi)
435 panic("NMI indicates hardware failure");
439 case T_OFLOW: /* integer overflow fault */
444 case T_BOUND: /* bounds check fault */
450 /* transparent fault (due to context switch "late") */
451 KASSERT(PCB_USER_FPU(td->td_pcb),
452 ("kernel FPU ctx has leaked"));
456 case T_FPOPFLT: /* FPU operand fetch fault */
461 case T_XMMFLT: /* SIMD floating-point exception */
469 KASSERT(cold || td->td_ucred != NULL,
470 ("kernel trap doesn't have ucred"));
472 case T_PAGEFLT: /* page fault */
473 (void) trap_pfault(frame, FALSE);
477 KASSERT(!PCB_USER_FPU(td->td_pcb),
478 ("Unregistered use of FPU in kernel"));
482 case T_ARITHTRAP: /* arithmetic trap */
483 case T_XMMFLT: /* SIMD floating-point exception */
484 case T_FPOPFLT: /* FPU operand fetch fault */
486 * XXXKIB for now disable any FPU traps in kernel
487 * handler registration seems to be overkill
489 trap_fatal(frame, 0);
492 case T_STKFLT: /* stack fault */
495 case T_PROTFLT: /* general protection fault */
496 case T_SEGNPFLT: /* segment not present fault */
497 if (td->td_intr_nesting_level != 0)
501 * Invalid segment selectors and out of bounds
502 * %rip's and %rsp's can be set up in user mode.
503 * This causes a fault in kernel mode when the
504 * kernel tries to return to user mode. We want
505 * to get this fault so that we can fix the
506 * problem here and not have to check all the
507 * selectors and pointers when the user changes
510 if (frame->tf_rip == (long)doreti_iret) {
511 frame->tf_rip = (long)doreti_iret_fault;
514 if (frame->tf_rip == (long)ld_ds) {
515 frame->tf_rip = (long)ds_load_fault;
518 if (frame->tf_rip == (long)ld_es) {
519 frame->tf_rip = (long)es_load_fault;
522 if (frame->tf_rip == (long)ld_fs) {
523 frame->tf_rip = (long)fs_load_fault;
526 if (frame->tf_rip == (long)ld_gs) {
527 frame->tf_rip = (long)gs_load_fault;
530 if (frame->tf_rip == (long)ld_gsbase) {
531 frame->tf_rip = (long)gsbase_load_fault;
534 if (frame->tf_rip == (long)ld_fsbase) {
535 frame->tf_rip = (long)fsbase_load_fault;
538 if (PCPU_GET(curpcb)->pcb_onfault != NULL) {
540 (long)PCPU_GET(curpcb)->pcb_onfault;
547 * PSL_NT can be set in user mode and isn't cleared
548 * automatically when the kernel is entered. This
549 * causes a TSS fault when the kernel attempts to
550 * `iret' because the TSS link is uninitialized. We
551 * want to get this fault so that we can fix the
552 * problem here and not every time the kernel is
555 if (frame->tf_rflags & PSL_NT) {
556 frame->tf_rflags &= ~PSL_NT;
561 case T_TRCTRAP: /* trace trap */
563 * Ignore debug register trace traps due to
564 * accesses in the user's address space, which
565 * can happen under several conditions such as
566 * if a user sets a watchpoint on a buffer and
567 * then passes that buffer to a system call.
568 * We still want to get TRCTRAPS for addresses
569 * in kernel space because that is useful when
570 * debugging the kernel.
572 if (user_dbreg_trap()) {
574 * Reset breakpoint bits because the
577 /* XXX check upper bits here */
578 load_dr6(rdr6() & 0xfffffff0);
582 * FALLTHROUGH (TRCTRAP kernel mode, kernel address)
586 * If KDB is enabled, let it handle the debugger trap.
587 * Otherwise, debugger traps "can't happen".
590 if (kdb_trap(type, 0, frame))
597 /* machine/parity/power fail/"kitchen sink" faults */
598 if (isa_nmi(code) == 0) {
601 * NMI can be hooked up to a pushbutton
605 printf ("NMI ... going to debugger\n");
606 kdb_trap(type, 0, frame);
610 } else if (panic_on_nmi == 0)
616 trap_fatal(frame, 0);
620 /* Translate fault for emulators (e.g. Linux) */
621 if (*p->p_sysent->sv_transtrap)
622 i = (*p->p_sysent->sv_transtrap)(i, type);
624 ksiginfo_init_trap(&ksi);
626 ksi.ksi_code = ucode;
627 ksi.ksi_trapno = type;
628 ksi.ksi_addr = (void *)addr;
629 trapsignal(td, &ksi);
633 mtx_assert(&Giant, MA_NOTOWNED);
634 KASSERT(PCB_USER_FPU(td->td_pcb),
635 ("Return from trap with kernel FPU ctx leaked"));
642 trap_pfault(frame, usermode)
643 struct trapframe *frame;
647 struct vmspace *vm = NULL;
651 struct thread *td = curthread;
652 struct proc *p = td->td_proc;
653 vm_offset_t eva = frame->tf_addr;
655 va = trunc_page(eva);
656 if (va >= VM_MIN_KERNEL_ADDRESS) {
658 * Don't allow user-mode faults in kernel address space.
666 * This is a fault on non-kernel virtual memory.
667 * vm is initialized above to NULL. If curproc is NULL
668 * or curproc->p_vmspace is NULL the fault is fatal.
679 * When accessing a usermode address, kernel must be
680 * ready to accept the page fault, and provide a
681 * handling routine. Since accessing the address
682 * without the handler is a bug, do not try to handle
683 * it normally, and panic immediately.
685 if (!usermode && (td->td_intr_nesting_level != 0 ||
686 PCPU_GET(curpcb)->pcb_onfault == NULL)) {
687 trap_fatal(frame, eva);
693 * PGEX_I is defined only if the execute disable bit capability is
694 * supported and enabled.
696 if (frame->tf_err & PGEX_W)
697 ftype = VM_PROT_WRITE;
698 else if ((frame->tf_err & PGEX_I) && pg_nx != 0)
699 ftype = VM_PROT_EXECUTE;
701 ftype = VM_PROT_READ;
703 if (map != kernel_map) {
705 * Keep swapout from messing with us during this
712 /* Fault in the user page: */
713 rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL);
720 * Don't have to worry about process locking or stacks in the
723 rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL);
725 if (rv == KERN_SUCCESS)
729 if (td->td_intr_nesting_level == 0 &&
730 PCPU_GET(curpcb)->pcb_onfault != NULL) {
731 frame->tf_rip = (long)PCPU_GET(curpcb)->pcb_onfault;
734 trap_fatal(frame, eva);
738 return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
742 trap_fatal(frame, eva)
743 struct trapframe *frame;
749 struct soft_segment_descriptor softseg;
752 code = frame->tf_err;
753 type = frame->tf_trapno;
754 sdtossd(&gdt[NGDT * PCPU_GET(cpuid) + IDXSEL(frame->tf_cs & 0xffff)],
757 if (type <= MAX_TRAP_MSG)
758 msg = trap_msg[type];
761 printf("\n\nFatal trap %d: %s while in %s mode\n", type, msg,
762 ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel");
764 /* two separate prints in case of a trap on an unmapped page */
765 printf("cpuid = %d; ", PCPU_GET(cpuid));
766 printf("apic id = %02x\n", PCPU_GET(apic_id));
768 if (type == T_PAGEFLT) {
769 printf("fault virtual address = 0x%lx\n", eva);
770 printf("fault code = %s %s %s, %s\n",
771 code & PGEX_U ? "user" : "supervisor",
772 code & PGEX_W ? "write" : "read",
773 code & PGEX_I ? "instruction" : "data",
774 code & PGEX_P ? "protection violation" : "page not present");
776 printf("instruction pointer = 0x%lx:0x%lx\n",
777 frame->tf_cs & 0xffff, frame->tf_rip);
778 if (ISPL(frame->tf_cs) == SEL_UPL) {
779 ss = frame->tf_ss & 0xffff;
782 ss = GSEL(GDATA_SEL, SEL_KPL);
783 esp = (long)&frame->tf_rsp;
785 printf("stack pointer = 0x%x:0x%lx\n", ss, esp);
786 printf("frame pointer = 0x%x:0x%lx\n", ss, frame->tf_rbp);
787 printf("code segment = base 0x%lx, limit 0x%lx, type 0x%x\n",
788 softseg.ssd_base, softseg.ssd_limit, softseg.ssd_type);
789 printf(" = DPL %d, pres %d, long %d, def32 %d, gran %d\n",
790 softseg.ssd_dpl, softseg.ssd_p, softseg.ssd_long, softseg.ssd_def32,
792 printf("processor eflags = ");
793 if (frame->tf_rflags & PSL_T)
794 printf("trace trap, ");
795 if (frame->tf_rflags & PSL_I)
796 printf("interrupt enabled, ");
797 if (frame->tf_rflags & PSL_NT)
798 printf("nested task, ");
799 if (frame->tf_rflags & PSL_RF)
801 printf("IOPL = %ld\n", (frame->tf_rflags & PSL_IOPL) >> 12);
802 printf("current process = ");
805 (u_long)curproc->p_pid, curthread->td_name ?
806 curthread->td_name : "");
812 if (debugger_on_panic || kdb_active)
813 if (kdb_trap(type, 0, frame))
816 printf("trap number = %d\n", type);
817 if (type <= MAX_TRAP_MSG)
818 panic("%s", trap_msg[type]);
820 panic("unknown/reserved trap");
824 * Double fault handler. Called when a fault occurs while writing
825 * a frame for a trap/exception onto the stack. This usually occurs
826 * when the stack overflows (such is the case with infinite recursion,
830 dblfault_handler(struct trapframe *frame)
833 if (dtrace_doubletrap_func != NULL)
834 (*dtrace_doubletrap_func)();
836 printf("\nFatal double fault\n");
837 printf("rip = 0x%lx\n", frame->tf_rip);
838 printf("rsp = 0x%lx\n", frame->tf_rsp);
839 printf("rbp = 0x%lx\n", frame->tf_rbp);
841 /* two separate prints in case of a trap on an unmapped page */
842 printf("cpuid = %d; ", PCPU_GET(cpuid));
843 printf("apic id = %02x\n", PCPU_GET(apic_id));
845 panic("double fault");
849 cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
852 struct trapframe *frame;
855 int reg, regcnt, error;
858 frame = td->td_frame;
862 params = (caddr_t)frame->tf_rsp + sizeof(register_t);
863 sa->code = frame->tf_rax;
865 if (sa->code == SYS_syscall || sa->code == SYS___syscall) {
866 sa->code = frame->tf_rdi;
870 if (p->p_sysent->sv_mask)
871 sa->code &= p->p_sysent->sv_mask;
873 if (sa->code >= p->p_sysent->sv_size)
874 sa->callp = &p->p_sysent->sv_table[0];
876 sa->callp = &p->p_sysent->sv_table[sa->code];
878 sa->narg = sa->callp->sy_narg;
879 KASSERT(sa->narg <= sizeof(sa->args) / sizeof(sa->args[0]),
880 ("Too many syscall arguments!"));
882 argp = &frame->tf_rdi;
884 bcopy(argp, sa->args, sizeof(sa->args[0]) * regcnt);
885 if (sa->narg > regcnt) {
886 KASSERT(params != NULL, ("copyin args with no params!"));
887 error = copyin(params, &sa->args[regcnt],
888 (sa->narg - regcnt) * sizeof(sa->args[0]));
892 td->td_retval[0] = 0;
893 td->td_retval[1] = frame->tf_rdx;
899 #include "../../kern/subr_syscall.c"
902 * syscall - system call request C handler
904 * A system call is essentially treated as a trap.
907 amd64_syscall(struct thread *td, int traced)
909 struct syscall_args sa;
914 if (ISPL(td->td_frame->tf_cs) != SEL_UPL) {
919 error = syscallenter(td, &sa);
924 if (__predict_false(traced)) {
925 td->td_frame->tf_rflags &= ~PSL_T;
926 ksiginfo_init_trap(&ksi);
927 ksi.ksi_signo = SIGTRAP;
928 ksi.ksi_code = TRAP_TRACE;
929 ksi.ksi_addr = (void *)td->td_frame->tf_rip;
930 trapsignal(td, &ksi);
933 KASSERT(PCB_USER_FPU(td->td_pcb),
934 ("System call %s returing with kernel FPU ctx leaked",
935 syscallname(td->td_proc, sa.code)));
936 KASSERT(td->td_pcb->pcb_save == &td->td_pcb->pcb_user_save,
937 ("System call %s returning with mangled pcb_save",
938 syscallname(td->td_proc, sa.code)));
940 syscallret(td, error, &sa);