| 1 | comment "subroutine declare" |
| 2 | .purgem gdbasm_declare |
| 3 | .macro gdbasm_declare name |
| 4 | .section ".opd","aw" |
| 5 | \name: |
| 6 | .quad .\name, .TOC.@tocbase, 0 |
| 7 | .section ".text" |
| 8 | .type \name, @function |
| 9 | .\name: |
| 10 | .endm |
| 11 | |
| 12 | comment "subroutine prologue" |
| 13 | .macro gdbasm_enter |
| 14 | stdu 1, -112(1) |
| 15 | mflr 0 |
| 16 | std 0, 128(1) |
| 17 | .endm |
| 18 | |
| 19 | comment "subroutine epilogue" |
| 20 | .macro gdbasm_leave |
| 21 | ld 0, 128(1) |
| 22 | mtlr 0 |
| 23 | ld 1, 0(1) |
| 24 | blr |
| 25 | .endm |
| 26 | |
| 27 | .macro gdbasm_call subr |
| 28 | bl \subr |
| 29 | nop |
| 30 | .endm |
| 31 | |
| 32 | .macro gdbasm_several_nops |
| 33 | nop |
| 34 | nop |
| 35 | nop |
| 36 | nop |
| 37 | .endm |
| 38 | |
| 39 | comment "exit (0)" |
| 40 | .macro gdbasm_exit0 |
| 41 | comment "sys_exit" |
| 42 | li 0, 1 |
| 43 | sc |
| 44 | .endm |
| 45 | |
| 46 | comment "crt0 startup" |
| 47 | .macro gdbasm_startup |
| 48 | .p2align 2 |
| 49 | .endm |
| 50 | |
| 51 | comment "Declare a data variable" |
| 52 | .purgem gdbasm_datavar |
| 53 | .macro gdbasm_datavar name value |
| 54 | .section ".data" |
| 55 | \name: |
| 56 | .long \value |
| 57 | .endm |