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

Re: [Xen-devel] [RFC PATCH 12/16]: PVH xen: return PVH features during creation, etc...



On Thu, 17 Jan 2013 15:36:17 -0800
Mukesh Rathor <mukesh.rathor@xxxxxxxxxx> wrote:

> On Mon, 14 Jan 2013 12:20:12 +0000
> "Jan Beulich" <JBeulich@xxxxxxxx> wrote:
> Agree, I need to make propgate_page_fault() inject PF into the PVH
> guest. Working on it now.

Done. No other callers of prop_page_fault for PVH. So are you OK with
something like this:

static noinline int vmxit_invalid_op(struct cpu_user_regs *regs)
{
    ulong addr=0;

    if ( guest_kernel_mode(current, regs) ||
         (addr = emulate_forced_invalid_op(regs)) == 0 )
    {
        hvm_inject_hw_exception(TRAP_invalid_op,
    HVM_DELIVER_NO_ERROR_CODE); return 0;
    }

    if (addr != EXCRET_fault_fixed)
        hvm_inject_page_fault(0, addr);
    return 0;
}


unsigned long emulate_forced_invalid_op(struct cpu_user_regs *regs)
{
    char sig[5], instr[2];
    unsigned long eip, rc, addr;

    eip = regs->eip;

    /* Check for forced emulation signature: ud2 ; .ascii "xen". */
    if ( (rc = raw_copy_from_guest(sig, (char *)eip, sizeof(sig))) !=
    0 ) {
        addr = eip + sizeof(sig) - rc;
        if ( is_pvh_vcpu(current) )
            return addr;

        propagate_page_fault(addr, 0);
        return EXCRET_fault_fixed;
    }
    if ( memcmp(sig, "\xf\xbxen", sizeof(sig)) )
        return 0;
    eip += sizeof(sig);

    /* We only emulate CPUID. */
    if ( ( rc = raw_copy_from_guest(instr, (char *)eip,
    sizeof(instr))) != 0 ) {
        addr = eip + sizeof(instr) - rc;
        if ( is_pvh_vcpu(current) )
            return addr;

        propagate_page_fault(addr, 0);
        return EXCRET_fault_fixed;
    }
    if ( memcmp(instr, "\xf\xa2", sizeof(instr)) )
        return 0;
    eip += sizeof(instr);

    pv_cpuid(regs);

    if ( is_pvh_vcpu(current) )
        regs->eip = eip;
    else
        instruction_done(regs, eip, 0);

    trace_trap_one_addr(TRC_PV_FORCED_INVALID_OP, regs->eip);

    return EXCRET_fault_fixed;


Thanks,
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®.