// doSyscall is the entry point for an invocation of a system call specified by
// the current state of t's registers.
//
// The syscall path is very hot; avoid defer.
doSyscall is the entry point for an invocation of a system call specified by
the current state of t's registers.

The syscall path is very hot; avoid defer.
// doSyscall is the entry point for an invocation of a system call specified by // the current state of t ' s registers . // // The syscall path is very hot ; avoid defer .
func (t *Task) doSyscall() taskRunState {
	 On x86, register rax was shared by syscall number and return
	 value, and at the entry of the syscall handler, the rax was
	 saved to regs.orig_rax which was exposed to userspace.
	 But on arm64, syscall number was passed through X8, and the X0
	 was shared by the first syscall argument and return value. The
	 X0 was saved to regs.orig_x0 which was not exposed to userspace.
	 So we have to do the same operation here to save the X0 value
	 into the task context.
	t.Arch().SyscallSaveOrig()
	sysno := t.Arch().SyscallNo()
	args := t.Arch().SyscallArgs()
	 Tracers expect to see this between when the task traps into the kernel
	 to perform a syscall and when the syscall is actually invoked.
	 This useless-looking temporary is needed because Go.
	tmp := uintptr(unix.ENOSYS)
	t.Arch().SetReturn(-tmp)
	 Check seccomp filters. The nil check is for performance (as seccomp use
	 is rare), not needed for correctness.
	if t.syscallFilters.Load() != nil {
		switch r := t.checkSeccompSyscall(int32(sysno), args, hostarch.Addr(t.Arch().IP())); r {
		case linux.SECCOMP_RET_ERRNO, linux.SECCOMP_RET_TRAP:
			t.Debugf("Syscall %d: denied by seccomp", sysno)
			return (*runSyscallExit)(nil)
		case linux.SECCOMP_RET_ALLOW:
			 ok
		case linux.SECCOMP_RET_KILL_THREAD:
			t.Debugf("Syscall %d: killed by seccomp", sysno)
			t.PrepareExit(ExitStatus{Signo: int(linux.SIGSYS)})
			return (*runExit)(nil)
		case linux.SECCOMP_RET_TRACE:
			t.Debugf("Syscall %d: stopping for PTRACE_EVENT_SECCOMP", sysno)
			return (*runSyscallAfterPtraceEventSeccomp)(nil)
		default:
			panic(fmt.Sprintf("Unknown seccomp result %d", r))
		}
	}
	return t.doSyscallEnter(sysno, args)
}
func ( t * Task ) doSyscall ( ) taskRunState { t . Arch ( ) . SyscallSaveOrig ( ) sysno := t . Arch ( ) . SyscallNo ( ) args := t . Arch ( ) . SyscallArgs ( ) tmp := uintptr ( unix . ENOSYS ) t . Arch ( ) . SetReturn ( - tmp ) if t . syscallFilters . Load ( ) != nil { switch r := t . checkSeccompSyscall ( int32 ( sysno ) , args , hostarch . Addr ( t . Arch ( ) . IP ( ) ) ) ; r { case linux . SECCOMP_RET_ERRNO , linux . SECCOMP_RET_TRAP : t . Debugf ( " " , sysno ) return ( * runSyscallExit ) ( nil ) case linux . SECCOMP_RET_ALLOW : case linux . SECCOMP_RET_KILL_THREAD : t . Debugf ( " " , sysno ) t . PrepareExit ( ExitStatus { Signo : int ( linux . SIGSYS ) } ) return ( * runExit ) ( nil ) case linux . SECCOMP_RET_TRACE : t . Debugf ( " " , sysno ) return ( * runSyscallAfterPtraceEventSeccomp ) ( nil ) default : panic ( fmt . Sprintf ( " " , r ) ) } } return t . doSyscallEnter ( sysno , args ) }
doSyscall is the entry point for an invocation of a system call specified by
the current state of t's registers.
doSyscall is the entry point for an invocation of a system call specified by the current state of t ' s registers .
// Save value of the register which is clobbered in the following // t.Arch().SetReturn(-ENOSYS) operation. This is dedicated to arm64. // // On x86, register rax was shared by syscall number and return // value, and at the entry of the syscall handler, the rax was // saved to regs.orig_rax which was exposed to userspace. // But on arm64, syscall number was passed through X8, and the X0 // was shared by the first syscall argument and return value. The // X0 was saved to regs.orig_x0 which was not exposed to userspace. // So we have to do the same operation here to save the X0 value // into the task context. // Tracers expect to see this between when the task traps into the kernel // to perform a syscall and when the syscall is actually invoked. // This useless-looking temporary is needed because Go. // Check seccomp filters. The nil check is for performance (as seccomp use // is rare), not needed for correctness. // ok