summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Celio <celio@eecs.berkeley.edu>2015-06-23 18:08:49 -0700
committerChristopher Celio <celio@eecs.berkeley.edu>2015-06-23 18:08:49 -0700
commitc60e1a9e2f48f8c011a4967247a7618d42c53462 (patch)
treeee5ae8f77b9439e863a49c7982eeeba51a36fd2c
parentdac4ddd40078f31f4c2e766368c237eba84ef68c (diff)
downloadenv-c60e1a9e2f48f8c011a4967247a7618d42c53462.zip
env-c60e1a9e2f48f8c011a4967247a7618d42c53462.tar.gz
env-c60e1a9e2f48f8c011a4967247a7618d42c53462.tar.bz2
Avoid "csrw stvec" if stvec_handler doesn't exist.
-rw-r--r--p/riscv_test.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/p/riscv_test.h b/p/riscv_test.h
index b82b108..efd9c52 100644
--- a/p/riscv_test.h
+++ b/p/riscv_test.h
@@ -168,8 +168,9 @@ _start: \
RISCV_MULTICORE_DISABLE; \
CHECK_XLEN; \
la t0, stvec_handler; \
+ beqz t0, 1f; \
csrw stvec, t0; \
- li t0, MSTATUS_PRV1 | MSTATUS_PRV2 | MSTATUS_IE1 | MSTATUS_IE2; \
+1: li t0, MSTATUS_PRV1 | MSTATUS_PRV2 | MSTATUS_IE1 | MSTATUS_IE2; \
csrc mstatus, t0; \
init; \
EXTRA_INIT; \