From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net
Subject: [Qemu-devel] [PATCH 1/5] tcg-i386: Tidy data16 prefixes.
Date: Fri, 21 May 2010 09:03:00 -0700 [thread overview]
Message-ID: <1274457790-22396-2-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1274457790-22396-1-git-send-email-rth@twiddle.net>
Include it in the opcode as an extension, as with P_EXT
or the REX bits in the x86-64 port.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
tcg/i386/tcg-target.c | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index 396a2f1..9226c1e 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -156,7 +156,8 @@ static inline int tcg_target_const_match(tcg_target_long val,
return 0;
}
-#define P_EXT 0x100 /* 0x0f opcode prefix */
+#define P_EXT 0x100 /* 0x0f opcode prefix */
+#define P_DATA16 0x200 /* 0x66 opcode prefix */
#define OPC_ARITH_EvIz (0x81)
#define OPC_ARITH_EvIb (0x83)
@@ -262,8 +263,12 @@ static const uint8_t tcg_cond_to_jcc[10] = {
static inline void tcg_out_opc(TCGContext *s, int opc)
{
- if (opc & P_EXT)
+ if (opc & P_DATA16) {
+ tcg_out8(s, 0x66);
+ }
+ if (opc & P_EXT) {
tcg_out8(s, 0x0f);
+ }
tcg_out8(s, opc);
}
@@ -396,10 +401,14 @@ static inline void tcg_out_st(TCGContext *s, TCGType type, int arg,
static void tcg_out_shifti(TCGContext *s, int subopc, int reg, int count)
{
+ /* Propagate an opcode prefix, such as P_DATA16. */
+ int ext = subopc & ~0x7;
+ subopc &= 0x7;
+
if (count == 1) {
- tcg_out_modrm(s, OPC_SHIFT_1, subopc, reg);
+ tcg_out_modrm(s, OPC_SHIFT_1 | ext, subopc, reg);
} else {
- tcg_out_modrm(s, OPC_SHIFT_Ib, subopc, reg);
+ tcg_out_modrm(s, OPC_SHIFT_Ib | ext, subopc, reg);
tcg_out8(s, count);
}
}
@@ -411,8 +420,7 @@ static inline void tcg_out_bswap32(TCGContext *s, int reg)
static inline void tcg_out_rolw_8(TCGContext *s, int reg)
{
- tcg_out8(s, 0x66);
- tcg_out_shifti(s, SHIFT_ROL, reg, 8);
+ tcg_out_shifti(s, SHIFT_ROL | P_DATA16, reg, 8);
}
static inline void tcg_out_ext8u(TCGContext *s, int dest, int src)
@@ -1053,8 +1061,8 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args,
data_reg = r1;
}
/* movw */
- tcg_out8(s, 0x66);
- tcg_out_modrm_offset(s, OPC_MOVL_EvGv, data_reg, r0, GUEST_BASE);
+ tcg_out_modrm_offset(s, OPC_MOVL_EvGv | P_DATA16,
+ data_reg, r0, GUEST_BASE);
break;
case 2:
if (bswap) {
@@ -1159,8 +1167,8 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
break;
case INDEX_op_st16_i32:
/* movw */
- tcg_out8(s, 0x66);
- tcg_out_modrm_offset(s, OPC_MOVL_EvGv, args[0], args[1], args[2]);
+ tcg_out_modrm_offset(s, OPC_MOVL_EvGv | P_DATA16,
+ args[0], args[1], args[2]);
break;
case INDEX_op_st_i32:
tcg_out_st(s, TCG_TYPE_I32, args[0], args[1], args[2]);
--
1.7.0.1
next prev parent reply other threads:[~2010-05-21 16:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-21 16:02 [Qemu-devel] [PATCH 0/5] tcg-i386: tidy softmmu code Richard Henderson
2010-05-21 16:03 ` Richard Henderson [this message]
2010-05-21 16:03 ` [Qemu-devel] [PATCH 2/5] tcg-i386: Split out TLB Hit path from qemu_ld/st Richard Henderson
2010-05-21 16:03 ` [Qemu-devel] [PATCH 3/5] tcg-i386: Swap order of TLB hit and miss paths Richard Henderson
2010-05-21 16:03 ` [Qemu-devel] [PATCH 4/5] tcg-i386: Split out tlb load function Richard Henderson
2010-05-21 16:03 ` [Qemu-devel] [PATCH 5/5] tcg-i386: Remove some ifdefs in qemu_ld/st Richard Henderson
2010-05-21 16:58 ` [Qemu-devel] [PATCH 0/5] tcg-i386: tidy softmmu code Richard Henderson
2010-06-02 20:51 ` Aurelien Jarno
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=1274457790-22396-2-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=aurelien@aurel32.net \
--cc=qemu-devel@nongnu.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).