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.
5 //go:build mips || mipsle
9 // Called by C code generated by cmd/cgo.
10 // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr)
11 // Saves C callee-saved registers and calls cgocallback with three arguments.
12 // fn is the PC of a func(a unsafe.Pointer) function.
13 TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0
15 * We still need to save all callee save register as before, and then
16 * push 3 args for fn (R4, R5, R7), skipping R6.
17 * Also note that at procedure entry in gc world, 4(R29) will be the
21 // Space for 9 caller-saved GPR + LR + 6 caller-saved FPR.
22 // O32 ABI allows us to smash 16 bytes argument area of caller frame.
23 #ifndef GOMIPS_softfloat
24 SUBU $(4*14+8*6-16), R29
26 SUBU $(4*14-16), R29 // For soft-float, no FPR.
28 MOVW R4, (4*1)(R29) // fn unsafe.Pointer
29 MOVW R5, (4*2)(R29) // a unsafe.Pointer
30 MOVW R7, (4*3)(R29) // ctxt uintptr
41 #ifndef GOMIPS_softfloat
43 MOVD F22, (4*14+8*1)(R29)
44 MOVD F24, (4*14+8*2)(R29)
45 MOVD F26, (4*14+8*3)(R29)
46 MOVD F28, (4*14+8*4)(R29)
47 MOVD F30, (4*14+8*5)(R29)
49 JAL runtimeĀ·load_g(SB)
51 JAL runtimeĀ·cgocallback(SB)
63 #ifndef GOMIPS_softfloat
65 MOVD (4*14+8*1)(R29), F22
66 MOVD (4*14+8*2)(R29), F24
67 MOVD (4*14+8*3)(R29), F26
68 MOVD (4*14+8*4)(R29), F28
69 MOVD (4*14+8*5)(R29), F30
71 ADDU $(4*14+8*6-16), R29