chiark / gitweb /
[PATCH] update klibc to version 0.181
[elogind.git] / klibc / klibc / arch / x86_64 / syscall.S
1 /*
2  * arch/x86-64/syscall.S
3  *
4  * Common tail-handling code for system calls.
5  *
6  * The arguments are in the standard argument registers; the system
7  * call number in %eax.
8  */
9         .text
10         .align  4
11         .globl  __syscall_common
12         .type   __syscall_common,@function
13 __syscall_common:
14         movq    %rcx,%r10               # The kernel uses %r10 istf %rcx
15         syscall
16
17         cmpq    $-4095,%rax
18         jb      1f
19
20         # Error return, must set errno
21         negl    %eax
22         movl    %eax,errno(%rip)        # errno is type int, so 32 bits
23         orq     $-1,%rax                # orq $-1 smaller than movq $-1
24
25 1:
26         ret
27
28         .size   __syscall_common,.-__syscall_common