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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial