Minor changes in memory save/restore code (restore failure still not fixed).
- When restoring memory swap file, reset file pointer if file is already open. - Increased buffer size for restoring memory swap file. - Fixed save/restore list (added next_swapout_idx, removed host / guest size).
This commit is contained in:
parent
4b465e5b50
commit
484b0eeee7
@ -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);
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user