diff options
author | wiz <wiz@pkgsrc.org> | 2000-12-28 03:56:52 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2000-12-28 03:56:52 +0000 |
commit | a603589f04c62139acf4619aaa6bffcdfcd2deae (patch) | |
tree | 25499acea262c474e9e45c86189ed7c853c88763 /devel/unproven-pthreads | |
parent | 4f0c1acfd84c4e2ffb3df68c757aba19b1090581 (diff) | |
download | pkgsrc-a603589f04c62139acf4619aaa6bffcdfcd2deae.tar.gz |
Add alpha support to unproven-pthreads.
By Olaf Seibert <rhialto@polderland.nl>, posted on port-alpha on 2000/08/08.
Compiles fine, otherwise untested.
Diffstat (limited to 'devel/unproven-pthreads')
-rw-r--r-- | devel/unproven-pthreads/Makefile | 7 | ||||
-rw-r--r-- | devel/unproven-pthreads/files/patch-sum | 8 | ||||
-rw-r--r-- | devel/unproven-pthreads/patches/patch-ac | 13 | ||||
-rw-r--r-- | devel/unproven-pthreads/patches/patch-ad | 220 | ||||
-rw-r--r-- | devel/unproven-pthreads/patches/patch-ae | 83 | ||||
-rw-r--r-- | devel/unproven-pthreads/patches/patch-af | 13 | ||||
-rw-r--r-- | devel/unproven-pthreads/patches/patch-ag | 258 | ||||
-rw-r--r-- | devel/unproven-pthreads/patches/patch-ah | 403 |
8 files changed, 1001 insertions, 4 deletions
diff --git a/devel/unproven-pthreads/Makefile b/devel/unproven-pthreads/Makefile index 4711ecd0f5c..d6951484a5f 100644 --- a/devel/unproven-pthreads/Makefile +++ b/devel/unproven-pthreads/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.17 2000/09/11 02:02:40 wiz Exp $ +# $NetBSD: Makefile,v 1.18 2000/12/28 03:56:52 wiz Exp $ # DISTNAME= unproven-pthreads-0.17 @@ -8,8 +8,9 @@ MASTER_SITES= ftp://ftp.flame.org/pub/netbsd/ MAINTAINER= explorer@netbsd.org -#ONLY_FOR_PLATFORM= NetBSD-*-alpha NetBSD-*-sparc -ONLY_FOR_PLATFORM= NetBSD-*-i386 NetBSD-*-arm32 NetBSD-*-m68k +#ONLY_FOR_PLATFORM= NetBSD-*-sparc +ONLY_FOR_PLATFORM= NetBSD-*-alpha NetBSD-*-arm32 NetBSD-*-i386 \ + NetBSD-*-m68k CONFLICTS+= mit-pthreads-* HAS_CONFIGURE= yes diff --git a/devel/unproven-pthreads/files/patch-sum b/devel/unproven-pthreads/files/patch-sum index bf85e35b00e..75605206be4 100644 --- a/devel/unproven-pthreads/files/patch-sum +++ b/devel/unproven-pthreads/files/patch-sum @@ -1,4 +1,10 @@ -$NetBSD: patch-sum,v 1.4 2000/11/29 17:08:07 agc Exp $ +$NetBSD: patch-sum,v 1.5 2000/12/28 03:56:53 wiz Exp $ MD5 (patch-aa) = c22d3df041130ba62d48208de1f281c5 MD5 (patch-ab) = 1e5276b89be447be4bb0983f6be81569 +MD5 (patch-ac) = c7df28ac1efaa1eb6c5c246ea2020aa9 +MD5 (patch-ad) = 3c6504ebf05008f1736b5c10680ccc87 +MD5 (patch-ae) = 7766b977f14b40509b56ac14ee0b767f +MD5 (patch-af) = 6e42849e7483fa1b99871f4b274182dc +MD5 (patch-ag) = c004c08ab5f156eb66f747c4f56d004d +MD5 (patch-ah) = 8ab61f9ea67a6dd50e6af66f4ca07c5d diff --git a/devel/unproven-pthreads/patches/patch-ac b/devel/unproven-pthreads/patches/patch-ac new file mode 100644 index 00000000000..500c10cc35d --- /dev/null +++ b/devel/unproven-pthreads/patches/patch-ac @@ -0,0 +1,13 @@ +$NetBSD: patch-ac,v 1.1 2000/12/28 03:56:53 wiz Exp $ + +--- config/configure.in.orig Tue Dec 26 23:43:07 2000 ++++ config/configure.in +@@ -83,7 +83,7 @@ + + case $host in + changequote(,)dnl +- alpha-*-netbsd1.4*) ++ alpha-*-netbsd1.5*) + name=alpha-netbsd-1.3 + except="fork lseek ftruncate pipe fstat" + available_syscalls="sigsuspend sigaction sigprocmask" diff --git a/devel/unproven-pthreads/patches/patch-ad b/devel/unproven-pthreads/patches/patch-ad new file mode 100644 index 00000000000..510923c5689 --- /dev/null +++ b/devel/unproven-pthreads/patches/patch-ad @@ -0,0 +1,220 @@ +$NetBSD: patch-ad,v 1.1 2000/12/28 03:56:53 wiz Exp $ + +--- machdep/engine-alpha-netbsd-1.3.h.orig Fri Nov 12 16:02:40 1999 ++++ machdep/engine-alpha-netbsd-1.3.h +@@ -10,7 +10,15 @@ + #include <setjmp.h> + #include <sys/time.h> + #include <sys/cdefs.h> +-#include <sys/signal.h> /* for _NSIG */ ++#include <sys/signal.h> /* for _NSIG */ ++#include <sys/syscall.h> ++ ++#include <unistd.h> ++#include <setjmp.h> ++#include <stdlib.h> ++#include <fcntl.h> ++ ++#include <pthread/sysfunc.h> + + /* The first machine dependent functions are the SEMAPHORES needing + the test and set instruction. +@@ -21,20 +29,20 @@ + #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"); \ ++#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; \ ++({ int *_sem_lock = (lock); \ ++ *_sem_lock = SEMAPHORE_CLEAR; \ + asm ("mb" : : : "memory"); }) + #endif + +@@ -46,19 +54,19 @@ + /* + * sigset_t macros + */ +-#define SIG_ANY(sig) (sig) +-#define SIGMAX (_NSIG-1) ++#define SIG_ANY(sig) (sig) ++#define SIGMAX (_NSIG-1) + + /* + * 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]; ++ void *(*start_routine)(void *); ++ void *start_argument; ++ void *machdep_stack; ++ struct itimerval machdep_timer; ++ unsigned long machdep_istate[11]; ++ unsigned long machdep_fstate[9]; + }; + + /* +@@ -66,18 +74,18 @@ + * For initial thread only. + */ + #define MACHDEP_PTHREAD_INIT \ +- { NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 } ++ { NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, { 0 }, { 0 } } + + /* + * Minimum stack size + */ +-#define PTHREAD_STACK_MIN 2048 ++#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 ++#define __FD_NONBLOCK O_NONBLOCK + + /* + * New functions +@@ -91,21 +99,112 @@ + #define __machdep_stack_set(x, y) (x)->machdep_stack = y + #define __machdep_stack_repl(x, y) \ + { \ +- if (stack = __machdep_stack_get(x)) { \ ++ if ((stack = __machdep_stack_get(x))) { \ + __machdep_stack_free(stack); \ + } \ + __machdep_stack_set(x, y); \ + } + +-void * __machdep_stack_alloc(size_t); +-void __machdep_stack_free(void *); +- + int machdep_save_state(void); ++int safe_store (int *loc, int nw); + + int __machdep_save_int_state(unsigned long *); + void __machdep_restore_int_state(unsigned long *); + void __machdep_save_fp_state(unsigned long *); + void __machdep_restore_fp_state(unsigned long *); ++ ++void *machdep_pthread_cleanup(struct machdep_pthread *machdep_pthread); ++void machdep_pthread_start(void); ++ ++/* ========================================================================== ++ * __machdep_stack_free() ++ */ ++inline static ++void __machdep_stack_free(void * stack) ++{ ++ free(stack); ++} ++ ++/* ========================================================================== ++ * __machdep_stack_alloc() ++ */ ++inline static ++void * __machdep_stack_alloc(size_t size) ++{ ++ return(malloc(size)); ++} ++ ++/* ========================================================================== ++ * machdep_sys_creat() ++ */ ++static inline int ++machdep_sys_creat(char * path, int mode) ++{ ++ return(machdep_sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); ++} ++ ++/* ========================================================================== ++ * machdep_sys_wait3() ++ */ ++static inline int ++machdep_sys_wait3(int * b, int c, struct rusage *d) ++{ ++ return(machdep_sys_wait4(0, b, c, d)); ++} ++ ++/* ========================================================================== ++ * machdep_sys_waitpid() ++ */ ++static inline int ++machdep_sys_waitpid(int a, int * b, int c) ++{ ++ return(machdep_sys_wait4(a, b, c, NULL)); ++} ++ ++/* ========================================================================== ++ * machdep_sys_getdtablesize() ++ */ ++static inline int ++machdep_sys_getdtablesize(void) ++{ ++ return(sysconf(_SC_OPEN_MAX)); ++} ++ ++/* ========================================================================== ++ * machdep_sys_lseek() ++ */ ++static inline ++off_t machdep_sys_lseek(int fd, off_t offset, int whence) ++{ ++ return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence)); ++} ++ ++static inline ++int machdep_sys_ftruncate( int fd, off_t length) ++{ ++ quad_t q; ++ int rv; ++ ++ q = __syscall((quad_t)SYS_ftruncate, fd,0, length); ++ if( /* LINTED constant */ sizeof( quad_t ) == sizeof( register_t ) || ++ /* LINTED constant */ BYTE_ORDER == LITTLE_ENDIAN ) ++ rv = (int)q; ++ else ++ rv = (int)((u_quad_t)q >> 32); ++ ++ return rv; ++} ++ ++ ++/* ========================================================================== ++ * machdep_sys_getdirentries() ++ */ ++static inline int ++machdep_sys_getdirentries(int fd, char * buf, int len, int * seek) ++{ ++ return(machdep_sys_getdents(fd, buf, len)); ++} ++ + + #endif + diff --git a/devel/unproven-pthreads/patches/patch-ae b/devel/unproven-pthreads/patches/patch-ae new file mode 100644 index 00000000000..155e1449158 --- /dev/null +++ b/devel/unproven-pthreads/patches/patch-ae @@ -0,0 +1,83 @@ +$NetBSD: patch-ae,v 1.1 2000/12/28 03:56:53 wiz Exp $ + +--- machdep/syscall-template-alpha-netbsd-1.3.S.orig Sat Nov 6 18:33:03 1999 ++++ machdep/syscall-template-alpha-netbsd-1.3.S +@@ -1,11 +1,16 @@ + #include <machine/asm.h> + #define COMPAT_43 + #include <sys/syscall.h> +-#define CHMK() call_pal 0x83 ++#define CHMK() call_pal 0x83 + + #ifdef SYS___sigsuspend14 + #define SYS_sigsuspend SYS___sigsuspend14 + #endif ++ ++#ifdef SYS___sigaction14 ++#define SYS_sigaction SYS___sigaction14 ++#endif ++ + #ifdef SYS___sigprocmask14 + #define SYS_sigprocmask SYS___sigprocmask14 + #endif +@@ -14,11 +19,11 @@ + + /* Kernel syscall interface: + Input: +- v0 - system call number +- a* - arguments, as in C ++ v0 - system call number ++ a* - arguments, as in C + Output: +- a3 - zero iff successful +- v0 - errno value on failure, else result ++ 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 +@@ -26,28 +31,28 @@ + + This macro expansions does not include the return instruction. + If there's no other work to be done, use something like: +- SYSCALL(foo) ; ret ++ 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 ;\ ++ .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 SIMPLE_SYSCALL(x) SYSCALL(x) ; ret ; .end machdep_sys_##x + +-#define XSYSCALL(x) SIMPLE_SYSCALL(x) ++#define XSYSCALL(x) SIMPLE_SYSCALL(x) + + XSYSCALL(SYSCALL_NAME) diff --git a/devel/unproven-pthreads/patches/patch-af b/devel/unproven-pthreads/patches/patch-af new file mode 100644 index 00000000000..eb6cf2a3c7f --- /dev/null +++ b/devel/unproven-pthreads/patches/patch-af @@ -0,0 +1,13 @@ +$NetBSD: patch-af,v 1.1 2000/12/28 03:56:54 wiz Exp $ + +--- config/configure.orig Mon Jul 10 15:03:06 2000 ++++ config/configure +@@ -1151,7 +1151,7 @@ + name=$host_cpu-$host_os + + case $host in +- alpha-*-netbsd1.4*) ++ alpha-*-netbsd1.5*) + name=alpha-netbsd-1.3 + except="fork lseek ftruncate pipe fstat" + available_syscalls="sigsuspend sigaction sigprocmask" diff --git a/devel/unproven-pthreads/patches/patch-ag b/devel/unproven-pthreads/patches/patch-ag new file mode 100644 index 00000000000..e9444c993b1 --- /dev/null +++ b/devel/unproven-pthreads/patches/patch-ag @@ -0,0 +1,258 @@ +$NetBSD: patch-ag,v 1.1 2000/12/28 03:56:54 wiz Exp $ + +--- machdep/engine-alpha-netbsd-1.3.c.orig Fri Dec 10 13:40:41 1999 ++++ machdep/engine-alpha-netbsd-1.3.c +@@ -3,17 +3,17 @@ + * + * Description : Machine dependent functions for NetBSD/Alpha 1.1(+) + * +- * 1.00 93/08/04 proven ++ * 1.00 93/08/04 proven + * -Started coding this file. + * +- * 95/04/22 cgd +- * -Modified to make it go with NetBSD/Alpha ++ * 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> +@@ -23,77 +23,24 @@ + #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("setitimer failed"); +- } +-} +- +-/* ========================================================================== +- * 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("setitimer failed"); +- } +-} +- +-/* ========================================================================== +- * 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 (); ++ context_switch_done(); ++ pthread_sched_resume (); + +- /* XXXMLG +- * This is EXTREMELY bogus, but it seems that this function is called +- * with the pthread kernel locked. If this happens, __errno() will +- * return the wrong address until after the first context switch. +- * +- * Clearly there is a leak of pthread_kernel somewhere, but until +- * it is found, we force a context switch here, just before calling +- * the thread start routine. When we return from pthread_yield +- * the kernel will be unlocked. +- */ +- pthread_yield(); ++ /* XXXMLG ++ * This is EXTREMELY bogus, but it seems that this function is called ++ * with the pthread kernel locked. If this happens, __errno() will ++ * return the wrong address until after the first context switch. ++ * ++ * Clearly there is a leak of pthread_kernel somewhere, but until ++ * it is found, we force a context switch here, just before calling ++ * the thread start routine. When we return from pthread_yield ++ * the kernel will be unlocked. ++ */ ++ pthread_yield(); + + /* Run current threads start routine with argument */ + pthread_exit(pthread_run->machdep_data.start_routine +@@ -104,28 +51,10 @@ + } + + /* ========================================================================== +- * __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, ++ void *(* start_routine)(void *), void *start_argument, + long stack_size, long nsec, long flags) + { + machdep_pthread->start_routine = start_routine; +@@ -151,66 +80,68 @@ + } + } + +-int safe_store (loc, new) +- int *loc; +- int new; ++/* ========================================================================== ++ * machdep_save_state() ++ */ ++int machdep_save_state(void) + { +- 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; ++ return __machdep_save_int_state(pthread_run->machdep_data.machdep_istate); + } + +-/* ========================================================================== +- * machdep_sys_creat() +- */ +-machdep_sys_creat(char * path, int mode) +-{ +- return(machdep_sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); +-} ++void machdep_restore_state(void) ++{ ++ __machdep_restore_int_state(pthread_run->machdep_data.machdep_istate); ++} + +-/* ========================================================================== +- * 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) ++void machdep_save_float_state (struct pthread *pthread) ++{ ++ __machdep_save_fp_state(pthread->machdep_data.machdep_fstate); ++} ++ ++void machdep_restore_float_state (void) + { +- return(machdep_sys_wait4(a, b, c, NULL)); ++ __machdep_restore_fp_state(pthread_run->machdep_data.machdep_fstate); + } + + /* ========================================================================== +- * machdep_sys_getdtablesize() ++ * machdep_set_thread_timer() + */ +-machdep_sys_getdtablesize() ++void machdep_set_thread_timer(struct machdep_pthread *machdep_pthread) + { +- return(sysconf(_SC_OPEN_MAX)); ++ if (setitimer(ITIMER_VIRTUAL, &(machdep_pthread->machdep_timer), NULL)) { ++ PANIC("setitimer failed"); ++ } + } + + /* ========================================================================== +- * machdep_sys_lseek() ++ * machdep_unset_thread_timer() + */ +-off_t machdep_sys_lseek(int fd, off_t offset, int whence) ++void machdep_unset_thread_timer(struct machdep_pthread *machdep_pthread) + { +- extern off_t __syscall(); ++ struct itimerval zeroval = { { 0, 0 }, { 0, 0} }; + +- return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence)); ++ if (setitimer(ITIMER_VIRTUAL, &zeroval, NULL)) { ++ PANIC("setitimer failed"); ++ } + } + + /* ========================================================================== +- * machdep_sys_getdirentries() ++ * machdep_pthread_cleanup() + */ +-machdep_sys_getdirentries(int fd, char * buf, int len, int * seek) ++void *machdep_pthread_cleanup(struct machdep_pthread *machdep_pthread) + { +- return(machdep_sys_getdents(fd, buf, len)); +-} ++ return(machdep_pthread->machdep_stack); ++} ++ ++int safe_store (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; ++} ++ diff --git a/devel/unproven-pthreads/patches/patch-ah b/devel/unproven-pthreads/patches/patch-ah new file mode 100644 index 00000000000..a49d453ab1f --- /dev/null +++ b/devel/unproven-pthreads/patches/patch-ah @@ -0,0 +1,403 @@ +$NetBSD: patch-ah,v 1.1 2000/12/28 03:56:54 wiz Exp $ + +--- machdep/syscall-alpha-netbsd-1.3.S.orig Sat Nov 6 18:33:03 1999 ++++ machdep/syscall-alpha-netbsd-1.3.S +@@ -1,21 +1,21 @@ + #include <machine/asm.h> +-#define CHMK() call_pal 0x83 ++#define CHMK() call_pal 0x83 + #define COMPAT_43 + #include <sys/syscall.h> + #ifndef __CONCAT + #include <sys/cdefs.h> + #endif +-#define CONCAT __CONCAT ++#define CONCAT __CONCAT + + #undef SYSCALL + + /* Kernel syscall interface: + Input: +- v0 - system call number +- a* - arguments, as in C ++ v0 - system call number ++ a* - arguments, as in C + Output: +- a3 - zero iff successful +- v0 - errno value on failure, else result ++ 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 +@@ -23,206 +23,206 @@ + + This macro expansions does not include the return instruction. + If there's no other work to be done, use something like: +- SYSCALL(foo) ; ret ++ 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 ;\ ++ .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) ++#define XSYSCALL(x) SYSCALL(x) ; RET ; .end CONCAT(machdep_sys_,x) + +- .globl machdep_cerror ++ .globl machdep_cerror + machdep_cerror: +- br t0, Lmachdep_cerror_setgp ++ br t0, Lmachdep_cerror_setgp + Lmachdep_cerror_setgp: +- ldgp gp, 0(t0) +- stl v0, errno ++ ldgp gp, 0(t0) ++ stl v0, errno + #if 0 +- ldiq v0, -1 ++ ldiq v0, -1 + #else +- subq zero, v0, v0 ++ subq zero, v0, v0 + #endif +- RET ++ RET + + /* The fork system call is special... */ + SYSCALL(fork) +- cmovne a4, 0, v0 +- RET +- .end machdep_sys_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 ++ stl v0, 0(a0) ++ stl a4, 4(a0) ++ mov zero, v0 ++ RET ++ .end machdep_sys_pipe + + #ifndef SYS___sigsuspend14 + /* The sigsuspend system call is special... */ +- .align 4 +- .globl machdep_sys_sigsuspend +- .ent machdep_sys_sigsuspend, 0 ++ .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 ++ 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 + #endif /* SYS_sigsuspend14 */ + + #ifndef SYS___sigprocmask14 + /* The sigprocmask system call is special... */ +- .align 4 +- .globl machdep_sys_sigprocmask +- .ent machdep_sys_sigprocmask, 0 ++ .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 ++ 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 + #endif /* SYS_sigprocmask14 */ + + /* More stuff ... */ +- .align 4 +- .global __machdep_save_int_state +- .ent __machdep_save_int_state, 0 ++ .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 ++ .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 ++ .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 ++ .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 ++ .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 ++ .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 ++ .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 ++ /* 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 ++ RET ++ .end machdep_sys_fstat |