1 # See LICENSE for license details.
3 #*****************************************************************************
5 #-----------------------------------------------------------------------------
7 # Test illegal instruction trap.
10 #include "riscv_test.h"
11 #include "test_macros.h"
24 # Test vectored interrupts if they are supported.
25 test_vectored_interrupts:
28 la t0, mtvec_handler + 1
33 csrsi mstatus, MSTATUS_MIE
40 # Skip the rest of the test if S-mode is not present.
43 li t1, (MSTATUS_MPP & -MSTATUS_MPP) * PRV_S
49 # Delegate supervisor software interrupts so WFI won't stall.
50 csrwi mideleg, MIP_SSIP
56 # Make sure WFI doesn't trap when TW=0.
63 # Make sure WFI does trap when TW=1.
67 # Make sure SFENCE.VMA and sptbr don't trap when TVM=0.
75 # Make sure SFENCE.VMA and sptbr do trap when TVM=1.
82 # Make sure SRET doesn't trap when TSR=0.
94 # Make sure SRET does trap when TSR=1.
106 j synchronous_exception
123 synchronous_exception:
124 li t1, CAUSE_ILLEGAL_INSTRUCTION