Revision 4ef4db86
b/memory.c | ||
---|---|---|
18 | 18 |
#include "kvm.h" |
19 | 19 |
#include <assert.h> |
20 | 20 |
|
21 |
unsigned memory_region_transaction_depth = 0; |
|
22 |
|
|
21 | 23 |
typedef struct AddrRange AddrRange; |
22 | 24 |
|
23 | 25 |
struct AddrRange { |
... | ... | |
626 | 628 |
|
627 | 629 |
static void memory_region_update_topology(void) |
628 | 630 |
{ |
631 |
if (memory_region_transaction_depth) { |
|
632 |
return; |
|
633 |
} |
|
634 |
|
|
629 | 635 |
if (address_space_memory.root) { |
630 | 636 |
address_space_update_topology(&address_space_memory); |
631 | 637 |
} |
... | ... | |
634 | 640 |
} |
635 | 641 |
} |
636 | 642 |
|
643 |
void memory_region_transaction_begin(void) |
|
644 |
{ |
|
645 |
++memory_region_transaction_depth; |
|
646 |
} |
|
647 |
|
|
648 |
void memory_region_transaction_commit(void) |
|
649 |
{ |
|
650 |
assert(memory_region_transaction_depth); |
|
651 |
--memory_region_transaction_depth; |
|
652 |
memory_region_update_topology(); |
|
653 |
} |
|
654 |
|
|
637 | 655 |
void memory_region_init(MemoryRegion *mr, |
638 | 656 |
const char *name, |
639 | 657 |
uint64_t size) |
b/memory.h | ||
---|---|---|
456 | 456 |
void memory_region_del_subregion(MemoryRegion *mr, |
457 | 457 |
MemoryRegion *subregion); |
458 | 458 |
|
459 |
/* Start a transaction; changes will be accumulated and made visible only |
|
460 |
* when the transaction ends. |
|
461 |
*/ |
|
462 |
void memory_region_transaction_begin(void); |
|
463 |
/* Commit a transaction and make changes visible to the guest. |
|
464 |
*/ |
|
465 |
void memory_region_transaction_commit(void); |
|
466 |
|
|
459 | 467 |
#endif |
460 | 468 |
|
461 | 469 |
#endif |
Also available in: Unified diff