[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/31] memory: Add FlatView foreach function
From: |
Thomas Huth |
Subject: |
[PULL 09/31] memory: Add FlatView foreach function |
Date: |
Mon, 26 Oct 2020 11:06:10 +0100 |
From: Alexander Bulekov <alxndr@bu.edu>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20201023150746.107063-2-alxndr@bu.edu>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
include/exec/memory.h | 5 +++++
softmmu/memory.c | 13 +++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 622207bde1..042918dd16 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -719,6 +719,11 @@ static inline FlatView
*address_space_to_flatview(AddressSpace *as)
return qatomic_rcu_read(&as->current_map);
}
+typedef int (*flatview_cb)(Int128 start,
+ Int128 len,
+ const MemoryRegion*, void*);
+
+void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque);
/**
* struct MemoryRegionSection: describes a fragment of a #MemoryRegion
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 403ff3abc9..a5d1641820 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -656,6 +656,19 @@ static void render_memory_region(FlatView *view,
}
}
+void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque)
+{
+ FlatRange *fr;
+
+ assert(fv);
+ assert(cb);
+
+ FOR_EACH_FLAT_RANGE(fr, fv) {
+ if (cb(fr->addr.start, fr->addr.size, fr->mr, opaque))
+ break;
+ }
+}
+
static MemoryRegion *memory_region_get_flatview_root(MemoryRegion *mr)
{
while (mr->enabled) {
--
2.18.2
- [PULL 00/31] qtests and gitlab-CI/acceptance patches, Thomas Huth, 2020/10/26
- [PULL 01/31] tests/migration: fix memleak in wait_command/wait_command_fd, Thomas Huth, 2020/10/26
- [PULL 03/31] accel: Remove _WIN32 ifdef from qtest-cpus.c, Thomas Huth, 2020/10/26
- [PULL 02/31] tests/qtest/libqtest: Fix detection of architecture for binaries without path, Thomas Huth, 2020/10/26
- [PULL 04/31] accel: move qtest CpusAccel functions to a common location, Thomas Huth, 2020/10/26
- [PULL 05/31] accel: Add xen CpusAccel using dummy-cpus, Thomas Huth, 2020/10/26
- [PULL 06/31] tests/qtest: Make npcm7xx_timer-test conditional on CONFIG_NPCM7XX, Thomas Huth, 2020/10/26
- [PULL 07/31] libqtest: fix the order of buffered events, Thomas Huth, 2020/10/26
- [PULL 08/31] libqtest: fix memory leak in the qtest_qmp_event_ref, Thomas Huth, 2020/10/26
- [PULL 09/31] memory: Add FlatView foreach function,
Thomas Huth <=
- [PULL 10/31] fuzz: Add generic virtual-device fuzzer, Thomas Huth, 2020/10/26
- [PULL 11/31] fuzz: Add PCI features to the generic fuzzer, Thomas Huth, 2020/10/26
- [PULL 12/31] fuzz: Add DMA support to the generic-fuzzer, Thomas Huth, 2020/10/26
- [PULL 15/31] fuzz: Add support for custom crossover functions, Thomas Huth, 2020/10/26
- [PULL 14/31] fuzz: Add fuzzer callbacks to DMA-read functions, Thomas Huth, 2020/10/26
- [PULL 19/31] scripts/oss-fuzz: Add crash trace minimization script, Thomas Huth, 2020/10/26
- [PULL 16/31] fuzz: add a DISABLE_PCI op to generic-fuzzer, Thomas Huth, 2020/10/26
- [PULL 20/31] fuzz: Add instructions for using generic-fuzz, Thomas Huth, 2020/10/26
- [PULL 21/31] fuzz: add an "opaque" to the FuzzTarget struct, Thomas Huth, 2020/10/26
- [PULL 17/31] fuzz: add a crossover function to generic-fuzzer, Thomas Huth, 2020/10/26