Changeset View
Changeset View
Standalone View
Standalone View
sys/i386/i386/trap.c
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | |||||
void trap(struct trapframe *frame); | void trap(struct trapframe *frame); | ||||
void syscall(struct trapframe *frame); | void syscall(struct trapframe *frame); | ||||
static int trap_pfault(struct trapframe *, int, vm_offset_t); | static int trap_pfault(struct trapframe *, int, vm_offset_t); | ||||
static void trap_fatal(struct trapframe *, vm_offset_t); | static void trap_fatal(struct trapframe *, vm_offset_t); | ||||
void dblfault_handler(void); | void dblfault_handler(void); | ||||
extern inthand_t IDTVEC(bpt), IDTVEC(dbg), IDTVEC(int0x80_syscall); | extern inthand_t IDTVEC(bpt), IDTVEC(dbg), IDTVEC(int0x80_syscall); | ||||
extern uint64_t pg_nx; | |||||
#define MAX_TRAP_MSG 32 | #define MAX_TRAP_MSG 32 | ||||
struct trap_data { | struct trap_data { | ||||
bool ei; | bool ei; | ||||
const char *msg; | const char *msg; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 736 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
/* | /* | ||||
* PGEX_I is defined only if the execute disable bit capability is | * PGEX_I is defined only if the execute disable bit capability is | ||||
* supported and enabled. | * supported and enabled. | ||||
*/ | */ | ||||
if (frame->tf_err & PGEX_W) | if (frame->tf_err & PGEX_W) | ||||
ftype = VM_PROT_WRITE; | ftype = VM_PROT_WRITE; | ||||
#if defined(PAE) || defined(PAE_TABLES) | |||||
else if ((frame->tf_err & PGEX_I) && pg_nx != 0) | else if ((frame->tf_err & PGEX_I) && pg_nx != 0) | ||||
ftype = VM_PROT_EXECUTE; | ftype = VM_PROT_EXECUTE; | ||||
#endif | |||||
else | else | ||||
ftype = VM_PROT_READ; | ftype = VM_PROT_READ; | ||||
/* Fault in the page. */ | /* Fault in the page. */ | ||||
rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); | rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); | ||||
if (rv == KERN_SUCCESS) { | if (rv == KERN_SUCCESS) { | ||||
#ifdef HWPMC_HOOKS | #ifdef HWPMC_HOOKS | ||||
if (ftype == VM_PROT_READ || ftype == VM_PROT_WRITE) { | if (ftype == VM_PROT_READ || ftype == VM_PROT_WRITE) { | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | #ifdef SMP | ||||
printf("cpuid = %d; ", PCPU_GET(cpuid)); | printf("cpuid = %d; ", PCPU_GET(cpuid)); | ||||
printf("apic id = %02x\n", PCPU_GET(apic_id)); | printf("apic id = %02x\n", PCPU_GET(apic_id)); | ||||
#endif | #endif | ||||
if (type == T_PAGEFLT) { | if (type == T_PAGEFLT) { | ||||
printf("fault virtual address = 0x%x\n", eva); | printf("fault virtual address = 0x%x\n", eva); | ||||
printf("fault code = %s %s%s, %s\n", | printf("fault code = %s %s%s, %s\n", | ||||
code & PGEX_U ? "user" : "supervisor", | code & PGEX_U ? "user" : "supervisor", | ||||
code & PGEX_W ? "write" : "read", | code & PGEX_W ? "write" : "read", | ||||
#if defined(PAE) || defined(PAE_TABLES) | |||||
pg_nx != 0 ? | pg_nx != 0 ? | ||||
(code & PGEX_I ? " instruction" : " data") : | (code & PGEX_I ? " instruction" : " data") : | ||||
#endif | |||||
"", | "", | ||||
code & PGEX_RSV ? "reserved bits in PTE" : | code & PGEX_RSV ? "reserved bits in PTE" : | ||||
code & PGEX_P ? "protection violation" : "page not present"); | code & PGEX_P ? "protection violation" : "page not present"); | ||||
} else { | } else { | ||||
printf("error code = %#x\n", code); | printf("error code = %#x\n", code); | ||||
} | } | ||||
printf("instruction pointer = 0x%x:0x%x\n", | printf("instruction pointer = 0x%x:0x%x\n", | ||||
frame->tf_cs & 0xffff, frame->tf_eip); | frame->tf_cs & 0xffff, frame->tf_eip); | ||||
▲ Show 20 Lines • Show All 217 Lines • Show Last 20 Lines |