From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH] x86emul: avoid using _PRE_EFLAGS() in a few cases
Date: Wed, 2 Jun 2021 16:37:38 +0200 [thread overview]
Message-ID: <9285f566-e352-9265-e9e3-e9a1e15ce7d5@suse.com> (raw)
The macro expanding to quite a few insns, replace its use by simply
clearing the status flags when the to be executed insn doesn't depend
on their initial state, in cases where this is easily possible. (There
are more cases where the uses are hidden inside macros, and where some
of the users of the macros want guest flags put in place before running
the insn, i.e. the macros can't be updated as easily.)
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6863,7 +6863,8 @@ x86_emulate(
}
opc[2] = 0xc3;
- invoke_stub(_PRE_EFLAGS("[eflags]", "[mask]", "[tmp]"),
+ _regs.eflags &= ~EFLAGS_MASK;
+ invoke_stub("",
_POST_EFLAGS("[eflags]", "[mask]", "[tmp]"),
[eflags] "+g" (_regs.eflags),
[tmp] "=&r" (dummy), "+m" (*mmvalp)
@@ -8111,7 +8112,8 @@ x86_emulate(
opc[2] = 0xc3;
copy_VEX(opc, vex);
- invoke_stub(_PRE_EFLAGS("[eflags]", "[mask]", "[tmp]"),
+ _regs.eflags &= ~EFLAGS_MASK;
+ invoke_stub("",
_POST_EFLAGS("[eflags]", "[mask]", "[tmp]"),
[eflags] "+g" (_regs.eflags),
"=a" (dst.val), [tmp] "=&r" (dummy)
@@ -11698,13 +11700,14 @@ int x86_emul_rmw(
break;
case rmw_xadd:
+ *eflags &= ~EFLAGS_MASK;
switch ( state->op_bytes )
{
unsigned long dummy;
#define XADD(sz, cst, mod) \
case sz: \
- asm ( _PRE_EFLAGS("[efl]", "[msk]", "[tmp]") \
+ asm ( "" \
COND_LOCK(xadd) " %"#mod"[reg], %[mem]; " \
_POST_EFLAGS("[efl]", "[msk]", "[tmp]") \
: [reg] "+" #cst (state->ea.val), \
next reply other threads:[~2021-06-02 14:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 14:37 Jan Beulich [this message]
2021-06-28 12:14 ` Ping: [PATCH] x86emul: avoid using _PRE_EFLAGS() in a few cases Jan Beulich
2021-06-28 17:14 ` Andrew Cooper
2021-06-29 9:09 ` Jan Beulich
2021-06-29 10:00 ` 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=9285f566-e352-9265-e9e3-e9a1e15ce7d5@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=roger.pau@citrix.com \
--cc=wl@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 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.