diff options
author | Keith Randall <khr@golang.org> | 2021-02-01 00:45:41 -0800 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2021-02-23 20:05:37 +0000 |
commit | c49c7a675a2c8ee7591a2d6243255813856b65ce (patch) | |
tree | d464e707368f75500d3bb32f2a023bb538b919f9 /src/runtime/preempt_amd64.s | |
parent | d2911d76127deaa08644979cec7d990559f0aa54 (diff) | |
download | go-c49c7a675a2c8ee7591a2d6243255813856b65ce.tar.gz go-c49c7a675a2c8ee7591a2d6243255813856b65ce.zip |
runtime: save R15 before checking AVX state
When in dynlink mode, reading a global can clobber R15.
Just to be safe, save R15 before checking the AVX state to see
if we need to VZEROUPPER or not.
This could cause a problem in buildmodes that aren't supported yet.
Change-Id: I8fda62d3fbe808584774fa5e8d9810a4612a84e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/288452
Trust: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/preempt_amd64.s')
-rw-r--r-- | src/runtime/preempt_amd64.s | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/runtime/preempt_amd64.s b/src/runtime/preempt_amd64.s index 92c664d79a..dc7af806d3 100644 --- a/src/runtime/preempt_amd64.s +++ b/src/runtime/preempt_amd64.s @@ -13,11 +13,6 @@ TEXT ·asyncPreempt<ABIInternal>(SB),NOSPLIT|NOFRAME,$0-0 ADJSP $368 // But vet doesn't know ADJSP, so suppress vet stack checking NOP SP - #ifdef GOOS_darwin - CMPB internal∕cpu·X86+const_offsetX86HasAVX(SB), $0 - JE 2(PC) - VZEROUPPER - #endif MOVQ AX, 0(SP) MOVQ CX, 8(SP) MOVQ DX, 16(SP) @@ -32,6 +27,11 @@ TEXT ·asyncPreempt<ABIInternal>(SB),NOSPLIT|NOFRAME,$0-0 MOVQ R13, 88(SP) MOVQ R14, 96(SP) MOVQ R15, 104(SP) + #ifdef GOOS_darwin + CMPB internal∕cpu·X86+const_offsetX86HasAVX(SB), $0 + JE 2(PC) + VZEROUPPER + #endif MOVUPS X0, 112(SP) MOVUPS X1, 128(SP) MOVUPS X2, 144(SP) |