ld-tool portability fix: MacOS build experience
[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 8
7 saved_registers:
8     .struct saved_registers + 5 * regsize
9 id:
10     .struct id + regsize
11 a1:
12     .struct a1 + regsize
13 a2:
14     .struct a2 + regsize
15 a3:
16     .struct a3 + regsize
17 a4:
18     .struct a4 + regsize
19 a5:
20
21 .section .text
22     .type do_lunaix_syscall, @function
23     .global do_lunaix_syscall
24     do_lunaix_syscall:
25         push %ebp
26         movl %esp, %ebp
27
28         pushl %ebx
29         pushl %ecx
30         pushl %edx
31         pushl %edi
32         pushl %esi
33         
34         movl id(%esp), %eax
35         movl a1(%esp), %ebx
36         movl a2(%esp), %ecx
37         movl a3(%esp), %edx
38         movl a4(%esp), %edi
39         movl a5(%esp), %esi
40         
41         int $LUNAIX_SYSCALL
42
43         popl %esi
44         popl %edi
45         popl %edx
46         popl %ecx
47         popl %ebx
48
49         leave
50         ret