|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH v4] x86/monitor: Add new monitor event to catch I/O instructions
On 20.03.2023 22:56, Dmitry Isaykin wrote:
> Adds monitor support for I/O instructions.
>
> Signed-off-by: Dmitry Isaykin <isaikin-dmitry@xxxxxxxxx>
> Signed-off-by: Anton Belousov <abelousov@xxxxxxxxxxxxxx>
LGTM now FWIW, but this part ...
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -4560,8 +4560,24 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
> break;
>
> case EXIT_REASON_IO_INSTRUCTION:
> + {
> + unsigned int port, bytes;
> + bool in, str;
> + int rc;
> +
> __vmread(EXIT_QUALIFICATION, &exit_qualification);
> - if ( exit_qualification & 0x10 )
> +
> + port = (exit_qualification >> 16) & 0xFFFF;
> + bytes = (exit_qualification & 0x07) + 1;
> + in = (exit_qualification & 0x08);
> + str = (exit_qualification & 0x10);
> + rc = hvm_monitor_io(port, bytes, in, str);
> + if ( rc < 0 )
> + goto exit_and_crash;
> + if ( rc )
> + break;
> +
> + if ( str )
> {
> /* INS, OUTS */
> if ( !hvm_emulate_one_insn(x86_insn_is_portio, "port I/O") )
> @@ -4570,13 +4586,11 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
> else
> {
> /* IN, OUT */
> - uint16_t port = (exit_qualification >> 16) & 0xFFFF;
> - int bytes = (exit_qualification & 0x07) + 1;
> - int dir = (exit_qualification & 0x08) ? IOREQ_READ : IOREQ_WRITE;
> - if ( handle_pio(port, bytes, dir) )
> + if ( handle_pio(port, bytes, in ? IOREQ_READ : IOREQ_WRITE) )
> update_guest_eip(); /* Safe: IN, OUT */
> }
> break;
> + }
... would preferably be re-based over Andrew's change to use bitfields here
as well (just like was already done by him for SVM).
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |