|
From: Abhijit Menon-S. <am...@wi...> - 2003-10-14 12:58:30
|
At 2003-10-14 10:27:27 +0100, th...@cy... wrote:
>
> Here's a patch that uses a separate condition JMP instruction which
> does seem to work:
Hi Tom.
Thanks for your help. Unfortunately, your patch doesn't quite handle the
LOOPZ/LOOPNZ corner cases correctly. The problem is that the jump cannot
safely be decomposed into two independent jumps. Right now, the code you
wrote is doing the moral equivalent of:
decl %ecx
jnz $disp8
cmpl $0, %ecx
jnz $disp8
But what it really needs to be doing is:
decl %ecx
pushfl
cmpl $0, %ecx
jz $.after
popfl
jz $disp8
.after:
(You can see how your implementation goes wrong with the test program I
posted earlier, and changing loopz to loopnz, or the xorl %eax, %eax to
xorl $1, %eax. The program then loops forever under valgrind.)
The question is, how best to write this in disInstr()?
-- ams
|