github.com/mangodowner/go-gm@v0.0.0-20180818020936-8baa2bd4408c/src/runtime/cgo/gcc_mipsx.S (about)

     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  // +build mips mipsle
     6  
     7  /*
     8   * void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
     9   *
    10   * Calling into the gc tool chain, where all registers are caller save.
    11   * Called from standard MIPS O32 ABI, where $16-$23, $30, and $f20-$f31
    12   * are callee-save, so they must be saved explicitly, along with $31 (LR).
    13   */
    14  .globl crosscall1
    15  .set noat
    16  crosscall1:
    17  	addiu	$29, $29, -88
    18  
    19  	sw	$31, 0($29)
    20  	sw	$16, 4($29)
    21  	sw	$17, 8($29)
    22  	sw	$18, 12($29)
    23  	sw	$19, 16($29)
    24  	sw	$20, 20($29)
    25  	sw	$21, 24($29)
    26  	sw	$22, 28($29)
    27  	sw	$23, 32($29)
    28  	sw	$30, 36($29)
    29  
    30  	sdc1	$f20, 40($29)
    31  	sdc1	$f22, 48($29)
    32  	sdc1	$f24, 56($29)
    33  	sdc1	$f26, 64($29)
    34  	sdc1	$f28, 72($29)
    35  	sdc1	$f30, 80($29)
    36  
    37  
    38  	move	$20, $4 // save R4
    39  	move	$4, $6
    40  	jalr	$5	// call setg_gcc
    41  	jalr	$20	// call fn
    42  
    43  	lw	$16, 4($29)
    44  	lw	$17, 8($29)
    45  	lw	$18, 12($29)
    46  	lw	$19, 16($29)
    47  	lw	$20, 20($29)
    48  	lw	$21, 24($29)
    49  	lw	$22, 28($29)
    50  	lw	$23, 32($29)
    51  	lw	$30, 36($29)
    52  	ldc1	$f20, 40($29)
    53  	ldc1	$f22, 48($29)
    54  	ldc1	$f24, 56($29)
    55  	ldc1	$f26, 64($29)
    56  	ldc1	$f28, 72($29)
    57  	ldc1	$f30, 80($29)
    58  
    59  	lw	$31, 0($29)
    60  
    61  	addiu	$29, $29, 88
    62  	jr	$31
    63  
    64  .set at
    65  
    66  #ifdef __ELF__
    67  .section .note.GNU-stack,"",%progbits
    68  #endif