From: Avi Kivity <avi@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 05/10] memory: code motion: move MEMORY_LISTENER_CALL()
Date: Wed, 8 Feb 2012 17:27:54 +0200 [thread overview]
Message-ID: <1328714879-18906-6-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1328714879-18906-1-git-send-email-avi@redhat.com>
So it can be used in earlier code.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
memory.c | 64 +++++++++++++++++++++++++++++++-------------------------------
1 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/memory.c b/memory.c
index cb2b4f1..a1013bc 100644
--- a/memory.c
+++ b/memory.c
@@ -82,6 +82,38 @@ static AddrRange addrrange_intersection(AddrRange r1, AddrRange r2)
return addrrange_make(start, int128_sub(end, start));
}
+enum ListenerDirection { Forward, Reverse };
+
+#define MEMORY_LISTENER_CALL(_callback, _direction, _args...) \
+ do { \
+ MemoryListener *_listener; \
+ \
+ switch (_direction) { \
+ case Forward: \
+ QTAILQ_FOREACH(_listener, &memory_listeners, link) { \
+ _listener->_callback(_listener, ##_args); \
+ } \
+ break; \
+ case Reverse: \
+ QTAILQ_FOREACH_REVERSE(_listener, &memory_listeners, \
+ memory_listeners, link) { \
+ _listener->_callback(_listener, ##_args); \
+ } \
+ break; \
+ default: \
+ abort(); \
+ } \
+ } while (0)
+
+#define MEMORY_LISTENER_UPDATE_REGION(fr, as, dir, callback) \
+ MEMORY_LISTENER_CALL(callback, dir, &(MemoryRegionSection) { \
+ .mr = (fr)->mr, \
+ .address_space = (as)->root, \
+ .offset_within_region = (fr)->offset_in_region, \
+ .size = int128_get64((fr)->addr.size), \
+ .offset_within_address_space = int128_get64((fr)->addr.start), \
+ })
+
struct CoalescedMemoryRange {
AddrRange addr;
QTAILQ_ENTRY(CoalescedMemoryRange) link;
@@ -678,38 +710,6 @@ static void address_space_update_ioeventfds(AddressSpace *as)
as->ioeventfd_nb = ioeventfd_nb;
}
-enum ListenerDirection { Forward, Reverse };
-
-#define MEMORY_LISTENER_CALL(_callback, _direction, _args...) \
- do { \
- MemoryListener *_listener; \
- \
- switch (_direction) { \
- case Forward: \
- QTAILQ_FOREACH(_listener, &memory_listeners, link) { \
- _listener->_callback(_listener, ##_args); \
- } \
- break; \
- case Reverse: \
- QTAILQ_FOREACH_REVERSE(_listener, &memory_listeners, \
- memory_listeners, link) { \
- _listener->_callback(_listener, ##_args); \
- } \
- break; \
- default: \
- abort(); \
- } \
- } while (0)
-
-#define MEMORY_LISTENER_UPDATE_REGION(fr, as, dir, callback) \
- MEMORY_LISTENER_CALL(callback, dir, &(MemoryRegionSection) { \
- .mr = (fr)->mr, \
- .address_space = (as)->root, \
- .offset_within_region = (fr)->offset_in_region, \
- .size = int128_get64((fr)->addr.size), \
- .offset_within_address_space = int128_get64((fr)->addr.start), \
- })
-
static void address_space_update_topology_pass(AddressSpace *as,
FlatView old_view,
FlatView new_view,
--
1.7.9
next prev parent reply other threads:[~2012-02-08 15:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 15:27 [Qemu-devel] [PATCH 00/10] Remove AddressSpaceOps Avi Kivity
2012-02-08 15:27 ` [Qemu-devel] [PATCH 01/10] ioport: change portio_list not to use memory_region_set_offset() Avi Kivity
2012-02-08 15:27 ` [Qemu-devel] [PATCH 02/10] memory: remove memory_region_set_offset() Avi Kivity
2012-02-08 15:27 ` [Qemu-devel] [PATCH 03/10] memory: add shorthand for invoking a callback on all listeners Avi Kivity
2012-02-08 15:27 ` [Qemu-devel] [PATCH 04/10] memory: switch memory listeners to a QTAILQ Avi Kivity
2012-02-08 15:27 ` Avi Kivity [this message]
2012-02-08 15:27 ` [Qemu-devel] [PATCH 06/10] memory: move ioeventfd ops to MemoryListener Avi Kivity
2012-02-08 15:27 ` [Qemu-devel] [PATCH 07/10] memory: add a readonly attribute to MemoryRegionSection Avi Kivity
2012-02-08 15:27 ` [Qemu-devel] [PATCH 08/10] memory: don't pass ->readable attribute to cpu_register_physical_memory_log Avi Kivity
2012-02-08 15:27 ` [Qemu-devel] [PATCH 09/10] memory: use a MemoryListener for core memory map updates too Avi Kivity
2012-02-09 7:58 ` Paolo Bonzini
2012-02-09 9:28 ` Avi Kivity
2012-02-08 15:27 ` [Qemu-devel] [PATCH 10/10] memory: drop AddressSpaceOps Avi Kivity
2012-02-08 15:35 ` [Qemu-devel] [PATCH 00/10] Remove AddressSpaceOps Avi Kivity
2012-02-08 23:28 ` Richard Henderson
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=1328714879-18906-6-git-send-email-avi@redhat.com \
--to=avi@redhat.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).