Rewrite the lunabuild toolchain with enhanced feature (#60)
[lunaix-os.git] / lunaix-os / usr / libc / arch / x86_64 / syscall.S
1 #include <lunaix/syscallid.h>
2
3 #define LUNAIX_SYSCALL 33
4 #define regsize 8
5
6     .struct  2 * regsize # rip, rbp
7 id:
8     .struct id + regsize
9 a1:
10     .struct a1 + regsize
11 a2:
12     .struct a2 + regsize
13 a3:
14     .struct a3 + regsize
15 a4:
16     .struct a4 + regsize
17 a5:
18
19 .section .text
20     .type do_lunaix_syscall, @function    
21     .global do_lunaix_syscall
22
23     do_lunaix_syscall:
24         pushq %rbp
25         movq %rsp, %rbp
26
27         pushq %rbx
28
29         movq %rcx, %r10
30        
31         movq %rdi, %rax
32         movq %rsi, %rbx
33         movq %rdx, %rcx
34         movq %r10, %rdx
35         movq %r8, %rdi
36         movq %r9, %rsi
37         
38         int $LUNAIX_SYSCALL
39
40         popq %rbx
41
42         leave
43         ret