Fixed bug and tried to reset menvcfg to improve testing of csri in priv.

This commit is contained in:
harshinisrinath 2023-07-30 16:40:06 -07:00
parent 413a104b6c
commit b4cfdf3393

View file

@ -56,16 +56,38 @@ sretdone:
csrw satp, zero
# STIMECMP from S mode
li t0, 1
# 1st is when MENVCFG_STCE is cleared
li a0, 3
ecall # starts in M-mode
csrw menvcfg, x0
li a0, 1
ecall # enter S-mode
csrw stimecmp, zero
li t0, 3
li a0, 3
ecall # return to M-mode
csrsi mcounteren, 2 # mcounteren_tm = 1
li t0, 1
li a0, 1
ecall # supervisor mode again
csrw stimecmp, zero
li t0, 3
li a0, 3
ecall # machine mode again
# STIMECMP from S mode
# 2nd is when MENVCFG_STCE is set
csrci mcounteren, 2 # mcounteren_tm = 0
li t0, 1
slli t0, t0, 63
csrw menvcfg, t0
li a0, 1
ecall # enter S-mode
csrw stimecmp, zero
li a0, 3
ecall # return to M-mode
csrsi mcounteren, 2 # mcounteren_tm = 1
li a0, 1
ecall # supervisor mode again
csrw stimecmp, zero
li a0, 3
ecall # machine mode again