Text file src/runtime/cgo/gcc_mips64x.S

     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 mips64 mips64le
     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 N64 ABI, where $16-$23, $28, $30, and $f24-$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  #ifndef __mips_soft_float
    18  	daddiu	$29, $29, -160
    19  #else
    20  	daddiu	$29, $29, -96 // For soft-float, no need to make room for FP registers
    21  #endif
    22  	sd	$31, 0($29)
    23  	sd	$16, 8($29)
    24  	sd	$17, 16($29)
    25  	sd	$18, 24($29)
    26  	sd	$19, 32($29)
    27  	sd	$20, 40($29)
    28  	sd	$21, 48($29)
    29  	sd	$22, 56($29)
    30  	sd	$23, 64($29)
    31  	sd	$28, 72($29)
    32  	sd	$30, 80($29)
    33  #ifndef __mips_soft_float
    34  	sdc1	$f24, 88($29)
    35  	sdc1	$f25, 96($29)
    36  	sdc1	$f26, 104($29)
    37  	sdc1	$f27, 112($29)
    38  	sdc1	$f28, 120($29)
    39  	sdc1	$f29, 128($29)
    40  	sdc1	$f30, 136($29)
    41  	sdc1	$f31, 144($29)
    42  #endif
    43  
    44  	// prepare SB register = pc & 0xffffffff00000000
    45  	bal	1f
    46  1:
    47  	dsrl	$28, $31, 32
    48  	dsll	$28, $28, 32
    49  
    50  	move	$20, $4 // save R4
    51  	move	$1, $6
    52  	jalr	$5	// call setg_gcc (clobbers R4)
    53  	jalr	$20	// call fn
    54  
    55  	ld	$16, 8($29)
    56  	ld	$17, 16($29)
    57  	ld	$18, 24($29)
    58  	ld	$19, 32($29)
    59  	ld	$20, 40($29)
    60  	ld	$21, 48($29)
    61  	ld	$22, 56($29)
    62  	ld	$23, 64($29)
    63  	ld	$28, 72($29)
    64  	ld	$30, 80($29)
    65  #ifndef __mips_soft_float
    66  	ldc1	$f24, 88($29)
    67  	ldc1	$f25, 96($29)
    68  	ldc1	$f26, 104($29)
    69  	ldc1	$f27, 112($29)
    70  	ldc1	$f28, 120($29)
    71  	ldc1	$f29, 128($29)
    72  	ldc1	$f30, 136($29)
    73  	ldc1	$f31, 144($29)
    74  #endif
    75  	ld	$31, 0($29)
    76  #ifndef __mips_soft_float
    77  	daddiu	$29, $29, 160
    78  #else
    79  	daddiu	$29, $29, 96
    80  #endif
    81  	jr	$31
    82  
    83  .set at
    84  
    85  #ifdef __ELF__
    86  .section .note.GNU-stack,"",%progbits
    87  #endif
    88  

View as plain text