SVM: set/unset TF flag for single_step
PATCH 1/1 SVM: set/unset TF flag for single_step
Noticed on AMD (cpu family : 16, model : 2), that SVM does not honor arch.hvm_vcpu.single_step flag.
When arch.hvm_vcpu.single_step is set on VMX, it sets MTF. Since there is no MTF equivalent on AMD, it must set EFLAGS.TF.
Also strangely, when SVM VMEXIT_EXCEPTION_DB occurs, the TF flag is not cleared. This patch addresses that too.
Signed-off-by Mukesh Rathor <[email protected]>
--- xen/arch/x86/hvm/svm/intr.c | 6 ++++++ xen/arch/x86/hvm/svm/svm.c | 2 ++ 2 files changed, 8 insertions(+)
xen/arch/x86/hvm/svm/intr.c +6 -0
@@ -139,6 +139,12 @@ void svm_intr_assist(void)struct hvm_intack intack;enum hvm_intblk intblk; +if (unlikely (v->arch.hvm_vcpu.single_step) ) + { +guest_cpu_user_regs ()->eflags |=X86_EFLAGS_TF ; +return ; + } +/* Crank the handle on interrupt state. */ pt_update_irq (v);
xen/arch/x86/hvm/svm/svm.c +2 -0
@@ -2350,6 +2350,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)case VMEXIT_EXCEPTION_DB :if ( !v->domain->debugger_attached ) goto exit_and_crash; +else + regs->eflags &= ~X86_EFLAGS_TF ;domain_pause_for_debugger ();break ;
Signature · 1 line
1.8.3.1