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 Restore errno just before switching to...



details:   https://anonhg.NetBSD.org/src/rev/585754601f18
branches:  trunk
changeset: 769290:585754601f18
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Mon Sep 05 19:28:32 2011 +0000

description:
Restore errno just before switching to the new context and NOT after it got
back again

diffstat:

 sys/arch/usermode/dev/cpu.c |  12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (51 lines):

diff -r a4983b1f6fe5 -r 585754601f18 sys/arch/usermode/dev/cpu.c
--- a/sys/arch/usermode/dev/cpu.c       Mon Sep 05 18:52:14 2011 +0000
+++ b/sys/arch/usermode/dev/cpu.c       Mon Sep 05 19:28:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.31 2011/09/05 12:40:38 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.32 2011/09/05 19:28:32 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.31 2011/09/05 12:40:38 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.32 2011/09/05 19:28:32 reinoud Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -159,7 +159,6 @@
        struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL;
        struct pcb *newpcb = lwp_getpcb(newlwp);
        struct cpu_info *ci = curcpu();
-       int s;
 
 #ifdef CPU_DEBUG
        printf("cpu_switchto [%s,pid=%d,lid=%d] -> [%s,pid=%d,lid=%d]\n",
@@ -185,22 +184,19 @@
        }
 #endif /* !CPU_DEBUG */
 
-       s = splsched();
-
        ci->ci_stash = oldlwp;
        curlwp = newlwp;
 
        if (oldpcb) {
                oldpcb->pcb_errno = thunk_geterrno();
+               thunk_seterrno(newpcb->pcb_errno);
                if (thunk_swapcontext(&oldpcb->pcb_ucp, &newpcb->pcb_ucp))
                        panic("swapcontext failed");
        } else {
+               thunk_seterrno(newpcb->pcb_errno);
                if (thunk_setcontext(&newpcb->pcb_ucp))
                        panic("setcontext failed");
        }
-       thunk_seterrno(newpcb->pcb_errno);
-
-       splx(s);
 
 #ifdef CPU_DEBUG
        printf("cpu_switchto: returning %p (was %p)\n", ci->ci_stash, oldlwp);



Home | Main Index | Thread Index | Old Index