Make WFI test more strict
[riscv-tests.git] / isa / rv64si / scall.S
1 # See LICENSE for license details.
2
3 #*****************************************************************************
4 # scall.S
5 #-----------------------------------------------------------------------------
6 #
7 # Test syscall trap.
8 #
9
10 #include "riscv_test.h"
11 #include "test_macros.h"
12
13 RVTEST_RV64S
14 RVTEST_CODE_BEGIN
15
16 #ifdef __MACHINE_MODE
17 #define sscratch mscratch
18 #define sstatus mstatus
19 #define scause mcause
20 #define sepc mepc
21 #define stvec_handler mtvec_handler
22 #undef SSTATUS_SPP
23 #define SSTATUS_SPP MSTATUS_MPP
24 #endif
25
26 li TESTNUM, 2
27
28 li t0, SSTATUS_SPP
29 csrc sstatus, t0
30 la t0, 1f
31 csrw sepc, t0
32 eret
33 1:
34
35 scall
36 j fail
37
38 TEST_PASSFAIL
39
40 stvec_handler:
41 li t1, CAUSE_USER_ECALL
42 csrr t0, scause
43 bne t0, t1, fail
44 j pass
45
46 RVTEST_CODE_END
47
48 .data
49 RVTEST_DATA_BEGIN
50
51 TEST_DATA
52
53 RVTEST_DATA_END