From cf9263dee1bb160f013a080bbda3532a7d35da15 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Fri, 16 Dec 2022 16:54:03 +0100 Subject: runtime: factor out windows sigtramp This CL factors out part of the Windows sigtramp implementation, which was duplicated in all four architectures. The new common code is implemented in Go rather than in assembly, which will make Windows error handling easier to reason and maintain. While here, implement the control flow guard workaround on windows/386, which almost comes for free. Change-Id: I0bf38c28c54793225126e161bd95527a62de05e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/458135 Run-TryBot: Quim Muntal Reviewed-by: Cherry Mui Reviewed-by: Alex Brainman TryBot-Result: Gopher Robot Reviewed-by: Bryan Mills Reviewed-by: Michael Pratt --- src/runtime/defs_windows_amd64.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/runtime/defs_windows_amd64.go') diff --git a/src/runtime/defs_windows_amd64.go b/src/runtime/defs_windows_amd64.go index ac636a68ec..afa8a657b8 100644 --- a/src/runtime/defs_windows_amd64.go +++ b/src/runtime/defs_windows_amd64.go @@ -70,6 +70,11 @@ func (c *context) set_lr(x uintptr) {} func (c *context) set_ip(x uintptr) { c.rip = uint64(x) } func (c *context) set_sp(x uintptr) { c.rsp = uint64(x) } +func prepareContextForSigResume(c *context) { + c.r8 = c.rsp + c.r9 = c.rip +} + func dumpregs(r *context) { print("rax ", hex(r.rax), "\n") print("rbx ", hex(r.rbx), "\n") -- cgit v1.3