summaryrefslogtreecommitdiffstats
path: root/hw/acpi.c
diff options
context:
space:
mode:
authoraurel322008-09-02 02:09:25 +0200
committeraurel322008-09-02 02:09:25 +0200
commit9669d3c570c7a2129c6d6d4e32b856a2d155eb54 (patch)
treef078e38f9fa6529b974e3e5d826a6c3352e89522 /hw/acpi.c
parentFix typo in console.c comment (diff)
downloadqemu-9669d3c570c7a2129c6d6d4e32b856a2d155eb54.tar.gz
qemu-9669d3c570c7a2129c6d6d4e32b856a2d155eb54.tar.xz
qemu-9669d3c570c7a2129c6d6d4e32b856a2d155eb54.zip
x86: Fix powerdown for non-ACPI case
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> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5130 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/acpi.c')
-rw-r--r--hw/acpi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/acpi.c b/hw/acpi.c
index bdcc4255f1..45963d37e8 100644
--- 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 devfn, uint32_t smb_io_base,
#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);
}