Index: lib/libc/mips/gen/_ctx_start.S =================================================================== --- lib/libc/mips/gen/_ctx_start.S +++ lib/libc/mips/gen/_ctx_start.S @@ -28,11 +28,19 @@ __FBSDID("$FreeBSD$"); /* - * XXX gp? + * This assumes that the inherited GP from getcontext() matches the GP + * needed by _ctx_start(). For O32, save GP in S1 while invoking the + * callback. */ ENTRY(_ctx_start) +#ifdef __mips_o32 + move s1, gp +#endif jalr t9 +#ifdef __mips_o32 + move gp, s1 +#endif move a0, s0 PTR_LA t9, _ctx_done jalr t9