#include <i386/trap.h>
#include <i386/pmap.h>
#include <i386/fpu.h>
-#include <architecture/i386/pio.h> /* inb() */
+#include <i386/misc_protos.h> /* panic_io_port_read() */
#include <mach/exception.h>
#include <mach/kern_return.h>
#include <i386/postcode.h>
#include <i386/mp_desc.h>
#include <i386/proc_reg.h>
+#include <i386/machine_check.h>
#include <mach/i386/syscall_sw.h>
/*
const char * trap_type[] = {TRAP_NAMES};
unsigned TRAP_TYPES = sizeof(trap_type)/sizeof(trap_type[0]);
-extern unsigned panic_io_port;
-
static inline void
reset_dr7(void)
{
uint32_t cr3 = get_cr3();
uint32_t cr4 = get_cr4();
- if (panic_io_port)
- (void)inb(panic_io_port);
+ panic_io_port_read();
kprintf("panic trap number 0x%x, eip 0x%x\n", regs->trapno, regs->eip);
kprintf("cr0 0x%08x cr2 0x%08x cr3 0x%08x cr4 0x%08x\n",
/* Issue an I/O port read if one has been requested - this is an event logic
* analyzers can use as a trigger point.
*/
- if (panic_io_port)
- (void)inb(panic_io_port);
+ panic_io_port_read();
/*
* Break kprintf lock in case of recursion,
* and record originally faulted instruction address.
*/
kprintf_break_lock();
+
+ /*
+ * Dump the contents of the machine check MSRs (if any).
+ */
+ mca_dump();
+
+ /*
+ * And that's all folks, we don't attempt recovery...
+ */
panic("Machine-check (CPU:%d, thread:%p, code:0x%x),"
"registers:\n"
"CR0: 0x%08x, CR2: 0x%08x, CR3: 0x%08x, CR4: 0x%08x\n"
"RSP: 0x%016qx, RBP: 0x%016qx, RSI: 0x%016qx, RDI: 0x%016qx\n"
"R8: 0x%016qx, R9: 0x%016qx, R10: 0x%016qx, R11: 0x%016qx\n"
"R12: 0x%016qx, R13: 0x%016qx, R14: 0x%016qx, R15: 0x%016qx\n"
- "RFL: 0x%016qx, RIP: 0x%016qx\n",
+ "RFL: 0x%016qx, RIP: 0x%016qx, CR2: 0x%016qx\n",
cpu_number(), current_thread(), ss64p->isf.trapno, ss64p->isf.err,
get_cr0(), get_cr2(), get_cr3(), get_cr4(),
ss64p->rax, ss64p->rbx, ss64p->rcx, ss64p->rdx,
ss64p->isf.rsp, ss64p->rbp, ss64p->rsi, ss64p->rdi,
ss64p->r8, ss64p->r9, ss64p->r10, ss64p->r11,
ss64p->r12, ss64p->r13, ss64p->r14, ss64p->r15,
- ss64p->isf.rflags, ss64p->isf.rip);
+ ss64p->isf.rflags, ss64p->isf.rip, ss64p->cr2);
} else {
x86_saved_state32_t *ss32p = saved_state32(esp);
panic("Double fault (CPU:%d, thread:%p, trapno:0x%x, err:0x%x),"
}
/*
- * Simplistic machine check handler.
- * We could peruse all those MSRs but we only dump register state as we do for
- * the double fault exception.
- * Note: the machine check registers are non-volatile across warm boot - so
- * they'll be around when we return.
+ * Machine check handler for 64-bit.
*/
void
panic_machine_check64(x86_saved_state_t *esp)
kprintf_break_lock();
/*
- * Dump the interrupt stack frame at last kernel entry.
+ * Dump the contents of the machine check MSRs (if any).
+ */
+ mca_dump();
+
+ /*
+ * And that's all folks, we don't attempt recovery...
*/
if (is_saved_state64(esp)) {
x86_saved_state64_t *ss64p = saved_state64(esp);