@ -899,7 +899,7 @@ void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length)
}
}
}
}
void cpu_ physical_memory_dirty_bits_cleared( ram_addr_t start , ram_addr_t length )
void physical_memory_dirty_bits_cleared ( ram_addr_t start , ram_addr_t length )
{
{
if ( tcg_enabled ( ) ) {
if ( tcg_enabled ( ) ) {
tlb_reset_dirty_range_all ( start , length ) ;
tlb_reset_dirty_range_all ( start , length ) ;
@ -945,17 +945,17 @@ static bool physical_memory_get_dirty(ram_addr_t start, ram_addr_t length,
return dirty ;
return dirty ;
}
}
bool cpu_ physical_memory_get_dirty_flag( ram_addr_t addr , unsigned client )
bool physical_memory_get_dirty_flag ( ram_addr_t addr , unsigned client )
{
{
return physical_memory_get_dirty ( addr , 1 , client ) ;
return physical_memory_get_dirty ( addr , 1 , client ) ;
}
}
bool cpu_ physical_memory_is_clean( ram_addr_t addr )
bool physical_memory_is_clean ( ram_addr_t addr )
{
{
bool vga = cpu_ physical_memory_get_dirty_flag( addr , DIRTY_MEMORY_VGA ) ;
bool vga = physical_memory_get_dirty_flag ( addr , DIRTY_MEMORY_VGA ) ;
bool code = cpu_ physical_memory_get_dirty_flag( addr , DIRTY_MEMORY_CODE ) ;
bool code = physical_memory_get_dirty_flag ( addr , DIRTY_MEMORY_CODE ) ;
bool migration =
bool migration =
cpu_ physical_memory_get_dirty_flag( addr , DIRTY_MEMORY_MIGRATION ) ;
physical_memory_get_dirty_flag ( addr , DIRTY_MEMORY_MIGRATION ) ;
return ! ( vga & & code & & migration ) ;
return ! ( vga & & code & & migration ) ;
}
}
@ -998,7 +998,7 @@ static bool physical_memory_all_dirty(ram_addr_t start, ram_addr_t length,
return dirty ;
return dirty ;
}
}
uint8_t cpu_ physical_memory_range_includes_clean( ram_addr_t start ,
uint8_t physical_memory_range_includes_clean ( ram_addr_t start ,
ram_addr_t length ,
ram_addr_t length ,
uint8_t mask )
uint8_t mask )
{
{
@ -1019,7 +1019,7 @@ uint8_t cpu_physical_memory_range_includes_clean(ram_addr_t start,
return ret ;
return ret ;
}
}
void cpu_ physical_memory_set_dirty_flag( ram_addr_t addr , unsigned client )
void physical_memory_set_dirty_flag ( ram_addr_t addr , unsigned client )
{
{
unsigned long page , idx , offset ;
unsigned long page , idx , offset ;
DirtyMemoryBlocks * blocks ;
DirtyMemoryBlocks * blocks ;
@ -1037,7 +1037,7 @@ void cpu_physical_memory_set_dirty_flag(ram_addr_t addr, unsigned client)
set_bit_atomic ( offset , blocks - > blocks [ idx ] ) ;
set_bit_atomic ( offset , blocks - > blocks [ idx ] ) ;
}
}
void cpu_ physical_memory_set_dirty_range( ram_addr_t start , ram_addr_t length ,
void physical_memory_set_dirty_range ( ram_addr_t start , ram_addr_t length ,
uint8_t mask )
uint8_t mask )
{
{
DirtyMemoryBlocks * blocks [ DIRTY_MEMORY_NUM ] ;
DirtyMemoryBlocks * blocks [ DIRTY_MEMORY_NUM ] ;
@ -1089,7 +1089,7 @@ void cpu_physical_memory_set_dirty_range(ram_addr_t start, ram_addr_t length,
}
}
/* Note: start and end must be within the same ram block. */
/* Note: start and end must be within the same ram block. */
bool cpu_ physical_memory_test_and_clear_dirty( ram_addr_t start ,
bool physical_memory_test_and_clear_dirty ( ram_addr_t start ,
ram_addr_t length ,
ram_addr_t length ,
unsigned client )
unsigned client )
{
{
@ -1131,7 +1131,7 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start,
}
}
if ( dirty ) {
if ( dirty ) {
cpu_ physical_memory_dirty_bits_cleared( start , length ) ;
physical_memory_dirty_bits_cleared ( start , length ) ;
}
}
return dirty ;
return dirty ;
@ -1139,12 +1139,12 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start,
static void physical_memory_clear_dirty_range ( ram_addr_t addr , ram_addr_t length )
static void physical_memory_clear_dirty_range ( ram_addr_t addr , ram_addr_t length )
{
{
cpu_ physical_memory_test_and_clear_dirty( addr , length , DIRTY_MEMORY_MIGRATION ) ;
physical_memory_test_and_clear_dirty ( addr , length , DIRTY_MEMORY_MIGRATION ) ;
cpu_ physical_memory_test_and_clear_dirty( addr , length , DIRTY_MEMORY_VGA ) ;
physical_memory_test_and_clear_dirty ( addr , length , DIRTY_MEMORY_VGA ) ;
cpu_ physical_memory_test_and_clear_dirty( addr , length , DIRTY_MEMORY_CODE ) ;
physical_memory_test_and_clear_dirty ( addr , length , DIRTY_MEMORY_CODE ) ;
}
}
DirtyBitmapSnapshot * cpu_ physical_memory_snapshot_and_clear_dirty
DirtyBitmapSnapshot * physical_memory_snapshot_and_clear_dirty
( MemoryRegion * mr , hwaddr offset , hwaddr length , unsigned client )
( MemoryRegion * mr , hwaddr offset , hwaddr length , unsigned client )
{
{
DirtyMemoryBlocks * blocks ;
DirtyMemoryBlocks * blocks ;
@ -1191,14 +1191,14 @@ DirtyBitmapSnapshot *cpu_physical_memory_snapshot_and_clear_dirty
}
}
}
}
cpu_ physical_memory_dirty_bits_cleared( start , length ) ;
physical_memory_dirty_bits_cleared ( start , length ) ;
memory_region_clear_dirty_bitmap ( mr , offset , length ) ;
memory_region_clear_dirty_bitmap ( mr , offset , length ) ;
return snap ;
return snap ;
}
}
bool cpu_ physical_memory_snapshot_get_dirty( DirtyBitmapSnapshot * snap ,
bool physical_memory_snapshot_get_dirty ( DirtyBitmapSnapshot * snap ,
ram_addr_t start ,
ram_addr_t start ,
ram_addr_t length )
ram_addr_t length )
{
{
@ -1219,7 +1219,7 @@ bool cpu_physical_memory_snapshot_get_dirty(DirtyBitmapSnapshot *snap,
return false ;
return false ;
}
}
uint64_t cpu_ physical_memory_set_dirty_lebitmap( unsigned long * bitmap ,
uint64_t physical_memory_set_dirty_lebitmap ( unsigned long * bitmap ,
ram_addr_t start ,
ram_addr_t start ,
ram_addr_t pages )
ram_addr_t pages )
{
{
@ -1312,7 +1312,7 @@ uint64_t cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
page_number = ( i * HOST_LONG_BITS + j ) * hpratio ;
page_number = ( i * HOST_LONG_BITS + j ) * hpratio ;
addr = page_number * TARGET_PAGE_SIZE ;
addr = page_number * TARGET_PAGE_SIZE ;
ram_addr = start + addr ;
ram_addr = start + addr ;
cpu_ physical_memory_set_dirty_range( ram_addr ,
physical_memory_set_dirty_range ( ram_addr ,
TARGET_PAGE_SIZE * hpratio , clients ) ;
TARGET_PAGE_SIZE * hpratio , clients ) ;
} while ( c ! = 0 ) ;
} while ( c ! = 0 ) ;
}
}
@ -2080,7 +2080,7 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp)
physical_memory_clear_dirty_range ( block - > offset , block - > used_length ) ;
physical_memory_clear_dirty_range ( block - > offset , block - > used_length ) ;
block - > used_length = newsize ;
block - > used_length = newsize ;
cpu_ physical_memory_set_dirty_range( block - > offset , block - > used_length ,
physical_memory_set_dirty_range ( block - > offset , block - > used_length ,
DIRTY_CLIENTS_ALL ) ;
DIRTY_CLIENTS_ALL ) ;
memory_region_set_size ( block - > mr , unaligned_size ) ;
memory_region_set_size ( block - > mr , unaligned_size ) ;
if ( block - > resized ) {
if ( block - > resized ) {
@ -2285,7 +2285,7 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)
ram_list . version + + ;
ram_list . version + + ;
qemu_mutex_unlock_ramlist ( ) ;
qemu_mutex_unlock_ramlist ( ) ;
cpu_ physical_memory_set_dirty_range( new_block - > offset ,
physical_memory_set_dirty_range ( new_block - > offset ,
new_block - > used_length ,
new_block - > used_length ,
DIRTY_CLIENTS_ALL ) ;
DIRTY_CLIENTS_ALL ) ;
@ -3134,19 +3134,19 @@ static void invalidate_and_set_dirty(MemoryRegion *mr, hwaddr addr,
addr + = ramaddr ;
addr + = ramaddr ;
/* No early return if dirty_log_mask is or becomes 0, because
/* No early return if dirty_log_mask is or becomes 0, because
* cpu_ physical_memory_set_dirty_range will still call
* physical_memory_set_dirty_range will still call
* xen_modified_memory .
* xen_modified_memory .
*/
*/
if ( dirty_log_mask ) {
if ( dirty_log_mask ) {
dirty_log_mask =
dirty_log_mask =
cpu_ physical_memory_range_includes_clean( addr , length , dirty_log_mask ) ;
physical_memory_range_includes_clean ( addr , length , dirty_log_mask ) ;
}
}
if ( dirty_log_mask & ( 1 < < DIRTY_MEMORY_CODE ) ) {
if ( dirty_log_mask & ( 1 < < DIRTY_MEMORY_CODE ) ) {
assert ( tcg_enabled ( ) ) ;
assert ( tcg_enabled ( ) ) ;
tb_invalidate_phys_range ( NULL , addr , addr + length - 1 ) ;
tb_invalidate_phys_range ( NULL , addr , addr + length - 1 ) ;
dirty_log_mask & = ~ ( 1 < < DIRTY_MEMORY_CODE ) ;
dirty_log_mask & = ~ ( 1 < < DIRTY_MEMORY_CODE ) ;
}
}
cpu_ physical_memory_set_dirty_range( addr , length , dirty_log_mask ) ;
physical_memory_set_dirty_range ( addr , length , dirty_log_mask ) ;
}
}
void memory_region_flush_rom_device ( MemoryRegion * mr , hwaddr addr , hwaddr size )
void memory_region_flush_rom_device ( MemoryRegion * mr , hwaddr addr , hwaddr size )