VirtualBox

Changeset 40069 in vbox


Ignore:
Timestamp:
Feb 10, 2012 6:05:02 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76203
Message:

Floating point testing.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/err.mac

    r39405 r40069  
    170170%define VERR_PGM_INVALID_LARGE_PAGE_RANGE    (-1645)
    171171%define VERR_PGM_PHYS_PAGE_BALLOONED    (-1646)
    172 %define VINF_PGM_SHARED_MODULE_ALREADY_REGISTERED    (1647)
    173 %define VERR_PGM_SHARED_MODULE_NOT_FOUND    (-1648)
    174 %define VINF_PGM_SHARED_MODULE_COLLISION    (1649)
    175 %define VERR_PGM_SHARED_MODULE_REGISTRATION_INCONSISTENCY    (-1650)
    176172%define VERR_PGM_MAP_MMIO2_ALIAS_MMIO    (-1651)
    177173%define VERR_PGM_MAPPINGS_DISABLED    (-1652)
     
    495491%define VERR_PDM_BAD_PCI_CONFIG    (-2887)
    496492%define VERR_PDM_DEV_IPE_1    (-2888)
     493%define VERR_PDM_MISCONFIGURED_DRV_TRANSFORMATION    (-2889)
     494%define VERR_PDM_CANNOT_TRANSFORM_REMOVED_DRIVER    (-2890)
    497495%define VERR_HGCM_SERVICE_NOT_FOUND    (-2900)
    498496%define VINF_HGCM_CLIENT_REJECTED    2901
     
    552550%define VERR_VD_DISCARD_ALIGNMENT_NOT_MET    (-3277)
    553551%define VERR_VD_DISCARD_NOT_SUPPORTED    (-3278)
     552%define VERR_VD_IMAGE_CORRUPTED    (-3279)
     553%define VERR_VD_IMAGE_REPAIR_NOT_SUPPORTED    (-3280)
     554%define VERR_VD_IMAGE_REPAIR_IMPOSSIBLE    (-3281)
    554555%define VERR_VBGL_NOT_INITIALIZED    (-3300)
    555556%define VERR_VBGL_INVALID_ADDR    (-3301)
     
    618619%define VERR_GMM_ALLOC_PAGES_IPE    (-3820)
    619620%define VERR_GMM_ACTUAL_PAGES_IPE    (-3821)
     621%define VERR_GMM_MODULE_NAME_TOO_LONG    (-3822)
     622%define VERR_GMM_MODULE_VERSION_TOO_LONG    (-3823)
     623%define VERR_GMM_TOO_MANY_REGIONS    (-3824)
     624%define VERR_GMM_TOO_MANY_PER_VM_MODULES    (-3825)
     625%define VERR_GMM_TOO_MANY_GLOBAL_MODULES    (-3826)
     626%define VINF_GMM_SHARED_MODULE_ALREADY_REGISTERED    (3827)
     627%define VERR_GMM_SHARED_MODULE_ADDRESS_CLASH    (-3828)
     628%define VERR_GMM_SHARED_MODULE_NOT_FOUND    (-3829)
     629%define VERR_GMM_BAD_SHARED_MODULE_SIZE    (-3830)
     630%define VERR_GMM_SHARED_MODULE_BAD_REGIONS_SIZE    (-3831)
    620631%define VERR_GVM_TOO_MANY_VMS    (-3900)
    621632%define VINF_GVM_NOT_BLOCKED    3901
     
    705716%define VERR_GVMM_IPE_1    (-5203)
    706717%define VERR_GVMM_IPE_2    (-5204)
     718%define VERR_IEM_INSTR_NOT_IMPLEMENTED    (-5300)
     719%define VERR_IEM_ASPECT_NOT_IMPLEMENTED    (-5391)
     720%define VERR_IEM_IPE_1    (-5392)
     721%define VERR_IEM_IPE_2    (-5393)
    707722%define VERR_EXTPACK_UNSUPPORTED_HOST_UNINSTALL    (-6000)
    708723%define VERR_EXTPACK_VBOX_VERSION_MISMATCH    (-6001)
  • trunk/include/iprt/err.mac

    r39402 r40069  
    117117%define VERR_MISSING    (-99)
    118118%define VERR_UNEXPECTED_EXCEPTION    (-22400)
     119%define VERR_BUFFER_UNDERFLOW    (-22401)
     120%define VINF_BUFFER_UNDERFLOW    22401
     121%define VERR_UNEVEN_INPUT    (-22402)
    119122%define VERR_FILE_IO_ERROR    (-100)
    120123%define VERR_OPEN_FAILED    (-101)
     
    202205%define VERR_PIPE_NOT_CONNECTED    (-305)
    203206%define VERR_MORE_DATA    (-306)
     207%define VERR_PIPE_NOT_READ    (-307)
     208%define VERR_PIPE_NOT_WRITE    (-308)
    204209%define VERR_SEM_ERROR    (-350)
    205210%define VERR_TOO_MANY_SEMAPHORES    (-351)
     
    391396%define VERR_MANIFEST_DIGEST_MISMATCH    (-902)
    392397%define VERR_MANIFEST_FILE_MISMATCH    (-903)
     398%define VERR_MANIFEST_ATTR_NOT_FOUND    (-904)
     399%define VERR_MANIFEST_ATTR_TYPE_MISMATCH    (-905)
     400%define VERR_MANIFEST_ATTR_TYPE_NOT_FOUND    (-906)
    393401%define VERR_TAR_CHKSUM_MISMATCH    (-925)
    394402%define VERR_TAR_END_OF_FILE    (-926)
     
    439447%define VERR_DVM_MAP_NO_VOLUME    (-22201)
    440448%define VERR_LOG_REVISION_MISMATCH    (-22300)
     449%define VERR_SYS_CANNOT_POWER_OFF    (-22400)
     450%define VINF_SYS_MAY_POWER_OFF    (22401)
     451%define VERR_SYS_SHUTDOWN_FAILED    (-22402)
     452%define VERR_FILESYSTEM_CORRUPT    (-22500)
  • trunk/include/iprt/x86.h

    r37955 r40069  
    21002100/** FPU busy. */
    21012101#define X86_FSW_B           RT_BIT(15)
     2102/** @} */
     2103
     2104
     2105/** @name FPU control word flags.
     2106 * @{ */
     2107/** Exception Mask: Invalid operation.  */
     2108#define X86_FCW_IM          RT_BIT(0)
     2109/** Exception Mask: Denormalized operand.  */
     2110#define X86_FCW_DM          RT_BIT(1)
     2111/** Exception Mask: Zero divide.  */
     2112#define X86_FCW_ZM          RT_BIT(2)
     2113/** Exception Mask: Overflow.  */
     2114#define X86_FCW_OM          RT_BIT(3)
     2115/** Exception Mask: Underflow.  */
     2116#define X86_FCW_UM          RT_BIT(4)
     2117/** Exception Mask: Precision.  */
     2118#define X86_FCW_PM          RT_BIT(5)
     2119/** Precision control mask. */
     2120#define X86_FCW_PC_MASK     UINT16_C(0x0300)
     2121/** Precision control: 24-bit. */
     2122#define X86_FCW_PC_24       UINT16_C(0x0000)
     2123/** Precision control: Reserved. */
     2124#define X86_FCW_PC_RSVD     UINT16_C(0x0100)
     2125/** Precision control: 53-bit. */
     2126#define X86_FCW_PC_53       UINT16_C(0x0200)
     2127/** Precision control: 64-bit. */
     2128#define X86_FCW_PC_64       UINT16_C(0x0300)
     2129/** Rounding control mask. */
     2130#define X86_FCW_RC_MASK     UINT16_C(0x0c00)
     2131/** Rounding control: To nearest. */
     2132#define X86_FCW_RC_NEAREST  UINT16_C(0x0000)
     2133/** Rounding control: Down. */
     2134#define X86_FCW_RC_DOWN     UINT16_C(0x0400)
     2135/** Rounding control: Up. */
     2136#define X86_FCW_RC_UP       UINT16_C(0x0800)
     2137/** Rounding control: Towards zero. */
     2138#define X86_FCW_RC_ZERO     UINT16_C(0x0c00)
    21022139/** @} */
    21032140
  • trunk/include/iprt/x86.mac

    r37968 r40069  
    474474%define X86_FSW_C3          RT_BIT(14)
    475475%define X86_FSW_B           RT_BIT(15)
     476%define X86_FCW_IM          RT_BIT(0)
     477%define X86_FCW_DM          RT_BIT(1)
     478%define X86_FCW_ZM          RT_BIT(2)
     479%define X86_FCW_OM          RT_BIT(3)
     480%define X86_FCW_UM          RT_BIT(4)
     481%define X86_FCW_PM          RT_BIT(5)
     482%define X86_FCW_PC_MASK     0x0300
     483%define X86_FCW_PC_24       0x0000
     484%define X86_FCW_PC_RSVD     0x0100
     485%define X86_FCW_PC_53       0x0200
     486%define X86_FCW_PC_64       0x0300
     487%define X86_FCW_RC_MASK     0x0c00
     488%define X86_FCW_RC_NEAREST  0x0000
     489%define X86_FCW_RC_DOWN     0x0400
     490%define X86_FCW_RC_UP       0x0800
     491%define X86_FCW_RC_ZERO     0x0c00
    476492%if HC_ARCH_BITS == 64
    477493%else
  • trunk/src/VBox/VMM/testcase/tstX86-1A.asm

    r40057 r40069  
    9595BEGINCODE
    9696%%resume:
     97%endmacro
     98
     99
     100;;
     101; Macro for recording a FPU instruction trapping on a following fwait.
     102;
     103; Uses stack.
     104;
     105; @param        1       The status flags that are expected to be set afterwards.
     106; @param        2       C0..C3 to mask out in case undefined.
     107; @param        3+      The instruction which should trap.
     108; @uses         eax
     109;
     110%macro FpuShouldTrap 3+
     111        fnclex
     112        %3
     113%%trap:
     114        fwait
     115%%trap_end:
     116        mov     eax, __LINE__
     117        jmp     .return
     118BEGINDATA
     119%%trapinfo: istruc TRAPINFO
     120        at TRAPINFO.uTrapPC,    RTCCPTR_DEF     %%trap
     121        at TRAPINFO.uResumePC,  RTCCPTR_DEF     %%resume
     122        at TRAPINFO.u8TrapNo,   db              X86_XCPT_MF
     123        at TRAPINFO.cbInstr,    db              (%%trap_end - %%trap)
     124iend
     125BEGINCODE
     126%%resume:
     127        FpuCheckFSW ((%1) | X86_FSW_B | X86_FSW_ES), %2
     128        fnclex
     129%endmacro
     130
     131;;
     132; Macro for recording a FPU instruction trapping on a following fwait.
     133;
     134; Uses stack.
     135;
     136; @param        1       The status flags that are expected to be set afterwards.
     137; @param        2       C0..C3 to mask out in case undefined.
     138; @uses         eax
     139;
     140%macro FpuCheckFSW 2
     141%%resume:
     142        fnstsw  ax
     143        and     eax, ~X86_FSW_TOP_MASK & ~(%2)
     144        cmp     eax, (%1)
     145        je      %%ok
     146        int3
     147        lea     eax, [eax + __LINE__ * 100000]
     148        jmp     .return
     149%%ok:
     150        fnstsw  ax
     151%endmacro
     152
     153
     154;;
     155; Checks that ST0 has a certain value
     156;
     157; @uses tword at [xSP]
     158;
     159%macro CheckSt0Value 3
     160        fstp    tword [xSP]
     161        fld     tword [xSP]
     162        cmp     dword [xSP], %1
     163        je      %%ok1
     164%%bad:
     165        mov     eax, __LINE__
     166        jmp     .return
     167%%ok1:
     168        cmp     dword [xSP + 4], %2
     169        jne     %%bad
     170        cmp     word  [xSP + 8], %3
     171        jne     %%bad
    97172%endmacro
    98173
     
    13381413; Tests some floating point exceptions and such.
    13391414;
     1415;
     1416;
    13401417BEGINPROC   x861_Test6
    13411418        SAVE_ALL_PROLOGUE
    1342         sub     xSP, 1024
    1343 
     1419        sub     xSP, 2048
     1420
     1421        ; Load some pointers.
     1422        lea     xSI, REF(.r32V1)
     1423        mov     xDI, REF_GLOBAL(g_pbEfExecPage)
     1424        add     xDI, PAGE_SIZE          ; invalid page.
     1425
     1426        ;
     1427        ; Check denormal numbers.
     1428        ; Turns out the number is loaded onto the stack even if an exception is triggered.
     1429        ;
     1430        fninit
     1431        mov     dword [xSP], X86_FCW_PC_64 | X86_FCW_RC_NEAREST
     1432        fldcw   [xSP]
     1433        FpuShouldTrap  X86_FSW_DE, 0, fld dword REF(.r32D0)
     1434        CheckSt0Value 0x00000000, 0x80000000, 0x3f7f
     1435
     1436        mov     dword [xSP], X86_FCW_PC_64 | X86_FCW_RC_NEAREST | X86_FCW_DM
     1437        fldcw   [xSP]
     1438        fld     dword REF(.r32D0)
     1439        fwait
     1440        FpuCheckFSW X86_FSW_DE, 0
     1441        CheckSt0Value 0x00000000, 0x80000000, 0x3f7f
     1442
     1443        ;
    13441444        ; stack overflow
     1445        ;
    13451446        fninit
    1346         ;mov     dword [xSP], 037fh
    1347         mov     dword [xSP], 0300h
     1447        mov     dword [xSP], X86_FCW_PC_64 | X86_FCW_RC_NEAREST
    13481448        fldcw   [xSP]
    1349         fld dword REF(.r32V1)
    1350         fld dword REF(.r32V1)
    1351         fld dword REF(.r32V1)
    1352         fld dword REF(.r32V1)
    1353         fld dword REF(.r32V1)
    1354         fld dword REF(.r32V1)
    1355         fld dword REF(.r32V1)
    1356         fld dword REF(.r32V1)
     1449        fld     qword REF(.r64V1)
     1450        fld     dword [xSI]
     1451        fld     dword [xSI]
     1452        fld     dword [xSI]
     1453        fld     dword [xSI]
     1454        fld     dword [xSI]
     1455        fld     dword [xSI]
     1456        fld     tword REF(.r80V1)
    13571457        fwait
    13581458
    1359         fld dword REF(.r32V1)
    1360         ShouldTrap X86_XCPT_MF, fwait
    1361         fnstenv [xSP]
    1362         and     word [xSP + 4], ~07fh
    1363         fldenv  [xSP]
    1364 
    1365         fld dword REF(.r32V1)
    1366         ShouldTrap X86_XCPT_MF, fwait
     1459        FpuShouldTrap  X86_FSW_IE | X86_FSW_SF | X86_FSW_C1, X86_FSW_C0 | X86_FSW_C2 | X86_FSW_C3, \
     1460                fld     dword [xSI]
     1461        CheckSt0Value 0x00000000, 0x80000000, 0x4002
     1462
     1463        FpuShouldTrap  X86_FSW_IE | X86_FSW_SF | X86_FSW_C1, X86_FSW_C0 | X86_FSW_C2 | X86_FSW_C3, \
     1464                fld     dword [xSI]
     1465        CheckSt0Value 0x00000000, 0x80000000, 0x4002
     1466
     1467        ; stack overflow vs #PF.
     1468        ShouldTrap X86_XCPT_PF, fld     dword [xDI]
     1469        fwait
     1470
     1471        ; stack overflow vs denormal number
     1472        FpuShouldTrap  X86_FSW_IE | X86_FSW_SF | X86_FSW_C1, X86_FSW_C0 | X86_FSW_C2 | X86_FSW_C3, \
     1473                fld     dword [xSI]
     1474        CheckSt0Value 0x00000000, 0x80000000, 0x4002
     1475
     1476        ;
     1477        ; Mask the overflow exception. We should get QNaN now regardless of
     1478        ; what we try to push (provided the memory is valid).
     1479        ;
     1480        mov     dword [xSP], X86_FCW_PC_64 | X86_FCW_RC_NEAREST | X86_FCW_IM
     1481        fldcw   [xSP]
     1482
     1483        fld     dword [xSI]
     1484        FpuCheckFSW X86_FSW_IE | X86_FSW_SF | X86_FSW_C1, X86_FSW_C0 | X86_FSW_C2 | X86_FSW_C3
     1485        fnclex
     1486        CheckSt0Value 0x00000000, 0xc0000000, 0xffff
     1487
     1488        fld     qword REF(.r64V1)
     1489        FpuCheckFSW X86_FSW_IE | X86_FSW_SF | X86_FSW_C1, X86_FSW_C0 | X86_FSW_C2 | X86_FSW_C3
     1490        fnclex
     1491        CheckSt0Value 0x00000000, 0xc0000000, 0xffff
     1492
     1493        ; This is includes denormal values.
     1494        fld     dword REF(.r32D0)
     1495        fwait
     1496        FpuCheckFSW X86_FSW_IE | X86_FSW_SF | X86_FSW_C1, X86_FSW_C0 | X86_FSW_C2 | X86_FSW_C3
     1497        CheckSt0Value 0x00000000, 0xc0000000, 0xffff
     1498        fnclex
    13671499
    13681500
     
    13701502        xor     eax, eax
    13711503.return:
    1372         add     xSP, 1024
     1504        add     xSP, 2048
    13731505        SAVE_ALL_EPILOGUE
    13741506        ret
     
    13771509.r64V1: dq 6.4
    13781510.r80V1: dt 8.0
     1511
     1512; Denormal numbers.
     1513.r32D0: dd 0200000h
    13791514
    13801515ENDPROC     x861_Test6
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette