Commit a0a62463 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntdll: Introduce signal_init_syscalls.

parent 3d1a98f4
......@@ -104,6 +104,7 @@ void (WINAPI *pLdrInitializeThunk)(CONTEXT*,void**,ULONG_PTR,ULONG_PTR) = NU
void (WINAPI *pRtlUserThreadStart)( PRTL_THREAD_START_ROUTINE entry, void *arg ) = NULL;
static NTSTATUS (CDECL *p__wine_set_unix_funcs)( int version, const struct unix_funcs *funcs );
static void *syscall_dispatcher;
#ifdef __GNUC__
static void fatal_error( const char *err, ... ) __attribute__((noreturn, format(printf,1,2)));
......@@ -883,7 +884,7 @@ static void load_ntdll_functions( HMODULE module )
if ((ptr = (void *)find_named_export( module, ntdll_exports, #name ))) *ptr = val; \
else ERR( "%s not found\n", #name )
SET_PTR( __wine_syscall_dispatcher, __wine_syscall_dispatcher );
SET_PTR( __wine_syscall_dispatcher, syscall_dispatcher );
#ifdef __i386__
SET_PTR( __wine_ldt_copy, &__wine_ldt_copy );
#endif
......@@ -1650,6 +1651,7 @@ static void start_main_thread(void)
startup_info_size = server_init_process();
virtual_map_user_shared_data();
init_cpu_info();
syscall_dispatcher = signal_init_syscalls();
init_files();
init_startup_info();
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
......
......@@ -963,6 +963,15 @@ void signal_init_process(void)
}
/**********************************************************************
* signal_init_syscalls
*/
void *signal_init_syscalls(void)
{
return __wine_syscall_dispatcher;
}
/***********************************************************************
* init_thread_context
*/
......
......@@ -1120,6 +1120,16 @@ void signal_init_process(void)
exit(1);
}
/**********************************************************************
* signal_init_syscalls
*/
void *signal_init_syscalls(void)
{
return __wine_syscall_dispatcher;
}
/***********************************************************************
* init_thread_context
*/
......
......@@ -2467,6 +2467,15 @@ void signal_init_process(void)
}
/**********************************************************************
* signal_init_syscalls
*/
void *signal_init_syscalls(void)
{
return __wine_syscall_dispatcher;
}
/***********************************************************************
* init_thread_context
*/
......
......@@ -34,6 +34,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/mman.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
......@@ -2787,6 +2788,22 @@ void signal_init_process(void)
}
/**********************************************************************
* signal_init_syscalls
*/
void *signal_init_syscalls(void)
{
void *ptr;
/* sneak in a syscall dispatcher pointer at a fixed address (7ffe1000) */
ptr = (char *)user_shared_data + page_size;
anon_mmap_fixed( ptr, page_size, PROT_READ | PROT_WRITE, 0 );
*(void **)ptr = __wine_syscall_dispatcher;
return __wine_syscall_dispatcher;
}
/***********************************************************************
* init_thread_context
*/
......
......@@ -208,6 +208,7 @@ extern NTSTATUS signal_alloc_thread( TEB *teb ) DECLSPEC_HIDDEN;
extern void signal_free_thread( TEB *teb ) DECLSPEC_HIDDEN;
extern void signal_init_thread( TEB *teb ) DECLSPEC_HIDDEN;
extern void signal_init_process(void) DECLSPEC_HIDDEN;
extern void *signal_init_syscalls(void) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE entry, void *arg,
BOOL suspend, void *thunk, TEB *teb ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int) ) DECLSPEC_HIDDEN;
......
......@@ -2597,12 +2597,6 @@ TEB *virtual_alloc_first_teb(void)
exit(1);
}
#ifdef __x86_64__ /* sneak in a syscall dispatcher pointer at a fixed address (7ffe1000) */
ptr = (char *)user_shared_data + page_size;
anon_mmap_fixed( ptr, page_size, PROT_READ | PROT_WRITE, 0 );
*(void **)ptr = __wine_syscall_dispatcher;
#endif
NtAllocateVirtualMemory( NtCurrentProcess(), &teb_block, 0, &total,
MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE );
teb_block_pos = 30;
......
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