set most of trunk svn property eol-style:native
[reactos.git] / reactos / lib / intrlck / i386 / exchange.c
1 /*
2 * PROJECT: ReactOS system libraries
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: lib/intrlck/i386/exchange.c
5 * PURPOSE: Inter lock exchanges
6 * PROGRAMMERS: Copyright 1995 Martin von Loewis
7 * Copyright 1997 Onno Hovers
8 */
9
10 /************************************************************************
11 * InterlockedExchange
12 *
13 * Atomically exchanges a pair of values.
14 *
15 * RETURNS
16 * Prior value of value pointed to by Target
17 */
18
19 /*
20 * LONG NTAPI InterlockedExchange(LPLONG target, LONG value)
21 */
22
23 #include <windows.h>
24 LONG
25 NTAPI
26 InterlockedExchange(LPLONG target, LONG value)
27 {
28 LONG ret;
29 __asm__ (
30 /* lock for SMP systems */
31 "lock\n\txchgl %0,(%1)"
32 :"=r" (ret):"r" (target), "0" (value):"memory" );
33 return ret;
34 }