[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/svm: Use named (bit)fields for task switch exit info
commit 131c89ce1e1dfd0b57a249615a92de4f120d9100 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Tue Dec 3 16:57:52 2019 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Thu Dec 5 13:19:28 2019 +0000 x86/svm: Use named (bit)fields for task switch exit info Introduce vmcb.ei.* to provide names to fields in exitinfo{1,2}. Implement the task switch names for now, and clean up the TASK_SWITCH handler. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/hvm/svm/svm.c | 22 ++++++---------------- xen/include/asm-x86/hvm/svm/vmcb.h | 24 ++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 48203c538c..fb2677b9a6 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -2748,10 +2748,7 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) svm_vmexit_do_invalidate_cache(regs, exit_reason == VMEXIT_INVD); break; - case VMEXIT_TASK_SWITCH: { - enum hvm_task_switch_reason reason; - int32_t errcode = -1; - + case VMEXIT_TASK_SWITCH: /* * All TASK_SWITCH intercepts have fault-like semantics. NRIP is * never provided, even for instruction-induced task switches, but we @@ -2797,19 +2794,12 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) if ( insn_len < 0 && (insn_len = svm_get_task_switch_insn_len()) == 0 ) goto crash_or_fault; - if ( (vmcb->exitinfo2 >> 36) & 1 ) - reason = TSW_iret; - else if ( (vmcb->exitinfo2 >> 38) & 1 ) - reason = TSW_jmp; - else - reason = TSW_call_or_int; - if ( (vmcb->exitinfo2 >> 44) & 1 ) - errcode = (uint32_t)vmcb->exitinfo2; - - hvm_task_switch(vmcb->exitinfo1, reason, errcode, insn_len, - (vmcb->exitinfo2 & (1ul << 48)) ? X86_EFLAGS_RF : 0); + hvm_task_switch(vmcb->ei.task_switch.sel, + vmcb->ei.task_switch.iret ? TSW_iret : + vmcb->ei.task_switch.jmp ? TSW_jmp : TSW_call_or_int, + vmcb->ei.task_switch.ev ? vmcb->ei.task_switch.ec : -1, + insn_len, vmcb->ei.task_switch.rf ? X86_EFLAGS_RF : 0); break; - } case VMEXIT_CPUID: if ( (insn_len = svm_get_insn_len(v, INSTR_CPUID)) == 0 ) diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h b/xen/include/asm-x86/hvm/svm/vmcb.h index d2fc4d7281..56aff9b2ea 100644 --- a/xen/include/asm-x86/hvm/svm/vmcb.h +++ b/xen/include/asm-x86/hvm/svm/vmcb.h @@ -418,8 +418,28 @@ struct vmcb_struct { vintr_t _vintr; /* offset 0x60 - cleanbit 3 */ u64 interrupt_shadow; /* offset 0x68 */ u64 exitcode; /* offset 0x70 */ - u64 exitinfo1; /* offset 0x78 */ - u64 exitinfo2; /* offset 0x80 */ + union { + struct { + uint64_t exitinfo1; /* offset 0x78 */ + uint64_t exitinfo2; /* offset 0x80 */ + }; + union { + struct { + uint16_t sel; + uint64_t :48; + + uint32_t ec; + uint32_t :4; + bool iret:1; + uint32_t :1; + bool jmp:1; + uint32_t :5; + bool ev:1; + uint32_t :3; + bool rf:1; + } task_switch; + } ei; + }; intinfo_t exit_int_info; /* offset 0x88 */ u64 _np_enable; /* offset 0x90 - cleanbit 4 */ u64 res08[2]; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |