VirtualBox

Changeset 90168 in vbox


Ignore:
Timestamp:
Jul 13, 2021 2:25:40 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145680
Message:

iprt/cdefs.h: Adjusted the RT_VALID_PTR versions for linux/AMD64 to account for possible use of 5-level paging. bugref:10064

File:
1 edited

Legend:

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

    r89076 r90168  
    42844284                                 && (   ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0xffff800000000000ULL \
    42854285                                     || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) )
     4286#  elif defined(RT_OS_LINUX) /* May use 5-level paging  (see Documentation/x86/x86_64/mm.rst). */
     4287#   define RT_VALID_PTR(ptr)    (   (uintptr_t)(ptr) >= 0x1000U /* one invalid page at the bottom */ \
     4288                                 && !((uintptr_t)(ptr) & 0xff00000000000000ULL) )
    42864289#  else
    4287 #   define RT_VALID_PTR(ptr)    (   (uintptr_t)(ptr) + 0x1000U >= 0x2000U \
     4290#   define RT_VALID_PTR(ptr)    (   (uintptr_t)(ptr) >= 0x1000U \
    42884291                                 && !((uintptr_t)(ptr) & 0xffff800000000000ULL) )
    42894292#  endif
    42904293# else /* !IN_RING3 */
    4291 #  define RT_VALID_PTR(ptr)     (   (uintptr_t)(ptr) + 0x1000U >= 0x2000U \
     4294#  if defined(RT_OS_LINUX) /* May use 5-level paging (see Documentation/x86/x86_64/mm.rst). */
     4295#   define RT_VALID_PTR(ptr)    (   (uintptr_t)(ptr) + 0x200000 >= 0x201000U /* one invalid page at the bottom and 2MB at the top */ \
     4296                                 && (   ((uintptr_t)(ptr) & 0xff00000000000000ULL) == 0xff00000000000000ULL \
     4297                                     || ((uintptr_t)(ptr) & 0xff00000000000000ULL) == 0) )
     4298#  else
     4299#   define RT_VALID_PTR(ptr)    (   (uintptr_t)(ptr) + 0x1000U >= 0x2000U \
    42924300                                 && (   ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0xffff800000000000ULL \
    42934301                                     || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) )
     4302#  endif
    42944303# endif /* !IN_RING3 */
    42954304
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