]> git.proxmox.com Git - qemu.git/blob - memory.h
rtl8139: remove unused marco
[qemu.git] / memory.h
1 /*
2 * Physical memory management API
3 *
4 * Copyright 2011 Red Hat, Inc. and/or its affiliates
5 *
6 * Authors:
7 * Avi Kivity <avi@redhat.com>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
11 *
12 */
13
14 #ifndef MEMORY_H
15 #define MEMORY_H
16
17 #ifndef CONFIG_USER_ONLY
18
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"
28
29 typedef struct MemoryRegionOps MemoryRegionOps;
30 typedef struct MemoryRegion MemoryRegion;
31 typedef struct MemoryRegionPortio MemoryRegionPortio;
32 typedef struct MemoryRegionMmio MemoryRegionMmio;
33
34 /* Must match *_DIRTY_FLAGS in cpu-all.h. To be replaced with dynamic
35 * registration.
36 */
37 #define DIRTY_MEMORY_VGA 0
38 #define DIRTY_MEMORY_CODE 1
39 #define DIRTY_MEMORY_MIGRATION 3
40
41 struct MemoryRegionMmio {
42 CPUReadMemoryFunc *read[3];
43 CPUWriteMemoryFunc *write[3];
44 };
45
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;
52 };
53
54 /*
55 * Memory region callbacks
56 */
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);
69
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.
75 */
76 unsigned min_access_size;
77 unsigned max_access_size;
78 /* If true, unaligned accesses are supported. Otherwise unaligned
79 * accesses throw machine checks.
80 */
81 bool unaligned;
82 /*
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).
86 */
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.
94 */
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.
98 */
99 unsigned max_access_size;
100 /* If true, unaligned accesses are supported. Otherwise all accesses
101 * are converted to (possibly multiple) naturally aligned accesses.
102 */
103 bool unaligned;
104 } impl;
105
106 /* If .read and .write are not present, old_portio may be used for
107 * backwards compatibility with old portio registration
108 */
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
112 */
113 const MemoryRegionMmio old_mmio;
114 };
115
116 typedef struct CoalescedMemoryRange CoalescedMemoryRange;
117 typedef struct MemoryRegionIoeventfd MemoryRegionIoeventfd;
118
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 MemoryRegion *alias;
137 target_phys_addr_t alias_offset;
138 unsigned priority;
139 bool may_overlap;
140 QTAILQ_HEAD(subregions, MemoryRegion) subregions;
141 QTAILQ_ENTRY(MemoryRegion) subregions_link;
142 QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced;
143 const char *name;
144 uint8_t dirty_log_mask;
145 unsigned ioeventfd_nb;
146 MemoryRegionIoeventfd *ioeventfds;
147 };
148
149 struct MemoryRegionPortio {
150 uint32_t offset;
151 uint32_t len;
152 unsigned size;
153 IOPortReadFunc *read;
154 IOPortWriteFunc *write;
155 };
156
157 #define PORTIO_END_OF_LIST() { }
158
159 typedef struct MemoryRegionSection MemoryRegionSection;
160
161 /**
162 * MemoryRegionSection: describes a fragment of a #MemoryRegion
163 *
164 * @mr: the region, or %NULL if empty
165 * @address_space: the address space the region is mapped in
166 * @offset_within_region: the beginning of the section, relative to @mr's start
167 * @size: the size of the section; will not exceed @mr's boundaries
168 * @offset_within_address_space: the address of the first byte of the section
169 * relative to the region's address space
170 * @readonly: writes to this section are ignored
171 */
172 struct MemoryRegionSection {
173 MemoryRegion *mr;
174 MemoryRegion *address_space;
175 target_phys_addr_t offset_within_region;
176 uint64_t size;
177 target_phys_addr_t offset_within_address_space;
178 bool readonly;
179 };
180
181 typedef struct MemoryListener MemoryListener;
182
183 /**
184 * MemoryListener: callbacks structure for updates to the physical memory map
185 *
186 * Allows a component to adjust to changes in the guest-visible memory map.
187 * Use with memory_listener_register() and memory_listener_unregister().
188 */
189 struct MemoryListener {
190 void (*begin)(MemoryListener *listener);
191 void (*commit)(MemoryListener *listener);
192 void (*region_add)(MemoryListener *listener, MemoryRegionSection *section);
193 void (*region_del)(MemoryListener *listener, MemoryRegionSection *section);
194 void (*region_nop)(MemoryListener *listener, MemoryRegionSection *section);
195 void (*log_start)(MemoryListener *listener, MemoryRegionSection *section);
196 void (*log_stop)(MemoryListener *listener, MemoryRegionSection *section);
197 void (*log_sync)(MemoryListener *listener, MemoryRegionSection *section);
198 void (*log_global_start)(MemoryListener *listener);
199 void (*log_global_stop)(MemoryListener *listener);
200 void (*eventfd_add)(MemoryListener *listener, MemoryRegionSection *section,
201 bool match_data, uint64_t data, int fd);
202 void (*eventfd_del)(MemoryListener *listener, MemoryRegionSection *section,
203 bool match_data, uint64_t data, int fd);
204 /* Lower = earlier (during add), later (during del) */
205 unsigned priority;
206 MemoryRegion *address_space_filter;
207 QTAILQ_ENTRY(MemoryListener) link;
208 };
209
210 /**
211 * memory_region_init: Initialize a memory region
212 *
213 * The region typically acts as a container for other memory regions. Use
214 * memory_region_add_subregion() to add subregions.
215 *
216 * @mr: the #MemoryRegion to be initialized
217 * @name: used for debugging; not visible to the user or ABI
218 * @size: size of the region; any subregions beyond this size will be clipped
219 */
220 void memory_region_init(MemoryRegion *mr,
221 const char *name,
222 uint64_t size);
223 /**
224 * memory_region_init_io: Initialize an I/O memory region.
225 *
226 * Accesses into the region will cause the callbacks in @ops to be called.
227 * if @size is nonzero, subregions will be clipped to @size.
228 *
229 * @mr: the #MemoryRegion to be initialized.
230 * @ops: a structure containing read and write callbacks to be used when
231 * I/O is performed on the region.
232 * @opaque: passed to to the read and write callbacks of the @ops structure.
233 * @name: used for debugging; not visible to the user or ABI
234 * @size: size of the region.
235 */
236 void memory_region_init_io(MemoryRegion *mr,
237 const MemoryRegionOps *ops,
238 void *opaque,
239 const char *name,
240 uint64_t size);
241
242 /**
243 * memory_region_init_ram: Initialize RAM memory region. Accesses into the
244 * region will modify memory directly.
245 *
246 * @mr: the #MemoryRegion to be initialized.
247 * @name: the name of the region.
248 * @size: size of the region.
249 */
250 void memory_region_init_ram(MemoryRegion *mr,
251 const char *name,
252 uint64_t size);
253
254 /**
255 * memory_region_init_ram: Initialize RAM memory region from a user-provided.
256 * pointer. Accesses into the region will modify
257 * memory directly.
258 *
259 * @mr: the #MemoryRegion to be initialized.
260 * @name: the name of the region.
261 * @size: size of the region.
262 * @ptr: memory to be mapped; must contain at least @size bytes.
263 */
264 void memory_region_init_ram_ptr(MemoryRegion *mr,
265 const char *name,
266 uint64_t size,
267 void *ptr);
268
269 /**
270 * memory_region_init_alias: Initialize a memory region that aliases all or a
271 * part of another memory region.
272 *
273 * @mr: the #MemoryRegion to be initialized.
274 * @name: used for debugging; not visible to the user or ABI
275 * @orig: the region to be referenced; @mr will be equivalent to
276 * @orig between @offset and @offset + @size - 1.
277 * @offset: start of the section in @orig to be referenced.
278 * @size: size of the region.
279 */
280 void memory_region_init_alias(MemoryRegion *mr,
281 const char *name,
282 MemoryRegion *orig,
283 target_phys_addr_t offset,
284 uint64_t size);
285
286 /**
287 * memory_region_init_rom_device: Initialize a ROM memory region. Writes are
288 * handled via callbacks.
289 *
290 * @mr: the #MemoryRegion to be initialized.
291 * @ops: callbacks for write access handling.
292 * @name: the name of the region.
293 * @size: size of the region.
294 */
295 void memory_region_init_rom_device(MemoryRegion *mr,
296 const MemoryRegionOps *ops,
297 void *opaque,
298 const char *name,
299 uint64_t size);
300
301 /**
302 * memory_region_init_reservation: Initialize a memory region that reserves
303 * I/O space.
304 *
305 * A reservation region primariy serves debugging purposes. It claims I/O
306 * space that is not supposed to be handled by QEMU itself. Any access via
307 * the memory API will cause an abort().
308 *
309 * @mr: the #MemoryRegion to be initialized
310 * @name: used for debugging; not visible to the user or ABI
311 * @size: size of the region.
312 */
313 void memory_region_init_reservation(MemoryRegion *mr,
314 const char *name,
315 uint64_t size);
316 /**
317 * memory_region_destroy: Destroy a memory region and reclaim all resources.
318 *
319 * @mr: the region to be destroyed. May not currently be a subregion
320 * (see memory_region_add_subregion()) or referenced in an alias
321 * (see memory_region_init_alias()).
322 */
323 void memory_region_destroy(MemoryRegion *mr);
324
325 /**
326 * memory_region_size: get a memory region's size.
327 *
328 * @mr: the memory region being queried.
329 */
330 uint64_t memory_region_size(MemoryRegion *mr);
331
332 /**
333 * memory_region_is_ram: check whether a memory region is random access
334 *
335 * Returns %true is a memory region is random access.
336 *
337 * @mr: the memory region being queried
338 */
339 bool memory_region_is_ram(MemoryRegion *mr);
340
341 /**
342 * memory_region_name: get a memory region's name
343 *
344 * Returns the string that was used to initialize the memory region.
345 *
346 * @mr: the memory region being queried
347 */
348 const char *memory_region_name(MemoryRegion *mr);
349
350 /**
351 * memory_region_is_logging: return whether a memory region is logging writes
352 *
353 * Returns %true if the memory region is logging writes
354 *
355 * @mr: the memory region being queried
356 */
357 bool memory_region_is_logging(MemoryRegion *mr);
358
359 /**
360 * memory_region_is_rom: check whether a memory region is ROM
361 *
362 * Returns %true is a memory region is read-only memory.
363 *
364 * @mr: the memory region being queried
365 */
366 bool memory_region_is_rom(MemoryRegion *mr);
367
368 /**
369 * memory_region_get_ram_ptr: Get a pointer into a RAM memory region.
370 *
371 * Returns a host pointer to a RAM memory region (created with
372 * memory_region_init_ram() or memory_region_init_ram_ptr()). Use with
373 * care.
374 *
375 * @mr: the memory region being queried.
376 */
377 void *memory_region_get_ram_ptr(MemoryRegion *mr);
378
379 /**
380 * memory_region_set_log: Turn dirty logging on or off for a region.
381 *
382 * Turns dirty logging on or off for a specified client (display, migration).
383 * Only meaningful for RAM regions.
384 *
385 * @mr: the memory region being updated.
386 * @log: whether dirty logging is to be enabled or disabled.
387 * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or
388 * %DIRTY_MEMORY_VGA.
389 */
390 void memory_region_set_log(MemoryRegion *mr, bool log, unsigned client);
391
392 /**
393 * memory_region_get_dirty: Check whether a range of bytes is dirty
394 * for a specified client.
395 *
396 * Checks whether a range of bytes has been written to since the last
397 * call to memory_region_reset_dirty() with the same @client. Dirty logging
398 * must be enabled.
399 *
400 * @mr: the memory region being queried.
401 * @addr: the address (relative to the start of the region) being queried.
402 * @size: the size of the range being queried.
403 * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or
404 * %DIRTY_MEMORY_VGA.
405 */
406 bool memory_region_get_dirty(MemoryRegion *mr, target_phys_addr_t addr,
407 target_phys_addr_t size, unsigned client);
408
409 /**
410 * memory_region_set_dirty: Mark a range of bytes as dirty in a memory region.
411 *
412 * Marks a range of bytes as dirty, after it has been dirtied outside
413 * guest code.
414 *
415 * @mr: the memory region being dirtied.
416 * @addr: the address (relative to the start of the region) being dirtied.
417 * @size: size of the range being dirtied.
418 */
419 void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr,
420 target_phys_addr_t size);
421
422 /**
423 * memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap with
424 * any external TLBs (e.g. kvm)
425 *
426 * Flushes dirty information from accelerators such as kvm and vhost-net
427 * and makes it available to users of the memory API.
428 *
429 * @mr: the region being flushed.
430 */
431 void memory_region_sync_dirty_bitmap(MemoryRegion *mr);
432
433 /**
434 * memory_region_reset_dirty: Mark a range of pages as clean, for a specified
435 * client.
436 *
437 * Marks a range of pages as no longer dirty.
438 *
439 * @mr: the region being updated.
440 * @addr: the start of the subrange being cleaned.
441 * @size: the size of the subrange being cleaned.
442 * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or
443 * %DIRTY_MEMORY_VGA.
444 */
445 void memory_region_reset_dirty(MemoryRegion *mr, target_phys_addr_t addr,
446 target_phys_addr_t size, unsigned client);
447
448 /**
449 * memory_region_set_readonly: Turn a memory region read-only (or read-write)
450 *
451 * Allows a memory region to be marked as read-only (turning it into a ROM).
452 * only useful on RAM regions.
453 *
454 * @mr: the region being updated.
455 * @readonly: whether rhe region is to be ROM or RAM.
456 */
457 void memory_region_set_readonly(MemoryRegion *mr, bool readonly);
458
459 /**
460 * memory_region_rom_device_set_readable: enable/disable ROM readability
461 *
462 * Allows a ROM device (initialized with memory_region_init_rom_device() to
463 * to be marked as readable (default) or not readable. When it is readable,
464 * the device is mapped to guest memory. When not readable, reads are
465 * forwarded to the #MemoryRegion.read function.
466 *
467 * @mr: the memory region to be updated
468 * @readable: whether reads are satisified directly (%true) or via callbacks
469 * (%false)
470 */
471 void memory_region_rom_device_set_readable(MemoryRegion *mr, bool readable);
472
473 /**
474 * memory_region_set_coalescing: Enable memory coalescing for the region.
475 *
476 * Enabled writes to a region to be queued for later processing. MMIO ->write
477 * callbacks may be delayed until a non-coalesced MMIO is issued.
478 * Only useful for IO regions. Roughly similar to write-combining hardware.
479 *
480 * @mr: the memory region to be write coalesced
481 */
482 void memory_region_set_coalescing(MemoryRegion *mr);
483
484 /**
485 * memory_region_add_coalescing: Enable memory coalescing for a sub-range of
486 * a region.
487 *
488 * Like memory_region_set_coalescing(), but works on a sub-range of a region.
489 * Multiple calls can be issued coalesced disjoint ranges.
490 *
491 * @mr: the memory region to be updated.
492 * @offset: the start of the range within the region to be coalesced.
493 * @size: the size of the subrange to be coalesced.
494 */
495 void memory_region_add_coalescing(MemoryRegion *mr,
496 target_phys_addr_t offset,
497 uint64_t size);
498
499 /**
500 * memory_region_clear_coalescing: Disable MMIO coalescing for the region.
501 *
502 * Disables any coalescing caused by memory_region_set_coalescing() or
503 * memory_region_add_coalescing(). Roughly equivalent to uncacheble memory
504 * hardware.
505 *
506 * @mr: the memory region to be updated.
507 */
508 void memory_region_clear_coalescing(MemoryRegion *mr);
509
510 /**
511 * memory_region_add_eventfd: Request an eventfd to be triggered when a word
512 * is written to a location.
513 *
514 * Marks a word in an IO region (initialized with memory_region_init_io())
515 * as a trigger for an eventfd event. The I/O callback will not be called.
516 * The caller must be prepared to handle failure (that is, take the required
517 * action if the callback _is_ called).
518 *
519 * @mr: the memory region being updated.
520 * @addr: the address within @mr that is to be monitored
521 * @size: the size of the access to trigger the eventfd
522 * @match_data: whether to match against @data, instead of just @addr
523 * @data: the data to match against the guest write
524 * @fd: the eventfd to be triggered when @addr, @size, and @data all match.
525 **/
526 void memory_region_add_eventfd(MemoryRegion *mr,
527 target_phys_addr_t addr,
528 unsigned size,
529 bool match_data,
530 uint64_t data,
531 int fd);
532
533 /**
534 * memory_region_del_eventfd: Cancel an eventfd.
535 *
536 * Cancels an eventfd trigger requested by a previous
537 * memory_region_add_eventfd() call.
538 *
539 * @mr: the memory region being updated.
540 * @addr: the address within @mr that is to be monitored
541 * @size: the size of the access to trigger the eventfd
542 * @match_data: whether to match against @data, instead of just @addr
543 * @data: the data to match against the guest write
544 * @fd: the eventfd to be triggered when @addr, @size, and @data all match.
545 */
546 void memory_region_del_eventfd(MemoryRegion *mr,
547 target_phys_addr_t addr,
548 unsigned size,
549 bool match_data,
550 uint64_t data,
551 int fd);
552 /**
553 * memory_region_add_subregion: Add a subregion to a container.
554 *
555 * Adds a subregion at @offset. The subregion may not overlap with other
556 * subregions (except for those explicitly marked as overlapping). A region
557 * may only be added once as a subregion (unless removed with
558 * memory_region_del_subregion()); use memory_region_init_alias() if you
559 * want a region to be a subregion in multiple locations.
560 *
561 * @mr: the region to contain the new subregion; must be a container
562 * initialized with memory_region_init().
563 * @offset: the offset relative to @mr where @subregion is added.
564 * @subregion: the subregion to be added.
565 */
566 void memory_region_add_subregion(MemoryRegion *mr,
567 target_phys_addr_t offset,
568 MemoryRegion *subregion);
569 /**
570 * memory_region_add_subregion: Add a subregion to a container, with overlap.
571 *
572 * Adds a subregion at @offset. The subregion may overlap with other
573 * subregions. Conflicts are resolved by having a higher @priority hide a
574 * lower @priority. Subregions without priority are taken as @priority 0.
575 * A region may only be added once as a subregion (unless removed with
576 * memory_region_del_subregion()); use memory_region_init_alias() if you
577 * want a region to be a subregion in multiple locations.
578 *
579 * @mr: the region to contain the new subregion; must be a container
580 * initialized with memory_region_init().
581 * @offset: the offset relative to @mr where @subregion is added.
582 * @subregion: the subregion to be added.
583 * @priority: used for resolving overlaps; highest priority wins.
584 */
585 void memory_region_add_subregion_overlap(MemoryRegion *mr,
586 target_phys_addr_t offset,
587 MemoryRegion *subregion,
588 unsigned priority);
589
590 /**
591 * memory_region_get_ram_addr: Get the ram address associated with a memory
592 * region
593 *
594 * DO NOT USE THIS FUNCTION. This is a temporary workaround while the Xen
595 * code is being reworked.
596 */
597 ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr);
598
599 /**
600 * memory_region_del_subregion: Remove a subregion.
601 *
602 * Removes a subregion from its container.
603 *
604 * @mr: the container to be updated.
605 * @subregion: the region being removed; must be a current subregion of @mr.
606 */
607 void memory_region_del_subregion(MemoryRegion *mr,
608 MemoryRegion *subregion);
609
610 /*
611 * memory_region_set_enabled: dynamically enable or disable a region
612 *
613 * Enables or disables a memory region. A disabled memory region
614 * ignores all accesses to itself and its subregions. It does not
615 * obscure sibling subregions with lower priority - it simply behaves as
616 * if it was removed from the hierarchy.
617 *
618 * Regions default to being enabled.
619 *
620 * @mr: the region to be updated
621 * @enabled: whether to enable or disable the region
622 */
623 void memory_region_set_enabled(MemoryRegion *mr, bool enabled);
624
625 /*
626 * memory_region_set_address: dynamically update the address of a region
627 *
628 * Dynamically updates the address of a region, relative to its parent.
629 * May be used on regions are currently part of a memory hierarchy.
630 *
631 * @mr: the region to be updated
632 * @addr: new address, relative to parent region
633 */
634 void memory_region_set_address(MemoryRegion *mr, target_phys_addr_t addr);
635
636 /*
637 * memory_region_set_alias_offset: dynamically update a memory alias's offset
638 *
639 * Dynamically updates the offset into the target region that an alias points
640 * to, as if the fourth argument to memory_region_init_alias() has changed.
641 *
642 * @mr: the #MemoryRegion to be updated; should be an alias.
643 * @offset: the new offset into the target memory region
644 */
645 void memory_region_set_alias_offset(MemoryRegion *mr,
646 target_phys_addr_t offset);
647
648 /**
649 * memory_region_find: locate a MemoryRegion in an address space
650 *
651 * Locates the first #MemoryRegion within an address space given by
652 * @address_space that overlaps the range given by @addr and @size.
653 *
654 * Returns a #MemoryRegionSection that describes a contiguous overlap.
655 * It will have the following characteristics:
656 * .@offset_within_address_space >= @addr
657 * .@offset_within_address_space + .@size <= @addr + @size
658 * .@size = 0 iff no overlap was found
659 * .@mr is non-%NULL iff an overlap was found
660 *
661 * @address_space: a top-level (i.e. parentless) region that contains
662 * the region to be found
663 * @addr: start of the area within @address_space to be searched
664 * @size: size of the area to be searched
665 */
666 MemoryRegionSection memory_region_find(MemoryRegion *address_space,
667 target_phys_addr_t addr, uint64_t size);
668
669
670 /**
671 * memory_global_sync_dirty_bitmap: synchronize the dirty log for all memory
672 *
673 * Synchronizes the dirty page log for an entire address space.
674 * @address_space: a top-level (i.e. parentless) region that contains the
675 * memory being synchronized
676 */
677 void memory_global_sync_dirty_bitmap(MemoryRegion *address_space);
678
679 /**
680 * memory_region_transaction_begin: Start a transaction.
681 *
682 * During a transaction, changes will be accumulated and made visible
683 * only when the transaction ends (is committed).
684 */
685 void memory_region_transaction_begin(void);
686
687 /**
688 * memory_region_transaction_commit: Commit a transaction and make changes
689 * visible to the guest.
690 */
691 void memory_region_transaction_commit(void);
692
693 /**
694 * memory_listener_register: register callbacks to be called when memory
695 * sections are mapped or unmapped into an address
696 * space
697 *
698 * @listener: an object containing the callbacks to be called
699 * @filter: if non-%NULL, only regions in this address space will be observed
700 */
701 void memory_listener_register(MemoryListener *listener, MemoryRegion *filter);
702
703 /**
704 * memory_listener_unregister: undo the effect of memory_listener_register()
705 *
706 * @listener: an object containing the callbacks to be removed
707 */
708 void memory_listener_unregister(MemoryListener *listener);
709
710 /**
711 * memory_global_dirty_log_start: begin dirty logging for all regions
712 */
713 void memory_global_dirty_log_start(void);
714
715 /**
716 * memory_global_dirty_log_stop: begin dirty logging for all regions
717 */
718 void memory_global_dirty_log_stop(void);
719
720 void mtree_info(fprintf_function mon_printf, void *f);
721
722 #endif
723
724 #endif