memory: maintain a list of address spaces
[qemu/ar7.git] / memory.h
blob46bc5e1cfd5abe806085105a55d5e437fbef581d
1 /*
2 * Physical memory management API
4 * Copyright 2011 Red Hat, Inc. and/or its affiliates
6 * Authors:
7 * Avi Kivity <avi@redhat.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #ifndef MEMORY_H
15 #define MEMORY_H
17 #ifndef CONFIG_USER_ONLY
19 #include <stdint.h>
20 #include <stdbool.h>
21 #include "qemu-common.h"
22 #include "cpu-common.h"
23 #include "targphys.h"
24 #include "qemu-queue.h"
25 #include "iorange.h"
26 #include "ioport.h"
27 #include "int128.h"
29 typedef struct MemoryRegionOps MemoryRegionOps;
30 typedef struct MemoryRegion MemoryRegion;
31 typedef struct MemoryRegionPortio MemoryRegionPortio;
32 typedef struct MemoryRegionMmio MemoryRegionMmio;
34 /* Must match *_DIRTY_FLAGS in cpu-all.h. To be replaced with dynamic
35 * registration.
37 #define DIRTY_MEMORY_VGA 0
38 #define DIRTY_MEMORY_CODE 1
39 #define DIRTY_MEMORY_MIGRATION 3
41 struct MemoryRegionMmio {
42 CPUReadMemoryFunc *read[3];
43 CPUWriteMemoryFunc *write[3];
46 /* Internal use; thunks between old-style IORange and MemoryRegions. */
47 typedef struct MemoryRegionIORange MemoryRegionIORange;
48 struct MemoryRegionIORange {
49 IORange iorange;
50 MemoryRegion *mr;
51 target_phys_addr_t offset;
55 * Memory region callbacks
57 struct MemoryRegionOps {
58 /* Read from the memory region. @addr is relative to @mr; @size is
59 * in bytes. */
60 uint64_t (*read)(void *opaque,
61 target_phys_addr_t addr,
62 unsigned size);
63 /* Write to the memory region. @addr is relative to @mr; @size is
64 * in bytes. */
65 void (*write)(void *opaque,
66 target_phys_addr_t addr,
67 uint64_t data,
68 unsigned size);
70 enum device_endian endianness;
71 /* Guest-visible constraints: */
72 struct {
73 /* If nonzero, specify bounds on access sizes beyond which a machine
74 * check is thrown.
76 unsigned min_access_size;
77 unsigned max_access_size;
78 /* If true, unaligned accesses are supported. Otherwise unaligned
79 * accesses throw machine checks.
81 bool unaligned;
83 * If present, and returns #false, the transaction is not accepted
84 * by the device (and results in machine dependent behaviour such
85 * as a machine check exception).
87 bool (*accepts)(void *opaque, target_phys_addr_t addr,
88 unsigned size, bool is_write);
89 } valid;
90 /* Internal implementation constraints: */
91 struct {
92 /* If nonzero, specifies the minimum size implemented. Smaller sizes
93 * will be rounded upwards and a partial result will be returned.
95 unsigned min_access_size;
96 /* If nonzero, specifies the maximum size implemented. Larger sizes
97 * will be done as a series of accesses with smaller sizes.
99 unsigned max_access_size;
100 /* If true, unaligned accesses are supported. Otherwise all accesses
101 * are converted to (possibly multiple) naturally aligned accesses.
103 bool unaligned;
104 } impl;
106 /* If .read and .write are not present, old_portio may be used for
107 * backwards compatibility with old portio registration
109 const MemoryRegionPortio *old_portio;
110 /* If .read and .write are not present, old_mmio may be used for
111 * backwards compatibility with old mmio registration
113 const MemoryRegionMmio old_mmio;
116 typedef struct CoalescedMemoryRange CoalescedMemoryRange;
117 typedef struct MemoryRegionIoeventfd MemoryRegionIoeventfd;
119 struct MemoryRegion {
120 /* All fields are private - violators will be prosecuted */
121 const MemoryRegionOps *ops;
122 void *opaque;
123 MemoryRegion *parent;
124 Int128 size;
125 target_phys_addr_t addr;
126 void (*destructor)(MemoryRegion *mr);
127 ram_addr_t ram_addr;
128 bool subpage;
129 bool terminates;
130 bool readable;
131 bool ram;
132 bool readonly; /* For RAM regions */
133 bool enabled;
134 bool rom_device;
135 bool warning_printed; /* For reservations */
136 bool flush_coalesced_mmio;
137 MemoryRegion *alias;
138 target_phys_addr_t alias_offset;
139 unsigned priority;
140 bool may_overlap;
141 QTAILQ_HEAD(subregions, MemoryRegion) subregions;
142 QTAILQ_ENTRY(MemoryRegion) subregions_link;
143 QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced;
144 const char *name;
145 uint8_t dirty_log_mask;
146 unsigned ioeventfd_nb;
147 MemoryRegionIoeventfd *ioeventfds;
150 struct MemoryRegionPortio {
151 uint32_t offset;
152 uint32_t len;
153 unsigned size;
154 IOPortReadFunc *read;
155 IOPortWriteFunc *write;
158 #define PORTIO_END_OF_LIST() { }
160 typedef struct AddressSpace AddressSpace;
163 * AddressSpace: describes a mapping of addresses to #MemoryRegion objects
165 struct AddressSpace {
166 /* All fields are private. */
167 const char *name;
168 MemoryRegion *root;
169 struct FlatView *current_map;
170 int ioeventfd_nb;
171 struct MemoryRegionIoeventfd *ioeventfds;
172 QTAILQ_ENTRY(AddressSpace) address_spaces_link;
175 typedef struct MemoryRegionSection MemoryRegionSection;
178 * MemoryRegionSection: describes a fragment of a #MemoryRegion
180 * @mr: the region, or %NULL if empty
181 * @address_space: the address space the region is mapped in
182 * @offset_within_region: the beginning of the section, relative to @mr's start
183 * @size: the size of the section; will not exceed @mr's boundaries
184 * @offset_within_address_space: the address of the first byte of the section
185 * relative to the region's address space
186 * @readonly: writes to this section are ignored
188 struct MemoryRegionSection {
189 MemoryRegion *mr;
190 MemoryRegion *address_space;
191 target_phys_addr_t offset_within_region;
192 uint64_t size;
193 target_phys_addr_t offset_within_address_space;
194 bool readonly;
197 typedef struct MemoryListener MemoryListener;
200 * MemoryListener: callbacks structure for updates to the physical memory map
202 * Allows a component to adjust to changes in the guest-visible memory map.
203 * Use with memory_listener_register() and memory_listener_unregister().
205 struct MemoryListener {
206 void (*begin)(MemoryListener *listener);
207 void (*commit)(MemoryListener *listener);
208 void (*region_add)(MemoryListener *listener, MemoryRegionSection *section);
209 void (*region_del)(MemoryListener *listener, MemoryRegionSection *section);
210 void (*region_nop)(MemoryListener *listener, MemoryRegionSection *section);
211 void (*log_start)(MemoryListener *listener, MemoryRegionSection *section);
212 void (*log_stop)(MemoryListener *listener, MemoryRegionSection *section);
213 void (*log_sync)(MemoryListener *listener, MemoryRegionSection *section);
214 void (*log_global_start)(MemoryListener *listener);
215 void (*log_global_stop)(MemoryListener *listener);
216 void (*eventfd_add)(MemoryListener *listener, MemoryRegionSection *section,
217 bool match_data, uint64_t data, EventNotifier *e);
218 void (*eventfd_del)(MemoryListener *listener, MemoryRegionSection *section,
219 bool match_data, uint64_t data, EventNotifier *e);
220 /* Lower = earlier (during add), later (during del) */
221 unsigned priority;
222 MemoryRegion *address_space_filter;
223 QTAILQ_ENTRY(MemoryListener) link;
227 * memory_region_init: Initialize a memory region
229 * The region typically acts as a container for other memory regions. Use
230 * memory_region_add_subregion() to add subregions.
232 * @mr: the #MemoryRegion to be initialized
233 * @name: used for debugging; not visible to the user or ABI
234 * @size: size of the region; any subregions beyond this size will be clipped
236 void memory_region_init(MemoryRegion *mr,
237 const char *name,
238 uint64_t size);
240 * memory_region_init_io: Initialize an I/O memory region.
242 * Accesses into the region will cause the callbacks in @ops to be called.
243 * if @size is nonzero, subregions will be clipped to @size.
245 * @mr: the #MemoryRegion to be initialized.
246 * @ops: a structure containing read and write callbacks to be used when
247 * I/O is performed on the region.
248 * @opaque: passed to to the read and write callbacks of the @ops structure.
249 * @name: used for debugging; not visible to the user or ABI
250 * @size: size of the region.
252 void memory_region_init_io(MemoryRegion *mr,
253 const MemoryRegionOps *ops,
254 void *opaque,
255 const char *name,
256 uint64_t size);
259 * memory_region_init_ram: Initialize RAM memory region. Accesses into the
260 * region will modify memory directly.
262 * @mr: the #MemoryRegion to be initialized.
263 * @name: the name of the region.
264 * @size: size of the region.
266 void memory_region_init_ram(MemoryRegion *mr,
267 const char *name,
268 uint64_t size);
271 * memory_region_init_ram_ptr: Initialize RAM memory region from a
272 * user-provided pointer. Accesses into the
273 * region will modify memory directly.
275 * @mr: the #MemoryRegion to be initialized.
276 * @name: the name of the region.
277 * @size: size of the region.
278 * @ptr: memory to be mapped; must contain at least @size bytes.
280 void memory_region_init_ram_ptr(MemoryRegion *mr,
281 const char *name,
282 uint64_t size,
283 void *ptr);
286 * memory_region_init_alias: Initialize a memory region that aliases all or a
287 * part of another memory region.
289 * @mr: the #MemoryRegion to be initialized.
290 * @name: used for debugging; not visible to the user or ABI
291 * @orig: the region to be referenced; @mr will be equivalent to
292 * @orig between @offset and @offset + @size - 1.
293 * @offset: start of the section in @orig to be referenced.
294 * @size: size of the region.
296 void memory_region_init_alias(MemoryRegion *mr,
297 const char *name,
298 MemoryRegion *orig,
299 target_phys_addr_t offset,
300 uint64_t size);
303 * memory_region_init_rom_device: Initialize a ROM memory region. Writes are
304 * handled via callbacks.
306 * @mr: the #MemoryRegion to be initialized.
307 * @ops: callbacks for write access handling.
308 * @name: the name of the region.
309 * @size: size of the region.
311 void memory_region_init_rom_device(MemoryRegion *mr,
312 const MemoryRegionOps *ops,
313 void *opaque,
314 const char *name,
315 uint64_t size);
318 * memory_region_init_reservation: Initialize a memory region that reserves
319 * I/O space.
321 * A reservation region primariy serves debugging purposes. It claims I/O
322 * space that is not supposed to be handled by QEMU itself. Any access via
323 * the memory API will cause an abort().
325 * @mr: the #MemoryRegion to be initialized
326 * @name: used for debugging; not visible to the user or ABI
327 * @size: size of the region.
329 void memory_region_init_reservation(MemoryRegion *mr,
330 const char *name,
331 uint64_t size);
333 * memory_region_destroy: Destroy a memory region and reclaim all resources.
335 * @mr: the region to be destroyed. May not currently be a subregion
336 * (see memory_region_add_subregion()) or referenced in an alias
337 * (see memory_region_init_alias()).
339 void memory_region_destroy(MemoryRegion *mr);
342 * memory_region_size: get a memory region's size.
344 * @mr: the memory region being queried.
346 uint64_t memory_region_size(MemoryRegion *mr);
349 * memory_region_is_ram: check whether a memory region is random access
351 * Returns %true is a memory region is random access.
353 * @mr: the memory region being queried
355 bool memory_region_is_ram(MemoryRegion *mr);
358 * memory_region_is_romd: check whether a memory region is ROMD
360 * Returns %true is a memory region is ROMD and currently set to allow
361 * direct reads.
363 * @mr: the memory region being queried
365 static inline bool memory_region_is_romd(MemoryRegion *mr)
367 return mr->rom_device && mr->readable;
371 * memory_region_name: get a memory region's name
373 * Returns the string that was used to initialize the memory region.
375 * @mr: the memory region being queried
377 const char *memory_region_name(MemoryRegion *mr);
380 * memory_region_is_logging: return whether a memory region is logging writes
382 * Returns %true if the memory region is logging writes
384 * @mr: the memory region being queried
386 bool memory_region_is_logging(MemoryRegion *mr);
389 * memory_region_is_rom: check whether a memory region is ROM
391 * Returns %true is a memory region is read-only memory.
393 * @mr: the memory region being queried
395 bool memory_region_is_rom(MemoryRegion *mr);
398 * memory_region_get_ram_ptr: Get a pointer into a RAM memory region.
400 * Returns a host pointer to a RAM memory region (created with
401 * memory_region_init_ram() or memory_region_init_ram_ptr()). Use with
402 * care.
404 * @mr: the memory region being queried.
406 void *memory_region_get_ram_ptr(MemoryRegion *mr);
409 * memory_region_set_log: Turn dirty logging on or off for a region.
411 * Turns dirty logging on or off for a specified client (display, migration).
412 * Only meaningful for RAM regions.
414 * @mr: the memory region being updated.
415 * @log: whether dirty logging is to be enabled or disabled.
416 * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or
417 * %DIRTY_MEMORY_VGA.
419 void memory_region_set_log(MemoryRegion *mr, bool log, unsigned client);
422 * memory_region_get_dirty: Check whether a range of bytes is dirty
423 * for a specified client.
425 * Checks whether a range of bytes has been written to since the last
426 * call to memory_region_reset_dirty() with the same @client. Dirty logging
427 * must be enabled.
429 * @mr: the memory region being queried.
430 * @addr: the address (relative to the start of the region) being queried.
431 * @size: the size of the range being queried.
432 * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or
433 * %DIRTY_MEMORY_VGA.
435 bool memory_region_get_dirty(MemoryRegion *mr, target_phys_addr_t addr,
436 target_phys_addr_t size, unsigned client);
439 * memory_region_set_dirty: Mark a range of bytes as dirty in a memory region.
441 * Marks a range of bytes as dirty, after it has been dirtied outside
442 * guest code.
444 * @mr: the memory region being dirtied.
445 * @addr: the address (relative to the start of the region) being dirtied.
446 * @size: size of the range being dirtied.
448 void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr,
449 target_phys_addr_t size);
452 * memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap with
453 * any external TLBs (e.g. kvm)
455 * Flushes dirty information from accelerators such as kvm and vhost-net
456 * and makes it available to users of the memory API.
458 * @mr: the region being flushed.
460 void memory_region_sync_dirty_bitmap(MemoryRegion *mr);
463 * memory_region_reset_dirty: Mark a range of pages as clean, for a specified
464 * client.
466 * Marks a range of pages as no longer dirty.
468 * @mr: the region being updated.
469 * @addr: the start of the subrange being cleaned.
470 * @size: the size of the subrange being cleaned.
471 * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or
472 * %DIRTY_MEMORY_VGA.
474 void memory_region_reset_dirty(MemoryRegion *mr, target_phys_addr_t addr,
475 target_phys_addr_t size, unsigned client);
478 * memory_region_set_readonly: Turn a memory region read-only (or read-write)
480 * Allows a memory region to be marked as read-only (turning it into a ROM).
481 * only useful on RAM regions.
483 * @mr: the region being updated.
484 * @readonly: whether rhe region is to be ROM or RAM.
486 void memory_region_set_readonly(MemoryRegion *mr, bool readonly);
489 * memory_region_rom_device_set_readable: enable/disable ROM readability
491 * Allows a ROM device (initialized with memory_region_init_rom_device() to
492 * to be marked as readable (default) or not readable. When it is readable,
493 * the device is mapped to guest memory. When not readable, reads are
494 * forwarded to the #MemoryRegion.read function.
496 * @mr: the memory region to be updated
497 * @readable: whether reads are satisified directly (%true) or via callbacks
498 * (%false)
500 void memory_region_rom_device_set_readable(MemoryRegion *mr, bool readable);
503 * memory_region_set_coalescing: Enable memory coalescing for the region.
505 * Enabled writes to a region to be queued for later processing. MMIO ->write
506 * callbacks may be delayed until a non-coalesced MMIO is issued.
507 * Only useful for IO regions. Roughly similar to write-combining hardware.
509 * @mr: the memory region to be write coalesced
511 void memory_region_set_coalescing(MemoryRegion *mr);
514 * memory_region_add_coalescing: Enable memory coalescing for a sub-range of
515 * a region.
517 * Like memory_region_set_coalescing(), but works on a sub-range of a region.
518 * Multiple calls can be issued coalesced disjoint ranges.
520 * @mr: the memory region to be updated.
521 * @offset: the start of the range within the region to be coalesced.
522 * @size: the size of the subrange to be coalesced.
524 void memory_region_add_coalescing(MemoryRegion *mr,
525 target_phys_addr_t offset,
526 uint64_t size);
529 * memory_region_clear_coalescing: Disable MMIO coalescing for the region.
531 * Disables any coalescing caused by memory_region_set_coalescing() or
532 * memory_region_add_coalescing(). Roughly equivalent to uncacheble memory
533 * hardware.
535 * @mr: the memory region to be updated.
537 void memory_region_clear_coalescing(MemoryRegion *mr);
540 * memory_region_set_flush_coalesced: Enforce memory coalescing flush before
541 * accesses.
543 * Ensure that pending coalesced MMIO request are flushed before the memory
544 * region is accessed. This property is automatically enabled for all regions
545 * passed to memory_region_set_coalescing() and memory_region_add_coalescing().
547 * @mr: the memory region to be updated.
549 void memory_region_set_flush_coalesced(MemoryRegion *mr);
552 * memory_region_clear_flush_coalesced: Disable memory coalescing flush before
553 * accesses.
555 * Clear the automatic coalesced MMIO flushing enabled via
556 * memory_region_set_flush_coalesced. Note that this service has no effect on
557 * memory regions that have MMIO coalescing enabled for themselves. For them,
558 * automatic flushing will stop once coalescing is disabled.
560 * @mr: the memory region to be updated.
562 void memory_region_clear_flush_coalesced(MemoryRegion *mr);
565 * memory_region_add_eventfd: Request an eventfd to be triggered when a word
566 * is written to a location.
568 * Marks a word in an IO region (initialized with memory_region_init_io())
569 * as a trigger for an eventfd event. The I/O callback will not be called.
570 * The caller must be prepared to handle failure (that is, take the required
571 * action if the callback _is_ called).
573 * @mr: the memory region being updated.
574 * @addr: the address within @mr that is to be monitored
575 * @size: the size of the access to trigger the eventfd
576 * @match_data: whether to match against @data, instead of just @addr
577 * @data: the data to match against the guest write
578 * @fd: the eventfd to be triggered when @addr, @size, and @data all match.
580 void memory_region_add_eventfd(MemoryRegion *mr,
581 target_phys_addr_t addr,
582 unsigned size,
583 bool match_data,
584 uint64_t data,
585 EventNotifier *e);
588 * memory_region_del_eventfd: Cancel an eventfd.
590 * Cancels an eventfd trigger requested by a previous
591 * memory_region_add_eventfd() call.
593 * @mr: the memory region being updated.
594 * @addr: the address within @mr that is to be monitored
595 * @size: the size of the access to trigger the eventfd
596 * @match_data: whether to match against @data, instead of just @addr
597 * @data: the data to match against the guest write
598 * @fd: the eventfd to be triggered when @addr, @size, and @data all match.
600 void memory_region_del_eventfd(MemoryRegion *mr,
601 target_phys_addr_t addr,
602 unsigned size,
603 bool match_data,
604 uint64_t data,
605 EventNotifier *e);
608 * memory_region_add_subregion: Add a subregion to a container.
610 * Adds a subregion at @offset. The subregion may not overlap with other
611 * subregions (except for those explicitly marked as overlapping). A region
612 * may only be added once as a subregion (unless removed with
613 * memory_region_del_subregion()); use memory_region_init_alias() if you
614 * want a region to be a subregion in multiple locations.
616 * @mr: the region to contain the new subregion; must be a container
617 * initialized with memory_region_init().
618 * @offset: the offset relative to @mr where @subregion is added.
619 * @subregion: the subregion to be added.
621 void memory_region_add_subregion(MemoryRegion *mr,
622 target_phys_addr_t offset,
623 MemoryRegion *subregion);
625 * memory_region_add_subregion_overlap: Add a subregion to a container
626 * with overlap.
628 * Adds a subregion at @offset. The subregion may overlap with other
629 * subregions. Conflicts are resolved by having a higher @priority hide a
630 * lower @priority. Subregions without priority are taken as @priority 0.
631 * A region may only be added once as a subregion (unless removed with
632 * memory_region_del_subregion()); use memory_region_init_alias() if you
633 * want a region to be a subregion in multiple locations.
635 * @mr: the region to contain the new subregion; must be a container
636 * initialized with memory_region_init().
637 * @offset: the offset relative to @mr where @subregion is added.
638 * @subregion: the subregion to be added.
639 * @priority: used for resolving overlaps; highest priority wins.
641 void memory_region_add_subregion_overlap(MemoryRegion *mr,
642 target_phys_addr_t offset,
643 MemoryRegion *subregion,
644 unsigned priority);
647 * memory_region_get_ram_addr: Get the ram address associated with a memory
648 * region
650 * DO NOT USE THIS FUNCTION. This is a temporary workaround while the Xen
651 * code is being reworked.
653 ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr);
656 * memory_region_del_subregion: Remove a subregion.
658 * Removes a subregion from its container.
660 * @mr: the container to be updated.
661 * @subregion: the region being removed; must be a current subregion of @mr.
663 void memory_region_del_subregion(MemoryRegion *mr,
664 MemoryRegion *subregion);
667 * memory_region_set_enabled: dynamically enable or disable a region
669 * Enables or disables a memory region. A disabled memory region
670 * ignores all accesses to itself and its subregions. It does not
671 * obscure sibling subregions with lower priority - it simply behaves as
672 * if it was removed from the hierarchy.
674 * Regions default to being enabled.
676 * @mr: the region to be updated
677 * @enabled: whether to enable or disable the region
679 void memory_region_set_enabled(MemoryRegion *mr, bool enabled);
682 * memory_region_set_address: dynamically update the address of a region
684 * Dynamically updates the address of a region, relative to its parent.
685 * May be used on regions are currently part of a memory hierarchy.
687 * @mr: the region to be updated
688 * @addr: new address, relative to parent region
690 void memory_region_set_address(MemoryRegion *mr, target_phys_addr_t addr);
693 * memory_region_set_alias_offset: dynamically update a memory alias's offset
695 * Dynamically updates the offset into the target region that an alias points
696 * to, as if the fourth argument to memory_region_init_alias() has changed.
698 * @mr: the #MemoryRegion to be updated; should be an alias.
699 * @offset: the new offset into the target memory region
701 void memory_region_set_alias_offset(MemoryRegion *mr,
702 target_phys_addr_t offset);
705 * memory_region_find: locate a MemoryRegion in an address space
707 * Locates the first #MemoryRegion within an address space given by
708 * @address_space that overlaps the range given by @addr and @size.
710 * Returns a #MemoryRegionSection that describes a contiguous overlap.
711 * It will have the following characteristics:
712 * .@offset_within_address_space >= @addr
713 * .@offset_within_address_space + .@size <= @addr + @size
714 * .@size = 0 iff no overlap was found
715 * .@mr is non-%NULL iff an overlap was found
717 * @address_space: a top-level (i.e. parentless) region that contains
718 * the region to be found
719 * @addr: start of the area within @address_space to be searched
720 * @size: size of the area to be searched
722 MemoryRegionSection memory_region_find(MemoryRegion *address_space,
723 target_phys_addr_t addr, uint64_t size);
726 * memory_region_section_addr: get offset within MemoryRegionSection
728 * Returns offset within MemoryRegionSection
730 * @section: the memory region section being queried
731 * @addr: address in address space
733 static inline target_phys_addr_t
734 memory_region_section_addr(MemoryRegionSection *section,
735 target_phys_addr_t addr)
737 addr -= section->offset_within_address_space;
738 addr += section->offset_within_region;
739 return addr;
743 * memory_global_sync_dirty_bitmap: synchronize the dirty log for all memory
745 * Synchronizes the dirty page log for an entire address space.
746 * @address_space: a top-level (i.e. parentless) region that contains the
747 * memory being synchronized
749 void memory_global_sync_dirty_bitmap(MemoryRegion *address_space);
752 * memory_region_transaction_begin: Start a transaction.
754 * During a transaction, changes will be accumulated and made visible
755 * only when the transaction ends (is committed).
757 void memory_region_transaction_begin(void);
760 * memory_region_transaction_commit: Commit a transaction and make changes
761 * visible to the guest.
763 void memory_region_transaction_commit(void);
766 * memory_listener_register: register callbacks to be called when memory
767 * sections are mapped or unmapped into an address
768 * space
770 * @listener: an object containing the callbacks to be called
771 * @filter: if non-%NULL, only regions in this address space will be observed
773 void memory_listener_register(MemoryListener *listener, MemoryRegion *filter);
776 * memory_listener_unregister: undo the effect of memory_listener_register()
778 * @listener: an object containing the callbacks to be removed
780 void memory_listener_unregister(MemoryListener *listener);
783 * memory_global_dirty_log_start: begin dirty logging for all regions
785 void memory_global_dirty_log_start(void);
788 * memory_global_dirty_log_stop: end dirty logging for all regions
790 void memory_global_dirty_log_stop(void);
792 void mtree_info(fprintf_function mon_printf, void *f);
795 * address_space_init: initializes an address space
797 * @as: an uninitialized #AddressSpace
798 * @root: a #MemoryRegion that routes addesses for the address space
800 void address_space_init(AddressSpace *as, MemoryRegion *root);
802 #endif
804 #endif