Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/arch/i386/syscall.S
Parent Directory | Revision Log
Revision 532 -
(show annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File size: 1032 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File size: 1032 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
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+20)(%esp) |
10 | |
11 | .text |
12 | .align 4 |
13 | .globl __syscall_common |
14 | .type __syscall_common,@function |
15 | __syscall_common: |
16 | #ifdef _REGPARM |
17 | xchgl %ebx,(%esp) |
18 | #else |
19 | popl %eax |
20 | pushl %ebx |
21 | #endif |
22 | pushl %esi |
23 | pushl %edi |
24 | pushl %ebp |
25 | |
26 | #ifdef _REGPARM |
27 | xchgl %eax,%ebx |
28 | xchgl %ecx,%edx |
29 | movl ARG(0),%esi |
30 | movl ARG(1),%edi |
31 | movl ARG(2),%ebp |
32 | #else |
33 | movl ARG(0),%ebx # Syscall arguments |
34 | movl ARG(1),%ecx |
35 | movl ARG(2),%edx |
36 | movl ARG(3),%esi |
37 | movl ARG(4),%edi |
38 | movl ARG(5),%ebp |
39 | #endif |
40 | .globl __syscall_common_tail |
41 | __syscall_common_tail: |
42 | int $0x80 |
43 | |
44 | cmpl $-4095,%eax |
45 | |
46 | popl %ebp |
47 | popl %edi |
48 | popl %esi |
49 | popl %ebx |
50 | |
51 | jb 1f |
52 | |
53 | # Error return, must set errno |
54 | negl %eax |
55 | movl %eax,errno |
56 | orl $-1,%eax # Return -1 |
57 | |
58 | 1: |
59 | ret |
60 | |
61 | .size __syscall_common,.-__syscall_common |
62 | |
63 | #ifndef _REGPARM |
64 | |
65 | .globl __syscall_varadic |
66 | .type __syscall_varadic,@function |
67 | __syscall_varadic = __syscall_common |
68 | |
69 | #endif |