aboutsummaryrefslogtreecommitdiff
path: root/include/exec/memory-internal.h
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2013-10-08 12:44:04 +0200
committerJuan Quintela <quintela@redhat.com>2014-01-13 14:04:54 +0100
commit52159192919469b424b54c167312e53d5a62d233 (patch)
treee66a6935d02a1707173a9ea0850e60cf11edb4b9 /include/exec/memory-internal.h
parent75218e7f2b7f052c6f44489afaf45b3ea4369f45 (diff)
memory: cpu_physical_memory_mask_dirty_range() always clears a single flag
Document it Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Diffstat (limited to 'include/exec/memory-internal.h')
-rw-r--r--include/exec/memory-internal.h40
1 files changed, 18 insertions, 22 deletions
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
index 681d63b7ba..b58010f1d0 100644
--- a/include/exec/memory-internal.h
+++ b/include/exec/memory-internal.h
@@ -40,29 +40,25 @@ void *qemu_get_ram_ptr(ram_addr_t addr);
void qemu_ram_free(ram_addr_t addr);
void qemu_ram_free_from_ptr(ram_addr_t addr);
-#define VGA_DIRTY_FLAG 0x01
-#define CODE_DIRTY_FLAG 0x02
-#define MIGRATION_DIRTY_FLAG 0x08
-
static inline bool cpu_physical_memory_get_dirty_flag(ram_addr_t addr,
- int dirty_flag)
+ unsigned client)
{
- return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] & dirty_flag;
+ return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] & (1 << client);
}
/* read dirty bit (return 0 or 1) */
static inline bool cpu_physical_memory_is_dirty(ram_addr_t addr)
{
- bool vga = cpu_physical_memory_get_dirty_flag(addr, VGA_DIRTY_FLAG);
- bool code = cpu_physical_memory_get_dirty_flag(addr, CODE_DIRTY_FLAG);
+ bool vga = cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_VGA);
+ bool code = cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_CODE);
bool migration =
- cpu_physical_memory_get_dirty_flag(addr, MIGRATION_DIRTY_FLAG);
+ cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_MIGRATION);
return vga && code && migration;
}
static inline int cpu_physical_memory_get_dirty(ram_addr_t start,
ram_addr_t length,
- int dirty_flag)
+ unsigned client)
{
int ret = 0;
ram_addr_t addr, end;
@@ -70,28 +66,28 @@ static inline int cpu_physical_memory_get_dirty(ram_addr_t start,
end = TARGET_PAGE_ALIGN(start + length);
start &= TARGET_PAGE_MASK;
for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
- ret |= cpu_physical_memory_get_dirty_flag(addr, dirty_flag);
+ ret |= cpu_physical_memory_get_dirty_flag(addr, client);
}
return ret;
}
static inline void cpu_physical_memory_set_dirty_flag(ram_addr_t addr,
- int dirty_flag)
+ unsigned client)
{
- ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] |= dirty_flag;
+ ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] |= (1 << client);
}
static inline void cpu_physical_memory_set_dirty(ram_addr_t addr)
{
- cpu_physical_memory_set_dirty_flag(addr, MIGRATION_DIRTY_FLAG);
- cpu_physical_memory_set_dirty_flag(addr, VGA_DIRTY_FLAG);
- cpu_physical_memory_set_dirty_flag(addr, CODE_DIRTY_FLAG);
+ cpu_physical_memory_set_dirty_flag(addr, DIRTY_MEMORY_MIGRATION);
+ cpu_physical_memory_set_dirty_flag(addr, DIRTY_MEMORY_VGA);
+ cpu_physical_memory_set_dirty_flag(addr, DIRTY_MEMORY_CODE);
}
-static inline int cpu_physical_memory_clear_dirty_flags(ram_addr_t addr,
- int dirty_flags)
+static inline int cpu_physical_memory_clear_dirty_flag(ram_addr_t addr,
+ unsigned client)
{
- int mask = ~dirty_flags;
+ int mask = ~(1 << client);
return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] &= mask;
}
@@ -111,19 +107,19 @@ static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start,
static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start,
ram_addr_t length,
- int dirty_flags)
+ unsigned client)
{
ram_addr_t addr, end;
end = TARGET_PAGE_ALIGN(start + length);
start &= TARGET_PAGE_MASK;
for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
- cpu_physical_memory_clear_dirty_flags(addr, dirty_flags);
+ cpu_physical_memory_clear_dirty_flag(addr, client);
}
}
void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end,
- int dirty_flags);
+ unsigned client);
#endif