xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v3 07/18] x86emul: support {,V}{LD,ST}MXCSR
Date: Mon, 20 Feb 2017 14:52:35 +0000	[thread overview]
Message-ID: <0704d10c-33ef-7d9e-a9ea-bf218fc56ec5@citrix.com> (raw)
In-Reply-To: <58A4456C020000780013A1C6@prv-mh.provo.novell.com>

On 15/02/17 11:11, Jan Beulich wrote:
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -6183,6 +6200,23 @@ x86_emulate(
>      case X86EMUL_OPC(0x0f, 0xae): case X86EMUL_OPC_66(0x0f, 0xae): /* Grp15 */
>          switch ( modrm_reg & 7 )
>          {
> +        case 2: /* ldmxcsr */
> +            generate_exception_if(vex.pfx, EXC_UD);
> +            vcpu_must_have(sse);
> +        ldmxcsr:
> +            generate_exception_if(src.type != OP_MEM, EXC_UD);
> +            generate_exception_if(src.val & ~mxcsr_mask, EXC_GP, 0);
> +            asm volatile ( "ldmxcsr %0" :: "m" (src.val) );
> +            break;
> +
> +        case 3: /* stmxcsr */
> +            generate_exception_if(vex.pfx, EXC_UD);
> +            vcpu_must_have(sse);
> +        stmxcsr:
> +            generate_exception_if(dst.type != OP_MEM, EXC_UD);
> +            asm volatile ( "stmxcsr %0" : "=m" (dst.val) );
> +            break;
> +
>          case 5: /* lfence */
>              fail_if(modrm_mod != 3);
>              generate_exception_if(vex.pfx, EXC_UD);
> @@ -6226,6 +6260,20 @@ x86_emulate(
>          }
>          break;
>  
> +    case X86EMUL_OPC_VEX(0x0f, 0xae): /* Grp15 */
> +        switch ( modrm_reg & 7 )
> +        {
> +        case 2: /* vldmxcsr */
> +            generate_exception_if(vex.l || vex.reg != 0xf, EXC_UD);
> +            host_and_vcpu_must_have(avx);

If you move the {ld,st}mxcsr labels up by one, these can reduce to just
vcpu_must_have(avx), as we don't use the VEX encoded variant.

Having said that, shouldn't the pfx check be included even in the
VEX-encoded case?  (i.e. the lables move up once again).

~Andrew

> +            goto ldmxcsr;
> +        case 3: /* vstmxcsr */
> +            generate_exception_if(vex.l || vex.reg != 0xf, EXC_UD);
> +            host_and_vcpu_must_have(avx);
> +            goto stmxcsr;
> +        }
> +        goto cannot_emulate;
> +
>      case X86EMUL_OPC_F3(0x0f, 0xae): /* Grp15 */
>          fail_if(modrm_mod != 3);
>          generate_exception_if((modrm_reg & 4) || !mode_64bit(), EXC_UD);
>


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

  reply	other threads:[~2017-02-20 14:52 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15 10:47 [PATCH v3 00/18] x86emul: MMX/SSEn support Jan Beulich
2017-02-15 11:06 ` [PATCH v3 01/18] x86emul: catch exceptions occurring in stubs Jan Beulich
2017-02-15 11:27   ` Andrew Cooper
2017-02-15 11:49     ` Jan Beulich
2017-02-15 16:55     ` [PATCH v3.1 " Jan Beulich
2017-02-15 11:07 ` [PATCH v3 02/18] x86emul: support most memory accessing MMX/SSE{, 2, 3} insns Jan Beulich
2017-02-20 13:45   ` Andrew Cooper
2017-02-20 14:52     ` Jan Beulich
2017-02-20 18:40       ` Andrew Cooper
2017-02-21  8:44         ` Jan Beulich
2017-02-15 11:08 ` [PATCH v3 03/18] x86emul: support MMX/SSE{,2,3} moves Jan Beulich
2017-02-15 11:09 ` [PATCH v3 04/18] x86emul: support MMX/SSE/SSE2 converts Jan Beulich
2017-02-15 11:09 ` [PATCH v3 05/18] x86emul: support {,V}{,U}COMIS{S,D} Jan Beulich
2017-02-20 15:28   ` [PATCH v3 05/18] x86emul: support {, V}{, U}COMIS{S, D} Jan Beulich
2017-02-15 11:10 ` [PATCH v3 06/18] x86emul: support MMX/SSE/SSE2 insns with only register operands Jan Beulich
2017-02-15 11:11 ` [PATCH v3 07/18] x86emul: support {,V}{LD,ST}MXCSR Jan Beulich
2017-02-20 14:52   ` Andrew Cooper [this message]
2017-02-20 15:12     ` Jan Beulich
2017-02-20 15:33       ` Jan Beulich
2017-02-15 11:12 ` [PATCH v3 08/18] x86emul: support {,V}MOVNTDQA Jan Beulich
2017-02-20 15:01   ` Andrew Cooper
2017-02-20 15:13     ` Jan Beulich
2017-02-15 11:12 ` [PATCH v3 09/18] x86emul/test: split generic and testcase specific parts Jan Beulich
2017-02-20 15:13   ` Andrew Cooper
2017-02-15 11:13 ` [PATCH v3 10/18] x86emul: test coverage for SSE/SSE2 insns Jan Beulich
2017-02-20 15:24   ` Andrew Cooper
2017-02-20 15:40     ` Jan Beulich
2017-02-20 15:41       ` Andrew Cooper
2017-02-15 11:14 ` [PATCH v3 11/18] x86emul: honor MMXEXT feature flag Jan Beulich
2017-02-20 15:37   ` Andrew Cooper
2017-02-15 11:14 ` [PATCH v3 12/18] x86emul: add tables for 0f38 and 0f3a extension space Jan Beulich
2017-02-20 16:05   ` Andrew Cooper
2017-02-21  8:52     ` Jan Beulich
2017-02-15 11:15 ` [PATCH v3 13/18] x86emul: support SSSE3 insns Jan Beulich
2017-02-15 11:15 ` [PATCH v3 14/18] x86emul: support SSE4.1 insns Jan Beulich
2017-02-15 11:16 ` [PATCH v3 15/18] x86emul: support SSE4.2 insns Jan Beulich
2017-02-15 11:16 ` [PATCH v3 16/18] x86emul: support PCLMULQDQ Jan Beulich
2017-02-15 11:17 ` [PATCH v3 17/18] x86emul: support AESNI insns Jan Beulich
2017-02-15 11:17 ` [PATCH v3 18/18] x86emul: support SHA insns Jan Beulich

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=0704d10c-33ef-7d9e-a9ea-bf218fc56ec5@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).