x86: fix daa opcode for al register values higher than 0xf9
PATCH 1/1 x86: fix daa opcode for al register values higher than 0xf9
The second if statement should consider the original al register value, and not the new one.
Signed-off-by Boris Figovsky <[email protected]>
--- target-i386/op_helper.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
target-i386/op_helper.c +3 -3
@@ -1970,20 +1970,20 @@ void helper_aas(void)void helper_daa (void ) { -int al, af, cf; +int old_al, al, af, cf;int eflags; eflags =helper_cc_compute_all (CC_OP ); cf = eflags &CC_C ; af = eflags &CC_A ; - al =EAX &0xff ; + old_al = al =EAX &0xff ; eflags =0 ;if (((al &0x0f ) >9 ) || af) { al = (al +6 ) &0xff ; eflags |=CC_A ; } -if ((al >0x9f ) || cf) { +if ((old_al >0x99 ) || cf) { al = (al +0x60 ) &0xff ; eflags |=CC_C ; }
Signature · 1 line
1.7.0.4
Quoted 2 lines · Boris Figovsky
The second if statement should consider the original al register value, and not the new one.
Reviewed-by Peter Maydell <[email protected]>
(It took me some time to convince myself that the line
CF <- old_CF or (Carry from AL <- AL + 6)
in the Intel architecture manual is actually redundant; the AMD docs are much clearer here...)
-- PMM
Stefan Hajnoczi
AppliedQuoted 7 lines · Boris Figovsky
The second if statement should consider the original al register value, and not the new one.
Signed-off-by Boris Figovsky <[email protected]>--- target-i386/op_helper.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches
Stefan