Module Name:    src
Committed By:   hannken
Date:           Tue Dec  3 11:50:16 UTC 2019

Modified Files:
        src/sys/arch/x86/x86: x86_machdep.c

Log Message:
Make cpu_intr_p() work with "curlwp->l_cpu == NULL" and
assert "curlwp == &lwp0" in this case.

Prevents crash during early boot with "options LOCKDEBUG".


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/x86/x86/x86_machdep.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/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.130 src/sys/arch/x86/x86/x86_machdep.c:1.131
--- src/sys/arch/x86/x86/x86_machdep.c:1.130	Sun Dec  1 14:52:14 2019
+++ src/sys/arch/x86/x86/x86_machdep.c	Tue Dec  3 11:50:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_machdep.c,v 1.130 2019/12/01 14:52:14 ad Exp $	*/
+/*	$NetBSD: x86_machdep.c,v 1.131 2019/12/03 11:50:16 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.130 2019/12/01 14:52:14 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.131 2019/12/03 11:50:16 hannken Exp $");
 
 #include "opt_modular.h"
 #include "opt_physmem.h"
@@ -354,6 +354,10 @@ cpu_intr_p(void)
 	lwp_t *l;
 
 	l = curlwp;
+	if (__predict_false(l->l_cpu == NULL)) {
+		KASSERT(l == &lwp0);
+		return false;
+	}
 	do {
 		ncsw = l->l_ncsw;
 		idepth = l->l_cpu->ci_idepth;

Reply via email to