Author: tkreuzer
Date: Sun Jul 3 01:04:01 2011
New Revision: 52509
URL:
http://svn.reactos.org/svn/reactos?rev=52509&view=rev
Log:
[NTOSKRNL]
Fix KiConvertToGuiThread on MSVC builds, by using a raw assembly function instead of a
(broken) inline asembly function
MSVC built kernel boots further now.
Modified:
trunk/reactos/ntoskrnl/include/internal/i386/ke.h
trunk/reactos/ntoskrnl/ke/i386/trap.s
Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] Sun Jul 3 01:04:01
2011
@@ -707,6 +707,7 @@
//
// Converts a base thread to a GUI thread
//
+#ifdef __GNUC__
NTSTATUS
FORCEINLINE
KiConvertToGuiThread(VOID)
@@ -730,7 +731,6 @@
* on its merry way.
*
*/
-#ifdef __GNUC__
__asm__ __volatile__
(
"movl %%ebp, %1\n"
@@ -743,22 +743,15 @@
:
: "%esp", "%ecx", "%edx", "memory"
);
+ return Result;
+}
#elif defined(_MSC_VER)
- NTSTATUS NTAPI PsConvertToGuiThread(VOID);
- __asm
- {
- mov StackFrame, ebp
- sub StackFrame, esp
- call PsConvertToGuiThread
- add StackFrame, esp
- mov ebp, StackFrame
- mov Result, eax
- }
+NTSTATUS
+NTAPI
+KiConvertToGuiThread(VOID);
#else
#error Unknown Compiler
#endif
- return Result;
-}
//
// Switches from boot loader to initial kernel stack
Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/trap.s?re…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/trap.s [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/trap.s [iso-8859-1] Sun Jul 3 01:04:01 2011
@@ -156,4 +156,24 @@
KiTrapExitStub KiTrapReturn, (KI_RESTORE_VOLATILES OR KI_RESTORE_SEGMENTS OR
KI_EXIT_IRET)
KiTrapExitStub KiTrapReturnNoSegments, (KI_RESTORE_VOLATILES OR KI_EXIT_IRET)
+#ifdef _MSC_VER
+EXTERN _PsConvertToGuiThread@0:PROC
+
+PUBLIC _KiConvertToGuiThread@0
+_KiConvertToGuiThread@0:
+ /* Calculate the stack frame offset in ebx */
+ mov ebx, ebp
+ sub ebx, esp
+
+ /* Call the worker function */
+ call _PsConvertToGuiThread@0
+
+ /* Adjust ebp to the new stack */
+ mov ebp, esp
+ add ebp, ebx
+
+ /* return to the caller */
+ ret
+#endif
+
END