qemu-devel
[Top][All Lists]
Advanced

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

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


From: Aurelien Jarno
Subject: Re: [Qemu-devel] [PATCH] x86: Fix powerdown for non-ACPI case
Date: Tue, 2 Sep 2008 02:09:12 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Mon, Sep 01, 2008 at 06:03:46PM +0200, Jan Kiszka wrote:
> 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.

Applied, thanks.

> 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);
>      }
> 
> 
> 

-- 
  .''`.  Aurelien Jarno             | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   address@hidden         | address@hidden
   `-    people.debian.org/~aurel32 | www.aurel32.net




reply via email to

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