[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 3/5] tcg/i386: add support for three-byte opcodes
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL 3/5] tcg/i386: add support for three-byte opcodes |
Date: |
Sat, 25 Jan 2014 15:32:50 -0800 |
From: Aurelien Jarno <address@hidden>
Add support for three-byte opcodes, starting with the 0x0f 0x38 prefix.
Use P_EXT38 as the new constant, and shift all other constants so that
P_EXT and P_EXT38 have neighbouring values.
Signed-off-by: Aurelien Jarno <address@hidden>
[RTH: Changed the name from P_EXT2 to P_EXT38.]
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/i386/tcg-target.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index 753b3a1..7161fe0 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -240,13 +240,14 @@ static inline int tcg_target_const_match(tcg_target_long
val,
#endif
#define P_EXT 0x100 /* 0x0f opcode prefix */
-#define P_DATA16 0x200 /* 0x66 opcode prefix */
+#define P_EXT38 0x200 /* 0x0f 0x38 opcode prefix */
+#define P_DATA16 0x400 /* 0x66 opcode prefix */
#if TCG_TARGET_REG_BITS == 64
-# define P_ADDR32 0x400 /* 0x67 opcode prefix */
-# define P_REXW 0x800 /* Set REX.W = 1 */
-# define P_REXB_R 0x1000 /* REG field as byte register */
-# define P_REXB_RM 0x2000 /* R/M field as byte register */
-# define P_GS 0x4000 /* gs segment override */
+# define P_ADDR32 0x800 /* 0x67 opcode prefix */
+# define P_REXW 0x1000 /* Set REX.W = 1 */
+# define P_REXB_R 0x2000 /* REG field as byte register */
+# define P_REXB_RM 0x4000 /* R/M field as byte register */
+# define P_GS 0x8000 /* gs segment override */
#else
# define P_ADDR32 0
# define P_REXW 0
@@ -398,9 +399,13 @@ static void tcg_out_opc(TCGContext *s, int opc, int r, int
rm, int x)
tcg_out8(s, (uint8_t)(rex | 0x40));
}
- if (opc & P_EXT) {
+ if (opc & (P_EXT | P_EXT38)) {
tcg_out8(s, 0x0f);
+ if (opc & P_EXT38) {
+ tcg_out8(s, 0x38);
+ }
}
+
tcg_out8(s, opc);
}
#else
@@ -409,8 +414,11 @@ static void tcg_out_opc(TCGContext *s, int opc)
if (opc & P_DATA16) {
tcg_out8(s, 0x66);
}
- if (opc & P_EXT) {
+ if (opc & (P_EXT | P_EXT38)) {
tcg_out8(s, 0x0f);
+ if (opc & P_EXT38) {
+ tcg_out8(s, 0x38);
+ }
}
tcg_out8(s, opc);
}
--
1.8.5.3
- [Qemu-devel] [PULL 0/5] tcg/i386 movbe support, Richard Henderson, 2014/01/25
- [Qemu-devel] [PULL 1/5] disas/i386.c: disassemble movbe instruction, Richard Henderson, 2014/01/25
- [Qemu-devel] [PULL 3/5] tcg/i386: add support for three-byte opcodes,
Richard Henderson <=
- [Qemu-devel] [PULL 2/5] tcg/i386: remove hardcoded P_REXW value, Richard Henderson, 2014/01/25
- [Qemu-devel] [PULL 4/5] tcg/i386: use movbe instruction in qemu_ldst routines, Richard Henderson, 2014/01/25
- [Qemu-devel] [PULL 5/5] tcg/i386: cleanup useless #ifdef, Richard Henderson, 2014/01/25
- Re: [Qemu-devel] [PULL 0/5] tcg/i386 movbe support, Peter Maydell, 2014/01/30