[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH for 4.9 4/6] x86/svm: Introduce svm_emul_swint_injection()
> +static void svm_emul_swint_injection(struct x86_event *event) > +{ > + struct vcpu *curr = current; > + struct vmcb_struct *vmcb = curr->arch.hvm_svm.vmcb; > + struct cpu_user_regs *regs = guest_cpu_user_regs(); > + > + unsigned int trap = event->vector, type = event->type; > + unsigned int fault = TRAP_gp_fault, ec = 0; > + > + if ( vmcb->_cr0 & X86_CR0_PE ) /* TODO: support real-mode injection? */ if ( !(vmcb->_cr0 & X86_CR0_PE) ) goto raise_exception; will avoid extra indentation level; > + { > + pagefault_info_t pf; > + struct segment_register idtr; > + unsigned int idte_size, idte_offset; > + unsigned long idte_linear_addr; > + struct { uint32_t a, b, c, d; } idte = {}; > + bool lm = vmcb->_efer & EFER_LMA; > + enum hvm_segmentation_mode seg_mode = > + lm ? hvm_seg_mode_long : hvm_seg_mode_prot; > + int rc; > + > + idte_size = lm ? 16 : 8; > + idte_offset = trap * idte_size; > + > + /* ICEBP sets the External Event bit despite being an instruction. */ > + ec = (trap << 3) | X86_XEC_IDT | > + (type == X86_EVENTTYPE_PRI_SW_EXCEPTION ? X86_XEC_EXT : 0); > + > + /* > + * TODO: This does not cover the v8086 mode with CR4.VME case > + * correctly, but falls on the safe side from the point of view of a > + * 32bit OS. Someone with many TUITs can see about reading the TSS > + * Software Interrupt Redirection bitmap. > + */ > + if ( (regs->eflags & X86_EFLAGS_VM) && > + MASK_EXTR(regs->eflags, X86_EFLAGS_IOPL) != 3 ) > + goto raise_exception; > + > + /* > + * Read all 8/16 bytes so the idtr limit check is applied properly to > + * this entry, even though don't look all the words read. I think some words are missing here. -boris _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |