1*b725ae77Skettenis### entry point code 2*b725ae77Skettenis .macro gdbasm_startup 3*b725ae77Skettenis 4*b725ae77Skettenis # Align the stack pointer to an 8-byte boundary. 5*b725ae77Skettenis lhi %r0,-8 6*b725ae77Skettenis nr %r15,%r0 7*b725ae77Skettenis 8*b725ae77Skettenis # Reserve space for the standard stack frame: 9*b725ae77Skettenis # back chain, and space for the callee to save its registers. 10*b725ae77Skettenis ahi %r15,-104 11*b725ae77Skettenis 12*b725ae77Skettenis # Zero this frame's back chain pointer. 13*b725ae77Skettenis xc 0(4,%r15),0(%r15) 14*b725ae77Skettenis .endm 15*b725ae77Skettenis 16*b725ae77Skettenis 17*b725ae77Skettenis### Call a function. 18*b725ae77Skettenis .macro gdbasm_call subr 19*b725ae77Skettenis 20*b725ae77Skettenis # Put the address of the constant in %r1, load the constant 21*b725ae77Skettenis # (SUBR's address), and jump to it. 22*b725ae77Skettenis bras %r1, .Lafterconst\@ 23*b725ae77Skettenis .long \subr 24*b725ae77Skettenis.Lafterconst\@: 25*b725ae77Skettenis l %r1,0(%r1) 26*b725ae77Skettenis basr %r14,%r1 27*b725ae77Skettenis .endm 28*b725ae77Skettenis 29*b725ae77Skettenis 30*b725ae77Skettenis### Exit with a zero status. 31*b725ae77Skettenis .macro gdbasm_exit0 32*b725ae77Skettenis lhi %r2, 0 33*b725ae77Skettenis svc 1 34*b725ae77Skettenis .endm 35*b725ae77Skettenis 36*b725ae77Skettenis### Standard subroutine prologue. 37*b725ae77Skettenis .macro gdbasm_enter 38*b725ae77Skettenis 39*b725ae77Skettenis # Save all the callee-saves registers. What the heck. 40*b725ae77Skettenis stm %r6,%r15,24(%r15) 41*b725ae77Skettenis 42*b725ae77Skettenis # Allocate the stack frame, and write the back chain pointer. 43*b725ae77Skettenis # Keep the original SP in %r11. 44*b725ae77Skettenis lr %r1,%r15 45*b725ae77Skettenis ahi %r15,-96 46*b725ae77Skettenis st %r1,0(%r15) 47*b725ae77Skettenis .endm 48*b725ae77Skettenis 49*b725ae77Skettenis 50*b725ae77Skettenis### Standard subroutine epilogue. 51*b725ae77Skettenis .macro gdbasm_leave 52*b725ae77Skettenis 53*b725ae77Skettenis # Restore all our registers. This also pops the frame, and 54*b725ae77Skettenis # restores our return address. 55*b725ae77Skettenis lm %r6,%r15,120(%r15) 56*b725ae77Skettenis 57*b725ae77Skettenis # Jump to the return address. 58*b725ae77Skettenis br %r14 59*b725ae77Skettenis 60*b725ae77Skettenis .endm 61*b725ae77Skettenis 62*b725ae77Skettenis### Several nops. 63*b725ae77Skettenis .macro gdbasm_several_nops 64*b725ae77Skettenis lr %r0, %r0 65*b725ae77Skettenis lr %r0, %r0 66*b725ae77Skettenis lr %r0, %r0 67*b725ae77Skettenis lr %r0, %r0 68*b725ae77Skettenis .endm 69*b725ae77Skettenis 70*b725ae77Skettenis### Declare an `int' variable. 71*b725ae77Skettenis .macro gdbasm_datavar name value 72*b725ae77Skettenis .data 73*b725ae77Skettenis\name: 74*b725ae77Skettenis .long \value 75*b725ae77Skettenis .endm 76