[RFC PATCH 4/4] arm64: Change mapping for data/rodata/text

Ilias Apalodimas ilias.apalodimas at linaro.org
Thu Jan 30 08:20:29 CET 2025


Now that we have everything in place switch the page permissions for
.rodata, .text and .data just after we relocate everything in top of the
RAM.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
---
 common/board_r.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/common/board_r.c b/common/board_r.c
index 179259b00de8..38944f600fd6 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -170,6 +170,13 @@ static int initr_reloc_global_data(void)
 	efi_save_gd();
 
 	efi_runtime_relocate(gd->relocaddr, NULL);
+
+#if (IS_ENABLED(CONFIG_ARM64))
+	mmu_set_attrs((u64)(__start_rodata), (u64)(__end_rodata - __start_rodata), 1);
+	mmu_set_attrs((u64)(__start_data), (u64)(__end_data - __start_data), 3);
+	mmu_set_attrs((u64)(__text_start), (u64)(__text_end - __text_start), 2);
+#endif
+
 #endif
 
 	return 0;
-- 
2.43.0



More information about the U-Boot mailing list