1# You'll find a bunch of nop opcodes in the below macros.  They are
2# there to keep the code correctly aligned.  Be careful to maintain
3# them when changing the code.
4
5	comment "subroutine declare"
6	.macro gdbasm_declare name
7	.align	1
8	.global	\name
9\name:
10	.endm
11
12	comment "subroutine prologue"
13	.macro gdbasm_enter
14	mov.l   r14,@-r15
15	sts.l   pr,@-r15
16	mov     r15,r14
17	nop
18	.endm
19
20	comment "subroutine epilogue"
21	.macro gdbasm_leave
22	mov     r14,r15
23	lds.l   @r15+,pr
24	mov.l   @r15+,r14
25	rts
26	nop
27	nop
28	.endm
29
30	comment "subroutine end"
31	.macro gdbasm_end name
32	.size   \name, .-_foo1
33	.align	1
34	.endm
35
36	comment "subroutine call"
37	.macro gdbasm_call subr
38	mov.l   .Lconst\@,r1
39	bra	.Lafterconst\@
40	nop
41	nop
42.Lconst\@:
43	.align	2
44	.long	\subr
45	.align	1
46.Lafterconst\@:
47	jsr	@r1
48	nop
49	.endm
50
51	.macro gdbasm_several_nops
52	nop
53	nop
54	nop
55	nop
56	.endm
57
58	comment "exit (0)"
59	.macro gdbasm_exit0
60	sleep
61	nop
62	.endm
63
64	comment "crt0 startup"
65	.macro gdbasm_startup
66	mov.l	.stackaddr,r15
67	bra	.afterstackaddr
68	nop
69	nop
70	.align 2
71.stackaddr:
72	.long	196608		! 0x30000
73	.align	1
74.afterstackaddr:
75	.endm
76
77	comment "Declare a data variable"
78	.macro gdbasm_datavar name value
79	.data
80	.align 2
81	.type	\name, @object
82	.size	\name, 4
83\name:
84	.long	\value
85	.endm
86