Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Make cpu_intr_p() work with "curlwp->l_cpu ...



details:   https://anonhg.NetBSD.org/src/rev/e2429e83236a
branches:  trunk
changeset: 1005278:e2429e83236a
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Dec 03 11:50:16 2019 +0000

description:
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".

diffstat:

 sys/arch/x86/x86/x86_machdep.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 384754553905 -r e2429e83236a sys/arch/x86/x86/x86_machdep.c
--- a/sys/arch/x86/x86/x86_machdep.c    Tue Dec 03 11:26:12 2019 +0000
+++ b/sys/arch/x86/x86/x86_machdep.c    Tue Dec 03 11:50:16 2019 +0000
@@ -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 @@
        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;



Home | Main Index | Thread Index | Old Index