monitor_trap_flag is a VMX feature. This will never be true on AMD> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -6431,6 +6431,14 @@ int hvm_debug_op(struct vcpu *v, int32_t op)
> return rc;
> }
>
> +void hvm_toggle_singlestep(struct vcpu *v)
> +{
> + if ( !cpu_has_monitor_trap_flag )
systems. (its use in hvm_debug_op() is also dubious)
Yes, this feature is only for Intel cpus. Reworking the use of the flag though is a bit out-of-scope for this patch itself.
Why is 'current' excluded?
> + return;
> +
> + v->arch.hvm_vcpu.single_step = !v->arch.hvm_vcpu.single_step;
> +}
> +
> int nhvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
> {
> if (hvm_funcs.nhvm_vcpu_hostrestore)
> diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
> new file mode 100644
> index 0000000..95b30ad
> --- /dev/null
> +++ b/xen/arch/x86/vm_event.c
> @@ -0,0 +1,41 @@
> +/*
> + * arch/x86/vm_event.c
> + *
> + * Architecture-specific vm_event handling routines
> + *
> + * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public
> + * License v2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public
> + * License along with this program; if not, write to the
> + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> + * Boston, MA 021110-1307, USA.
> + */
> +
> +#include <xen/sched.h>
> +#include <asm/hvm/hvm.h>
> +
> +void vm_event_toggle_singlestep(struct domain *d, struct vcpu *v)
> +{
> + if ( (v == current) || !is_hvm_domain(d) )
Only to be consistent with the sanity check applied for XEN_DOMCTL_debug_op.