Commit b35f0007 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Move LdrInitializeThunk to the CPU backends.

parent db89311a
...@@ -4188,28 +4188,17 @@ static void release_address_space(void) ...@@ -4188,28 +4188,17 @@ static void release_address_space(void)
} }
/****************************************************************** /******************************************************************
* LdrInitializeThunk (NTDLL.@) * loader_init
* *
* Attach to all the loaded dlls. * Attach to all the loaded dlls.
* If this is the first time, perform the full process initialization. * If this is the first time, perform the full process initialization.
*/ */
void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR unknown3, ULONG_PTR unknown4 ) void loader_init( CONTEXT *context, void **entry )
{ {
static int attach_done; static int attach_done;
NTSTATUS status; NTSTATUS status;
ULONG_PTR cookie; ULONG_PTR cookie;
WINE_MODREF *wm; WINE_MODREF *wm;
void **entry;
#ifdef __i386__
entry = (void **)&context->Eax;
#elif defined(__x86_64__)
entry = (void **)&context->Rcx;
#elif defined(__arm__)
entry = (void **)&context->R0;
#elif defined(__aarch64__)
entry = (void **)&context->X0;
#endif
if (process_detaching) NtTerminateThread( GetCurrentThread(), 0 ); if (process_detaching) NtTerminateThread( GetCurrentThread(), 0 );
...@@ -4335,7 +4324,6 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR ...@@ -4335,7 +4324,6 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
} }
RtlLeaveCriticalSection( &loader_section ); RtlLeaveCriticalSection( &loader_section );
signal_start_thread( context );
} }
......
...@@ -68,12 +68,12 @@ extern const char *debugstr_exception_code( DWORD code ) DECLSPEC_HIDDEN; ...@@ -68,12 +68,12 @@ extern const char *debugstr_exception_code( DWORD code ) DECLSPEC_HIDDEN;
extern void set_native_thread_name( DWORD tid, const char *name ) DECLSPEC_HIDDEN; extern void set_native_thread_name( DWORD tid, const char *name ) DECLSPEC_HIDDEN;
/* init routines */ /* init routines */
extern void loader_init( CONTEXT *context, void **entry ) DECLSPEC_HIDDEN;
extern void version_init(void) DECLSPEC_HIDDEN; extern void version_init(void) DECLSPEC_HIDDEN;
extern void debug_init(void) DECLSPEC_HIDDEN; extern void debug_init(void) DECLSPEC_HIDDEN;
extern void actctx_init(void) DECLSPEC_HIDDEN; extern void actctx_init(void) DECLSPEC_HIDDEN;
extern void locale_init(void) DECLSPEC_HIDDEN; extern void locale_init(void) DECLSPEC_HIDDEN;
extern void init_user_process_params(void) DECLSPEC_HIDDEN; extern void init_user_process_params(void) DECLSPEC_HIDDEN;
extern void CDECL DECLSPEC_NORETURN signal_start_thread( CONTEXT *ctx ) DECLSPEC_HIDDEN;
extern void get_resource_lcids( LANGID *user, LANGID *user_neutral, LANGID *system ) DECLSPEC_HIDDEN; extern void get_resource_lcids( LANGID *user, LANGID *user_neutral, LANGID *system ) DECLSPEC_HIDDEN;
/* module handling */ /* module handling */
......
...@@ -1487,13 +1487,14 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ...@@ -1487,13 +1487,14 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
return 0; return 0;
} }
/*********************************************************************** /******************************************************************
* signal_start_thread * LdrInitializeThunk (NTDLL.@)
*/ */
__ASM_GLOBAL_FUNC( signal_start_thread, void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unk2, ULONG_PTR unk3, ULONG_PTR unk4 )
"mov sp, r0\n\t" /* context */ {
"mov r1, #1\n\t" loader_init( context, (void **)&context->R0 );
"b " __ASM_NAME("NtContinue") ) NtContinue( context, TRUE );
}
/********************************************************************** /**********************************************************************
* DbgBreakPoint (NTDLL.@) * DbgBreakPoint (NTDLL.@)
......
...@@ -1524,13 +1524,14 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ...@@ -1524,13 +1524,14 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
return 0; return 0;
} }
/*********************************************************************** /******************************************************************
* signal_start_thread * LdrInitializeThunk (NTDLL.@)
*/ */
__ASM_GLOBAL_FUNC( signal_start_thread, void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unk2, ULONG_PTR unk3, ULONG_PTR unk4 )
"mov sp, x0\n\t" /* context */ {
"mov x1, #1\n\t" loader_init( context, (void **)&context->X0 );
"b " __ASM_NAME("NtContinue") ) NtContinue( context, TRUE );
}
/********************************************************************** /**********************************************************************
* DbgBreakPoint (NTDLL.@) * DbgBreakPoint (NTDLL.@)
......
...@@ -537,6 +537,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ...@@ -537,6 +537,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
/*********************************************************************** /***********************************************************************
* signal_start_thread * signal_start_thread
*/ */
extern void CDECL DECLSPEC_NORETURN signal_start_thread( CONTEXT *ctx ) DECLSPEC_HIDDEN;
__ASM_GLOBAL_FUNC( signal_start_thread, __ASM_GLOBAL_FUNC( signal_start_thread,
"movl 4(%esp),%esi\n\t" /* context */ "movl 4(%esp),%esi\n\t" /* context */
"leal -12(%esi),%edi\n\t" "leal -12(%esi),%edi\n\t"
...@@ -554,6 +555,16 @@ __ASM_GLOBAL_FUNC( signal_start_thread, ...@@ -554,6 +555,16 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
"movl %esi,(%esp)\n\t" "movl %esi,(%esp)\n\t"
"call " __ASM_STDCALL("NtContinue", 8) ) "call " __ASM_STDCALL("NtContinue", 8) )
/******************************************************************
* LdrInitializeThunk (NTDLL.@)
*/
void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unk2, ULONG_PTR unk3, ULONG_PTR unk4 )
{
loader_init( context, (void **)&context->Eax );
signal_start_thread( context );
}
/********************************************************************** /**********************************************************************
* DbgBreakPoint (NTDLL.@) * DbgBreakPoint (NTDLL.@)
*/ */
......
...@@ -1590,6 +1590,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ...@@ -1590,6 +1590,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
/*********************************************************************** /***********************************************************************
* signal_start_thread * signal_start_thread
*/ */
extern void CDECL DECLSPEC_NORETURN signal_start_thread( CONTEXT *ctx ) DECLSPEC_HIDDEN;
__ASM_GLOBAL_FUNC( signal_start_thread, __ASM_GLOBAL_FUNC( signal_start_thread,
"movq %rcx,%rbx\n\t" /* context */ "movq %rcx,%rbx\n\t" /* context */
/* clear the thread stack */ /* clear the thread stack */
...@@ -1607,6 +1608,16 @@ __ASM_GLOBAL_FUNC( signal_start_thread, ...@@ -1607,6 +1608,16 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
"call " __ASM_NAME("NtContinue") ) "call " __ASM_NAME("NtContinue") )
/******************************************************************
* LdrInitializeThunk (NTDLL.@)
*/
void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unk2, ULONG_PTR unk3, ULONG_PTR unk4 )
{
loader_init( context, (void **)&context->Rcx );
signal_start_thread( context );
}
/********************************************************************** /**********************************************************************
* DbgBreakPoint (NTDLL.@) * DbgBreakPoint (NTDLL.@)
*/ */
......
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