-
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.
Merge pull request #3368 from bylaws/preprcr
FEXCore: Fix RCL/RCR shift wraparound behaviour
- Loading branch information
Showing
7 changed files
with
508 additions
and
279 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
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,50 @@ | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"RBX": "0x00000006", | ||
"RDI": "0x00000004", | ||
"RDX": "0x00000002", | ||
"RSI": "0x00000000", | ||
"R8": "0x0", | ||
"R9": "0x0", | ||
"R10": "0x1", | ||
"R11": "0x1" | ||
} | ||
} | ||
%endif | ||
|
||
mov rbx, 0x00000001 | ||
mov rdi, 0x00000001 | ||
mov rdx, 0x40000000 | ||
mov rsi, 0x40000000 | ||
mov rcx, 34 ; Test wraparound | ||
|
||
stc | ||
rcl ebx, cl | ||
lahf | ||
mov r8w, ax | ||
shr r8, 8 | ||
and r8, 1 ; We only care about carry flag here | ||
|
||
clc | ||
rcl edi, cl | ||
lahf | ||
mov r9w, ax | ||
shr r9, 8 | ||
and r9, 1 ; We only care about carry flag here | ||
|
||
stc | ||
rcl edx, cl | ||
lahf | ||
mov r10w, ax | ||
shr r10, 8 | ||
and r10, 1 ; We only care about carry flag here | ||
|
||
clc | ||
rcl esi, cl | ||
lahf | ||
mov r11w, ax | ||
shr r11, 8 | ||
and r11, 1 ; We only care about carry flag here | ||
|
||
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,50 @@ | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"RBX": "0x00000001", | ||
"RDI": "0x00000001", | ||
"RDX": "0x40000000", | ||
"RSI": "0x40000000", | ||
"R8": "0x1", | ||
"R9": "0x0", | ||
"R10": "0x1", | ||
"R11": "0x0" | ||
} | ||
} | ||
%endif | ||
|
||
mov rbx, 0x00000001 | ||
mov rdi, 0x00000001 | ||
mov rdx, 0x40000000 | ||
mov rsi, 0x40000000 | ||
mov rcx, 32 ; Test wraparound with zero shift | ||
|
||
stc | ||
rcl ebx, cl | ||
lahf | ||
mov r8w, ax | ||
shr r8, 8 | ||
and r8, 1 ; We only care about carry flag here | ||
|
||
clc | ||
rcl edi, cl | ||
lahf | ||
mov r9w, ax | ||
shr r9, 8 | ||
and r9, 1 ; We only care about carry flag here | ||
|
||
stc | ||
rcl edx, cl | ||
lahf | ||
mov r10w, ax | ||
shr r10, 8 | ||
and r10, 1 ; We only care about carry flag here | ||
|
||
clc | ||
rcl esi, cl | ||
lahf | ||
mov r11w, ax | ||
shr r11, 8 | ||
and r11, 1 ; We only care about carry flag here | ||
|
||
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,50 @@ | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"RBX": "0x40000000", | ||
"RDI": "0x00000000", | ||
"RDX": "0x60000000", | ||
"RSI": "0x20000000", | ||
"R8": "0x1", | ||
"R9": "0x1", | ||
"R10": "0x0", | ||
"R11": "0x0" | ||
} | ||
} | ||
%endif | ||
|
||
mov rbx, 0x00000002 | ||
mov rdi, 0x00000002 | ||
mov rdx, 0x80000000 | ||
mov rsi, 0x80000000 | ||
mov rcx, 34 ; Test wraparound | ||
|
||
stc | ||
rcr ebx, cl | ||
lahf | ||
mov r8w, ax | ||
shr r8, 8 | ||
and r8, 1 ; We only care about carry flag here | ||
|
||
clc | ||
rcr edi, cl | ||
lahf | ||
mov r9w, ax | ||
shr r9, 8 | ||
and r9, 1 ; We only care about carry flag here | ||
|
||
stc | ||
rcr edx, cl | ||
lahf | ||
mov r10w, ax | ||
shr r10, 8 | ||
and r10, 1 ; We only care about carry flag here | ||
|
||
clc | ||
rcr esi, cl | ||
lahf | ||
mov r11w, ax | ||
shr r11, 8 | ||
and r11, 1 ; We only care about carry flag here | ||
|
||
hlt |
Oops, something went wrong.