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 Jump to `userland' or the other functi...



details:   https://anonhg.NetBSD.org/src/rev/b275188f38d5
branches:  trunk
changeset: 768902:b275188f38d5
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Sun Aug 28 19:41:34 2011 +0000

description:
Jump to `userland' or the other function specified in the pcb's ucontext

diffstat:

 sys/arch/usermode/dev/cpu.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r b6b0ae286f7f -r b275188f38d5 sys/arch/usermode/dev/cpu.c
--- a/sys/arch/usermode/dev/cpu.c       Sun Aug 28 19:40:26 2011 +0000
+++ b/sys/arch/usermode/dev/cpu.c       Sun Aug 28 19:41:34 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.20 2011/08/28 00:40:10 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.21 2011/08/28 19:41:34 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_cpu.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.20 2011/08/28 00:40:10 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.21 2011/08/28 19:41:34 reinoud Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -269,6 +269,8 @@
 static void
 cpu_lwp_trampoline(void (*func)(void *), void *arg)
 {
+       struct pcb *pcb;
+
 #ifdef CPU_DEBUG
        printf("cpu_lwp_trampoline called with func %p, arg %p\n", (void *) func, arg);
 #endif
@@ -276,6 +278,15 @@
 
        func(arg);
 
+printf("%s: setting ucontext on lwp %p\n", __func__, curlwp);
+pcb = lwp_getpcb(curlwp);
+printf("pcb %p\n", pcb);
+printf("\tpcb->pcb_ucp.uc_stack.ss_sp   = %p\n", pcb->pcb_ucp.uc_stack.ss_sp);
+printf("\tpcb->pcb_ucp.uc_stack.ss_size = %d\n", (int) pcb->pcb_ucp.uc_stack.ss_size);
+
+       /* switch to userland */
+       thunk_setcontext(&pcb->pcb_ucp);
+
        panic("%s: shouldn't return", __func__);
 }
 



Home | Main Index | Thread Index | Old Index