MCPcopy Create free account
hub / github.com/F-Stack/f-stack / trap_fatal

Function trap_fatal

freebsd/i386/i386/trap.c:877–961  ·  view source on GitHub ↗
(frame, eva)

Source from the content-addressed store, hash-verified

875}
876
877static void
878trap_fatal(frame, eva)
879 struct trapframe *frame;
880 vm_offset_t eva;
881{
882 int code, ss, esp;
883 u_int type;
884 struct soft_segment_descriptor softseg;
885#ifdef KDB
886 bool handled;
887#endif
888
889 code = frame->tf_err;
890 type = frame->tf_trapno;
891 sdtossd(&gdt[IDXSEL(frame->tf_cs & 0xffff)].sd, &softseg);
892
893 printf("\n\nFatal trap %d: %s while in %s mode\n", type, trap_msg(type),
894 frame->tf_eflags & PSL_VM ? "vm86" :
895 ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel");
896#ifdef SMP
897 /* two separate prints in case of a trap on an unmapped page */
898 printf("cpuid = %d; ", PCPU_GET(cpuid));
899 printf("apic id = %02x\n", PCPU_GET(apic_id));
900#endif
901 if (type == T_PAGEFLT) {
902 printf("fault virtual address = 0x%x\n", eva);
903 printf("fault code = %s %s%s, %s\n",
904 code & PGEX_U ? "user" : "supervisor",
905 code & PGEX_W ? "write" : "read",
906 pg_nx != 0 ?
907 (code & PGEX_I ? " instruction" : " data") :
908 "",
909 code & PGEX_RSV ? "reserved bits in PTE" :
910 code & PGEX_P ? "protection violation" : "page not present");
911 } else {
912 printf("error code = %#x\n", code);
913 }
914 printf("instruction pointer = 0x%x:0x%x\n",
915 frame->tf_cs & 0xffff, frame->tf_eip);
916 if (TF_HAS_STACKREGS(frame)) {
917 ss = frame->tf_ss & 0xffff;
918 esp = frame->tf_esp;
919 } else {
920 ss = GSEL(GDATA_SEL, SEL_KPL);
921 esp = (int)&frame->tf_esp;
922 }
923 printf("stack pointer = 0x%x:0x%x\n", ss, esp);
924 printf("frame pointer = 0x%x:0x%x\n", ss, frame->tf_ebp);
925 printf("code segment = base 0x%x, limit 0x%x, type 0x%x\n",
926 softseg.ssd_base, softseg.ssd_limit, softseg.ssd_type);
927 printf(" = DPL %d, pres %d, def32 %d, gran %d\n",
928 softseg.ssd_dpl, softseg.ssd_p, softseg.ssd_def32,
929 softseg.ssd_gran);
930 printf("processor eflags = ");
931 if (frame->tf_eflags & PSL_T)
932 printf("trace trap, ");
933 if (frame->tf_eflags & PSL_I)
934 printf("interrupt enabled, ");

Callers 2

trapFunction · 0.70
trap_pfaultFunction · 0.70

Calls 5

trap_msgFunction · 0.85
kdb_trapFunction · 0.85
sdtossdFunction · 0.70
printfFunction · 0.50
panicFunction · 0.50

Tested by

no test coverage detected