From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Keir Fraser <keir@xen.org>
Subject: Re: [PATCH] x86_emulate: properly do IP updates and other side effects on success
Date: Thu, 7 Aug 2014 12:40:42 +0100 [thread overview]
Message-ID: <53E365BA.8010801@citrix.com> (raw)
In-Reply-To: <53E35543020000780002A09C@mail.emea.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 3410 bytes --]
On 07/08/14 09:30, Jan Beulich wrote:
> The two MMX/SSE/AVX code blocks failed to update IP properly, and these
> as well as get_reg_refix(), which "manually" updated IP so far, failed
> to do the TF and RF processing needed at the end of successfully
> emulated instructions.
>
> Reported-by: Andrei LUTAS <vlutas@bitdefender.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Tested-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Reviewed-by: Andrew Cooper <andrew.cooper@citrix.com>
>
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -720,29 +720,26 @@ do{ uint8_t stub[] = { _bytes, 0xc3 };
> put_fpu(&fic); \
> } while (0)
>
> -static unsigned long __get_rep_prefix(
> - struct cpu_user_regs *int_regs,
> - struct cpu_user_regs *ext_regs,
> +static unsigned long _get_rep_prefix(
> + const struct cpu_user_regs *int_regs,
> int ad_bytes)
> {
> - unsigned long ecx = ((ad_bytes == 2) ? (uint16_t)int_regs->ecx :
> - (ad_bytes == 4) ? (uint32_t)int_regs->ecx :
> - int_regs->ecx);
> -
> - /* Skip the instruction if no repetitions are required. */
> - if ( ecx == 0 )
> - ext_regs->eip = int_regs->eip;
> -
> - return ecx;
> + return (ad_bytes == 2) ? (uint16_t)int_regs->ecx :
> + (ad_bytes == 4) ? (uint32_t)int_regs->ecx :
> + int_regs->ecx;
> }
>
> #define get_rep_prefix() ({ \
> unsigned long max_reps = 1; \
> if ( rep_prefix() ) \
> - max_reps = __get_rep_prefix(&_regs, ctxt->regs, ad_bytes); \
> + max_reps = _get_rep_prefix(&_regs, ad_bytes); \
> if ( max_reps == 0 ) \
> - goto done; \
> - max_reps; \
> + { \
> + /* Skip the instruction if no repetitions are required. */ \
> + dst.type = OP_NONE; \
> + goto writeback; \
> + } \
> + max_reps; \
> })
>
> static void __put_rep_prefix(
> @@ -3921,7 +3918,8 @@ x86_emulate(
> if ( !rc && (b & 1) && (ea.type == OP_MEM) )
> rc = ops->write(ea.mem.seg, ea.mem.off, mmvalp,
> ea.bytes, ctxt);
> - goto done;
> + dst.type = OP_NONE;
> + break;
> }
>
> case 0x20: /* mov cr,reg */
> @@ -4188,7 +4186,8 @@ x86_emulate(
> if ( !rc && (b != 0x6f) && (ea.type == OP_MEM) )
> rc = ops->write(ea.mem.seg, ea.mem.off, mmvalp,
> ea.bytes, ctxt);
> - goto done;
> + dst.type = OP_NONE;
> + break;
> }
>
> case 0x80 ... 0x8f: /* jcc (near) */ {
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 4431 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-08-07 11:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-07 8:30 [PATCH] x86_emulate: properly do IP updates and other side effects on success Jan Beulich
2014-08-07 11:40 ` Andrew Cooper [this message]
2014-08-07 13:24 ` Fabio Fantoni
2014-08-07 14:38 ` Jan Beulich
2014-08-07 14:57 ` Fabio Fantoni
2014-08-11 12:53 ` Fabio Fantoni
2014-08-11 13:16 ` Fabio Fantoni
2014-08-11 13:32 ` Andrew Cooper
2014-08-11 14:14 ` Jan Beulich
2014-08-11 14:31 ` Fabio Fantoni
2014-08-07 14:40 ` Fabio Fantoni
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=53E365BA.8010801@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--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).