+ #include <sys/ksyms.h>
+
/*
* Called after returning from a kernel preemption, and called with
* preemption disabled.
*************** cpu_kpreempt_exit(uintptr_t where)
*** 303,308 ****
--- 305,328 ----
pmap_load();
}
+ {
+ int curldt;
+
+ __asm__ __volatile__("sldt %0" : "=r" (curldt) : );
+ if (curldt != curlwp->l_addr->u_pcb.pcb_ldt_sel) {
+ const char *mod, *sym;
+
+ if (ksyms_getname(&mod, &sym, where, KSYMS_ANY) != 0) {
+ mod = "<x>";
+ sym = "<x>";
+ }
+
+ printf("oink! %x != %x! where = %p (%s:%s)\n", curldt, curlwp->l_addr->u_pcb.pcb_ldt_sel, (void *)where, mod, sym);
+ //Debugger();
+ pmap_load();
+ }
+ }
+
/* Restore cr2 only after the pmap, as pmap_load can block. */
lcr2(((struct pcb *)curlwp->l_addr)->pcb_cr2);
}