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: 5892 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3EE47240A4 for ; Mon, 19 Dec 2011 22:02:01 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 354DDA18818 for ; Mon, 19 Dec 2011 22:02:01 +0000 (UTC) Received: by mail-ey0-f180.google.com with SMTP id c11so2529425eaa.11 for ; Mon, 19 Dec 2011 14:02:01 -0800 (PST) Received: by 10.204.133.207 with SMTP id g15mr5590397bkt.17.1324332121019; Mon, 19 Dec 2011 14:02:01 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs18272bkc; Mon, 19 Dec 2011 14:02:00 -0800 (PST) Received: by 10.180.94.97 with SMTP id db1mr2463554wib.16.1324332119728; Mon, 19 Dec 2011 14:01:59 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id ce6si4832393wib.18.2011.12.19.14.01.59 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Dec 2011 14:01:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk 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 Cc: patches@linaro.org Subject: [PATCH] hw/pl110.c: Add post-load hook to invalidate display 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 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);