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
bd0d5dea
Commit
bd0d5dea
authored
Mar 15, 2022
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcp110: Introduce wrapper around critical_section functions.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ffb152df
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
34 deletions
+59
-34
misc.c
dlls/msvcp90/misc.c
+6
-24
msvcp90.h
dlls/msvcp90/msvcp90.h
+5
-5
msvcp_main.c
dlls/msvcp90/msvcp_main.c
+48
-5
No files found.
dlls/msvcp90/misc.c
View file @
bd0d5dea
...
...
@@ -706,24 +706,6 @@ unsigned int __cdecl _Random_device(void)
#endif
#if _MSVCP_VER >= 110
#ifdef __ASM_USE_THISCALL_WRAPPER
extern
void
*
call_thiscall_func
;
__ASM_GLOBAL_FUNC
(
call_thiscall_func
,
"popl %eax
\n\t
"
"popl %edx
\n\t
"
"popl %ecx
\n\t
"
"pushl %eax
\n\t
"
"jmp *%edx
\n\t
"
)
#define call_func1(func,this) ((void* (WINAPI*)(void*,void*))&call_thiscall_func)(func,this)
#else
/* __i386__ */
#define call_func1(func,this) func(this)
#endif
/* __i386__ */
#define MTX_PLAIN 0x1
#define MTX_TRY 0x2
#define MTX_TIMED 0x4
...
...
@@ -753,7 +735,7 @@ void __cdecl _Mtx_init_in_situ(_Mtx_t mtx, int flags)
FIXME
(
"unknown flags ignored: %x
\n
"
,
flags
);
mtx
->
flags
=
flags
;
c
all_func1
(
critical_section_ctor
,
&
mtx
->
cs
);
c
s_init
(
&
mtx
->
cs
);
mtx
->
thread_id
=
-
1
;
mtx
->
count
=
0
;
}
...
...
@@ -767,12 +749,12 @@ int __cdecl _Mtx_init(_Mtx_t *mtx, int flags)
void
__cdecl
_Mtx_destroy_in_situ
(
_Mtx_t
mtx
)
{
c
all_func1
(
critical_section_dtor
,
&
mtx
->
cs
);
c
s_destroy
(
&
mtx
->
cs
);
}
void
__cdecl
_Mtx_destroy
(
_Mtx_arg_t
mtx
)
{
c
all_func1
(
critical_section_dtor
,
&
MTX_T_FROM_ARG
(
mtx
)
->
cs
);
c
s_destroy
(
&
MTX_T_FROM_ARG
(
mtx
)
->
cs
);
operator_delete
(
MTX_T_FROM_ARG
(
mtx
));
}
...
...
@@ -784,7 +766,7 @@ int __cdecl _Mtx_current_owns(_Mtx_arg_t mtx)
int
__cdecl
_Mtx_lock
(
_Mtx_arg_t
mtx
)
{
if
(
MTX_T_FROM_ARG
(
mtx
)
->
thread_id
!=
GetCurrentThreadId
())
{
c
all_func1
(
critical_section_lock
,
&
MTX_T_FROM_ARG
(
mtx
)
->
cs
);
c
s_lock
(
&
MTX_T_FROM_ARG
(
mtx
)
->
cs
);
MTX_T_FROM_ARG
(
mtx
)
->
thread_id
=
GetCurrentThreadId
();
}
else
if
(
!
(
MTX_T_FROM_ARG
(
mtx
)
->
flags
&
MTX_RECURSIVE
)
&&
MTX_T_FROM_ARG
(
mtx
)
->
flags
!=
MTX_PLAIN
)
{
...
...
@@ -801,14 +783,14 @@ int __cdecl _Mtx_unlock(_Mtx_arg_t mtx)
return
0
;
MTX_T_FROM_ARG
(
mtx
)
->
thread_id
=
-
1
;
c
all_func1
(
critical_section_unlock
,
&
MTX_T_FROM_ARG
(
mtx
)
->
cs
);
c
s_unlock
(
&
MTX_T_FROM_ARG
(
mtx
)
->
cs
);
return
0
;
}
int
__cdecl
_Mtx_trylock
(
_Mtx_arg_t
mtx
)
{
if
(
MTX_T_FROM_ARG
(
mtx
)
->
thread_id
!=
GetCurrentThreadId
())
{
if
(
!
c
all_func1
(
critical_section_trylock
,
&
MTX_T_FROM_ARG
(
mtx
)
->
cs
))
if
(
!
c
s_trylock
(
&
MTX_T_FROM_ARG
(
mtx
)
->
cs
))
return
MTX_LOCKED
;
MTX_T_FROM_ARG
(
mtx
)
->
thread_id
=
GetCurrentThreadId
();
}
else
if
(
!
(
MTX_T_FROM_ARG
(
mtx
)
->
flags
&
MTX_RECURSIVE
)
...
...
dlls/msvcp90/msvcp90.h
View file @
bd0d5dea
...
...
@@ -58,11 +58,11 @@ typedef struct
void
*
tail
;
}
critical_section
;
extern
critical_section
*
(
__thiscall
*
critical_section_ctor
)
(
critical_section
*
);
extern
void
(
__thiscall
*
critical_section_dtor
)
(
critical_section
*
);
extern
void
(
__thiscall
*
critical_section_lock
)
(
critical_section
*
);
extern
void
(
__thiscall
*
critical_section_unlock
)
(
critical_section
*
);
extern
bool
(
__thiscall
*
critical_section_trylock
)
(
critical_section
*
);
extern
void
cs_init
(
critical_section
*
);
extern
void
cs_destroy
(
critical_section
*
);
extern
void
cs_lock
(
critical_section
*
);
extern
void
cs_unlock
(
critical_section
*
);
extern
bool
cs_trylock
(
critical_section
*
);
#endif
#if _MSVCP_VER >= 100
...
...
dlls/msvcp90/msvcp_main.c
View file @
bd0d5dea
...
...
@@ -57,11 +57,54 @@ DEFINE_VTBL_WRAPPER(56);
void
*
(
__cdecl
*
MSVCRT_set_new_handler
)(
void
*
);
#if _MSVCP_VER >= 110
critical_section
*
(
__thiscall
*
critical_section_ctor
)(
critical_section
*
);
void
(
__thiscall
*
critical_section_dtor
)(
critical_section
*
);
void
(
__thiscall
*
critical_section_lock
)(
critical_section
*
);
void
(
__thiscall
*
critical_section_unlock
)(
critical_section
*
);
bool
(
__thiscall
*
critical_section_trylock
)(
critical_section
*
);
#ifdef __ASM_USE_THISCALL_WRAPPER
extern
void
*
call_thiscall_func
;
__ASM_GLOBAL_FUNC
(
call_thiscall_func
,
"popl %eax
\n\t
"
"popl %edx
\n\t
"
"popl %ecx
\n\t
"
"pushl %eax
\n\t
"
"jmp *%edx
\n\t
"
)
#define call_func1(func,this) ((void* (WINAPI*)(void*,void*))&call_thiscall_func)(func,this)
#else
/* __i386__ */
#define call_func1(func,this) func(this)
#endif
/* __i386__ */
static
critical_section
*
(
__thiscall
*
critical_section_ctor
)(
critical_section
*
);
static
void
(
__thiscall
*
critical_section_dtor
)(
critical_section
*
);
static
void
(
__thiscall
*
critical_section_lock
)(
critical_section
*
);
static
void
(
__thiscall
*
critical_section_unlock
)(
critical_section
*
);
static
bool
(
__thiscall
*
critical_section_trylock
)(
critical_section
*
);
void
cs_init
(
critical_section
*
cs
)
{
call_func1
(
critical_section_ctor
,
cs
);
}
void
cs_destroy
(
critical_section
*
cs
)
{
call_func1
(
critical_section_dtor
,
cs
);
}
void
cs_lock
(
critical_section
*
cs
)
{
call_func1
(
critical_section_lock
,
cs
);
}
void
cs_unlock
(
critical_section
*
cs
)
{
call_func1
(
critical_section_unlock
,
cs
);
}
bool
cs_trylock
(
critical_section
*
cs
)
{
return
call_func1
(
critical_section_trylock
,
cs
);
}
#endif
#if _MSVCP_VER >= 100
...
...
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