Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/trap.c
Show First 20 Lines • Show All 405 Lines • ▼ Show 20 Lines | for (reg = 0; reg < nitems(frame->tf_x); reg++) { | ||||
print_gp_register(name, frame->tf_x[reg]); | print_gp_register(name, frame->tf_x[reg]); | ||||
} | } | ||||
printf(" sp: %16lx\n", frame->tf_sp); | printf(" sp: %16lx\n", frame->tf_sp); | ||||
print_gp_register(" lr", frame->tf_lr); | print_gp_register(" lr", frame->tf_lr); | ||||
print_gp_register("elr", frame->tf_elr); | print_gp_register("elr", frame->tf_elr); | ||||
printf("spsr: %8x\n", frame->tf_spsr); | printf("spsr: %8x\n", frame->tf_spsr); | ||||
} | } | ||||
#ifdef VFP | |||||
static void | |||||
fpe_trap(struct thread *td, void *addr, uint32_t exception) | |||||
andrew: I'd drop the `do_` from this name. | |||||
{ | |||||
int code; | |||||
code = FPE_FLTIDO; | |||||
if ((exception & ISS_FP_TFV) != 0) { | |||||
Done Inline ActionsThis should be if ((exception & ISS_DATA_TFV) != 0) { (and similar below) andrew: This should be `if ((exception & ISS_DATA_TFV) != 0) {` (and similar below) | |||||
if ((exception & ISS_FP_IOF) != 0) | |||||
code = FPE_FLTINV; | |||||
else if ((exception & ISS_FP_DZF) != 0) | |||||
code = FPE_FLTDIV; | |||||
else if ((exception & ISS_FP_OFF) != 0) | |||||
code = FPE_FLTOVF; | |||||
else if ((exception & ISS_FP_UFF) != 0) | |||||
code = FPE_FLTUND; | |||||
else if ((exception & ISS_FP_IXF) != 0) | |||||
code = FPE_FLTRES; | |||||
} | |||||
call_trapsignal(td, SIGFPE, code, addr, exception); | |||||
} | |||||
#endif | |||||
void | void | ||||
do_el1h_sync(struct thread *td, struct trapframe *frame) | do_el1h_sync(struct thread *td, struct trapframe *frame) | ||||
{ | { | ||||
uint32_t exception; | uint32_t exception; | ||||
uint64_t esr, far; | uint64_t esr, far; | ||||
int dfsc; | int dfsc; | ||||
/* Read the esr register to get the exception details */ | /* Read the esr register to get the exception details */ | ||||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | do_el0_sync(struct thread *td, struct trapframe *frame) | ||||
intr_enable(); | intr_enable(); | ||||
CTR4(KTR_TRAP, | CTR4(KTR_TRAP, | ||||
"do_el0_sync: curthread: %p, esr %lx, elr: %lx, frame: %p", td, esr, | "do_el0_sync: curthread: %p, esr %lx, elr: %lx, frame: %p", td, esr, | ||||
frame->tf_elr, frame); | frame->tf_elr, frame); | ||||
switch (exception) { | switch (exception) { | ||||
case EXCP_FP_SIMD: | case EXCP_FP_SIMD: | ||||
case EXCP_TRAP_FP: | |||||
#ifdef VFP | #ifdef VFP | ||||
vfp_restore_state(); | vfp_restore_state(); | ||||
Done Inline ActionsDo we need to restore the VFP state? It should be enabled when this exception is raised. andrew: Do we need to restore the VFP state? It should be enabled when this exception is raised. | |||||
Done Inline Actionsyep, I should read Architecture Reference Manual before dchagin: yep, I should read Architecture Reference Manual before | |||||
#else | |||||
panic("VFP exception in userland"); | |||||
#endif | |||||
break; | |||||
case EXCP_TRAP_FP: | |||||
#ifdef VFP | |||||
fpe_trap(td, (void *)frame->tf_elr, esr); | |||||
userret(td, frame); | |||||
#else | #else | ||||
panic("VFP exception in userland"); | panic("VFP exception in userland"); | ||||
#endif | #endif | ||||
break; | break; | ||||
case EXCP_SVC32: | case EXCP_SVC32: | ||||
case EXCP_SVC64: | case EXCP_SVC64: | ||||
svc_handler(td, frame); | svc_handler(td, frame); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |
I'd drop the do_ from this name.