Commit 7b96e82f authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Make the reserved area functions static.

parent 4c45348f
......@@ -1406,12 +1406,6 @@ static void start_main_thread(void)
#ifdef __APPLE__
struct apple_stack_info
{
void *stack;
size_t desired_size;
};
static void *apple_wine_thread( void *arg )
{
start_main_thread();
......@@ -1419,31 +1413,6 @@ static void *apple_wine_thread( void *arg )
}
/***********************************************************************
* apple_alloc_thread_stack
*
* Callback for mmap_enum_reserved_areas to allocate space for
* the secondary thread's stack.
*/
#ifndef _WIN64
static int CDECL apple_alloc_thread_stack( void *base, size_t size, void *arg )
{
struct apple_stack_info *info = arg;
/* For mysterious reasons, putting the thread stack at the very top
* of the address space causes subsequent execs to fail, even on the
* child side of a fork. Avoid the top 16MB. */
char * const limit = (char*)0xff000000;
if ((char *)base >= limit) return 0;
if (size > limit - (char*)base)
size = limit - (char*)base;
if (size < info->desired_size) return 0;
info->stack = wine_anon_mmap( (char *)base + size - info->desired_size,
info->desired_size, PROT_READ|PROT_WRITE, MAP_FIXED );
return (info->stack != (void *)-1);
}
#endif
/***********************************************************************
* apple_create_wine_thread
*
* Spin off a secondary thread to complete Wine initialization, leaving
......@@ -1453,33 +1422,13 @@ static int CDECL apple_alloc_thread_stack( void *base, size_t size, void *arg )
*/
static void apple_create_wine_thread( void *arg )
{
int success = 0;
pthread_t thread;
pthread_attr_t attr;
if (!pthread_attr_init( &attr ))
{
#ifndef _WIN64
struct apple_stack_info info;
/* Try to put the new thread's stack in the reserved area. If this
* fails, just let it go wherever. It'll be a waste of space, but we
* can go on. */
if (!pthread_attr_getstacksize( &attr, &info.desired_size ) &&
mmap_enum_reserved_areas( apple_alloc_thread_stack, &info, 1 ))
{
mmap_remove_reserved_area( info.stack, info.desired_size );
pthread_attr_setstackaddr( &attr, (char*)info.stack + info.desired_size );
}
#endif
if (!pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE ) &&
!pthread_create( &thread, &attr, apple_wine_thread, NULL ))
success = 1;
pthread_attr_destroy( &attr );
}
if (!success) exit(1);
pthread_attr_init( &attr );
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE );
if (pthread_create( &thread, &attr, apple_wine_thread, NULL )) exit(1);
pthread_attr_destroy( &attr );
}
......
......@@ -103,11 +103,6 @@ extern LONGLONG CDECL fast_RtlGetSystemTimePrecise(void) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL fast_wait_cv( RTL_CONDITION_VARIABLE *variable, const void *value,
const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
void CDECL mmap_add_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), void *arg,
int top_down ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL get_initial_environment( WCHAR **wargv[], WCHAR *env, SIZE_T *size ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL get_startup_info( startup_info_t *info, SIZE_T *total_size, SIZE_T *info_size ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL get_dynamic_environment( WCHAR *env, SIZE_T *size ) DECLSPEC_HIDDEN;
......
......@@ -212,6 +212,8 @@ static inline BOOL is_inside_signal_stack( void *ptr )
}
static void mmap_add_reserved_area( void *addr, SIZE_T size );
static void reserve_area( void *addr, void *end )
{
#ifdef __APPLE__
......@@ -351,7 +353,7 @@ static void mmap_init( const struct preload_info *preload_info )
#endif
}
void CDECL mmap_add_reserved_area( void *addr, SIZE_T size )
static void mmap_add_reserved_area( void *addr, SIZE_T size )
{
struct reserved_area *area;
struct list *ptr;
......@@ -400,7 +402,7 @@ void CDECL mmap_add_reserved_area( void *addr, SIZE_T size )
}
}
void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size )
static void mmap_remove_reserved_area( void *addr, SIZE_T size )
{
struct reserved_area *area;
struct list *ptr;
......@@ -460,7 +462,7 @@ void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size )
}
}
int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size )
static int mmap_is_in_reserved_area( void *addr, SIZE_T size )
{
struct reserved_area *area;
struct list *ptr;
......@@ -477,8 +479,8 @@ int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size )
return 0;
}
int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg),
void *arg, int top_down )
static int mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg),
void *arg, int top_down )
{
int ret = 0;
struct list *ptr;
......
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