diff options
author | 1999-03-10 08:53:00 +0000 | |
---|---|---|
committer | 1999-03-10 08:53:00 +0000 | |
commit | 291343549086b4faed12e5929eda2f37a1ac79ca (patch) | |
tree | 688630b9d9aa237978c1f19d0a51468168ad4631 /lib/libpthread/arch | |
parent | Daylight Saving Time, not savings (diff) | |
download | wireguard-openbsd-291343549086b4faed12e5929eda2f37a1ac79ca.tar.xz wireguard-openbsd-291343549086b4faed12e5929eda2f37a1ac79ca.zip |
Goodbye, MIT pthreads... you were a handy reference implementation
Diffstat (limited to 'lib/libpthread/arch')
-rw-r--r-- | lib/libpthread/arch/alpha/machdep.c | 204 | ||||
-rw-r--r-- | lib/libpthread/arch/alpha/machdep.h | 111 | ||||
-rw-r--r-- | lib/libpthread/arch/alpha/syscall-template.S | 46 | ||||
-rw-r--r-- | lib/libpthread/arch/alpha/syscall.S | 224 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/SYS.h | 56 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/machdep.c | 215 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/machdep.h | 97 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/syscall-template.S | 48 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/syscall.S | 248 | ||||
-rw-r--r-- | lib/libpthread/arch/m68k/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libpthread/arch/m68k/machdep.c | 153 | ||||
-rw-r--r-- | lib/libpthread/arch/m68k/machdep.h | 77 | ||||
-rw-r--r-- | lib/libpthread/arch/m68k/syscall.S | 125 | ||||
-rw-r--r-- | lib/libpthread/arch/sparc/syscall-template.S | 40 | ||||
-rw-r--r-- | lib/libpthread/arch/sparc/syscall.S | 102 |
16 files changed, 0 insertions, 1754 deletions
diff --git a/lib/libpthread/arch/alpha/machdep.c b/lib/libpthread/arch/alpha/machdep.c deleted file mode 100644 index 0932c421ea2..00000000000 --- a/lib/libpthread/arch/alpha/machdep.c +++ /dev/null @@ -1,204 +0,0 @@ -/* ==== machdep.c ============================================================ - * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu - * - * Description : Machine dependent functions for NetBSD/Alpha 1.1(+) - * - * 1.00 93/08/04 proven - * -Started coding this file. - * - * 95/04/22 cgd - * -Modified to make it go with NetBSD/Alpha - */ - -#ifndef lint -static const char rcsid[] = "engine-alpha-osf1.c,v 1.4.4.1 1995/12/13 05:41:37 proven Exp"; -#endif - -#include <pthread.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/syscall.h> -#include <stdlib.h> -#include <fcntl.h> -#include <stdio.h> - -/* ========================================================================== - * machdep_save_state() - */ -int machdep_save_state(void) -{ - return __machdep_save_int_state(pthread_run->machdep_data.machdep_istate); -} - -void machdep_restore_state(void) -{ - __machdep_restore_int_state(pthread_run->machdep_data.machdep_istate); -} - -void machdep_save_float_state (void) -{ - __machdep_save_fp_state(pthread_run->machdep_data.machdep_fstate); -} - -void machdep_restore_float_state (void) -{ - __machdep_restore_fp_state(pthread_run->machdep_data.machdep_fstate); -} - -/* ========================================================================== - * 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} }; - - if (setitimer(ITIMER_VIRTUAL, &zeroval, NULL)) { - 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; - - /* Set up new stack frame so that it looks like it returned from a - longjmp() to the beginning of machdep_pthread_start(). */ - machdep_pthread->machdep_istate[8/*ISTATE_RA*/] = 0; - machdep_pthread->machdep_istate[0/*ISTATE_PC*/] = (long)machdep_pthread_start; - machdep_pthread->machdep_istate[10/*ISTATE_PV*/] = (long)machdep_pthread_start; - - /* Alpha stack starts high and builds down. */ - { - long stk_addr = (long) machdep_pthread->machdep_stack; - stk_addr += stack_size - 1024; - stk_addr &= ~15; - machdep_pthread->machdep_istate[9/*ISTATE_SP*/] = stk_addr; - } -} - -int safe_store (loc, new) - int *loc; - int new; -{ - int locked, old; - asm ("mb" : : : "memory"); - do { - asm ("ldl_l %0,%1" : "=r" (old) : "m" (*loc)); - asm ("stl_c %0,%1" : "=r" (locked), "=m" (*loc) : "0" (new)); - } while (!locked); - asm ("mb" : : : "memory"); - return old; -} - -/* ========================================================================== - * 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)); -} - -/* ========================================================================== - * machdep_sys_lseek() - */ -off_t machdep_sys_lseek(int fd, off_t offset, int whence) -{ - extern off_t __syscall(); - - return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence)); -} - -/* ========================================================================== - * machdep_sys_getdirentries() - */ -machdep_sys_getdirentries(int fd, char * buf, int len, int * seek) -{ - return(machdep_sys_getdents(fd, buf, len)); -} diff --git a/lib/libpthread/arch/alpha/machdep.h b/lib/libpthread/arch/alpha/machdep.h deleted file mode 100644 index 50c872da7b6..00000000000 --- a/lib/libpthread/arch/alpha/machdep.h +++ /dev/null @@ -1,111 +0,0 @@ -/* ==== machdep.h ============================================================ - * Copyright (c) 1994 Chris Provenzano (proven@athena.mit.edu) and - * Ken Raeburn (raeburn@mit.edu). - * - * engine-alpha-osf1.h,v 1.4.4.1 1995/12/13 05:41:42 proven Exp - * - */ - -#include <unistd.h> -#include <setjmp.h> -#include <sys/time.h> -#include <sys/cdefs.h> - -/* The first machine dependent functions are the SEMAPHORES needing - the test and set instruction. - - On the Alpha, the actual values here are irrelevant; they just have - to be different. */ -#define SEMAPHORE_CLEAR 0 -#define SEMAPHORE_SET 1 - -#if 0 -#define SEMAPHORE_TEST_AND_SET(lock) \ -({ int *_sem_lock = (lock), locked, old; \ - asm ("mb" : : : "memory"); \ - do { asm ("ldl_l %0,%1" : "=r" (old) : "m" (*_sem_lock)); \ - /* ?? if (old != SEMAPHORE_CLEAR) break; */ \ - asm ("stl_c %0,%1" : "=r" (locked), "=m" (*_sem_lock) \ - : "0" (SEMAPHORE_SET)); \ - } while (!locked); \ - asm ("mb" : : : "memory"); \ - old == SEMAPHORE_CLEAR; }) - -#define SEMAPHORE_RESET(lock) \ -({ int *_sem_lock = (lock); \ - *_sem_lock = SEMAPHORE_CLEAR; \ - asm ("mb" : : : "memory"); }) -#endif - -/* - * New types - */ -typedef int 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; - unsigned long machdep_istate[11]; - unsigned long machdep_fstate[9]; -}; - -/* - * 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 2048 - -/* - * 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)); - -int __machdep_save_int_state __P_((unsigned long *)); -void __machdep_restore_int_state __P_((unsigned long *)); -void __machdep_save_fp_state __P_((unsigned long *)); -void __machdep_restore_fp_state __P_((unsigned long *)); - -#endif - -__END_DECLS diff --git a/lib/libpthread/arch/alpha/syscall-template.S b/lib/libpthread/arch/alpha/syscall-template.S deleted file mode 100644 index a2941ece7c9..00000000000 --- a/lib/libpthread/arch/alpha/syscall-template.S +++ /dev/null @@ -1,46 +0,0 @@ -#include <machine/asm.h> -#define COMPAT_43 -#include <sys/syscall.h> -#define CHMK() call_pal 0x83 - -#undef SYSCALL - -/* Kernel syscall interface: - Input: - v0 - system call number - a* - arguments, as in C - Output: - a3 - zero iff successful - v0 - errno value on failure, else result - - This macro is similar to SYSCALL in asm.h, but not completely. - There's room for optimization, if we assume this will continue to - be assembled as one file. - - This macro expansions does not include the return instruction. - If there's no other work to be done, use something like: - SYSCALL(foo) ; ret - If there is other work to do (in fork, maybe?), do it after the - SYSCALL invocation. */ - -#define SYSCALL(x) \ - .align 4 ;\ - .globl machdep_sys_##x ;\ - .ent machdep_sys_##x, 0 ;\ -machdep_sys_##x: ;\ - .frame sp,0,ra ;\ - ldiq v0, SYS_##x ;\ - CHMK() ;\ - beq a3, Lsys_noerr_##x ;\ - br gp, Lsys_err_##x ;\ -Lsys_err_##x: ;\ - /* Load gp so we can find cerror to jump to. */;\ - ldgp gp, 0(gp) ;\ - jmp zero, machdep_cerror ;\ -Lsys_noerr_##x: - -#define SIMPLE_SYSCALL(x) SYSCALL(x) ; ret ; .end machdep_sys_##x - -#define XSYSCALL(x) SIMPLE_SYSCALL(x) - -XSYSCALL(SYSCALL_NAME) diff --git a/lib/libpthread/arch/alpha/syscall.S b/lib/libpthread/arch/alpha/syscall.S deleted file mode 100644 index eda44311281..00000000000 --- a/lib/libpthread/arch/alpha/syscall.S +++ /dev/null @@ -1,224 +0,0 @@ -#include <machine/asm.h> -#define CHMK() call_pal 0x83 -#define COMPAT_43 -#include <sys/syscall.h> -#ifndef __CONCAT -#include <sys/cdefs.h> -#endif -#define CONCAT __CONCAT - -#undef SYSCALL - -/* Kernel syscall interface: - Input: - v0 - system call number - a* - arguments, as in C - Output: - a3 - zero iff successful - v0 - errno value on failure, else result - - This macro is similar to SYSCALL in asm.h, but not completely. - There's room for optimization, if we assume this will continue to - be assembled as one file. - - This macro expansions does not include the return instruction. - If there's no other work to be done, use something like: - SYSCALL(foo) ; ret - If there is other work to do (in fork, maybe?), do it after the - SYSCALL invocation. */ - -#define SYSCALL(x) \ - .align 4 ;\ - .globl CONCAT(machdep_sys_,x) ;\ - .ent CONCAT(machdep_sys_,x), 0 ;\ -CONCAT(machdep_sys_,x): ;\ - .frame sp,0,ra ;\ - ldiq v0, CONCAT(SYS_,x) ;\ - CHMK() ;\ - beq a3, CONCAT(Lsys_noerr_,x) ;\ - br gp, CONCAT(Lsys_err_,x) ;\ -CONCAT(Lsys_err_,x): ;\ - /* Load gp so we can find cerror to jump to. */;\ - ldgp gp, 0(gp) ;\ - jmp zero, machdep_cerror ;\ -CONCAT(Lsys_noerr_,x): - -#define XSYSCALL(x) SYSCALL(x) ; RET ; .end CONCAT(machdep_sys_,x) - - .globl machdep_cerror -machdep_cerror: - br t0, Lmachdep_cerror_setgp -Lmachdep_cerror_setgp: - ldgp gp, 0(t0) - stl v0, errno -#if 0 - ldiq v0, -1 -#else - subq zero, v0, v0 -#endif - RET - -/* The fork system call is special... */ -SYSCALL(fork) - cmovne a4, 0, v0 - RET - .end machdep_sys_fork - -/* The pipe system call is special... */ -SYSCALL(pipe) - stl v0, 0(a0) - stl a4, 4(a0) - mov zero, v0 - RET - .end machdep_sys_pipe - -/* The sigsuspend system call is special... */ - .align 4 - .globl machdep_sys_sigsuspend - .ent machdep_sys_sigsuspend, 0 -machdep_sys_sigsuspend: - ldl a0, 0(a0) /* pass *mask instead of mask */ - ldiq v0, SYS_sigsuspend - CHMK() - mov zero, v0 /* shouldn't need; just in case... */ - RET - .end machdep_sys_sigsuspend - -/* The sigprocmask system call is special... */ - .align 4 - .globl machdep_sys_sigprocmask - .ent machdep_sys_sigprocmask, 0 -machdep_sys_sigprocmask: - mov a2, a5 /* safe */ - cmoveq a1, 1, a0 /* if set == NULL, how = SIG_BLOCK */ - beq a1, Ldoit /* and set = 0, and do it. */ - ldl a1, 0(a1) /* load the set from *set */ -Ldoit: ldiq v0, SYS_sigprocmask - CHMK() - beq a5, Lret /* if they don't want old mask, done */ - stl v0, 0(a5) /* otherwise, give it to them. */ -Lret: mov zero, v0 - RET - .end machdep_sys_sigprocmask - -/* More stuff ... */ - .align 4 - .global __machdep_save_int_state - .ent __machdep_save_int_state, 0 -__machdep_save_int_state: - .frame sp, 16, ra - ldgp gp, 0(t12) - lda sp, -16(sp) - stq ra, 0(sp) - - /* save integer registers */ - stq ra, ( 0 * 8)(a0) /* return address */ - stq s0, ( 1 * 8)(a0) /* callee-saved registers */ - stq s1, ( 2 * 8)(a0) - stq s2, ( 3 * 8)(a0) - stq s3, ( 4 * 8)(a0) - stq s4, ( 5 * 8)(a0) - stq s5, ( 6 * 8)(a0) - stq s6, ( 7 * 8)(a0) - stq sp, ( 9 * 8)(a0) - stq ra, ( 8 * 8)(a0) /* RA on return */ - stq pv, (10 * 8)(a0) /* and PV; we restore it */ - - mov zero, v0 - lda sp, 16(sp) - RET - .end __machdep_save_int_state - - .align 4 - .global __machdep_restore_int_state - .ent __machdep_restore_int_state, 0 -__machdep_restore_int_state: - .frame sp, 16, ra - ldgp gp, 0(t12) - lda sp, -16(sp) - stq ra, 0(sp) - - /* restore integer registers */ - ldq t0, ( 0 * 8)(a0) /* return address */ - ldq s0, ( 1 * 8)(a0) /* callee-saved registers */ - ldq s1, ( 2 * 8)(a0) - ldq s2, ( 3 * 8)(a0) - ldq s3, ( 4 * 8)(a0) - ldq s4, ( 5 * 8)(a0) - ldq s5, ( 6 * 8)(a0) - ldq s6, ( 7 * 8)(a0) - ldq ra, ( 8 * 8)(a0) /* RA after return */ - ldq sp, ( 9 * 8)(a0) - ldq pv, (10 * 8)(a0) /* and PV; we restore it */ - - ldiq v0, 1 - ret zero,(t0),1 - .end __machdep_restore_int_state - - .align 4 - .global __machdep_save_fp_state - .ent __machdep_save_fp_state, 0 -__machdep_save_fp_state: - .frame sp, 16, ra - ldgp gp, 0(t12) - lda sp, -16(sp) - stq ra, 0(sp) - - /* save FP registers */ - stt fs0, (0 * 8)(a0) /* callee-saved registers */ - stt fs1, (1 * 8)(a0) - stt fs2, (2 * 8)(a0) - stt fs3, (3 * 8)(a0) - stt fs4, (4 * 8)(a0) - stt fs5, (5 * 8)(a0) - stt fs6, (6 * 8)(a0) - stt fs7, (7 * 8)(a0) - mf_fpcr ft0 /* and FP control reg */ - stt ft0, (8 * 8)(a0) - - lda sp, 16(sp) - RET - .end __machdep_save_fp_state - - .align 4 - .global __machdep_restore_fp_state - .ent __machdep_restore_fp_state, 0 -__machdep_restore_fp_state: - .frame sp, 16, ra - ldgp gp, 0(t12) - lda sp, -16(sp) - stq ra, 0(sp) - - /* restore FP registers */ - ldt fs0, (0 * 8)(a0) /* callee-saved registers */ - ldt fs1, (1 * 8)(a0) - ldt fs2, (2 * 8)(a0) - ldt fs3, (3 * 8)(a0) - ldt fs4, (4 * 8)(a0) - ldt fs5, (5 * 8)(a0) - ldt fs6, (6 * 8)(a0) - ldt fs7, (7 * 8)(a0) - ldt ft0, (8 * 8)(a0) - mt_fpcr ft0 /* and FP control reg */ - - lda sp, 16(sp) - RET - .end __machdep_restore_fp_state - -/* For fstat() we actually syscall fstat13. */ - .align 4 - .globl machdep_sys_fstat - .ent machdep_sys_fstat, 0 -machdep_sys_fstat: - .frame sp,0,ra - ldiq v0, SYS___fstat13 - CHMK() - beq a3, Lsys_noerr_fstat - br gp, Lsys_err_fstat -Lsys_err_fstat: - /* Load gp so we can find cerror to jump to. */ - ldgp gp, 0(gp) - jmp zero, machdep_cerror -Lsys_noerr_fstat: - RET - .end machdep_sys_fstat diff --git a/lib/libpthread/arch/i386/Makefile.inc b/lib/libpthread/arch/i386/Makefile.inc deleted file mode 100644 index 85468b9aa69..00000000000 --- a/lib/libpthread/arch/i386/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -# Machine dependent sources -.PATH: ${.CURDIR}/arch/${MACHINE} - -SRCS+= machdep.c syscall.S diff --git a/lib/libpthread/arch/i386/SYS.h b/lib/libpthread/arch/i386/SYS.h deleted file mode 100644 index 91431a6f543..00000000000 --- a/lib/libpthread/arch/i386/SYS.h +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * 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. - * - * $OpenBSD: SYS.h,v 1.1 1998/07/23 08:21:43 peter Exp $ - */ - -#include <machine/asm.h> -#include <sys/syscall.h> - -#ifdef __STDC__ - -#define SYSCALL(x) .text; .align 2; 2: jmp PIC_PLT(cerror); ENTRY(machdep_sys_ ## x); movl $(SYS_ ## x),%eax; int $0x80; jc 2b -#define RSYSCALL(x) SYSCALL(x); ret -#define PSEUDO(x,y) ENTRY(machdep_sys_ ## x); movl $(SYS_ ## y),%eax; int $0x80; ret - -#else /* !__STDC__ */ - -#define SYSCALL(x) .text; .align 2; 2: jmp PIC_PLT(cerror); ENTRY(machdep_sys_/**/x); movl $(SYS_/**/x),%eax; int $0x80; jc 2b -#define RSYSCALL(x) SYSCALL(x); ret -#define PSEUDO(x,y) ENTRY(machdep_sys_/**/x); movl $(SYS_/**/y),%eax; int $0x80; ret - -#endif - - .globl cerror diff --git a/lib/libpthread/arch/i386/machdep.c b/lib/libpthread/arch/i386/machdep.c deleted file mode 100644 index 09ff0072fdc..00000000000 --- a/lib/libpthread/arch/i386/machdep.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/arch/i386/machdep.h b/lib/libpthread/arch/i386/machdep.h deleted file mode 100644 index 41a3a553cc0..00000000000 --- a/lib/libpthread/arch/i386/machdep.h +++ /dev/null @@ -1,97 +0,0 @@ -/* ==== machdep.h ============================================================ - * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu - * - * $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 - * 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/arch/i386/syscall-template.S b/lib/libpthread/arch/i386/syscall-template.S deleted file mode 100644 index 34fb5caaa43..00000000000 --- a/lib/libpthread/arch/i386/syscall-template.S +++ /dev/null @@ -1,48 +0,0 @@ -#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 - -#define XSYSCALL(NAME) SYSCALL(NAME) - -XSYSCALL(SYSCALL_NAME) diff --git a/lib/libpthread/arch/i386/syscall.S b/lib/libpthread/arch/i386/syscall.S deleted file mode 100644 index 8f2060e61e3..00000000000 --- a/lib/libpthread/arch/i386/syscall.S +++ /dev/null @@ -1,248 +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 - -/* ========================================================================== - * machdep_sys_pipe() - */ - .globl _machdep_sys_pipe; - -_machdep_sys_pipe:; - movl 4(%esp),%ecx - movl %eax,(%ecx) - movl %edx,4(%ecx) - xorl %eax,%eax - ret diff --git a/lib/libpthread/arch/m68k/Makefile.inc b/lib/libpthread/arch/m68k/Makefile.inc deleted file mode 100644 index a7c4761a6b4..00000000000 --- a/lib/libpthread/arch/m68k/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -# Machine dependent sources -.PATH: ${.CURDIR}/arch/${MACHINE_ARCH} - -SRCS+= machdep.c syscall.S diff --git a/lib/libpthread/arch/m68k/machdep.c b/lib/libpthread/arch/m68k/machdep.c deleted file mode 100644 index 80b47c63cae..00000000000 --- a/lib/libpthread/arch/m68k/machdep.c +++ /dev/null @@ -1,153 +0,0 @@ -/* ==== machdep.c ============================================================ - * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu - * - * Copyright (c) 1993 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. - * - * m68k work from David Leonard <david.leonard@it.uq.edu.au>. - * - */ - -#ifndef lint -static const char rcsid[] = "$Id: machdep.c,v 1.1 1997/04/13 17:13:08 briggs Exp $"; -#endif - -#include "pthread.h" - -/* ========================================================================== - * machdep_save_state() - */ -int machdep_save_state(void) -{ - return( _setjmp(pthread_run->machdep_data.machdep_state) ); -} - -/* ========================================================================== - * machdep_restore_state() - */ -void machdep_restore_state(void) -{ - _longjmp(pthread_run->machdep_data.machdep_state, 1); -} - -/* ========================================================================== - * 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 } }; - - if (setitimer(ITIMER_VIRTUAL, &zeroval, NULL)) { - 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(); - sig_check_and_resume(); - - /* Run current thread's start routine with argument */ - pthread_exit( - pthread_run->machdep_data.start_routine( - pthread_run->machdep_data.start_argument - ) - ); - - /* should never reach here */ - PANIC(); -} - -/* ========================================================================== - * machdep_pthread_create() - */ -void machdep_pthread_create(struct machdep_pthread *machdep_pthread, - void *(* start_routine)(), void *start_argument, long stack_size, - void *stack_start, long nsec) -{ - machdep_pthread->machdep_stack = stack_start; - - 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; - - _setjmp(machdep_pthread->machdep_state); - - /* - * Set up new stack frame so that it looks like it - * returned from a longjmp() to the beginning of - * machdep_pthread_start(). - * - * state is the set_jmp structure, which for m68k is: - * long onstack_flag; // [0] - * long sigmask; // [1] - * long sp; // [2] - * long fp; // [3] - * long ap; // [4] - * long pc; // [5] - * long ps; // [6] - * long regs[10]; // non scratch registers - */ - machdep_pthread->machdep_state[5] = (long)machdep_pthread_start; - - /* Stack starts high and builds down. */ - machdep_pthread->machdep_state[2] = - (int)machdep_pthread->machdep_stack + stack_size; -} diff --git a/lib/libpthread/arch/m68k/machdep.h b/lib/libpthread/arch/m68k/machdep.h deleted file mode 100644 index 72b42e45c7b..00000000000 --- a/lib/libpthread/arch/m68k/machdep.h +++ /dev/null @@ -1,77 +0,0 @@ -/* ==== machdep.h ============================================================ - * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu - * - * $Id: machdep.h,v 1.2 1998/07/21 16:28:05 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/arch/m68k/syscall.S b/lib/libpthread/arch/m68k/syscall.S deleted file mode 100644 index b68fc846138..00000000000 --- a/lib/libpthread/arch/m68k/syscall.S +++ /dev/null @@ -1,125 +0,0 @@ -/* $OpenBSD: syscall.S,v 1.1 1997/04/13 17:13:09 briggs Exp $ */ - -#ifndef lint - .text - .asciz "$Id: syscall.S,v 1.1 1997/04/13 17:13:09 briggs Exp $"; -#endif - -#include <machine/asm.h> -#include <sys/syscall.h> - -#ifdef __STDC__ -#define SYSCALL(x) .even; ENTRY(machdep_sys_ ## x); \ - movl \#SYS_ ## x,d0; trap \#0; jcs err; rts -#else /* !__STDC__ */ -#define SYSCALL(x) .even; ENTRY(machdep_sys_/**/x); \ - movl #SYS_/**/x,d0; trap #0; jcs err; rts -#endif /* !__STDC__ */ - -/* - * Initial asm stuff for all functions. - */ - .text - .even - - -/* ========================================================================== - * error code for all syscalls. The error value is returned as the negative - * of the errno value. - */ - -err: - negl d0 - rts - -/* ========================================================================== - * machdep_sys_write() - */ -SYSCALL(write) - -/* ========================================================================== - * machdep_sys_read() - */ -SYSCALL(read) - -/* ========================================================================== - * machdep_sys_open() - */ -SYSCALL(open) - -/* ========================================================================== - * machdep_sys_close() - */ -SYSCALL(close) - -/* ========================================================================== - * machdep_sys_fcntl() - */ -SYSCALL(fcntl) - -/* ========================================================================== - * machdep_sys_lseek() - */ -SYSCALL(lseek) - -/* ========================================================================== - * Nonstandard calls used to make the system work - * - * ========================================================================== - * machdep_sys_select() - */ -SYSCALL(select) - -/* ========================================================================== - * Berkeley socket stuff - * - * ========================================================================== - * machdep_sys_socket() - */ -SYSCALL(socket) - -/* ========================================================================== - * machdep_sys_bind() - */ -SYSCALL(bind) - -/* ========================================================================== - * machdep_sys_connect() - */ -SYSCALL(connect) - -/* ========================================================================== - * machdep_sys_accept() - */ -SYSCALL(accept) - -/* ========================================================================== - * machdep_sys_listen() - */ -SYSCALL(listen) - -/* ========================================================================== - * machdep_sys_getsockopt() - */ -SYSCALL(getsockopt) - -/* ========================================================================== - * machdep_sys_readv() - */ -SYSCALL(readv) - -/* ========================================================================== - * machdep_sys_writev() - */ -SYSCALL(writev) - -/* ========================================================================== - * machdep_sys_getpeername() - */ -SYSCALL(getpeername) - -/* ========================================================================== - * machdep_sys_getsockname() - */ -SYSCALL(getsockname) - diff --git a/lib/libpthread/arch/sparc/syscall-template.S b/lib/libpthread/arch/sparc/syscall-template.S deleted file mode 100644 index 2d07892a315..00000000000 --- a/lib/libpthread/arch/sparc/syscall-template.S +++ /dev/null @@ -1,40 +0,0 @@ -/* ==== syscall.S ============================================================ - * Copyright (c) 1994 Chris Provenzano, proven@mit.edu - * All rights reserved. - * - */ - -#include <sys/syscall.h> - -#define SYSCALL(x) \ - .globl _machdep_sys_##x; \ - \ -_machdep_sys_##x:; \ - \ - mov SYS_##x, %g1; \ - ta 0; \ - bcs,a 2b; \ - sub %r0,%o0,%o0; \ - retl; \ - nop - -/* - * Initial asm stuff for all functions. - */ - .text - .align 4 - -/* ========================================================================== - * error code for all syscalls. The error value is returned as the negative - * of the errno value. - */ - -1: - sub %r0, %o0, %o0 -2: - retl - nop - -#define XSYSCALL(NAME) SYSCALL(NAME) - -XSYSCALL(SYSCALL_NAME) diff --git a/lib/libpthread/arch/sparc/syscall.S b/lib/libpthread/arch/sparc/syscall.S deleted file mode 100644 index 9312ef7352a..00000000000 --- a/lib/libpthread/arch/sparc/syscall.S +++ /dev/null @@ -1,102 +0,0 @@ -/* ==== syscall.S ============================================================ - * Copyright (c) 1994 Chris Provenzano, proven@mit.edu - * All rights reserved. - * - */ - -#ifndef lint - .text - .asciz "$Id: syscall.S,v 1.1 1998/07/21 16:28:06 peter Exp $"; -#endif - -#include <sys/syscall.h> - -#define SYSCALL(x) \ - .globl _machdep_sys_##x; \ - \ -_machdep_sys_##x:; \ - \ - mov SYS_##x, %g1; \ - ta 0; \ - bcs,a 2b; \ - sub %r0,%o0,%o0; \ - retl - - -/* - * Initial asm stuff for all functions. - */ - .text - .align 4 - -/* ========================================================================== - * error code for all syscalls. The error value is returned as the negative - * of the errno value. - */ - -1: - sub %r0, %o0, %o0 -2: - retl - nop - -/* ========================================================================== - * machdep_sys_pipe() - */ - .globl _machdep_sys_pipe - -_machdep_sys_pipe: - mov %o0, %o2 - mov SYS_pipe, %g1 - ta 0 - bcs 1b - nop - st %o0, [ %o2 ] - st %o1, [ %o2 + 4 ] - retl - mov %g0, %o0 - -/* ========================================================================== - * machdep_sys_fork() - */ - .globl _machdep_sys_fork; - -_machdep_sys_fork:; - - mov SYS_fork, %g1; - ta 0; - bcs 1b; - nop; - dec %o1; - retl; - and %o0, %o1, %o0; ! return 0 in child, pid in parent - -/* ========================================================================== - * machdep_sys_sigprocmask() - */ - .globl _machdep_sys_sigprocmask; - -_machdep_sys_sigprocmask:; - - ld [%o1], %o1; - mov SYS_sigprocmask, %g1; - ta 0; - bcs 1b; - nop; - retl - nop - -/* ========================================================================== - * machdep_sys_sigsuspend() - */ - .globl _machdep_sys_sigsuspend; - -_machdep_sys_sigsuspend:; - - ld [%o0], %o0; - mov SYS_sigsuspend, %g1; - ta 0; - bcs 1b; - nop; - retl - nop |