-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,328 additions
and
2 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 @@ | ||
Test_X87/FXAM_Simple.asm |
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
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,40 @@ | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"RAX": "8" | ||
} | ||
} | ||
%endif | ||
|
||
fninit | ||
fld1 | ||
fld1 | ||
fld1 | ||
fld1 | ||
fld1 | ||
fld1 | ||
fld1 | ||
fld1 | ||
|
||
mov ebx, 0 | ||
|
||
.ExamineStack: | ||
; Examine st(0) | ||
fxam | ||
fwait | ||
; Get the results in to AX | ||
fnstsw ax | ||
and ax, 0x4500 | ||
; Check for empty | ||
cmp ax, 0x4100 | ||
je .Done | ||
|
||
; Now push the x87 stack value | ||
; We know it isn't empty | ||
fstp st0 | ||
fwait | ||
inc ebx | ||
jmp .ExamineStack | ||
.Done: | ||
mov eax, ebx | ||
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,51 @@ | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"RAX": "8" | ||
} | ||
} | ||
%endif | ||
|
||
mov rdx, 0xe0000000 | ||
|
||
; This behaviour was seen around Wine 32-bit libraries | ||
; Anything doing a call to a double application would spin | ||
; the x87 stack on to the stack looking for fxam to return empty | ||
; Empty in this case is that C0 and C3 is set while C2 is not | ||
|
||
fninit | ||
; Fill the x87 stack | ||
fldz | ||
fldz | ||
fldz | ||
fldz | ||
fldz | ||
fldz | ||
fldz | ||
fldz | ||
|
||
mov eax, 0 | ||
mov ecx, 0 | ||
|
||
.ExamineStack: | ||
; Examine st(0) | ||
fxam | ||
fwait | ||
; Get the results in to AX | ||
fnstsw ax | ||
and ax, 0x4500 | ||
; Check for empty | ||
cmp ax, 0x4100 | ||
je .Done | ||
|
||
; Now push the x87 stack value | ||
; We know it isn't empty | ||
fstp qword [rdx + rcx * 8] | ||
fwait | ||
inc ecx | ||
jmp .ExamineStack | ||
|
||
.Done: | ||
; Save how many we stored | ||
mov eax, ecx | ||
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,49 @@ | ||
;; Simpler versions of FXAM_Push* tests. | ||
;; In hostrunner tests this will fail because we mentioned below there's no support | ||
;; for the zero flag. In hostrunner RCX should contain 0x4000 instead of 0x400. | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"RAX": "0x6", | ||
"RBX": "0x0400", | ||
"RCX": "0x0400", | ||
"RDX": "0x4100" | ||
} | ||
} | ||
%endif | ||
|
||
mov rdx, 0xe0000000 | ||
|
||
fninit | ||
;; Before adding anything to the stack, lets examine it. | ||
;; The result should be empty. | ||
fxam | ||
fwait | ||
|
||
fnstsw ax | ||
and ax, 0x4500 ; should be 0x4100 for zero | ||
mov edx, eax | ||
|
||
fldz | ||
fxam | ||
fwait | ||
|
||
fnstsw ax | ||
and ax, 0x4500 ; should be 0x4000 for zero, but there's no support for it at the moment, so it'll return 0x0400 as it does for a normal number. | ||
mov ecx, eax | ||
|
||
fld1 | ||
fxam | ||
fwait | ||
|
||
fnstsw ax | ||
mov ebx, eax | ||
and ebx, 0x4500 ; should be 0x0400 for normal | ||
|
||
;; Top should be 6 | ||
;; right shift status word by 11 and and with 0x7. | ||
shr eax, 11 | ||
and eax, 0x7 | ||
|
||
|
||
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,21 @@ | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"RAX": "0x3ff8000000000000", | ||
"RBX": "0x3ff8000000000000" | ||
}, | ||
"MemoryRegions": { | ||
"0x100000000": "4096" | ||
} | ||
} | ||
%endif | ||
|
||
mov rdx, 0x100000000 | ||
mov rax, 0x3ff8000000000000 ; 1.5 | ||
mov [rdx], rax | ||
|
||
fld qword [rdx] | ||
fstp qword [rdx + 8] | ||
|
||
mov rbx, [rdx + 8] | ||
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,26 @@ | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"RAX": "0x4142434445464748", | ||
"RBX": "0" | ||
} | ||
} | ||
%endif | ||
|
||
lea rax, [rel .data] | ||
lea rbx, [rel .data_mov] | ||
|
||
fld qword [rax] | ||
fstp qword [rbx] | ||
|
||
mov rax, [rbx] | ||
mov rbx, [rbx + 8] | ||
hlt | ||
|
||
.data: | ||
dq 0x4142434445464748 | ||
dq 0x5152535455565758 | ||
|
||
.data_mov: | ||
dq 0 | ||
dq 0 |
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,2 @@ | ||
## Unable to support zero flag | ||
FXAM_Simple.asm |
Oops, something went wrong.