diff options
author | Russ Cox <rsc@golang.org> | 2021-01-28 09:23:35 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2021-02-19 00:04:14 +0000 |
commit | b19e7b518e564cd309d3eb68dfd2da8839a7433b (patch) | |
tree | e7e5d3e103070df944a8e7672ba0ed5cadaea49a /src/runtime/signal_windows.go | |
parent | 5421c37a1db5098659f86b21d011fc263d93524e (diff) | |
download | go-b19e7b518e564cd309d3eb68dfd2da8839a7433b.tar.gz go-b19e7b518e564cd309d3eb68dfd2da8839a7433b.zip |
runtime: clean up windows a bit
Document the various hard-coded architecture checks
or remove them in favor of more general checks.
This should be a no-op now but will make the arm64 port
have fewer diffs.
This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.
Change-Id: Ifd6b19e44e8c9ca4a0d2590f314928ce235821b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/288813
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Diffstat (limited to 'src/runtime/signal_windows.go')
-rw-r--r-- | src/runtime/signal_windows.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go index 18834b0ec5..cb1fbe9f81 100644 --- a/src/runtime/signal_windows.go +++ b/src/runtime/signal_windows.go @@ -5,6 +5,7 @@ package runtime import ( + "runtime/internal/sys" "unsafe" ) @@ -132,16 +133,14 @@ func exceptionhandler(info *exceptionrecord, r *context, gp *g) int32 { // overwrite the PC. (See issue #35773) if r.ip() != 0 && r.ip() != funcPC(asyncPreempt) { sp := unsafe.Pointer(r.sp()) - sp = add(sp, ^(unsafe.Sizeof(uintptr(0)) - 1)) // sp-- + delta := uintptr(sys.StackAlign) + sp = add(sp, -delta) r.set_sp(uintptr(sp)) - switch GOARCH { - default: - panic("unsupported architecture") - case "386", "amd64": - *((*uintptr)(sp)) = r.ip() - case "arm": + if usesLR { *((*uintptr)(sp)) = r.lr() r.set_lr(r.ip()) + } else { + *((*uintptr)(sp)) = r.ip() } } r.set_ip(funcPC(sigpanic)) |