Module Name:    src
Committed By:   reinoud
Date:           Sun Aug 28 19:41:35 UTC 2011

Modified Files:
        src/sys/arch/usermode/dev: cpu.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.20 src/sys/arch/usermode/dev/cpu.c:1.21
--- src/sys/arch/usermode/dev/cpu.c:1.20	Sun Aug 28 00:40:10 2011
+++ src/sys/arch/usermode/dev/cpu.c	Sun Aug 28 19:41:34 2011
@@ -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 <jmcne...@invisible.ca>
@@ -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__);
 }
 

Reply via email to