1
0
mirror of https://github.com/golang/go synced 2024-11-24 04:30:14 -07:00

Revert "syscall: define Syscall6 in terms of RawSyscall6 on linux"

This reverts CL 388478. Parent CL 388477 breaks cmd/go
TestScript/cover_pkgall_runtime.

For #51087.
For #52472.

Change-Id: Id5d5a4e138792cf130ecdcc6b996c8102d142a7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/401635
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Michael Pratt 2022-04-21 14:49:54 -04:00 committed by Gopher Robot
parent 347534343b
commit d35ec0b899
10 changed files with 242 additions and 10 deletions

View File

@ -13,6 +13,32 @@
// instead of the glibc-specific "CALL 0x10(GS)".
#define INVOKE_SYSCALL INT $0x80
// func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
TEXT ·Syscall6(SB),NOSPLIT,$0-40
CALL runtime·entersyscall(SB)
MOVL trap+0(FP), AX // syscall entry
MOVL a1+4(FP), BX
MOVL a2+8(FP), CX
MOVL a3+12(FP), DX
MOVL a4+16(FP), SI
MOVL a5+20(FP), DI
MOVL a6+24(FP), BP
INVOKE_SYSCALL
CMPL AX, $0xfffff001
JLS ok6
MOVL $-1, r1+28(FP)
MOVL $0, r2+32(FP)
NEGL AX
MOVL AX, err+36(FP)
CALL runtime·exitsyscall(SB)
RET
ok6:
MOVL AX, r1+28(FP)
MOVL DX, r2+32(FP)
MOVL $0, err+36(FP)
CALL runtime·exitsyscall(SB)
RET
// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-16
MOVL trap+0(FP), AX // syscall entry

View File

@ -11,6 +11,32 @@
#define SYS_gettimeofday 96
// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
TEXT ·Syscall6(SB),NOSPLIT,$0-80
CALL runtime·entersyscall<ABIInternal>(SB)
MOVQ a1+8(FP), DI
MOVQ a2+16(FP), SI
MOVQ a3+24(FP), DX
MOVQ a4+32(FP), R10
MOVQ a5+40(FP), R8
MOVQ a6+48(FP), R9
MOVQ trap+0(FP), AX // syscall entry
SYSCALL
CMPQ AX, $0xfffffffffffff001
JLS ok6
MOVQ $-1, r1+56(FP)
MOVQ $0, r2+64(FP)
NEGQ AX
MOVQ AX, err+72(FP)
CALL runtime·exitsyscall<ABIInternal>(SB)
RET
ok6:
MOVQ AX, r1+56(FP)
MOVQ DX, r2+64(FP)
MOVQ $0, err+72(FP)
CALL runtime·exitsyscall<ABIInternal>(SB)
RET
// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-32
MOVQ a1+8(FP), DI

View File

@ -9,6 +9,37 @@
// System calls for arm, Linux
//
// func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
// Actually Syscall5 but the rest of the code expects it to be named Syscall6.
TEXT ·Syscall6(SB),NOSPLIT,$0-40
BL runtime·entersyscall(SB)
MOVW trap+0(FP), R7 // syscall entry
MOVW a1+4(FP), R0
MOVW a2+8(FP), R1
MOVW a3+12(FP), R2
MOVW a4+16(FP), R3
MOVW a5+20(FP), R4
MOVW a6+24(FP), R5
SWI $0
MOVW $0xfffff001, R6
CMP R6, R0
BLS ok6
MOVW $-1, R1
MOVW R1, r1+28(FP)
MOVW $0, R2
MOVW R2, r2+32(FP)
RSB $0, R0, R0
MOVW R0, err+36(FP)
BL runtime·exitsyscall(SB)
RET
ok6:
MOVW R0, r1+28(FP)
MOVW R1, r2+32(FP)
MOVW $0, R0
MOVW R0, err+36(FP)
BL runtime·exitsyscall(SB)
RET
#define SYS__LLSEEK 140 /* from zsysnum_linux_arm.go */
// func seek(fd int, offset int64, whence int) (newoffset int64, errno int)
// Implemented in assembly to avoid allocation when

View File

@ -4,6 +4,32 @@
#include "textflag.h"
TEXT ·Syscall6(SB),NOSPLIT,$0-80
BL runtime·entersyscall<ABIInternal>(SB)
MOVD a1+8(FP), R0
MOVD a2+16(FP), R1
MOVD a3+24(FP), R2
MOVD a4+32(FP), R3
MOVD a5+40(FP), R4
MOVD a6+48(FP), R5
MOVD trap+0(FP), R8 // syscall entry
SVC
CMN $4095, R0
BCC ok
MOVD $-1, R4
MOVD R4, r1+56(FP) // r1
MOVD ZR, r2+64(FP) // r2
NEG R0, R0
MOVD R0, err+72(FP) // errno
BL runtime·exitsyscall<ABIInternal>(SB)
RET
ok:
MOVD R0, r1+56(FP) // r1
MOVD R1, r2+64(FP) // r2
MOVD ZR, err+72(FP) // errno
BL runtime·exitsyscall<ABIInternal>(SB)
RET
// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
TEXT ·rawVforkSyscall(SB),NOSPLIT,$0-32
MOVD a1+8(FP), R0

View File

