xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:52cc9d9ffb3f
1 #
2 # -*- Mode: Asm -*-
3 #
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8 #
9 # ** Assumed vtable layout (obtained by disassembling with gdb):
10 # ** 4 bytes per vtable entry, skip 0th and 1st entries, so the mapping
11 # ** from index to entry is (4 * index) + 8.
12 #
13
14 .text
15 .align 2
16 #
17 # NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
18 # uint32_t paramCount, nsXPTCVariant* params)
19 #
20
21 .globl __NS_InvokeByIndex
22 __NS_InvokeByIndex:
23 mflr r0
24 stw r31,-4(r1)
25 #
26 # save off the incoming values in the callers parameter area
27 #
28 stw r3,24(r1) ; that
29 stw r4,28(r1) ; methodIndex
30 stw r5,32(r1) ; paramCount
31 stw r6,36(r1) ; params
32 stw r0,8(r1)
33 stwu r1,-144(r1) ; 24 for linkage area,
34 ; 8*13 for fprData area,
35 ; 8 for saved registers,
36 ; 8 to keep stack 16-byte aligned
37
38 # set up for and call 'invoke_count_words' to get new stack size
39 #
40 mr r3,r5
41 mr r4,r6
42
43 stwu r1,-24(r1)
44 bl L_invoke_count_words$stub
45 lwz r1,0(r1)
46
47 # prepare args for 'invoke_copy_to_stack' call
48 #
49 lwz r4,176(r1) ; paramCount
50 lwz r5,180(r1) ; params
51 mr r6,r1 ; fprData
52 slwi r3,r3,2 ; number of stack bytes required
53 addi r3,r3,28 ; linkage area
54 mr r31,r1 ; save original stack top
55 sub r1,r1,r3 ; bump the stack
56 clrrwi r1,r1,4 ; keep the stack 16-byte aligned
57 addi r3,r31,144 ; act like real alloca, so 0(sp) always
58 stw r3,0(r1) ; points back to previous stack frame
59 addi r3,r1,28 ; parameter pointer excludes linkage area size + 'this'
60
61 # create "temporary" stack frame for _invoke_copy_to_stack to operate in.
62 stwu r1,-40(r1)
63 bl L_invoke_copy_to_stack$stub
64 # remove temporary stack frame.
65 lwz r1,0(r1)
66
67 lfd f1,0(r31)
68 lfd f2,8(r31)
69 lfd f3,16(r31)
70 lfd f4,24(r31)
71 lfd f5,32(r31)
72 lfd f6,40(r31)
73 lfd f7,48(r31)
74 lfd f8,56(r31)
75 lfd f9,64(r31)
76 lfd f10,72(r31)
77 lfd f11,80(r31)
78 lfd f12,88(r31)
79 lfd f13,96(r31)
80
81 lwz r3,168(r31) ; that
82 lwz r4,0(r3) ; get vTable from 'that'
83 lwz r5,172(r31) ; methodIndex
84 slwi r5,r5,2 ; methodIndex * 4
85 lwzx r12,r5,r4 ; get function pointer
86
87 lwz r4,28(r1)
88 lwz r5,32(r1)
89 lwz r6,36(r1)
90 lwz r7,40(r1)
91 lwz r8,44(r1)
92 lwz r9,48(r1)
93 lwz r10,52(r1)
94
95 mtlr r12
96 blrl
97
98 mr r1,r31
99 lwz r0,152(r1)
100 addi r1,r1,144
101 mtlr r0
102 lwz r31,-4(r1)
103
104 blr
105
106 .picsymbol_stub
107 L_invoke_count_words$stub:
108 .indirect_symbol _invoke_count_words
109 mflr r0
110 bcl 20,31,L1$pb
111 L1$pb:
112 mflr r11
113 addis r11,r11,ha16(L1$lz-L1$pb)
114 mtlr r0
115 lwz r12,lo16(L1$lz-L1$pb)(r11)
116 mtctr r12
117 addi r11,r11,lo16(L1$lz-L1$pb)
118 bctr
119 .lazy_symbol_pointer
120 L1$lz:
121 .indirect_symbol _invoke_count_words
122 .long dyld_stub_binding_helper
123
124
125 .picsymbol_stub
126 L_invoke_copy_to_stack$stub:
127 .indirect_symbol _invoke_copy_to_stack
128 mflr r0
129 bcl 20,31,L2$pb
130 L2$pb:
131 mflr r11
132 addis r11,r11,ha16(L2$lz-L2$pb)
133 mtlr r0
134 lwz r12,lo16(L2$lz-L2$pb)(r11)
135 mtctr r12
136 addi r11,r11,lo16(L2$lz-L2$pb)
137 bctr
138 .lazy_symbol_pointer
139 L2$lz:
140 .indirect_symbol _invoke_copy_to_stack
141 .long dyld_stub_binding_helper
142

mercurial