Ooops sorry for the stream of consciousness comments in the Coro.c patch... Obviously I'm no longer segfaulting or jumping to the wrong place or I wouldn't have posted the patch!
>
> I finally got back to this... Below is the diff that got it working on OpenBSD on the latest build. I haven't attacked the addons yet, and but "gmake test" does appear to give the same output on OpenBSD as on my mac.
>
> Salient changes:
> 1) Add "OpenBSD" to the Makefile and the tools Makefile where FreeBSD is
> 2) Change the line for the tests from "make test" to "($MAKE) test" (it should be this anyway I believe.
> 3) Add "OpenBSD" to PortableStdint.h where FreeBSD is
> 4) Hack #1 - force USE_SETJMP in the coroutine/Makefile. This should be done with proper platform pragmas but there ya go.
> 5) Hack #2 - hardwire the number of CPUs to 1 in IoSystem.c. This should also be done with proper pragmas
> 6) Add a Coro_setup routine for OpenBSD in Coro.c. I copied the one from DragonFly BSD, but it looks obsolete - there needs (beyond the correct offsets) to be the right elements set up in globalCallbackBlock.
>
> So, it ain't pretty (yet), but here it is. I'll post and play with addons as appropriate, and welcome comments/corrections....
>
>
>
> diff -r /tmp/stevedekorte-io-d301d39e0d20266d9617624881ef351e4c6a0cb1/Makefile io/Makefile
> 10c10
> < NEEDS_M := FreeBSD Linux NetBSD DragonFly
> ---
> > NEEDS_M := FreeBSD Linux NetBSD DragonFly OpenBSD
> 180c180
> < cd tools; make test
> ---
> > cd tools; $(MAKE) test
>
> diff -r /tmp/stevedekorte-io-d301d39e0d20266d9617624881ef351e4c6a0cb1/libs/basekit/source/PortableStdint.h io/libs/basekit/source/PortableStdint.h
> 193c193
> < #if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)) )) && !defined (_PSTDINT_H_INCLUDED) || defined(__FreeBSD__)
> ---
> > #if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)) )) && !defined (_PSTDINT_H_INCLUDED) || defined(__FreeBSD__) || defined(__OpenBSD__)
> diff -r /tmp/stevedekorte-io-d301d39e0d20266d9617624881ef351e4c6a0cb1/libs/coroutine/Makefile io/libs/coroutine/Makefile
> 7c7
> < #CFLAGS += -DUSE_SETJMP # method of last resort
> ---
> > CFLAGS += -DUSE_SETJMP # method of last resort
>
> diff -r /tmp/stevedekorte-io-d301d39e0d20266d9617624881ef351e4c6a0cb1/libs/coroutine/source/Coro.c io/libs/coroutine/source/Coro.c
> 468a469,496
> > // NLB ... guessing. Check data from here
http://state-threads.sourceforge.net/docs/notes.html> > // It appears 2 is the SP and probably 0 is the PC just like on DragonFly
> > // /usr/src/lib/libc/arch/i386/gen/setjmp.S appears to confirm this...
> > // but I'm segfaulting to an address of 0000, so obviously I'm a but wrong somewhere...
> > // Current problem looks like "func" is off by 143 bytes/whatever, and I'm landing in the
> > // wrong spot after the return! So my structure is right, but somehow I have the wrong *func
> > #elif defined(__OpenBSD__)
> >
> > #define buf (self->env)
> >
> > void Coro_setup(Coro *self, void *arg)
> > {
> > void *stack = Coro_stack(self);
> > size_t stacksize = Coro_stackSize(self);
> > void *func = (void *)Coro_Start;
> >
> > setjmp(buf);
> >
> > buf[2] = (long)(stack + stacksize);
> > buf[0] = (long)Coro_Start;
> > // it would seem this needs to have some value??
> > globalCallbackBlock.context=((CallbackBlock*)arg)->context;
> > globalCallbackBlock.func=((CallbackBlock*)arg)->func;
> >
> > return;
> > }
> >
> >
>
> diff -r /tmp/stevedekorte-io-d301d39e0d20266d9617624881ef351e4c6a0cb1/libs/iovm/source/IoSystem.c io/libs/iovm/source/IoSystem.c
> 437,438c437,439
> < #else
> < #error
> ---
> > // NLB Why give an error? Just let CPUs default to one, no?
> > // #else
> > // #error
>
> diff -r /tmp/stevedekorte-io-d301d39e0d20266d9617624881ef351e4c6a0cb1/tools/Makefile io/tools/Makefile
> 46c46
> < NEEDS_M := FreeBSD Linux NetBSD DragonFly
> ---
> > NEEDS_M := FreeBSD Linux NetBSD DragonFly OpenBSD
>
>
> --- In
iolanguage@..., "nlb0666" <me@> wrote:
> >
> > As far as I can tell, ucontext is not available on OpenBSD. I tried using a version of libtask from here
http://swtch.com/libtask/ but it appears that there are version differences between that and what io expects (ie struct members have different names etc)
> >
> > --- In
iolanguage@..., Steve Dekorte <steve@> wrote:
> > >
> > >
> > > On 2009-05-06, at 9:01 PM, nlb0666 wrote:
> > > > Guidance here would be welcome - at least on how to get a reasonably
> > > > probably workable Coro.c....
> > >
> > > If the ucontext is both available and working on OpenBSD, we can just
> > > tell the libcoroutine to use it.
> > >
> >
>