diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2018-02-05 18:10:28 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2018-02-05 18:10:28 +0000 |
| commit | 0b2b653012091354fe26f1138f61f648ed2ac6e4 (patch) | |
| tree | 2d717c516a41fbe674e0ccd72481e6f2d973eaef /lib/libc/mips | |
| parent | 7dea788b91a06a2b9e250c40a797246f4cf36848 (diff) | |
Notes
Diffstat (limited to 'lib/libc/mips')
| -rw-r--r-- | lib/libc/mips/gen/_ctx_start.S | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/libc/mips/gen/_ctx_start.S b/lib/libc/mips/gen/_ctx_start.S index 5d754a9927d16..f1f5cdc326415 100644 --- a/lib/libc/mips/gen/_ctx_start.S +++ b/lib/libc/mips/gen/_ctx_start.S @@ -28,11 +28,25 @@ __FBSDID("$FreeBSD$"); /* - * XXX gp? + * This requires makecontext() to setup a valid GP for locating + * _ctx_done rather than deriving GP from T9 on entry. Currently this + * uses the GP inherited from getcontext() assuming that getcontext() + * is in the same shared object as _ctx_done(). For N32 and N64, GP + * is caller-save so will be preserved across the call to the callback + * function. For O32, GP is callee-save, so save it in a different + * caller-save register (S1) while invoking the callback. This is + * done instead of the usual SETUP_GP/SAVE_GP to avoid disturbing the + * stack frame setup by makecontext() for the callback function. */ 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 |
