OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [sysdep/] [ia64/] [locks.h] - Blame information for rev 830

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 764 jeremybenn
// locks.h - Thread synchronization primitives. IA64 implementation.
2
 
3
/* Copyright (C) 2002  Free Software Foundation
4
 
5
   This file is part of libgcj.
6
 
7
This software is copyrighted work licensed under the terms of the
8
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9
details.  */
10
 
11
#ifndef __SYSDEP_LOCKS_H__
12
#define __SYSDEP_LOCKS_H__
13
 
14
#include <ia64intrin.h>
15
 
16
typedef size_t obj_addr_t;      /* Integer type big enough for object   */
17
                                /* address.                             */
18
 
19
inline static bool
20
compare_and_swap(volatile obj_addr_t *addr,
21
                                              obj_addr_t old,
22
                                              obj_addr_t new_val)
23
{
24
  return __sync_bool_compare_and_swap (addr, old, new_val);
25
}
26
 
27
// The fact that *addr is volatile should cause the compiler to
28
// automatically generate an st8.rel.
29
inline static void
30
release_set(volatile obj_addr_t *addr, obj_addr_t new_val)
31
{
32
  __asm__ __volatile__("" : : : "memory");
33
  *(addr) = new_val;
34
}
35
 
36
inline static bool
37
compare_and_swap_release(volatile obj_addr_t *addr,
38
                                                     obj_addr_t old,
39
                                                     obj_addr_t new_val)
40
{
41
  register unsigned long ar_ccv __asm__("ar.ccv") = old;
42
  unsigned long out;
43
  __asm__ __volatile__("cmpxchg8.rel %0=%1,%2,%4"
44
              : "=r"(out), "=m"(*addr)
45
              : "r"(new_val), "m"(*addr), "d"(ar_ccv) : "memory");
46
  return (out == old);
47
}
48
 
49
inline static void
50
read_barrier()
51
{
52
  __sync_synchronize ();
53
}
54
 
55
inline static void
56
write_barrier()
57
{
58
  __sync_synchronize ();
59
}
60
 
61
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.