Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / arch / i386 / core / linux / linux_syscall.S
1
2         .section ".data"
3         .globl linux_errno
4
5 linux_errno:    .int 0
6
7         .section ".text"
8         .code32
9         .globl linux_syscall
10         .type  linux_syscall, @function
11
12 linux_syscall:
13         /* Save registers */
14         pushl   %ebx
15         pushl   %esi
16         pushl   %edi
17         pushl   %ebp
18
19         movl    20(%esp), %eax  // C arg1 -> syscall number
20         movl    24(%esp), %ebx  // C arg2 -> syscall arg1
21         movl    28(%esp), %ecx  // C arg3 -> syscall arg2
22         movl    32(%esp), %edx  // C arg4 -> syscall arg3
23         movl    36(%esp), %esi  // C arg5 -> syscall arg4
24         movl    40(%esp), %edi  // C arg6 -> syscall arg5
25         movl    44(%esp), %ebp  // C arg7 -> syscall arg6
26
27         int     $0x80
28
29         /* Restore registers */
30         popl    %ebp
31         popl    %edi
32         popl    %esi
33         popl    %ebx
34
35         cmpl    $-4095, %eax
36         jae     1f
37         ret
38
39 1:
40         negl    %eax
41         movl    %eax, linux_errno
42         movl    $-1, %eax
43         ret
44
45         .size linux_syscall, . - linux_syscall