1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix64.s Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,128 @@ 1.4 +# This Source Code Form is subject to the terms of the Mozilla Public 1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 1.9 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 1.10 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 1.11 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 1.12 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 1.13 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 1.14 +.set r30,30; .set r31,31 1.15 +.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 1.16 +.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 1.17 +.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 1.18 +.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 1.19 +.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 1.20 +.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 1.21 +.set f30,30; .set f31,31 1.22 +.set BO_IF,12 1.23 +.set CR0_EQ,2 1.24 + 1.25 + .rename H.10.NO_SYMBOL{PR},"" 1.26 + .rename H.18.NS_InvokeByIndex{TC},"NS_InvokeByIndex" 1.27 + 1.28 + 1.29 +# .text section 1.30 + 1.31 + .csect H.10.NO_SYMBOL{PR} 1.32 + .globl .NS_InvokeByIndex 1.33 + .globl NS_InvokeByIndex{DS} 1.34 + .extern .invoke_copy_to_stack 1.35 + .extern ._ptrgl{PR} 1.36 + 1.37 +# 1.38 +# NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex, 1.39 +# uint32_t paramCount, nsXPTCVariant* params) 1.40 +# 1.41 + 1.42 +.NS_InvokeByIndex: 1.43 + mflr r0 1.44 + std r31,-8(sp) 1.45 +# 1.46 +# save off the incoming values in the caller's parameter area 1.47 +# 1.48 + std r3,48(sp) # that 1.49 + std r4,56(sp) # methodIndex 1.50 + std r5,64(sp) # paramCount 1.51 + std r6,72(sp) # params 1.52 + std r0,16(sp) 1.53 + stdu sp,-168(sp) # 2*24=48 for linkage area, 1.54 + # 8*13=104 for fprData area 1.55 + # 16 for saved registers 1.56 + 1.57 +# prepare args for 'invoke_copy_to_stack' call 1.58 +# 1.59 + ld r4,232(sp) # paramCount (168+8+56) 1.60 + ld r5,240(sp) # params 1.61 + mr r6,sp # fprData 1.62 + sldi r3,r4,3 # number of bytes of stack required 1.63 + # is at most numParams*8 1.64 + addi r3,r3,56 # linkage area (48) + this (8) 1.65 + mr r31,sp # save original stack top 1.66 + subfc sp,r3,sp # bump the stack 1.67 + addi r3,sp,56 # parameter pointer excludes linkage area 1.68 + # size + 'this' 1.69 + 1.70 + bl .invoke_copy_to_stack 1.71 + nop 1.72 + 1.73 + lfd f1,0(r31) # Restore floating point registers 1.74 + lfd f2,8(r31) 1.75 + lfd f3,16(r31) 1.76 + lfd f4,24(r31) 1.77 + lfd f5,32(r31) 1.78 + lfd f6,40(r31) 1.79 + lfd f7,48(r31) 1.80 + lfd f8,56(r31) 1.81 + lfd f9,64(r31) 1.82 + lfd f10,72(r31) 1.83 + lfd f11,80(r31) 1.84 + lfd f12,88(r31) 1.85 + lfd f13,96(r31) 1.86 + 1.87 + ld r3,216(r31) # that (168+48) 1.88 + ld r4,0(r3) # get vTable from 'that' 1.89 + ld r5,224(r31) # methodIndex (168+56) 1.90 + sldi r5,r5,3 # methodIndex * 8 1.91 + # No junk at the start of 64bit vtable !!! 1.92 + ldx r11,r5,r4 # get function pointer (this jumps 1.93 + # either to the function if no adjustment 1.94 + # is needed (displacement = 0), or it 1.95 + # jumps to the thunk code, which will jump 1.96 + # to the function at the end) 1.97 + 1.98 + # No adjustment of the that pointer in 64bit mode, this is done 1.99 + # by the thunk code 1.100 + 1.101 + ld r4,56(sp) 1.102 + ld r5,64(sp) 1.103 + ld r6,72(sp) 1.104 + ld r7,80(sp) 1.105 + ld r8,88(sp) 1.106 + ld r9,96(sp) 1.107 + ld r10,104(sp) 1.108 + 1.109 + bl ._ptrgl{PR} 1.110 + nop 1.111 + 1.112 + mr sp,r31 1.113 + ld r0,184(sp) # 168+16 1.114 + addi sp,sp,168 1.115 + mtlr r0 1.116 + ld r31,-8(sp) 1.117 + blr 1.118 + 1.119 +# .data section 1.120 + 1.121 + .toc # 0x00000038 1.122 +T.18.NS_InvokeByIndex: 1.123 + .tc H.18.NS_InvokeByIndex{TC},NS_InvokeByIndex{DS} 1.124 + 1.125 + .csect NS_InvokeByIndex{DS} 1.126 + .llong .NS_InvokeByIndex # "\0\0\0\0" 1.127 + .llong TOC{TC0} # "\0\0\0008" 1.128 + .llong 0x00000000 # "\0\0\0\0" 1.129 +# End csect NS_InvokeByIndex{DS} 1.130 + 1.131 +# .bss section