aboutsummaryrefslogtreecommitdiff
path: root/sim/testsuite/mn10300/testutils.inc
blob: 64188172667b30c97125a3824e62505e65874fe6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# MACRO: exit
	.macro exit nr
	mov \nr, d1;
	# Trap function 1: exit().
	mov 1, d0;
	syscall;
	.endm

# MACRO: pass
# Write 'pass' to stdout and quit
	.macro pass
	# Trap function 5: write().
	mov 5, d0;
	# Use stdout.
	mov 1, d1;
	# Point to the string.
	mov 1f, a0;
	mov a0, (12, sp);
	# Number of bytes to write.
	mov 5, d3;
	mov d3, (16, sp);
	# Trigger OS trap.
	syscall;
	exit 0
	.data
	1: .asciz "pass\n"
	.endm

# MACRO: fail
# Write 'fail' to stdout and quit
	.macro fail
	# Trap function 5: write().
	mov 5, d0;
	# Use stdout.
	mov 1, d1;
	# Point to the string.
	mov 1f, a0;
	mov a0, (12, sp);
	# Number of bytes to write.
	mov 5, d3;
	mov d3, (16, sp);
	# Trigger OS trap.
	syscall;
	exit 0
	.data
	1: .asciz "fail\n"
	.endm

# MACRO: start
# All assembler tests should start with a call to "start"
	.macro start
	.data
.global _stack
_stack:
	.rept 8
	.long 0
	.endr
	.text
.global _start
_start:
	mov _stack, a0;
	mov a0, sp;
	.endm