OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libffi/] [src/] [powerpc/] [linux64.S] - Blame information for rev 790

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 732 jeremybenn
/* -----------------------------------------------------------------------
2
   sysv.h - Copyright (c) 2003 Jakub Jelinek 
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 
30
#include 
31
 
32
#ifdef __powerpc64__
33
        .hidden ffi_call_LINUX64, .ffi_call_LINUX64
34
        .globl  ffi_call_LINUX64, .ffi_call_LINUX64
35
        .section        ".opd","aw"
36
        .align  3
37
ffi_call_LINUX64:
38
        .quad   .ffi_call_LINUX64,.TOC.@tocbase,0
39
        .size   ffi_call_LINUX64,24
40
        .type   .ffi_call_LINUX64,@function
41
        .text
42
.ffi_call_LINUX64:
43
.LFB1:
44
        mflr    %r0
45
        std     %r28, -32(%r1)
46
        std     %r29, -24(%r1)
47
        std     %r30, -16(%r1)
48
        std     %r31, -8(%r1)
49
        std     %r0, 16(%r1)
50
 
51
        mr      %r28, %r1       /* our AP.  */
52
.LCFI0:
53
        stdux   %r1, %r1, %r4
54
        mr      %r31, %r5       /* flags, */
55
        mr      %r30, %r6       /* rvalue, */
56
        mr      %r29, %r7       /* function address.  */
57
        std     %r2, 40(%r1)
58
 
59
        /* Call ffi_prep_args64.  */
60
        mr      %r4, %r1
61
        bl      .ffi_prep_args64
62
 
63
        ld      %r0, 0(%r29)
64
        ld      %r2, 8(%r29)
65
        ld      %r11, 16(%r29)
66
 
67
        /* Now do the call.  */
68
        /* Set up cr1 with bits 4-7 of the flags.  */
69
        mtcrf   0x40, %r31
70
 
71
        /* Get the address to call into CTR.  */
72
        mtctr   %r0
73
        /* Load all those argument registers.  */
74
        ld      %r3, -32-(8*8)(%r28)
75
        ld      %r4, -32-(7*8)(%r28)
76
        ld      %r5, -32-(6*8)(%r28)
77
        ld      %r6, -32-(5*8)(%r28)
78
        bf-     5, 1f
79
        ld      %r7, -32-(4*8)(%r28)
80
        ld      %r8, -32-(3*8)(%r28)
81
        ld      %r9, -32-(2*8)(%r28)
82
        ld      %r10, -32-(1*8)(%r28)
83
1:
84
 
85
        /* Load all the FP registers.  */
86
        bf-     6, 2f
87
        lfd     %f1, -32-(21*8)(%r28)
88
        lfd     %f2, -32-(20*8)(%r28)
89
        lfd     %f3, -32-(19*8)(%r28)
90
        lfd     %f4, -32-(18*8)(%r28)
91
        lfd     %f5, -32-(17*8)(%r28)
92
        lfd     %f6, -32-(16*8)(%r28)
93
        lfd     %f7, -32-(15*8)(%r28)
94
        lfd     %f8, -32-(14*8)(%r28)
95
        lfd     %f9, -32-(13*8)(%r28)
96
        lfd     %f10, -32-(12*8)(%r28)
97
        lfd     %f11, -32-(11*8)(%r28)
98
        lfd     %f12, -32-(10*8)(%r28)
99
        lfd     %f13, -32-(9*8)(%r28)
100
2:
101
 
102
        /* Make the call.  */
103
        bctrl
104
 
105
        /* This must follow the call immediately, the unwinder
106
           uses this to find out if r2 has been saved or not.  */
107
        ld      %r2, 40(%r1)
108
 
109
        /* Now, deal with the return value.  */
110
        mtcrf   0x01, %r31
111
        bt-     30, .Ldone_return_value
112
        bt-     29, .Lfp_return_value
113
        std     %r3, 0(%r30)
114
        /* Fall through...  */
115
 
116
.Ldone_return_value:
117
        /* Restore the registers we used and return.  */
118
        mr      %r1, %r28
119
        ld      %r0, 16(%r28)
120
        ld      %r28, -32(%r1)
121
        mtlr    %r0
122
        ld      %r29, -24(%r1)
123
        ld      %r30, -16(%r1)
124
        ld      %r31, -8(%r1)
125
        blr
126
 
127
.Lfp_return_value:
128
        bf      28, .Lfloat_return_value
129
        stfd    %f1, 0(%r30)
130
        mtcrf   0x02, %r31 /* cr6  */
131
        bf      27, .Ldone_return_value
132
        stfd    %f2, 8(%r30)
133
        b       .Ldone_return_value
134
.Lfloat_return_value:
135
        stfs    %f1, 0(%r30)
136
        b       .Ldone_return_value
137
.LFE1:
138
        .long   0
139
        .byte   0,12,0,1,128,4,0,0
140
        .size   .ffi_call_LINUX64,.-.ffi_call_LINUX64
141
 
142
        .section        .eh_frame,EH_FRAME_FLAGS,@progbits
143
.Lframe1:
144
        .4byte  .LECIE1-.LSCIE1  # Length of Common Information Entry
145
.LSCIE1:
146
        .4byte  0x0      # CIE Identifier Tag
147
        .byte   0x1      # CIE Version
148
        .ascii "zR\0"    # CIE Augmentation
149
        .uleb128 0x1     # CIE Code Alignment Factor
150
        .sleb128 -8      # CIE Data Alignment Factor
151
        .byte   0x41     # CIE RA Column
152
        .uleb128 0x1     # Augmentation size
153
        .byte   0x14     # FDE Encoding (pcrel udata8)
154
        .byte   0xc      # DW_CFA_def_cfa
155
        .uleb128 0x1
156
        .uleb128 0x0
157
        .align 3
158
.LECIE1:
159
.LSFDE1:
160
        .4byte  .LEFDE1-.LASFDE1         # FDE Length
161
.LASFDE1:
162
        .4byte  .LASFDE1-.Lframe1        # FDE CIE offset
163
        .8byte  .LFB1-.  # FDE initial location
164
        .8byte  .LFE1-.LFB1      # FDE address range
165
        .uleb128 0x0     # Augmentation size
166
        .byte   0x2      # DW_CFA_advance_loc1
167
        .byte   .LCFI0-.LFB1
168
        .byte   0xd      # DW_CFA_def_cfa_register
169
        .uleb128 0x1c
170
        .byte   0x11     # DW_CFA_offset_extended_sf
171
        .uleb128 0x41
172
        .sleb128 -2
173
        .byte   0x9f     # DW_CFA_offset, column 0x1f
174
        .uleb128 0x1
175
        .byte   0x9e     # DW_CFA_offset, column 0x1e
176
        .uleb128 0x2
177
        .byte   0x9d     # DW_CFA_offset, column 0x1d
178
        .uleb128 0x3
179
        .byte   0x9c     # DW_CFA_offset, column 0x1c
180
        .uleb128 0x4
181
        .align 3
182
.LEFDE1:
183
#endif
184
 
185
#if defined __ELF__ && defined __linux__
186
        .section        .note.GNU-stack,"",@progbits
187
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.