]> Cypherpunks repositories - gostls13.git/commit
runtime,runtime/cgo: save all necessary registers on entry to Go on Windows
authorAustin Clements <austin@google.com>
Tue, 13 Apr 2021 13:06:50 +0000 (09:06 -0400)
committerAustin Clements <austin@google.com>
Thu, 15 Apr 2021 12:38:11 +0000 (12:38 +0000)
commitdba2eab8267599f5f59f1f586b47f31b6552938c
tree9bf0361a5b89b5efc48720b5f58b7a0f71ac5f3c
parent3e0b1cdb5d92ac45a28c3c8224e1b6ab41bff99d
runtime,runtime/cgo: save all necessary registers on entry to Go on Windows

There are several assembly functions that transition from the Windows
ABI to the Go ABI. These all need to save all registers that are
callee-save in the Windows ABI and caller-save in the Go ABI and
prepare the register state for Go. However, they all do this slightly
differently and most of them don't save the necessary XMM registers
for this transition (which could corrupt them in the C caller).
Furthermore, now that we have a carefully specified Go ABI, it's clear
that none of these actually get all of the details 100% right.

So, unify this code into two macros in a shared header in
runtime/cgo/abi_amd64.h that handle all necessary registers and setup
and use these macros everywhere on Windows that handles transitions
from C to Go.

Change-Id: I62f41345a507aad1ca383814ac8b7e2a9ffb821e
Reviewed-on: https://go-review.googlesource.com/c/go/+/309769
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/cmd/internal/obj/x86/obj6.go
src/runtime/cgo/abi_amd64.h [new file with mode: 0644]
src/runtime/cgo/asm_amd64.s
src/runtime/sys_windows_amd64.s