[ros-diffs] [tkreuzer] 55414: [NTDLL] - Implement amd64 version of LdrInitializeThunk and KiUserApcDispatcher - Export ExpInterlockedPopEntrySList* on amd64, too - Fix some 64 bit issues

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Sat Feb 4 18:25:26 UTC 2012


Author: tkreuzer
Date: Sat Feb  4 18:25:25 2012
New Revision: 55414

URL: http://svn.reactos.org/svn/reactos?rev=55414&view=rev
Log:
[NTDLL]
- Implement amd64 version of LdrInitializeThunk and KiUserApcDispatcher
- Export ExpInterlockedPopEntrySList* on amd64, too
- Fix some 64 bit issues

Added:
    trunk/reactos/dll/ntdll/dispatch/amd64/dispatch.S   (with props)
Modified:
    trunk/reactos/dll/ntdll/CMakeLists.txt
    trunk/reactos/dll/ntdll/def/ntdll.spec
    trunk/reactos/dll/ntdll/ldr/ldrinit.c

Modified: trunk/reactos/dll/ntdll/CMakeLists.txt
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/CMakeLists.txt?rev=55414&r1=55413&r2=55414&view=diff
==============================================================================
--- trunk/reactos/dll/ntdll/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/ntdll/CMakeLists.txt [iso-8859-1] Sat Feb  4 18:25:25 2012
@@ -27,7 +27,7 @@
 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()

Modified: trunk/reactos/dll/ntdll/def/ntdll.spec
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.spec?rev=55414&r1=55413&r2=55414&view=diff
==============================================================================
--- trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] Sat Feb  4 18:25:25 2012
@@ -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

Added: trunk/reactos/dll/ntdll/dispatch/amd64/dispatch.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/dispatch/amd64/dispatch.S?rev=55414&view=auto
==============================================================================
--- trunk/reactos/dll/ntdll/dispatch/amd64/dispatch.S (added)
+++ trunk/reactos/dll/ntdll/dispatch/amd64/dispatch.S [iso-8859-1] Sat Feb  4 18:25:25 2012
@@ -1,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 at reactos.org)
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <asm.inc>
+#include <ksamd64.inc>
+
+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
+

Propchange: trunk/reactos/dll/ntdll/dispatch/amd64/dispatch.S
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/dll/ntdll/ldr/ldrinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/ldrinit.c?rev=55414&r1=55413&r2=55414&view=diff
==============================================================================
--- trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] (original)
+++ trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] Sat Feb  4 18:25:25 2012
@@ -124,7 +124,7 @@
 
     /* Setup the object attributes */
     InitializeObjectAttributes(&ObjectAttributes,
-                               Wow64 ? 
+                               Wow64 ?
                                &Wow64OptionsString : &ImageExecOptionsString,
                                OBJ_CASE_INSENSITIVE,
                                NULL,
@@ -441,7 +441,7 @@
 {
     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 @@
                 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 @@
             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 @@
     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 @@
         NextEntry = NextEntry->Flink;
 
         /* Allocate this vector */
-        TlsDataSize = TlsData->TlsDirectory.EndAddressOfRawData - 
+        TlsDataSize = TlsData->TlsDirectory.EndAddressOfRawData -
                       TlsData->TlsDirectory.StartAddressOfRawData;
         TlsVector[TlsData->TlsDirectory.Characteristics] = RtlAllocateHeap(RtlGetProcessHeap(),
                                                                            0,




More information about the Ros-diffs mailing list