1 // locks.h - Thread synchronization primitives. SuperH implementation.
3 /* Copyright (C) 2002, 2007 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 #ifndef __SYSDEP_LOCKS_H__
12 #define __SYSDEP_LOCKS_H__
14 typedef size_t obj_addr_t
; /* Integer type big enough for object */
17 static unsigned char __cas_lock
= 0;
20 __cas_start_atomic (void)
25 __asm__
__volatile__ ("tas.b @%1; movt %0"
33 __cas_end_atomic (void)
35 __asm__
__volatile__ (" " : : : "memory");
40 compare_and_swap (volatile obj_addr_t
*addr
, obj_addr_t old
,
45 __cas_start_atomic ();
59 release_set (volatile obj_addr_t
*addr
, obj_addr_t new_val
)
61 __asm__
__volatile__ (" " : : : "memory");
66 compare_and_swap_release (volatile obj_addr_t
*addr
, obj_addr_t old
,
69 return compare_and_swap (addr
, old
, new_val
);
75 __asm__
__volatile__(" " : : : "memory");
81 __asm__
__volatile__(" " : : : "memory");
84 #endif /* ! __SYSDEP_LOCKS_H__ */