Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / context / src / asm / make_ppc64_sysv_xcoff_gas.S
1         .globl  make_fcontext[DS]
2         .globl .make_fcontext[PR]
3         .align 2 
4         .csect .make_fcontext[PR], 3
5         .globl _make_fcontext
6 #._make_fcontext:
7     # save return address into R6
8     mflr  6
9
10     # first arg of make_fcontext() == top address of context-function
11     # shift address in R3 to lower 16 byte boundary
12     clrrwi  3, 3, 4
13
14     # reserve space for context-data on context-stack
15     # including 64 byte of linkage + parameter area (R1 % 16 == 0)
16     subi  3, 3, 392
17
18     # third arg of make_fcontext() == address of context-function
19     stw  5, 320(3)
20
21     # load LR
22     mflr  0
23     # jump to label 1
24     bl  .Label
25 .Label:
26     # load LR into R4
27     mflr  4
28     # compute abs address of label .L_finish
29     addi  4, 4, .L_finish - .Label
30     # restore LR
31     mtlr  0
32     # save address of finish as return-address for context-function
33     # will be entered after context-function returns
34     stw  4, 312(3)
35
36     # restore return address from R6
37     mtlr  6
38
39     blr  # return pointer to context-data
40
41 .L_finish:
42     # save return address into R0
43     mflr  0
44     # save return address on stack, set up stack frame
45     stw  0, 8(1)
46     # allocate stack space, R1 % 16 == 0
47     stwu  1, -32(1)
48
49     # exit code is zero
50     li  3, 0
51     # exit application
52     bl  ._exit
53     nop