summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/x86_64/unified.S
blob: 48bb9a4faf9f8e864398b82d296ee5eda2508334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <dietfeatures.h>

#define SYS_exit 0x3c

.text
.weak exit
exit:
.global _exit
_exit:
	mov	$SYS_exit,%al

#ifndef __DYN_LIB
.global __unified_syscall
#endif
__unified_syscall:
	movzbl	%al, %eax
	mov	%rcx, %r10
	syscall
	cmpq	$-128, %rax
	jbe	.Lnoerror
	negl	%eax
	pushq	%rax
	call	__errno_location
	popq	%rcx
	movl	%ecx,(%rax)
	orq	$-1, %rax
.Lnoerror:

/* here we go and "reuse" the return for weak-void functions */
#include "dietuglyweaks.h"

	ret