-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide optimized assembly for PPOLL blocking syscall on i386
- Loading branch information
Showing
3 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "textflag.h" | ||
|
||
#define INVOKE_SYSCALL INT $0x80 | ||
#define SYS__PPOLL 0x135 | ||
|
||
// func pollBlock(fds *unix.PollFd, nfds int) (err syscall.Errno) | ||
TEXT ·pollBlock(SB),NOSPLIT,$0-12 | ||
CALL runtime·entersyscallblock(SB) // Call blocking SYSCALL directive from runtime package | ||
MOVL $SYS__PPOLL, AX // Prepare / perform ppoll() SYSCALL | ||
MOVL fds+0(FP), BX // PollFDs parameter | ||
MOVL nfds+4(FP), CX // Put nFDs parameter | ||
MOVL $0x0, DX // Put timeout parameter (set to NULL) | ||
MOVL $0x0, SI // Put sigmask parameter (skip) | ||
INVOKE_SYSCALL | ||
CMPL AX, $0xfffff002 // No error / EINTR | ||
JLS success // Jump to success | ||
NEGL AX // Negate SYSCALL errno | ||
MOVL AX, err+8(FP) // Store error code in err return value | ||
CALL runtime·exitsyscall(SB) // Finalize SYSCALL using the directive from runtime package | ||
RET // Return | ||
success: | ||
MOVL $0, err+8(FP) // Store NULL error code in err return value | ||
CALL runtime·exitsyscall(SB) // Finalize SYSCALL using the directive from runtime package | ||
RET // Return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters