From: Kenn H. <ke...@us...> - 2003-02-17 20:04:24
|
Update of /cvsroot/linux-vax/kernel-2.5/include/asm-vax In directory sc8-pr-cvs1:/tmp/cvs-serv5158/include/asm-vax Modified Files: system.h Log Message: Need a definition of cmpxchg() in 2.5.37 Index: system.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/include/asm-vax/system.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- system.h 14 Feb 2003 02:21:02 -0000 1.9 +++ system.h 17 Feb 2003 20:04:17 -0000 1.10 @@ -38,6 +38,24 @@ extern void __switch_to(struct task_struct*, struct task_struct*); #define switch_to(prev, next, last) __switch_to((prev), (next)) +/* + * Atomic compare and exchange. Compare OLD with MEM, if identical, + * store NEW in MEM. Return the initial value in MEM. Success is + * indicated by comparing RETURN with OLD. + */ + +#define cmpxchg(ptr, old, new) ({ \ + unsigned long flags; \ + __typeof__(*(ptr)) cur; \ + local_irq_save(flags); \ + cur = *(ptr); \ + if (cur == (old)) { \ + *(ptr) = (new); \ + } \ + local_irq_restore(flags); \ + cur; \ +}) + /* mb is the alpha instruction to cause serialisation of memory operations. According to a software note in section 5.5.4 of part I of the alpha arch handbook (p/no ey-l520e-dp) we dont |