OpenCores
URL https://opencores.org/ocsvn/fwrisc/fwrisc/trunk

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [ve/] [fwrisc/] [tests/] [riscv-compliance/] [riscv-test-suite/] [rv32mi/] [rv64si/] [scall.S] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
# 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 "compliance_test.h"
12
#include "compliance_io.h"
13
#include "aw_test_macros.h"
14
 
15
RVTEST_RV64S
16
RVTEST_CODE_BEGIN
17
 
18
#ifdef __MACHINE_MODE
19
  #define sscratch mscratch
20
  #define sstatus mstatus
21
  #define scause mcause
22
  #define sepc mepc
23
  #define sret mret
24
  #define stvec_handler mtvec_handler
25
  #undef SSTATUS_SPP
26
  #define SSTATUS_SPP MSTATUS_MPP
27
#endif
28
 
29
  li TESTNUM, 2
30
  SWSIG(2, TESTNUM)
31
 
32
  # This is the expected trap code.
33
  li t1, CAUSE_USER_ECALL
34
 
35
#ifdef __MACHINE_MODE
36
  # If running in M mode, use mstatus.MPP to check existence of U mode.
37
  # Otherwise, if in S mode, then U mode must exist and we don't need to check.
38
  li t0, MSTATUS_MPP
39
  csrc mstatus, t0
40
  csrr t2, mstatus
41
  and t0, t0, t2
42
  beqz t0, 1f
43
 
44
  # If U mode doesn't exist, mcause should indicate ECALL from M mode.
45
  li t1, CAUSE_MACHINE_ECALL
46
#endif
47
 
48
1:
49
  li t0, SSTATUS_SPP
50
  csrc sstatus, t0
51
  la t0, 1f
52
  csrw sepc, t0
53
  sret
54
1:
55
 
56
  li TESTNUM, 1
57
  SWSIG(1, TESTNUM)
58
do_scall:
59
  li TESTNUM, 1;
60
  SWSIG (0, TESTNUM); # say it is a pass
61
  scall
62
  j fail
63
 
64
  TEST_PASSFAIL
65
 
66
  .align 2
67
  .global stvec_handler
68
stvec_handler:
69
  csrr t0, scause
70
  bne t0, t1, fail
71
  la t2, do_scall
72
  csrr t0, sepc
73
  bne t0, t2, fail
74
  j pass
75
 
76
RVTEST_CODE_END
77
 
78
  .data
79
RV_COMPLIANCE_DATA_BEGIN
80
test_res:
81
    .fill 40, 4, -1
82
RV_COMPLIANCE_DATA_END
83
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.