summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/i386/unified.S
blob: 989bf37b5e06e0fa41b3f922387f80280d346c39 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

#include <dietfeatures.h>

.text
.global __unified_syscall_256
.type __unified_syscall_256,@function
__unified_syscall_256:
	movzwl %ax,%eax
	jmp .L1
.L2:
.size __unified_syscall_256,.L2-__unified_syscall_256
.weak exit
exit:
.global _exit
.type	_exit,@function
_exit:
	movb	$1,%al
.global __unified_syscall
.type	__unified_syscall,@function
__unified_syscall:
.size _exit,__unified_syscall-_exit
	movzbl	%al, %eax
.L1:
	push	%edi
	push	%esi
	push	%ebx
	movl	%esp,%edi
	/* we use movl instead of pop because otherwise a signal would
	   destroy the stack frame and crash the program, although it
	   would save a few bytes. */
	movl	0x10(%edi),%ebx
	movl	0x14(%edi),%ecx
	movl	0x18(%edi),%edx
	movl	0x1c(%edi),%esi
	movl	0x20(%edi),%edi
	int	$0x80
	cmp	$-124,%eax
	jbe	.Lnoerror
	neg	%eax
#ifdef WANT_THREAD_SAFE
	movl	%eax,%ebx
	call	__errno_location
	movl	%ebx,(%eax)
	orl	$-1,%eax
#else
	mov	%eax,errno
	sbb	%eax,%eax               # eax = eax - eax - CY = -1
#endif
.Lnoerror:
	pop	%ebx
	pop	%esi
	pop	%edi

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

	ret
.L3:
.size __unified_syscall,.L3-__unified_syscall