]> gitweb @ CieloNegro.org - pkgsrc-firefox3.git/blob - files/xptcinvoke_asm_ppc_rhapsody.s
Placed missing xptcinvoke_asm_ppc_rhapsody.s into files/.
[pkgsrc-firefox3.git] / files / xptcinvoke_asm_ppc_rhapsody.s
1 #
2 # -*- Mode: Asm -*-
3 #
4 # ***** BEGIN LICENSE BLOCK *****
5 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 #
7 # The contents of this file are subject to the Mozilla Public License Version
8 # 1.1 (the "License"); you may not use this file except in compliance with
9 # the License. You may obtain a copy of the License at
10 # http://www.mozilla.org/MPL/
11 #
12 # Software distributed under the License is distributed on an "AS IS" basis,
13 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 # for the specific language governing rights and limitations under the
15 # License.
16 #
17 # The Original Code is mozilla.org code.
18 #
19 # The Initial Developer of the Original Code is
20 # Netscape Communications Corporation.
21 # Portions created by the Initial Developer are Copyright (C) 1999
22 # the Initial Developer. All Rights Reserved.
23 #
24 # Contributor(s):
25 #   Patrick C. Beard <beard@netscape.com>
26 #
27 # Alternatively, the contents of this file may be used under the terms of
28 # either the GNU General Public License Version 2 or later (the "GPL"), or
29 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 # in which case the provisions of the GPL or the LGPL are applicable instead
31 # of those above. If you wish to allow use of your version of this file only
32 # under the terms of either the GPL or the LGPL, and not to allow others to
33 # use your version of this file under the terms of the MPL, indicate your
34 # decision by deleting the provisions above and replace them with the notice
35 # and other provisions required by the GPL or the LGPL. If you do not delete
36 # the provisions above, a recipient may use your version of this file under
37 # the terms of any one of the MPL, the GPL or the LGPL.
38 #
39 # ***** END LICENSE BLOCK *****
40
41
42 # ** Assumed vtable layout (obtained by disassembling with gdb):
43 # ** 4 bytes per vtable entry, skip 0th and 1st entries, so the mapping
44 # ** from index to entry is (4 * index) + 8.
45 #
46
47 .text
48         .align 2
49 #
50 #   NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
51 #                    PRUint32 paramCount, nsXPTCVariant* params)
52 #
53
54 .globl __NS_InvokeByIndex_P     
55 __NS_InvokeByIndex_P:
56         mflr    r0
57         stw     r31,-4(r1)
58 #
59 # save off the incoming values in the callers parameter area
60 #               
61         stw     r3,24(r1)               ; that
62         stw     r4,28(r1)               ; methodIndex
63         stw     r5,32(r1)               ; paramCount
64         stw     r6,36(r1)               ; params
65         stw     r0,8(r1)
66         stwu    r1,-144(r1)             ; 24 for linkage area, 
67                                         ; 8*13 for fprData area,
68                                         ; 8 for saved registers,
69                                         ; 8 to keep stack 16-byte aligned
70
71 # set up for and call 'invoke_count_words' to get new stack size
72 #       
73         mr      r3,r5
74         mr      r4,r6
75
76         stwu    r1,-24(r1)      
77         bl      L_invoke_count_words$stub
78         lwz     r1,0(r1)
79
80 # prepare args for 'invoke_copy_to_stack' call
81 #               
82         lwz     r4,176(r1)              ; paramCount
83         lwz     r5,180(r1)              ; params
84         mr      r6,r1                   ; fprData
85         slwi    r3,r3,2                 ; number of stack bytes required
86         addi    r3,r3,28                ; linkage area
87         mr      r31,r1                  ; save original stack top
88         sub     r1,r1,r3                ; bump the stack
89         clrrwi  r1,r1,4                 ; keep the stack 16-byte aligned
90         addi    r3,r31,144              ; act like real alloca, so 0(sp) always
91         stw     r3,0(r1)                ;  points back to previous stack frame
92         addi    r3,r1,28                ; parameter pointer excludes linkage area size + 'this'
93         
94 # create "temporary" stack frame for _invoke_copy_to_stack to operate in.
95         stwu    r1,-40(r1)
96         bl      L_invoke_copy_to_stack$stub
97 # remove temporary stack frame.
98         lwz     r1,0(r1)
99
100         lfd     f1,0(r31)                               
101         lfd     f2,8(r31)                               
102         lfd     f3,16(r31)                              
103         lfd     f4,24(r31)                              
104         lfd     f5,32(r31)                              
105         lfd     f6,40(r31)                              
106         lfd     f7,48(r31)                              
107         lfd     f8,56(r31)                              
108         lfd     f9,64(r31)                              
109         lfd     f10,72(r31)                             
110         lfd     f11,80(r31)                             
111         lfd     f12,88(r31)                             
112         lfd     f13,96(r31)                             
113         
114         lwz     r3,168(r31)             ; that
115         lwz     r4,0(r3)                ; get vTable from 'that'
116         lwz     r5,172(r31)             ; methodIndex
117         slwi    r5,r5,2                 ; methodIndex * 4
118 #ifndef HAVE_GCC3_ABI
119         addi    r5,r5,8                 ; (methodIndex * 4) + 8
120 #endif
121         lwzx    r12,r5,r4               ; get function pointer
122
123         lwz     r4,28(r1)
124         lwz     r5,32(r1)
125         lwz     r6,36(r1)
126         lwz     r7,40(r1)
127         lwz     r8,44(r1)
128         lwz     r9,48(r1)
129         lwz     r10,52(r1)
130         
131         mtlr    r12
132         blrl
133         
134         mr      r1,r31
135         lwz     r0,152(r1)
136         addi    r1,r1,144
137         mtlr    r0
138         lwz     r31,-4(r1)
139
140         blr
141
142 .picsymbol_stub
143 L_invoke_count_words$stub:
144         .indirect_symbol _invoke_count_words
145         mflr r0
146         bcl 20,31,L1$pb
147 L1$pb:
148         mflr r11
149         addis r11,r11,ha16(L1$lz-L1$pb)
150         mtlr r0
151         lwz r12,lo16(L1$lz-L1$pb)(r11)
152         mtctr r12
153         addi r11,r11,lo16(L1$lz-L1$pb)
154         bctr
155 .lazy_symbol_pointer
156 L1$lz:
157         .indirect_symbol _invoke_count_words
158         .long dyld_stub_binding_helper
159
160
161 .picsymbol_stub
162 L_invoke_copy_to_stack$stub:
163         .indirect_symbol _invoke_copy_to_stack
164         mflr r0
165         bcl 20,31,L2$pb
166 L2$pb:
167         mflr r11
168         addis r11,r11,ha16(L2$lz-L2$pb)
169         mtlr r0
170         lwz r12,lo16(L2$lz-L2$pb)(r11)
171         mtctr r12
172         addi r11,r11,lo16(L2$lz-L2$pb)
173         bctr
174 .lazy_symbol_pointer
175 L2$lz:
176         .indirect_symbol _invoke_copy_to_stack
177         .long dyld_stub_binding_helper
178