1275970Scy### entry point code
2275970Scy        .macro gdbasm_startup
3275970Scy
4275970Scy        # Align the stack pointer to an 8-byte boundary.
5275970Scy        lghi %r0,-16
6275970Scy        ngr %r15,%r0
7275970Scy
8275970Scy        # Reserve space for the standard stack frame:
9275970Scy        # back chain, and space for the callee to save its registers.
10275970Scy        aghi %r15,-168
11275970Scy
12275970Scy        # Zero this frame's back chain pointer.
13275970Scy        xc 0(8,%r15),0(%r15)
14275970Scy        .endm
15275970Scy
16275970Scy
17275970Scy### Call a function.
18275970Scy        .macro gdbasm_call subr
19275970Scy        brasl %r14, \subr
20275970Scy        .endm
21275970Scy
22275970Scy
23275970Scy### Exit with a zero status.
24275970Scy        .macro gdbasm_exit0
25275970Scy        lghi %r2, 0
26275970Scy        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.
64	.purgem gdbasm_datavar
65        .macro gdbasm_datavar name value
66        .data
67\name:
68        .long \value
69        .endm
70