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

Re: [Xen-devel] [PATCH RFC V6 1/5] xen: Emulate with no writes



>>> On 11.08.14 at 17:08, <rcojocaru@xxxxxxxxxxxxxxx> wrote:
> +static const struct x86_emulate_ops hvm_emulate_ops_no_write = {
> +    .read          = hvmemul_read,
> +    .insn_fetch    = hvmemul_insn_fetch,
> +    .write         = hvmemul_write_discard,
> +    .cmpxchg       = hvmemul_cmpxchg_discard,
> +    .rep_ins       = hvmemul_rep_ins_discard,
> +    .rep_outs      = hvmemul_rep_outs_discard,
> +    .rep_movs      = hvmemul_rep_movs_discard,
> +    .read_segment  = hvmemul_read_segment,
> +    .write_segment = hvmemul_write_segment,
> +    .read_io       = hvmemul_read_io_discard,
> +    .write_io      = hvmemul_write_io_discard,
> +    .read_cr       = hvmemul_read_cr,
> +    .write_cr      = hvmemul_write_cr,
> +    .read_msr      = hvmemul_read_msr,
> +    .write_msr     = hvmemul_write_msr,
> +    .wbinvd        = hvmemul_wbinvd,

How about these last two?

> +void hvm_emulate_one_full(bool_t nowrite, unsigned int trapnr,
> +    unsigned int errcode)
> +{
> +    struct hvm_emulate_ctxt ctx = {{ 0 }};
> +    int rc;
> +
> +    hvm_emulate_prepare(&ctx, guest_cpu_user_regs());
> +
> +    if ( nowrite )
> +        rc = hvm_emulate_one_no_write(&ctx);
> +    else
> +        rc = hvm_emulate_one(&ctx);
> +
> +    switch ( rc )
> +    {
> +    case X86EMUL_UNHANDLEABLE:
> +        gdprintk(XENLOG_DEBUG, "Emulation failed @ %04x:%lx: "
> +               "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
> +               hvmemul_get_seg_reg(x86_seg_cs, &ctx)->sel,
> +               ctx.insn_buf_eip,
> +               ctx.insn_buf[0], ctx.insn_buf[1],
> +               ctx.insn_buf[2], ctx.insn_buf[3],
> +               ctx.insn_buf[4], ctx.insn_buf[5],
> +               ctx.insn_buf[6], ctx.insn_buf[7],
> +               ctx.insn_buf[8], ctx.insn_buf[9]);
> +        hvm_inject_hw_exception(trapnr, errcode);
> +        break;
> +    case X86EMUL_EXCEPTION:
> +        if ( ctx.exn_pending )
> +            hvm_inject_hw_exception(ctx.exn_vector, ctx.exn_error_code);
> +        /* fall through */
> +    default:
> +        hvm_emulate_writeback(&ctx);

Shouldn't this be pulled out of the switch to also cover the exception
injection in the X86EMUL_UNHANDLEABLE case?

Jan

> +        break;
> +    }
> +}



_______________________________________________
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®.