xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s.m4

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s.m4	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,75 @@
     1.4 +/* -*- Mode: asm; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * Version: MPL 1.1
     1.6 + *
     1.7 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +/* This code is for MIPS using the O32 ABI. */
    1.12 +
    1.13 +#include <sys/regdef.h>
    1.14 +#include <sys/asm.h>
    1.15 +
    1.16 +	.text
    1.17 +	.globl PrepareAndDispatch
    1.18 +
    1.19 +NARGSAVE=4  # extra space for the callee to use.  gccism
    1.20 +            # we can put our a0-a3 in our callers space.
    1.21 +LOCALSZ=2   # gp, ra
    1.22 +FRAMESZ=(((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK
    1.23 +
    1.24 +define(STUB_NAME, `Stub'$1`__14nsXPTCStubBase')
    1.25 +
    1.26 +define(STUB_ENTRY,
    1.27 +`	.globl		'STUB_NAME($1)`
    1.28 +	.align		2
    1.29 +	.type		'STUB_NAME($1)`,@function
    1.30 +	.ent		'STUB_NAME($1)`, 0
    1.31 +'STUB_NAME($1)`:
    1.32 +	.frame		sp, FRAMESZ, ra 
    1.33 +	.set		noreorder
    1.34 +	.cpload		t9
    1.35 +	.set		reorder
    1.36 +	subu		sp, FRAMESZ
    1.37 +	.cprestore	16	
    1.38 +	li		t0, '$1`
    1.39 +	b		sharedstub
    1.40 +.end			'STUB_NAME($1)`
    1.41 +
    1.42 +')
    1.43 +
    1.44 +define(SENTINEL_ENTRY, `')
    1.45 +
    1.46 +include(xptcstubsdef.inc)
    1.47 +
    1.48 +	.globl	sharedstub
    1.49 +	.ent	sharedstub
    1.50 +sharedstub:
    1.51 +
    1.52 +	REG_S	ra, 20(sp)
    1.53 +
    1.54 +	REG_S	a0, 24(sp)
    1.55 +	REG_S	a1, 28(sp)
    1.56 +	REG_S	a2, 32(sp)
    1.57 +	REG_S	a3, 36(sp)
    1.58 +
    1.59 +	# t0 is methodIndex
    1.60 +	move	a1, t0
    1.61 +
    1.62 +	# put the start of a1, a2, a3, and stack
    1.63 +	move	a2, sp
    1.64 +	addi	a2, 24  # have a2 point to sp + 24 (where a0 is)
    1.65 +
    1.66 +	# PrepareAndDispatch(that, methodIndex, args)
    1.67 +	#                     a0       a1        a2
    1.68 +	#
    1.69 +	jal	PrepareAndDispatch
    1.70 +
    1.71 +	REG_L	ra, 20(sp)
    1.72 +	REG_L	a1, 28(sp)
    1.73 +	REG_L	a2, 32(sp)
    1.74 +
    1.75 +	addu	sp, FRAMESZ
    1.76 +	j	ra
    1.77 +
    1.78 +.end sharedstub

mercurial