From ba6dcb1789caff4a91e9d99c57c7c119b7cdb4ba Mon Sep 17 00:00:00 2001 From: Dolu1990 Date: Thu, 27 Apr 2023 14:56:41 +0200 Subject: [PATCH] Add a few privSpec tests --- src/test/cpp/raw/privSpec/src/crt.S | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/test/cpp/raw/privSpec/src/crt.S b/src/test/cpp/raw/privSpec/src/crt.S index f013ab2..b41119a 100644 --- a/src/test/cpp/raw/privSpec/src/crt.S +++ b/src/test/cpp/raw/privSpec/src/crt.S @@ -11,6 +11,54 @@ _start: test1: li TEST_ID, 1 + + machine_setup_trap + csrr zero, ustatus + machine_handle_trap + + la x1, fail + csrw mtvec, x1 + + csrrw x0, mhpmcounter3, x0 + csrrw x0, mhpmcounter31, x0 + csrrw x0, mhpmevent3, x0 + csrrw x0, mhpmevent31, x0 + csrr x0, hpmcounter3 + csrr x0, hpmcounter31 + + machine_setup_trap + csrw hpmcounter3, x0 + machine_handle_trap + + machine_setup_trap + csrw hpmcounter31, x0 + machine_handle_trap + + machine_setup_trap; machine_to_user; csrrw x0, mhpmcounter3, x0; machine_handle_trap + machine_setup_trap; machine_to_user; csrrw x0, mhpmcounter31, x0; machine_handle_trap + machine_setup_trap; machine_to_user; csrrw x0, mhpmevent3, x0; machine_handle_trap + machine_setup_trap; machine_to_user; csrrw x0, mhpmevent31, x0; machine_handle_trap + machine_setup_trap; machine_to_user; csrr x0, hpmcounter3; machine_handle_trap + machine_setup_trap; machine_to_user; csrr x0, hpmcounter31; machine_handle_trap + + machine_setup_trap + machine_to_supervisor + ebreak + machine_handle_trap + csrr x1, mstatus + + li x1, 0x8 + csrw medeleg, x1 + machine_setup_trap + machine_to_supervisor + supervisor_setup_trap + ebreak + supervisor_handle_trap + csrr x1, sstatus + ecall + machine_handle_trap + + csrw misa, x0 //Test xtvec mode