From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: blauwirbel@gmail.com, atar4qemu@googlemail.com
Subject: [Qemu-devel] [PATCH] Fill in unassigned mem read/write callbacks.
Date: Fri, 7 May 2010 09:52:51 -0700 [thread overview]
Message-ID: <1273251171-25338-1-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <l2vf43fc5581005070828lb66a4abap3f63d630ae9d473qemu-devel@nongnu.org>
In-Reply-To: <l2vf43fc5581005070828lb66a4abap3f63d630ae9d4737@mail.gmail.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 <rth@twiddle.net>
---
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
next prev parent reply other threads:[~2010-05-07 16:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-20 20:26 [Qemu-devel] [PATCH 0/2] [RFC] 64-bit io paths Richard Henderson
2010-04-20 19:54 ` [Qemu-devel] [PATCH 1/2] io: Add CPUIOMemoryOps and use it Richard Henderson
2010-04-20 20:22 ` [Qemu-devel] [PATCH 2/2] io: Add readq/writeq hooks and use them Richard Henderson
2010-04-22 19:38 ` [Qemu-devel] [PATCH 0/2] [RFC] 64-bit io paths Blue Swirl
2010-04-22 19:55 ` Richard Henderson
2010-04-22 20:01 ` Blue Swirl
2010-04-22 21:19 ` Richard Henderson
2010-04-23 18:30 ` Blue Swirl
2010-05-28 20:45 ` Paul Brook
2010-04-22 23:47 ` [Qemu-devel] [PATCH] Remove IO_MEM_SUBWIDTH Richard Henderson
2010-04-25 15:06 ` [Qemu-devel] " Blue Swirl
2010-04-26 21:54 ` Artyom Tarasenko
2010-04-27 18:30 ` Richard Henderson
2010-04-28 19:29 ` Artyom Tarasenko
2010-05-06 20:25 ` Artyom Tarasenko
2010-05-07 15:28 ` Blue Swirl
2010-05-07 16:52 ` Richard Henderson [this message]
2010-05-07 17:02 ` [Qemu-devel] Re: [PATCH] Fill in unassigned mem read/write callbacks Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1273251171-25338-1-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=atar4qemu@googlemail.com \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).