[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [V10 PATCH 11/23] PVH xen: support invalid op emulation for PVH



On Thu, 8 Aug 2013 09:55:26 +0100
George Dunlap <george.dunlap@xxxxxxxxxxxxx> wrote:

> On 08/08/13 02:49, Mukesh Rathor wrote:
> > On Wed, 7 Aug 2013 12:29:13 +0100
> > George Dunlap <George.Dunlap@xxxxxxxxxxxxx> wrote:
> >
> >> On Wed, Jul 24, 2013 at 2:59 AM, Mukesh Rathor
......... 
> >>> +    if ( (rc = raw_copy_from_guest(sig, (char *)eip,
> >>> sizeof(sig))) != 0 ) {
> >>>           propagate_page_fault(eip + sizeof(sig) - rc, 0);
> >>>           return EXCRET_fault_fixed;
> >>> @@ -931,7 +936,7 @@ static int emulate_forced_invalid_op(struct
> >>> cpu_user_regs *regs) eip += sizeof(sig);
> >>>
> >>>       /* We only emulate CPUID. */
> >>> -    if ( ( rc = copy_from_user(instr, (char *)eip,
> >>> sizeof(instr))) != 0 )
> >>> +    if ( ( rc = raw_copy_from_guest(instr, (char *)eip,
> >>> sizeof(instr))) != 0 ) {
> >>>           propagate_page_fault(eip + sizeof(instr) - rc, 0);
> >>>           return EXCRET_fault_fixed;
> >>> @@ -1076,6 +1081,12 @@ void propagate_page_fault(unsigned long
> >>> addr, u16 error_code) struct vcpu *v = current;
> >>>       struct trap_bounce *tb = &v->arch.pv_vcpu.trap_bounce;
> >>>
> >>> +    if ( is_pvh_vcpu(v) )
> >>> +    {
> >>> +        hvm_inject_page_fault(error_code, addr);
> >>> +        return;
> >>> +    }
> >> Would it make more sense to rename this function
> >> "pv_inject_page_fault", and then make a macro to switch between the
> >> two?
> > I don't think so, propagate_page_fault seems generic enough.
> 
> What I meant was something similar to what I suggested for patch 10
> -- make propagate_page_fault() truly generic, by making it check what
> mode is running and calling either pv_inject_page_fault() or 
> hvm_inject_page_fault() as appropriate.

I guess, what you mean:

propagate_page_fault():
{
   if (pvh)
       hvm_inject_pf

   else if pv
       pv_inject_pf
}

where pv_inject_pf() is all the code after my "if pvh" in the current
patch. Small enough change I can accomodate in the next patch.

Mukesh

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.