diff options
author | Marti Alonso <41269236+martialonso@users.noreply.github.com> | 2025-04-01 23:51:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-01 14:51:04 -0700 |
commit | 6de71edb142be36319e380ce782c3d1830c65d68 (patch) | |
tree | a28a845f0c738a33db0a90215d5705c65d134411 /v/vm.c | |
parent | f780d4038ad4da0f7cfbe294ef6360dd9f29d44a (diff) | |
download | env-6de71edb142be36319e380ce782c3d1830c65d68.zip env-6de71edb142be36319e380ce782c3d1830c65d68.tar.gz env-6de71edb142be36319e380ce782c3d1830c65d68.tar.bz2 |
Order pt writes before jumping to supervisor mode (#48)
Although, usually, caches for in-memory memory-management data
structures (e.g. TLB) are empty on reset, implicit references to such
data structures, due to instruction execution, might not necessarily be
ordered with respect to explicit writes. An SFENCE.VMA guarantees such
ordering.
This is necessary in order to ensure that when trapping into S mode the
hart sees the correct address translation mappings for supervisor level
code. For user level code, the supervisor already executes an SFENCE.VMA
when mapping the pages.
Diffstat (limited to 'v/vm.c')
-rw-r--r-- | v/vm.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -288,6 +288,7 @@ void vm_boot(uintptr_t test_addr) write_csr(satp, satp_value); if (read_csr(satp) != satp_value) assert(!"unsupported satp mode"); + flush_page(DRAM_BASE); // Set up PMPs if present, ignoring illegal instruction trap if not. uintptr_t pmpc = PMP_NAPOT | PMP_R | PMP_W | PMP_X; |