@@ -203,6 +203,12 @@ int ram_save_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset)
static RAMBlock *last_block;
static ram_addr_t last_offset;
+void ram_save_set_last_block(RAMBlock *block, ram_addr_t offset)
+{
+ last_block = block;
+ last_offset = offset;
+}
+
int ram_save_block(QEMUFile *f)
{
RAMBlock *block = last_block;
@@ -230,9 +236,7 @@ int ram_save_block(QEMUFile *f)
}
} while (block != last_block || offset != last_offset);
- last_block = block;
- last_offset = offset;
-
+ ram_save_set_last_block(block, offset);
return bytes_sent;
}
@@ -349,8 +353,7 @@ int ram_save_live(QEMUFile *f, int stage, void *opaque)
if (stage == 1) {
bytes_transferred = 0;
last_block_sent = NULL;
- last_block = NULL;
- last_offset = 0;
+ ram_save_set_last_block(NULL, 0);
sort_ram_list();
/* Make sure all dirty bits are set */
@@ -40,6 +40,7 @@ int xen_available(void);
#define RAM_SAVE_VERSION_ID 4 /* currently version 4 */
#if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY)
+void ram_save_set_last_block(RAMBlock *block, ram_addr_t offset);
int ram_save_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset);
RAMBlock *ram_find_block(const char *id, uint8_t len);
void *ram_load_host_from_stream_offset(QEMUFile *f,
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> --- arch_init.c | 13 ++++++++----- arch_init.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-)