Module Name: src
Committed By: matt
Date: Fri Apr 30 16:10:42 UTC 2010
Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: cpu_subr.c
Log Message:
In N32 kernel, cpu_setmcontext needs to deal O32 mcontext
To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/arch/mips/mips/cpu_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.1.2.7 src/sys/arch/mips/mips/cpu_subr.c:1.1.2.8
--- src/sys/arch/mips/mips/cpu_subr.c:1.1.2.7 Wed Mar 24 19:23:24 2010
+++ src/sys/arch/mips/mips/cpu_subr.c Fri Apr 30 16:10:42 2010
@@ -32,7 +32,7 @@
#include "opt_multiprocessor.h"
#include "opt_sa.h"
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.1.2.7 2010/03/24 19:23:24 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.1.2.8 2010/04/30 16:10:42 matt Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -384,6 +384,16 @@
if (flags & _UC_CPU) {
/* Save register context. */
/* XXX: Do we validate the addresses?? */
+#ifdef __mips_n32
+ CTASSERT(_R_AST == _REG_AT);
+ if (__predict_false(p->p_md.md_abi == _MIPS_BSD_API_O32)) {
+ const mcontext_o32_t *mcp32 = (const mcontext_o32_t *)mcp;
+ const __greg32_t *gr32 = mcp32->__gregs;
+ for (size_t i = _R_AST; i < 32; i++) {
+ tf->tf_regs[i] = gr32[i];
+ }
+ } else
+#endif
memcpy(&tf->tf_regs[_R_AST], &gr[_REG_AT],
sizeof(mips_reg_t) * 31);