Merge branch 'priv-1.9'
[riscv-tests.git] / isa / rv64mi / illegal.S
1 # See LICENSE for license details.
2
3 #*****************************************************************************
4 # illegal.S
5 #-----------------------------------------------------------------------------
6 #
7 # Test illegal instruction trap.
8 #
9
10 #include "riscv_test.h"
11 #include "test_macros.h"
12
13 RVTEST_RV64M
14 RVTEST_CODE_BEGIN
15
16 li TESTNUM, 2
17 .word 0
18 j fail
19
20 j pass
21
22 TEST_PASSFAIL
23
24 mtvec_handler:
25 li t1, CAUSE_ILLEGAL_INSTRUCTION
26 csrr t0, mcause
27 bne t0, t1, fail
28 csrr t0, mepc
29 addi t0, t0, 8
30 csrw mepc, t0
31 sret
32
33 RVTEST_CODE_END
34
35 .data
36 RVTEST_DATA_BEGIN
37
38 TEST_DATA
39
40 RVTEST_DATA_END