head 1.4; access; symbols pkgsrc-2018Q1:1.3.0.112 pkgsrc-2018Q1-base:1.3 pkgsrc-2017Q4:1.3.0.110 pkgsrc-2017Q4-base:1.3 pkgsrc-2017Q3:1.3.0.108 pkgsrc-2017Q3-base:1.3 pkgsrc-2017Q2:1.3.0.104 pkgsrc-2017Q2-base:1.3 pkgsrc-2017Q1:1.3.0.102 pkgsrc-2017Q1-base:1.3 pkgsrc-2016Q4:1.3.0.100 pkgsrc-2016Q4-base:1.3 pkgsrc-2016Q3:1.3.0.98 pkgsrc-2016Q3-base:1.3 pkgsrc-2016Q2:1.3.0.96 pkgsrc-2016Q2-base:1.3 pkgsrc-2016Q1:1.3.0.94 pkgsrc-2016Q1-base:1.3 pkgsrc-2015Q4:1.3.0.92 pkgsrc-2015Q4-base:1.3 pkgsrc-2015Q3:1.3.0.90 pkgsrc-2015Q3-base:1.3 pkgsrc-2015Q2:1.3.0.88 pkgsrc-2015Q2-base:1.3 pkgsrc-2015Q1:1.3.0.86 pkgsrc-2015Q1-base:1.3 pkgsrc-2014Q4:1.3.0.84 pkgsrc-2014Q4-base:1.3 pkgsrc-2014Q3:1.3.0.82 pkgsrc-2014Q3-base:1.3 pkgsrc-2014Q2:1.3.0.80 pkgsrc-2014Q2-base:1.3 pkgsrc-2014Q1:1.3.0.78 pkgsrc-2014Q1-base:1.3 pkgsrc-2013Q4:1.3.0.76 pkgsrc-2013Q4-base:1.3 pkgsrc-2013Q3:1.3.0.74 pkgsrc-2013Q3-base:1.3 pkgsrc-2013Q2:1.3.0.72 pkgsrc-2013Q2-base:1.3 pkgsrc-2013Q1:1.3.0.70 pkgsrc-2013Q1-base:1.3 pkgsrc-2012Q4:1.3.0.68 pkgsrc-2012Q4-base:1.3 pkgsrc-2012Q3:1.3.0.66 pkgsrc-2012Q3-base:1.3 pkgsrc-2012Q2:1.3.0.64 pkgsrc-2012Q2-base:1.3 pkgsrc-2012Q1:1.3.0.62 pkgsrc-2012Q1-base:1.3 pkgsrc-2011Q4:1.3.0.60 pkgsrc-2011Q4-base:1.3 pkgsrc-2011Q3:1.3.0.58 pkgsrc-2011Q3-base:1.3 pkgsrc-2011Q2:1.3.0.56 pkgsrc-2011Q2-base:1.3 pkgsrc-2011Q1:1.3.0.54 pkgsrc-2011Q1-base:1.3 pkgsrc-2010Q4:1.3.0.52 pkgsrc-2010Q4-base:1.3 pkgsrc-2010Q3:1.3.0.50 pkgsrc-2010Q3-base:1.3 pkgsrc-2010Q2:1.3.0.48 pkgsrc-2010Q2-base:1.3 pkgsrc-2010Q1:1.3.0.46 pkgsrc-2010Q1-base:1.3 pkgsrc-2009Q4:1.3.0.44 pkgsrc-2009Q4-base:1.3 pkgsrc-2009Q3:1.3.0.42 pkgsrc-2009Q3-base:1.3 pkgsrc-2009Q2:1.3.0.40 pkgsrc-2009Q2-base:1.3 pkgsrc-2009Q1:1.3.0.38 pkgsrc-2009Q1-base:1.3 pkgsrc-2008Q4:1.3.0.36 pkgsrc-2008Q4-base:1.3 pkgsrc-2008Q3:1.3.0.34 pkgsrc-2008Q3-base:1.3 cube-native-xorg:1.3.0.32 cube-native-xorg-base:1.3 pkgsrc-2008Q2:1.3.0.30 pkgsrc-2008Q2-base:1.3 cwrapper:1.3.0.28 pkgsrc-2008Q1:1.3.0.26 pkgsrc-2008Q1-base:1.3 pkgsrc-2007Q4:1.3.0.24 pkgsrc-2007Q4-base:1.3 pkgsrc-2007Q3:1.3.0.22 pkgsrc-2007Q3-base:1.3 pkgsrc-2007Q2:1.3.0.20 pkgsrc-2007Q2-base:1.3 pkgsrc-2007Q1:1.3.0.18 pkgsrc-2007Q1-base:1.3 pkgsrc-2006Q4:1.3.0.16 pkgsrc-2006Q4-base:1.3 pkgsrc-2006Q3:1.3.0.14 pkgsrc-2006Q3-base:1.3 pkgsrc-2006Q2:1.3.0.12 pkgsrc-2006Q2-base:1.3 pkgsrc-2006Q1:1.3.0.10 pkgsrc-2006Q1-base:1.3 pkgsrc-2005Q4:1.3.0.8 pkgsrc-2005Q4-base:1.3 pkgsrc-2005Q3:1.3.0.6 pkgsrc-2005Q3-base:1.3 pkgsrc-2005Q2:1.3.0.4 pkgsrc-2005Q2-base:1.3 pkgsrc-2005Q1:1.3.0.2 pkgsrc-2005Q1-base:1.3 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.4 date 2018.04.18.08.42.16; author he; state dead; branches; next 1.3; commitid 35dX2wFofcj9UTyA; 1.3 date 2005.03.02.13.21.34; author is; state Exp; branches; next 1.2; 1.2 date 2005.03.01.10.00.47; author is; state Exp; branches; next 1.1; 1.1 date 2005.02.25.15.54.59; author is; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2005.02.25.15.54.59; author is; state Exp; branches; next ; desc @@ 1.4 log @Modernize this so that it builds again (after SSP), and do the context-shifting in a non-MI manner so it may work on other ports than i386. Bump PKGREVISION. @ text @$NetBSD: patch-au,v 1.3 2005/03/02 13:21:34 is Exp $ --- csw/netbsd.c.orig 2005-03-02 13:00:06.000000000 +0000 +++ csw/netbsd.c @@@@ -0,0 +1,112 @@@@ +/* + * netbsd.c -- context switch code for NetBSD 2. + * + * Some Makefile changes are needed to use this code. + */ + +#include + +void sr_stk_underflow(void); +void sr_stk_corrupted(void); + +static void startup(void (*)(void), unsigned long, unsigned long, unsigned long, unsigned long); + +#ifdef __i386__ +void pthread__i386_init(void); + +#define _setcontext_u(uc) (*_md_setcontext_u)(uc) +#define _swapcontext_u(oc,nc) (*_md_swapcontext_u)(oc,nc) + +static void sr_setcontext_u(ucontext_t *); +static void sr_swapcontext_u(ucontext_t *, ucontext_t *); + +void (*_md_getcontext_u) (ucontext_t *); +void (*_md_setcontext_u) (ucontext_t *) = sr_setcontext_u; +void (*_md_swapcontext_u)(ucontext_t *, ucontext_t *) = sr_swapcontext_u; + +static void +sr_setcontext_u(ucontext_t *uc) { + pthread__i386_init(); + _setcontext_u(uc); +} + +static void +sr_swapcontext_u(ucontext_t *oldc, ucontext_t *newc) { + pthread__i386_init(); + _swapcontext_u(oldc, newc); +} +#endif + + +/* + * sr_build_context (func, buf, bufsize, arg1, arg2, arg3, arg4) + * + * Build a context that will call func(arg1,arg2,arg3,arg4) when activated + * and will catch an underflow error if func returns. We use an intermediary + * in order to catch that return. + */ +void +sr_build_context (func, buf, bufsize, arg1, arg2, arg3, arg4) +void (*func)(); +char *buf; +int bufsize; +unsigned long arg1, arg2, arg3, arg4; +{ + ucontext_t *uc = (ucontext_t *) buf; /* put header at front of buf */ + + if (0 != getcontext(uc)) { /* initialize context */ + sr_stk_corrupted(); + } + + uc->uc_stack.ss_sp = buf + sizeof (ucontext_t); + uc->uc_stack.ss_size = bufsize - sizeof (ucontext_t); + + makecontext (uc, startup, 5, func, arg1, arg2, arg3, arg4); + uc->uc_stack.ss_flags = 0; +} + +/* + * startup (func, a,b,c,d) -- intermediary for startup and underflow detection. + */ +static void +startup (func, arg1, arg2, arg3, arg4) +void (*func)(); +unsigned long arg1, arg2, arg3, arg4; +{ + (*func) (arg1, arg2, arg3, arg4); + sr_stk_underflow(); +} + + + +/* + * sr_chg_context (newctx, oldctx) -- change contexts. + */ +void +sr_chg_context (new, old) +char *new, *old; +{ + ucontext_t *oldu, *newu; + newu = (ucontext_t *)new; + + if (old) { + oldu = (ucontext_t *)old; + _swapcontext_u(oldu, newu); + } else { + _setcontext_u(newu); + } +} + + + +/* + * sr_check_stk (stk) -- check for stack overflow. + * + * We have no idea of how to do that, so we do nothing. + */ +void +sr_check_stk(stk) +char *stk; +{ + /* nothing */ +} @ 1.3 log @Be more careful when abusing libpthread internals. Should help SR on RISC machines. Version bump to 2.3.3nb1. @ text @d1 1 a1 1 $NetBSD$ @ 1.2 log @Clean up patches. @ text @d3 1 a3 1 --- csw/netbsd.c.orig 2005-03-01 09:35:06.000000000 +0000 d5 1 a5 1 @@@@ -0,0 +1,116 @@@@ d14 4 a17 2 +static void startup(); +void sr_stk_underflow(); a21 1 +#define _getcontext_u(uc) (*_md_getcontext_u)(uc) a24 1 +static void sr_getcontext_u(ucontext_t *); d28 1 a28 1 +void (*_md_getcontext_u) (ucontext_t *) = sr_getcontext_u; a32 6 +sr_getcontext_u(ucontext_t *uc) { + pthread__i386_init(); + _getcontext_u(uc); +} + +static void d62 3 a64 1 + _getcontext_u(uc); /* initialize context */ d74 1 a74 1 + * startup (func, stk) -- intermediary for startup and underflow detection. @ 1.1 log @Initial revision @ text @d3 1 a3 1 --- csw/netbsd.c.orig 2004-11-03 23:04:48.000000000 +0100 d5 1 a5 1 @@@@ -0,0 +1,118 @@@@ a11 2 +#include +#include @ 1.1.1.1 log @This is the SR, a language for concurrent programming from the University of Arizona, version 2.3.2. SR is described in "The SR Programming Language: Concurrency in Practice" by Gregory R. Andrews and Ronald A. Olsson (Benjamin/Cummings, 1993, ISBN 0-8053-0088-0). @ text @@