Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | # |
michael@0 | 2 | # -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 3 | # |
michael@0 | 4 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 6 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 7 | |
michael@0 | 8 | .set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 |
michael@0 | 9 | .set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 |
michael@0 | 10 | .set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 |
michael@0 | 11 | .set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 |
michael@0 | 12 | .set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 |
michael@0 | 13 | .set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 |
michael@0 | 14 | .set r30,30; .set r31,31 |
michael@0 | 15 | .set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 |
michael@0 | 16 | .set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 |
michael@0 | 17 | .set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 |
michael@0 | 18 | .set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 |
michael@0 | 19 | .set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 |
michael@0 | 20 | .set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 |
michael@0 | 21 | .set f30,30; .set f31,31 |
michael@0 | 22 | .set BO_IF,12 |
michael@0 | 23 | .set CR0_EQ,2 |
michael@0 | 24 | |
michael@0 | 25 | |
michael@0 | 26 | |
michael@0 | 27 | .rename H.10.NO_SYMBOL{PR},"" |
michael@0 | 28 | .rename H.18.NS_InvokeByIndex{TC},"NS_InvokeByIndex" |
michael@0 | 29 | |
michael@0 | 30 | |
michael@0 | 31 | # .text section |
michael@0 | 32 | |
michael@0 | 33 | .csect H.10.NO_SYMBOL{PR} |
michael@0 | 34 | .globl .NS_InvokeByIndex |
michael@0 | 35 | .globl NS_InvokeByIndex{DS} |
michael@0 | 36 | .extern .invoke_copy_to_stack |
michael@0 | 37 | .extern ._ptrgl{PR} |
michael@0 | 38 | |
michael@0 | 39 | |
michael@0 | 40 | # |
michael@0 | 41 | # NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex, |
michael@0 | 42 | # uint32_t paramCount, nsXPTCVariant* params) |
michael@0 | 43 | # |
michael@0 | 44 | |
michael@0 | 45 | .NS_InvokeByIndex: |
michael@0 | 46 | mflr r0 |
michael@0 | 47 | stw r31,-4(sp) |
michael@0 | 48 | # |
michael@0 | 49 | # save off the incoming values in the caller's parameter area |
michael@0 | 50 | # |
michael@0 | 51 | stw r3,24(sp) # that |
michael@0 | 52 | stw r4,28(sp) # methodIndex |
michael@0 | 53 | stw r5,32(sp) # paramCount |
michael@0 | 54 | stw r6,36(sp) # params |
michael@0 | 55 | stw r0,8(sp) |
michael@0 | 56 | stwu sp,-136(sp) # = 24 for linkage area, 8 * 13 for fprData area, 8 for saved registers |
michael@0 | 57 | |
michael@0 | 58 | # prepare args for 'invoke_copy_to_stack' call |
michael@0 | 59 | # |
michael@0 | 60 | lwz r4,168(sp) # paramCount |
michael@0 | 61 | lwz r5,172(sp) # params |
michael@0 | 62 | mr r6,sp # fprData |
michael@0 | 63 | slwi r3,r4,3 # number of bytes of stack required |
michael@0 | 64 | # at most 8*paramCount |
michael@0 | 65 | addi r3,r3,28 # linkage area |
michael@0 | 66 | mr r31,sp # save original stack top |
michael@0 | 67 | subfc sp,r3,sp # bump the stack |
michael@0 | 68 | addi r3,sp,28 # parameter pointer excludes linkage area size + 'this' |
michael@0 | 69 | |
michael@0 | 70 | bl .invoke_copy_to_stack |
michael@0 | 71 | nop |
michael@0 | 72 | |
michael@0 | 73 | lfd f1,0(r31) # Restore floating point registers |
michael@0 | 74 | lfd f2,8(r31) |
michael@0 | 75 | lfd f3,16(r31) |
michael@0 | 76 | lfd f4,24(r31) |
michael@0 | 77 | lfd f5,32(r31) |
michael@0 | 78 | lfd f6,40(r31) |
michael@0 | 79 | lfd f7,48(r31) |
michael@0 | 80 | lfd f8,56(r31) |
michael@0 | 81 | lfd f9,64(r31) |
michael@0 | 82 | lfd f10,72(r31) |
michael@0 | 83 | lfd f11,80(r31) |
michael@0 | 84 | lfd f12,88(r31) |
michael@0 | 85 | lfd f13,96(r31) |
michael@0 | 86 | |
michael@0 | 87 | lwz r3,160(r31) # that |
michael@0 | 88 | lwz r4,0(r3) # get vTable from 'that' |
michael@0 | 89 | lwz r5,164(r31) # methodIndex |
michael@0 | 90 | slwi r5,r5,3 # methodIndex * 8 |
michael@0 | 91 | addi r5,r5,8 # step over junk at start of vTable ! |
michael@0 | 92 | lwzx r11,r5,r4 # get function pointer |
michael@0 | 93 | |
michael@0 | 94 | addi r5,r5,4 # We need to manually adjust the 'that' pointer, this is CFRONT based |
michael@0 | 95 | lwzx r5,r4,r5 # offset = r4(vtable) + r5(methodIndex offset) - 4 |
michael@0 | 96 | add r3,r5,r3 # adjust 'that' r3 = r3 + r5 |
michael@0 | 97 | |
michael@0 | 98 | lwz r4,28(sp) |
michael@0 | 99 | lwz r5,32(sp) |
michael@0 | 100 | lwz r6,36(sp) |
michael@0 | 101 | lwz r7,40(sp) |
michael@0 | 102 | lwz r8,44(sp) |
michael@0 | 103 | lwz r9,48(sp) |
michael@0 | 104 | lwz r10,52(sp) |
michael@0 | 105 | |
michael@0 | 106 | bl ._ptrgl{PR} |
michael@0 | 107 | nop |
michael@0 | 108 | |
michael@0 | 109 | mr sp,r31 |
michael@0 | 110 | lwz r0,144(sp) |
michael@0 | 111 | addi sp,sp,136 |
michael@0 | 112 | mtlr r0 |
michael@0 | 113 | lwz r31,-4(sp) |
michael@0 | 114 | blr |
michael@0 | 115 | |
michael@0 | 116 | |
michael@0 | 117 | # .data section |
michael@0 | 118 | |
michael@0 | 119 | .toc # 0x00000038 |
michael@0 | 120 | T.18.NS_InvokeByIndex: |
michael@0 | 121 | .tc H.18.NS_InvokeByIndex{TC},NS_InvokeByIndex{DS} |
michael@0 | 122 | |
michael@0 | 123 | .csect NS_InvokeByIndex{DS} |
michael@0 | 124 | .long .NS_InvokeByIndex # "\0\0\0\0" |
michael@0 | 125 | .long TOC{TC0} # "\0\0\0008" |
michael@0 | 126 | .long 0x00000000 # "\0\0\0\0" |
michael@0 | 127 | # End csect NS_InvokeByIndex{DS} |
michael@0 | 128 | |
michael@0 | 129 | # .bss section |