diff options
author | Yunsup Lee <yunsup@cs.berkeley.edu> | 2015-03-25 16:25:42 -0700 |
---|---|---|
committer | Yunsup Lee <yunsup@cs.berkeley.edu> | 2015-03-25 16:25:42 -0700 |
commit | 9e4b081d4a219c4eea1a7e979c316a0ff1cd7cdc (patch) | |
tree | 7e1db6f26a9d315cf164154a43623a33daf835a6 /isa/rv64si/csr.S | |
parent | a398a9baeccebbf7b8c7bd04edaac5e0d02cd7bf (diff) | |
download | riscv-tests-9e4b081d4a219c4eea1a7e979c316a0ff1cd7cdc.zip riscv-tests-9e4b081d4a219c4eea1a7e979c316a0ff1cd7cdc.tar.gz riscv-tests-9e4b081d4a219c4eea1a7e979c316a0ff1cd7cdc.tar.bz2 |
split out S-mode tests and M-mode tests
Diffstat (limited to 'isa/rv64si/csr.S')
-rw-r--r-- | isa/rv64si/csr.S | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/isa/rv64si/csr.S b/isa/rv64si/csr.S index edaaeb3..5d4b309 100644 --- a/isa/rv64si/csr.S +++ b/isa/rv64si/csr.S @@ -13,9 +13,16 @@ RVTEST_RV64S RVTEST_CODE_BEGIN - # Set up stvec in case we trap. - la t0, stvec - csrw stvec, t0 +#ifdef __MACHINE_MODE + #define sscratch mscratch + #define sstatus mstatus + #define scause mcause + #define sepc mepc + #define stvec_handler mtvec_handler + #undef SSTATUS_PS + #define SSTATUS_PS MSTATUS_PRV1 +#endif + csrwi scycle, 0 csrwi sscratch, 3 @@ -31,7 +38,7 @@ RVTEST_CODE_BEGIN # Make sure writing the cycle counter causes an exception. TEST_CASE(10, a0, 255, li a0, 255; csrrw a0, cycle, x0); - # Enter user mode + # jump to user land li t0, SSTATUS_PS csrc sstatus, t0 la t0, 1f @@ -51,7 +58,7 @@ RVTEST_CODE_BEGIN # We should only fall through to this if scall failed. TEST_PASSFAIL -stvec: +stvec_handler: # Trapping on tests 10, 11, and 13 is usually good news. # Note that since the test didn't complete, TESTNUM is smaller by 1. li t0, 9 @@ -65,7 +72,7 @@ stvec: j fail privileged: - # Make sure CAUSE indicates a lack of privilege. + # Make sure scause indicates a lack of privilege. csrr t0, scause li t1, CAUSE_ILLEGAL_INSTRUCTION bne t0, t1, fail @@ -76,7 +83,7 @@ privileged: sret syscall: - # Make sure CAUSE indicates a syscall. + # Make sure scause indicates a syscall. csrr t0, scause li t1, CAUSE_ECALL bne t0, t1, fail |