#include <SysThread.h>
Defines | |
| #define | SYSATOMICADD32(locationP, addvalue) |
| #define | SYSATOMICAND32(locationP, andvalue) |
| #define | SYSATOMICCMPXCHG32(locationP, oldvalue, newvalue) |
| #define | SYSATOMICDEC32(locationP) SYSATOMICADD32(locationP,-1) |
| #define | SYSATOMICINC32(locationP) SYSATOMICADD32(locationP,1) |
| #define | SYSATOMICOR32(locationP, orvalue) |
| #define | SYSATOMICSUB32(locationP, subvalue) |
Functions | |
| int32_t | SysAtomicAdd32 (volatile int32_t *location, int32_t addvalue) |
| uint32_t | SysAtomicAnd32 (volatile uint32_t *location, uint32_t andvalue) |
| uint32_t | SysAtomicCompareAndSwap32 (volatile uint32_t *location, uint32_t oldvalue, uint32_t newvalue) |
| int32_t | SysAtomicDec32 (volatile int32_t *location) |
| int32_t | SysAtomicInc32 (volatile int32_t *location) |
| uint32_t | SysAtomicOr32 (volatile uint32_t *location, uint32_t orvalue) |
| int32_t | SysAtomicSub32 (volatile int32_t *location, int32_t subvalue) |
|
|
Value: ({ \
int32_t res; \
asm volatile \
( \
"1:" \
"mov %2, %%ecx;" \
"mov (%1), %0;" \
"add %0, %%ecx;" \
"lock; cmpxchg %%ecx, (%1);" \
"jnz 1b" \
: "=&a"(res) \
: "r"(locationP), "r"(addvalue) \
: "%ecx" \
); \
res; \
})
|
|
|
Value: ({ \
uint32_t res; \
asm volatile \
( \
"1:" \
"mov %2, %%ecx;" \
"mov (%1), %0;" \
"and %0, %%ecx;" \
"lock; cmpxchg %%ecx, (%1);" \
"jnz 1b" \
: "=&a"(res) \
: "r"(locationP), "r"(andvalue) \
: "%ecx" \
); \
res; \
})
|
|
|
Value: ({ \
uint32_t success; \
asm volatile \
( \
"lock; cmpxchg %%ecx, (%%edx);" \
" sete %%al;" \
" andl $1, %%eax" \
: "=a" (success) \
: "a" (oldvalue), "c" (newvalue), "d" (location)\
); \
success; \
})
|
|
|
|
|
|
|
|
|
Value: ({ \
uint32_t res; \
asm volatile \
( \
"1:" \
"mov %2, %%ecx;" \
"mov (%1), %0;" \
"or %0, %%ecx;" \
"lock; cmpxchg %%ecx, (%1);" \
"jnz 1b" \
: "=&a"(res) \
: "r"(locationP), "r"(orvalue) \
: "%ecx" \
); \
res; \
})
|
|
|
Value: ({ \
int32_t res; \
asm volatile \
( \
"1:" \
"mov %2, %%ecx;" \
"mov (%1), %0;" \
"sub %0, %%ecx;" \
"lock; cmpxchg %%ecx, (%1);" \
"jnz 1b" \
: "=&a"(res) \
: "r"(locationP), "r"(subvalue) \
: "%ecx" \
); \
res; \
})
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|