From patchwork Mon Dec 19 22:01:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132322 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3BA06B705D for ; Tue, 20 Dec 2011 09:02:32 +1100 (EST) Received: from localhost ([::1]:52860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RclHx-0002JY-Lf for incoming@patchwork.ozlabs.org; Mon, 19 Dec 2011 17:02:29 -0500 Received: from eggs.gnu.org ([140.186.70.92]:44765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RclHV-00018B-NV for qemu-devel@nongnu.org; Mon, 19 Dec 2011 17:02:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RclHT-0002lF-Py for qemu-devel@nongnu.org; Mon, 19 Dec 2011 17:02:01 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:37530) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RclHT-0002l2-JE for qemu-devel@nongnu.org; Mon, 19 Dec 2011 17:01:59 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1RclHS-0007Zh-Ln; Mon, 19 Dec 2011 22:01:58 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 19 Dec 2011 22:01:58 +0000 Message-Id: <1324332118-29094-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: patches@linaro.org Subject: [Qemu-devel] [PATCH] hw/pl110.c: Add post-load hook to invalidate display X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add a post-load hook which invalidates the display. In particular, if we don't do this and the display size we've just reloaded is larger than the default then we will segfault trying to read off the end of the buffer. Signed-off-by: Peter Maydell --- hw/pl110.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/hw/pl110.c b/hw/pl110.c index cc1eb6d..be07f56 100644 --- a/hw/pl110.c +++ b/hw/pl110.c @@ -60,10 +60,13 @@ typedef struct { qemu_irq irq; } pl110_state; +static int vmstate_pl110_post_load(void *opaque, int version_id); + static const VMStateDescription vmstate_pl110 = { .name = "pl110", .version_id = 2, .minimum_version_id = 1, + .post_load = vmstate_pl110_post_load, .fields = (VMStateField[]) { VMSTATE_INT32(version, pl110_state), VMSTATE_UINT32_ARRAY(timing, pl110_state, 4), @@ -430,6 +433,14 @@ static void pl110_mux_ctrl_set(void *opaque, int line, int level) s->mux_ctrl = level; } +static int vmstate_pl110_post_load(void *opaque, int version_id) +{ + pl110_state *s = opaque; + /* Make sure we redraw, and at the right size */ + pl110_invalidate_display(s); + return 0; +} + static int pl110_init(SysBusDevice *dev) { pl110_state *s = FROM_SYSBUS(pl110_state, dev);