VirtualBox

Changeset 103614 in vbox


Ignore:
Timestamp:
Feb 29, 2024 2:07:04 PM (11 months ago)
Author:
vboxsync
Message:

VMM/IEM: Fixed liveness state layout after r161946 broke it. Added compile time assert to help detecting this. bugref:10372 bugref:10371

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veLiveness.cpp

    r103613 r103614  
    176176        } while (0)
    177177#endif
     178
     179
     180#define IEM_LIVENESS_CR0_INPUT()                    IEM_LIVENESS_BITMAP_MEMBER_INPUT(  fCr0, 0)
     181#define IEM_LIVENESS_CR4_INPUT()                    IEM_LIVENESS_BITMAP_MEMBER_INPUT(  fCr4, 0)
     182
     183
     184#define IEM_LIVENESS_FCW_INPUT()                    IEM_LIVENESS_BITMAP_MEMBER_INPUT(  fFcw, 0)
     185#define IEM_LIVENESS_FCW_CLOBBER()                  IEM_LIVENESS_BITMAP_MEMBER_CLOBBER(fFcw, 0)
     186#define IEM_LIVENESS_FCW_MODIFY()                   IEM_LIVENESS_BITMAP_MEMBER_MODIFY( fFcw, 0)
     187
     188
     189#define IEM_LIVENESS_FSW_INPUT()                    IEM_LIVENESS_BITMAP_MEMBER_INPUT(  fFsw, 0)
     190#define IEM_LIVENESS_FSW_CLOBBER()                  IEM_LIVENESS_BITMAP_MEMBER_CLOBBER(fFsw, 0)
     191#define IEM_LIVENESS_FSW_MODIFY()                   IEM_LIVENESS_BITMAP_MEMBER_MODIFY( fFsw, 0)
    178192
    179193
     
    430444#define IEM_MC_NO_NATIVE_RECOMPILE()                                NOP()
    431445
    432 #define IEM_MC_RAISE_DIVIDE_ERROR()                                 NOP()
    433 #define IEM_MC_MAYBE_RAISE_DEVICE_NOT_AVAILABLE()                   IEM_LIVENESS_MARK_XCPT_OR_CALL()
    434 #define IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE()              IEM_LIVENESS_MARK_XCPT_OR_CALL()
    435 #define IEM_MC_MAYBE_RAISE_FPU_XCPT()                               IEM_LIVENESS_MARK_XCPT_OR_CALL()
    436 #define IEM_MC_MAYBE_RAISE_AVX_RELATED_XCPT()                       IEM_LIVENESS_MARK_XCPT_OR_CALL()
    437 #define IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT()                       IEM_LIVENESS_MARK_XCPT_OR_CALL()
    438 #define IEM_MC_MAYBE_RAISE_MMX_RELATED_XCPT()                       IEM_LIVENESS_MARK_XCPT_OR_CALL()
     446#define IEM_MC_RAISE_DIVIDE_ERROR()                                 IEM_LIVENESS_MARK_XCPT_OR_CALL()
     447#define IEM_MC_MAYBE_RAISE_DEVICE_NOT_AVAILABLE()                   IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_CR0_INPUT()
     448#define IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE() \            IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_CR0_INPUT()
     449#define IEM_MC_MAYBE_RAISE_FPU_XCPT()                               IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_FSW_INPUT()
     450#define IEM_MC_MAYBE_RAISE_AVX_RELATED_XCPT() \
     451    IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_CR0_INPUT(); IEM_LIVENESS_CR4_INPUT() //; IEM_LIVENESS_XCR0_INPUT()
     452#define IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT() \
     453    IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_CR0_INPUT(); IEM_LIVENESS_CR4_INPUT()
     454#define IEM_MC_MAYBE_RAISE_MMX_RELATED_XCPT() \
     455    IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_CR0_INPUT(); IEM_LIVENESS_FSW_INPUT()
    439456#define IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO()                          IEM_LIVENESS_MARK_XCPT_OR_CALL()
    440457#define IEM_MC_RAISE_GP0_IF_EFF_ADDR_UNALIGNED(a_EffAddr, a_cbAlign) IEM_LIVENESS_MARK_XCPT_OR_CALL()
    441 #define IEM_MC_MAYBE_RAISE_FSGSBASE_XCPT()                          IEM_LIVENESS_MARK_XCPT_OR_CALL()
     458#define IEM_MC_MAYBE_RAISE_FSGSBASE_XCPT()                          IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_CR4_INPUT()
    442459#define IEM_MC_MAYBE_RAISE_NON_CANONICAL_ADDR_GP0(a_u64Addr)        IEM_LIVENESS_MARK_XCPT_OR_CALL()
    443 #define IEM_MC_MAYBE_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT()             IEM_LIVENESS_MARK_XCPT_OR_CALL()
    444 #define IEM_MC_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT()                   IEM_LIVENESS_MARK_XCPT_OR_CALL()
     460#define IEM_MC_MAYBE_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT()             IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_CR4_INPUT() /** @todo revisit when implemented. */
     461#define IEM_MC_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT()                   IEM_LIVENESS_MARK_XCPT_OR_CALL(); IEM_LIVENESS_CR4_INPUT()
    445462
    446463#define IEM_MC_LOCAL(a_Type, a_Name)                                NOP()
  • trunk/src/VBox/VMM/include/IEMN8veRecompiler.h

    r103592 r103614  
    399399        uint64_t    bmGprs      : 16;   /**< 0x00 /  0: The 16 general purpose registers. */
    400400        uint64_t    fUnusedPc   :  1;   /**< 0x10 / 16: (PC in ) */
    401         uint64_t    uPadding1   :  3;   /**< 0x11 / 17: */
     401        uint64_t    fCr0        :  1;   /**< 0x11 / 17: */
     402        uint64_t    fFcw        :  1;   /**< 0x12 / 18: */
     403        uint64_t    fFsw        :  1;   /**< 0x13 / 19: */
    402404        uint64_t    bmSegBase   :  6;   /**< 0x14 / 20: */
    403405        uint64_t    bmSegAttrib :  6;   /**< 0x1a / 26: */
    404406        uint64_t    bmSegLimit  :  6;   /**< 0x20 / 32: */
    405407        uint64_t    bmSegSel    :  6;   /**< 0x26 / 38: */
    406         uint64_t    fEflOther   :  1;   /**< 0x2c / 44: Other EFLAGS bits   (~X86_EFL_STATUS_BITS & X86_EFL_LIVE_MASK). First! */
    407         uint64_t    fEflCf      :  1;   /**< 0x2d / 45: Carry flag          (X86_EFL_CF / 0). */
    408         uint64_t    fEflPf      :  1;   /**< 0x2e / 46: Parity flag         (X86_EFL_PF / 2). */
    409         uint64_t    fEflAf      :  1;   /**< 0x2f / 47: Auxilary carry flag (X86_EFL_AF / 4). */
    410         uint64_t    fEflZf      :  1;   /**< 0x30 / 48: Zero flag           (X86_EFL_ZF / 6). */
    411         uint64_t    fEflSf      :  1;   /**< 0x31 / 49: Signed flag         (X86_EFL_SF / 7). */
    412         uint64_t    fEflOf      :  1;   /**< 0x32 / 50: Overflow flag       (X86_EFL_OF / 12). */
    413         uint64_t    uUnused     : 13;     /* 0x33 / 51 -> 0x40/64 */
     408        uint64_t    fCr4        :  1;   /**< 0x2c / 44: */
     409        uint64_t    fEflOther   :  1;   /**< 0x2d / 45: Other EFLAGS bits   (~X86_EFL_STATUS_BITS & X86_EFL_LIVE_MASK). First! */
     410        uint64_t    fEflCf      :  1;   /**< 0x2e / 46: Carry flag          (X86_EFL_CF / 0). */
     411        uint64_t    fEflPf      :  1;   /**< 0x2f / 47: Parity flag         (X86_EFL_PF / 2). */
     412        uint64_t    fEflAf      :  1;   /**< 0x20 / 48: Auxilary carry flag (X86_EFL_AF / 4). */
     413        uint64_t    fEflZf      :  1;   /**< 0x31 / 49: Zero flag           (X86_EFL_ZF / 6). */
     414        uint64_t    fEflSf      :  1;   /**< 0x32 / 50: Signed flag         (X86_EFL_SF / 7). */
     415        uint64_t    fEflOf      :  1;   /**< 0x33 / 51: Overflow flag       (X86_EFL_OF / 12). */
     416        uint64_t    uUnused     : 12;     /* 0x34 / 52 -> 0x40/64 */
    414417    };
    415418} IEMLIVENESSBIT;
     
    473476/** @name 64-bit value masks for IEMLIVENESSENTRY.
    474477 * @{ */                                      /*         0xzzzzyyyyxxxxwwww */
    475 #define IEMLIVENESSBIT_MASK                     UINT64_C(0x0007fffffff0ffff)
     478#define IEMLIVENESSBIT_MASK                     UINT64_C(0x000ffffffffeffff)
    476479
    477480#ifndef IEMLIVENESS_EXTENDED_LAYOUT
     
    483486#endif
    484487
    485 #define IEMLIVENESSBIT_ALL_EFL_MASK             UINT64_C(0x0007f00000000000)
     488#define IEMLIVENESSBIT_ALL_EFL_MASK             UINT64_C(0x000fe00000000000)
    486489
    487490#ifndef IEMLIVENESS_EXTENDED_LAYOUT
     
    678681 * Guest registers that can be shadowed in GPRs.
    679682 *
    680  * This runs parallel to the first 128-bits of liveness state.  To avoid having
    681  * the SegLimitXxxx range cross from the 1st 64-bit word to the 2nd,
    682  * we've inserted some padding.  The EFlags must be placed last, as the liveness
    683  * state tracks it as 7 subcomponents and we don't want to waste space here.
     683 * This runs parallel to the liveness state (IEMLIVENESSBIT, ++). The EFlags
     684 * must be placed last, as the liveness state tracks it as 7 subcomponents and
     685 * we don't want to waste space here.
     686 *
     687 * @note Make sure to update IEMLIVENESSBIT, IEMLIVENESSBIT_ALL_EFL_MASK and
     688 *       friends as well as IEMAllN8veLiveness.cpp.
    684689 */
    685690typedef enum IEMNATIVEGSTREG : uint8_t
     
    704709} IEMNATIVEGSTREG;
    705710AssertCompile((int)kIemNativeGstReg_SegLimitFirst == 32);
     711AssertCompile((UINT64_C(0x7f) << kIemNativeGstReg_EFlags) == IEMLIVENESSBIT_ALL_EFL_MASK);
    706712
    707713/** @name Helpers for converting register numbers to IEMNATIVEGSTREG values.
Note: See TracChangeset for help on using the changeset viewer.

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