From patchwork Wed Jun 5 13:42:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 249063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7B7F82C00A2 for ; Wed, 5 Jun 2013 23:41:36 +1000 (EST) Received: from localhost ([::1]:47583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkDy1-0006KD-Ty for incoming@patchwork.ozlabs.org; Wed, 05 Jun 2013 09:41:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkDxh-0006JO-4h for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:41:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkDxc-0000ce-4n for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:41:13 -0400 Received: from [101.78.175.194] (port=39976 helo=ibis.ibis) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkDxb-0000c9-PE; Wed, 05 Jun 2013 09:41:08 -0400 Received: from [172.19.126.47] (helo=localhost.localdomain) by ibis.ibis with esmtp (Exim 4.70) (envelope-from ) id 1UkDxZ-00028a-0H; Wed, 05 Jun 2013 21:41:05 +0800 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= To: qemu-devel@nongnu.org Date: Wed, 5 Jun 2013 21:42:28 +0800 Message-Id: <1370439748-18092-1-git-send-email-hpoussin@reactos.org> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 101.78.175.194 Cc: qemu-trivial@nongnu.org, Paolo Bonzini , =?UTF-8?q?Herv=C3=A9=20Poussineau?= Subject: [Qemu-devel] [PATCH] ioport/memory: check that both .read and .write callbacks are defined 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 If that's not the case, QEMU will may during execution. This has recently been fixed for: - acpi (2d3b989529727ccace243b953a181fbae04a30d1) - kvmapic (0c1cd0ae2a4faabeb948b9a07ea1696e853de174) - xhci (6d3bc22e31bcee74dc1e05a5370cabb33b7c3fda) Signed-off-by: Hervé Poussineau --- I started all current QEMU system emulations with qemu-system-{arch} -M {machine} , and none broke on these additionnal asserts. However, lots of them exited for other reasons, like not having the right number of CPUs, no -kernel argument, or fetching invalid instructions from RAM. ioport.c | 1 + memory.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ioport.c b/ioport.c index a0ac2a0..8dd9d50 100644 --- a/ioport.c +++ b/ioport.c @@ -337,6 +337,7 @@ void portio_list_init(PortioList *piolist, unsigned n = 0; while (callbacks[n].size) { + assert(callbacks[n].read && callbacks[n].write); ++n; } diff --git a/memory.c b/memory.c index 5cb8f4a..654d1ce 100644 --- a/memory.c +++ b/memory.c @@ -1008,6 +1008,8 @@ void memory_region_init_io(MemoryRegion *mr, uint64_t size) { memory_region_init(mr, name, size); + assert(ops->read || ops->old_mmio.read); + assert(ops->write || ops->old_mmio.write); mr->ops = ops; mr->opaque = opaque; mr->terminates = true;