mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
x86emul: Fix AAM emulation AH output
AAM is defined in APM as AH = (AL/10d) AL = (AL mod 10d) However, due to the order of operations, we're incorrectly computing it as AL = (AL mod 10d) AH = (AL/10d) = ((originalAL mod 10d)/10d) = 0 Fix it by reordering the operations to match what's defined in APM and avoid the unexpected dependency between the 2 operations. Fixes:8993572b9c("x86emul: fold/eliminate some local variables") Signed-off-by: Teddy Astie <teddy.astie@vates.tech> Reviewed-by: Andrew Cooper <andrew.cooper3@citix.com> master commit:4c1aba82cfmaster date: 2026-09-25 14:44:27 +0100
This commit is contained in:
1 parent
526ec85405
commit
c3f3cf3ef3
1 file changed
+1
-1
@@ -2461,8 +2461,8 @@ x86_emulate(
|
||||
else
|
||||
{
|
||||
generate_exception_if(!n, X86_EXC_DE);
|
||||
_regs.al = _regs.al % n;
|
||||
_regs.ah = _regs.al / n;
|
||||
_regs.al = _regs.al % n;
|
||||
}
|
||||
_regs.eflags &= ~(X86_EFLAGS_SF | X86_EFLAGS_ZF | X86_EFLAGS_PF);
|
||||
_regs.eflags |= !_regs.al ? X86_EFLAGS_ZF : 0;
|
||||
|
||||