Created
May 30, 2023 16:39
-
-
Save Unam3dd/60d6c1692e502f42a9abda6c8245988e to your computer and use it in GitHub Desktop.
Syscall Template assembly x86
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
.intel_syntax noprefix | |
.global vs_syscall | |
.section .text | |
vs_syscall: | |
endbr64 | |
mov rax, rdi | |
mov rdi, rsi | |
mov rsi, rdx | |
mov rdx, rcx | |
mov r10, r8 | |
mov r8, r9 | |
mov r9, qword [rsp+0x8] | |
syscall | |
cmp rax, 0xfffffffffffff001 | |
jae .L_ret_errno | |
ret | |
.L_ret_errno: | |
neg eax | |
mov ebx, eax | |
call __errno_location | |
mov dword ptr [rax], ebx | |
xor ebx, eax | |
xor eax, ebx | |
xor ebx, eax | |
or rax, 0xffffffffffffffff | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment