Update copyright year range in all GDB files.
[deliverable/binutils-gdb.git] / sim / testsuite / sim / pru / testutils.inc
CommitLineData
b811d2c2 1# Copyright (C) 2016-2020 Free Software Foundation, Inc.
e2e9097b
DD
2# Contributed by Dimitar Dimitrov <dimitar@dinux.eu>
3#
4# This file is part of the GNU simulators.
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19# MACRO: start
20# All assembler tests should start with a call to "main_test"
21 .macro start
22 .text
23
24 .global _start
25_start:
26
27 # Skip over these inlined funcs.
28 jmp __main_test;
29
30 .global __pass
31 .type __pass, function
32__pass:
33 # Note - DRAM LMA and VMA are equal for PRU, so
34 # we can afford to pass DRAM pointer directly.
35 write 1, _passmsg, 5
36 exit 0
37
38 .global __fail
39 .type __fail, function
40__fail:
41 write 1, _failmsg, 5
42 exit 1
43
44 .data
45_passmsg:
46 .ascii "pass\n"
47
48_failmsg:
49 .ascii "fail\n"
50
51 .text
52 .global __main_test
53 .type __main_test, function
54__main_test:
55 .endm
56
57# MACRO: system_call
58# Make a libgloss system call
59 .macro system_call nr:req, arg1=0, arg2=0, arg3=0
60 ldi r1, \nr
61 ldi r14, \arg1
62 ldi r15, \arg2
63 ldi r16, \arg3
64 halt
65 .endm
66
67# MACRO: exit
68# Quit the current test
69 .macro exit rc:req
70 system_call 1, \rc
71 .endm
72
73# MACRO: pass
74# Write 'pass' to stdout via syscalls and quit;
75# meant for non-OS operating environments
76 .macro pass
77 jmp __pass;
78 .endm
79
80# MACRO: fail
81# Write 'fail' to stdout via syscalls and quit;
82# meant for non-OS operating environments
83 .macro fail
84 jmp __fail;
85 .endm
86
87# MACRO: write
88# Just like the write() C function; uses system calls
89 .macro write fd:req, str:req, len:req
90 system_call 5, \fd, \str, \len
91 .endm
92
93# MACRO: qbne32
94# Like qbne instruction, but check a 32-bit constant value.
95 .macro qbne32 label:req, op0:req, C0:req
96 qbne \label, \op0\().b0, ((\C0) >> 0) & 0xff
97 qbne \label, \op0\().b1, ((\C0) >> 8) & 0xff
98 qbne \label, \op0\().b2, ((\C0) >> 16) & 0xff
99 qbne \label, \op0\().b3, ((\C0) >> 24) & 0xff
100 .endm
This page took 0.037378 seconds and 4 git commands to generate.