]>
Commit | Line | Data |
---|---|---|
09bf6082 JB |
1 | ### entry point code |
2 | .macro gdbasm_startup | |
3 | ||
4 | # Align the stack pointer to an 8-byte boundary. | |
5 | lghi %r0,-16 | |
6 | ngr %r15,%r0 | |
7 | ||
8 | # Reserve space for the standard stack frame: | |
9 | # back chain, and space for the callee to save its registers. | |
10 | aghi %r15,-168 | |
11 | ||
12 | # Zero this frame's back chain pointer. | |
13 | xc 0(8,%r15),0(%r15) | |
14 | .endm | |
15 | ||
16 | ||
17 | ### Call a function. | |
18 | .macro gdbasm_call subr | |
19 | brasl %r14, \subr | |
20 | .endm | |
21 | ||
22 | ||
23 | ### Exit with a zero status. | |
24 | .macro gdbasm_exit0 | |
25 | lghi %r2, 0 | |
26 | svc 1 | |
27 | .endm | |
28 | ||
29 | ### Standard subroutine prologue. | |
30 | .macro gdbasm_enter | |
31 | ||
32 | # Save all the callee-saves registers. What the heck. | |
33 | stmg %r6,%r15,48(%r15) | |
34 | ||
35 | # Allocate the stack frame, and write the back chain pointer. | |
36 | # Keep the original SP in %r11. | |
37 | lgr %r11,%r15 | |
38 | aghi %r15,-168 | |
39 | stg %r11,0(%r15) | |
40 | .endm | |
41 | ||
42 | ||
43 | ### Standard subroutine epilogue. | |
44 | .macro gdbasm_leave | |
45 | ||
46 | # Restore all our registers. This also pops the frame, and | |
47 | # restores our return address. | |
48 | lmg %r6,%r15,216(%r15) | |
49 | ||
50 | # Jump to the return address. | |
51 | br %r14 | |
52 | ||
53 | .endm | |
54 | ||
55 | ### Several nops. | |
56 | .macro gdbasm_several_nops | |
57 | lr %r0, %r0 | |
58 | lr %r0, %r0 | |
59 | lr %r0, %r0 | |
60 | lr %r0, %r0 | |
61 | .endm | |
62 | ||
63 | ### Declare an `int' variable. | |
584b6e9e | 64 | .purgem gdbasm_datavar |
09bf6082 JB |
65 | .macro gdbasm_datavar name value |
66 | .data | |
67 | \name: | |
68 | .long \value | |
69 | .endm |