summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGokturk Yuksek <gokturk@binghamton.edu>2020-11-24 00:46:00 -0500
committerGokturk Yuksek <gokturk@binghamton.edu>2020-11-24 00:46:00 -0500
commit9fca12559e540e72b62cbbbe26fa565770f38cc4 (patch)
tree1e6f090a096bc6514e11e8d2365f7dbdbc1fefd1
parent43d3d53809085e2c8f030d72eed1bdf798bfb31a (diff)
downloadenv-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.h2
-rw-r--r--v/vm.c6
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:
diff --git a/v/vm.c b/v/vm.c
index 71700f5..d03f3b1 100644
--- a/v/vm.c
+++ b/v/vm.c
@@ -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.