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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: asm; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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 /*
michael@0 8 Platform specific code to invoke XPCOM methods on native objects
michael@0 9 for sparcv9 Solaris.
michael@0 10
michael@0 11 See the SPARC Compliance Definition (SCD) Chapter 3
michael@0 12 for more information about what is going on here, including
michael@0 13 the use of BIAS (0x7ff).
michael@0 14 The SCD is available from http://www.sparc.com/.
michael@0 15 */
michael@0 16
michael@0 17 .global NS_InvokeByIndex
michael@0 18 .type NS_InvokeByIndex, #function
michael@0 19
michael@0 20 /*
michael@0 21 NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
michael@0 22 uint32_t paramCount, nsXPTCVariant* params);
michael@0 23
michael@0 24 */
michael@0 25 NS_InvokeByIndex:
michael@0 26 save %sp,-(128 + 64),%sp ! room for the register window and
michael@0 27 ! struct pointer, rounded up to 0 % 64
michael@0 28 sll %i2,4,%l0 ! assume the worst case
michael@0 29 ! paramCount * 2 * 8 bytes
michael@0 30 cmp %l0, 0 ! are there any args? If not,
michael@0 31 be .invoke ! no need to copy args to stack
michael@0 32 nop
michael@0 33
michael@0 34 sub %sp,%l0,%sp ! create the additional stack space
michael@0 35 add %sp,0x7ff+136,%o0 ! step past the register window, the
michael@0 36 ! struct result pointer and the 'this' slot
michael@0 37 mov %i2,%o1 ! paramCount
michael@0 38 call invoke_copy_to_stack
michael@0 39 mov %i3,%o2 ! params
michael@0 40
michael@0 41 !
michael@0 42 ! load arguments from stack into the outgoing registers
michael@0 43 ! BIAS is 0x7ff (2047)
michael@0 44 !
michael@0 45
michael@0 46 ! load the %o1..5 64bit (extended word) output registers registers
michael@0 47 ldx [%sp + 0x7ff + 136],%o1 ! %i1
michael@0 48 ldx [%sp + 0x7ff + 144],%o2 ! %i2
michael@0 49 ldx [%sp + 0x7ff + 152],%o3 ! %i3
michael@0 50 ldx [%sp + 0x7ff + 160],%o4 ! %i4
michael@0 51 ldx [%sp + 0x7ff + 168],%o5 ! %i5
michael@0 52
michael@0 53 ! load the even number double registers starting with %f2
michael@0 54 ldd [%sp + 0x7ff + 136],%f2
michael@0 55 ldd [%sp + 0x7ff + 144],%f4
michael@0 56 ldd [%sp + 0x7ff + 152],%f6
michael@0 57 ldd [%sp + 0x7ff + 160],%f8
michael@0 58 ldd [%sp + 0x7ff + 168],%f10
michael@0 59 ldd [%sp + 0x7ff + 176],%f12
michael@0 60 ldd [%sp + 0x7ff + 184],%f14
michael@0 61 ldd [%sp + 0x7ff + 192],%f16
michael@0 62 ldd [%sp + 0x7ff + 200],%f18
michael@0 63 ldd [%sp + 0x7ff + 208],%f20
michael@0 64 ldd [%sp + 0x7ff + 216],%f22
michael@0 65 ldd [%sp + 0x7ff + 224],%f24
michael@0 66 ldd [%sp + 0x7ff + 232],%f26
michael@0 67 ldd [%sp + 0x7ff + 240],%f28
michael@0 68 ldd [%sp + 0x7ff + 248],%f30
michael@0 69
michael@0 70 !
michael@0 71 ! calculate the target address from the vtable
michael@0 72 !
michael@0 73 .invoke:
michael@0 74 sll %i1,3,%l0 ! index *= 8
michael@0 75 ! add %l0,16,%l0 ! there are 2 extra entries in the vTable (16bytes)
michael@0 76 ldx [%i0],%l1 ! *that --> address of vtable
michael@0 77 ldx [%l0 + %l1],%l0 ! that->vtable[index * 8 + 16] --> address
michael@0 78
michael@0 79 jmpl %l0,%o7 ! call the routine
michael@0 80 mov %i0,%o0 ! move 'this' pointer to out register
michael@0 81
michael@0 82 mov %o0,%i0 ! propagate return value
michael@0 83 ret
michael@0 84 restore
michael@0 85
michael@0 86 .size NS_InvokeByIndex, .-NS_InvokeByIndex

mercurial