Skip to content

Commit

Permalink
unittests: Add test for carry inversion bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bylaws committed Nov 17, 2024
1 parent a69135c commit 6f23cc8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions unittests/32Bit_ASM/FEX_bugs/InvertedCarrySet.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%ifdef CONFIG
{
"RegData": {
"RAX": "1"
},
"Mode": "32BIT"
}
%endif

; FEX had a bug where inverting CF to match the ABI when flushing the register cache didn't mark CF as possibly being set.
; This caused accesses relying on that flag to be set correctly to return wrong values.
and al,cl ; Zeros CF, non-inverted
push ecx ; Triggers a register cache flush
inc eax ; Tries to preserve CF, but would encounter the bug and set it instead
jnb succ
mov eax, 0
hlt
succ:
mov eax, 1
hlt

0 comments on commit 6f23cc8

Please sign in to comment.