4 # ***** BEGIN LICENSE BLOCK *****
5 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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
17 # The Original Code is mozilla.org code.
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.
25 # Patrick C. Beard <beard@netscape.com>
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.
39 # ***** END LICENSE BLOCK *****
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.
50 # NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
51 # PRUint32 paramCount, nsXPTCVariant* params)
54 .globl __NS_InvokeByIndex_P
59 # save off the incoming values in the callers parameter area
62 stw r4,28(r1) ; methodIndex
63 stw r5,32(r1) ; paramCount
64 stw r6,36(r1) ; params
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
71 # set up for and call 'invoke_count_words' to get new stack size
77 bl L_invoke_count_words$stub
80 # prepare args for 'invoke_copy_to_stack' call
82 lwz r4,176(r1) ; paramCount
83 lwz r5,180(r1) ; params
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'
94 # create "temporary" stack frame for _invoke_copy_to_stack to operate in.
96 bl L_invoke_copy_to_stack$stub
97 # remove temporary stack frame.
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
121 lwzx r12,r5,r4 ; get function pointer
143 L_invoke_count_words$stub:
144 .indirect_symbol _invoke_count_words
149 addis r11,r11,ha16(L1$lz-L1$pb)
151 lwz r12,lo16(L1$lz-L1$pb)(r11)
153 addi r11,r11,lo16(L1$lz-L1$pb)
157 .indirect_symbol _invoke_count_words
158 .long dyld_stub_binding_helper
162 L_invoke_copy_to_stack$stub:
163 .indirect_symbol _invoke_copy_to_stack
168 addis r11,r11,ha16(L2$lz-L2$pb)
170 lwz r12,lo16(L2$lz-L2$pb)(r11)
172 addi r11,r11,lo16(L2$lz-L2$pb)
176 .indirect_symbol _invoke_copy_to_stack
177 .long dyld_stub_binding_helper