All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mihai Donțu" <mdontu@bitdefender.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel@lists.xenproject.org,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH 4/5] x86/emulate: add support for {, v}movq xmm, xmm/m64
Date: Thu, 8 Sep 2016 16:56:27 +0300	[thread overview]
Message-ID: <20160908165627.6b483536@bitdefender.com> (raw)
In-Reply-To: <57D1878F020000780010D270@prv-mh.provo.novell.com>


[-- Attachment #1.1: Type: text/plain, Size: 4480 bytes --]

On Thursday 08 September 2016 07:45:19 Jan Beulich wrote:
> From: Mihai Donțu <mdontu@bitdefender.com>
> 
> Signed-off-by: Mihai Donțu <mdontu@bitdefender.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> v4: Re-base on decoding changes. Address my own review comments (where
>     still applicable). #UD when vex.l is set. Various adjustments to
>     the test tool change.

Thank you! They were in my queue for too long and I was struggling to
find a window of time to get them in shape.

> --- a/tools/tests/x86_emulator/test_x86_emulator.c
> +++ b/tools/tests/x86_emulator/test_x86_emulator.c
> @@ -713,6 +713,54 @@ int main(int argc, char **argv)
>      else
>          printf("skipped\n");
>  
> +    printf("%-40s", "Testing movq %%xmm0,32(%%ecx)...");
> +    if ( stack_exec && cpu_has_sse2 )
> +    {
> +        decl_insn(movq_to_mem2);
> +
> +        asm volatile ( "pcmpgtb %%xmm0, %%xmm0\n"
> +                       put_insn(movq_to_mem2, "movq %%xmm0, 32(%0)")
> +                       :: "c" (NULL) );
> +
> +        memset(res, 0xbd, 64);
> +        set_insn(movq_to_mem2);
> +        regs.ecx = (unsigned long)res;
> +        regs.edx = 0;
> +        rc = x86_emulate(&ctxt, &emulops);
> +        if ( rc != X86EMUL_OKAY || !check_eip(movq_to_mem2) ||
> +             *((uint64_t *)res + 4) ||
> +             memcmp(res, res + 10, 24) ||
> +             memcmp(res, res + 6, 8) )
> +            goto fail;
> +        printf("okay\n");
> +    }
> +    else
> +        printf("skipped\n");
> +
> +    printf("%-40s", "Testing vmovq %%xmm1,32(%%edx)...");
> +    if ( stack_exec && cpu_has_avx )
> +    {
> +        decl_insn(vmovq_to_mem);
> +
> +        asm volatile ( "pcmpgtb %%xmm1, %%xmm1\n"
> +                       put_insn(vmovq_to_mem, "vmovq %%xmm1, 32(%0)")
> +                       :: "d" (NULL) );
> +
> +        memset(res, 0xdb, 64);
> +        set_insn(vmovq_to_mem);
> +        regs.ecx = 0;
> +        regs.edx = (unsigned long)res;
> +        rc = x86_emulate(&ctxt, &emulops);
> +        if ( rc != X86EMUL_OKAY || !check_eip(vmovq_to_mem) ||
> +             *((uint64_t *)res + 4) ||
> +             memcmp(res, res + 10, 24) ||
> +             memcmp(res, res + 6, 8) )
> +            goto fail;
> +        printf("okay\n");
> +    }
> +    else
> +        printf("skipped\n");
> +
>      printf("%-40s", "Testing movdqu %xmm2,(%ecx)...");
>      if ( stack_exec && cpu_has_sse2 )
>      {
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -269,7 +269,7 @@ static const opcode_desc_t twobyte_table
>      ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
>      ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
>      /* 0xD0 - 0xDF */
> -    ModRM, ModRM, ModRM, ModRM, ModRM, ModRM, ModRM, ModRM,
> +    ModRM, ModRM, ModRM, ModRM, ModRM, ModRM, ImplicitOps|ModRM, ModRM,
>      ModRM, ModRM, ModRM, ModRM, ModRM, ModRM, ModRM, ModRM,
>      /* 0xE0 - 0xEF */
>      ModRM, ModRM, ModRM, ModRM, ModRM, ModRM, ModRM, ImplicitOps|ModRM,
> @@ -4779,6 +4779,8 @@ x86_emulate(
>      case X86EMUL_OPC_F3(0x0f, 0x7f):     /* movdqu xmm,xmm/m128 */
>      case X86EMUL_OPC_VEX_F3(0x0f, 0x7f): /* vmovdqu xmm,xmm/m128 */
>                                           /* vmovdqu ymm,ymm/m256 */
> +    case X86EMUL_OPC_66(0x0f, 0xd6):     /* movq xmm,xmm/m64 */
> +    case X86EMUL_OPC_VEX_66(0x0f, 0xd6): /* vmovq xmm,xmm/m64 */
>      {
>          uint8_t *buf = get_stub(stub);
>          struct fpu_insn_ctxt fic = { .insn_bytes = 5 };
> @@ -4796,7 +4798,8 @@ x86_emulate(
>              case vex_66:
>              case vex_f3:
>                  host_and_vcpu_must_have(sse2);
> -                buf[0] = 0x66; /* movdqa */
> +                /* Converting movdqu to movdqa here: Our buffer is aligned. */
> +                buf[0] = 0x66;
>                  get_fpu(X86EMUL_FPU_xmm, &fic);
>                  ea.bytes = 16;
>                  break;
> @@ -4819,6 +4822,11 @@ x86_emulate(
>              get_fpu(X86EMUL_FPU_ymm, &fic);
>              ea.bytes = 16 << vex.l;
>          }
> +        if ( b == 0xd6 )
> +        {
> +            generate_exception_if(vex.l, EXC_UD, -1);
> +            ea.bytes = 8;
> +        }
>          if ( ea.type == OP_MEM )
>          {
>              generate_exception_if((vex.pfx == vex_66) &&
> 

-- 
Mihai DONȚU

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

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

  reply	other threads:[~2016-09-08 13:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 13:36 [PATCH 0/5] x86: further insn emulator improvements Jan Beulich
2016-09-08 13:42 ` [PATCH 1/5] x86emul: support UMIP Jan Beulich
2016-09-30 10:32   ` Andrew Cooper
2016-09-30 12:23     ` Jan Beulich
2016-09-30 12:27       ` Andrew Cooper
2016-09-30 12:44         ` Jan Beulich
2016-09-08 13:43 ` [PATCH 2/5] x86emul: consolidate segment register handling Jan Beulich
2016-09-30 10:39   ` Andrew Cooper
2016-09-30 12:15     ` Jan Beulich
2016-09-30 12:16       ` Andrew Cooper
2016-09-08 13:44 ` [PATCH 3/5] x86emul: support RTM instructions Jan Beulich
2016-09-30 12:37   ` Andrew Cooper
2016-09-30 12:51     ` Jan Beulich
2016-09-08 13:45 ` [PATCH 4/5] x86/emulate: add support for {, v}movq xmm, xmm/m64 Jan Beulich
2016-09-08 13:56   ` Mihai Donțu [this message]
2016-09-30 10:43   ` Andrew Cooper
2016-09-08 13:46 ` [PATCH 5/5] x86/emulate: add support for {, v}movd {, x}mm, r/m32 and {, v}movq {, x}mm, r/m64 Jan Beulich
2016-09-30 11:59   ` Andrew Cooper
2016-09-30 12:11     ` Jan Beulich
2016-09-30 12:12       ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160908165627.6b483536@bitdefender.com \
    --to=mdontu@bitdefender.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.