Module Name: src Committed By: bouyer Date: Tue May 31 18:04:11 UTC 2022
Modified Files: src/sys/arch/i386/i386: locore.S machdep.c Log Message: For some reason on my system, the guest starts with a pending event in the shared structure. On i386, this cause hypervisor_callback to be entered before cpu_info_primary is fully initialised, especially on i386 ci_intrstack is still NULL, which cause a crash when we try to use it. Work around by recycling the boot's tmp stack for this until cpu_attach() is called. To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/sys/arch/i386/i386/locore.S cvs rdiff -u -r1.834 -r1.835 src/sys/arch/i386/i386/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/i386/i386/locore.S diff -u src/sys/arch/i386/i386/locore.S:1.187 src/sys/arch/i386/i386/locore.S:1.188 --- src/sys/arch/i386/i386/locore.S:1.187 Wed Nov 10 15:59:08 2021 +++ src/sys/arch/i386/i386/locore.S Tue May 31 18:04:11 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.187 2021/11/10 15:59:08 msaitoh Exp $ */ +/* $NetBSD: locore.S,v 1.188 2022/05/31 18:04:11 bouyer Exp $ */ /* * Copyright-o-rama! @@ -128,7 +128,7 @@ */ #include <machine/asm.h> -__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.187 2021/11/10 15:59:08 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.188 2022/05/31 18:04:11 bouyer Exp $"); #include "opt_copy_symtab.h" #include "opt_ddb.h" @@ -326,6 +326,7 @@ LABEL(PDPpaddr) .long 0 /* paddr of PDP END(PDPpaddr) /* Space for the temporary stack */ + .globl _C_LABEL(tmpstk) .size tmpstk, tmpstk - . .space 512 tmpstk: Index: src/sys/arch/i386/i386/machdep.c diff -u src/sys/arch/i386/i386/machdep.c:1.834 src/sys/arch/i386/i386/machdep.c:1.835 --- src/sys/arch/i386/i386/machdep.c:1.834 Sun Dec 26 21:33:48 2021 +++ src/sys/arch/i386/i386/machdep.c Tue May 31 18:04:11 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.834 2021/12/26 21:33:48 riastradh Exp $ */ +/* $NetBSD: machdep.c,v 1.835 2022/05/31 18:04:11 bouyer Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017 @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.834 2021/12/26 21:33:48 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.835 2022/05/31 18:04:11 bouyer Exp $"); #include "opt_beep.h" #include "opt_compat_freebsd.h" @@ -1423,6 +1423,8 @@ init386(paddr_t first_avail) #endif #ifdef XENPV + extern int tmpstk; + cpu_info_primary.ci_intrstack = &tmpstk; events_default_setup(); #else intr_default_setup();