Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/arm/trap-v6.c
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
#include <vm/vm_map.h> | #include <vm/vm_map.h> | ||||
#include <vm/vm_extern.h> | #include <vm/vm_extern.h> | ||||
#include <vm/vm_param.h> | #include <vm/vm_param.h> | ||||
#include <machine/acle-compat.h> | #include <machine/acle-compat.h> | ||||
#include <machine/cpu.h> | #include <machine/cpu.h> | ||||
#include <machine/frame.h> | #include <machine/frame.h> | ||||
#include <machine/machdep.h> | #include <machine/machdep.h> | ||||
#include <machine/param.h> | |||||
#include <machine/pcb.h> | #include <machine/pcb.h> | ||||
#ifdef KDB | #ifdef KDB | ||||
#include <sys/kdb.h> | #include <sys/kdb.h> | ||||
#include <machine/db_machdep.h> | #include <machine/db_machdep.h> | ||||
#endif | #endif | ||||
#ifdef KDTRACE_HOOKS | #ifdef KDTRACE_HOOKS | ||||
▲ Show 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | |||||
#ifdef KDB | #ifdef KDB | ||||
kdb_trap((prefetch) ? T_BREAKPOINT : T_WATCHPOINT, 0, tf); | kdb_trap((prefetch) ? T_BREAKPOINT : T_WATCHPOINT, 0, tf); | ||||
#else | #else | ||||
printf("No debugger in kernel.\n"); | printf("No debugger in kernel.\n"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
static int | |||||
is_inside_rescue_stack(void) | |||||
{ | |||||
int variable_on_stack; | |||||
/* | /* | ||||
* Check if we're inside a special stack. If yes, we've hit | |||||
* a guard page with the SP, i.e. the kernel thread had overflowed | |||||
* the allocated stack space. | |||||
*/ | |||||
if (((uint32_t)&variable_on_stack >= (uint32_t)&__aux_rescue_stack) && | |||||
((uint32_t)&variable_on_stack < ((uint32_t)&__aux_rescue_stack + | |||||
AUX_RESCUE_STACK_SIZE))) | |||||
return (1); | |||||
return (0); | |||||
} | |||||
/* | |||||
* Abort handler. | * Abort handler. | ||||
* | * | ||||
* FAR, FSR, and everything what can be lost after enabling | * FAR, FSR, and everything what can be lost after enabling | ||||
* interrupts must be grabbed before the interrupts will be | * interrupts must be grabbed before the interrupts will be | ||||
* enabled. Note that when interrupts will be enabled, we | * enabled. Note that when interrupts will be enabled, we | ||||
* could even migrate to another CPU ... | * could even migrate to another CPU ... | ||||
* | * | ||||
* TODO: move quick cases to ASM | * TODO: move quick cases to ASM | ||||
Show All 13 Lines | abort_handler(struct trapframe *tf, int prefetch) | ||||
vm_prot_t ftype; | vm_prot_t ftype; | ||||
bool usermode; | bool usermode; | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
void *onfault; | void *onfault; | ||||
#endif | #endif | ||||
PCPU_INC(cnt.v_trap); | PCPU_INC(cnt.v_trap); | ||||
td = curthread; | td = curthread; | ||||
if (is_inside_rescue_stack()) | |||||
panic("Kernel thread hit the guard page with the Stack Pointer"); | |||||
fsr = (prefetch) ? cp15_ifsr_get(): cp15_dfsr_get(); | fsr = (prefetch) ? cp15_ifsr_get(): cp15_dfsr_get(); | ||||
#if __ARM_ARCH >= 7 | #if __ARM_ARCH >= 7 | ||||
far = (prefetch) ? cp15_ifar_get() : cp15_dfar_get(); | far = (prefetch) ? cp15_ifar_get() : cp15_dfar_get(); | ||||
#else | #else | ||||
far = (prefetch) ? TRAPF_PC(tf) : cp15_dfar_get(); | far = (prefetch) ? TRAPF_PC(tf) : cp15_dfar_get(); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 344 Lines • Show Last 20 Lines |