Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/usermode/dev Implement cpu_getmcontext() and cpu_se...
details: https://anonhg.NetBSD.org/src/rev/20d3545d8090
branches: trunk
changeset: 772209:20d3545d8090
user: reinoud <reinoud%NetBSD.org@localhost>
date: Sat Dec 24 12:23:24 2011 +0000
description:
Implement cpu_getmcontext() and cpu_setmcontext()
diffstat:
sys/arch/usermode/dev/cpu.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diffs (47 lines):
diff -r 76befbb634dd -r 20d3545d8090 sys/arch/usermode/dev/cpu.c
--- a/sys/arch/usermode/dev/cpu.c Sat Dec 24 05:05:55 2011 +0000
+++ b/sys/arch/usermode/dev/cpu.c Sat Dec 24 12:23:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.55 2011/12/15 03:42:32 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.56 2011/12/24 12:23:24 reinoud Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
#include "opt_hz.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.55 2011/12/15 03:42:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.56 2011/12/24 12:23:24 reinoud Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -224,19 +224,26 @@
void
cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags)
{
- panic("cpu_getmcontext");
+ struct pcb *pcb = lwp_getpcb(l);
+ ucontext_t *ucp = &pcb->pcb_userret_ucp;
+
#ifdef CPU_DEBUG
dprintf_debug("cpu_getmcontext\n");
#endif
+ memcpy(mcp, &ucp->uc_mcontext, sizeof(mcontext_t));
+ return;
}
int
cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
{
- panic("cpu_setmcontext");
+ struct pcb *pcb = lwp_getpcb(l);
+ ucontext_t *ucp = &pcb->pcb_userret_ucp;
+
#ifdef CPU_DEBUG
dprintf_debug("cpu_setmcontext\n");
#endif
+ memcpy(&ucp->uc_mcontext, mcp, sizeof(mcontext_t));
return 0;
}
Home |
Main Index |
Thread Index |
Old Index