9e7f70a4bfb8ba9c9e95f61cd22bd05a179cdf11
[cacao.git] / src / mm / boehm-gc / libatomic_ops-1.2 / src / atomic_ops / sysdeps / gcc / m68k.h
1 /* 
2  * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
3  * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
4  * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
5  *
6  *
7  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
9  *
10  * Permission is hereby granted to use or copy this program
11  * for any purpose,  provided the above notices are retained on all copies.
12  * Permission to modify the code and to distribute modified code is granted,
13  * provided the above notices are retained, and a notice that the code was
14  * modified is included with the above copyright notice.
15  *
16  */
17
18 /* FIXME.  Very incomplete.  */
19 #include "../all_aligned_atomic_load_store.h"
20
21 /* Are there any m68k multiprocessors still around?     */
22 /* AFAIK, Alliants were sequentially consistent.        */
23 #include "../ordered.h"
24
25 #include "../test_and_set_t_is_ao_t.h"
26
27 /* Contributed by Tony Mantler or new.  Should be changed to MIT license? */
28 AO_INLINE AO_TS_VAL_t
29 AO_test_and_set_full(volatile AO_TS_t *addr) {
30   int oldval;
31
32   /* The return value is semi-phony. */
33   /* 'tas' sets bit 7 while the return */
34   /* value pretends bit 0 was set */
35   __asm__ __volatile__(
36                  "tas %1@; sne %0; negb %0"
37                  : "=d" (oldval)
38                  : "a" (addr) : "memory");
39    return oldval;
40 }
41
42 #define AO_HAVE_test_and_set_full
43
44
45