gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/pkg/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  #include "textflag.h"
    16  
    17  // BlockingPoll makes the ppoll() syscall while calling the version of
    18  // entersyscall that relinquishes the P so that other Gs can run. This is meant
    19  // to be called in cases when the syscall is expected to block.
    20  //
    21  // func BlockingPoll(fds *PollEvent, nfds int, timeout *syscall.Timespec) (n int, err syscall.Errno)
    22  TEXT ·BlockingPoll(SB),NOSPLIT,$0-40
    23  	BL	·callEntersyscallblock(SB)
    24  	MOVD	fds+0(FP), R0
    25  	MOVD	nfds+8(FP), R1
    26  	MOVD	timeout+16(FP), R2
    27  	MOVD	$0x0, R3  // sigmask parameter which isn't used here
    28  	MOVD	$0x49, R8 // SYS_PPOLL
    29  	SVC
    30  	CMP	$0xfffffffffffff002, R0
    31  	BLS	ok
    32  	MOVD	$-1, R1
    33  	MOVD	R1, ret+24(FP)
    34  	NEG	R0, R0
    35  	MOVD	R0, ret1+32(FP)
    36  	BL	·callExitsyscall(SB)
    37  	RET
    38  ok:
    39  	MOVD	R0, ret+24(FP)
    40  	MOVD	$0, ret1+32(FP)
    41  	BL	·callExitsyscall(SB)
    42  	RET