6bb87769cd
said to work on i386, not tested on any other architecture
234 lines
5.0 KiB
Plaintext
234 lines
5.0 KiB
Plaintext
--- mit-pthreads/machdep/syscall-i386-freebsd-2.0.S.orig Mon Oct 20 03:35:30 1997
|
|
+++ mit-pthreads/machdep/syscall-i386-freebsd-2.0.S Sat Oct 10 17:20:22 1998
|
|
@@ -51,30 +51,29 @@
|
|
|
|
#ifdef __STDC__
|
|
|
|
-#define SYSCALL(x) \
|
|
- .globl _machdep_sys_##x##; \
|
|
- \
|
|
-_machdep_sys_##x##:; \
|
|
- \
|
|
- movl $(SYS_##x##), %eax; \
|
|
- .byte 0x9a; .long 0; .word 7; \
|
|
- jb 1b; \
|
|
- ret;
|
|
+#ifdef __ELF__
|
|
+#define NAME(X) machdep_sys_##X
|
|
+#else
|
|
+#define NAME(X) _machdep_sys_##X
|
|
+#endif
|
|
|
|
#else
|
|
|
|
-#define SYSCALL(x) \
|
|
- .globl _machdep_sys_/**/x; \
|
|
- \
|
|
-_machdep_sys_/**/x:; \
|
|
- \
|
|
- movl $(SYS_/**/x), %eax; \
|
|
- .byte 0x9a; .long 0; .word 7; \
|
|
- jb 1b; \
|
|
- ret;
|
|
+#ifdef __ELF__
|
|
+#define NAME(X) machdep_sys_/**/X
|
|
+#else
|
|
+#define NAME(X) _machdep_sys_/**/X
|
|
+#endif
|
|
|
|
#endif
|
|
|
|
+#ifdef __ELF__
|
|
+#define END(X) 5: ; .type NAME(X),@function ; .size NAME(X),5b - NAME(X)
|
|
+#define KERNCALL int $0x80
|
|
+#else
|
|
+#define END(X)
|
|
+#define KERNCALL .byte 0x9a; .long 0; .word 7;
|
|
+#endif
|
|
|
|
/*
|
|
* Initial asm stuff for all functions.
|
|
@@ -95,17 +94,18 @@
|
|
/* ==========================================================================
|
|
* machdep_sys_fork()
|
|
*/
|
|
- .globl _machdep_sys_fork;
|
|
+ .globl NAME(fork);
|
|
|
|
-_machdep_sys_fork:;
|
|
+NAME(fork):;
|
|
|
|
movl $(SYS_fork), %eax;
|
|
- .byte 0x9a; .long 0; .word 7;
|
|
+ KERNCALL;
|
|
cmpl $0, %edx
|
|
je 2f
|
|
movl $0, %eax
|
|
2:
|
|
ret;
|
|
+ END(fork)
|
|
|
|
/* ==========================================================================
|
|
* machdep_sys___syscall()
|
|
@@ -114,57 +114,56 @@
|
|
_machdep_sys___syscall:;
|
|
|
|
movl $(SYS___syscall), %eax;
|
|
- .byte 0x9a; .long 0; .word 7;
|
|
+ KERNCALL;
|
|
jb 3f;
|
|
ret
|
|
|
|
/* ==========================================================================
|
|
* machdep_sys_sigsuspend()
|
|
*/
|
|
- .globl _machdep_sys_sigsuspend;
|
|
+ .globl NAME(sigsuspend);
|
|
|
|
-_machdep_sys_sigsuspend:;
|
|
+NAME(sigsuspend):;
|
|
|
|
movl 4(%esp),%eax # fetch mask arg
|
|
- movl (%eax),%eax # indirect to mask arg
|
|
- movl %eax,4(%esp)
|
|
+ movl (%eax),%eax # indirect to mask arg
|
|
+ movl %eax,4(%esp)
|
|
movl $(SYS_sigsuspend), %eax;
|
|
- .byte 0x9a; .long 0; .word 7;
|
|
+ KERNCALL;
|
|
jb 3f;
|
|
ret
|
|
-
|
|
3:
|
|
-
|
|
neg %eax
|
|
movl $0xffffffff,%edx
|
|
ret
|
|
+ END(sigsuspend)
|
|
|
|
/* ==========================================================================
|
|
* machdep_sys_sigprocmask()
|
|
*/
|
|
- .globl _machdep_sys_sigprocmask;
|
|
+ .globl NAME(sigprocmask);
|
|
|
|
-_machdep_sys_sigprocmask:;
|
|
+NAME(sigprocmask):;
|
|
|
|
movl 8(%esp),%ecx
|
|
movl (%ecx),%ecx
|
|
movl %ecx,8(%esp)
|
|
movl $ SYS_sigprocmask , %eax
|
|
- .byte 0x9a; .long 0; .word 7;
|
|
+ KERNCALL;
|
|
jb 4f;
|
|
ret
|
|
-
|
|
4:
|
|
neg %eax
|
|
movl $0xffffffff,%edx
|
|
ret
|
|
+ END(sigprocmask)
|
|
|
|
/* ==========================================================================
|
|
* machdep_sys_lseek()
|
|
*/
|
|
- .globl _machdep_sys_lseek;
|
|
+ .globl NAME(lseek);
|
|
|
|
-_machdep_sys_lseek:;
|
|
+NAME(lseek):;
|
|
|
|
pushl %ebp;
|
|
movl %esp,%ebp;
|
|
@@ -178,13 +177,14 @@
|
|
call _machdep_sys___syscall;
|
|
leave
|
|
ret
|
|
+ END(lseek)
|
|
|
|
/* ==========================================================================
|
|
* machdep_sys_ftruncate() ; Added by Monty
|
|
*/
|
|
- .globl _machdep_sys_ftruncate;
|
|
+ .globl NAME(ftruncate);
|
|
|
|
-_machdep_sys_ftruncate:;
|
|
+NAME(ftruncate):;
|
|
|
|
pushl %ebp;
|
|
movl %esp,%ebp;
|
|
@@ -197,41 +197,44 @@
|
|
call _machdep_sys___syscall;
|
|
leave
|
|
ret
|
|
+ END(ftruncate)
|
|
|
|
/* ==========================================================================
|
|
* machdep_sys_setjmp()
|
|
*/
|
|
- .globl _machdep_sys_setjmp;
|
|
+ .globl NAME(setjmp);
|
|
|
|
-_machdep_sys_setjmp:;
|
|
- movl 4(%esp),%eax
|
|
- movl 0(%esp),%edx
|
|
- movl %edx, 0(%eax) /* rta */
|
|
- movl %ebx, 4(%eax)
|
|
- movl %esp, 8(%eax)
|
|
- movl %ebp,12(%eax)
|
|
- movl %esi,16(%eax)
|
|
- movl %edi,20(%eax)
|
|
- xorl %eax,%eax
|
|
- ret
|
|
+NAME(setjmp):;
|
|
+ movl 4(%esp),%eax
|
|
+ movl 0(%esp),%edx
|
|
+ movl %edx, 0(%eax) /* rta */
|
|
+ movl %ebx, 4(%eax)
|
|
+ movl %esp, 8(%eax)
|
|
+ movl %ebp,12(%eax)
|
|
+ movl %esi,16(%eax)
|
|
+ movl %edi,20(%eax)
|
|
+ xorl %eax,%eax
|
|
+ ret
|
|
+ END(setjmp)
|
|
|
|
/* ==========================================================================
|
|
* machdep_sys_longjmp()
|
|
*/
|
|
- .globl _machdep_sys_longjmp;
|
|
+ .globl NAME(longjmp);
|
|
|
|
-_machdep_sys_longjmp:;
|
|
- movl 4(%esp),%edx
|
|
- movl 8(%esp),%eax
|
|
- movl 0(%edx),%ecx
|
|
- movl 4(%edx),%ebx
|
|
- movl 8(%edx),%esp
|
|
- movl 12(%edx),%ebp
|
|
- movl 16(%edx),%esi
|
|
- movl 20(%edx),%edi
|
|
- testl %eax,%eax
|
|
- jnz 1f
|
|
- incl %eax
|
|
-1: movl %ecx,0(%esp)
|
|
- ret
|
|
-
|
|
+NAME(longjmp):;
|
|
+ movl 4(%esp),%edx
|
|
+ movl 8(%esp),%eax
|
|
+ movl 0(%edx),%ecx
|
|
+ movl 4(%edx),%ebx
|
|
+ movl 8(%edx),%esp
|
|
+ movl 12(%edx),%ebp
|
|
+ movl 16(%edx),%esi
|
|
+ movl 20(%edx),%edi
|
|
+ testl %eax,%eax
|
|
+ jnz 1f
|
|
+ incl %eax
|
|
+1:
|
|
+ movl %ecx,0(%esp)
|
|
+ ret
|
|
+ END(longjmp)
|