qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] x86: Fix powerdown for non-ACPI case
@ 2008-09-01 16:03 Jan Kiszka
  2008-09-02  0:09 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2008-09-01 16:03 UTC (permalink / raw)
  To: qemu-devel

Trivial fix for a corner case: system_shutdown on isapc machines causes
qemu to segfaults due to accessing the uninitialized pm_state. Issue a
system shutdown instead.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/acpi.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: b/hw/acpi.c
===================================================================
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -72,7 +72,7 @@ typedef struct PIIX4PMState {
 #define SMBHSTDAT1 0x06
 #define SMBBLKDAT 0x07
 
-PIIX4PMState *pm_state;
+static PIIX4PMState *pm_state;
 
 static uint32_t get_pmtmr(PIIX4PMState *s)
 {
@@ -526,7 +526,9 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int
 #if defined(TARGET_I386)
 void qemu_system_powerdown(void)
 {
-    if(pm_state->pmen & PWRBTN_EN) {
+    if (!pm_state) {
+        qemu_system_shutdown_request();
+    } else if (pm_state->pmen & PWRBTN_EN) {
         pm_state->pmsts |= PWRBTN_EN;
 	pm_update_sci(pm_state);
     }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-02  0:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-01 16:03 [Qemu-devel] [PATCH] x86: Fix powerdown for non-ACPI case Jan Kiszka
2008-09-02  0:09 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).