diff options
author | eivind <eivind@FreeBSD.org> | 1999-10-03 21:15:25 +0000 |
---|---|---|
committer | eivind <eivind@FreeBSD.org> | 1999-10-03 21:15:25 +0000 |
commit | f53ad097bbea091dba9cb5af1e44f111feda2101 (patch) | |
tree | 00d04ccd06c69b9e1d72d9962e7f9215502efa18 /sys/amd64/include/atomic.h | |
parent | 9a5996a307b039347019c86523d3b37e893b7b9d (diff) | |
download | FreeBSD-src-f53ad097bbea091dba9cb5af1e44f111feda2101.zip FreeBSD-src-f53ad097bbea091dba9cb5af1e44f111feda2101.tar.gz |
Allow compilation with older versions of GCC, in order to make it possible
to bootstrap and work with -current from older versions of FreeBSD.
Diffstat (limited to 'sys/amd64/include/atomic.h')
-rw-r--r-- | sys/amd64/include/atomic.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h index b3fd514..41b08c0 100644 --- a/sys/amd64/include/atomic.h +++ b/sys/amd64/include/atomic.h @@ -86,6 +86,7 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ } #endif /* KLD_MODULE */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR_ > 9) ATOMIC_ASM(set, char, "orb %2,%0", v) ATOMIC_ASM(clear, char, "andb %2,%0", ~v) ATOMIC_ASM(add, char, "addb %2,%0", v) @@ -106,4 +107,26 @@ ATOMIC_ASM(clear, long, "andl %2,%0", ~v) ATOMIC_ASM(add, long, "addl %2,%0", v) ATOMIC_ASM(subtract, long, "subl %2,%0", v) +#else +#define atomic_set_char(P, V) (*(u_char*)(P) |= (V)) +#define atomic_clear_char(P, V) (*(u_char*)(P) &= ~(V)) +#define atomic_add_char(P, V) (*(u_char*)(P) += (V)) +#define atomic_subtract_char(P, V) (*(u_char*)(P) -= (V)) + +#define atomic_set_short(P, V) (*(u_short*)(P) |= (V)) +#define atomic_clear_short(P, V) (*(u_short*)(P) &= ~(V)) +#define atomic_add_short(P, V) (*(u_short*)(P) += (V)) +#define atomic_subtract_short(P, V) (*(u_short*)(P) -= (V)) + +#define atomic_set_int(P, V) (*(u_int*)(P) |= (V)) +#define atomic_clear_int(P, V) (*(u_int*)(P) &= ~(V)) +#define atomic_add_int(P, V) (*(u_int*)(P) += (V)) +#define atomic_subtract_int(P, V) (*(u_int*)(P) -= (V)) + +#define atomic_set_long(P, V) (*(u_long*)(P) |= (V)) +#define atomic_clear_long(P, V) (*(u_long*)(P) &= ~(V)) +#define atomic_add_long(P, V) (*(u_long*)(P) += (V)) +#define atomic_subtract_long(P, V) (*(u_long*)(P) -= (V)) +#endif + #endif /* ! _MACHINE_ATOMIC_H_ */ |