[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.

svn path=/trunk/; revision=52509
This commit is contained in:
Timo Kreuzer 2011-07-03 01:04:01 +00:00
parent c1276124ac
commit 82562115f8
2 changed files with 26 additions and 13 deletions

View file

@ -707,6 +707,7 @@ KiCheckForApcDelivery(IN PKTRAP_FRAME TrapFrame)
// //
// Converts a base thread to a GUI thread // Converts a base thread to a GUI thread
// //
#ifdef __GNUC__
NTSTATUS NTSTATUS
FORCEINLINE FORCEINLINE
KiConvertToGuiThread(VOID) KiConvertToGuiThread(VOID)
@ -730,7 +731,6 @@ KiConvertToGuiThread(VOID)
* on its merry way. * on its merry way.
* *
*/ */
#ifdef __GNUC__
__asm__ __volatile__ __asm__ __volatile__
( (
"movl %%ebp, %1\n" "movl %%ebp, %1\n"
@ -743,22 +743,15 @@ KiConvertToGuiThread(VOID)
: :
: "%esp", "%ecx", "%edx", "memory" : "%esp", "%ecx", "%edx", "memory"
); );
return Result;
}
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
NTSTATUS NTAPI PsConvertToGuiThread(VOID); NTSTATUS
__asm NTAPI
{ KiConvertToGuiThread(VOID);
mov StackFrame, ebp
sub StackFrame, esp
call PsConvertToGuiThread
add StackFrame, esp
mov ebp, StackFrame
mov Result, eax
}
#else #else
#error Unknown Compiler #error Unknown Compiler
#endif #endif
return Result;
}
// //
// Switches from boot loader to initial kernel stack // Switches from boot loader to initial kernel stack

View file

@ -156,4 +156,24 @@ KiTrapExitStub KiEditedTrapReturn, (KI_RESTORE_VOLATILES OR KI_RESTORE_EF
KiTrapExitStub KiTrapReturn, (KI_RESTORE_VOLATILES OR KI_RESTORE_SEGMENTS OR KI_EXIT_IRET) KiTrapExitStub KiTrapReturn, (KI_RESTORE_VOLATILES OR KI_RESTORE_SEGMENTS OR KI_EXIT_IRET)
KiTrapExitStub KiTrapReturnNoSegments, (KI_RESTORE_VOLATILES 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 END