github.com/FlowerWrong/netstack@v0.0.0-20191009141956-e5848263af28/tcpip/link/rawfile/blockingpoll_arm64.s (about)

     1  // Copyright 2018 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // +build linux,arm64
    16  
    17  #include "textflag.h"
    18  
    19  // BlockingPoll makes the ppoll() syscall while calling the version of
    20  // entersyscall that relinquishes the P so that other Gs can run. This is meant
    21  // to be called in cases when the syscall is expected to block.
    22  //
    23  // func BlockingPoll(fds *PollEvent, nfds int, timeout *syscall.Timespec) (n int, err syscall.Errno)
    24  TEXT ·BlockingPoll(SB),NOSPLIT,$0-40
    25  	BL	·callEntersyscallblock(SB)
    26  	MOVD	fds+0(FP), R0
    27  	MOVD	nfds+8(FP), R1
    28  	MOVD	timeout+16(FP), R2
    29  	MOVD	$0x0, R3  // sigmask parameter which isn't used here
    30  	MOVD	$0x49, R8 // SYS_PPOLL
    31  	SVC
    32  	CMP	$0xfffffffffffff001, R0
    33  	BLS	ok
    34  	MOVD	$-1, R1
    35  	MOVD	R1, n+24(FP)
    36  	NEG	R0, R0
    37  	MOVD	R0, err+32(FP)
    38  	BL	·callExitsyscall(SB)
    39  	RET
    40  ok:
    41  	MOVD	R0, n+24(FP)
    42  	MOVD	$0, err+32(FP)
    43  	BL	·callExitsyscall(SB)
    44  	RET