]> Cypherpunks.ru repositories - gostls13.git/blob - src/runtime/cgo/asm_arm64.s
Revert "runtime/cgo: store M for C-created thread in pthread key"
[gostls13.git] / src / runtime / cgo / asm_arm64.s
1 // Copyright 2015 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 #include "textflag.h"
6 #include "abi_arm64.h"
7
8 // Called by C code generated by cmd/cgo.
9 // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr)
10 // Saves C callee-saved registers and calls cgocallback with three arguments.
11 // fn is the PC of a func(a unsafe.Pointer) function.
12 TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0
13         /*
14          * We still need to save all callee save register as before, and then
15          *  push 3 args for fn (R0, R1, R3), skipping R2.
16          * Also note that at procedure entry in gc world, 8(RSP) will be the
17          *  first arg.
18          */
19         SUB     $(8*24), RSP
20         STP     (R0, R1), (8*1)(RSP)
21         MOVD    R3, (8*3)(RSP)
22
23         SAVE_R19_TO_R28(8*4)
24         SAVE_F8_TO_F15(8*14)
25         STP     (R29, R30), (8*22)(RSP)
26
27
28         // Initialize Go ABI environment
29         BL      runtimeĀ·load_g(SB)
30         BL      runtimeĀ·cgocallback(SB)
31
32         RESTORE_R19_TO_R28(8*4)
33         RESTORE_F8_TO_F15(8*14)
34         LDP     (8*22)(RSP), (R29, R30)
35
36         ADD     $(8*24), RSP
37         RET