1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
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/. */
6
7        .global SharedStub
8
9/*
10    in the frame for the function that called SharedStub are the
11    rest of the parameters we need
12
13*/
14
15SharedStub:
16! we don't create a new frame yet, but work within the frame of the calling
17! function to give ourselves the other parameters we want
18
19        mov     %o0, %o1            ! shuffle the index up to 2nd place
20        mov     %i0, %o0            ! the original 'this'
21        add     %fp, 72, %o2        ! previous stack top adjusted to the first argument slot (beyond 'this')
22! save off the original incoming parameters that arrived in
23! registers, the ABI guarantees the space for us to do this
24        st      %i1, [%fp + 72]
25        st      %i2, [%fp + 76]
26        st      %i3, [%fp + 80]
27        st      %i4, [%fp + 84]
28        st      %i5, [%fp + 88]
29! now we can build our own stack frame
30        save    %sp,-(64 + 32),%sp   ! room for the register window and
31                                    ! struct pointer, rounded up to 0 % 32
32! our function now appears to have been called
33! as SharedStub(nsISupports* that, uint32_t index, uint32_t* args)
34! so we can just copy these through
35
36        mov     %i0, %o0
37        mov     %i1, %o1
38        mov     %i2, %o2
39        call    PrepareAndDispatch
40        nop
41        mov     %o0,%i0             ! propagate return value
42        b .LL1
43        nop
44.LL1:
45        ret
46        restore
47
48       .size    SharedStub, .-SharedStub
49       .type    SharedStub, #function
50