From e1cc11b7c6019bf4aaaab2c7d5916625dd24b1df Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 25 Jul 2004 15:43:00 +0000 Subject: [PATCH] Move the decoding of SFENCE out of the SSE only part of disInstr as it exists on Athlon's that have MMXEXT support and those don't have SSE state so won't decode it where it was. CCMAIL: 85947-done@bugs.kde.org git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2524 --- coregrind/vg_to_ucode.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/coregrind/vg_to_ucode.c b/coregrind/vg_to_ucode.c index 4f5bf95f5..f05e3f32a 100644 --- a/coregrind/vg_to_ucode.c +++ b/coregrind/vg_to_ucode.c @@ -3984,17 +3984,17 @@ static Addr disInstr ( UCodeBlock* cb, Addr eip, Bool* isEnd ) goto decode_success; } - /* LFENCE/MFENCE/SFENCE -- flush pending operations to memory */ + /* LFENCE/MFENCE -- flush pending operations to memory */ if (insn[0] == 0x0F && insn[1] == 0xAE && (epartIsReg(insn[2])) - && (gregOfRM(insn[2]) >= 5 && gregOfRM(insn[2]) <= 7)) + && (gregOfRM(insn[2]) >= 5 && gregOfRM(insn[2]) <= 6)) { vg_assert(sz == 4); eip += 3; uInstr2(cb, SSE3, 0, /* ignore sz for internal ops */ Lit16, (((UShort)0x0F) << 8) | (UShort)0xAE, Lit16, (UShort)insn[2] ); - DIP("sfence\n"); + DIP("%sfence\n", gregOfRM(insn[2]) == 5 ? "l" : "m"); goto decode_success; } @@ -6852,6 +6852,22 @@ static Addr disInstr ( UCodeBlock* cb, Addr eip, Bool* isEnd ) } break; + case 0xAE: /* SFENCE */ + vg_assert(sz == 4); + modrm = getUChar(eip); + if (!epartIsReg(modrm)) { + goto decode_failure; + } + if (gregOfRM(modrm) != 7) { + goto decode_failure; + } + eip += lengthAMode(eip); + uInstr2(cb, SSE3, 0, /* ignore sz for internal ops */ + Lit16, (((UShort)0x0F) << 8) | (UShort)0xAE, + Lit16, (UShort)modrm ); + DIP("sfence\n"); + break; + case 0x71: case 0x72: case 0x73: { /* (sz==4): PSLL/PSRA/PSRL mmxreg by imm8 */ /* (sz==2): PSLL/PSRA/PSRL xmmreg by imm8 */