mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Don't return r2 from RawSyscalls.
In practice we don't seem to ever use it. PiperOrigin-RevId: 681073641
This commit is contained in:
committed by
gVisor bot
parent
fa27ee0b23
commit
4a0bf841d9
@@ -28,10 +28,10 @@ import (
|
||||
)
|
||||
|
||||
// RawSyscall6 is a copy of runtime.Syscall6.
|
||||
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, errno unix.Errno)
|
||||
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1 uintptr, errno unix.Errno)
|
||||
|
||||
// RawSyscall is a copy of runtime.Syscall6, but only uses the first three arguments.
|
||||
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, errno unix.Errno)
|
||||
func RawSyscall(trap, a1, a2, a3 uintptr) (r1 uintptr, errno unix.Errno)
|
||||
|
||||
// Variants of runtime.Syscall6 that use slightly less stack space by only
|
||||
// returning errno.
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, errno)
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, errno)
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-72
|
||||
MOVQ a1+8(FP), DI
|
||||
MOVQ a2+16(FP), SI
|
||||
MOVQ a3+24(FP), DX
|
||||
@@ -27,18 +27,16 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
CMPQ AX, $0xfffffffffffff001
|
||||
JLS ok
|
||||
MOVQ $-1, r1+56(FP)
|
||||
MOVQ $0, r2+64(FP)
|
||||
NEGQ AX
|
||||
MOVQ AX, errno+72(FP)
|
||||
MOVQ AX, errno+64(FP)
|
||||
RET
|
||||
ok:
|
||||
MOVQ AX, r1+56(FP)
|
||||
MOVQ DX, r2+64(FP)
|
||||
MOVQ $0, errno+72(FP)
|
||||
MOVQ $0, errno+64(FP)
|
||||
RET
|
||||
|
||||
// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, errno)
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, errno)
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-48
|
||||
MOVQ a1+8(FP), DI
|
||||
MOVQ a2+16(FP), SI
|
||||
MOVQ a3+24(FP), DX
|
||||
@@ -50,14 +48,12 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
CMPQ AX, $0xfffffffffffff001
|
||||
JLS ok
|
||||
MOVQ $-1, r1+32(FP)
|
||||
MOVQ $0, r2+40(FP)
|
||||
NEGQ AX
|
||||
MOVQ AX, errno+48(FP)
|
||||
MOVQ AX, errno+40(FP)
|
||||
RET
|
||||
ok:
|
||||
MOVQ AX, r1+32(FP)
|
||||
MOVQ DX, r2+40(FP)
|
||||
MOVQ $0, errno+48(FP)
|
||||
MOVQ $0, errno+40(FP)
|
||||
RET
|
||||
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, errno uintptr)
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, errno)
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-72
|
||||
MOVD trap+0(FP), R8 // syscall entry
|
||||
MOVD a1+8(FP), R0
|
||||
MOVD a2+16(FP), R1
|
||||
@@ -28,18 +28,16 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
BCC ok
|
||||
MOVD $-1, R4
|
||||
MOVD R4, r1+56(FP)
|
||||
MOVD ZR, r2+64(FP)
|
||||
NEG R0, R0
|
||||
MOVD R0, errno+72(FP)
|
||||
MOVD R0, errno+64(FP)
|
||||
RET
|
||||
ok:
|
||||
MOVD R0, r1+56(FP)
|
||||
MOVD R1, r2+64(FP)
|
||||
MOVD ZR, errno+72(FP)
|
||||
MOVD ZR, errno+64(FP)
|
||||
RET
|
||||
|
||||
// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, errno uintptr)
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, errno)
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-48
|
||||
MOVD trap+0(FP), R8 // syscall entry
|
||||
MOVD a1+8(FP), R0
|
||||
MOVD a2+16(FP), R1
|
||||
@@ -52,14 +50,12 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
BCC ok
|
||||
MOVD $-1, R4
|
||||
MOVD R4, r1+32(FP)
|
||||
MOVD ZR, r2+40(FP)
|
||||
NEG R0, R0
|
||||
MOVD R0, errno+48(FP)
|
||||
MOVD R0, errno+40(FP)
|
||||
RET
|
||||
ok:
|
||||
MOVD R0, r1+32(FP)
|
||||
MOVD R1, r2+40(FP)
|
||||
MOVD ZR, errno+48(FP)
|
||||
MOVD ZR, errno+40(FP)
|
||||
RET
|
||||
|
||||
// func RawSyscallErrno6(trap, a1, a2, a3, a4, a5, a6 uintptr) (errno unix.Errno)
|
||||
|
||||
@@ -190,7 +190,7 @@ func seccompMmapSyscall(context unsafe.Pointer) (uintptr, uintptr, unix.Errno) {
|
||||
ctx := bluepillArchContext(context)
|
||||
|
||||
// MAP_DENYWRITE is deprecated and ignored by kernel. We use it only for seccomp filters.
|
||||
addr, _, e := hostsyscall.RawSyscall6(uintptr(ctx.Rax), uintptr(ctx.Rdi), uintptr(ctx.Rsi),
|
||||
addr, e := hostsyscall.RawSyscall6(uintptr(ctx.Rax), uintptr(ctx.Rdi), uintptr(ctx.Rsi),
|
||||
uintptr(ctx.Rdx), uintptr(ctx.R10)|unix.MAP_DENYWRITE, uintptr(ctx.R8), uintptr(ctx.R9))
|
||||
ctx.Rax = uint64(addr)
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ func seccompMmapSyscall(context unsafe.Pointer) (uintptr, uintptr, unix.Errno) {
|
||||
ctx := bluepillArchContext(context)
|
||||
|
||||
// MAP_DENYWRITE is deprecated and ignored by kernel. We use it only for seccomp filters.
|
||||
addr, _, e := hostsyscall.RawSyscall6(uintptr(ctx.Regs[8]), uintptr(ctx.Regs[0]), uintptr(ctx.Regs[1]),
|
||||
addr, e := hostsyscall.RawSyscall6(uintptr(ctx.Regs[8]), uintptr(ctx.Regs[0]), uintptr(ctx.Regs[1]),
|
||||
uintptr(ctx.Regs[2]), uintptr(ctx.Regs[3])|unix.MAP_DENYWRITE, uintptr(ctx.Regs[4]), uintptr(ctx.Regs[5]))
|
||||
ctx.Regs[0] = uint64(addr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user