diff options
author | sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2002-03-24 10:03:17 +0000 |
---|---|---|
committer | sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2002-03-24 10:03:17 +0000 |
commit | 3a72df0b322cd524ab6f2a1cea6d5d60cb4ece9d (patch) | |
tree | d87244805ddf53c4c47f816956175b456daa373c /vg_to_ucode.c | |
parent | 4d0ab1fa18db34a06260388095a90d4b197b22ba (diff) |
(merge from 20020320)
Modify codegen_SAHF so the instrumenter doesn't generate spurious
value errors if parts of %eax other than %ah are undefined.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'vg_to_ucode.c')
-rw-r--r-- | vg_to_ucode.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/vg_to_ucode.c b/vg_to_ucode.c index 5cef0b84..c03f5817 100644 --- a/vg_to_ucode.c +++ b/vg_to_ucode.c @@ -2644,8 +2644,23 @@ void codegen_xchg_eAX_Reg ( UCodeBlock* cb, Int sz, Int reg ) static void codegen_SAHF ( UCodeBlock* cb ) { - Int t = newTemp(cb); + Int t = newTemp(cb); + Int t2 = newTemp(cb); uInstr2(cb, GET, 4, ArchReg, R_EAX, TempReg, t); + + /* Mask out parts of t not corresponding to %AH. This stops the + instrumenter complaining if they are undefined. Otherwise, the + instrumenter would check all 32 bits of t at the PUSH, which + could be the cause of incorrect warnings. Discovered by Daniel + Veillard <veillard@redhat.com>. + */ + uInstr2(cb, MOV, 4, Literal, 0, TempReg, t2); + uLiteral(cb, 0x0000FF00); + uInstr2(cb, AND, 4, TempReg, t2, TempReg, t); + /* We deliberately don't set the condition codes here, since this + AND is purely internal to Valgrind and nothing to do with the + client's state. */ + uInstr0(cb, CALLM_S, 0); uInstr1(cb, PUSH, 4, TempReg, t); uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_SAHF)); |