Changeset 40139 in vbox for trunk/src/VBox/VMM/testcase
- Timestamp:
- Feb 15, 2012 9:10:19 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/tstX86-1A.asm
r40138 r40139 1645 1645 call SaveFPUAndGRegsToStack 1646 1646 %1 1647 call CompareFPUAndGRegsOnStack 1647 call CompareFPUAndGRegsOnStackIgnoreOpAndIp 1648 1648 leave 1649 1649 … … 1671 1671 arch_fxrstor [xSP + 1024] 1672 1672 %2 1673 call CompareFPUAndGRegsOnStack 1673 call CompareFPUAndGRegsOnStackIgnoreOpAndIp 1674 1674 ;arch_fxrstor [xSP + 1024] 1675 1675 leave … … 1791 1791 lea xDI, [xSI + 1024] 1792 1792 1793 cld 1794 repe cmpsb 1795 je .ok 1796 1797 ;int3 1798 lea xAX, [xSP + xS*3] 1799 xchg xAX, xSI 1800 sub xAX, xSI 1801 1802 push xDX 1803 mov xDX, 1000000 1804 mul xDX 1805 pop xDX 1806 jmp .return 1807 .ok: 1808 xor eax, eax 1809 .return: 1810 pop xCX 1811 pop xDI 1812 pop xSI 1813 lea xSP, [xSP + (1024 - xS)] 1814 or eax, eax 1815 ret 1816 1817 ;; 1818 ; Same as CompareFPUAndGRegsOnStack, except that it ignores the FOP and FPUIP 1819 ; registers. 1820 ; 1821 ; @uses Stack, flags and eax/rax. 1822 ; @returns eax is zero on success, eax is 1000000 * offset on failure. 1823 ; ZF reflects the eax value to save a couple of instructions... 1824 ; 1825 CompareFPUAndGRegsOnStackIgnoreOpAndIp: 1826 lea xSP, [xSP - (1024 - xS)] 1827 call SaveFPUAndGRegsToStack 1828 1829 push xSI 1830 push xDI 1831 push xCX 1832 1833 mov xCX, 640 1834 lea xSI, [xSP + xS*3] 1835 lea xDI, [xSI + 1024] 1836 1793 1837 mov word [xSI + X86FXSTATE.FOP], 0 ; ignore 1838 mov word [xDI + X86FXSTATE.FOP], 0 ; ignore 1794 1839 mov dword [xSI + X86FXSTATE.FPUIP], 0 ; ignore 1795 mov dword [xDI + X86FXSTATE.FPU DP], 0 ; ignore1840 mov dword [xDI + X86FXSTATE.FPUIP], 0 ; ignore 1796 1841 1797 1842 cld … … 2359 2404 2360 2405 ;; 2406 ; Checks that the FPU and GReg state is completely unchanged after an instruction 2407 ; resulting in a CPU trap. 2408 ; 2409 ; @param 1 The trap number. 2410 ; @param 2+ The instruction which should trap. 2411 ; 2412 %macro FpuCheckCpuTrapUnchangedState 2+ 2413 call SaveFPUAndGRegsToStack 2414 ShouldTrap %1, %2 2415 call CompareFPUAndGRegsOnStack 2416 jz %%ok 2417 or eax, __LINE__ 2418 jmp .return 2419 %%ok: 2420 %endmacro 2421 2422 2423 ;; 2361 2424 ; Initialize the FPU and set CW to %1. 2362 2425 ; … … 2378 2441 SAVE_ALL_PROLOGUE 2379 2442 sub xSP, 2048 2380 2381 ; Make xBX (preserved accross calls) point to the invalid page.2382 mov xBX, [REF_EXTERN(g_pbEfExecPage)]2383 add xBX, PAGE_SIZE2384 2443 2385 2444 ; … … 2461 2520 2462 2521 ; ## Unmasked exceptions. ## 2463 %if 12464 2522 ; Stack underflow - TOP and ST0 unmodified. 2465 2523 FpuInitWithCW X86_FCW_PC_64 | X86_FCW_RC_NEAREST … … 2523 2581 FxSaveCheckFSW xSP, X86_FSW_DE | X86_FSW_ES | X86_FSW_B, X86_FSW_C0 | X86_FSW_C2 | X86_FSW_C3 2524 2582 FxSaveCheckSt0ValueConst xSP, REF(g_r80_One) 2525 %endif 2583 2584 ;;; @todo exception priority checks. 2585 2526 2586 2527 2587 2528 2588 ; ## A couple of variations on the #PF theme. ## 2589 2590 FpuInitWithCW X86_FCW_PC_64 | X86_FCW_RC_NEAREST 2591 mov xBX, [REF_EXTERN(g_pbEfExecPage)] 2592 FpuCheckCpuTrapUnchangedState X86_XCPT_PF, fdiv qword [xBX + PAGE_SIZE] 2593 2594 ; Check that a pending FPU exception takes precedence over a #PF. 2595 fninit 2596 fdiv qword [REF(g_r64_One)] 2597 fstcw [xSP] 2598 and word [xSP], ~(X86_FCW_IM) 2599 fldcw [xSP] 2600 mov xBX, [REF_EXTERN(g_pbEfExecPage)] 2601 ShouldTrap X86_XCPT_MF, fdiv qword [xBX + PAGE_SIZE] 2529 2602 2530 2603 .success:
Note:
See TracChangeset
for help on using the changeset viewer.