OSDN Git Service

* path.cc (conv_path_list): Take cygwin_conv_path_t as third parameter.
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / winbase.h
1 /* winbase.h
2
3    Copyright 2002, 2003, 2004, 2008 Red Hat, Inc.
4
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
7 details. */
8
9 #include_next "winbase.h"
10
11 #ifndef _WINBASE2_H
12 #define _WINBASE2_H
13
14 extern __inline__ long
15 ilockincr (volatile long *m)
16 {
17   register int __res;
18   __asm__ __volatile__ ("\n\
19         movl    $1,%0\n\
20         lock    xadd %0,%1\n\
21         inc     %0\n\
22         ": "=&r" (__res), "=m" (*m): "m" (*m): "cc");
23   return __res;
24 }
25
26 extern __inline__ long
27 ilockdecr (volatile long *m)
28 {
29   register int __res;
30   __asm__ __volatile__ ("\n\
31         movl    $0xffffffff,%0\n\
32         lock    xadd %0,%1\n\
33         dec     %0\n\
34         ": "=&r" (__res), "=m" (*m): "m" (*m): "cc");
35   return __res;
36 }
37
38 extern __inline__ long
39 ilockexch (volatile long *t, long v)
40 {
41   return
42   ({
43     register long ret __asm ("%eax");
44     __asm __volatile ("\n"
45         "1:     lock cmpxchgl %2, %1\n"
46         "       jne  1b\n"
47         : "=a" (ret), "=m" (*t)
48         : "r" (v), "m" (*t), "0" (*t)
49         : "memory");
50     ret;
51   });
52 }
53
54 extern __inline__ long
55 ilockcmpexch (volatile long *t, long v, long c)
56 {
57   return
58   ({
59     register long ret __asm ("%eax");
60     __asm __volatile ("lock cmpxchgl %2, %1"
61         : "=a" (ret), "=m" (*t)
62         : "r" (v), "m" (*t), "0" (c)
63         : "memory");
64     ret;
65   });
66 }
67
68 #undef InterlockedIncrement
69 #define InterlockedIncrement ilockincr
70 #undef InterlockedDecrement
71 #define InterlockedDecrement ilockdecr
72 #undef InterlockedExchange
73 #define InterlockedExchange ilockexch
74 #undef InterlockedCompareExchange
75 #define InterlockedCompareExchange ilockcmpexch
76 #endif /*_WINBASE2_H*/