Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / arch / x86_64 / core / linux / linux_syscall.S
1
2         .section ".data"
3         .globl linux_errno
4
5 linux_errno:    .int 0
6
7         .section ".text"
8         .code64
9         .globl linux_syscall
10         .type  linux_syscall, @function
11
12 linux_syscall:
13         movq    %rdi, %rax    // C arg1 -> syscall number
14         movq    %rsi, %rdi    // C arg2 -> syscall arg1
15         movq    %rdx, %rsi    // C arg3 -> syscall arg2
16         movq    %rcx, %rdx    // C arg4 -> syscall arg3
17         movq    %r8, %r10     // C arg5 -> syscall arg4
18         movq    %r9, %r8      // C arg6 -> syscall arg5
19         movq    8(%rsp), %r9  // C arg7 -> syscall arg6
20
21         syscall
22
23         cmpq    $-4095, %rax
24         jae     1f
25         ret
26
27 1:
28         negq    %rax
29         movl    %eax, linux_errno
30         movq    $-1, %rax
31         ret
32
33         .size linux_syscall, . - linux_syscall