aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demo_functionality.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/demo_functionality.c b/demo_functionality.c
index 7bba6a6..eddb1d2 100644
--- a/demo_functionality.c
+++ b/demo_functionality.c
@@ -65,25 +65,31 @@ void demo_go_unprivileged(void)
short_section_descriptor_t *translation_table =
(short_section_descriptor_t*) TRANSLATION_TABLE_BASE;
- volatile short_section_descriptor_t *PL0_section =
+ short_section_descriptor_t volatile *PL0_section_entry =
&translation_table[PL0_SECTION_NUMBER];
- volatile short_section_descriptor_t *UART_memory_section =
+ short_section_descriptor_t volatile *UART_memory_section_entry =
&translation_table[((uint32_t) GPIO_BASE) >> 20];
- PL0_section->SECTION_BASE_ADDRESS_31_20 =
+ short_section_descriptor_t
+ PL0_section = *PL0_section_entry,
+ UART_memory_section = *UART_memory_section_entry;
+
+ PL0_section.SECTION_BASE_ADDRESS_31_20 =
UNPRIVILEGED_MEMORY_START >> 20;
// make the selected section and uart section available for PL0
- PL0_section->ACCESS_PERMISSIONS_2 =
+ PL0_section.ACCESS_PERMISSIONS_2 =
AP_2_0_MODEL_RW_ALL >> 2;
- PL0_section->ACCESS_PERMISSIONS_1_0 =
+ PL0_section.ACCESS_PERMISSIONS_1_0 =
AP_2_0_MODEL_RW_ALL & 0b011;
- UART_memory_section->ACCESS_PERMISSIONS_2 =
+ UART_memory_section.ACCESS_PERMISSIONS_2 =
AP_2_0_MODEL_RW_ALL >> 2;
- UART_memory_section->ACCESS_PERMISSIONS_1_0 =
+ UART_memory_section.ACCESS_PERMISSIONS_1_0 =
AP_2_0_MODEL_RW_ALL & 0b011;
-
+
+ *PL0_section_entry = PL0_section;
+ *UART_memory_section_entry = UART_memory_section;
// invalidate main Translation Lookup Buffer (just in case)
asm("mcr p15, 0, %0, c8, c7, 0\n\r"