We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3c2897f commit 9777a96Copy full SHA for 9777a96
libcpu/risc-v/common64/mmu.c
@@ -692,6 +692,9 @@ void rt_hw_mem_setup_early(void)
692
* PC are still at lower region before relocating to high memory
693
*/
694
rt_ubase_t pg_idx ;
695
+ /* Round down symb_pc to L1_PAGE_SIZE boundary to ensure proper page alignment.
696
+ * This is necessary because MMU operations work with page-aligned addresses, and
697
+ * make sure all the text region is mapped.*/
698
ps = (rt_ubase_t)symb_pc & (~(L1_PAGE_SIZE - 1));
699
pg_idx = GET_L1(ps);
700
early_pgtbl[pg_idx] = COMBINEPTE(ps, MMU_MAP_EARLY);
0 commit comments