summaryrefslogtreecommitdiffstats
path: root/lib/libc/i386
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/i386')
-rw-r--r--lib/libc/i386/SYS.h17
-rw-r--r--lib/libc/i386/gen/_setjmp.S12
-rw-r--r--lib/libc/i386/gen/setjmp.S20
-rw-r--r--lib/libc/i386/gen/sigsetjmp.S20
-rw-r--r--lib/libc/i386/sys/Ovfork.S28
-rw-r--r--lib/libc/i386/sys/cerror.S28
-rw-r--r--lib/libc/i386/sys/fork.S6
-rw-r--r--lib/libc/i386/sys/pipe.S6
-rw-r--r--lib/libc/i386/sys/sigpending.S6
-rw-r--r--lib/libc/i386/sys/sigprocmask.S8
-rw-r--r--lib/libc/i386/sys/sigreturn.S6
-rw-r--r--lib/libc/i386/sys/sigsuspend.S8
12 files changed, 137 insertions, 28 deletions
diff --git a/lib/libc/i386/SYS.h b/lib/libc/i386/SYS.h
index 53837ab..9e989e5 100644
--- a/lib/libc/i386/SYS.h
+++ b/lib/libc/i386/SYS.h
@@ -35,7 +35,7 @@
*
* from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
*
- * $Id: SYS.h,v 1.3 1993/11/04 00:01:17 paul Exp $
+ * $Id: SYS.h,v 1.2 1994/08/05 01:17:57 wollman Exp $
*/
#include <sys/syscall.h>
@@ -63,6 +63,21 @@
#define SYSCALL(x) 2: jmp cerror; ENTRY(x); lea SYS_/**/x,%eax; LCALL(7,0); jb 2b
#define RSYSCALL(x) SYSCALL(x); ret
+
+#ifdef _THREAD_SAFE
+/*
+ * Support for user-space threads which require that some syscalls be
+ * private to the threaded library.
+ */
+#define PSYSCALL(x) 2: jmp cerror; ENTRY(_thread_sys_/**/x); lea SYS_/**/x,%eax; LCALL(7,0); jb 2b
+#else
+/*
+ * The non-threaded library defaults to traditional syscalls where
+ * the function name matches the syscall name.
+ */
+#define PSYSCALL(x) SYSCALL(x)
+#endif
+#define PRSYSCALL(x) PSYSCALL(x); ret
#define PSEUDO(x,y) ENTRY(x); lea SYS_/**/y, %eax; ; LCALL(7,0); ret
#define CALL(x,y) call _/**/y; addl $4*x,%esp
/* gas fucks up offset -- although we don't currently need it, do for BCS */
diff --git a/lib/libc/i386/gen/_setjmp.S b/lib/libc/i386/gen/_setjmp.S
index abd2684..23a2cde 100644
--- a/lib/libc/i386/gen/_setjmp.S
+++ b/lib/libc/i386/gen/_setjmp.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: _setjmp.S,v 1.3 1995/01/23 01:26:41 davidg Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: _setjmp.S,v 1.3 1995/01/23 01:26:41 davidg Exp $"
#endif /* LIBC_RCS and not lint */
/*
@@ -53,7 +53,11 @@
#include "DEFS.h"
+#ifdef _THREAD_SAFE
+ENTRY(__thread_sys_setjmp)
+#else
ENTRY(_setjmp)
+#endif
movl 4(%esp),%eax
movl 0(%esp),%edx
movl %edx, 0(%eax) /* rta */
@@ -66,7 +70,11 @@ ENTRY(_setjmp)
xorl %eax,%eax
ret
+#ifdef _THREAD_SAFE
+ENTRY(__thread_sys_longjmp)
+#else
ENTRY(_longjmp)
+#endif
movl 4(%esp),%edx
movl 8(%esp),%eax
movl 0(%edx),%ecx
diff --git a/lib/libc/i386/gen/setjmp.S b/lib/libc/i386/gen/setjmp.S
index fa52b83..89efa92 100644
--- a/lib/libc/i386/gen/setjmp.S
+++ b/lib/libc/i386/gen/setjmp.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: setjmp.S,v 1.3 1995/01/23 01:27:08 davidg Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: setjmp.S,v 1.3 1995/01/23 01:27:08 davidg Exp $"
#endif /* LIBC_RCS and not lint */
/*
@@ -54,9 +54,17 @@
#include "DEFS.h"
#include "SYS.h"
+#ifdef _THREAD_SAFE
+ENTRY(_thread_sys_setjmp)
+#else
ENTRY(setjmp)
+#endif
pushl $0
+#ifdef _THREAD_SAFE
+ call PIC_PLT(__thread_sys_sigblock)
+#else
call PIC_PLT(_sigblock)
+#endif
popl %edx
movl 4(%esp),%ecx
movl 0(%esp),%edx
@@ -71,10 +79,18 @@ ENTRY(setjmp)
xorl %eax,%eax
ret
+#ifdef _THREAD_SAFE
+ENTRY(_thread_sys_longjmp)
+#else
ENTRY(longjmp)
+#endif
movl 4(%esp),%edx
pushl 24(%edx)
+#ifdef _THREAD_SAFE
+ call PIC_PLT(__thread_sys_sigsetmask)
+#else
call PIC_PLT(_sigsetmask) /* XXX this is not reentrant */
+#endif
popl %eax
movl 4(%esp),%edx
movl 8(%esp),%eax
diff --git a/lib/libc/i386/gen/sigsetjmp.S b/lib/libc/i386/gen/sigsetjmp.S
index 4f592a3..1e15101 100644
--- a/lib/libc/i386/gen/sigsetjmp.S
+++ b/lib/libc/i386/gen/sigsetjmp.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigsetjmp.S,v 1.3 1994/12/27 13:34:04 bde Exp $
+ * $Id: sigsetjmp.S,v 1.4 1995/01/23 01:27:10 davidg Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: sigsetjmp.S,v 1.3 1994/12/27 13:34:04 bde Exp $"
+ .asciz "$Id: sigsetjmp.S,v 1.4 1995/01/23 01:27:10 davidg Exp $"
#endif /* LIBC_RCS and not lint */
#include "DEFS.h"
@@ -59,14 +59,22 @@
* use sigreturn() if sigreturn() works.
*/
+#ifdef _THREAD_SAFE
+ENTRY(_thread_sys_sigsetjmp)
+#else
ENTRY(sigsetjmp)
+#endif
movl 8(%esp),%eax
movl 4(%esp),%ecx
movl %eax,32(%ecx)
testl %eax,%eax
jz 1f
pushl $0
+#ifdef _THREAD_SAFE
+ call PIC_PLT(__thread_sys_sigblock)
+#else
call PIC_PLT(_sigblock)
+#endif
addl $4,%esp
movl 4(%esp),%ecx
movl %eax,24(%ecx)
@@ -81,12 +89,20 @@ ENTRY(sigsetjmp)
xorl %eax,%eax
ret
+#ifdef _THREAD_SAFE
+ENTRY(_thread_sys_siglongjmp)
+#else
ENTRY(siglongjmp)
+#endif
movl 4(%esp),%edx
cmpl $0,32(%edx)
jz 1f
pushl 24(%edx)
+#ifdef _THREAD_SAFE
+ call PIC_PLT(_thread_sys_sigsetmask)
+#else
call PIC_PLT(_sigsetmask)
+#endif
addl $4,%esp
1: movl 4(%esp),%edx
movl 8(%esp),%eax
diff --git a/lib/libc/i386/sys/Ovfork.S b/lib/libc/i386/sys/Ovfork.S
index 06e3eb6..341b75c 100644
--- a/lib/libc/i386/sys/Ovfork.S
+++ b/lib/libc/i386/sys/Ovfork.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: Ovfork.S,v 1.1 1994/08/05 01:18:38 wollman Exp $
+ * $Id: Ovfork.S,v 1.2 1995/01/23 01:29:37 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: Ovfork.S,v 1.2 1995/01/23 01:29:37 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
@@ -63,7 +63,28 @@ vforkok:
cmpl $0,%edx /* child process? */
jne child /* yes */
jmp parent
-.globl _errno
+#ifdef _THREAD_SAFE
+ /*
+ * Threaded version using __error().
+ */
+ .globl ___error
+ .type ___error,@function
+verror:
+ pushl %eax
+#ifdef PIC
+ call PIC_PLT(___error)
+#else
+ call ___error
+#endif
+ popl %ecx
+ movl %ecx,(%eax)
+ movl $-1,%eax
+ movl $-1,%edx
+#else /* !_THREAD_SAFE */
+ /*
+ * Non-threaded version using global errno.
+ */
+ .globl _errno
verror:
#ifdef PIC
PIC_PROLOGUE
@@ -74,6 +95,7 @@ verror:
movl %eax,_errno
#endif
movl $-1,%eax
+#endif /* !_THREAD_SAFE */
jmp %ecx
child:
movl $0,%eax
diff --git a/lib/libc/i386/sys/cerror.S b/lib/libc/i386/sys/cerror.S
index 875f6db..2cbb0f9 100644
--- a/lib/libc/i386/sys/cerror.S
+++ b/lib/libc/i386/sys/cerror.S
@@ -33,16 +33,39 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: cerror.S,v 1.2 1994/08/13 14:00:26 davidg Exp $
+ * $Id: cerror.S,v 1.3 1995/01/23 01:29:43 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: cerror.S,v 1.3 1995/01/23 01:29:43 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
+#ifdef _THREAD_SAFE
+ /*
+ * Threaded version using __error().
+ */
+ .globl ___error
+ .type ___error,@function
+cerror:
+ pushl %eax
+#ifdef PIC
+ call PIC_PLT(___error)
+#else
+ call ___error
+#endif
+ popl %ecx
+ movl %ecx,(%eax)
+ movl $-1,%eax
+ movl $-1,%edx
+ ret
+
+#else /* _THREAD_SAFE */
+ /*
+ * Non-threaded version using global errno.
+ */
.globl _errno
cerror:
#ifdef PIC
@@ -56,3 +79,4 @@ cerror:
movl $-1,%eax
movl $-1,%edx
ret
+#endif /* _THREAD_SAFE */
diff --git a/lib/libc/i386/sys/fork.S b/lib/libc/i386/sys/fork.S
index fe4c36d..567aa4c 100644
--- a/lib/libc/i386/sys/fork.S
+++ b/lib/libc/i386/sys/fork.S
@@ -33,17 +33,17 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: fork.S,v 1.1 1994/08/05 01:18:44 wollman Exp $
+ * $Id: fork.S,v 1.2 1995/01/23 01:29:48 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: fork.S,v 1.2 1995/01/23 01:29:48 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-SYSCALL(fork)
+PSYSCALL(fork)
cmpl $0,%edx /* parent, since %edx == 0 in parent, 1 in child */
je 1f
movl $0,%eax
diff --git a/lib/libc/i386/sys/pipe.S b/lib/libc/i386/sys/pipe.S
index cf3264c..809445f 100644
--- a/lib/libc/i386/sys/pipe.S
+++ b/lib/libc/i386/sys/pipe.S
@@ -33,17 +33,17 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: pipe.S,v 1.1 1994/08/05 01:18:46 wollman Exp $
+ * $Id: pipe.S,v 1.2 1995/01/23 01:29:57 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: pipe.S,v 1.2 1995/01/23 01:29:57 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-SYSCALL(pipe)
+PSYSCALL(pipe)
movl 4(%esp),%ecx
movl %eax,(%ecx)
movl %edx,4(%ecx)
diff --git a/lib/libc/i386/sys/sigpending.S b/lib/libc/i386/sys/sigpending.S
index fdc1e9f..dba82ee 100644
--- a/lib/libc/i386/sys/sigpending.S
+++ b/lib/libc/i386/sys/sigpending.S
@@ -33,17 +33,17 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigpending.S,v 1.1 1994/08/05 01:18:51 wollman Exp $
+ * $Id: sigpending.S,v 1.2 1995/01/23 01:30:08 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: sigpending.S,v 1.2 1995/01/23 01:30:08 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-SYSCALL(sigpending)
+PSYSCALL(sigpending)
movl 4(%esp),%ecx # fetch pointer to...
movl %eax,(%ecx) # store old mask
xorl %eax,%eax
diff --git a/lib/libc/i386/sys/sigprocmask.S b/lib/libc/i386/sys/sigprocmask.S
index 1757a3a..69c50a4 100644
--- a/lib/libc/i386/sys/sigprocmask.S
+++ b/lib/libc/i386/sys/sigprocmask.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigprocmask.S,v 1.1 1994/08/05 01:18:52 wollman Exp $
+ * $Id: sigprocmask.S,v 1.2 1995/01/23 01:30:11 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: sigprocmask.S,v 1.2 1995/01/23 01:30:11 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
@@ -46,7 +46,11 @@
err:
jmp cerror
+#ifdef _THREAD_SAFE
+ENTRY(_thread_sys_sigprocmask)
+#else
ENTRY(sigprocmask)
+#endif
movl 8(%esp),%ecx # fetch new sigset pointer
cmpl $0,%ecx # check new sigset pointer
jne 1f # if not null, indirect
diff --git a/lib/libc/i386/sys/sigreturn.S b/lib/libc/i386/sys/sigreturn.S
index ac0ffd6..6f3f571 100644
--- a/lib/libc/i386/sys/sigreturn.S
+++ b/lib/libc/i386/sys/sigreturn.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigreturn.S,v 1.1 1994/08/05 01:18:53 wollman Exp $
+ * $Id: sigreturn.S,v 1.2 1995/01/23 01:30:16 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: sigreturn.S,v 1.2 1995/01/23 01:30:16 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
@@ -53,5 +53,5 @@
.data; 1:; .long 0; .text; movl $1b,%eax; call mcount; popa ; nop
#endif /* PROF */
-SYSCALL(sigreturn)
+PSYSCALL(sigreturn)
ret
diff --git a/lib/libc/i386/sys/sigsuspend.S b/lib/libc/i386/sys/sigsuspend.S
index a72154a..4d70ea6 100644
--- a/lib/libc/i386/sys/sigsuspend.S
+++ b/lib/libc/i386/sys/sigsuspend.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: sigsuspend.S,v 1.2 1995/01/23 01:30:20 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: sigsuspend.S,v 1.2 1995/01/23 01:30:20 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
@@ -46,7 +46,11 @@
err:
jmp cerror
+#ifdef _THREAD_SAFE
+ENTRY(_thread_sys_sigsuspend)
+#else
ENTRY(sigsuspend)
+#endif
movl 4(%esp),%eax # fetch mask arg
movl (%eax),%eax # indirect to mask arg
movl %eax,4(%esp)
OpenPOWER on IntegriCloud