VirtualBox

Changeset 47432 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Jul 27, 2013 12:35:49 AM (11 years ago)
Author:
vboxsync
Message:

HMR0VMX.cpp: Attempt to fix incorrect DR7 and DR[0-3] checks in I/O port path.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/x86.h

    r47406 r47432  
    738738/** Bit 3 - B3 - Breakpoint 3 condition detected. */
    739739#define X86_DR6_B3                          RT_BIT(3)
     740/** Mask of all the Bx bits. */
     741#define X86_DR6_B_MASK                      UINT64_C(0x0000000f)
    740742/** Bit 13 - BD - Debug register access detected. Corresponds to the X86_DR7_GD bit. */
    741743#define X86_DR6_BD                          RT_BIT(13)
     
    753755#define X86_DR6_MBZ_MASK                    UINT64_C(0xffffffff00000000)
    754756/** @} */
     757
     758/** Get the DR6.Bx bit for a the given breakpoint. */
     759#define X86_DR6_B(iBp)                      RT_BIT_64(iBp)
    755760
    756761
     
    815820#define X86_DR7_G(iBp)                      ( UINT32_C(1) << (iBp * 2 + 1) )
    816821
     822/** Calcs the L and G bits of Nth breakpoint.
     823 * @param   iBp     The breakpoint number [0..3].
     824 */
     825#define X86_DR7_L_G(iBp)                    ( UINT32_C(3) << (iBp * 2) )
     826
    817827/** @name Read/Write values.
    818828 * @{ */
     
    833843#define X86_DR7_RW(iBp, fRw)                ( (fRw) << ((iBp) * 4 + 16) )
    834844
     845/** Fetch the the R/Wx bits for a given breakpoint (so it can be compared with
     846 * one of the X86_DR7_RW_XXX constants).
     847 *
     848 * @returns X86_DR7_RW_XXX
     849 * @param   uDR7    DR7 value
     850 * @param   iBp     The breakpoint number [0..3].
     851 */
     852#define X86_DR7_GET_RW(uDR7, iBp)            ( ( (uDR7) >> ((iBp) * 4 + 16) ) & UINT32_C(3) )
     853
     854/** R/W0, R/W1, R/W2, and R/W3. */
     855#define X86_DR7_RW_ALL_MASKS                UINT32_C(0x33330000)
     856
     857/** Checks if there are any I/O breakpoint types configured in the RW
     858 * registers.  Does NOT check if these are enabled, sorry. */
     859#define X86_DR7_ANY_RW_IO(uDR7) \
     860    (   (    UINT32_C(0x22220000) & (uDR7) ) /* any candidates? */ \
     861     && ( ( (UINT32_C(0x22220000) & (uDR7) ) >> 1 )  &  ~(uDR7) ) )
     862AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x33330000)) == 0);
     863AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x22220000)) == 1);
     864AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x32320000)) == 1);
     865AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x23230000)) == 1);
     866AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00000000)) == 0);
     867AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00010000)) == 0);
     868AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00020000)) == 1);
     869AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00030000)) == 0);
     870AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00040000)) == 0);
     871
    835872/** @name Length values.
    836873 * @{ */
     
    851888 * @param   iBp     The breakpoint number [0..3].
    852889 */
    853 #define X86_DR7_GET_LEN(uDR7, iBp)          ( ( (uDR7) >> ((iBp) * 4 + 18) ) & 0x3U)
     890#define X86_DR7_GET_LEN(uDR7, iBp)          ( ( (uDR7) >> ((iBp) * 4 + 18) ) & UINT32_C(0x3) )
    854891
    855892/** Mask used to check if any breakpoints are enabled. */
    856 #define X86_DR7_ENABLED_MASK                (RT_BIT(0) | RT_BIT(1) | RT_BIT(2) | RT_BIT(3) | RT_BIT(4) | RT_BIT(5) | RT_BIT(6) | RT_BIT(7))
    857 
    858 /** Mask used to check if any io breakpoints are set. */
    859 #define X86_DR7_IO_ENABLED_MASK             (X86_DR7_RW(0, X86_DR7_RW_IO) | X86_DR7_RW(1, X86_DR7_RW_IO) | X86_DR7_RW(2, X86_DR7_RW_IO) | X86_DR7_RW(3, X86_DR7_RW_IO))
     893#define X86_DR7_ENABLED_MASK                UINT32_C(0x000000ff)
    860894
    861895/** Value of DR7 after powerup/reset. */
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