Module Name:    src
Committed By:   reinoud
Date:           Thu May 17 19:00:39 UTC 2018

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

Log Message:
Refactor for easier debugging and while here add some more signals


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 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.74 src/sys/arch/usermode/dev/cpu.c:1.75
--- src/sys/arch/usermode/dev/cpu.c:1.74	Thu Jun  1 02:45:08 2017
+++ src/sys/arch/usermode/dev/cpu.c	Thu May 17 19:00:39 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.74 2017/06/01 02:45:08 chs Exp $ */
+/* $NetBSD: cpu.c,v 1.75 2018/05/17 19:00:39 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca>
@@ -30,7 +30,7 @@
 #include "opt_hz.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.74 2017/06/01 02:45:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.75 2018/05/17 19:00:39 reinoud Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -119,6 +119,8 @@ cpu_attach(device_t parent, device_t sel
 	sc->sc_ucp.uc_flags = _UC_STACK | _UC_CPU | _UC_SIGMASK;
 	thunk_sigaddset(&sc->sc_ucp.uc_sigmask, SIGALRM);
 	thunk_sigaddset(&sc->sc_ucp.uc_sigmask, SIGIO);
+	thunk_sigaddset(&sc->sc_ucp.uc_sigmask, SIGINT);
+	thunk_sigaddset(&sc->sc_ucp.uc_sigmask, SIGTSTP);
 }
 
 void
@@ -191,9 +193,13 @@ static
 void
 cpu_switchto_atomic(lwp_t *oldlwp, lwp_t *newlwp)
 {
-	struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL;
-	struct pcb *newpcb = lwp_getpcb(newlwp);
-	struct cpu_info *ci = curcpu();
+	struct pcb *oldpcb;
+	struct pcb *newpcb;
+	struct cpu_info *ci;
+
+	oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL;
+	newpcb = lwp_getpcb(newlwp);
+	ci = curcpu();
 
 	ci->ci_stash = oldlwp;
 
@@ -241,6 +247,7 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw
 #endif /* !CPU_DEBUG */
 
 	/* create atomic switcher */
+	KASSERT(newlwp);
 	thunk_makecontext(&sc->sc_ucp, (void (*)(void)) cpu_switchto_atomic,
 			2, oldlwp, newlwp, NULL, NULL);
 

Reply via email to