]> git.ipfire.org Git - thirdparty/systemd.git/blob - klibc/klibc/arch/x86_64/syscall.S
klibc: version 1.0.14
[thirdparty/systemd.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 jnb 1f
19 ret
20
21 # Error return, must set errno
22 1:
23 negl %eax
24 movl %eax,errno(%rip) # errno is type int, so 32 bits
25 orq $-1,%rax # orq $-1 smaller than movq $-1
26 ret
27
28 .size __syscall_common,.-__syscall_common