PAPI 7.1.0.0
Loading...
Searching...
No Matches
m68k.h
Go to the documentation of this file.
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/* The cas instruction causes an emulation trap for the */
19/* 060 with a misaligned pointer, so let's avoid this. */
20#undef AO_t
21typedef unsigned long AO_t __attribute__((__aligned__(4)));
22
23/* FIXME. Very incomplete. */
24#include "../all_aligned_atomic_load_store.h"
25
26/* Are there any m68k multiprocessors still around? */
27/* AFAIK, Alliants were sequentially consistent. */
28#include "../ordered.h"
29
30#include "../test_and_set_t_is_char.h"
31
34 AO_TS_t oldval;
35
36 /* The value at addr is semi-phony. */
37 /* 'tas' sets bit 7 while the return */
38 /* value pretends all bits were set, */
39 /* which at least matches AO_TS_SET. */
40 __asm__ __volatile__(
41 "tas %1; sne %0"
42 : "=d" (oldval), "=m" (*addr)
43 : "m" (*addr)
44 : "memory");
45 /* This cast works due to the above. */
46 return (AO_TS_VAL_t)oldval;
47}
48#define AO_HAVE_test_and_set_full
49
50/* Returns nonzero if the comparison succeeded. */
51AO_INLINE int
53 AO_t old, AO_t new_val)
54{
55 char result;
56
57 __asm__ __volatile__(
58 "cas.l %3,%4,%1; seq %0"
59 : "=d" (result), "=m" (*addr)
60 : "m" (*addr), "d" (old), "d" (new_val)
61 : "memory");
62 return -result;
63}
64#define AO_HAVE_compare_and_swap_full
65
66/* TODO: implement AO_fetch_compare_and_swap. */
67
68#define AO_T_IS_INT
volatile int result
#define AO_t
Definition: atomic_ops.h:156
#define AO_INLINE
Definition: atomic_ops.h:186
#define AO_TS_t
Definition: gcc/hppa.h:39
#define AO_TS_VAL_t
Definition: gcc/hppa.h:44
AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val)
Definition: m68k.h:52
AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr)
Definition: m68k.h:33
unsigned long AO_t __attribute__((__aligned__(4)))
Definition: m68k.h:21