Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/i386 i386/bioscall: Disable preemption while w...



details:   https://anonhg.NetBSD.org/src/rev/139b35684548
branches:  trunk
changeset: 373745:139b35684548
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Feb 25 13:52:09 2023 +0000

description:
i386/bioscall: Disable preemption while we load the kernel pmap.

Fixes crash on boot in new KASSERT(kpreempt_disabled()) in
cpu_load_pmap.

We could do KASSERT(kpreempt_disabled() || cold), but I don't know if
bioscall is ever reachable after warm boot; this way is safer.

XXX Would be nice if bioscall were a C function, not asm -- I don't
see any reason why we need it to be asm?

diffstat:

 sys/arch/i386/i386/bioscall.S |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r d33041835736 -r 139b35684548 sys/arch/i386/i386/bioscall.S
--- a/sys/arch/i386/i386/bioscall.S     Sat Feb 25 13:51:48 2023 +0000
+++ b/sys/arch/i386/i386/bioscall.S     Sat Feb 25 13:52:09 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bioscall.S,v 1.10 2018/07/14 14:29:40 maxv Exp $ */
+/*     $NetBSD: bioscall.S,v 1.11 2023/02/25 13:52:09 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: bioscall.S,v 1.10 2018/07/14 14:29:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bioscall.S,v 1.11 2023/02/25 13:52:09 riastradh Exp $");
 
 #include <machine/bioscall.h>
 
@@ -67,6 +67,8 @@
        pushl   %ebp
        movl    %esp,%ebp               /* set up frame ptr */
 
+       call    _C_LABEL(kpreempt_disable)
+
        /* install lwp0 pmap */
        movl    _C_LABEL(kernel_pmap_ptr),%eax
        pushl   %eax
@@ -85,5 +87,7 @@
        call    _C_LABEL(cpu_load_pmap)
        addl    $4,%esp
 
+       call    _C_LABEL(kpreempt_enable)
+
        leave
        ret



Home | Main Index | Thread Index | Old Index