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.
7 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
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.
18 /* The cas instruction causes an emulation trap for the */
19 /* 060 with a misaligned pointer, so let's avoid this. */
21 typedef unsigned long AO_t __attribute__ ((aligned (4)));
23 /* FIXME. Very incomplete. */
24 #include "../all_aligned_atomic_load_store.h"
26 /* Are there any m68k multiprocessors still around? */
27 /* AFAIK, Alliants were sequentially consistent. */
28 #include "../ordered.h"
30 #include "../test_and_set_t_is_char.h"
32 /* Contributed by Tony Mantler or new. Should be changed to MIT license? */
34 AO_test_and_set_full(volatile AO_TS_t *addr) {
37 /* The value at addr is semi-phony. */
38 /* 'tas' sets bit 7 while the return */
39 /* value pretends all bits were set, */
40 /* which at least matches AO_TS_SET. */
43 : "=d" (oldval), "=m" (*addr)
46 /* This cast works due to the above. */
47 return (AO_TS_VAL_t)oldval;
49 #define AO_HAVE_test_and_set_full
51 /* Returns nonzero if the comparison succeeded. */
53 AO_compare_and_swap_full(volatile AO_t *addr,
54 AO_t old, AO_t new_val)
59 "cas.l %3,%4,%1; seq %0"
60 : "=d" (result), "=m" (*addr)
61 : "m" (*addr), "d" (old), "d" (new_val)
65 #define AO_HAVE_compare_and_swap_full
67 #include "../ao_t_is_int.h"