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

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

mercurial