From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OAQnK-0003go-SA for qemu-devel@nongnu.org; Fri, 07 May 2010 12:52:58 -0400 Received: from [140.186.70.92] (port=35875 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAQnI-0003fg-MA for qemu-devel@nongnu.org; Fri, 07 May 2010 12:52:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OAQnG-0001tm-ML for qemu-devel@nongnu.org; Fri, 07 May 2010 12:52:56 -0400 Received: from are.twiddle.net ([75.149.56.221]:53067) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAQnG-0001qu-EF for qemu-devel@nongnu.org; Fri, 07 May 2010 12:52:54 -0400 From: Richard Henderson Date: Fri, 7 May 2010 09:52:51 -0700 Message-Id: <1273251171-25338-1-git-send-email-rth@twiddle.net> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH] Fill in unassigned mem read/write callbacks. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: blauwirbel@gmail.com, atar4qemu@googlemail.com Implement the "functions may be omitted with NULL pointer" interface mentioned in the function block comment by transforming NULL entries in the read/write arrays into calls to the unassigned_mem family of functions. Signed-off-by: Richard Henderson --- exec.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index e980788..3416aed 100644 --- a/exec.c +++ b/exec.c @@ -3262,6 +3262,8 @@ static int cpu_register_io_memory_fixed(int io_index, CPUWriteMemoryFunc * const *mem_write, void *opaque) { + int i; + if (io_index <= 0) { io_index = get_free_io_mem_idx(); if (io_index == -1) @@ -3272,8 +3274,14 @@ static int cpu_register_io_memory_fixed(int io_index, return -1; } - memcpy(io_mem_read[io_index], mem_read, 3 * sizeof(CPUReadMemoryFunc*)); - memcpy(io_mem_write[io_index], mem_write, 3 * sizeof(CPUWriteMemoryFunc*)); + for (i = 0; i < 3; ++i) { + io_mem_read[io_index][i] + = (mem_read[i] ? mem_read[i] : unassigned_mem_read[i]); + } + for (i = 0; i < 3; ++i) { + io_mem_write[io_index][i] + = (mem_write[i] ? mem_write[i] : unassigned_mem_write[i]); + } io_mem_opaque[io_index] = opaque; return (io_index << IO_MEM_SHIFT); -- 1.6.6.1