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 For some reason on my system, the guest s...



details:   https://anonhg.NetBSD.org/src/rev/b4a8dd901563
branches:  trunk
changeset: 366593:b4a8dd901563
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue May 31 18:04:11 2022 +0000

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

diffstat:

 sys/arch/i386/i386/locore.S  |  5 +++--
 sys/arch/i386/i386/machdep.c |  6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r ef973ea977b1 -r b4a8dd901563 sys/arch/i386/i386/locore.S
--- a/sys/arch/i386/i386/locore.S       Tue May 31 18:01:22 2022 +0000
+++ b/sys/arch/i386/i386/locore.S       Tue May 31 18:04:11 2022 +0000
@@ -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 @@
 END(PDPpaddr)
 
        /* Space for the temporary stack */
+       .globl  _C_LABEL(tmpstk)
        .size   tmpstk, tmpstk - .
        .space  512
 tmpstk:
diff -r ef973ea977b1 -r b4a8dd901563 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Tue May 31 18:01:22 2022 +0000
+++ b/sys/arch/i386/i386/machdep.c      Tue May 31 18:04:11 2022 +0000
@@ -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 @@
 #endif
 
 #ifdef XENPV
+       extern int tmpstk;
+       cpu_info_primary.ci_intrstack = &tmpstk;
        events_default_setup();
 #else
        intr_default_setup();



Home | Main Index | Thread Index | Old Index