Preserve/restore user r/w tpid in mcontext.
This commit is contained in:
parent
fc5db8c0e8
commit
d87c4ff51d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sig_machdep.c,v 1.48 2014/08/13 21:10:31 matt Exp $ */
|
||||
/* $NetBSD: sig_machdep.c,v 1.49 2015/03/24 08:38:29 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||
|
@ -44,7 +44,7 @@
|
|||
|
||||
#include <sys/param.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.48 2014/08/13 21:10:31 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.49 2015/03/24 08:38:29 matt Exp $");
|
||||
|
||||
#include <sys/mount.h> /* XXX only needed by syscallargs.h */
|
||||
#include <sys/cpu.h>
|
||||
|
@ -199,6 +199,11 @@ cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags)
|
|||
|
||||
mcp->_mc_tlsbase = (uintptr_t)l->l_private;
|
||||
*flags |= _UC_TLSBASE;
|
||||
|
||||
#ifdef __PROG32
|
||||
const struct pcb * const pcb = lwp_getpcb(l);
|
||||
mcp->_mc_user_tpid = pcb->pcb_user_pid_rw;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -268,5 +273,10 @@ cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
|
|||
l->l_sigstk.ss_flags &= ~SS_ONSTACK;
|
||||
mutex_exit(p->p_lock);
|
||||
|
||||
#ifdef __PROG32
|
||||
struct pcb * const pcb = lwp_getpcb(l);
|
||||
pcb->pcb_user_pid_rw = mcp->_mc_user_tpid;
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mcontext.h,v 1.17 2015/03/18 21:02:47 joerg Exp $ */
|
||||
/* $NetBSD: mcontext.h,v 1.18 2015/03/24 08:38:29 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -95,6 +95,7 @@ typedef struct {
|
|||
__vfpregset_t __vfpregs;
|
||||
} __fpu;
|
||||
__greg_t _mc_tlsbase;
|
||||
__greg_t _mc_user_tpid;
|
||||
} mcontext_t, mcontext32_t;
|
||||
|
||||
/* Machine-dependent uc_flags */
|
||||
|
@ -106,7 +107,7 @@ typedef struct {
|
|||
|
||||
#define _UC_TLSBASE 0x00080000
|
||||
|
||||
#define _UC_MACHINE_PAD 2 /* Padding appended to ucontext_t */
|
||||
#define _UC_MACHINE_PAD 1 /* Padding appended to ucontext_t */
|
||||
|
||||
#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_SP])
|
||||
#define _UC_MACHINE_PC(uc) ((uc)->uc_mcontext.__gregs[_REG_PC])
|
||||
|
|
Loading…
Reference in New Issue