qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] x86: Fix powerdown for non-ACPI case


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH] x86: Fix powerdown for non-ACPI case
Date: Mon, 01 Sep 2008 18:03:46 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

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 <address@hidden>
---
 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);
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]