Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/pmap.c
Show First 20 Lines • Show All 5,758 Lines • ▼ Show 20 Lines | while (sz != 0) { | ||||
sz -= len; | sz -= len; | ||||
va += len; | va += len; | ||||
/* Set the length for the next iteration */ | /* Set the length for the next iteration */ | ||||
len = imin(PAGE_SIZE, sz); | len = imin(PAGE_SIZE, sz); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
static uint64_t | |||||
pmap_fault_translate(pmap_t pmap, uint64_t far) | |||||
{ | |||||
register_t intr; | |||||
uint64_t par; | |||||
/* Ask the MMU to check the address */ | |||||
intr = intr_disable(); | |||||
if (pmap == kernel_pmap) | |||||
par = arm64_address_translate_s1e1r(far); | |||||
else | |||||
par = arm64_address_translate_s1e0r(far); | |||||
intr_restore(intr); | |||||
return (par); | |||||
} | |||||
int | int | ||||
pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) | pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) | ||||
{ | { | ||||
pt_entry_t pte, *ptep; | pt_entry_t pte, *ptep; | ||||
register_t intr; | |||||
uint64_t ec, par; | uint64_t ec, par; | ||||
int lvl, rv; | int lvl, rv; | ||||
rv = KERN_FAILURE; | rv = KERN_FAILURE; | ||||
ec = ESR_ELx_EXCEPTION(esr); | ec = ESR_ELx_EXCEPTION(esr); | ||||
switch (ec) { | switch (ec) { | ||||
case EXCP_INSN_ABORT_L: | case EXCP_INSN_ABORT_L: | ||||
Show All 39 Lines | if (ptep != NULL && | ||||
rv = KERN_SUCCESS; | rv = KERN_SUCCESS; | ||||
} | } | ||||
PMAP_UNLOCK(pmap); | PMAP_UNLOCK(pmap); | ||||
break; | break; | ||||
case ISS_DATA_DFSC_TF_L0: | case ISS_DATA_DFSC_TF_L0: | ||||
case ISS_DATA_DFSC_TF_L1: | case ISS_DATA_DFSC_TF_L1: | ||||
case ISS_DATA_DFSC_TF_L2: | case ISS_DATA_DFSC_TF_L2: | ||||
case ISS_DATA_DFSC_TF_L3: | case ISS_DATA_DFSC_TF_L3: | ||||
PMAP_LOCK(pmap); | |||||
/* Ask the MMU to check the address */ | |||||
intr = intr_disable(); | |||||
if (pmap == kernel_pmap) | |||||
par = arm64_address_translate_s1e1r(far); | |||||
else | |||||
par = arm64_address_translate_s1e0r(far); | |||||
intr_restore(intr); | |||||
PMAP_UNLOCK(pmap); | |||||
/* | /* | ||||
* If the translation was successful the address was invalid | * If the translation was successful the address was invalid | ||||
* due to a break-before-make sequence. We can unlock and | * due to a break-before-make sequence. Try first unlocked | ||||
* return success to the trap handler. | * as the operatin is only a few instructions long and will | ||||
markj: Typo: "operation". | |||||
* have interrupts disabled to stop it being interrupted. | |||||
*/ | */ | ||||
par = pmap_fault_translate(pmap, far); | |||||
if (PAR_SUCCESS(par)) { | |||||
rv = KERN_SUCCESS; | |||||
break; | |||||
} | |||||
/* | |||||
* The translation failed, try afain with the pmap lock to | |||||
markjUnsubmitted Not Done Inline ActionsTypo, "again". markj: Typo, "again". | |||||
* ensure all page table updates have completed. | |||||
*/ | |||||
PMAP_LOCK(pmap); | |||||
par = pmap_fault_translate(pmap, far); | |||||
PMAP_UNLOCK(pmap); | |||||
if (PAR_SUCCESS(par)) | if (PAR_SUCCESS(par)) | ||||
rv = KERN_SUCCESS; | rv = KERN_SUCCESS; | ||||
break; | break; | ||||
} | } | ||||
return (rv); | return (rv); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |
Typo: "operation".