-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unittests: Add test for carry inversion bug
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |