Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
0f079d78
Commit
0f079d78
authored
Jun 06, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the kernel per-thread data out of the TEB into a private
structure stored in TEB.SystemReserved1.
parent
6ae4ee49
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
65 additions
and
29 deletions
+65
-29
change.c
dlls/kernel/change.c
+2
-0
global16.c
dlls/kernel/global16.c
+2
-0
kernel_main.c
dlls/kernel/kernel_main.c
+3
-4
kernel_private.h
dlls/kernel/kernel_private.h
+21
-0
local16.c
dlls/kernel/local16.c
+2
-0
locale.c
dlls/kernel/locale.c
+2
-3
ne_module.c
dlls/kernel/ne_module.c
+2
-0
ne_segment.c
dlls/kernel/ne_segment.c
+2
-0
pthread.c
dlls/kernel/pthread.c
+4
-3
relay16.c
dlls/kernel/relay16.c
+2
-0
snoop16.c
dlls/kernel/snoop16.c
+2
-0
syslevel.c
dlls/kernel/syslevel.c
+16
-17
system.c
dlls/kernel/system.c
+2
-0
task.c
dlls/kernel/task.c
+2
-2
vxd.c
dlls/kernel/vxd.c
+1
-0
No files found.
dlls/kernel/change.c
View file @
0f079d78
...
...
@@ -28,6 +28,8 @@
#include "winbase.h"
#include "winerror.h"
#include "ntstatus.h"
#include "winreg.h"
#include "winternl.h"
#include "kernel_private.h"
#include "wine/windef16.h"
#include "wine/server.h"
...
...
dlls/kernel/global16.c
View file @
0f079d78
...
...
@@ -40,6 +40,8 @@
#include "wine/winbase16.h"
#include "ntstatus.h"
#include "toolhelp.h"
#include "winreg.h"
#include "winternl.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/debug.h"
...
...
dlls/kernel/kernel_main.c
View file @
0f079d78
...
...
@@ -33,7 +33,6 @@
#include "windef.h"
#include "winbase.h"
#include "wincon.h"
#include "thread.h"
#include "winreg.h"
#include "winternl.h"
...
...
@@ -84,8 +83,8 @@ static void thread_attach(void)
{
/* allocate the 16-bit stack (FIXME: should be done lazily) */
HGLOBAL16
hstack
=
K32WOWGlobalAlloc16
(
GMEM_FIXED
,
0x10000
);
NtCurrentTeb
()
->
stack_sel
=
GlobalHandleToSel16
(
hstack
);
NtCurrentTeb
()
->
WOW32Reserved
=
(
void
*
)
MAKESEGPTR
(
NtCurrentTeb
()
->
stack_sel
,
kernel_get_thread_data
()
->
stack_sel
=
GlobalHandleToSel16
(
hstack
);
NtCurrentTeb
()
->
WOW32Reserved
=
(
void
*
)
MAKESEGPTR
(
kernel_get_thread_data
()
->
stack_sel
,
0x10000
-
sizeof
(
STACK16FRAME
)
);
}
...
...
@@ -96,7 +95,7 @@ static void thread_attach(void)
static
void
thread_detach
(
void
)
{
/* free the 16-bit stack */
K32WOWGlobalFree16
(
NtCurrentTeb
()
->
stack_sel
);
K32WOWGlobalFree16
(
kernel_get_thread_data
()
->
stack_sel
);
NtCurrentTeb
()
->
WOW32Reserved
=
0
;
if
(
NtCurrentTeb
()
->
Tib
.
SubSystemTib
)
TASK_ExitTask
();
}
...
...
dlls/kernel/kernel_private.h
View file @
0f079d78
...
...
@@ -21,6 +21,24 @@
#ifndef __WINE_KERNEL_PRIVATE_H
#define __WINE_KERNEL_PRIVATE_H
struct
tagSYSLEVEL
;
struct
kernel_thread_data
{
UINT
code_page
;
/* thread code page */
WORD
stack_sel
;
/* 16-bit stack selector */
WORD
htask16
;
/* Win16 task handle */
DWORD
sys_count
[
4
];
/* syslevel mutex entry counters */
struct
tagSYSLEVEL
*
sys_mutex
[
4
];
/* syslevel mutex pointers */
void
*
pthread_data
;
/* private data for pthread emulation */
void
*
pad
[
43
];
/* change this if you add fields! */
};
static
inline
struct
kernel_thread_data
*
kernel_get_thread_data
(
void
)
{
return
(
struct
kernel_thread_data
*
)
NtCurrentTeb
()
->
SystemReserved1
;
}
HANDLE
WINAPI
OpenConsoleW
(
LPCWSTR
,
DWORD
,
BOOL
,
DWORD
);
BOOL
WINAPI
VerifyConsoleIoHandle
(
HANDLE
);
HANDLE
WINAPI
DuplicateConsoleHandle
(
HANDLE
,
DWORD
,
BOOL
,
DWORD
);
...
...
@@ -98,6 +116,9 @@ extern LPVOID DOSMEM_MapDosToLinear(UINT); /* linear DOS to Wine */
extern
UINT
DOSMEM_MapLinearToDos
(
LPVOID
);
/* linear Wine to DOS */
extern
void
load_winedos
(
void
);
/* thread.c */
extern
TEB
*
THREAD_InitStack
(
TEB
*
teb
,
DWORD
stack_size
);
extern
struct
winedos_exports
{
/* for global16.c */
...
...
dlls/kernel/local16.c
View file @
0f079d78
...
...
@@ -36,6 +36,8 @@
#include "wine/winbase16.h"
#include "wownt32.h"
#include "toolhelp.h"
#include "winreg.h"
#include "winternl.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/debug.h"
...
...
dlls/kernel/locale.c
View file @
0f079d78
...
...
@@ -35,7 +35,6 @@
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
/* for RT_STRINGW */
#include "thread.h"
#include "winreg.h"
#include "winternl.h"
#include "wine/unicode.h"
...
...
@@ -203,7 +202,7 @@ static const union cptable *get_codepage_table( unsigned int codepage )
case
CP_UTF8
:
break
;
case
CP_THREAD_ACP
:
if
(
!
(
codepage
=
NtCurrentTeb
()
->
code_page
))
return
ansi_cptable
;
if
(
!
(
codepage
=
kernel_get_thread_data
()
->
code_page
))
return
ansi_cptable
;
/* fall through */
default:
if
(
codepage
==
ansi_cptable
->
info
.
codepage
)
return
ansi_cptable
;
...
...
@@ -1713,7 +1712,7 @@ BOOL WINAPI SetThreadLocale( LCID lcid )
}
NtCurrentTeb
()
->
CurrentLocale
=
lcid
;
NtCurrentTeb
()
->
code_page
=
get_lcid_codepage
(
lcid
);
kernel_get_thread_data
()
->
code_page
=
get_lcid_codepage
(
lcid
);
}
return
TRUE
;
}
...
...
dlls/kernel/ne_module.c
View file @
0f079d78
...
...
@@ -35,6 +35,8 @@
#include "windef.h"
#include "wine/winbase16.h"
#include "wownt32.h"
#include "winreg.h"
#include "winternl.h"
#include "toolhelp.h"
#include "excpt.h"
#include "kernel_private.h"
...
...
dlls/kernel/ne_segment.c
View file @
0f079d78
...
...
@@ -35,6 +35,8 @@
#include "wine/winbase16.h"
#include "wownt32.h"
#include "winreg.h"
#include "winternl.h"
#include "wine/library.h"
#include "kernel_private.h"
#include "kernel16_private.h"
...
...
dlls/kernel/pthread.c
View file @
0f079d78
...
...
@@ -45,8 +45,9 @@
#include "windef.h"
#include "winbase.h"
#include "
thread
.h"
#include "
winreg
.h"
#include "winternl.h"
#include "kernel_private.h"
#include "wine/pthread.h"
#define P_OUTPUT(stuff) write(2,stuff,strlen(stuff))
...
...
@@ -531,12 +532,12 @@ static void wine_pthread_exit(void *retval, char *currentframe)
static
void
*
wine_get_thread_data
(
void
)
{
return
NtCurrentTeb
()
->
pthread_data
;
return
kernel_get_thread_data
()
->
pthread_data
;
}
static
void
wine_set_thread_data
(
void
*
data
)
{
NtCurrentTeb
()
->
pthread_data
=
data
;
kernel_get_thread_data
()
->
pthread_data
=
data
;
}
static
const
struct
wine_pthread_functions
functions
=
...
...
dlls/kernel/relay16.c
View file @
0f079d78
...
...
@@ -29,6 +29,8 @@
#include "windef.h"
#include "winbase.h"
#include "wine/winbase16.h"
#include "winreg.h"
#include "winternl.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/unicode.h"
...
...
dlls/kernel/snoop16.c
View file @
0f079d78
...
...
@@ -29,6 +29,8 @@
#include "winbase.h"
#include "winnt.h"
#include "wine/winbase16.h"
#include "winreg.h"
#include "winternl.h"
#include "wine/library.h"
#include "kernel_private.h"
#include "kernel16_private.h"
...
...
dlls/kernel/syslevel.c
View file @
0f079d78
...
...
@@ -27,7 +27,6 @@
#include <sys/types.h>
#include "windef.h"
#include "winbase.h"
#include "thread.h"
#include "winreg.h"
#include "winternl.h"
#include "wine/winbase16.h"
...
...
@@ -93,26 +92,26 @@ VOID WINAPI _CreateSysLevel(SYSLEVEL *lock, INT level)
*/
VOID
WINAPI
_EnterSysLevel
(
SYSLEVEL
*
lock
)
{
TEB
*
teb
=
NtCurrentTeb
();
struct
kernel_thread_data
*
thread_data
=
kernel_get_thread_data
();
int
i
;
TRACE
(
"(%p, level %d): thread %lx count before %ld
\n
"
,
lock
,
lock
->
level
,
GetCurrentThreadId
(),
t
eb
->
sys_count
[
lock
->
level
]
);
lock
,
lock
->
level
,
GetCurrentThreadId
(),
t
hread_data
->
sys_count
[
lock
->
level
]
);
for
(
i
=
3
;
i
>
lock
->
level
;
i
--
)
if
(
t
eb
->
sys_count
[
i
]
>
0
)
if
(
t
hread_data
->
sys_count
[
i
]
>
0
)
{
ERR
(
"(%p, level %d): Holding %p, level %d. Expect deadlock!
\n
"
,
lock
,
lock
->
level
,
t
eb
->
sys_mutex
[
i
],
i
);
lock
,
lock
->
level
,
t
hread_data
->
sys_mutex
[
i
],
i
);
}
RtlEnterCriticalSection
(
&
lock
->
crst
);
t
eb
->
sys_count
[
lock
->
level
]
++
;
t
eb
->
sys_mutex
[
lock
->
level
]
=
lock
;
t
hread_data
->
sys_count
[
lock
->
level
]
++
;
t
hread_data
->
sys_mutex
[
lock
->
level
]
=
lock
;
TRACE
(
"(%p, level %d): thread %lx count after %ld
\n
"
,
lock
,
lock
->
level
,
GetCurrentThreadId
(),
t
eb
->
sys_count
[
lock
->
level
]
);
lock
,
lock
->
level
,
GetCurrentThreadId
(),
t
hread_data
->
sys_count
[
lock
->
level
]
);
#ifdef __i386__
if
(
lock
==
&
Win16Mutex
)
CallTo16_TebSelector
=
wine_get_fs
();
...
...
@@ -125,27 +124,27 @@ VOID WINAPI _EnterSysLevel(SYSLEVEL *lock)
*/
VOID
WINAPI
_LeaveSysLevel
(
SYSLEVEL
*
lock
)
{
TEB
*
teb
=
NtCurrentTeb
();
struct
kernel_thread_data
*
thread_data
=
kernel_get_thread_data
();
TRACE
(
"(%p, level %d): thread %lx count before %ld
\n
"
,
lock
,
lock
->
level
,
GetCurrentThreadId
(),
t
eb
->
sys_count
[
lock
->
level
]
);
lock
,
lock
->
level
,
GetCurrentThreadId
(),
t
hread_data
->
sys_count
[
lock
->
level
]
);
if
(
t
eb
->
sys_count
[
lock
->
level
]
<=
0
||
teb
->
sys_mutex
[
lock
->
level
]
!=
lock
)
if
(
t
hread_data
->
sys_count
[
lock
->
level
]
<=
0
||
thread_data
->
sys_mutex
[
lock
->
level
]
!=
lock
)
{
ERR
(
"(%p, level %d): Invalid state: count %ld mutex %p.
\n
"
,
lock
,
lock
->
level
,
t
eb
->
sys_count
[
lock
->
level
],
t
eb
->
sys_mutex
[
lock
->
level
]
);
lock
,
lock
->
level
,
t
hread_data
->
sys_count
[
lock
->
level
],
t
hread_data
->
sys_mutex
[
lock
->
level
]
);
}
else
{
if
(
--
t
eb
->
sys_count
[
lock
->
level
]
==
0
)
t
eb
->
sys_mutex
[
lock
->
level
]
=
NULL
;
if
(
--
t
hread_data
->
sys_count
[
lock
->
level
]
==
0
)
t
hread_data
->
sys_mutex
[
lock
->
level
]
=
NULL
;
}
RtlLeaveCriticalSection
(
&
lock
->
crst
);
TRACE
(
"(%p, level %d): thread %lx count after %ld
\n
"
,
lock
,
lock
->
level
,
GetCurrentThreadId
(),
t
eb
->
sys_count
[
lock
->
level
]
);
lock
,
lock
->
level
,
GetCurrentThreadId
(),
t
hread_data
->
sys_count
[
lock
->
level
]
);
}
/************************************************************************
...
...
@@ -236,7 +235,7 @@ VOID SYSLEVEL_CheckNotLevel( INT level )
INT
i
;
for
(
i
=
3
;
i
>=
level
;
i
--
)
if
(
NtCurrentTeb
()
->
sys_count
[
i
]
>
0
)
if
(
kernel_get_thread_data
()
->
sys_count
[
i
]
>
0
)
{
ERR
(
"(%d): Holding lock of level %d!
\n
"
,
level
,
i
);
...
...
dlls/kernel/system.c
View file @
0f079d78
...
...
@@ -28,6 +28,8 @@
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "wownt32.h"
#include "winreg.h"
#include "winternl.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/debug.h"
...
...
dlls/kernel/task.c
View file @
0f079d78
...
...
@@ -458,7 +458,7 @@ static DWORD CALLBACK task_start( LPVOID p )
TDB
*
pTask
=
(
TDB
*
)
p
;
DWORD
ret
;
NtCurrentTeb
()
->
htask16
=
pTask
->
hSelf
;
kernel_get_thread_data
()
->
htask16
=
pTask
->
hSelf
;
NtCurrentTeb
()
->
Tib
.
SubSystemTib
=
allocate_win16_tib
(
pTask
);
_EnterWin16Lock
();
...
...
@@ -1176,7 +1176,7 @@ void WINAPI GetTaskQueueES16(void)
*/
HTASK16
WINAPI
GetCurrentTask
(
void
)
{
HTASK16
ret
=
NtCurrentTeb
()
->
htask16
;
HTASK16
ret
=
kernel_get_thread_data
()
->
htask16
;
if
(
!
ret
)
ret
=
main_task
;
return
ret
;
}
...
...
dlls/kernel/vxd.c
View file @
0f079d78
...
...
@@ -38,6 +38,7 @@
#include "winbase.h"
#include "winreg.h"
#include "winerror.h"
#include "winternl.h"
#include "kernel_private.h"
#include "wine/library.h"
#include "wine/unicode.h"
...
...
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