blob: 71abe6b3fd4b956d76da4dfdfc265d81afa5d8f0 [file] [log] [blame]
Bruce Beare3c543e12010-03-04 10:29:38 -08001/*
2 * Generic syscall call.
3 * Upon entry
4 * %eax: system call number
5 * %ebx: arg0 to system call
6 * %ecx: arg..
7 * %edx: arg..
8 * %esi: arg..
9 * %edi: arg..
10 * We push these (to save them) load them up with the
11 * values from the calling frame (not all will actually be valid)
12 * and make the syscall.
13 */
14
15#include <sys/linux-syscalls.h>
16
17 .text
18 .type syscall, @function
19 .globl syscall
20 .align 4
21
22syscall:
23 push %eax
24 push %ebx
25 push %ecx
26 push %edx
27 push %esi
28 push %edi
29 mov 28(%esp),%eax
30 mov 32(%esp),%ebx
31 mov 36(%esp),%ecx
32 mov 40(%esp),%edx
33 mov 44(%esp),%esi
34 mov 48(%esp),%edi
35
36 int $0x80
37
38 cmpl $-129, %eax
39 jb 1f
40 negl %eax
41 pushl %eax
42 call __set_errno
43 addl $4, %esp
44 orl $-1, %eax
451:
46 pop %edi
47 pop %esi
48 pop %edx
49 pop %ecx
50 pop %ebx
51 pop %eax
52 ret