github.com/flowerwrong/netstack@v0.0.0-20191009141956-e5848263af28/tcpip/link/rawfile/blockingpoll_amd64.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,amd64 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 CALL ·callEntersyscallblock(SB) 26 MOVQ fds+0(FP), DI 27 MOVQ nfds+8(FP), SI 28 MOVQ timeout+16(FP), DX 29 MOVQ $0x0, R10 // sigmask parameter which isn't used here 30 MOVQ $0x10f, AX // SYS_PPOLL 31 SYSCALL 32 CMPQ AX, $0xfffffffffffff001 33 JLS ok 34 MOVQ $-1, n+24(FP) 35 NEGQ AX 36 MOVQ AX, err+32(FP) 37 CALL ·callExitsyscall(SB) 38 RET 39 ok: 40 MOVQ AX, n+24(FP) 41 MOVQ $0, err+32(FP) 42 CALL ·callExitsyscall(SB) 43 RET