VirtualBox

Changeset 14073 in vbox for trunk/include


Ignore:
Timestamp:
Nov 11, 2008 12:02:14 AM (16 years ago)
Author:
vboxsync
Message:

asm.h: ASMAtomicXchgR3Ptr, ASMAtomicXchgR0Ptr, ASMAtomicXchgRCPtr.

File:
1 edited

Legend:

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

    r13925 r14073  
    26542654
    26552655
     2656/**
     2657 * Atomically Exchange a raw-mode context pointer value, ordered.
     2658 *
     2659 * @returns Current *ppv value
     2660 * @param   ppvRC   Pointer to the pointer variable to update.
     2661 * @param   pvRC    The pointer value to assign to *ppv.
     2662 */
     2663DECLINLINE(RTRCPTR) ASMAtomicXchgRCPtr(RTRCPTR volatile *ppvRC, RTRCPTR pvRC)
     2664{
     2665    return (RTRCPTR)ASMAtomicXchgU32((uint32_t volatile *)(void *)ppvRC, (uint32_t)pvRC);
     2666}
     2667
     2668
     2669/**
     2670 * Atomically Exchange a ring-0 pointer value, ordered.
     2671 *
     2672 * @returns Current *ppv value
     2673 * @param   ppvR0  Pointer to the pointer variable to update.
     2674 * @param   pvR0   The pointer value to assign to *ppv.
     2675 */
     2676DECLINLINE(RTR0PTR) ASMAtomicXchgR0Ptr(RTR0PTR volatile *ppvR0, RTR0PTR pvR0)
     2677{
     2678#if R0_ARCH_BITS == 32
     2679    return (RTR0PTR)ASMAtomicXchgU32((volatile uint32_t *)(void *)ppvR0, (uint32_t)pvR0);
     2680#elif R0_ARCH_BITS == 64
     2681    return (RTR0PTR)ASMAtomicXchgU64((volatile uint64_t *)(void *)ppvR0, (uint64_t)pvR0);
     2682#else
     2683# error "R0_ARCH_BITS is bogus"
     2684#endif
     2685}
     2686
     2687
     2688/**
     2689 * Atomically Exchange a ring-3 pointer value, ordered.
     2690 *
     2691 * @returns Current *ppv value
     2692 * @param   ppvR3  Pointer to the pointer variable to update.
     2693 * @param   pvR3   The pointer value to assign to *ppv.
     2694 */
     2695DECLINLINE(RTR3PTR) ASMAtomicXchgR3Ptr(RTR3PTR volatile *ppvR3, RTR3PTR pvR3)
     2696{
     2697#if R3_ARCH_BITS == 32
     2698    return (RTR3PTR)ASMAtomicXchgU32((volatile uint32_t *)(void *)ppvR3, (uint32_t)pvR3);
     2699#elif R3_ARCH_BITS == 64
     2700    return (RTR3PTR)ASMAtomicXchgU64((volatile uint64_t *)(void *)ppvR3, (uint64_t)pvR3);
     2701#else
     2702# error "R3_ARCH_BITS is bogus"
     2703#endif
     2704}
     2705
     2706
    26562707/** @def ASMAtomicXchgHandle
    26572708 * Atomically Exchange a typical IPRT handle value, ordered.
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