Changeset 19177 in vbox
- Timestamp:
- Apr 24, 2009 6:29:25 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 46489
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cdefs.h
r19167 r19177 1536 1536 /** @def VALID_PTR 1537 1537 * Pointer validation macro. 1538 * @param ptr 1538 * @param ptr The pointer. 1539 1539 */ 1540 1540 #if defined(RT_ARCH_AMD64) 1541 1541 # ifdef IN_RING3 1542 1542 # if defined(RT_OS_DARWIN) /* first 4GB is reserved for legacy kernel. */ 1543 # define VALID_PTR(ptr)( (uintptr_t)(ptr) >= _4G \1544 && !((uintptr_t)(ptr) & 0xffff800000000000ULL) )1543 # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) >= _4G \ 1544 && !((uintptr_t)(ptr) & 0xffff800000000000ULL) ) 1545 1545 # elif defined(RT_OS_SOLARIS) /* The kernel only used the top 2TB, but keep it simple. */ 1546 # define VALID_PTR(ptr)( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \1547 && ( ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0xffff800000000000ULL \1548 || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) )1546 # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \ 1547 && ( ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0xffff800000000000ULL \ 1548 || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) ) 1549 1549 # else 1550 # define VALID_PTR(ptr)( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \1551 && !((uintptr_t)(ptr) & 0xffff800000000000ULL) )1550 # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \ 1551 && !((uintptr_t)(ptr) & 0xffff800000000000ULL) ) 1552 1552 # endif 1553 1553 # else /* !IN_RING3 */ 1554 # define VALID_PTR(ptr)( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \1555 && ( ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0xffff800000000000ULL \1556 || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) )1554 # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \ 1555 && ( ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0xffff800000000000ULL \ 1556 || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) ) 1557 1557 # endif /* !IN_RING3 */ 1558 1558 #elif defined(RT_ARCH_X86) 1559 # define VALID_PTR(ptr)( (uintptr_t)(ptr) + 0x1000U >= 0x2000U )1559 # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U ) 1560 1560 #else 1561 1561 # error "Architecture identifier missing / not implemented." 1562 1562 #endif 1563 1564 /** Old name for RT_VALID_PTR. */ 1565 #define VALID_PTR(ptr) RT_VALID_PTR(ptr) 1566 1567 /** @def RT_VALID_ALIGNED_PTR 1568 * Pointer validation macro that also checks the alignment. 1569 * @param ptr The pointer. 1570 * @param align The alignment, must be a power of two. 1571 */ 1572 #define RT_VALID_ALIGNED_PTR(ptr, align) \ 1573 ( !((uintptr_t)(ptr) & (uintptr_t)((align) - 1)) \ 1574 && VALID_PTR(ptr) ) 1563 1575 1564 1576
Note:
See TracChangeset
for help on using the changeset viewer.