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 .purgem gdbasm_declare 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" 32 .purgem gdbasm_end 33 .macro gdbasm_end name 34 .size \name, . - \name 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 comment "If there is a _stack symbol, use it for setting up the stack" 69 comment "pointer. In hosted mode (when there is no _stack symbol)," 70 comment "the operating system will have initialized it already." 71 mov.l .stackaddr, r0 72 tst r0, r0 73 bt .afterstackaddr 74 mov r0, r15 75 bra .afterstackaddr 76 nop 77 .align 2 78 .stackaddr: 79 .weak _stack 80 .long _stack 81 .align 1 82 .afterstackaddr: 83 .endm 84 85 comment "Declare a data variable" 86 .purgem gdbasm_datavar 87 .macro gdbasm_datavar name value 88 .data 89 .align 2 90 .type \name, @object 91 .size \name, 4 92 \name: 93 .long \value 94 .endm 95