From 9e18388b744c7cea04483ef1ef21bcd81e5835fb Mon Sep 17 00:00:00 2001 From: liangzhen Date: Fri, 2 Feb 2024 09:56:01 +0800 Subject: [PATCH] Add virtual memory synchronization after completing the page tables Signed-off-by: liangzhen Change-Id: Ida1490338d204541c5c7f143aec3b8d79d83d7f4 --- debug/programs/translate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/debug/programs/translate.c b/debug/programs/translate.c index 59dffd60f..e246baf77 100644 --- a/debug/programs/translate.c +++ b/debug/programs/translate.c @@ -163,6 +163,7 @@ int main() virtual = (uint32_t *) ( (reg_t) virtual | ~(((reg_t) 1 << vms->vaddr_bits) - 1)); add_entry(master_table, 0, (reg_t) virtual, (reg_t) physical); + __asm__ __volatile__ ("sfence.vma" ::: "memory"); // Virtual memory synchronization unsigned long satp = set_field(0, SATP_MODE, vms->mode); satp = set_field(satp, SATP_PPN, ((unsigned long) master_table) >> 12);