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
44c9758d
Commit
44c9758d
authored
Jul 19, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move private data to make room in the TEB for the activation context data.
parent
303b357c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
36 deletions
+48
-36
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+17
-17
signal_i386.c
dlls/ntdll/signal_i386.c
+3
-3
thread.c
dlls/ntdll/thread.c
+6
-9
thread.h
include/thread.h
+3
-3
winternl.h
include/winternl.h
+18
-3
relay.c
tools/winebuild/relay.c
+1
-1
No files found.
dlls/ntdll/ntdll_misc.h
View file @
44c9758d
...
...
@@ -146,15 +146,18 @@ struct debug_info
char
output
[
1024
];
/* current output line */
};
/* thread private data, stored in NtCurrentTeb()->SystemReserved2 */
struct
ntdll_thread_data
{
struct
debug_info
*
debug_info
;
/* info for debugstr functions */
int
request_fd
;
/* fd for sending server requests */
int
reply_fd
;
/* fd for receiving server replies */
int
wait_fd
[
2
];
/* fd for sleeping server requests */
void
*
vm86_ptr
;
/* data for vm86 mode */
void
*
pad
[
4
];
/* change this if you add fields! */
DWORD
fs
;
/* 1d4 TEB selector */
DWORD
gs
;
/* 1d8 libc selector; update winebuild if you move this! */
struct
debug_info
*
debug_info
;
/* 1dc info for debugstr functions */
int
request_fd
;
/* 1e0 fd for sending server requests */
int
reply_fd
;
/* 1e4 fd for receiving server replies */
int
wait_fd
[
2
];
/* 1e8 fd for sleeping server requests */
void
*
vm86_ptr
;
/* 1f0 data for vm86 mode */
void
*
pad
[
2
];
/* 1f4 change this if you add fields! */
};
static
inline
struct
ntdll_thread_data
*
ntdll_get_thread_data
(
void
)
...
...
@@ -162,18 +165,15 @@ static inline struct ntdll_thread_data *ntdll_get_thread_data(void)
return
(
struct
ntdll_thread_data
*
)
NtCurrentTeb
()
->
SystemReserved2
;
}
/* thread registers, stored in NtCurrentTeb()->SpareBytes1 */
/* thread
debug_
registers, stored in NtCurrentTeb()->SpareBytes1 */
struct
ntdll_thread_regs
{
DWORD
fs
;
/* 00 TEB selector */
DWORD
gs
;
/* 04 libc selector; update winebuild if you move this! */
DWORD
dr0
;
/* 08 debug registers */
DWORD
dr1
;
/* 0c */
DWORD
dr2
;
/* 10 */
DWORD
dr3
;
/* 14 */
DWORD
dr6
;
/* 18 */
DWORD
dr7
;
/* 1c */
DWORD
spare
[
2
];
/* 20 change this if you add fields! */
DWORD
dr0
;
DWORD
dr1
;
DWORD
dr2
;
DWORD
dr3
;
DWORD
dr6
;
DWORD
dr7
;
};
static
inline
struct
ntdll_thread_regs
*
ntdll_get_thread_regs
(
void
)
...
...
dlls/ntdll/signal_i386.c
View file @
44c9758d
...
...
@@ -543,7 +543,7 @@ static inline void *init_handler( const SIGCONTEXT *sigcontext, WORD *fs, WORD *
{
void
*
stack
=
(
void
*
)(
ESP_sig
(
sigcontext
)
&
~
3
);
TEB
*
teb
=
get_current_teb
();
struct
ntdll_thread_
regs
*
thread_regs
=
(
struct
ntdll_thread_regs
*
)
teb
->
SpareBytes1
;
struct
ntdll_thread_
data
*
thread_data
=
(
struct
ntdll_thread_data
*
)
teb
->
SystemReserved2
;
/* get %fs and %gs at time of the fault */
#ifdef FS_sig
...
...
@@ -557,7 +557,7 @@ static inline void *init_handler( const SIGCONTEXT *sigcontext, WORD *fs, WORD *
*
gs
=
wine_get_gs
();
#endif
wine_set_fs
(
thread_
regs
->
fs
);
wine_set_fs
(
thread_
data
->
fs
);
/* now restore a proper %gs for the fault handler */
if
(
!
wine_ldt_is_system
(
CS_sig
(
sigcontext
))
||
...
...
@@ -570,7 +570,7 @@ static inline void *init_handler( const SIGCONTEXT *sigcontext, WORD *fs, WORD *
* SS is still non-system segment. This is why both CS and SS
* are checked.
*/
wine_set_gs
(
thread_
regs
->
gs
);
wine_set_gs
(
thread_
data
->
gs
);
stack
=
teb
->
WOW32Reserved
;
}
#ifdef __HAVE_VM86
...
...
dlls/ntdll/thread.c
View file @
44c9758d
...
...
@@ -108,7 +108,6 @@ static void ldt_unlock(void)
static
inline
NTSTATUS
init_teb
(
TEB
*
teb
)
{
struct
ntdll_thread_data
*
thread_data
=
(
struct
ntdll_thread_data
*
)
teb
->
SystemReserved2
;
struct
ntdll_thread_regs
*
thread_regs
=
(
struct
ntdll_thread_regs
*
)
teb
->
SpareBytes1
;
teb
->
Tib
.
ExceptionList
=
(
void
*
)
~
0UL
;
teb
->
Tib
.
StackBase
=
(
void
*
)
~
0UL
;
...
...
@@ -116,7 +115,7 @@ static inline NTSTATUS init_teb( TEB *teb )
teb
->
StaticUnicodeString
.
Buffer
=
teb
->
StaticUnicodeBuffer
;
teb
->
StaticUnicodeString
.
MaximumLength
=
sizeof
(
teb
->
StaticUnicodeBuffer
);
if
(
!
(
thread_
regs
->
fs
=
wine_ldt_alloc_fs
()))
return
STATUS_TOO_MANY_THREADS
;
if
(
!
(
thread_
data
->
fs
=
wine_ldt_alloc_fs
()))
return
STATUS_TOO_MANY_THREADS
;
thread_data
->
request_fd
=
-
1
;
thread_data
->
reply_fd
=
-
1
;
thread_data
->
wait_fd
[
0
]
=
-
1
;
...
...
@@ -230,7 +229,6 @@ HANDLE thread_init(void)
HANDLE
exe_file
=
0
;
LARGE_INTEGER
now
;
struct
ntdll_thread_data
*
thread_data
;
struct
ntdll_thread_regs
*
thread_regs
;
struct
wine_pthread_thread_info
thread_info
;
static
struct
debug_info
debug_info
;
/* debug info for initial thread */
...
...
@@ -284,14 +282,13 @@ HANDLE thread_init(void)
thread_info
.
teb_size
=
size
;
init_teb
(
teb
);
thread_data
=
(
struct
ntdll_thread_data
*
)
teb
->
SystemReserved2
;
thread_regs
=
(
struct
ntdll_thread_regs
*
)
teb
->
SpareBytes1
;
thread_data
->
debug_info
=
&
debug_info
;
InsertHeadList
(
&
tls_links
,
&
teb
->
TlsLinks
);
thread_info
.
stack_base
=
NULL
;
thread_info
.
stack_size
=
0
;
thread_info
.
teb_base
=
teb
;
thread_info
.
teb_sel
=
thread_
regs
->
fs
;
thread_info
.
teb_sel
=
thread_
data
->
fs
;
wine_pthread_get_functions
(
&
pthread_functions
,
sizeof
(
pthread_functions
)
);
pthread_functions
.
init_current_teb
(
&
thread_info
);
pthread_functions
.
init_thread
(
&
thread_info
);
...
...
@@ -495,8 +492,8 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
HANDLE
*
handle_ptr
,
CLIENT_ID
*
id
)
{
sigset_t
sigset
;
struct
ntdll_thread_data
*
thread_data
;
struct
ntdll_thread_regs
*
thread_regs
=
NULL
;
struct
ntdll_thread_data
*
thread_data
=
NULL
;
struct
ntdll_thread_regs
*
thread_regs
;
struct
startup_info
*
info
=
NULL
;
void
*
addr
=
NULL
;
HANDLE
handle
=
0
;
...
...
@@ -575,7 +572,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
thread_data
->
request_fd
=
request_pipe
[
1
];
info
->
pthread_info
.
teb_base
=
teb
;
info
->
pthread_info
.
teb_sel
=
thread_
regs
->
fs
;
info
->
pthread_info
.
teb_sel
=
thread_
data
->
fs
;
/* inherit debug registers from parent thread */
thread_regs
->
dr0
=
ntdll_get_thread_regs
()
->
dr0
;
...
...
@@ -616,7 +613,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
return
STATUS_SUCCESS
;
error:
if
(
thread_
regs
)
wine_ldt_free_fs
(
thread_regs
->
fs
);
if
(
thread_
data
)
wine_ldt_free_fs
(
thread_data
->
fs
);
if
(
addr
)
{
SIZE_T
size
=
0
;
...
...
include/thread.h
View file @
44c9758d
...
...
@@ -47,9 +47,9 @@ typedef struct _TEB
ULONG
CurrentLocale
;
/* 0c4 */
ULONG
FpSoftwareStatusRegister
;
/* 0c8 */
PVOID
SystemReserved1
[
54
];
/* 0cc */
PVOID
Spare1
;
/* 1a4 */
LONG
ExceptionCode
;
/* 1a8 */
BYTE
SpareBytes1
[
40
];
/* 1a
c */
LONG
ExceptionCode
;
/* 1a4 */
ACTIVATION_CONTEXT_STACK
ActivationContextStack
;
/* 1a8 */
BYTE
SpareBytes1
[
24
];
/* 1b
c */
PVOID
SystemReserved2
[
10
];
/* 1d4 */
/* The following are Wine-specific fields (NT: GdiTebBatch) */
...
...
include/winternl.h
View file @
44c9758d
...
...
@@ -200,6 +200,21 @@ typedef struct _GDI_TEB_BATCH
ULONG
Buffer
[
0x136
];
}
GDI_TEB_BATCH
;
typedef
struct
_RTL_ACTIVATION_CONTEXT_STACK_FRAME
{
struct
_RTL_ACTIVATION_CONTEXT_STACK_FRAME
*
Previous
;
struct
_ACTIVATION_CONTEXT
*
ActivationContext
;
ULONG
Flags
;
}
RTL_ACTIVATION_CONTEXT_STACK_FRAME
,
*
PRTL_ACTIVATION_CONTEXT_STACK_FRAME
;
typedef
struct
_ACTIVATION_CONTEXT_STACK
{
ULONG
Flags
;
ULONG
NextCookieSequenceNumber
;
RTL_ACTIVATION_CONTEXT_STACK_FRAME
*
ActiveFrame
;
LIST_ENTRY
FrameListCache
;
}
ACTIVATION_CONTEXT_STACK
,
*
PACTIVATION_CONTEXT_STACK
;
/***********************************************************************
* PEB data structure
*/
...
...
@@ -286,9 +301,9 @@ typedef struct _TEB
ULONG
CurrentLocale
;
/* 0c4 */
ULONG
FpSoftwareStatusRegister
;
/* 0c8 */
PVOID
SystemReserved1
[
54
];
/* 0cc used for kernel32 private data in Wine */
PVOID
Spare1
;
/* 1a4 */
LONG
ExceptionCode
;
/* 1a8 */
BYTE
SpareBytes1
[
40
];
/* 1a
c used for ntdll private data in Wine */
LONG
ExceptionCode
;
/* 1a4 */
ACTIVATION_CONTEXT_STACK
ActivationContextStack
;
/* 1a8 */
BYTE
SpareBytes1
[
24
];
/* 1b
c used for ntdll private data in Wine */
PVOID
SystemReserved2
[
10
];
/* 1d4 used for ntdll private data in Wine */
GDI_TEB_BATCH
GdiTebBatch
;
/* 1fc */
ULONG
gdiRgn
;
/* 6dc */
...
...
tools/winebuild/relay.c
View file @
44c9758d
...
...
@@ -48,7 +48,7 @@
#define STACKOFFSET 0xc0
/* STRUCTOFFSET(TEB,WOW32Reserved) */
/* fix this if the ntdll_thread_regs structure is changed */
#define GS_OFFSET 0x1
b0
/* STRUCTOFFSET(TEB,SpareBytes1) + STRUCTOFFSET(ntdll_thread_regs
,gs) */
#define GS_OFFSET 0x1
d8
/* STRUCTOFFSET(TEB,SystemReserved2) + STRUCTOFFSET(ntdll_thread_data
,gs) */
static
void
function_header
(
const
char
*
name
)
{
...
...
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