1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc64_openbsd.s Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,86 @@ 1.4 +/* -*- Mode: asm; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 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 +/* 1.11 + Platform specific code to invoke XPCOM methods on native objects 1.12 + for sparcv9 Solaris. 1.13 + 1.14 + See the SPARC Compliance Definition (SCD) Chapter 3 1.15 + for more information about what is going on here, including 1.16 + the use of BIAS (0x7ff). 1.17 + The SCD is available from http://www.sparc.com/. 1.18 +*/ 1.19 + 1.20 + .global NS_InvokeByIndex 1.21 + .type NS_InvokeByIndex, #function 1.22 + 1.23 +/* 1.24 + NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex, 1.25 + uint32_t paramCount, nsXPTCVariant* params); 1.26 + 1.27 +*/ 1.28 +NS_InvokeByIndex: 1.29 + save %sp,-(128 + 64),%sp ! room for the register window and 1.30 + ! struct pointer, rounded up to 0 % 64 1.31 + sll %i2,4,%l0 ! assume the worst case 1.32 + ! paramCount * 2 * 8 bytes 1.33 + cmp %l0, 0 ! are there any args? If not, 1.34 + be .invoke ! no need to copy args to stack 1.35 + nop 1.36 + 1.37 + sub %sp,%l0,%sp ! create the additional stack space 1.38 + add %sp,0x7ff+136,%o0 ! step past the register window, the 1.39 + ! struct result pointer and the 'this' slot 1.40 + mov %i2,%o1 ! paramCount 1.41 + call invoke_copy_to_stack 1.42 + mov %i3,%o2 ! params 1.43 + 1.44 +! 1.45 +! load arguments from stack into the outgoing registers 1.46 +! BIAS is 0x7ff (2047) 1.47 +! 1.48 + 1.49 +! load the %o1..5 64bit (extended word) output registers registers 1.50 + ldx [%sp + 0x7ff + 136],%o1 ! %i1 1.51 + ldx [%sp + 0x7ff + 144],%o2 ! %i2 1.52 + ldx [%sp + 0x7ff + 152],%o3 ! %i3 1.53 + ldx [%sp + 0x7ff + 160],%o4 ! %i4 1.54 + ldx [%sp + 0x7ff + 168],%o5 ! %i5 1.55 + 1.56 +! load the even number double registers starting with %f2 1.57 + ldd [%sp + 0x7ff + 136],%f2 1.58 + ldd [%sp + 0x7ff + 144],%f4 1.59 + ldd [%sp + 0x7ff + 152],%f6 1.60 + ldd [%sp + 0x7ff + 160],%f8 1.61 + ldd [%sp + 0x7ff + 168],%f10 1.62 + ldd [%sp + 0x7ff + 176],%f12 1.63 + ldd [%sp + 0x7ff + 184],%f14 1.64 + ldd [%sp + 0x7ff + 192],%f16 1.65 + ldd [%sp + 0x7ff + 200],%f18 1.66 + ldd [%sp + 0x7ff + 208],%f20 1.67 + ldd [%sp + 0x7ff + 216],%f22 1.68 + ldd [%sp + 0x7ff + 224],%f24 1.69 + ldd [%sp + 0x7ff + 232],%f26 1.70 + ldd [%sp + 0x7ff + 240],%f28 1.71 + ldd [%sp + 0x7ff + 248],%f30 1.72 + 1.73 +! 1.74 +! calculate the target address from the vtable 1.75 +! 1.76 +.invoke: 1.77 + sll %i1,3,%l0 ! index *= 8 1.78 +! add %l0,16,%l0 ! there are 2 extra entries in the vTable (16bytes) 1.79 + ldx [%i0],%l1 ! *that --> address of vtable 1.80 + ldx [%l0 + %l1],%l0 ! that->vtable[index * 8 + 16] --> address 1.81 + 1.82 + jmpl %l0,%o7 ! call the routine 1.83 + mov %i0,%o0 ! move 'this' pointer to out register 1.84 + 1.85 + mov %o0,%i0 ! propagate return value 1.86 + ret 1.87 + restore 1.88 + 1.89 + .size NS_InvokeByIndex, .-NS_InvokeByIndex