From 6f0fa0f8a5db2321a200026af15a3113cd978c0a Mon Sep 17 00:00:00 2001 From: marcel Date: Sun, 1 Jun 2003 23:22:56 +0000 Subject: Improve set_mcontext: o Don't copy psr verbatim from the user supplied context. Only allow userland to change the processor settings that are part of the user mask. --- sys/ia64/ia64/machdep.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sys/ia64') diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index 982f746..49015b5 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -1023,9 +1023,14 @@ int set_mcontext(struct thread *td, const mcontext_t *mc) { struct trapframe *tf; + uint64_t psr; tf = td->td_frame; + /* Only copy the user mask from the new context. */ + psr = tf->tf_special.psr & ~0x1f; + psr |= mc->mc_special.psr & 0x1f; tf->tf_special = mc->mc_special; + tf->tf_special.psr = psr; restore_callee_saved(&mc->mc_preserved); restore_callee_saved_fp(&mc->mc_preserved_fp); return (0); -- cgit v1.1