1 # See LICENSE for license details.
3 #*****************************************************************************
5 #-----------------------------------------------------------------------------
9 # If the pmp registers are implemented, then the pmp registers have
10 # to be configured before jumping to the privilaged modes
12 #include "riscv_test.h"
13 #include "test_macros.h"
19 #define sscratch mscratch
20 #define sstatus mstatus
24 #define stvec_handler mtvec_handler
26 #define SSTATUS_SPP MSTATUS_MPP
32 # If running in M mode, use mstatus.MPP to check existence of U mode.
33 # Otherwise, if in S mode, then U mode must exist and we don't need to check.
36 srli t0, t0, PMP_SHIFT
41 li t0, (PMP_R | PMP_W | PMP_X) # giving read, write and execute permissions
42 or t0, t0, PMP_TOR # setting mode to TOR
49 .global no_pmp_implemented
56 # This is the expected trap code.
57 li t1, CAUSE_USER_ECALL
60 # If U mode doesn't exist, mcause should indicate ECALL from M mode.
61 li t1, CAUSE_MACHINE_ECALL
88 bne t0, t1, check_for_pmp
95 li t1, CAUSE_ILLEGAL_INSTRUCTION