...

Text file src/runtime/cgo/gcc_mipsx.S

Documentation: runtime/cgo

     1// Copyright 2016 The Go Authors. All rights reserved.
     2// Use of this source code is governed by a BSD-style
     3// license that can be found in the LICENSE file.
     4
     5//go:build mips || mipsle
     6
     7.file "gcc_mipsx.S"
     8
     9/*
    10 * void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
    11 *
    12 * Calling into the gc tool chain, where all registers are caller save.
    13 * Called from standard MIPS O32 ABI, where $16-$23, $30, and $f20-$f31
    14 * are callee-save, so they must be saved explicitly, along with $31 (LR).
    15 */
    16.globl crosscall1
    17.set noat
    18crosscall1:
    19#ifndef __mips_soft_float
    20	addiu	$29, $29, -88
    21#else
    22	addiu	$29, $29, -40 // For soft-float, no need to make room for FP registers
    23#endif
    24	sw	$31, 0($29)
    25	sw	$16, 4($29)
    26	sw	$17, 8($29)
    27	sw	$18, 12($29)
    28	sw	$19, 16($29)
    29	sw	$20, 20($29)
    30	sw	$21, 24($29)
    31	sw	$22, 28($29)
    32	sw	$23, 32($29)
    33	sw	$30, 36($29)
    34
    35#ifndef __mips_soft_float
    36	sdc1	$f20, 40($29)
    37	sdc1	$f22, 48($29)
    38	sdc1	$f24, 56($29)
    39	sdc1	$f26, 64($29)
    40	sdc1	$f28, 72($29)
    41	sdc1	$f30, 80($29)
    42#endif
    43	move	$20, $4 // save R4
    44	move	$4, $6
    45	jalr	$5	// call setg_gcc
    46	jalr	$20	// call fn
    47
    48	lw	$16, 4($29)
    49	lw	$17, 8($29)
    50	lw	$18, 12($29)
    51	lw	$19, 16($29)
    52	lw	$20, 20($29)
    53	lw	$21, 24($29)
    54	lw	$22, 28($29)
    55	lw	$23, 32($29)
    56	lw	$30, 36($29)
    57#ifndef __mips_soft_float
    58	ldc1	$f20, 40($29)
    59	ldc1	$f22, 48($29)
    60	ldc1	$f24, 56($29)
    61	ldc1	$f26, 64($29)
    62	ldc1	$f28, 72($29)
    63	ldc1	$f30, 80($29)
    64#endif
    65	lw	$31, 0($29)
    66#ifndef __mips_soft_float
    67	addiu	$29, $29, 88
    68#else
    69	addiu	$29, $29, 40
    70#endif
    71	jr	$31
    72
    73.set at
    74
    75#ifdef __ELF__
    76.section .note.GNU-stack,"",%progbits
    77#endif

View as plain text