From 51c33c4afd73815f191957f6f50131e99c774c21 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Wed, 24 Jul 2002 09:33:52 +0000 Subject: [PATCH] Assume PUTF modifies %EFLAGS in a completely arbitrary manner, and so be completely pessimistic if it is encountered during the redundant-flag- save/restore-elimination pass. This fixes the following mysterious failure: insane instruction 27: PUTFL %ecx valgrind: vg_from_ucode.c:2600 (vgPlain_emit_code): Assertion `sane' failed. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@516 --- coregrind/vg_translate.c | 9 +++++++++ vg_translate.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/coregrind/vg_translate.c b/coregrind/vg_translate.c index 0a806944ec..27a02754cf 100644 --- a/coregrind/vg_translate.c +++ b/coregrind/vg_translate.c @@ -1458,6 +1458,15 @@ static void vg_improve ( UCodeBlock* cb ) continue; } + /* PUTF modifies the %EFLAGS in essentially unpredictable ways. + For example people try to mess with bit 21 to see if CPUID + works. The setting may or may not actually take hold. So we + play safe here. */ + if (u->opcode == PUTF) { + future_dead_flags = FlagsEmpty; + continue; + } + /* We can annul the flags written by this insn if it writes a subset (or eq) of the set of flags known to be dead after this insn. If not, just record the flags also written by diff --git a/vg_translate.c b/vg_translate.c index 0a806944ec..27a02754cf 100644 --- a/vg_translate.c +++ b/vg_translate.c @@ -1458,6 +1458,15 @@ static void vg_improve ( UCodeBlock* cb ) continue; } + /* PUTF modifies the %EFLAGS in essentially unpredictable ways. + For example people try to mess with bit 21 to see if CPUID + works. The setting may or may not actually take hold. So we + play safe here. */ + if (u->opcode == PUTF) { + future_dead_flags = FlagsEmpty; + continue; + } + /* We can annul the flags written by this insn if it writes a subset (or eq) of the set of flags known to be dead after this insn. If not, just record the flags also written by -- 2.47.2