Commit f1ff598e authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Update the __wine_ldt_copy pointer directly from the Unix library.

parent 2334f4e6
......@@ -95,6 +95,8 @@ static inline struct x86_thread_data *x86_thread_data(void)
return (struct x86_thread_data *)NtCurrentTeb()->SystemReserved2;
}
struct ldt_copy *__wine_ldt_copy = NULL;
/* Exception record for handling exceptions happening inside exception handlers */
typedef struct
{
......
......@@ -46,8 +46,6 @@ static RTL_BITMAP tls_bitmap;
static RTL_BITMAP tls_expansion_bitmap;
static RTL_BITMAP fls_bitmap;
struct ldt_copy *__wine_ldt_copy = NULL;
static RTL_CRITICAL_SECTION peb_lock;
static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
{
......@@ -104,7 +102,7 @@ int __cdecl __wine_dbg_output( const char *str )
TEB *thread_init( SIZE_T *info_size )
{
ULONG_PTR val;
TEB *teb = unix_funcs->init_threading( &__wine_ldt_copy, info_size );
TEB *teb = unix_funcs->init_threading( info_size );
peb = teb->Peb;
peb->FastPebLock = &peb_lock;
......
......@@ -838,6 +838,13 @@ static void fixup_ntdll_imports( const IMAGE_NT_HEADERS *nt )
GET_FUNC( LdrInitializeThunk );
GET_FUNC( RtlUserThreadStart );
GET_FUNC( __wine_set_unix_funcs );
#ifdef __i386__
{
struct ldt_copy **p__wine_ldt_copy;
GET_FUNC( __wine_ldt_copy );
*p__wine_ldt_copy = &__wine_ldt_copy;
}
#endif
#undef GET_FUNC
}
......
......@@ -1461,9 +1461,6 @@ void server_init_process(void)
*/
void CDECL server_init_process_done( void *relay )
{
#ifdef __i386__
extern struct ldt_copy __wine_ldt_copy;
#endif
PEB *peb = NtCurrentTeb()->Peb;
IMAGE_NT_HEADERS *nt = RtlImageNtHeader( peb->ImageBaseAddress );
void *entry = (char *)peb->ImageBaseAddress + nt->OptionalHeader.AddressOfEntryPoint;
......
......@@ -86,15 +86,11 @@ static void pthread_exit_wrapper( int status )
/***********************************************************************
* init_threading
*/
TEB * CDECL init_threading( struct ldt_copy **ldt_copy, SIZE_T *size )
TEB * CDECL init_threading( SIZE_T *size )
{
TEB *teb;
BOOL suspend;
SIZE_T info_size;
#ifdef __i386__
extern struct ldt_copy __wine_ldt_copy;
*ldt_copy = &__wine_ldt_copy;
#endif
teb = virtual_alloc_first_teb();
......
......@@ -73,7 +73,6 @@ extern void (WINAPI *pDbgUiRemoteBreakin)( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN;
extern void (WINAPI *pLdrInitializeThunk)(CONTEXT*,void**,ULONG_PTR,ULONG_PTR) DECLSPEC_HIDDEN;
extern void (WINAPI *pRtlUserThreadStart)( PRTL_THREAD_START_ROUTINE entry, void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL fast_RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit, int timeout ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL fast_RtlpUnWaitCriticalSection( RTL_CRITICAL_SECTION *crit ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL fast_RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit ) DECLSPEC_HIDDEN;
......@@ -117,7 +116,7 @@ extern NTSTATUS CDECL server_handle_to_fd( HANDLE handle, unsigned int access, i
unsigned int *options ) DECLSPEC_HIDDEN;
extern void CDECL server_release_fd( HANDLE handle, int unix_fd ) DECLSPEC_HIDDEN;
extern void CDECL server_init_process_done( void *relay ) DECLSPEC_HIDDEN;
extern TEB * CDECL init_threading( struct ldt_copy **ldt_copy, SIZE_T *size ) DECLSPEC_HIDDEN;
extern TEB * CDECL init_threading( SIZE_T *size ) DECLSPEC_HIDDEN;
extern void CDECL DECLSPEC_NORETURN exit_thread( int status ) DECLSPEC_HIDDEN;
extern void CDECL DECLSPEC_NORETURN exit_process( int status ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status ) DECLSPEC_HIDDEN;
......@@ -149,6 +148,9 @@ extern sigset_t server_block_set DECLSPEC_HIDDEN;
extern SIZE_T signal_stack_size DECLSPEC_HIDDEN;
extern SIZE_T signal_stack_mask DECLSPEC_HIDDEN;
extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
#ifdef __i386__
extern struct ldt_copy __wine_ldt_copy DECLSPEC_HIDDEN;
#endif
extern void init_environment( int argc, char *argv[], char *envp[] ) DECLSPEC_HIDDEN;
extern DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen ) DECLSPEC_HIDDEN;
......
......@@ -24,12 +24,11 @@
#include "wine/server.h"
#include "wine/debug.h"
struct ldt_copy;
struct msghdr;
struct _DISPATCHER_CONTEXT;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 66
#define NTDLL_UNIXLIB_VERSION 67
struct unix_funcs
{
......@@ -319,7 +318,7 @@ struct unix_funcs
void (CDECL *virtual_set_large_address_space)(void);
/* thread/process functions */
TEB * (CDECL *init_threading)( struct ldt_copy **ldt_copy, SIZE_T *size );
TEB * (CDECL *init_threading)( SIZE_T *size );
void (CDECL *exit_thread)( int status );
void (CDECL *exit_process)( int status );
NTSTATUS (CDECL *exec_process)( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment