1 /* $Id: interlock.c,v 1.2 2002/02/20 09:17:57 hyperion Exp $
4 * COPYRIGHT: See COPYING in the top level directory
5 * PROJECT: ReactOS POSIX+ Subsystem
6 * FILE: subsys/psx/lib/psxdll/misc/interlock.c
7 * PURPOSE: inter-locked increments/decrements
8 * PROGRAMMER: KJK::Hyperion <noog@libero.it>
10 * 20/01/2002: Adapted from lib/kernel32/synch/intrlck.c
14 * NOTE by KJK::Hyperion: I do not understand what's behind these functions.
15 * Don't ask me how they work, or to fix errors in them.
16 * Please refer to the authors referenced in the original
17 * file, lib/kernel32/synch/intrlck.c
20 /* TODO? move these in some shared library */
22 #include <psx/interlock.h>
24 int __interlock_inc(int * addend
)
30 " lock\n" /* for SMP systems */
38 :"=r" (ret
):"r" (addend
), "0" (0): "memory"
44 int __interlock_dec(int * addend
)
50 " lock\n" /* for SMP systems */
58 :"=r" (ret
):"r" (addend
), "0" (0): "memory"
65 int __interlock_add(int * addend
, int increment
)
71 " lock\n" /* for SMP systems */
74 :"r" (addend
), "0" (increment
)