]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/runtime/cgo/asm_amd64.s
runtime/cgo: store M for C-created thread in pthread key
[gostls13.git] / src / runtime / cgo / asm_amd64.s
index e223a6c8706c843f9436167b138522a5f6aef1c2..f254622f231f504ff62468d79abec7820d9ae4b3 100644 (file)
@@ -5,6 +5,14 @@
 #include "textflag.h"
 #include "abi_amd64.h"
 
+// Set the x_crosscall2_ptr C function pointer variable point to crosscall2.
+// It's such a pointer chain: _crosscall2_ptr -> x_crosscall2_ptr -> crosscall2
+TEXT ·set_crosscall2(SB),NOSPLIT,$0-0
+       MOVQ    _crosscall2_ptr(SB), AX
+       MOVQ    $crosscall2(SB), BX
+       MOVQ    BX, (AX)
+       RET
+
 // Called by C code generated by cmd/cgo.
 // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr)
 // Saves C callee-saved registers and calls cgocallback with three arguments.