From 66865363f017a8d4cb0b07d84a3a6117fcf1cd30 Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Wed, 16 Mar 2022 19:21:49 -0400 Subject: [PATCH] syscall: call ABI0 exitsyscall on Plan 9/AMD64 CL 376356 changes syscall.Syscall to call ABIInternal entersyscall and exitsyscall. As mentioned in the CL description, it is important to call entersyscall without ABI wrapper, but it is not important to call exitsyscall this way. In fact, it is actually problematic -- on Plan 9, syscall may clobber our fixed G register, and we did not restore it. This CL changes it back to ABI0 exitsyscall, which will restore the G register through the wrapper. Should fix Plan 9/AMD64 build. Change-Id: I1f03d553f03e7b9f36d64686f20f2b2df0a0bf79 Reviewed-on: https://go-review.googlesource.com/c/go/+/393494 Trust: Cherry Mui Run-TryBot: Cherry Mui Reviewed-by: Michael Knyszek --- src/syscall/asm_plan9_amd64.s | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/syscall/asm_plan9_amd64.s b/src/syscall/asm_plan9_amd64.s index f22db3238d2..0641513f376 100644 --- a/src/syscall/asm_plan9_amd64.s +++ b/src/syscall/asm_plan9_amd64.s @@ -38,7 +38,7 @@ TEXT ·Syscall(SB),NOSPLIT,$168-64 MOVQ $128, sysargs1-152(SP) MOVQ $SYS_ERRSTR, BP SYSCALL - CALL runtime·exitsyscall(SB) + CALL runtime·exitsyscall(SB) // call via ABI wrapper, ensuring ABIInternal fixed registers are set MOVQ sysargs-160(SP), AX MOVQ AX, errbuf-168(SP) CALL runtime·gostring(SB) @@ -46,7 +46,7 @@ TEXT ·Syscall(SB),NOSPLIT,$168-64 JMP copyresult3 ok3: - CALL runtime·exitsyscall(SB) + CALL runtime·exitsyscall(SB) // call via ABI wrapper, ensuring ABIInternal fixed registers are set LEAQ ·emptystring(SB), SI copyresult3: @@ -83,7 +83,7 @@ TEXT ·Syscall6(SB),NOSPLIT,$168-88 MOVQ $128, sysargs1-152(SP) MOVQ $SYS_ERRSTR, BP SYSCALL - CALL runtime·exitsyscall(SB) + CALL runtime·exitsyscall(SB) // call via ABI wrapper, ensuring ABIInternal fixed registers are set MOVQ sysargs-160(SP), AX MOVQ AX, errbuf-168(SP) CALL runtime·gostring(SB) @@ -91,7 +91,7 @@ TEXT ·Syscall6(SB),NOSPLIT,$168-88 JMP copyresult4 ok4: - CALL runtime·exitsyscall(SB) + CALL runtime·exitsyscall(SB) // call via ABI wrapper, ensuring ABIInternal fixed registers are set LEAQ ·emptystring(SB), SI copyresult4: