Allow compilation with older versions of GCC, in order to make it possible

to bootstrap and work with -current from older versions of FreeBSD.
This commit is contained in:
Eivind Eklund 1999-10-03 21:15:25 +00:00
parent 9b2591a0a4
commit 181d21375b
2 changed files with 46 additions and 0 deletions

View File

@ -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_ */

View File

@ -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_ */