| 843 | } |
| 844 | |
| 845 | static void |
| 846 | trap_fatal(frame, eva) |
| 847 | struct trapframe *frame; |
| 848 | vm_offset_t eva; |
| 849 | { |
| 850 | int code, ss; |
| 851 | u_int type; |
| 852 | struct soft_segment_descriptor softseg; |
| 853 | struct user_segment_descriptor *gdt; |
| 854 | #ifdef KDB |
| 855 | bool handled; |
| 856 | #endif |
| 857 | |
| 858 | code = frame->tf_err; |
| 859 | type = frame->tf_trapno; |
| 860 | gdt = *PCPU_PTR(gdt); |
| 861 | sdtossd(&gdt[IDXSEL(frame->tf_cs & 0xffff)], &softseg); |
| 862 | |
| 863 | printf("\n\nFatal trap %d: %s while in %s mode\n", type, |
| 864 | type < nitems(trap_msg) ? trap_msg[type] : UNKNOWN, |
| 865 | TRAPF_USERMODE(frame) ? "user" : "kernel"); |
| 866 | #ifdef SMP |
| 867 | /* two separate prints in case of a trap on an unmapped page */ |
| 868 | printf("cpuid = %d; ", PCPU_GET(cpuid)); |
| 869 | printf("apic id = %02x\n", PCPU_GET(apic_id)); |
| 870 | #endif |
| 871 | if (type == T_PAGEFLT) { |
| 872 | printf("fault virtual address = 0x%lx\n", eva); |
| 873 | printf("fault code = %s %s %s%s%s, %s\n", |
| 874 | code & PGEX_U ? "user" : "supervisor", |
| 875 | code & PGEX_W ? "write" : "read", |
| 876 | code & PGEX_I ? "instruction" : "data", |
| 877 | code & PGEX_PK ? " prot key" : "", |
| 878 | code & PGEX_SGX ? " SGX" : "", |
| 879 | code & PGEX_RSV ? "reserved bits in PTE" : |
| 880 | code & PGEX_P ? "protection violation" : "page not present"); |
| 881 | } |
| 882 | printf("instruction pointer = 0x%lx:0x%lx\n", |
| 883 | frame->tf_cs & 0xffff, frame->tf_rip); |
| 884 | ss = frame->tf_ss & 0xffff; |
| 885 | printf("stack pointer = 0x%x:0x%lx\n", ss, frame->tf_rsp); |
| 886 | printf("frame pointer = 0x%x:0x%lx\n", ss, frame->tf_rbp); |
| 887 | printf("code segment = base 0x%lx, limit 0x%lx, type 0x%x\n", |
| 888 | softseg.ssd_base, softseg.ssd_limit, softseg.ssd_type); |
| 889 | printf(" = DPL %d, pres %d, long %d, def32 %d, gran %d\n", |
| 890 | softseg.ssd_dpl, softseg.ssd_p, softseg.ssd_long, softseg.ssd_def32, |
| 891 | softseg.ssd_gran); |
| 892 | printf("processor eflags = "); |
| 893 | if (frame->tf_rflags & PSL_T) |
| 894 | printf("trace trap, "); |
| 895 | if (frame->tf_rflags & PSL_I) |
| 896 | printf("interrupt enabled, "); |
| 897 | if (frame->tf_rflags & PSL_NT) |
| 898 | printf("nested task, "); |
| 899 | if (frame->tf_rflags & PSL_RF) |
| 900 | printf("resume, "); |
| 901 | printf("IOPL = %ld\n", (frame->tf_rflags & PSL_IOPL) >> 12); |
| 902 | printf("current process = %d (%s)\n", |