diff --git a/bochs/gui/siminterface.cc b/bochs/gui/siminterface.cc index bbe23c2a8..ac57c8d27 100644 --- a/bochs/gui/siminterface.cc +++ b/bochs/gui/siminterface.cc @@ -1286,14 +1286,18 @@ bool bx_real_sim_c::restore_bochs_param(bx_list_c *root, const char *sr_path, co if (fp2 != NULL) { FILE **fpp = ((bx_shadow_filedata_c*)param)->get_fpp(); // If the temporary backing store file wasn't created, do it now. - if (*fpp == NULL) + if (*fpp == NULL) { *fpp = tmpfile64(); + } else { + fseeko64(*fpp, 0, SEEK_SET); + } if (*fpp != NULL) { + char *buffer = new char[4096]; while (!feof(fp2)) { - char buffer[64]; - size_t chars = fread(buffer, 1, sizeof(buffer), fp2); + size_t chars = fread(buffer, 1, 4096, fp2); fwrite(buffer, 1, chars, *fpp); } + delete [] buffer; fflush(*fpp); } ((bx_shadow_filedata_c*)param)->restore(fp2); diff --git a/bochs/memory/misc_mem.cc b/bochs/memory/misc_mem.cc index 05db4f5fb..c1852fbd0 100644 --- a/bochs/memory/misc_mem.cc +++ b/bochs/memory/misc_mem.cc @@ -318,11 +318,10 @@ void BX_MEM_C::register_state() #if BX_LARGE_RAMFILE bx_shadow_filedata_c *ramfile = new bx_shadow_filedata_c(list, "ram", &(BX_MEM_THIS overflow_file)); ramfile->set_sr_handlers(this, ramfile_save_handler, (filedata_restore_handler)NULL); + BXRS_DEC_PARAM_FIELD(list, next_swapout_idx, BX_MEM_THIS next_swapout_idx); #else new bx_shadow_data_c(list, "ram", BX_MEM_THIS vector, BX_MEM_THIS allocated); #endif - BXRS_DEC_PARAM_FIELD(list, len, BX_MEM_THIS len); - BXRS_DEC_PARAM_FIELD(list, allocated, BX_MEM_THIS allocated); BXRS_DEC_PARAM_FIELD(list, used_blocks, BX_MEM_THIS used_blocks); bx_list_c *mapping = new bx_list_c(list, "mapping");