Magellan Linux

Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/arch/i386/syscall.S

Parent Directory Parent Directory | Revision Log Revision Log


Revision 815 - (show annotations) (download)
Fri Apr 24 18:32:46 2009 UTC (15 years ago) by niro
File size: 1069 byte(s)
-updated to klibc-1.5.15
1 /*
2 * arch/i386/syscall.S
3 *
4 * Common tail-handling code for system calls.
5 *
6 * The arguments are on the stack; the system call number in %eax.
7 */
8
9 #define ARG(n) (4*(n)+24)(%esp)
10 #define SYSNO ARG(-2)
11
12 .text
13 .align 4
14 .globl __syscall_common
15 .type __syscall_common,@function
16 __syscall_common:
17 pushl %ebx
18 pushl %esi
19 pushl %edi
20 pushl %ebp
21
22 #ifdef _REGPARM
23 xchgl %ecx,%edx
24 movl %eax,%ebx
25 movl SYSNO,%eax
26 movl ARG(0),%esi
27 movl ARG(1),%edi
28 movl ARG(2),%ebp
29 #else
30 movl SYSNO,%eax
31 movl ARG(0),%ebx # Syscall arguments
32 movl ARG(1),%ecx
33 movl ARG(2),%edx
34 movl ARG(3),%esi
35 movl ARG(4),%edi
36 movl ARG(5),%ebp
37 #endif
38 .globl __syscall_common_tail
39 __syscall_common_tail:
40 int $0x80
41
42 cmpl $-4095,%eax
43
44 popl %ebp
45 popl %edi
46 popl %esi
47 popl %ebx
48 popl %edx # Drop system call number
49
50 jb 1f
51
52 # Error return, must set errno
53 negl %eax
54 movl %eax,errno
55 orl $-1,%eax # Return -1
56
57 1:
58 ret
59
60 .size __syscall_common,.-__syscall_common
61
62 #ifndef _REGPARM
63
64 .globl __syscall_varadic
65 .type __syscall_varadic,@function
66 __syscall_varadic = __syscall_common
67
68 #endif