Subject: set/getcontext problems should be fixed
To: None <>
From: Simon Burge <>
List: port-sgimips
Date: 07/03/2004 15:59:05

With some debugging help help from Christos Zoulas and Klaus Klein, I
think I've fixed the recent csh/panic/cache problems on MIPS platforms.

In a nutshell, the mcontext_t structure was too big because it had both
the 32-bit and (currently unused) 64-bit FP register sets, and some
other code assumed that the FP register set was the same size as the
area for the FP registers in the PCB.  Unfortunately they weren't, and
the result was that we were trying to copy a 256-odd byte stucture over
a 128-odd byte structure and the results were understandably messy.

Can folks who have previously had problems please try a -current kernel
and userland, making sure that you have the following revs of the
following files:

   rev 1.4   of src/lib/libc/arch/mips/gen/__longjmp14.c 
   rev 1.5   of src/lib/libpthread/arch/mips/pthread_md.h 
   rev 1.6   of src/sys/arch/mips/include/mcontext.h 
   rev 1.176 of src/sys/arch/mips/mips/mips_machdep.c 
   rev 1.10  of src/sys/arch/mips/mips/sig_machdep.c 

I've built and tested on both little-endian and big-endian sbmips,
and all set/getcontext and setjmp/longjmp regression tests pass now.
There's still a problem with an ieee test, but that is unrelated to
all this.

I'm about to try building the 2.0 branch with these changes and then
I'll submit pullup requests for that branch.  However, I'd like to
verify that the lossage on some SGI models (the cache panics instead of
the csh core dump) is fixed too.

Simon Burge                                   <>
NetBSD Development, Support and Service: