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

Re: [Xen-devel] [PATCH v5 01/17] x86emul: support most memory accessing MMX/SSE{, 2, 3} insns



>>> On 03.03.17 at 15:58, <JBeulich@xxxxxxxx> wrote:
> @@ -6183,6 +6579,76 @@ x86_emulate(
>          goto cannot_emulate;
>      }
>  
> +    if ( state->simd_size )
> +    {
> +#ifdef __XEN__
> +        uint8_t *buf = stub.ptr;
> +#else
> +        uint8_t *buf = get_stub(stub);
> +#endif
> +
> +        generate_exception_if(!op_bytes, EXC_UD);
> +        generate_exception_if(vex.opcx && (d & TwoOp) && vex.reg != 0xf,
> +                              EXC_UD);
> +
> +        if ( !buf )
> +            BUG();
> +        if ( vex.opcx == vex_none )
> +            SET_SSE_PREFIX(buf[0], vex.pfx);
> +
> +        buf[fic.insn_bytes] = 0xc3;
> +        copy_REX_VEX(buf, rex_prefix, vex);
> +
> +        if ( ea.type == OP_MEM )
> +        {
> +            uint32_t mxcsr = 0;
> +
> +            if ( op_bytes < 16 ||
> +                 (vex.opcx
> +                  ? /* vmov{a,nt}p{s,d} are exceptions. */
> +                    ext != ext_0f || ((b | 1) != 0x29 && b != 0x2b)
> +                  : /* movup{s,d} and lddqu are exceptions. */
> +                    ext == ext_0f && ((b | 1) == 0x11 || b == 0xf0)) )
> +                mxcsr = MXCSR_MM;
> +            else if ( vcpu_has_misalignsse() )
> +                asm ( "stmxcsr %0" : "=m" (mxcsr) );
> +            generate_exception_if(!(mxcsr & MXCSR_MM) &&
> +                                  !is_aligned(ea.mem.seg, ea.mem.off, 
> op_bytes,
> +                                              ctxt, ops),
> +                                  EXC_GP, 0);
> +            if ( (d & SrcMask) == SrcMem )
> +            {
> +                rc = ops->read(ea.mem.seg, ea.mem.off, mmvalp, op_bytes, 
> ctxt);
> +                if ( rc != X86EMUL_OKAY )
> +                    goto done;
> +                dst.type = OP_NONE;
> +            }
> +            else if ( (d & DstMask) == DstMem )
> +            {
> +                fail_if(!ops->write); /* Check before running the stub. */
> +                ASSERT(d & Mov);
> +                dst.type = OP_MEM;
> +                dst.bytes = op_bytes;
> +                dst.mem = ea.mem;
> +            }
> +            else if ( (d & SrcMask) == SrcMem16 )
> +                dst.type = OP_NONE;
> +            else
> +            {
> +                ASSERT_UNREACHABLE();
> +                return X86EMUL_UNHANDLEABLE;

I've changed this to "goto cannot_emulate" to be on the safe side
on production builds (to avoid bypassing put_fpu() / put_stub()).

Jan


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

 


Rackspace

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