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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_openbsd.s	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +/* Platform specific code to invoke XPCOM methods on native objects */
    1.11 +        .global XPTC_InvokeByIndex
    1.12 +/*
    1.13 +    XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
    1.14 +                   uint32_t paramCount, nsXPTCVariant* params);
    1.15 +    
    1.16 +*/
    1.17 +XPTC_InvokeByIndex:
    1.18 +        save    %sp,-(64 + 16),%sp  ! room for the register window and
    1.19 +                                    ! struct pointer, rounded up to 0 % 16
    1.20 +        mov     %i2,%o0             ! paramCount
    1.21 +        call    invoke_count_words  ! returns the required stack size in %o0
    1.22 +        mov     %i3,%o1             ! params
    1.23 +        
    1.24 +	sll     %o0,2,%l0           ! number of bytes
    1.25 +        sub     %sp,%l0,%sp         ! create the additional stack space
    1.26 +            
    1.27 +        mov     %sp,%o0             ! pointer for copied args
    1.28 +        add     %o0,72,%o0          ! step past the register window, the
    1.29 +                                    ! struct result pointer and the 'this' slot
    1.30 +        mov     %i2,%o1             ! paramCount
    1.31 +        call    invoke_copy_to_stack
    1.32 +        mov     %i3,%o2             ! params
    1.33 +!
    1.34 +!   calculate the target address from the vtable
    1.35 +!
    1.36 +	add	%i1,1,%i1	    ! vTable is zero-based, index is 1 based (?)	
    1.37 +	ld	[%i0],%l1	    ! *that --> vTable
    1.38 +	sll	%i1,3,%i1
    1.39 +	add	%i1,%l1,%l1	    ! vTable[index * 8], l1 now points to vTable entry
    1.40 +	lduh	[%l1],%l0	    ! this adjustor
    1.41 +	sll	%l0,16,%l0          ! sign extend to 32 bits
    1.42 +	sra     %l0,16,%l0
    1.43 +	add     %l0,%i0,%i0         ! adjust this
    1.44 +	ld      [%l1 + 4],%l0       ! target address
    1.45 +
    1.46 +.L5:    ld      [%sp + 88],%o5
    1.47 +.L4:	ld	[%sp + 84],%o4
    1.48 +.L3:	ld	[%sp + 80],%o3
    1.49 +.L2:	ld	[%sp + 76],%o2
    1.50 +.L1:	ld	[%sp + 72],%o1
    1.51 +.L0:
    1.52 +        jmpl    %l0,%o7             ! call the routine
    1.53 +! always have a 'this', from the incoming 'that'
    1.54 +	mov	%i0,%o0
    1.55 +        
    1.56 +	mov     %o0,%i0             ! propagate return value
    1.57 +        ret
    1.58 +        restore

mercurial