blob: 3cca85c4e5fb8945f8ef7497189f3f2f083adb90 [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:
Bruce Beare3c543e12010-03-04 10:29:38 -080023 push %ebx
Bruce Beare3c543e12010-03-04 10:29:38 -080024 push %esi
25 push %edi
Kan-Ru Chen8488efa2011-03-29 12:00:38 +080026 mov 16(%esp),%eax
27 mov 20(%esp),%ebx
28 mov 24(%esp),%ecx
29 mov 28(%esp),%edx
30 mov 32(%esp),%esi
31 mov 36(%esp),%edi
Bruce Beare3c543e12010-03-04 10:29:38 -080032
33 int $0x80
34
35 cmpl $-129, %eax
36 jb 1f
37 negl %eax
38 pushl %eax
39 call __set_errno
40 addl $4, %esp
41 orl $-1, %eax
421:
43 pop %edi
44 pop %esi
Bruce Beare3c543e12010-03-04 10:29:38 -080045 pop %ebx
Bruce Beare3c543e12010-03-04 10:29:38 -080046 ret