Ignore:
Timestamp:
Sep 10, 2004, 9:39:57 AM (21 years ago)
Author:
bird
Message:

Going to bed. something is still broken.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/386/builtin.h

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r1487 r1488  
    299299
    300300
     301/**
     302 * Atomically compare and exchange a 32-bit word.
     303 *
     304 * @returns 1 if changed, 0 if unchanged (i.e. boolean).
     305 * @param   pu32    Pointer to the value to compare & exchange.
     306 * @param   u32New  The new value.
     307 * @param   u32Cur  The current value. Only update if *pu32 equals this one.
     308 */
     309static inline unsigned __atomic_cmpxchg32(volatile uint32_t *pu32, uint32_t u32New, uint32_t u32Old)
     310{
     311    __asm__ __volatile__("lock  cmpxchgl %2, %1\n\t"
     312                         "setz  %%al\n\t"
     313                         "movzx %%al, %%eax\n\t"
     314                         : "=a" (u32Old),
     315                           "=m" (*pu32)
     316                         : "r"  (u32New),
     317                           "0" (u32Old));
     318    return (unsigned)u32Old;
     319}
     320
     321
    301322#define __ROTATE_FUN(F,I,T) \
    302323  static __inline__ T F (T value, int shift) \
Note: See TracChangeset for help on using the changeset viewer.