diff options
author | Gokturk Yuksek <gokturk@binghamton.edu> | 2020-11-24 00:46:00 -0500 |
---|---|---|
committer | Gokturk Yuksek <gokturk@binghamton.edu> | 2020-11-24 00:46:00 -0500 |
commit | 9fca12559e540e72b62cbbbe26fa565770f38cc4 (patch) | |
tree | 1e6f090a096bc6514e11e8d2365f7dbdbc1fefd1 | |
parent | 43d3d53809085e2c8f030d72eed1bdf798bfb31a (diff) | |
download | env-9fca12559e540e72b62cbbbe26fa565770f38cc4.zip env-9fca12559e540e72b62cbbbe26fa565770f38cc4.tar.gz env-9fca12559e540e72b62cbbbe26fa565770f38cc4.tar.bz2 |
Replace sptbr with satp throughout
The RISC-V Privileged ISA v1.10 uses satp instead of sptbr. Although
GCC can cope with sptbr, clang cannot. It fails with:
error: operand must be a valid system register name or an integer in
the range [0, 4095]
Modified the variable name in vm.c as well to ensure consistency and
avoid possible confusion.
-rw-r--r-- | p/riscv_test.h | 2 | ||||
-rw-r--r-- | v/vm.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/p/riscv_test.h b/p/riscv_test.h index 2b6ff83..a08f49e 100644 --- a/p/riscv_test.h +++ b/p/riscv_test.h @@ -110,7 +110,7 @@ #define INIT_SATP \ la t0, 1f; \ csrw mtvec, t0; \ - csrwi sptbr, 0; \ + csrwi satp, 0; \ .align 2; \ 1: @@ -253,10 +253,10 @@ void vm_boot(uintptr_t test_addr) # error #endif uintptr_t vm_choice = SATP_MODE_CHOICE; - uintptr_t sptbr_value = ((uintptr_t)l1pt >> PGSHIFT) + uintptr_t satp_value = ((uintptr_t)l1pt >> PGSHIFT) | (vm_choice * (SATP_MODE & ~(SATP_MODE<<1))); - write_csr(sptbr, sptbr_value); - if (read_csr(sptbr) != sptbr_value) + write_csr(satp, satp_value); + if (read_csr(satp) != satp_value) assert(!"unsupported satp mode"); // Set up PMPs if present, ignoring illegal instruction trap if not. |