From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Kumar Gala <kumar.gala@linaro.org>
Subject: [PATCH for-6.0 1/2] memory: Add offset_in_region to flatview_cb arguments
Date: Fri, 12 Mar 2021 17:29:38 +0000 [thread overview]
Message-ID: <20210312172939.695-2-peter.maydell@linaro.org> (raw)
In-Reply-To: <20210312172939.695-1-peter.maydell@linaro.org>
The function flatview_for_each_range() calls a callback for each
range in a FlatView. Currently the callback gets the start and
length of the range and the MemoryRegion involved, but not the offset
within the MemoryRegion. Add this to the callback's arguments; we're
going to want it for a new use in the next commit.
While we're editing the flatview_cb typedef, add names for the
arguments that were missing names.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/exec/memory.h | 4 +++-
softmmu/memory.c | 3 ++-
tests/qtest/fuzz/generic_fuzz.c | 4 +++-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 54ccf1a5f09..0c3ddf2bb9a 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -778,7 +778,9 @@ static inline FlatView *address_space_to_flatview(AddressSpace *as)
typedef int (*flatview_cb)(Int128 start,
Int128 len,
- const MemoryRegion*, void*);
+ const MemoryRegion *mr,
+ hwaddr offset_in_region,
+ void *opaque);
void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque);
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 9db47b7db6b..3cc78862c79 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -671,7 +671,8 @@ void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque)
assert(cb);
FOR_EACH_FLAT_RANGE(fr, fv) {
- if (cb(fr->addr.start, fr->addr.size, fr->mr, opaque))
+ if (cb(fr->addr.start, fr->addr.size, fr->mr,
+ fr->offset_in_region, opaque))
break;
}
}
diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c
index ee8c17a04c4..c10a19316f5 100644
--- a/tests/qtest/fuzz/generic_fuzz.c
+++ b/tests/qtest/fuzz/generic_fuzz.c
@@ -96,7 +96,9 @@ struct get_io_cb_info {
};
static int get_io_address_cb(Int128 start, Int128 size,
- const MemoryRegion *mr, void *opaque) {
+ const MemoryRegion *mr,
+ hwaddr offset_in_region,
+ void *opaque) {
struct get_io_cb_info *info = opaque;
if (g_hash_table_lookup(fuzzable_memoryregions, mr)) {
if (info->index == 0) {
--
2.20.1
next prev parent reply other threads:[~2021-03-12 18:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 17:29 [PATCH for-6.0 0/2] arm: Make M-profile VTOR loads on reset handle memory aliasing Peter Maydell
2021-03-12 17:29 ` Peter Maydell [this message]
2021-03-12 20:09 ` [PATCH for-6.0 1/2] memory: Add offset_in_region to flatview_cb arguments Philippe Mathieu-Daudé
2021-03-12 17:29 ` [PATCH for-6.0 2/2] target/arm: Make M-profile VTOR loads on reset handle memory aliasing Peter Maydell
2021-03-12 20:17 ` Philippe Mathieu-Daudé
2021-03-13 19:03 ` Richard Henderson
2021-03-18 17:14 ` Peter Maydell
2021-03-12 18:59 ` [PATCH for-6.0 0/2] arm: " Peter Maydell
2021-03-13 19:05 ` Richard Henderson
2021-03-13 19:41 ` Peter Maydell
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=20210312172939.695-2-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=kumar.gala@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-arm@nongnu.org \
--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).