Add basic WFI test
[riscv-tests.git] / isa / rv64si / wfi.S
1 # See LICENSE for license details.
2
3 #*****************************************************************************
4 # wfi.S
5 #-----------------------------------------------------------------------------
6 #
7 # Test wait-for-interrupt instruction.
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 sstatus mstatus
18 #define sie mie
19 #define sip mip
20 #undef MIP_SSIP
21 #define MIP_SSIP MIP_MSIP
22 #endif
23
24 # Make sure wfi doesn't stall if an interrupt is pending
25 csrc sstatus, SSTATUS_IE
26 csrs sie, MIP_SSIP
27 csrs sip, MIP_SSIP
28 wfi
29
30 RVTEST_PASS
31
32 TEST_PASSFAIL
33
34 RVTEST_CODE_END
35
36 .data
37 RVTEST_DATA_BEGIN
38
39 TEST_DATA
40
41 RVTEST_DATA_END