[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/vmx: Provide named fields for IO exit qualification
commit f71f8e95c34fedb0d9ae21a100bfa9f012543abf Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Thu Mar 16 17:53:56 2023 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Tue Mar 21 10:41:16 2023 +0000 x86/vmx: Provide named fields for IO exit qualification This removes most of the opencoded bit logic on the exit qualification. Unfortunately, size is 1-based not 0-based, so need adjusting in a separate variable. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/hvm/vmx/vmx.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 00b531f76c..78ac9ece6f 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -4560,23 +4560,37 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) break; case EXIT_REASON_IO_INSTRUCTION: - __vmread(EXIT_QUALIFICATION, &exit_qualification); - if ( exit_qualification & 0x10 ) + { + union { + unsigned long raw; + struct { + uint16_t size:3; + bool in:1; + bool str:1; + bool rep:1; + bool imm:1; + uint16_t :9; + uint16_t port; + }; + } io_qual; + unsigned int bytes; + + __vmread(EXIT_QUALIFICATION, &io_qual.raw); + bytes = io_qual.size + 1; + + if ( io_qual.str ) { - /* INS, OUTS */ if ( !hvm_emulate_one_insn(x86_insn_is_portio, "port I/O") ) hvm_inject_hw_exception(TRAP_gp_fault, 0); } 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(io_qual.port, bytes, + io_qual.in ? IOREQ_READ : IOREQ_WRITE) ) update_guest_eip(); /* Safe: IN, OUT */ } break; + } case EXIT_REASON_INVD: case EXIT_REASON_WBINVD: -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |