~ubuntu-branches/ubuntu/trusty/python3.4/trusty-proposed

« back to all changes in this revision

Viewing changes to Modules/_ctypes/libffi/src/powerpc/linux64.S

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-11-25 09:44:27 UTC
  • Revision ID: package-import@ubuntu.com-20131125094427-lzxj8ap5w01lmo7f
Tags: upstream-3.4~b1
ImportĀ upstreamĀ versionĀ 3.4~b1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -----------------------------------------------------------------------
 
2
   sysv.h - Copyright (c) 2003 Jakub Jelinek <jakub@redhat.com>
 
3
            Copyright (c) 2008 Red Hat, Inc.
 
4
 
 
5
   PowerPC64 Assembly glue.
 
6
 
 
7
   Permission is hereby granted, free of charge, to any person obtaining
 
8
   a copy of this software and associated documentation files (the
 
9
   ``Software''), to deal in the Software without restriction, including
 
10
   without limitation the rights to use, copy, modify, merge, publish,
 
11
   distribute, sublicense, and/or sell copies of the Software, and to
 
12
   permit persons to whom the Software is furnished to do so, subject to
 
13
   the following conditions:
 
14
 
 
15
   The above copyright notice and this permission notice shall be included
 
16
   in all copies or substantial portions of the Software.
 
17
 
 
18
   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
 
19
   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
20
   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
21
   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 
22
   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 
23
   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
24
   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
25
   DEALINGS IN THE SOFTWARE.
 
26
   ----------------------------------------------------------------------- */
 
27
 
 
28
#define LIBFFI_ASM
 
29
#include <fficonfig.h>
 
30
#include <ffi.h>
 
31
 
 
32
#ifdef __powerpc64__
 
33
        .hidden ffi_call_LINUX64
 
34
        .globl  ffi_call_LINUX64
 
35
        .section        ".opd","aw"
 
36
        .align  3
 
37
ffi_call_LINUX64:
 
38
#ifdef _CALL_LINUX
 
39
        .quad   .L.ffi_call_LINUX64,.TOC.@tocbase,0
 
40
        .type   ffi_call_LINUX64,@function
 
41
        .text
 
42
.L.ffi_call_LINUX64:
 
43
#else
 
44
        .hidden .ffi_call_LINUX64
 
45
        .globl  .ffi_call_LINUX64
 
46
        .quad   .ffi_call_LINUX64,.TOC.@tocbase,0
 
47
        .size   ffi_call_LINUX64,24
 
48
        .type   .ffi_call_LINUX64,@function
 
49
        .text
 
50
.ffi_call_LINUX64:
 
51
#endif
 
52
.LFB1:
 
53
        mflr    %r0
 
54
        std     %r28, -32(%r1)
 
55
        std     %r29, -24(%r1)
 
56
        std     %r30, -16(%r1)
 
57
        std     %r31, -8(%r1)
 
58
        std     %r0, 16(%r1)
 
59
 
 
60
        mr      %r28, %r1       /* our AP.  */
 
61
.LCFI0:
 
62
        stdux   %r1, %r1, %r4
 
63
        mr      %r31, %r5       /* flags, */
 
64
        mr      %r30, %r6       /* rvalue, */
 
65
        mr      %r29, %r7       /* function address.  */
 
66
        std     %r2, 40(%r1)
 
67
 
 
68
        /* Call ffi_prep_args64.  */
 
69
        mr      %r4, %r1
 
70
#ifdef _CALL_LINUX
 
71
        bl      ffi_prep_args64
 
72
#else
 
73
        bl      .ffi_prep_args64
 
74
#endif
 
75
 
 
76
        ld      %r0, 0(%r29)
 
77
        ld      %r2, 8(%r29)
 
78
        ld      %r11, 16(%r29)
 
79
 
 
80
        /* Now do the call.  */
 
81
        /* Set up cr1 with bits 4-7 of the flags.  */
 
82
        mtcrf   0x40, %r31
 
83
 
 
84
        /* Get the address to call into CTR.  */
 
85
        mtctr   %r0
 
86
        /* Load all those argument registers.  */
 
87
        ld      %r3, -32-(8*8)(%r28)
 
88
        ld      %r4, -32-(7*8)(%r28)
 
89
        ld      %r5, -32-(6*8)(%r28)
 
90
        ld      %r6, -32-(5*8)(%r28)
 
91
        bf-     5, 1f
 
92
        ld      %r7, -32-(4*8)(%r28)
 
93
        ld      %r8, -32-(3*8)(%r28)
 
94
        ld      %r9, -32-(2*8)(%r28)
 
95
        ld      %r10, -32-(1*8)(%r28)
 
96
1:
 
97
 
 
98
        /* Load all the FP registers.  */
 
99
        bf-     6, 2f
 
100
        lfd     %f1, -32-(21*8)(%r28)
 
101
        lfd     %f2, -32-(20*8)(%r28)
 
102
        lfd     %f3, -32-(19*8)(%r28)
 
103
        lfd     %f4, -32-(18*8)(%r28)
 
104
        lfd     %f5, -32-(17*8)(%r28)
 
105
        lfd     %f6, -32-(16*8)(%r28)
 
106
        lfd     %f7, -32-(15*8)(%r28)
 
107
        lfd     %f8, -32-(14*8)(%r28)
 
108
        lfd     %f9, -32-(13*8)(%r28)
 
109
        lfd     %f10, -32-(12*8)(%r28)
 
110
        lfd     %f11, -32-(11*8)(%r28)
 
111
        lfd     %f12, -32-(10*8)(%r28)
 
112
        lfd     %f13, -32-(9*8)(%r28)
 
113
2:
 
114
 
 
115
        /* Make the call.  */
 
116
        bctrl
 
117
 
 
118
        /* This must follow the call immediately, the unwinder
 
119
           uses this to find out if r2 has been saved or not.  */
 
120
        ld      %r2, 40(%r1)
 
121
 
 
122
        /* Now, deal with the return value.  */
 
123
        mtcrf   0x01, %r31
 
124
        bt-     30, .Ldone_return_value
 
125
        bt-     29, .Lfp_return_value
 
126
        std     %r3, 0(%r30)
 
127
        /* Fall through...  */
 
128
 
 
129
.Ldone_return_value:
 
130
        /* Restore the registers we used and return.  */
 
131
        mr      %r1, %r28
 
132
        ld      %r0, 16(%r28)
 
133
        ld      %r28, -32(%r1)
 
134
        mtlr    %r0
 
135
        ld      %r29, -24(%r1)
 
136
        ld      %r30, -16(%r1)
 
137
        ld      %r31, -8(%r1)
 
138
        blr
 
139
 
 
140
.Lfp_return_value:
 
141
        bf      28, .Lfloat_return_value
 
142
        stfd    %f1, 0(%r30)
 
143
        mtcrf   0x02, %r31 /* cr6  */
 
144
        bf      27, .Ldone_return_value
 
145
        stfd    %f2, 8(%r30)
 
146
        b       .Ldone_return_value
 
147
.Lfloat_return_value:
 
148
        stfs    %f1, 0(%r30)
 
149
        b       .Ldone_return_value
 
150
.LFE1:
 
151
        .long   0
 
152
        .byte   0,12,0,1,128,4,0,0
 
153
#ifdef _CALL_LINUX
 
154
        .size   ffi_call_LINUX64,.-.L.ffi_call_LINUX64
 
155
#else
 
156
        .size   .ffi_call_LINUX64,.-.ffi_call_LINUX64
 
157
#endif
 
158
 
 
159
        .section        .eh_frame,EH_FRAME_FLAGS,@progbits
 
160
.Lframe1:
 
161
        .4byte  .LECIE1-.LSCIE1  # Length of Common Information Entry
 
162
.LSCIE1:
 
163
        .4byte  0x0      # CIE Identifier Tag
 
164
        .byte   0x1      # CIE Version
 
165
        .ascii "zR\0"    # CIE Augmentation
 
166
        .uleb128 0x1     # CIE Code Alignment Factor
 
167
        .sleb128 -8      # CIE Data Alignment Factor
 
168
        .byte   0x41     # CIE RA Column
 
169
        .uleb128 0x1     # Augmentation size
 
170
        .byte   0x14     # FDE Encoding (pcrel udata8)
 
171
        .byte   0xc      # DW_CFA_def_cfa
 
172
        .uleb128 0x1
 
173
        .uleb128 0x0
 
174
        .align 3
 
175
.LECIE1:
 
176
.LSFDE1:
 
177
        .4byte  .LEFDE1-.LASFDE1         # FDE Length
 
178
.LASFDE1:
 
179
        .4byte  .LASFDE1-.Lframe1        # FDE CIE offset
 
180
        .8byte  .LFB1-.  # FDE initial location
 
181
        .8byte  .LFE1-.LFB1      # FDE address range
 
182
        .uleb128 0x0     # Augmentation size
 
183
        .byte   0x2      # DW_CFA_advance_loc1
 
184
        .byte   .LCFI0-.LFB1
 
185
        .byte   0xd      # DW_CFA_def_cfa_register
 
186
        .uleb128 0x1c
 
187
        .byte   0x11     # DW_CFA_offset_extended_sf
 
188
        .uleb128 0x41
 
189
        .sleb128 -2
 
190
        .byte   0x9f     # DW_CFA_offset, column 0x1f
 
191
        .uleb128 0x1
 
192
        .byte   0x9e     # DW_CFA_offset, column 0x1e
 
193
        .uleb128 0x2
 
194
        .byte   0x9d     # DW_CFA_offset, column 0x1d
 
195
        .uleb128 0x3
 
196
        .byte   0x9c     # DW_CFA_offset, column 0x1c
 
197
        .uleb128 0x4
 
198
        .align 3
 
199
.LEFDE1:
 
200
#endif
 
201
 
 
202
#if defined __ELF__ && defined __linux__
 
203
        .section        .note.GNU-stack,"",@progbits
 
204
#endif