@ -10,6 +10,30 @@
// System calls for mips64, Linux
//
TEXT ·Syscall6(SB),NOSPLIT,$0-80
JAL runtime·entersyscall(SB)
MOVV a1+8(FP), R4
MOVV a2+16(FP), R5
MOVV a3+24(FP), R6
MOVV a4+32(FP), R7
MOVV a5+40(FP), R8
MOVV a6+48(FP), R9
MOVV trap+0(FP), R2 // syscall entry
SYSCALL
BEQ R7, ok6
MOVV $-1, R1
MOVV R1, r1+56(FP) // r1
MOVV R0, r2+64(FP) // r2
MOVV R2, err+72(FP) // errno
JAL runtime·exitsyscall(SB)
RET
ok6:
MOVV R2, r1+56(FP) // r1
MOVV R3, r2+64(FP) // r2
MOVV R0, err+72(FP) // errno
JAL runtime·exitsyscall(SB)
RET
// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-32
MOVV a1+8(FP), R4

View File

@ -11,6 +11,36 @@
// System calls for mips, Linux
//
// func Syscall6(trap trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
// 5th and 6th arg go at sp+16, sp+20.
// Note that frame size of 20 means that 24 bytes gets reserved on stack.
TEXT ·Syscall6(SB),NOSPLIT,$20-40
NO_LOCAL_POINTERS
JAL runtime·entersyscall(SB)
MOVW a1+4(FP), R4
MOVW a2+8(FP), R5
MOVW a3+12(FP), R6
MOVW a4+16(FP), R7
MOVW a5+20(FP), R8
MOVW a6+24(FP), R9
MOVW R8, 16(R29)
MOVW R9, 20(R29)
MOVW trap+0(FP), R2 // syscall entry
SYSCALL
BEQ R7, ok6
MOVW $-1, R1
MOVW R1, r1+28(FP) // r1
MOVW R0, r2+32(FP) // r2
MOVW R2, err+36(FP) // errno
JAL runtime·exitsyscall(SB)
RET
ok6:
MOVW R2, r1+28(FP) // r1
MOVW R3, r2+32(FP) // r2
MOVW R0, err+36(FP) // errno
JAL runtime·exitsyscall(SB)
RET
// func Syscall9(trap trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, err uintptr);
// Actually Syscall8 but the rest of the code expects it to be named Syscall9.
TEXT ·Syscall9(SB),NOSPLIT,$28-52

View File

@ -10,6 +10,30 @@
// System calls for ppc64, Linux
//
TEXT ·Syscall6(SB),NOSPLIT,$0-80
BL runtime·entersyscall<ABIInternal>(SB)
MOVD a1+8(FP), R3
MOVD a2+16(FP), R4
MOVD a3+24(FP), R5
MOVD a4+32(FP), R6
MOVD a5+40(FP), R7
MOVD a6+48(FP), R8
MOVD trap+0(FP), R9 // syscall entry
SYSCALL R9
BVC ok6
MOVD $-1, R4
MOVD R4, r1+56(FP) // r1
MOVD R0, r2+64(FP) // r2
MOVD R3, err+72(FP) // errno
BL runtime·exitsyscall<ABIInternal>(SB)
RET
ok6:
MOVD R3, r1+56(FP) // r1
MOVD R0, r2+64(FP) // r2
MOVD R0, err+72(FP) // errno
BL runtime·exitsyscall<ABIInternal>(SB)
RET
// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-32
MOVD a1+8(FP), R3

View File

@ -8,6 +8,33 @@
// System calls for riscv64, Linux
//
// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
TEXT ·Syscall6(SB),NOSPLIT,$0-80
CALL runtime·entersyscall(SB)
MOV a1+8(FP), A0
MOV a2+16(FP), A1
MOV a3+24(FP), A2
MOV a4+32(FP), A3
MOV a5+40(FP), A4
MOV a6+48(FP), A5
MOV trap+0(FP), A7 // syscall entry
ECALL
MOV $-4096, T0
BLTU T0, A0, err
MOV A0, r1+56(FP) // r1
MOV A1, r2+64(FP) // r2
MOV ZERO, err+72(FP) // errno
CALL runtime·exitsyscall(SB)
RET
err:
MOV $-1, T0
MOV T0, r1+56(FP) // r1
MOV ZERO, r2+64(FP) // r2
SUB A0, ZERO, A0
MOV A0, err+72(FP) // errno
CALL runtime·exitsyscall(SB)
RET
// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-32
MOV a1+8(FP), A0

View File

@ -8,6 +8,32 @@
// System calls for s390x, Linux
//
// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
TEXT ·Syscall6(SB),NOSPLIT,$0-80
BL runtime·entersyscall(SB)
MOVD a1+8(FP), R2
MOVD a2+16(FP), R3
MOVD a3+24(FP), R4
MOVD a4+32(FP), R5
MOVD a5+40(FP), R6
MOVD a6+48(FP), R7
MOVD trap+0(FP), R1 // syscall entry
SYSCALL
MOVD $0xfffffffffffff001, R8
CMPUBLT R2, R8, ok6
MOVD $-1, r1+56(FP)
MOVD $0, r2+64(FP)
NEG R2, R2
MOVD R2, err+72(FP) // errno
BL runtime·exitsyscall(SB)
RET
ok6:
MOVD R2, r1+56(FP)
MOVD R3, r2+64(FP)
MOVD $0, err+72(FP) // errno
BL runtime·exitsyscall(SB)
RET
// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-32
MOVD $0, R2

View File

@ -16,6 +16,8 @@ import (
"unsafe"
)
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
// N.B. RawSyscall6 is provided via linkname by runtime/internal/syscall.
//
// Errno is uintptr and thus compatible with the runtime/internal/syscall
@ -66,16 +68,6 @@ func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
return
}
//go:uintptrkeepalive
//go:nosplit
//go:linkname Syscall6
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
runtime_entersyscall()
r1, r2, err = RawSyscall6(trap, a1, a2, a3, a4, a5, a6)
runtime_exitsyscall()
return
}
func rawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
/*