X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/32b9a6d76790c73d3d2d36d9081a2581cc65d184..28c176b668c841a3b7fb093faccf0efa39257603:/lunaix-os/usr/libc/arch/x86_64/syscall.S diff --git a/lunaix-os/usr/libc/arch/x86_64/syscall.S b/lunaix-os/usr/libc/arch/x86_64/syscall.S new file mode 100644 index 0000000..def99e5 --- /dev/null +++ b/lunaix-os/usr/libc/arch/x86_64/syscall.S @@ -0,0 +1,43 @@ +#include + +#define LUNAIX_SYSCALL 33 +#define regsize 8 + + .struct 2 * regsize # rip, rbp +id: + .struct id + regsize +a1: + .struct a1 + regsize +a2: + .struct a2 + regsize +a3: + .struct a3 + regsize +a4: + .struct a4 + regsize +a5: + +.section .text + .type do_lunaix_syscall, @function + .global do_lunaix_syscall + + do_lunaix_syscall: + pushq %rbp + movq %rsp, %rbp + + pushq %rbx + + movq %rcx, %r10 + + movq %rdi, %rax + movq %rsi, %rbx + movq %rdx, %rcx + movq %r10, %rdx + movq %r8, %rdi + movq %r9, %rsi + + int $LUNAIX_SYSCALL + + popq %rbx + + leave + ret \ No newline at end of file