Architectural Support: x86_64 (#37)
[lunaix-os.git] / lunaix-os / usr / libc / arch / i386 / syscall.S
1 #include <lunaix/syscallid.h>
2
3 #define LUNAIX_SYSCALL 33
4 #define regsize 4
5
6     .struct  2 * regsize   # eip, ebp
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         push %ebp
25         movl %esp, %ebp
26
27         pushl %ebx
28         pushl %edi
29         pushl %esi
30
31         movl id(%ebp), %eax
32         movl a1(%ebp), %ebx
33         movl a2(%ebp), %ecx
34         movl a3(%ebp), %edx
35         movl a4(%ebp), %edi
36         movl a5(%ebp), %esi
37         
38         int $LUNAIX_SYSCALL
39
40         popl %esi
41         popl %edi
42         popl %ebx
43
44         leave
45         ret