summaryrefslogtreecommitdiff
path: root/mit-pthreads/machdep/syscall-template-i386-sco-3.2v5.S
blob: 753475b5c3dab51dc8edf7df1a5d17cb2292977a (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
60
61
62
63
64
65
66
67
#include <sys/errno.h>
#include <sys/syscall.h>

#ifdef _SCO_ELF

#define NAME(X) 	machdep_sys_##X
#define END(X)		1: ; .type NAME(X),@function ; .size NAME(X),1b - NAME(X)
#define GETBX(X) \
	push %ebx; \
	call 1f; \
1: \
	popl %ebx;
#else

#define NAME(X)		_machdep_sys_##X
#define END(X)

#endif

#ifdef __STDC__

#define	SYSCALL(x)					\
	.globl NAME(x);		\
									\
NAME(x):;				\
	movl $(SYS_##x##), %eax;		\
	.byte 0x9a; .long 0; .word 7;	\
	jae	1f;							\
	cmp	$(ERESTART), %eax; \
	je	NAME(x); \
	neg	%eax; \
1: \
	ret;							\
	END(x)

#else

#define	SYSCALL(x)					\
	.globl _machdep_sys_/**/x;		\
									\
machdep_sys_/**/x:;				\
									\
	movl $(SYS_/**/x), %eax;		\
	.byte 0x9a; .long 0; .word 7;	\
	jae	1f;							\
	neg	%eax;
1: \
	ret;							

#endif


/*
 * Initial asm stuff for all functions.
 */
	.text
	.align	2


/* ==========================================================================
 * error code for all syscalls. The error value is returned as the negative
 * of the errno value.
 */

#define XSYSCALL(NAME)	SYSCALL(NAME)

XSYSCALL(SYSCALL_NAME)