Commit | Line | Data |
---|---|---|
71e06f80 CV |
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" | |
584b6e9e | 6 | .purgem gdbasm_declare |
71e06f80 CV |
7 | .macro gdbasm_declare name |
8 | .align 1 | |
9 | .global \name | |
10 | \name: | |
11 | .endm | |
12 | ||
13 | comment "subroutine prologue" | |
14 | .macro gdbasm_enter | |
15 | mov.l r14,@-r15 | |
16 | sts.l pr,@-r15 | |
17 | mov r15,r14 | |
18 | nop | |
19 | .endm | |
20 | ||
21 | comment "subroutine epilogue" | |
22 | .macro gdbasm_leave | |
23 | mov r14,r15 | |
24 | lds.l @r15+,pr | |
25 | mov.l @r15+,r14 | |
26 | rts | |
27 | nop | |
28 | nop | |
29 | .endm | |
30 | ||
31 | comment "subroutine end" | |
584b6e9e | 32 | .purgem gdbasm_end |
71e06f80 CV |
33 | .macro gdbasm_end name |
34 | .size \name, .-_foo1 | |
35 | .align 1 | |
36 | .endm | |
37 | ||
38 | comment "subroutine call" | |
39 | .macro gdbasm_call subr | |
40 | mov.l .Lconst\@,r1 | |
41 | bra .Lafterconst\@ | |
42 | nop | |
43 | nop | |
44 | .Lconst\@: | |
45 | .align 2 | |
46 | .long \subr | |
47 | .align 1 | |
48 | .Lafterconst\@: | |
49 | jsr @r1 | |
50 | nop | |
51 | .endm | |
52 | ||
53 | .macro gdbasm_several_nops | |
54 | nop | |
55 | nop | |
56 | nop | |
57 | nop | |
58 | .endm | |
59 | ||
60 | comment "exit (0)" | |
61 | .macro gdbasm_exit0 | |
62 | sleep | |
63 | nop | |
64 | .endm | |
65 | ||
66 | comment "crt0 startup" | |
67 | .macro gdbasm_startup | |
68 | mov.l .stackaddr,r15 | |
69 | bra .afterstackaddr | |
70 | nop | |
71 | nop | |
72 | .align 2 | |
73 | .stackaddr: | |
74 | .long 196608 ! 0x30000 | |
75 | .align 1 | |
76 | .afterstackaddr: | |
77 | .endm | |
78 | ||
79 | comment "Declare a data variable" | |
584b6e9e | 80 | .purgem gdbasm_datavar |
71e06f80 CV |
81 | .macro gdbasm_datavar name value |
82 | .data | |
83 | .align 2 | |
84 | .type \name, @object | |
85 | .size \name, 4 | |
86 | \name: | |
87 | .long \value | |
88 | .endm |