diff options
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/Makefile | 19 | ||||
-rw-r--r-- | lib/libpthread/arch/alpha/machdep.c (renamed from lib/libpthread/machdep/engine-alpha-netbsd-1.3.c) | 0 | ||||
-rw-r--r-- | lib/libpthread/arch/alpha/machdep.h (renamed from lib/libpthread/machdep/engine-alpha-netbsd-1.3.h) | 0 | ||||
-rw-r--r-- | lib/libpthread/arch/alpha/syscall-template.S (renamed from lib/libpthread/machdep/syscall-template-alpha-netbsd-1.3.S) | 0 | ||||
-rw-r--r-- | lib/libpthread/arch/alpha/syscall.S (renamed from lib/libpthread/machdep/syscall-alpha-netbsd-1.3.S) | 0 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/machdep.c | 115 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/machdep.h | 99 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/syscall-template.S (renamed from lib/libpthread/machdep/syscall-template-i386-openbsd-2.0.S) | 0 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/syscall.S | 211 | ||||
-rw-r--r-- | lib/libpthread/arch/m68k/machdep.h | 52 | ||||
-rw-r--r-- | lib/libpthread/arch/sparc/syscall-template.S (renamed from lib/libpthread/machdep/syscall-template-sparc-netbsd-1.1.S) | 0 | ||||
-rw-r--r-- | lib/libpthread/arch/sparc/syscall.S (renamed from lib/libpthread/machdep/syscall-sparc-netbsd-1.1.S) | 2 | ||||
-rw-r--r-- | lib/libpthread/gen/Makefile.inc | 24 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/__math.h (renamed from lib/libpthread/machdep/openbsd-2.0/__math.h) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/__path.h (renamed from lib/libpthread/machdep/openbsd-2.0/__path.h) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/__signal.h (renamed from lib/libpthread/machdep/openbsd-2.0/__signal.h) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/__stdio.h (renamed from lib/libpthread/machdep/openbsd-2.0/__stdio.h) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/__stdlib.h (renamed from lib/libpthread/machdep/openbsd-2.0/__stdlib.h) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/__string.h (renamed from lib/libpthread/machdep/openbsd-2.0/__string.h) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/__time.h (renamed from lib/libpthread/machdep/openbsd-2.0/__time.h) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/__unistd.h (renamed from lib/libpthread/machdep/openbsd-2.0/__unistd.h) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/compat.h (renamed from lib/libpthread/machdep/openbsd-2.0/compat.h) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/dirent.h (renamed from lib/libpthread/machdep/openbsd-2.0/dirent.h) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/errno.h (renamed from lib/libpthread/machdep/openbsd-2.0/errno.h) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/timers.h (renamed from lib/libpthread/machdep/openbsd-2.0/timers.h) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/libpthread/include/sys/wait.h (renamed from lib/libpthread/machdep/openbsd-2.0/wait.h) | 2 | ||||
-rw-r--r-- | lib/libpthread/machdep/engine-i386-openbsd-2.0.c | 215 | ||||
-rw-r--r-- | lib/libpthread/machdep/engine-i386-openbsd-2.0.h | 97 | ||||
-rw-r--r-- | lib/libpthread/machdep/engine-m68000-netbsd.h | 77 | ||||
-rw-r--r-- | lib/libpthread/machdep/posix-openbsd-2.0.h | 31 | ||||
-rw-r--r-- | lib/libpthread/machdep/syscall-i386-openbsd-2.0.S | 237 | ||||
-rw-r--r-- | lib/libpthread/net/Makefile.inc | 5 | ||||
-rw-r--r-- | lib/libpthread/pthreads/Makefile.inc | 64 | ||||
-rw-r--r-- | lib/libpthread/stdio/Makefile.inc | 16 | ||||
-rw-r--r-- | lib/libpthread/stdlib/Makefile.inc | 7 | ||||
-rw-r--r-- | lib/libpthread/string/Makefile.inc | 4 |
36 files changed, 439 insertions, 850 deletions
diff --git a/lib/libpthread/Makefile b/lib/libpthread/Makefile index 0af5927b9b2..866c4456a5c 100644 --- a/lib/libpthread/Makefile +++ b/lib/libpthread/Makefile @@ -2,16 +2,19 @@ # @(#)Makefile 5.2 (Berkeley) 3/5/91 # +.include <bsd.own.mk> + LIB=pthread NOPIC= no -CPPFLAGS+= -DPTHREAD_KERNEL -I. -I${.CURDIR}/include -I${.CURDIR}/arch/${MACHINE_ARCH} +CPPFLAGS+= -I. -I${.CURDIR}/include -I${.CURDIR}/arch/${MACHINE_ARCH} -.include "${srcdir}/pthreads/Makefile.inc" -.include "${srcdir}/stdlib/Makefile.inc" -.include "${srcdir}/stdio/Makefile.inc" -.include "${srcdir}/string/Makefile.inc" -.include "${srcdir}/gen/Makefile.inc" -.include "${srcdir}/net/Makefile.inc" -.include "${srcdir}/scripts/Makefile.inc" +.include "${.CURDIR}/arch/${MACHINE}/Makefile.inc" +#.include "${.CURDIR}/pthreads/Makefile.inc" +#.include "${.CURDIR}/stdlib/Makefile.inc" +#.include "${.CURDIR}/stdio/Makefile.inc" +#.include "${.CURDIR}/string/Makefile.inc" +#.include "${.CURDIR}/gen/Makefile.inc" +#.include "${.CURDIR}/net/Makefile.inc" +#.include "${.CURDIR}/scripts/Makefile.inc" .include <bsd.lib.mk> diff --git a/lib/libpthread/machdep/engine-alpha-netbsd-1.3.c b/lib/libpthread/arch/alpha/machdep.c index 0932c421ea2..0932c421ea2 100644 --- a/lib/libpthread/machdep/engine-alpha-netbsd-1.3.c +++ b/lib/libpthread/arch/alpha/machdep.c diff --git a/lib/libpthread/machdep/engine-alpha-netbsd-1.3.h b/lib/libpthread/arch/alpha/machdep.h index 50c872da7b6..50c872da7b6 100644 --- a/lib/libpthread/machdep/engine-alpha-netbsd-1.3.h +++ b/lib/libpthread/arch/alpha/machdep.h diff --git a/lib/libpthread/machdep/syscall-template-alpha-netbsd-1.3.S b/lib/libpthread/arch/alpha/syscall-template.S index a2941ece7c9..a2941ece7c9 100644 --- a/lib/libpthread/machdep/syscall-template-alpha-netbsd-1.3.S +++ b/lib/libpthread/arch/alpha/syscall-template.S diff --git a/lib/libpthread/machdep/syscall-alpha-netbsd-1.3.S b/lib/libpthread/arch/alpha/syscall.S index eda44311281..eda44311281 100644 --- a/lib/libpthread/machdep/syscall-alpha-netbsd-1.3.S +++ b/lib/libpthread/arch/alpha/syscall.S diff --git a/lib/libpthread/arch/i386/machdep.c b/lib/libpthread/arch/i386/machdep.c index 2437cead1b1..09ff0072fdc 100644 --- a/lib/libpthread/arch/i386/machdep.c +++ b/lib/libpthread/arch/i386/machdep.c @@ -1,7 +1,5 @@ /* ==== machdep.c ============================================================ - * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu - * - * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * Copyright (c) 1995 by Chris Provenzano, proven@mit.edu * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,17 +36,32 @@ */ #ifndef lint -static const char rcsid[] = "$Id: machdep.c,v 1.1 1995/10/18 08:43:03 deraadt Exp $"; +static const char rcsid[] = "engine-i386-freebsd-2.0.c,v 1.1 1995/03/01 01:21:20 proven Exp"; #endif -#include "pthread.h" +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <stdlib.h> +#include <fcntl.h> +#include <stdio.h> /* ========================================================================== * machdep_save_state() */ int machdep_save_state(void) { - return(_setjmp(pthread_run->machdep_data.machdep_state)); + return(machdep_sys_setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_float_state(struct pthread * pthread) +{ + char * fdata = (char *)pthread->machdep_data.machdep_float_state; + + __asm__ ("fsave %0"::"m" (*fdata)); } /* ========================================================================== @@ -56,7 +69,17 @@ int machdep_save_state(void) */ void machdep_restore_state(void) { - _longjmp(pthread_run->machdep_data.machdep_state, 1); + machdep_sys_longjmp(pthread_run->machdep_data.machdep_state, 1); +} + +/* ========================================================================== + * machdep_restore_float_state() + */ +int machdep_restore_float_state(void) +{ + char * fdata = (char *)pthread_run->machdep_data.machdep_float_state; + + __asm__ ("frstor %0"::"m" (*fdata)); } /* ========================================================================== @@ -74,11 +97,19 @@ void machdep_set_thread_timer(struct machdep_pthread *machdep_pthread) */ void machdep_unset_thread_timer(struct machdep_pthread *machdep_pthread) { - struct itimerval zeroval = { { 0, 0 }, { 0, 0} }; - - if (setitimer(ITIMER_VIRTUAL, &zeroval, NULL)) { - PANIC(); + struct itimerval zeroval = { { 0, 0 }, { 0, 0 } }; + int ret; + + if (machdep_pthread) { + ret = setitimer(ITIMER_VIRTUAL, &zeroval, + &(machdep_pthread->machdep_timer)); + } else { + ret = setitimer(ITIMER_VIRTUAL, &zeroval, NULL); } + + if (ret) { + PANIC(); + } } /* ========================================================================== @@ -95,7 +126,7 @@ void *machdep_pthread_cleanup(struct machdep_pthread *machdep_pthread) void machdep_pthread_start(void) { context_switch_done(); - sig_check_and_resume(); + pthread_sched_resume(); /* Run current threads start routine with argument */ pthread_exit(pthread_run->machdep_data.start_routine @@ -106,14 +137,30 @@ void machdep_pthread_start(void) } /* ========================================================================== - * machdep_pthread_create() + * __machdep_stack_free() + */ +void __machdep_stack_free(void * stack) +{ + free(stack); +} + +/* ========================================================================== + * __machdep_stack_alloc() */ -void machdep_pthread_create(struct machdep_pthread *machdep_pthread, - void *(* start_routine)(), void *start_argument, long stack_size, - void *stack_start, long nsec) +void * __machdep_stack_alloc(size_t size) { - machdep_pthread->machdep_stack = stack_start; + void * stack; + + return(malloc(size)); +} +/* ========================================================================== + * __machdep_pthread_create() + */ +void __machdep_pthread_create(struct machdep_pthread *machdep_pthread, + void *(* start_routine)(), void *start_argument, + long stack_size, long nsec, long flags) +{ machdep_pthread->start_routine = start_routine; machdep_pthread->start_argument = start_argument; @@ -122,7 +169,7 @@ void machdep_pthread_create(struct machdep_pthread *machdep_pthread, machdep_pthread->machdep_timer.it_interval.tv_usec = 0; machdep_pthread->machdep_timer.it_value.tv_usec = nsec / 1000; - _setjmp(machdep_pthread->machdep_state); + machdep_sys_setjmp(machdep_pthread->machdep_state); /* * Set up new stact frame so that it looks like it * returned from a longjmp() to the beginning of @@ -134,3 +181,35 @@ void machdep_pthread_create(struct machdep_pthread *machdep_pthread, machdep_pthread->machdep_state[2] = (int)machdep_pthread->machdep_stack + stack_size; } + +/* ========================================================================== + * machdep_sys_creat() + */ +machdep_sys_creat(char * path, int mode) +{ + return(machdep_sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); +} + +/* ========================================================================== + * machdep_sys_wait3() + */ +machdep_sys_wait3(int * b, int c, int * d) +{ + return(machdep_sys_wait4(0, b, c, d)); +} + +/* ========================================================================== + * machdep_sys_waitpid() + */ +machdep_sys_waitpid(int a, int * b, int c) +{ + return(machdep_sys_wait4(a, b, c, NULL)); +} + +/* ========================================================================== + * machdep_sys_getdtablesize() + */ +machdep_sys_getdtablesize() +{ + return(sysconf(_SC_OPEN_MAX)); +} diff --git a/lib/libpthread/arch/i386/machdep.h b/lib/libpthread/arch/i386/machdep.h index 10521b02235..41a3a553cc0 100644 --- a/lib/libpthread/arch/i386/machdep.h +++ b/lib/libpthread/arch/i386/machdep.h @@ -1,36 +1,13 @@ /* ==== machdep.h ============================================================ - * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu - * All rights reserved. + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Chris Provenzano. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * $Id: machdep.h,v 1.2 1998/07/21 16:28:02 peter Exp $ * */ +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> /* * The first machine dependent functions are the SEMAPHORES @@ -41,9 +18,9 @@ #define SEMAPHORE_TEST_AND_SET(lock) \ ({ \ -volatile long temp = SEMAPHORE_SET; \ +long temp = SEMAPHORE_SET; \ \ -__asm__("xchgl %0,(%2)" \ +__asm__ volatile ("xchgl %0,(%2)" \ :"=r" (temp) \ :"0" (temp),"r" (lock)); \ temp; \ @@ -52,7 +29,69 @@ temp; \ #define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR /* + * New types + */ +typedef long semaphore; + +/* + * sigset_t macros + */ +#define SIG_ANY(sig) (sig) +#define SIGMAX 31 + +/* + * New Strutures + */ +struct machdep_pthread { + void *(*start_routine)(void *); + void *start_argument; + void *machdep_stack; + struct itimerval machdep_timer; + jmp_buf machdep_state; + char machdep_float_state[108]; +}; + +/* + * Static machdep_pthread initialization values. + * For initial thread only. + */ +#define MACHDEP_PTHREAD_INIT \ +{ NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 } + +/* * Minimum stack size */ #define PTHREAD_STACK_MIN 1024 +/* + * Some fd flag defines that are necessary to distinguish between posix + * behavior and bsd4.3 behavior. + */ +#define __FD_NONBLOCK O_NONBLOCK + +/* + * New functions + */ + +__BEGIN_DECLS + +#if defined(PTHREAD_KERNEL) + +#define __machdep_stack_get(x) (x)->machdep_stack +#define __machdep_stack_set(x, y) (x)->machdep_stack = y +#define __machdep_stack_repl(x, y) \ +{ \ + if (stack = __machdep_stack_get(x)) { \ + __machdep_stack_free(stack); \ + } \ + __machdep_stack_set(x, y); \ +} + +void * __machdep_stack_alloc __P_((size_t)); +void __machdep_stack_free __P_((void *)); + +int machdep_save_state __P_((void)); + +#endif + +__END_DECLS diff --git a/lib/libpthread/machdep/syscall-template-i386-openbsd-2.0.S b/lib/libpthread/arch/i386/syscall-template.S index 34fb5caaa43..34fb5caaa43 100644 --- a/lib/libpthread/machdep/syscall-template-i386-openbsd-2.0.S +++ b/lib/libpthread/arch/i386/syscall-template.S diff --git a/lib/libpthread/arch/i386/syscall.S b/lib/libpthread/arch/i386/syscall.S index 1b91abed0c8..cfdbbc77f73 100644 --- a/lib/libpthread/arch/i386/syscall.S +++ b/lib/libpthread/arch/i386/syscall.S @@ -1,6 +1,6 @@ /* ==== syscall.S ============================================================ * Copyright (c) 1990 The Regents of the University of California. - * Copyright (c) 1993 Chris Provenzano, proven@mit.edu + * Copyright (c) 1995 Chris Provenzano, proven@mit.edu * All rights reserved. * * This code is derived from software contributed to Berkeley by @@ -36,25 +36,33 @@ * * Description : Machine dependent syscalls for i386/i486/i586 * - * 1.00 93/08/26 proven - * -Started coding this file. - * - * 1.01 93/11/13 proven - * -The functions readv() and writev() added. */ #ifndef lint - .text - .asciz "$Id: syscall.S,v 1.1 1995/10/18 08:43:03 deraadt Exp $"; + .text + .asciz "syscall-i386-freebsd-2.0.S,v 1.2 1995/05/26 07:44:29 proven Exp"; #endif #if defined(SYSLIBC_SCCS) && !defined(lint) .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90" #endif /* SYSLIBC_SCCS and not lint */ -#include <machine/asm.h> #include <sys/syscall.h> +#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; + +#else + #define SYSCALL(x) \ .globl _machdep_sys_/**/x; \ \ @@ -65,6 +73,9 @@ _machdep_sys_/**/x:; \ jb 1b; \ ret; +#endif + + /* * Initial asm stuff for all functions. */ @@ -82,93 +93,145 @@ _machdep_sys_/**/x:; \ ret /* ========================================================================== - * machdep_sys_write() - */ -SYSCALL(write) - -/* ========================================================================== - * machdep_sys_read() + * machdep_sys_fork() */ -SYSCALL(read) + .globl _machdep_sys_fork; + +_machdep_sys_fork:; + + movl $(SYS_fork), %eax; + .byte 0x9a; .long 0; .word 7; + cmpl $0, %edx + je 2f + movl $0, %eax +2: + ret; /* ========================================================================== - * machdep_sys_open() + * machdep_sys___syscall() */ -SYSCALL(open) -/* ========================================================================== - * machdep_sys_close() - */ -SYSCALL(close) +_machdep_sys___syscall:; -/* ========================================================================== - * machdep_sys_fcntl() - */ -SYSCALL(fcntl) + movl $(SYS___syscall), %eax; + .byte 0x9a; .long 0; .word 7; + jb 3f; + ret /* ========================================================================== - * machdep_sys_lseek() - */ -SYSCALL(lseek) - -/* ========================================================================== - * Nonstandard calls used to make the system work - * - * ========================================================================== - * machdep_sys_select() + * machdep_sys_sigsuspend() */ -SYSCALL(select) + .globl _machdep_sys_sigsuspend; -/* ========================================================================== - * Berkeley socket stuff - * - * ========================================================================== - * machdep_sys_socket() - */ -SYSCALL(socket) +_machdep_sys_sigsuspend:; -/* ========================================================================== - * machdep_sys_bind() - */ -SYSCALL(bind) + movl 4(%esp),%eax # fetch mask arg + movl (%eax),%eax # indirect to mask arg + movl %eax,4(%esp) + movl $(SYS_sigsuspend), %eax; + .byte 0x9a; .long 0; .word 7; + jb 3f; + ret -/* ========================================================================== - * machdep_sys_connect() - */ -SYSCALL(connect) +3: + + neg %eax + movl $0xffffffff,%edx + ret /* ========================================================================== - * machdep_sys_accept() + * machdep_sys_sigprocmask() */ -SYSCALL(accept) + .globl _machdep_sys_sigprocmask; -/* ========================================================================== - * machdep_sys_listen() - */ -SYSCALL(listen) +_machdep_sys_sigprocmask:; -/* ========================================================================== - * machdep_sys_getsockopt() - */ -SYSCALL(getsockopt) - -/* ========================================================================== - * machdep_sys_readv() - */ -SYSCALL(readv) + movl 8(%esp),%ecx + movl (%ecx),%ecx + movl %ecx,8(%esp) + movl $ SYS_sigprocmask , %eax + .byte 0x9a; .long 0; .word 7; + jb 4f; + ret -/* ========================================================================== - * machdep_sys_writev() - */ -SYSCALL(writev) +4: + neg %eax + movl $0xffffffff,%edx + ret /* ========================================================================== - * machdep_sys_getpeername() + * machdep_sys_lseek() */ -SYSCALL(getpeername) + .globl _machdep_sys_lseek; + +_machdep_sys_lseek:; + + pushl %ebp; + movl %esp,%ebp; + pushl 0x14(%ebp); + pushl 0x10(%ebp); + pushl 0xc(%ebp); + pushl $0x0; + pushl 0x8(%ebp); + pushl $0x0; + pushl $(SYS_lseek); + call _machdep_sys___syscall; + leave + ret /* ========================================================================== - * machdep_sys_getsockname() + * machdep_sys_ftruncate() ; Added by Monty */ -SYSCALL(getsockname) + .globl _machdep_sys_ftruncate; + +_machdep_sys_ftruncate:; + + pushl %ebp; + movl %esp,%ebp; + pushl 0x10(%ebp); + pushl 0xc(%ebp); + pushl $0x0; # Why this? + pushl 0x8(%ebp); + pushl $0x0; # And this? + pushl $(SYS_ftruncate); + call _machdep_sys___syscall; + leave + ret + +/* ========================================================================== + * machdep_sys_setjmp() + */ + .globl _machdep_sys_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 + +/* ========================================================================== + * machdep_sys_longjmp() + */ + .globl _machdep_sys_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 diff --git a/lib/libpthread/arch/m68k/machdep.h b/lib/libpthread/arch/m68k/machdep.h index a63e77de0d3..72b42e45c7b 100644 --- a/lib/libpthread/arch/m68k/machdep.h +++ b/lib/libpthread/arch/m68k/machdep.h @@ -1,11 +1,10 @@ -/* $OpenBSD */ - /* ==== machdep.h ============================================================ * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu * - * $ I d: engine-m68000-netbsd.h,v 1.51 1994/11/08 15:39:15 proven Exp $ + * $Id: machdep.h,v 1.2 1998/07/21 16:28:05 peter Exp $ * */ + #include <unistd.h> #include <setjmp.h> #include <sys/time.h> @@ -17,24 +16,53 @@ #define SEMAPHORE_CLEAR 0 #define SEMAPHORE_SET 0x80; -#define SEMAPHORE_TEST_AND_SET(lock) \ -({ \ - volatile long temp = SEMAPHORE_CLEAR; \ - __asm__ volatile( \ - "tas %2; bpl 0f; movl #1,%0; 0:" \ - :"=r" (temp) \ - :"0" (temp),"m" (*lock)); \ - temp; \ +#define SEMAPHORE_TEST_AND_SET(lock) \ +({ \ +volatile long temp = SEMAPHORE_CLEAR; \ + \ +__asm__ volatile("tas (%2); bpl 0f; movl #1,%0; 0:" \ + :"=r" (temp) \ + :"0" (temp),"r" (lock)); \ +temp; \ }) #define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR /* + * New types + */ +typedef char semaphore; + +/* + * sigset_t macros + */ +#define SIG_ANY(sig) (sig) +#define SIGMAX 31 + +/* + * New Strutures + */ +struct machdep_pthread { + void *(*start_routine)(void *); + void *start_argument; + void *machdep_stack; + struct itimerval machdep_timer; + jmp_buf machdep_state; +}; + +/* * Min pthread stacksize */ #define PTHREAD_STACK_MIN 1024 /* + * Static machdep_pthread initialization values. + * For initial thread only. + */ +#define MACHDEP_PTHREAD_INIT \ +{ NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 } + +/* * New functions */ @@ -42,7 +70,7 @@ __BEGIN_DECLS #if defined(PTHREAD_KERNEL) -int machdep_save_state __P((void)); +int machdep_save_state __P_((void)); #endif diff --git a/lib/libpthread/machdep/syscall-template-sparc-netbsd-1.1.S b/lib/libpthread/arch/sparc/syscall-template.S index 2d07892a315..2d07892a315 100644 --- a/lib/libpthread/machdep/syscall-template-sparc-netbsd-1.1.S +++ b/lib/libpthread/arch/sparc/syscall-template.S diff --git a/lib/libpthread/machdep/syscall-sparc-netbsd-1.1.S b/lib/libpthread/arch/sparc/syscall.S index 78df3bd8c8a..9312ef7352a 100644 --- a/lib/libpthread/machdep/syscall-sparc-netbsd-1.1.S +++ b/lib/libpthread/arch/sparc/syscall.S @@ -6,7 +6,7 @@ #ifndef lint .text - .asciz "$Id: syscall-sparc-netbsd-1.1.S,v 1.1 1998/07/21 13:19:17 peter Exp $"; + .asciz "$Id: syscall.S,v 1.1 1998/07/21 16:28:06 peter Exp $"; #endif #include <sys/syscall.h> diff --git a/lib/libpthread/gen/Makefile.inc b/lib/libpthread/gen/Makefile.inc index 275955e9c86..a2e13b4a205 100644 --- a/lib/libpthread/gen/Makefile.inc +++ b/lib/libpthread/gen/Makefile.inc @@ -1,24 +1,8 @@ # from: @(#)Makefile.inc 5.21 (Berkeley) 5/24/91 -# $Id: Makefile.inc,v 1.1 1998/07/21 13:19:02 peter Exp $ +# $Id: Makefile.inc,v 1.2 1998/07/21 16:28:06 peter Exp $ -# gen sources -.PATH: ${srcdir}/gen +.PATH: ${.CURDIR}/gen SRCS+= ttyname.c isatty.c directory.c popen.c time.c ctime.c difftime.c \ - syslog.c eprintf.c getpwent.c getpwnamuid.c pwd_internal.c - -#SRCS+= alarm.c assert.c clock.c crypt.c ctermid.c ctype_.c \ -# disklabel.c err.c errlst.c exec.c fnmatch.c frexp.c \ -# fstab.c fts.c getcap.c getcwd.c getgrent.c getlogin.c getmntinfo.c \ -# getpass.c getpwent.c getsubopt.c getttyent.c getusershell.c glob.c \ -# infinity.c initgroups.c isatty.c isctype.c isinf.c mktemp.c nice.c \ -# nlist.c pause.c psignal.c raise.c \ -# scandir.c setjmperr.c \ -# setmode.c setrgid.c setruid.c siginterrupt.c \ -# siglist.c signal.c sigsetops.c syslog.c \ -# termios.c time.c times.c timezone.c ttyslot.c \ -# ualarm.c unvis.c utime.c valloc.c vis.c -# -# gen/regexp sources -#SRCS+= regerror.c regexp.c regsub.c - + syslog.c eprintf.c getpwent.c getpwnamuid.c pwd_internal.c getcwd.c \ + getwd.c diff --git a/lib/libpthread/machdep/openbsd-2.0/__math.h b/lib/libpthread/include/sys/__math.h index 27ed0f2575d..27ed0f2575d 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/__math.h +++ b/lib/libpthread/include/sys/__math.h diff --git a/lib/libpthread/machdep/openbsd-2.0/__path.h b/lib/libpthread/include/sys/__path.h index 3f3e8f826f5..e5a48d8ab73 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/__path.h +++ b/lib/libpthread/include/sys/__path.h @@ -1,6 +1,6 @@ /* * from: @(#)time.h 5.12 (Berkeley) 3/9/91 - * $Id: __path.h,v 1.1 1998/07/21 13:19:42 peter Exp $ + * $Id: __path.h,v 1.1 1998/07/21 16:28:08 peter Exp $ */ #ifndef _SYS__PATH_H_ diff --git a/lib/libpthread/machdep/openbsd-2.0/__signal.h b/lib/libpthread/include/sys/__signal.h index 918955c9948..918955c9948 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/__signal.h +++ b/lib/libpthread/include/sys/__signal.h diff --git a/lib/libpthread/machdep/openbsd-2.0/__stdio.h b/lib/libpthread/include/sys/__stdio.h index d60b9df7a54..d60b9df7a54 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/__stdio.h +++ b/lib/libpthread/include/sys/__stdio.h diff --git a/lib/libpthread/machdep/openbsd-2.0/__stdlib.h b/lib/libpthread/include/sys/__stdlib.h index 6b0730e3ef3..cfcbe91867c 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/__stdlib.h +++ b/lib/libpthread/include/sys/__stdlib.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)stdlib.h 5.13 (Berkeley) 6/4/91 - * $Id: __stdlib.h,v 1.1 1998/07/21 13:19:41 peter Exp $ + * $Id: __stdlib.h,v 1.1 1998/07/21 16:28:08 peter Exp $ */ #ifndef _SYS___STDLIB_H_ diff --git a/lib/libpthread/machdep/openbsd-2.0/__string.h b/lib/libpthread/include/sys/__string.h index 93d4fcf9dd2..93d4fcf9dd2 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/__string.h +++ b/lib/libpthread/include/sys/__string.h diff --git a/lib/libpthread/machdep/openbsd-2.0/__time.h b/lib/libpthread/include/sys/__time.h index 9423e10411b..536ec0400ad 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/__time.h +++ b/lib/libpthread/include/sys/__time.h @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * from: @(#)time.h 5.12 (Berkeley) 3/9/91 - * $Id: __time.h,v 1.1 1998/07/21 13:19:41 peter Exp $ + * $Id: __time.h,v 1.1 1998/07/21 16:28:08 peter Exp $ */ #ifndef _SYS__TIME_H_ diff --git a/lib/libpthread/machdep/openbsd-2.0/__unistd.h b/lib/libpthread/include/sys/__unistd.h index 2ad0f99c8c9..d4d621a8618 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/__unistd.h +++ b/lib/libpthread/include/sys/__unistd.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)stdlib.h 5.13 (Berkeley) 6/4/91 - * $Id: __unistd.h,v 1.1 1998/07/21 13:19:41 peter Exp $ + * $Id: __unistd.h,v 1.1 1998/07/21 16:28:08 peter Exp $ */ #ifndef _SYS___UNISTD_H_ diff --git a/lib/libpthread/machdep/openbsd-2.0/compat.h b/lib/libpthread/include/sys/compat.h index b85e46458a6..604b61e3907 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/compat.h +++ b/lib/libpthread/include/sys/compat.h @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: compat.h,v 1.1 1998/07/21 13:19:41 peter Exp $ + * $Id: compat.h,v 1.1 1998/07/21 16:28:08 peter Exp $ * * Description : COmpat header to make socket code compile. * diff --git a/lib/libpthread/machdep/openbsd-2.0/dirent.h b/lib/libpthread/include/sys/dirent.h index 5226443f86b..5226443f86b 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/dirent.h +++ b/lib/libpthread/include/sys/dirent.h diff --git a/lib/libpthread/machdep/openbsd-2.0/errno.h b/lib/libpthread/include/sys/errno.h index 3da61d692a3..3da61d692a3 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/errno.h +++ b/lib/libpthread/include/sys/errno.h diff --git a/lib/libpthread/machdep/openbsd-2.0/timers.h b/lib/libpthread/include/sys/timers.h index a4e39867166..c15b91d34ba 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/timers.h +++ b/lib/libpthread/include/sys/timers.h @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: timers.h,v 1.1 1998/07/21 13:19:41 peter Exp $ + * $Id: timers.h,v 1.1 1998/07/21 16:28:09 peter Exp $ * * Description : Basic timers header. * diff --git a/lib/libpthread/machdep/openbsd-2.0/wait.h b/lib/libpthread/include/sys/wait.h index b68a8a38c35..063dc3d766c 100755..100644 --- a/lib/libpthread/machdep/openbsd-2.0/wait.h +++ b/lib/libpthread/include/sys/wait.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)wait.h 8.1 (Berkeley) 6/2/93 - * $Id: wait.h,v 1.1 1998/07/21 13:19:42 peter Exp $ + * $Id: wait.h,v 1.1 1998/07/21 16:28:09 peter Exp $ */ #ifndef _SYS_WAIT_H_ diff --git a/lib/libpthread/machdep/engine-i386-openbsd-2.0.c b/lib/libpthread/machdep/engine-i386-openbsd-2.0.c deleted file mode 100644 index 09ff0072fdc..00000000000 --- a/lib/libpthread/machdep/engine-i386-openbsd-2.0.c +++ /dev/null @@ -1,215 +0,0 @@ -/* ==== machdep.c ============================================================ - * Copyright (c) 1995 by Chris Provenzano, proven@mit.edu - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Chris Provenzano. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Description : Machine dependent functions for NetBSD on i386 - * - * 1.00 93/08/04 proven - * -Started coding this file. - */ - -#ifndef lint -static const char rcsid[] = "engine-i386-freebsd-2.0.c,v 1.1 1995/03/01 01:21:20 proven Exp"; -#endif - -#include <pthread.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <stdlib.h> -#include <fcntl.h> -#include <stdio.h> - -/* ========================================================================== - * machdep_save_state() - */ -int machdep_save_state(void) -{ - return(machdep_sys_setjmp(pthread_run->machdep_data.machdep_state)); -} - -/* ========================================================================== - * machdep_save_state() - */ -int machdep_save_float_state(struct pthread * pthread) -{ - char * fdata = (char *)pthread->machdep_data.machdep_float_state; - - __asm__ ("fsave %0"::"m" (*fdata)); -} - -/* ========================================================================== - * machdep_restore_state() - */ -void machdep_restore_state(void) -{ - machdep_sys_longjmp(pthread_run->machdep_data.machdep_state, 1); -} - -/* ========================================================================== - * machdep_restore_float_state() - */ -int machdep_restore_float_state(void) -{ - char * fdata = (char *)pthread_run->machdep_data.machdep_float_state; - - __asm__ ("frstor %0"::"m" (*fdata)); -} - -/* ========================================================================== - * machdep_set_thread_timer() - */ -void machdep_set_thread_timer(struct machdep_pthread *machdep_pthread) -{ - if (setitimer(ITIMER_VIRTUAL, &(machdep_pthread->machdep_timer), NULL)) { - PANIC(); - } -} - -/* ========================================================================== - * machdep_unset_thread_timer() - */ -void machdep_unset_thread_timer(struct machdep_pthread *machdep_pthread) -{ - struct itimerval zeroval = { { 0, 0 }, { 0, 0 } }; - int ret; - - if (machdep_pthread) { - ret = setitimer(ITIMER_VIRTUAL, &zeroval, - &(machdep_pthread->machdep_timer)); - } else { - ret = setitimer(ITIMER_VIRTUAL, &zeroval, NULL); - } - - if (ret) { - PANIC(); - } -} - -/* ========================================================================== - * machdep_pthread_cleanup() - */ -void *machdep_pthread_cleanup(struct machdep_pthread *machdep_pthread) -{ - return(machdep_pthread->machdep_stack); -} - -/* ========================================================================== - * machdep_pthread_start() - */ -void machdep_pthread_start(void) -{ - context_switch_done(); - pthread_sched_resume(); - - /* Run current threads start routine with argument */ - pthread_exit(pthread_run->machdep_data.start_routine - (pthread_run->machdep_data.start_argument)); - - /* should never reach here */ - PANIC(); -} - -/* ========================================================================== - * __machdep_stack_free() - */ -void __machdep_stack_free(void * stack) -{ - free(stack); -} - -/* ========================================================================== - * __machdep_stack_alloc() - */ -void * __machdep_stack_alloc(size_t size) -{ - void * stack; - - return(malloc(size)); -} - -/* ========================================================================== - * __machdep_pthread_create() - */ -void __machdep_pthread_create(struct machdep_pthread *machdep_pthread, - void *(* start_routine)(), void *start_argument, - long stack_size, long nsec, long flags) -{ - machdep_pthread->start_routine = start_routine; - machdep_pthread->start_argument = start_argument; - - machdep_pthread->machdep_timer.it_value.tv_sec = 0; - machdep_pthread->machdep_timer.it_interval.tv_sec = 0; - machdep_pthread->machdep_timer.it_interval.tv_usec = 0; - machdep_pthread->machdep_timer.it_value.tv_usec = nsec / 1000; - - machdep_sys_setjmp(machdep_pthread->machdep_state); - /* - * Set up new stact frame so that it looks like it - * returned from a longjmp() to the beginning of - * machdep_pthread_start(). - */ - machdep_pthread->machdep_state[0] = (int)machdep_pthread_start; - - /* Stack starts high and builds down. */ - machdep_pthread->machdep_state[2] = - (int)machdep_pthread->machdep_stack + stack_size; -} - -/* ========================================================================== - * machdep_sys_creat() - */ -machdep_sys_creat(char * path, int mode) -{ - return(machdep_sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); -} - -/* ========================================================================== - * machdep_sys_wait3() - */ -machdep_sys_wait3(int * b, int c, int * d) -{ - return(machdep_sys_wait4(0, b, c, d)); -} - -/* ========================================================================== - * machdep_sys_waitpid() - */ -machdep_sys_waitpid(int a, int * b, int c) -{ - return(machdep_sys_wait4(a, b, c, NULL)); -} - -/* ========================================================================== - * machdep_sys_getdtablesize() - */ -machdep_sys_getdtablesize() -{ - return(sysconf(_SC_OPEN_MAX)); -} diff --git a/lib/libpthread/machdep/engine-i386-openbsd-2.0.h b/lib/libpthread/machdep/engine-i386-openbsd-2.0.h deleted file mode 100644 index 71ac156b20c..00000000000 --- a/lib/libpthread/machdep/engine-i386-openbsd-2.0.h +++ /dev/null @@ -1,97 +0,0 @@ -/* ==== machdep.h ============================================================ - * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu - * - * $Id: engine-i386-openbsd-2.0.h,v 1.1 1998/07/21 13:19:19 peter Exp $ - * - */ - -#include <unistd.h> -#include <setjmp.h> -#include <sys/time.h> - -/* - * The first machine dependent functions are the SEMAPHORES - * needing the test and set instruction. - */ -#define SEMAPHORE_CLEAR 0 -#define SEMAPHORE_SET 1 - -#define SEMAPHORE_TEST_AND_SET(lock) \ -({ \ -long temp = SEMAPHORE_SET; \ - \ -__asm__ volatile ("xchgl %0,(%2)" \ - :"=r" (temp) \ - :"0" (temp),"r" (lock)); \ -temp; \ -}) - -#define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR - -/* - * New types - */ -typedef long semaphore; - -/* - * sigset_t macros - */ -#define SIG_ANY(sig) (sig) -#define SIGMAX 31 - -/* - * New Strutures - */ -struct machdep_pthread { - void *(*start_routine)(void *); - void *start_argument; - void *machdep_stack; - struct itimerval machdep_timer; - jmp_buf machdep_state; - char machdep_float_state[108]; -}; - -/* - * Static machdep_pthread initialization values. - * For initial thread only. - */ -#define MACHDEP_PTHREAD_INIT \ -{ NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 } - -/* - * Minimum stack size - */ -#define PTHREAD_STACK_MIN 1024 - -/* - * Some fd flag defines that are necessary to distinguish between posix - * behavior and bsd4.3 behavior. - */ -#define __FD_NONBLOCK O_NONBLOCK - -/* - * New functions - */ - -__BEGIN_DECLS - -#if defined(PTHREAD_KERNEL) - -#define __machdep_stack_get(x) (x)->machdep_stack -#define __machdep_stack_set(x, y) (x)->machdep_stack = y -#define __machdep_stack_repl(x, y) \ -{ \ - if (stack = __machdep_stack_get(x)) { \ - __machdep_stack_free(stack); \ - } \ - __machdep_stack_set(x, y); \ -} - -void * __machdep_stack_alloc __P_((size_t)); -void __machdep_stack_free __P_((void *)); - -int machdep_save_state __P_((void)); - -#endif - -__END_DECLS diff --git a/lib/libpthread/machdep/engine-m68000-netbsd.h b/lib/libpthread/machdep/engine-m68000-netbsd.h deleted file mode 100644 index 0cf0b035d6f..00000000000 --- a/lib/libpthread/machdep/engine-m68000-netbsd.h +++ /dev/null @@ -1,77 +0,0 @@ -/* ==== machdep.h ============================================================ - * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu - * - * $Id: engine-m68000-netbsd.h,v 1.1 1998/07/21 13:19:14 peter Exp $ - * - */ - -#include <unistd.h> -#include <setjmp.h> -#include <sys/time.h> - -/* - * The first machine dependent functions are the SEMAPHORES - * needing the test and set instruction. - */ -#define SEMAPHORE_CLEAR 0 -#define SEMAPHORE_SET 0x80; - -#define SEMAPHORE_TEST_AND_SET(lock) \ -({ \ -volatile long temp = SEMAPHORE_CLEAR; \ - \ -__asm__ volatile("tas (%2); bpl 0f; movl #1,%0; 0:" \ - :"=r" (temp) \ - :"0" (temp),"r" (lock)); \ -temp; \ -}) - -#define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR - -/* - * New types - */ -typedef char semaphore; - -/* - * sigset_t macros - */ -#define SIG_ANY(sig) (sig) -#define SIGMAX 31 - -/* - * New Strutures - */ -struct machdep_pthread { - void *(*start_routine)(void *); - void *start_argument; - void *machdep_stack; - struct itimerval machdep_timer; - jmp_buf machdep_state; -}; - -/* - * Min pthread stacksize - */ -#define PTHREAD_STACK_MIN 1024 - -/* - * Static machdep_pthread initialization values. - * For initial thread only. - */ -#define MACHDEP_PTHREAD_INIT \ -{ NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 } - -/* - * New functions - */ - -__BEGIN_DECLS - -#if defined(PTHREAD_KERNEL) - -int machdep_save_state __P_((void)); - -#endif - -__END_DECLS diff --git a/lib/libpthread/machdep/posix-openbsd-2.0.h b/lib/libpthread/machdep/posix-openbsd-2.0.h deleted file mode 100644 index 55c127e8136..00000000000 --- a/lib/libpthread/machdep/posix-openbsd-2.0.h +++ /dev/null @@ -1,31 +0,0 @@ -/* ==== posix.h ============================================================ - * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu - * - * Description : Convert an Ultrix-4.2 system to a more or less POSIX system. - * - * $Id: posix-openbsd-2.0.h,v 1.1 1998/07/21 13:19:19 peter Exp $ - * - * 1.00 93/07/20 proven - * -Started coding this file. - */ - -#ifndef _PTHREAD_POSIX_H_ -#define _PTHREAD_POSIX_H_ - -#include <sys/cdefs.h> - -/* More stuff for compiling */ -#if defined(__GNUC__) -#define __INLINE extern inline -#else -#define __INLINE static -#endif - -/* Make sure we have size_t defined */ -#include <pthread/types.h> - -#ifndef __WAIT_STATUS -#define __WAIT_STATUS int * -#endif - -#endif diff --git a/lib/libpthread/machdep/syscall-i386-openbsd-2.0.S b/lib/libpthread/machdep/syscall-i386-openbsd-2.0.S deleted file mode 100644 index cfdbbc77f73..00000000000 --- a/lib/libpthread/machdep/syscall-i386-openbsd-2.0.S +++ /dev/null @@ -1,237 +0,0 @@ -/* ==== syscall.S ============================================================ - * Copyright (c) 1990 The Regents of the University of California. - * Copyright (c) 1995 Chris Provenzano, proven@mit.edu - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Description : Machine dependent syscalls for i386/i486/i586 - * - */ - -#ifndef lint - .text - .asciz "syscall-i386-freebsd-2.0.S,v 1.2 1995/05/26 07:44:29 proven Exp"; -#endif - -#if defined(SYSLIBC_SCCS) && !defined(lint) - .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90" -#endif /* SYSLIBC_SCCS and not lint */ - -#include <sys/syscall.h> - -#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; - -#else - -#define SYSCALL(x) \ - .globl _machdep_sys_/**/x; \ - \ -_machdep_sys_/**/x:; \ - \ - movl $(SYS_/**/x), %eax; \ - .byte 0x9a; .long 0; .word 7; \ - jb 1b; \ - 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. - */ - -1: - neg %eax - ret - -/* ========================================================================== - * machdep_sys_fork() - */ - .globl _machdep_sys_fork; - -_machdep_sys_fork:; - - movl $(SYS_fork), %eax; - .byte 0x9a; .long 0; .word 7; - cmpl $0, %edx - je 2f - movl $0, %eax -2: - ret; - -/* ========================================================================== - * machdep_sys___syscall() - */ - -_machdep_sys___syscall:; - - movl $(SYS___syscall), %eax; - .byte 0x9a; .long 0; .word 7; - jb 3f; - ret - -/* ========================================================================== - * machdep_sys_sigsuspend() - */ - .globl _machdep_sys_sigsuspend; - -_machdep_sys_sigsuspend:; - - movl 4(%esp),%eax # fetch mask arg - movl (%eax),%eax # indirect to mask arg - movl %eax,4(%esp) - movl $(SYS_sigsuspend), %eax; - .byte 0x9a; .long 0; .word 7; - jb 3f; - ret - -3: - - neg %eax - movl $0xffffffff,%edx - ret - -/* ========================================================================== - * machdep_sys_sigprocmask() - */ - .globl _machdep_sys_sigprocmask; - -_machdep_sys_sigprocmask:; - - movl 8(%esp),%ecx - movl (%ecx),%ecx - movl %ecx,8(%esp) - movl $ SYS_sigprocmask , %eax - .byte 0x9a; .long 0; .word 7; - jb 4f; - ret - -4: - neg %eax - movl $0xffffffff,%edx - ret - -/* ========================================================================== - * machdep_sys_lseek() - */ - .globl _machdep_sys_lseek; - -_machdep_sys_lseek:; - - pushl %ebp; - movl %esp,%ebp; - pushl 0x14(%ebp); - pushl 0x10(%ebp); - pushl 0xc(%ebp); - pushl $0x0; - pushl 0x8(%ebp); - pushl $0x0; - pushl $(SYS_lseek); - call _machdep_sys___syscall; - leave - ret - -/* ========================================================================== - * machdep_sys_ftruncate() ; Added by Monty - */ - .globl _machdep_sys_ftruncate; - -_machdep_sys_ftruncate:; - - pushl %ebp; - movl %esp,%ebp; - pushl 0x10(%ebp); - pushl 0xc(%ebp); - pushl $0x0; # Why this? - pushl 0x8(%ebp); - pushl $0x0; # And this? - pushl $(SYS_ftruncate); - call _machdep_sys___syscall; - leave - ret - -/* ========================================================================== - * machdep_sys_setjmp() - */ - .globl _machdep_sys_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 - -/* ========================================================================== - * machdep_sys_longjmp() - */ - .globl _machdep_sys_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 - diff --git a/lib/libpthread/net/Makefile.inc b/lib/libpthread/net/Makefile.inc index c89732ac048..76726e79e3a 100644 --- a/lib/libpthread/net/Makefile.inc +++ b/lib/libpthread/net/Makefile.inc @@ -1,8 +1,7 @@ # from: @(#)Makefile.inc 5.21 (Berkeley) 5/24/91 -# $Id: Makefile.inc,v 1.1 1998/07/21 13:19:44 peter Exp $ +# $Id: Makefile.inc,v 1.2 1998/07/21 16:28:42 peter Exp $ -# gen sources -.PATH: ${srcdir}/net +.PATH: ${.CURDIR}/net SRCS+= gethostbyaddr.c gethostbyname.c gethostent.c getnetbyaddr.c \ getnetbyname.c getnetent.c getproto.c getprotoent.c getprotoname.c \ diff --git a/lib/libpthread/pthreads/Makefile.inc b/lib/libpthread/pthreads/Makefile.inc index 86c63233c1a..98ac0b520cc 100644 --- a/lib/libpthread/pthreads/Makefile.inc +++ b/lib/libpthread/pthreads/Makefile.inc @@ -1,9 +1,65 @@ # from: @(#)Makefile.inc 5.6 (Berkeley) 6/4/91 -# pthread sources .PATH: ${.CURDIR}/pthreads -SRCS+= cond.c fd.c fd_kern.c fd_pipe.c file.c globals.c malloc.c mutex.c \ - pthread.c pthread_attr.c queue.c signal.c pthread_join.c \ - pthread_detach.c sleep.c +SRCS+= cleanup.c cond.c fd.c fd_kern.c fd_pipe.c file.c globals.c malloc.c \ + mutex.c pthread.c pthread_attr.c queue.c signal.c machdep.c syscall.S \ + pthread_join.c pthread_detach.c pthread_once.c sleep.c specific.c \ + process.c wait.c errno.c schedparam.c _exit.c prio_queue.c \ + pthread_init.c init.cc sig.c info.c mutexattr.c select.c wrapper.c \ + dump_state.c pthread_kill.c condattr.c pthread_cancel.c panic.c + +OBJS+= syscalls.o + +.if !defined(NOPIC) +SOBJS+= syscalls.so +SYSCALL_PIC_COMPILE= $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -DPIC -c ${.CURDIR}/syscall-template.S -o ${.OBJDIR}/syscalls/S$$syscall.so +.else +SYSCALL_PIC_COMPILE= true +.endif + +.if !defined(NOPROFILE) +POBJS+= syscalls.po +SYSCALL_PROF_COMPILE= $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -pg -c ${.CURDIR}/syscall-template.S -o ${.OBJDIR}/syscalls/S$$syscall.po +.else +SYSCALL_PROF_COMPILE= true +.endif + +syscalls.o syscalls.so syscalls.po : syscall-template.S + -rm -rf ${.OBJDIR}/syscalls + mkdir ${.OBJDIR}/syscalls + for syscall in $(AVAILABLE_SYSCALLS) ; do \ + case " $(SYSCALL_EXCEPTIONS) " in \ + *" "$$syscall" "*) ;; \ + *) echo $$syscall ; \ + $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -c ${.CURDIR}/syscall-template.S -o ${.OBJDIR}/syscalls/S$$syscall.o ; \ + $(SYSCALL_PIC_COMPILE) ; \ + $(SYSCALL_PROF_COMPILE) ;; \ + esac ; \ + done + x=`pwd` && cd ${.OBJDIR}/syscalls && ld -r -o ../syscalls.o *.o && cd $$x +.if !defined(NOPIC) + x=`pwd` && cd ${.OBJDIR}/syscalls && ld -r -o ../syscalls.so *.so && cd $$x +.endif + +.if !defined(NOPROFILE) + x=`pwd` && cd ${.OBJDIR}/syscalls && ld -r -o ../syscalls.po *.po && cd $$x +.endif + rm -r ${.OBJDIR}/syscalls + +syscall.o: syscall.S + cpp ${CPPFLAGS} ${.CURDIR}/syscall.S > syscall.i + as syscall.i + rm syscall.i + mv a.out syscall.o + +syscall.po: syscall.S + cpp ${CPPFLAGS} ${.CURDIR}/syscall.S > syscall.i + as syscall.i + rm syscall.i + mv a.out syscall.po + +MAN2+= + +MAN3+= diff --git a/lib/libpthread/stdio/Makefile.inc b/lib/libpthread/stdio/Makefile.inc index ff13440c8d0..8f0e0a5d30a 100644 --- a/lib/libpthread/stdio/Makefile.inc +++ b/lib/libpthread/stdio/Makefile.inc @@ -1,18 +1,18 @@ # from: @(#)Makefile.inc 5.7 (Berkeley) 6/27/91 -# $Id: Makefile.inc,v 1.1 1995/10/18 08:43:05 deraadt Exp $ +# $Id: Makefile.inc,v 1.2 1998/07/21 16:28:45 peter Exp $ -# Thread safe stdio sources .PATH: ${.CURDIR}/stdio +# SRCS+= tempnam.c tmpfile.c tmpnam.c + SRCS+= clrerr.c fclose.c fdopen.c feof.c ferror.c fflush.c fgetc.c \ fgetline.c fgetpos.c fgets.c fileno.c findfp.c flags.c fopen.c \ fprintf.c fpurge.c fputc.c fputs.c fread.c freopen.c fscanf.c \ fseek.c fsetpos.c ftell.c funopen.c fvwrite.c fwalk.c fwrite.c \ - getc.c getchar.c gets.c getw.c makebuf.c perror.c printf.c putc.c \ + getc.c getchar.c gets.c getw.c makebuf.c perror.c putc.c \ putchar.c puts.c putw.c refill.c remove.c rewind.c rget.c scanf.c \ - setbuf.c setbuffer.c setvbuf.c snprintf.c sprintf.c sscanf.c \ - stdio.c tempnam.c tmpfile.c tmpnam.c ungetc.c vfprintf.c \ - vfscanf.c vprintf.c vscanf.c vsnprintf.c vsprintf.c vsscanf.c \ + setbuf.c setbuffer.c setvbuf.c sscanf.c \ + stdio.c ungetc.c \ + vfscanf.c vscanf.c vsscanf.c \ wsetup.c putc_unlocked.c putchar_unlocked.c getc_unlocked.c \ - getchar_unlocked.c strerror.c wbuf.c - + getchar_unlocked.c strerror.c wbuf.c xprintf.c diff --git a/lib/libpthread/stdlib/Makefile.inc b/lib/libpthread/stdlib/Makefile.inc index cc323d1d0e1..07e7eceaec6 100644 --- a/lib/libpthread/stdlib/Makefile.inc +++ b/lib/libpthread/stdlib/Makefile.inc @@ -1,10 +1,5 @@ # @(#)Makefile.inc 5.6 (Berkeley) 6/4/91 -# stdlib sources -.PATH: ${srcdir}/${MACHINE}/stdlib ${srcdir}/stdlib +.PATH: ${.CURDIR}/stdlib SRCS+= exit.c strtod.c getopt.c rand.c random.c strtol.c strtoul.c - -# SRCS+=abort.c atexit.c atoi.c atof.c atol.c bsearch.c calloc.c div.c \ -# getenv.c heapsort.c labs.c ldiv.c malloc.c multibyte.c \ -# putenv.c qsort.c radixsort.c setenv.c system.c diff --git a/lib/libpthread/string/Makefile.inc b/lib/libpthread/string/Makefile.inc index 0a3804975e0..b76cb22565d 100644 --- a/lib/libpthread/string/Makefile.inc +++ b/lib/libpthread/string/Makefile.inc @@ -1,8 +1,8 @@ # from: @(#)Makefile.inc 5.21 (Berkeley) 5/24/91 -# $Id: Makefile.inc,v 1.1 1998/07/21 13:22:19 peter Exp $ +# $Id: Makefile.inc,v 1.2 1998/07/21 16:28:48 peter Exp $ # string sources -.PATH: ${srcdir}/string +.PATH: ${.CURDIR}/string SRCS+= strtok.c |