From ae907af48b0c82950cf2e153835fab97b31e7869 Mon Sep 17 00:00:00 2001 From: skrll Date: Sat, 14 May 2022 06:07:53 +0000 Subject: [PATCH] Add some special NOPs to help qemu. thanks to Helge Deller for the heads-up. --- sys/arch/hppa/hppa/idle_machdep.c | 9 ++++++--- sys/arch/hppa/hppa/machdep.c | 13 +++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sys/arch/hppa/hppa/idle_machdep.c b/sys/arch/hppa/hppa/idle_machdep.c index 636b07d8a384..cd3384b8ebb7 100644 --- a/sys/arch/hppa/hppa/idle_machdep.c +++ b/sys/arch/hppa/hppa/idle_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: idle_machdep.c,v 1.3 2019/04/15 20:45:08 skrll Exp $ */ +/* $NetBSD: idle_machdep.c,v 1.4 2022/05/14 06:07:53 skrll Exp $ */ /* * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: idle_machdep.c,v 1.3 2019/04/15 20:45:08 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: idle_machdep.c,v 1.4 2022/05/14 06:07:53 skrll Exp $"); #include #include @@ -36,5 +36,8 @@ __KERNEL_RCSID(0, "$NetBSD: idle_machdep.c,v 1.3 2019/04/15 20:45:08 skrll Exp $ void cpu_idle(void) { - /* do nothing */ + /* + * This NOP instruction is used by qemu to detect the idle loop. + */ + __asm volatile("or %%r10,%%r10,%%r10" ::: "memory"); } diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index 7b41da38ca07..5b427fd213ca 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.16 2020/09/14 16:11:32 skrll Exp $ */ +/* $NetBSD: machdep.c,v 1.17 2022/05/14 06:07:53 skrll Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.16 2020/09/14 16:11:32 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.17 2022/05/14 06:07:53 skrll Exp $"); #include "opt_cputype.h" #include "opt_ddb.h" @@ -1447,8 +1447,13 @@ cpu_reboot(int howto, char *user_boot_string) :: "r" (CMD_RESET), "r" (HPPA_LBCAST + iomod_command)); } - for (;;) - /* loop while bus reset is coming up */ ; + for (;;) { + /* + * loop while bus reset is coming up. This NOP instruction + * is used by qemu to detect the 'death loop'. + */ + __asm volatile("or %%r31, %%r31, %%r31" ::: "memory"); + } /* NOTREACHED */ }