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