mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
target-arm: Reinitialize all KVM VCPU registers on reset
Since the ARM KVM API doesn't include a "reset this VCPU" ioctl, we have to capture the initial values of every register it knows about so that we can reset the VCPU by feeding those values back again. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
ff047453f5
commit
2d8e5a0e25
2 changed files with 21 additions and 1 deletions
|
@ -162,6 +162,13 @@ int kvm_arch_init_vcpu(CPUState *cs)
|
|||
goto out;
|
||||
}
|
||||
|
||||
/* Save a copy of the initial register values so that we can
|
||||
* feed it back to the kernel on VCPU reset.
|
||||
*/
|
||||
cpu->cpreg_reset_values = g_memdup(cpu->cpreg_values,
|
||||
cpu->cpreg_array_len *
|
||||
sizeof(cpu->cpreg_values[0]));
|
||||
|
||||
out:
|
||||
g_free(rlp);
|
||||
return ret;
|
||||
|
@ -603,6 +610,15 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
|
|||
|
||||
void kvm_arch_reset_vcpu(CPUState *cs)
|
||||
{
|
||||
/* Feed the kernel back its initial register state */
|
||||
ARMCPU *cpu = ARM_CPU(cs);
|
||||
|
||||
memmove(cpu->cpreg_values, cpu->cpreg_reset_values,
|
||||
cpu->cpreg_array_len * sizeof(cpu->cpreg_values[0]));
|
||||
|
||||
if (!write_list_to_kvmstate(cpu)) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
bool kvm_arch_stop_on_emulation_error(CPUState *cs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue