Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7eef40d4
Commit
7eef40d4
authored
May 02, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libport: Get rid of interlocked functions.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2633a5c1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
134 deletions
+1
-134
port.h
include/wine/port.h
+0
-132
Makefile.in
libs/port/Makefile.in
+0
-1
interlocked.c
libs/port/interlocked.c
+0
-0
debug.c
libs/wine/debug.c
+1
-1
No files found.
include/wine/port.h
View file @
7eef40d4
...
...
@@ -352,133 +352,6 @@ int usleep (unsigned int useconds);
extern
int
mkstemps
(
char
*
template
,
int
suffix_len
);
/* Interlocked functions */
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
static
inline
int
interlocked_cmpxchg
(
int
*
dest
,
int
xchg
,
int
compare
)
{
int
ret
;
__asm__
__volatile__
(
"lock; cmpxchgl %2,(%1)"
:
"=a"
(
ret
)
:
"r"
(
dest
),
"r"
(
xchg
),
"0"
(
compare
)
:
"memory"
);
return
ret
;
}
static
inline
void
*
interlocked_cmpxchg_ptr
(
void
**
dest
,
void
*
xchg
,
void
*
compare
)
{
void
*
ret
;
#ifdef __x86_64__
__asm__
__volatile__
(
"lock; cmpxchgq %2,(%1)"
:
"=a"
(
ret
)
:
"r"
(
dest
),
"r"
(
xchg
),
"0"
(
compare
)
:
"memory"
);
#else
__asm__
__volatile__
(
"lock; cmpxchgl %2,(%1)"
:
"=a"
(
ret
)
:
"r"
(
dest
),
"r"
(
xchg
),
"0"
(
compare
)
:
"memory"
);
#endif
return
ret
;
}
static
inline
int
interlocked_xchg
(
int
*
dest
,
int
val
)
{
int
ret
;
__asm__
__volatile__
(
"lock; xchgl %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
return
ret
;
}
static
inline
void
*
interlocked_xchg_ptr
(
void
**
dest
,
void
*
val
)
{
void
*
ret
;
#ifdef __x86_64__
__asm__
__volatile__
(
"lock; xchgq %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
#else
__asm__
__volatile__
(
"lock; xchgl %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
#endif
return
ret
;
}
static
inline
int
interlocked_xchg_add
(
int
*
dest
,
int
incr
)
{
int
ret
;
__asm__
__volatile__
(
"lock; xaddl %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
incr
)
:
"memory"
);
return
ret
;
}
#ifdef __x86_64__
static
inline
unsigned
char
interlocked_cmpxchg128
(
__int64
*
dest
,
__int64
xchg_high
,
__int64
xchg_low
,
__int64
*
compare
)
{
unsigned
char
ret
;
__asm__
__volatile__
(
"lock cmpxchg16b %0; setz %b2"
:
"=m"
(
dest
[
0
]),
"=m"
(
dest
[
1
]),
"=r"
(
ret
),
"=a"
(
compare
[
0
]),
"=d"
(
compare
[
1
])
:
"m"
(
dest
[
0
]),
"m"
(
dest
[
1
]),
"3"
(
compare
[
0
]),
"4"
(
compare
[
1
]),
"c"
(
xchg_high
),
"b"
(
xchg_low
)
);
return
ret
;
}
#endif
#else
/* __GNUC__ */
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
static
inline
int
interlocked_cmpxchg
(
int
*
dest
,
int
xchg
,
int
compare
)
{
return
__sync_val_compare_and_swap
(
dest
,
compare
,
xchg
);
}
static
inline
int
interlocked_xchg_add
(
int
*
dest
,
int
incr
)
{
return
__sync_fetch_and_add
(
dest
,
incr
);
}
static
inline
int
interlocked_xchg
(
int
*
dest
,
int
val
)
{
int
ret
;
do
ret
=
*
dest
;
while
(
!
__sync_bool_compare_and_swap
(
dest
,
ret
,
val
));
return
ret
;
}
#else
extern
int
interlocked_cmpxchg
(
int
*
dest
,
int
xchg
,
int
compare
);
extern
int
interlocked_xchg_add
(
int
*
dest
,
int
incr
);
extern
int
interlocked_xchg
(
int
*
dest
,
int
val
);
#endif
#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) && __SIZEOF_POINTER__ == 4) \
|| (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) && __SIZEOF_POINTER__ == 8)
static
inline
void
*
interlocked_cmpxchg_ptr
(
void
**
dest
,
void
*
xchg
,
void
*
compare
)
{
return
__sync_val_compare_and_swap
(
dest
,
compare
,
xchg
);
}
static
inline
void
*
interlocked_xchg_ptr
(
void
**
dest
,
void
*
val
)
{
void
*
ret
;
do
ret
=
*
dest
;
while
(
!
__sync_bool_compare_and_swap
(
dest
,
ret
,
val
));
return
ret
;
}
#else
extern
void
*
interlocked_cmpxchg_ptr
(
void
**
dest
,
void
*
xchg
,
void
*
compare
);
extern
void
*
interlocked_xchg_ptr
(
void
**
dest
,
void
*
val
);
#endif
#if defined(__x86_64__) || defined(__aarch64__) || defined(_WIN64)
extern
unsigned
char
interlocked_cmpxchg128
(
__int64
*
dest
,
__int64
xchg_high
,
__int64
xchg_low
,
__int64
*
compare
);
#endif
#endif
/* __GNUC__ */
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
static
inline
__int64
interlocked_cmpxchg64
(
__int64
*
dest
,
__int64
xchg
,
__int64
compare
)
{
return
__sync_val_compare_and_swap
(
dest
,
compare
,
xchg
);
}
#else
extern
__int64
interlocked_cmpxchg64
(
__int64
*
dest
,
__int64
xchg
,
__int64
compare
);
#endif
#else
/* NO_LIBWINE_PORT */
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
...
...
@@ -487,11 +360,6 @@ extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compa
#define fstatvfs __WINE_NOT_PORTABLE(fstatvfs)
#define getopt_long __WINE_NOT_PORTABLE(getopt_long)
#define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only)
#define interlocked_cmpxchg __WINE_NOT_PORTABLE(interlocked_cmpxchg)
#define interlocked_cmpxchg_ptr __WINE_NOT_PORTABLE(interlocked_cmpxchg_ptr)
#define interlocked_xchg __WINE_NOT_PORTABLE(interlocked_xchg)
#define interlocked_xchg_ptr __WINE_NOT_PORTABLE(interlocked_xchg_ptr)
#define interlocked_xchg_add __WINE_NOT_PORTABLE(interlocked_xchg_add)
#define lstat __WINE_NOT_PORTABLE(lstat)
#define pread __WINE_NOT_PORTABLE(pread)
#define pwrite __WINE_NOT_PORTABLE(pwrite)
...
...
libs/port/Makefile.in
View file @
7eef40d4
...
...
@@ -5,7 +5,6 @@ C_SRCS = \
ffs.c
\
fstatvfs.c
\
getopt.c
\
interlocked.c
\
isfinite.c
\
isinf.c
\
isnan.c
\
...
...
libs/port/interlocked.c
deleted
100644 → 0
View file @
2633a5c1
This diff is collapsed.
Click to expand it.
libs/wine/debug.c
View file @
7eef40d4
...
...
@@ -278,7 +278,7 @@ static char *get_temp_buffer( size_t size )
char
*
ret
;
int
idx
;
idx
=
interlocked_xchg_add
(
&
pos
,
1
)
%
ARRAY_SIZE
(
list
);
idx
=
pos
++
%
ARRAY_SIZE
(
list
);
if
((
ret
=
realloc
(
list
[
idx
],
size
)))
list
[
idx
]
=
ret
;
return
ret
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment