// IN VOID *MVA // X1\r
// );\r
ASM_FUNC(ArmUpdateTranslationTableEntry)\r
- dc civac, x0 // Clean and invalidate data line\r
- dsb sy\r
+ dsb nshst\r
+ lsr x1, x1, #12\r
EL1_OR_EL2_OR_EL3(x0)\r
1: tlbi vaae1, x1 // TLB Invalidate VA , EL1\r
b 4f\r
2: tlbi vae2, x1 // TLB Invalidate VA , EL2\r
b 4f\r
3: tlbi vae3, x1 // TLB Invalidate VA , EL3\r
-4: dsb sy\r
+4: dsb nsh\r
isb\r
ret\r
\r
VOID\r
ReplaceLiveEntry (\r
IN UINT64 *Entry,\r
- IN UINT64 Value\r
+ IN UINT64 Value,\r
+ IN UINT64 RegionStart\r
)\r
{\r
if (!ArmMmuEnabled ()) {\r
*Entry = Value;\r
} else {\r
- ArmReplaceLiveTranslationEntry (Entry, Value);\r
+ ArmReplaceLiveTranslationEntry (Entry, Value, RegionStart);\r
}\r
}\r
\r
\r
// Fill the BlockEntry with the new TranslationTable\r
ReplaceLiveEntry (BlockEntry,\r
- ((UINTN)TranslationTable & TT_ADDRESS_MASK_DESCRIPTION_TABLE) | TableAttributes | TT_TYPE_TABLE_ENTRY);\r
+ (UINTN)TranslationTable | TableAttributes | TT_TYPE_TABLE_ENTRY,\r
+ RegionStart);\r
}\r
} else {\r
if (IndexLevel != PageLevel) {\r
*BlockEntry &= BlockEntryMask;\r
*BlockEntry |= (RegionStart & TT_ADDRESS_MASK_BLOCK_ENTRY) | Attributes | Type;\r
\r
+ ArmUpdateTranslationTableEntry (BlockEntry, (VOID *)RegionStart);\r
+\r
// Go to the next BlockEntry\r
RegionStart += BlockEntrySize;\r
RegionLength -= BlockEntrySize;\r
return Status;\r
}\r
\r
- // Invalidate all TLB entries so changes are synced\r
- ArmInvalidateTlb ();\r
-\r
return EFI_SUCCESS;\r
}\r
\r
return Status;\r
}\r
\r
- // Invalidate all TLB entries so changes are synced\r
- ArmInvalidateTlb ();\r
-\r
return EFI_SUCCESS;\r
}\r
\r
dmb sy\r
dc ivac, x0\r
\r
- // flush the TLBs\r
+ // flush translations for the target address from the TLBs\r
+ lsr x2, x2, #12\r
.if \el == 1\r
- tlbi vmalle1\r
+ tlbi vaae1, x2\r
.else\r
- tlbi alle\el\r
+ tlbi vae\el, x2\r
.endif\r
- dsb sy\r
+ dsb nsh\r
\r
// re-enable the MMU\r
msr sctlr_el\el, x8\r
//VOID\r
//ArmReplaceLiveTranslationEntry (\r
// IN UINT64 *Entry,\r
-// IN UINT64 Value\r
+// IN UINT64 Value,\r
+// IN UINT64 Address\r
// )\r
ASM_FUNC(ArmReplaceLiveTranslationEntry)\r
\r
// disable interrupts\r
- mrs x2, daif\r
+ mrs x4, daif\r
msr daifset, #0xf\r
isb\r
\r
// clean and invalidate first so that we don't clobber\r
// adjacent entries that are dirty in the caches\r
dc civac, x0\r
- dsb ish\r
+ dsb nsh\r
\r
EL1_OR_EL2_OR_EL3(x3)\r
1:__replace_entry 1\r
b 4f\r
3:__replace_entry 3\r
\r
-4:msr daif, x2\r
+4:msr daif, x4\r
ret\r
\r
ASM_GLOBAL ASM_PFX(ArmReplaceLiveTranslationEntrySize)\r