From 820e3513c7a0d77060751b6b9ee4fc066869265c Mon Sep 17 00:00:00 2001 From: David Harris Date: Fri, 31 Mar 2023 08:32:02 -0700 Subject: [PATCH] Privilege test improvements --- tests/coverage/priv.S | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/coverage/priv.S b/tests/coverage/priv.S index 3aa3aea5..008d06be 100644 --- a/tests/coverage/priv.S +++ b/tests/coverage/priv.S @@ -36,4 +36,30 @@ main: addi t0, zero, 0 csrr t0, stimecmp + # CSR coverage + csrw scause, zero + csrw stval, zero + csrw scounteren, zero + csrw satp, zero + + # satp write with mstatus.TVM = 1 + bseti t0, zero, 20 + csrs mstatus, t0 + csrw satp, zero + + # STIMECMP from S mode + li t0, 1 + ecall # enter S-mode + csrw stimecmp, zero + li t0, 3 + ecall # return to M-mode + csrsi mcounteren, 2 # mcounteren_tm = 1 + li t0, 1 + ecall # supervisor mode again + csrw stimecmp, zero + li t0, 3 + ecall # machine mode again + + + j done