1 /* Low-level functions for atomic operations. ARM version.
2 Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 #define _ATOMICITY_H 1
27 __attribute__ ((unused))
28 exchange_and_add (volatile uint32_t *mem, int val)
34 "0:\tldr\t%0,[%3]\n\t"
38 "swpne\t%1,%2,[%3]\n\t"
40 : "=&r" (result), "=&r" (tmp1), "=&r" (tmp2)
47 __attribute__ ((unused))
48 atomic_add (volatile uint32_t *mem, int val)
54 "0:\tldr\t%0,[%3]\n\t"
58 "swpne\t%1,%2,[%3]\n\t"
60 : "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3)
66 __attribute__ ((unused))
67 compare_and_swap (volatile long int *p, long int oldval, long int newval)
71 "0:\tldr\t%1,[%2]\n\t"
77 "swpne\t%1,%0,[%2]\n\t"
81 : "=&r" (result), "=&r" (tmp)
82 : "r" (p), "r" (newval), "r" (oldval)
87 #endif /* atomicity.h */