diff options
| author | Cherry Zhang <cherryyz@google.com> | 2021-02-04 11:41:34 -0500 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2021-02-08 17:48:48 +0000 |
| commit | 22f9e1ccbc9db9a1d9ecbadca972264e5ad2f169 (patch) | |
| tree | 0ca9252b1e3287d4f6ff77ef6c429df0dae5bb77 /src/runtime/asm_amd64.s | |
| parent | 5d7dc53888c3c91ef4122d584a064bc24b6f7540 (diff) | |
| download | go-22f9e1ccbc9db9a1d9ecbadca972264e5ad2f169.tar.xz | |
[dev.regabi] runtime: initialize special registers before sigpanic
In case that we are panicking in ABI0 context or external code,
special registers are not initialized. Initialized them in
injected code before calling sigpanic.
TODO: Windows, Plan 9.
Change-Id: I0919b80e7cc55463f3dd94f1f63cba305717270a
Reviewed-on: https://go-review.googlesource.com/c/go/+/289710
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/asm_amd64.s')
| -rw-r--r-- | src/runtime/asm_amd64.s | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 9f15990b13..83c08a52f7 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -1364,6 +1364,18 @@ TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0 POPQ R15 RET +// Initialize special registers then jump to sigpanic. +// This function is injected from the signal handler for panicking +// signals. It is quite painful to set X15 in the signal context, +// so we do it here. +TEXT ·sigpanic0<ABIInternal>(SB),NOSPLIT,$0-0 +#ifdef GOEXPERIMENT_REGABI + get_tls(R14) + MOVQ g(R14), R14 + XORPS X15, X15 +#endif + JMP ·sigpanic<ABIInternal>(SB) + // gcWriteBarrier performs a heap pointer write and informs the GC. // // gcWriteBarrier does NOT follow the Go ABI. It takes two arguments: |
