diff --git a/reactos/dll/ntdll/CMakeLists.txt b/reactos/dll/ntdll/CMakeLists.txt index 65e543bf66d..62069bb9986 100644 --- a/reactos/dll/ntdll/CMakeLists.txt +++ b/reactos/dll/ntdll/CMakeLists.txt @@ -27,7 +27,7 @@ list(APPEND SOURCE if(ARCH MATCHES i386) list(APPEND SOURCE dispatch/i386/dispatch.S) elseif(ARCH MATCHES amd64) - list(APPEND SOURCE dispatch/amd64/stubs.c) + list(APPEND SOURCE dispatch/amd64/dispatch.S) elseif(ARCH MATCHES arm) list(APPEND SOURCE dispatch/arm/stubs_asm.s) else() diff --git a/reactos/dll/ntdll/def/ntdll.spec b/reactos/dll/ntdll/def/ntdll.spec index ec779e88411..3464847710f 100644 --- a/reactos/dll/ntdll/def/ntdll.spec +++ b/reactos/dll/ntdll/def/ntdll.spec @@ -60,9 +60,9 @@ @ stdcall -arch=i386 KiFastSystemCall() @ stdcall -arch=i386 KiFastSystemCallRet() @ stdcall -arch=i386 KiIntSystemCall() -@ stdcall -arch=i386 ExpInterlockedPopEntrySListEnd() -@ stdcall -arch=i386 ExpInterlockedPopEntrySListFault() -@ stdcall -arch=i386 ExpInterlockedPopEntrySListResume() +@ stdcall -arch=i386,x86_64 ExpInterlockedPopEntrySListEnd() +@ stdcall -arch=i386,x86_64 ExpInterlockedPopEntrySListFault() +@ stdcall -arch=i386,x86_64 ExpInterlockedPopEntrySListResume() @ stdcall KiRaiseUserExceptionDispatcher() @ stdcall KiUserApcDispatcher(ptr ptr ptr ptr) @ stdcall KiUserCallbackDispatcher(ptr ptr long) ; CHECKME diff --git a/reactos/dll/ntdll/dispatch/amd64/dispatch.S b/reactos/dll/ntdll/dispatch/amd64/dispatch.S new file mode 100644 index 00000000000..f433c5fb22e --- /dev/null +++ b/reactos/dll/ntdll/dispatch/amd64/dispatch.S @@ -0,0 +1,75 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntdll/dispatch/amd64/dispatch.S + * PURPOSE: Usermode dispatcher stubs + * + * PROGRAMMER: Timo kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +EXTERN NtContinue:PROC +EXTERN LdrpInit:PROC + +.code + +PUBLIC LdrInitializeThunk +.PROC LdrInitializeThunk + mov rbp, 0 + .setframe rbp, 0 + .endprolog + + /* First parameter is the APC context */ + mov rcx, r9 + jmp LdrpInit + +.ENDP + +PUBLIC KiUserApcDispatcher +.PROC KiUserApcDispatcher + .endprolog + /* We enter with a 16 byte aligned stack */ + + mov rcx, [rsp + CONTEXT_P1Home] /* NormalContext */ + mov rdx, [rsp + CONTEXT_P2Home] /* SystemArgument1 */ + mov r8, [rsp + CONTEXT_P3Home] /* SystemArgument2 */ + lea r9, [rsp] /* Context */ + call qword ptr [rsp + CONTEXT_P4Home] /* NormalRoutine */ + + /* NtContinue(Context, TRUE); */ + lea rcx, [rsp] + mov dl, 1 + call NtContinue + + nop + int 3 +.ENDP + + +PUBLIC KiRaiseUserExceptionDispatcher +.PROC KiRaiseUserExceptionDispatcher + .endprolog + int 3 + +.ENDP + +PUBLIC KiUserCallbackDispatcher +.PROC KiUserCallbackDispatcher + .endprolog + int 3 + +.ENDP + +PUBLIC KiUserExceptionDispatcher +.PROC KiUserExceptionDispatcher + .endprolog + int 3 + +.ENDP + +END + diff --git a/reactos/dll/ntdll/ldr/ldrinit.c b/reactos/dll/ntdll/ldr/ldrinit.c index fdf28f7fc46..240eea059b3 100644 --- a/reactos/dll/ntdll/ldr/ldrinit.c +++ b/reactos/dll/ntdll/ldr/ldrinit.c @@ -124,7 +124,7 @@ LdrOpenImageFileOptionsKey(IN PUNICODE_STRING SubKey, /* Setup the object attributes */ InitializeObjectAttributes(&ObjectAttributes, - Wow64 ? + Wow64 ? &Wow64OptionsString : &ImageExecOptionsString, OBJ_CASE_INSENSITIVE, NULL, @@ -441,7 +441,7 @@ LdrpInitSecurityCookie(PLDR_DATA_TABLE_ENTRY LdrEntry) { PULONG_PTR Cookie; LARGE_INTEGER Counter; - ULONG NewCookie; + ULONG_PTR NewCookie; /* Fetch address of the cookie */ Cookie = LdrpFetchAddressOfSecurityCookie(LdrEntry->DllBase, LdrEntry->SizeOfImage); @@ -536,7 +536,7 @@ LdrpInitializeThread(IN PCONTEXT Context) EntryPoint = LdrEntry->EntryPoint; /* Check if we are ready to call it */ - if ((EntryPoint) && + if ((EntryPoint) && (LdrEntry->Flags & LDRP_PROCESS_ATTACH_CALLED) && (LdrEntry->Flags & LDRP_IMAGE_DLL)) { @@ -939,7 +939,7 @@ LdrShutdownProcess(VOID) EntryPoint = LdrEntry->EntryPoint; /* Check if we are ready to call it */ - if (EntryPoint && + if (EntryPoint && (LdrEntry->Flags & LDRP_PROCESS_ATTACH_CALLED) && LdrEntry->Flags) { @@ -1212,7 +1212,7 @@ LdrpAllocateTls(VOID) PTEB Teb = NtCurrentTeb(); PLIST_ENTRY NextEntry, ListHead; PLDRP_TLS_DATA TlsData; - ULONG TlsDataSize; + SIZE_T TlsDataSize; PVOID *TlsVector; /* Check if we have any entries */ @@ -1236,7 +1236,7 @@ LdrpAllocateTls(VOID) NextEntry = NextEntry->Flink; /* Allocate this vector */ - TlsDataSize = TlsData->TlsDirectory.EndAddressOfRawData - + TlsDataSize = TlsData->TlsDirectory.EndAddressOfRawData - TlsData->TlsDirectory.StartAddressOfRawData; TlsVector[TlsData->TlsDirectory.Characteristics] = RtlAllocateHeap(RtlGetProcessHeap(), 0,