1 /* -----------------------------------------------------------------------
2 sysv.h - Copyright (c) 1998 Geoffrey Keating
6 $Id: sysv.S,v 1.1.1.1 1998/11/29 16:48:16 green Exp $
8 Permission is hereby granted, free of charge, to any person obtaining
9 a copy of this software and associated documentation files (the
10 ``Software''), to deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense, and/or sell copies of the Software, and to
13 permit persons to whom the Software is furnished to do so, subject to
14 the following conditions:
16 The above copyright notice and this permission notice shall be included
17 in all copies or substantial portions of the Software.
19 THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 OTHER DEALINGS IN THE SOFTWARE.
26 ----------------------------------------------------------------------- */
29 #include <fficonfig.h>
31 #include <powerpc/asm.h>
34 .globl ffi_prep_args_SYSV
37 /* Save the old stack pointer as AP. */
41 /* Allocate the stack space we need. */
43 /* Save registers we use. */
56 /* Save arguments over call... */
57 mr %r31,%r5 /* flags, */
58 mr %r30,%r6 /* rvalue, */
59 mr %r29,%r7 /* function address, */
60 mr %r28,%r8 /* our AP. */
63 /* Call ffi_prep_args_SYSV. */
65 bl JUMPTARGET(ffi_prep_args_SYSV)
67 /* Now do the call. */
68 /* Set up cr1 with bits 4-7 of the flags. */
70 /* Get the address to call into CTR. */
72 /* Load all those argument registers. */
73 lwz %r3,-16-(8*4)(%r28)
74 lwz %r4,-16-(7*4)(%r28)
75 lwz %r5,-16-(6*4)(%r28)
76 lwz %r6,-16-(5*4)(%r28)
79 lwz %r7,-16-(4*4)(%r28)
80 lwz %r8,-16-(3*4)(%r28)
81 lwz %r9,-16-(2*4)(%r28)
82 lwz %r10,-16-(1*4)(%r28)
86 /* Load all the FP registers. */
88 lfd %f1,-16-(8*4)-(8*8)(%r28)
89 lfd %f2,-16-(8*4)-(7*8)(%r28)
90 lfd %f3,-16-(8*4)-(6*8)(%r28)
91 lfd %f4,-16-(8*4)-(5*8)(%r28)
93 lfd %f5,-16-(8*4)-(4*8)(%r28)
94 lfd %f6,-16-(8*4)-(3*8)(%r28)
95 lfd %f7,-16-(8*4)-(2*8)(%r28)
96 lfd %f8,-16-(8*4)-(1*8)(%r28)
102 /* Now, deal with the return value. */
104 bt- 30,L(done_return_value)
105 bt- 29,L(fp_return_value)
107 bf+ 28,L(done_return_value)
109 /* Fall through... */
111 L(done_return_value):
112 /* Restore the registers we used and return. */
123 bf 28,L(float_return_value)
125 b L(done_return_value)
126 L(float_return_value):
128 b L(done_return_value)
132 .section ".eh_frame",EH_FRAME_FLAGS,@progbits
134 .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */
136 .4byte 0x0 /* CIE Identifier Tag */
137 .byte 0x1 /* CIE Version */
138 #if defined _RELOCATABLE || defined __PIC__
139 .ascii "zR\0" /* CIE Augmentation */
141 .ascii "\0" /* CIE Augmentation */
143 .uleb128 0x1 /* CIE Code Alignment Factor */
144 .sleb128 -4 /* CIE Data Alignment Factor */
145 .byte 0x41 /* CIE RA Column */
146 #if defined _RELOCATABLE || defined __PIC__
147 .uleb128 0x1 /* Augmentation size */
148 .byte 0x1b /* FDE Encoding (pcrel sdata4) */
150 .byte 0xc /* DW_CFA_def_cfa */
156 .4byte .LEFDE1-.LASFDE1 /* FDE Length */
158 .4byte .LASFDE1-.Lframe1 /* FDE CIE offset */
159 #if defined _RELOCATABLE || defined __PIC__
160 .4byte .LFB1-. /* FDE initial location */
162 .4byte .LFB1 /* FDE initial location */
164 .4byte .LFE1-.LFB1 /* FDE address range */
165 #if defined _RELOCATABLE || defined __PIC__
166 .uleb128 0x0 /* Augmentation size */
168 .byte 0x4 /* DW_CFA_advance_loc4 */
170 .byte 0xd /* DW_CFA_def_cfa_register */
172 .byte 0x4 /* DW_CFA_advance_loc4 */
174 .byte 0x2f /* DW_CFA_GNU_negative_offset_extended */
177 .byte 0x9f /* DW_CFA_offset, column 0x1f */
179 .byte 0x9e /* DW_CFA_offset, column 0x1e */
181 .byte 0x9d /* DW_CFA_offset, column 0x1d */
183 .byte 0x9c /* DW_CFA_offset, column 0x1c */
185 .byte 0x4 /* DW_CFA_advance_loc4 */
187 .byte 0xd /* DW_CFA_def_cfa_register */