-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unittests/ASM: Adds tests for loop instruction address size overrides
32-bit test would fail if the 16-bit address size override wasn't respected.
- Loading branch information
1 parent
824f122
commit 9ab930c
Showing
2 changed files
with
52 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,27 @@ | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"RAX": "0x0000000000000001", | ||
"RBX": "0x0000000000010001" | ||
}, | ||
"Mode": "32BIT" | ||
} | ||
%endif | ||
|
||
; FEX-Emu had a bug where a16 loop instructions weren't treating the input RCX register as 16-bit. | ||
; Effectively always treating it as 32-bit. | ||
; Little test that operates at 16-bit and 32-bit sizes to ensure it is correctly handled. | ||
mov eax, 0 | ||
mov ebx, 0 | ||
mov ecx, 0x0001_0001 | ||
|
||
.test: | ||
inc eax | ||
a16 loop .test | ||
|
||
mov ecx, 0x0001_0001 | ||
.test2: | ||
inc ebx | ||
a32 loop .test2 | ||
|
||
hlt |
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,25 @@ | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"RAX": "0x0000000000010001", | ||
"RBX": "0x0000000000000001" | ||
} | ||
} | ||
%endif | ||
|
||
; FEX-Emu had a bug in the 32-bit implementation of LOOP where it didn't handle 16-bit RCX correctly. | ||
; For test coverage on the 64-bit side, ensure that both 64-bit and 32-bit operation works correctly. | ||
mov rax, 0 | ||
mov rbx, 0 | ||
mov rcx, 0x0001_0001 | ||
|
||
.test: | ||
inc rax | ||
a64 loop .test | ||
|
||
mov rcx, 0x1_0000_0001 | ||
.test2: | ||
inc rbx | ||
a32 loop .test2 | ||
|
||
hlt |