michael@0: /* -*- Mode: asm; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * Version: MPL 1.1 michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: .LEVEL 1.1 michael@0: .text michael@0: .align 4 michael@0: michael@0: framesz: michael@0: .equ 128 michael@0: michael@0: .globl NS_InvokeByIndex michael@0: .type NS_InvokeByIndex, @function michael@0: michael@0: michael@0: NS_InvokeByIndex: michael@0: .PROC michael@0: .CALLINFO FRAME=72, CALLER,SAVE_RP, SAVE_SP, ENTRY_GR=3 michael@0: .ENTRY michael@0: michael@0: ; frame marker takes 48 bytes, michael@0: ; register spill area takes 8 bytes, michael@0: ; local stack area takes 72 bytes result in 128 bytes total michael@0: michael@0: STW %rp,-20(%sp) michael@0: STW,MA %r3,128(%sp) michael@0: michael@0: LDO -framesz(%r30),%r28 michael@0: STW %r28,-4(%r30) ; save previous sp michael@0: STW %r19,-32(%r30) michael@0: michael@0: STW %r26,-36-framesz(%r30) ; save argument registers in michael@0: STW %r25,-40-framesz(%r30) ; in PREVIOUS frame michael@0: STW %r24,-44-framesz(%r30) ; michael@0: STW %r23,-48-framesz(%r30) ; michael@0: michael@0: .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR ;in=24,25,26;out=28 michael@0: BL invoke_count_bytes,%r31 michael@0: COPY %r31,%r2 michael@0: michael@0: CMPIB,>= 0,%r28, .+76 michael@0: COPY %r30,%r3 ; copy stack ptr to saved stack ptr michael@0: ADD %r30,%r28,%r30 ; extend stack frame michael@0: LDW -4(%r3),%r28 ; move frame michael@0: STW %r28,-4(%r30) michael@0: LDW -8(%r3),%r28 michael@0: STW %r28,-8(%r30) michael@0: LDW -12(%r3),%r28 michael@0: STW %r28,-12(%r30) michael@0: LDW -16(%r3),%r28 michael@0: STW %r28,-16(%r30) michael@0: LDW -20(%r3),%r28 michael@0: STW %r28,-20(%r30) michael@0: LDW -24(%r3),%r28 michael@0: STW %r28,-24(%r30) michael@0: LDW -28(%r3),%r28 michael@0: STW %r28,-28(%r30) michael@0: LDW -32(%r3),%r28 michael@0: STW %r28,-32(%r30) michael@0: michael@0: LDO -40(%r30),%r26 ; load copy address michael@0: LDW -44-framesz(%r3),%r25 ; load rest of 2 arguments michael@0: LDW -48-framesz(%r3),%r24 ; michael@0: michael@0: LDW -32(%r30),%r19 ; shared lib call destroys r19; reload michael@0: .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR ;in=24,25,26 michael@0: BL invoke_copy_to_stack,%r31 michael@0: COPY %r31,%r2 michael@0: michael@0: LDO -48(%r30),%r20 michael@0: EXTRW,U,= %r28,31,1,%r22 michael@0: FLDD 0(%r20),%fr7 ; load double arg 1 michael@0: EXTRW,U,= %r28,30,1,%r22 michael@0: FLDW 8(%r20),%fr5L ; load float arg 1 michael@0: EXTRW,U,= %r28,29,1,%r22 michael@0: FLDW 4(%r20),%fr6L ; load float arg 2 michael@0: EXTRW,U,= %r28,28,1,%r22 michael@0: FLDW 0(%r20),%fr7L ; load float arg 3 michael@0: michael@0: LDW -36-framesz(%r3),%r26 ; load ptr to 'that' michael@0: LDW -40(%r30),%r25 ; load the rest of dispatch argument registers michael@0: LDW -44(%r30),%r24 michael@0: LDW -48(%r30),%r23 michael@0: michael@0: LDW -36-framesz(%r3),%r20 ; load vtable addr michael@0: LDW -40-framesz(%r3),%r28 ; load index michael@0: LDW 0(%r20),%r20 ; follow vtable michael@0: SH2ADDL %r28,%r20,%r28 ; add 4*index to vtable entry michael@0: LDW 0(%r28),%r22 ; load vtable entry michael@0: michael@0: .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR ;in=22-26;out=28; michael@0: BL $$dyncall,%r31 michael@0: COPY %r31,%r2 michael@0: michael@0: LDW -32(%r30),%r19 michael@0: COPY %r3,%r30 ; restore saved stack ptr michael@0: michael@0: LDW -148(%sp),%rp michael@0: LDWM -128(%sp),%r3 michael@0: BV,N (%rp) michael@0: NOP michael@0: .EXIT michael@0: .PROCEND ;in=23,24,25,26; michael@0: .SIZE NS_InvokeByIndex, .-NS_InvokeByIndex michael@0: