Skip to content

Commit

Permalink
riscv/pgmap: Fix bug in kernel page directory init
Browse files Browse the repository at this point in the history
The L2 table was not connected -> results in random crashes. Also add
missing data sync barrier to the end.
  • Loading branch information
pussuw committed May 6, 2024
1 parent bf1da18 commit 25a9614
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arch/risc-v/src/common/riscv_addrenv_pgmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ int up_addrenv_kmap_init(void)
next = g_kernel_pgt_pbase;
vaddr = CONFIG_ARCH_KMAP_VBASE;

for (i = 0; i < (ARCH_SPGTS - 1); i++)
for (i = 0; i < ARCH_SPGTS; i++)
{
/* Connect the static page tables */

Expand All @@ -211,6 +211,10 @@ int up_addrenv_kmap_init(void)

addrenv->satp = mmu_satp_reg(g_kernel_pgt_pbase, 0);

/* When all is set and done, flush the data caches */

__DMB();

return OK;
}

Expand Down

0 comments on commit 25a9614

Please sign in to comment.