mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-22 19:45:35 +00:00
Fix save/restore to work while emulation is not active
This commit is contained in:
parent
885b809004
commit
3deb9fdcad
|
@ -740,7 +740,7 @@ static void test_i386_reg_save(void **state)
|
|||
int32_t eax = 1;
|
||||
|
||||
// Initialize emulator
|
||||
uc_assert_success(uc_open(UC_ARCH_X86, UC_MODE_16, &uc));
|
||||
uc_assert_success(uc_open(UC_ARCH_X86, UC_MODE_32, &uc));
|
||||
|
||||
// map 8KB memory for this emulation
|
||||
uc_assert_success(uc_mem_map(uc, address, 8 * 1024, UC_PROT_ALL));
|
||||
|
|
4
uc.c
4
uc.c
|
@ -1184,12 +1184,12 @@ void *uc_save_regstate(uc_engine *uc, void *buffer) {
|
|||
buffer = malloc(sz);
|
||||
}
|
||||
|
||||
memcpy(buffer, uc->current_cpu->env_ptr, sz);
|
||||
memcpy(buffer, first_cpu->env_ptr, sz);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
UNICORN_EXPORT
|
||||
void uc_restore_regstate(uc_engine *uc, void *buffer) {
|
||||
size_t sz = cpu_regs_size(uc->arch, uc->mode);
|
||||
memcpy(uc->current_cpu->env_ptr, buffer, sz);
|
||||
memcpy(first_cpu->env_ptr, buffer, sz);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue