Home | History | Annotate | Download | only in 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 // +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 #ifndef __mips_soft_float
     18 	addiu	$29, $29, -88
     19 #else
     20 	addiu	$29, $29, -40 // For soft-float, no need to make room for FP registers
     21 #endif
     22 	sw	$31, 0($29)
     23 	sw	$16, 4($29)
     24 	sw	$17, 8($29)
     25 	sw	$18, 12($29)
     26 	sw	$19, 16($29)
     27 	sw	$20, 20($29)
     28 	sw	$21, 24($29)
     29 	sw	$22, 28($29)
     30 	sw	$23, 32($29)
     31 	sw	$30, 36($29)
     32 
     33 #ifndef __mips_soft_float
     34 	sdc1	$f20, 40($29)
     35 	sdc1	$f22, 48($29)
     36 	sdc1	$f24, 56($29)
     37 	sdc1	$f26, 64($29)
     38 	sdc1	$f28, 72($29)
     39 	sdc1	$f30, 80($29)
     40 #endif
     41 	move	$20, $4 // save R4
     42 	move	$4, $6
     43 	jalr	$5	// call setg_gcc
     44 	jalr	$20	// call fn
     45 
     46 	lw	$16, 4($29)
     47 	lw	$17, 8($29)
     48 	lw	$18, 12($29)
     49 	lw	$19, 16($29)
     50 	lw	$20, 20($29)
     51 	lw	$21, 24($29)
     52 	lw	$22, 28($29)
     53 	lw	$23, 32($29)
     54 	lw	$30, 36($29)
     55 #ifndef __mips_soft_float
     56 	ldc1	$f20, 40($29)
     57 	ldc1	$f22, 48($29)
     58 	ldc1	$f24, 56($29)
     59 	ldc1	$f26, 64($29)
     60 	ldc1	$f28, 72($29)
     61 	ldc1	$f30, 80($29)
     62 #endif
     63 	lw	$31, 0($29)
     64 #ifndef __mips_soft_float
     65 	addiu	$29, $29, 88
     66 #else
     67 	addiu	$29, $29, 40
     68 #endif
     69 	jr	$31
     70 
     71 .set at
     72 
     73 #ifdef __ELF__
     74 .section .note.GNU-stack,"",%progbits
     75 #endif
     76