KVM: x86: Add debug register saving and restoring

Make use of the new KVM_GET/SET_DEBUGREGS to save/restore the x86 debug
registers.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Jan Kiszka 2010-03-12 15:20:49 +01:00 committed by Marcelo Tosatti
parent a303f9e37b
commit ff44f1a373
3 changed files with 67 additions and 0 deletions

View file

@ -64,6 +64,7 @@ struct KVMState
int migration_log;
int vcpu_events;
int robust_singlestep;
int debugregs;
#ifdef KVM_CAP_SET_GUEST_DEBUG
struct kvm_sw_breakpoint_head kvm_sw_breakpoints;
#endif
@ -664,6 +665,11 @@ int kvm_init(int smp_cpus)
kvm_check_extension(s, KVM_CAP_X86_ROBUST_SINGLESTEP);
#endif
s->debugregs = 0;
#ifdef KVM_CAP_DEBUGREGS
s->debugregs = kvm_check_extension(s, KVM_CAP_DEBUGREGS);
#endif
ret = kvm_arch_init(s, smp_cpus);
if (ret < 0)
goto err;
@ -939,6 +945,11 @@ int kvm_has_robust_singlestep(void)
return kvm_state->robust_singlestep;
}
int kvm_has_debugregs(void)
{
return kvm_state->debugregs;
}
void kvm_setup_guest_memory(void *start, size_t size)
{
if (!kvm_has_sync_mmu()) {