Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/trap.c
Show First 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | #endif | ||||
* Special case for fuswintr and suswintr. These can't sleep so | * Special case for fuswintr and suswintr. These can't sleep so | ||||
* handle them early on in the trap handler. | * handle them early on in the trap handler. | ||||
*/ | */ | ||||
if (__predict_false(pcb->pcb_onfault == (vm_offset_t)&fsu_intr_fault)) { | if (__predict_false(pcb->pcb_onfault == (vm_offset_t)&fsu_intr_fault)) { | ||||
frame->tf_elr = pcb->pcb_onfault; | frame->tf_elr = pcb->pcb_onfault; | ||||
return; | return; | ||||
} | } | ||||
KASSERT(td->td_md.md_spinlock_count == 0, | |||||
("data abort with spinlock held")); | |||||
if (td->td_critnest != 0 || WITNESS_CHECK(WARN_SLEEPOK | | |||||
WARN_GIANTOK, NULL, "Kernel page fault") != 0) { | |||||
print_registers(frame); | |||||
printf(" far: %16lx\n", far); | |||||
printf(" esr: %.8lx\n", esr); | |||||
panic("data abort in critical section or under mutex"); | |||||
} | |||||
p = td->td_proc; | p = td->td_proc; | ||||
if (lower) | if (lower) | ||||
map = &p->p_vmspace->vm_map; | map = &p->p_vmspace->vm_map; | ||||
else { | else { | ||||
/* The top bit tells us which range to use */ | /* The top bit tells us which range to use */ | ||||
if ((far >> 63) == 1) | if ((far >> 63) == 1) | ||||
map = kernel_map; | map = kernel_map; | ||||
else | else | ||||
map = &p->p_vmspace->vm_map; | map = &p->p_vmspace->vm_map; | ||||
} | |||||
if (pmap_fault(map->pmap, esr, far) == KERN_SUCCESS) | |||||
return; | |||||
KASSERT(td->td_md.md_spinlock_count == 0, | |||||
("data abort with spinlock held")); | |||||
if (td->td_critnest != 0 || WITNESS_CHECK(WARN_SLEEPOK | | |||||
WARN_GIANTOK, NULL, "Kernel page fault") != 0) { | |||||
print_registers(frame); | |||||
printf(" far: %16lx\n", far); | |||||
printf(" esr: %.8lx\n", esr); | |||||
panic("data abort in critical section or under mutex"); | |||||
} | } | ||||
va = trunc_page(far); | va = trunc_page(far); | ||||
ftype = ((esr >> 6) & 1) ? VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ; | ftype = ((esr >> 6) & 1) ? VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ; | ||||
/* Fault in the page. */ | /* Fault in the page. */ | ||||
error = vm_fault(map, va, ftype, VM_FAULT_NORMAL); | error = vm_fault(map, va, ftype, VM_FAULT_NORMAL); | ||||
if (error != KERN_SUCCESS) { | if (error != KERN_SUCCESS) { | ||||
▲ Show 20 Lines • Show All 201 Lines • Show Last 20 Lines |