# Copyright 2022-2023 Gabriel Jensen. # This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. # If a copy of the MPL was not distributed with this file, You can obtain one at . .globl zap_syscall zap_syscall: # System calls on AMD64 use the following registers: # rax : System call identifier # rdi : First parameter # rsi : Second parameter # rdx : Third parameter # r10 : Fourth parameter # r8 : Fifth parameter # r9 : Sixth parameter # eax : Return value # No registers to save. movq %rdi,%rax # Move the first parameter (the identifier) to rax. movq %rsi,%rdi # Move parameters into their designated registers. movq %rdx,%rsi movq %rcx,%rdx movq %r8,%r10 # System calls use r10 instead of rcx. movq %r9,%r8 movq 0x8(%rsp),%r9 # Extract the sixth argument from the stack. syscall # Slime incident # No need to move the return value. ret