]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/src/asm/make_ppc32_sysv_elf_gas.S
b826e18d8abcff8cac35d278c8b833ad51adc4b4
[ceph.git] / ceph / src / boost / libs / context / src / asm / make_ppc32_sysv_elf_gas.S
1 /*
2 Copyright Oliver Kowalke 2009.
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt)
6 */
7
8 /******************************************************
9 * *
10 * ------------------------------------------------- *
11 * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
12 * ------------------------------------------------- *
13 * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
14 * ------------------------------------------------- *
15 * | R13 | R14 | R15 | R16 | R17 | R18 | R19 | R20 | *
16 * ------------------------------------------------- *
17 * ------------------------------------------------- *
18 * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
19 * ------------------------------------------------- *
20 * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
21 * ------------------------------------------------- *
22 * | R21 | R22 | R23 | R24 | R25 | R26 | R27 | R28 | *
23 * ------------------------------------------------- *
24 * ------------------------------------------------- *
25 * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
26 * ------------------------------------------------- *
27 * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
28 * ------------------------------------------------- *
29 * | R29 | R30 | R31 |hiddn| CR | LR | PC |bchai| *
30 * ------------------------------------------------- *
31 * ------------------------------------------------- *
32 * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
33 * ------------------------------------------------- *
34 * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
35 * ------------------------------------------------- *
36 * |linkr| FCTX| DATA| | *
37 * ------------------------------------------------- *
38 * *
39 *******************************************************/
40
41 .text
42 .globl make_fcontext
43 .align 2
44 .type make_fcontext,@function
45 make_fcontext:
46 # save return address into R6
47 mflr %r6
48
49 # first arg of make_fcontext() == top address of context-function
50 # shift address in R3 to lower 16 byte boundary
51 clrrwi %r3, %r3, 4
52
53 # reserve space for context-data on context-stack
54 # including 64 byte of linkage + parameter area (R1 % 16 == 0)
55 subi %r3, %r3, 172
56
57 # third arg of make_fcontext() == address of context-function
58 stw %r5, 88(%r3)
59
60 # set back-chain to zero
61 li %r0, 0
62 stw %r0, 92(%r3)
63
64 # compute address of returned transfer_t
65 addi %r0, %r3, 100
66 mr %r4, %r0
67 stw %r4, 76(%r3)
68
69 # load LR
70 mflr %r0
71 # jump to label 1
72 bl 1f
73 1:
74 # load LR into R4
75 mflr %r4
76 # compute abs address of label finish
77 addi %r4, %r4, finish - 1b
78 # restore LR
79 mtlr %r0
80 # save address of finish as return-address for context-function
81 # will be entered after context-function returns
82 stw %r4, 84(%r3)
83
84 # restore return address from R6
85 mtlr %r6
86
87 blr # return pointer to context-data
88
89 finish:
90 # save return address into R0
91 mflr %r0
92 # save return address on stack, set up stack frame
93 stw %r0, 4(%r1)
94 # allocate stack space, R1 % 16 == 0
95 stwu %r1, -16(%r1)
96
97 # exit code is zero
98 li %r3, 0
99 # exit application
100 bl _exit@plt
101 .size make_fcontext, .-make_fcontext
102
103 /* Mark that we don't need executable stack. */
104 .section .note.GNU-stack,"",%progbits