]> Cypherpunks repositories - gostls13.git/commitdiff
syscall, runtime/internal/syscall: always zero the higher bits of return value on...
authorGuoqi Chen <chenguoqi@loongson.cn>
Fri, 10 Jun 2022 11:08:14 +0000 (19:08 +0800)
committerGopher Robot <gobot@golang.org>
Wed, 15 Jun 2022 20:49:30 +0000 (20:49 +0000)
All loong64 syscalls return values only via R4/A0, and R5/A1 may contain unrelated
content. Always zero the second return value.

Change-Id: I62af59369bece5bd8028b937c74f4694150f7a55
Reviewed-on: https://go-review.googlesource.com/c/go/+/411615
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/internal/syscall/asm_linux_loong64.s
src/syscall/asm_linux_loong64.s

index ac500fb3b1195f67610b0b2730d8e48d33e0e4cb..d6a33f90a70a27e0370b8c046485b13827b4b4de 100644 (file)
@@ -24,6 +24,6 @@ TEXT ·Syscall6(SB),NOSPLIT,$0-80
        RET
 ok:
        MOVV    R4, r1+56(FP)
-       MOVV    R5, r2+64(FP)
+       MOVV    R0, r2+64(FP)   // r2 is not used. Always set to 0.
        MOVV    R0, errno+72(FP)
        RET
index 2e7d0c7a3e5c1447a0cc6d00a5aeae5fe16cfdfa..7dc69c6612f8a9186ce44e8c956d7ac24c294e60 100644 (file)
@@ -40,5 +40,5 @@ TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-48
        MOVV    trap+0(FP), R11 // syscall entry
        SYSCALL
        MOVV    R4, r1+32(FP)
-       MOVV    R5, r2+40(FP)
+       MOVV    R0, r2+40(FP)   // r2 is not used. Always set to 0.
        RET