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
13RVTEST_RV64S
14RVTEST_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 sret mret
22  #define stvec_handler mtvec_handler
23#endif
24
25  li TESTNUM, 2
26
27do_break:
28  sbreak
29  j fail
30
31  TEST_PASSFAIL
32
33  .align 2
34  .global stvec_handler
35stvec_handler:
36  li t1, CAUSE_BREAKPOINT
37  csrr t0, scause
38  bne t0, t1, fail
39  la t1, do_break
40  csrr t0, sepc
41  bne t0, t1, fail
42  j pass
43
44RVTEST_CODE_END
45
46  .data
47RVTEST_DATA_BEGIN
48
49  TEST_DATA
50
51RVTEST_DATA_END
52