diff --git a/sys/arch/amd64/amd64/compat_16_machdep.c b/sys/arch/amd64/amd64/compat_16_machdep.c index 4e6d1581618a..a33a6c59d8ed 100644 --- a/sys/arch/amd64/amd64/compat_16_machdep.c +++ b/sys/arch/amd64/amd64/compat_16_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_16_machdep.c,v 1.2 2003/10/13 18:45:59 fvdl Exp $ */ +/* $NetBSD: compat_16_machdep.c,v 1.3 2003/10/19 18:14:42 fvdl Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.2 2003/10/13 18:45:59 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.3 2003/10/19 18:14:42 fvdl Exp $"); #include "opt_vm86.h" #include "opt_compat_netbsd.h" @@ -86,6 +86,7 @@ compat_16_sys___sigreturn14(l, v, retval) struct sigcontext *scp, context; struct trapframe *tf; int error; + int err, trapno; /* * The trampoline code hands us the context. @@ -106,7 +107,14 @@ compat_16_sys___sigreturn14(l, v, retval) if (error != 0) return error; + /* + * XXX maybe inline this. + */ + err = tf->tf_err; + trapno = tf->tf_trapno; memcpy(tf, &context.sc_mcontext.__gregs, sizeof (*tf)); + tf->tf_err = err; + tf->tf_trapno = trapno; /* Restore (possibly fixed up) FP state and force it to be reloaded */ if (l->l_md.md_flags & MDP_USEDFPU) { diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 74220652de0f..d9de527af29c 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.13 2003/10/17 16:24:31 fvdl Exp $ */ +/* $NetBSD: machdep.c,v 1.14 2003/10/19 18:14:42 fvdl Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.13 2003/10/17 16:24:31 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.14 2003/10/19 18:14:42 fvdl Exp $"); #include "opt_user_ldt.h" #include "opt_ddb.h" @@ -1736,16 +1736,24 @@ cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags) struct trapframe *tf = l->l_md.md_regs; __greg_t *gr = mcp->__gregs; int error; + int err, trapno; int64_t rflags; if ((flags & _UC_CPU) != 0) { error = check_mcontext(mcp, tf); if (error != 0) return error; + /* + * XXX maybe inline this. + */ rflags = tf->tf_rflags; + err = tf->tf_err; + trapno = tf->tf_trapno; memcpy(tf, gr, sizeof *tf); rflags &= ~PSL_USER; tf->tf_rflags = rflags | (gr[_REG_RFL] & PSL_USER); + tf->tf_err = err; + tf->tf_trapno = trapno; } if ((flags & _UC_FPU) != 0) {