X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/b0d623f7f2ae71ed96e60569f61f9a9a27016e80..bd504ef0e0b883cdd7917b73b3574eb9ce669905:/osfmk/i386/startup64.c diff --git a/osfmk/i386/startup64.c b/osfmk/i386/startup64.c index c85bf1955..b4f69f741 100644 --- a/osfmk/i386/startup64.c +++ b/osfmk/i386/startup64.c @@ -188,6 +188,7 @@ cpu_IA32e_disable(cpu_data_t *cdp) #endif #if DEBUG +extern void dump_regs64(void); extern void dump_gdt(void *); extern void dump_ldt(void *); extern void dump_idt(void *); @@ -264,11 +265,7 @@ dump_frame64(x86_saved_state64_t *sp) kprintf("%p: 0x%016llx\n", ip, *ip); kprintf("sp->isf.trapno: 0x%08x\n", sp->isf.trapno); -#ifdef __i386__ - kprintf("sp->isf.trapfn: 0x%08x\n", sp->isf.trapfn); -#else kprintf("sp->isf.trapfn: 0x%016llx\n", sp->isf.trapfn); -#endif kprintf("sp->isf.err: 0x%016llx\n", sp->isf.err); kprintf("sp->isf.rip: 0x%016llx\n", sp->isf.rip); kprintf("sp->isf.cs: 0x%016llx\n", sp->isf.cs); @@ -353,4 +350,49 @@ dump_tss(void *tssp) kprintf("%p: 0x%08x\n", ip+0, *(ip+0)); } } + +#if defined(__x86_64__) +void dump_regs64(void) +{ + +#define SNAP_REG(reg) \ + uint64_t reg; \ + __asm__ volatile("mov %%" #reg ", %0" : "=m" (reg)) + +#define KPRINT_REG(reg) \ + kprintf("%3s: %p\n", #reg, (void *) reg) + + SNAP_REG(rsp); + SNAP_REG(rbp); + SNAP_REG(rax); + SNAP_REG(rbx); + SNAP_REG(rcx); + SNAP_REG(rdx); + SNAP_REG(rsi); + SNAP_REG(rdi); + SNAP_REG(r8); + SNAP_REG(r9); + SNAP_REG(r10); + SNAP_REG(r11); + SNAP_REG(r12); + SNAP_REG(r13); + SNAP_REG(r14); + + KPRINT_REG(rsp); + KPRINT_REG(rbp); + KPRINT_REG(rax); + KPRINT_REG(rbx); + KPRINT_REG(rcx); + KPRINT_REG(rdx); + KPRINT_REG(rsi); + KPRINT_REG(rdi); + KPRINT_REG(r8); + KPRINT_REG(r9); + KPRINT_REG(r10); + KPRINT_REG(r11); + KPRINT_REG(r12); + KPRINT_REG(r13); + KPRINT_REG(r14); +} +#endif /* __x86_64__ */ #endif /* DEBUG */