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