1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 2 * 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7/* Platform specific code to invoke XPCOM methods on native objects */ 8 .global XPTC_InvokeByIndex 9/* 10 XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex, 11 uint32_t paramCount, nsXPTCVariant* params); 12 13*/ 14XPTC_InvokeByIndex: 15 save %sp,-(64 + 16),%sp ! room for the register window and 16 ! struct pointer, rounded up to 0 % 16 17 mov %i2,%o0 ! paramCount 18 call invoke_count_words ! returns the required stack size in %o0 19 mov %i3,%o1 ! params 20 21 sll %o0,2,%l0 ! number of bytes 22 sub %sp,%l0,%sp ! create the additional stack space 23 24 mov %sp,%o0 ! pointer for copied args 25 add %o0,72,%o0 ! step past the register window, the 26 ! struct result pointer and the 'this' slot 27 mov %i2,%o1 ! paramCount 28 call invoke_copy_to_stack 29 mov %i3,%o2 ! params 30! 31! calculate the target address from the vtable 32! 33 add %i1,1,%i1 ! vTable is zero-based, index is 1 based (?) 34 ld [%i0],%l1 ! *that --> vTable 35 sll %i1,3,%i1 36 add %i1,%l1,%l1 ! vTable[index * 8], l1 now points to vTable entry 37 lduh [%l1],%l0 ! this adjustor 38 sll %l0,16,%l0 ! sign extend to 32 bits 39 sra %l0,16,%l0 40 add %l0,%i0,%i0 ! adjust this 41 ld [%l1 + 4],%l0 ! target address 42 43.L5: ld [%sp + 88],%o5 44.L4: ld [%sp + 84],%o4 45.L3: ld [%sp + 80],%o3 46.L2: ld [%sp + 76],%o2 47.L1: ld [%sp + 72],%o1 48.L0: 49 jmpl %l0,%o7 ! call the routine 50! always have a 'this', from the incoming 'that' 51 mov %i0,%o0 52 53 mov %o0,%i0 ! propagate return value 54 ret 55 restore 56