summaryrefslogtreecommitdiffstats
path: root/bsps/aarch64/shared/mmu/vmsav8-64.c
diff options
context:
space:
mode:
Diffstat (limited to 'bsps/aarch64/shared/mmu/vmsav8-64.c')
-rw-r--r--bsps/aarch64/shared/mmu/vmsav8-64.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/bsps/aarch64/shared/mmu/vmsav8-64.c b/bsps/aarch64/shared/mmu/vmsav8-64.c
index 9caa91c414..c426dec900 100644
--- a/bsps/aarch64/shared/mmu/vmsav8-64.c
+++ b/bsps/aarch64/shared/mmu/vmsav8-64.c
@@ -47,14 +47,25 @@ rtems_status_code aarch64_mmu_map(
)
{
rtems_status_code sc;
+ ISR_Level level;
+ uint64_t max_mappable = 1LLU << aarch64_mmu_get_cpu_pa_bits();
+
+ if ( addr >= max_mappable || (addr + size) > max_mappable ) {
+ return RTEMS_INVALID_ADDRESS;
+ }
+
+ /*
+ * Disable interrupts so they don't run while the MMU tables are being
+ * modified.
+ */
+ _ISR_Local_disable( level );
- aarch64_mmu_disable();
sc = aarch64_mmu_map_block(
(uint64_t *) bsp_translation_table_base,
0x0,
addr,
size,
- 0,
+ -1,
flags
);
_AARCH64_Data_synchronization_barrier();
@@ -63,7 +74,8 @@ rtems_status_code aarch64_mmu_map(
);
_AARCH64_Data_synchronization_barrier();
_AARCH64_Instruction_synchronization_barrier();
- aarch64_mmu_enable();
+
+ _ISR_Local_enable( level );
return sc;
}