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 Clean up cpu_trampoline and link the c...



details:   https://anonhg.NetBSD.org/src/rev/51cb94b4f876
branches:  trunk
changeset: 769429:51cb94b4f876
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Fri Sep 09 16:24:44 2011 +0000

description:
Clean up cpu_trampoline and link the context so we dont have to manually do
that.

diffstat:

 sys/arch/usermode/dev/cpu.c |  17 +++--------------
 1 files changed, 3 insertions(+), 14 deletions(-)

diffs (50 lines):

diff -r a04dbb880878 -r 51cb94b4f876 sys/arch/usermode/dev/cpu.c
--- a/sys/arch/usermode/dev/cpu.c       Fri Sep 09 15:45:28 2011 +0000
+++ b/sys/arch/usermode/dev/cpu.c       Fri Sep 09 16:24:44 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.40 2011/09/08 15:13:27 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.41 2011/09/09 16:24:44 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.40 2011/09/08 15:13:27 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.41 2011/09/09 16:24:44 reinoud Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -280,22 +280,11 @@
 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
        lwp_startup(curcpu()->ci_stash, curlwp);
-
        func(arg);
-
-       pcb = lwp_getpcb(curlwp);
-
-       /* switch to userland */
-printf("return of trampoline func, switching to userland\n");
-       thunk_setcontext(&pcb->pcb_userland_ucp);
-
-       panic("%s: shouldn't return", __func__);
 }
 
 void
@@ -329,7 +318,7 @@
        /* set up the ucontext for the userland */
        pcb2->pcb_ucp.uc_stack.ss_sp = stack;
        pcb2->pcb_ucp.uc_stack.ss_size = stacksize;
-       pcb2->pcb_ucp.uc_link = NULL;
+       pcb2->pcb_ucp.uc_link = &pcb2->pcb_userland_ucp;
        pcb2->pcb_ucp.uc_flags = _UC_STACK | _UC_CPU;
        thunk_makecontext(&pcb2->pcb_ucp, (void (*)(void))cpu_lwp_trampoline,
            2, func, arg);



Home | Main Index | Thread Index | Old Index