Update i686 thread context initialization to match AMD64
This commit is contained in:
@@ -428,18 +428,19 @@ typedef struct _KEXCEPTION_FRAME
|
|||||||
/* Thread start frame definition */
|
/* Thread start frame definition */
|
||||||
typedef struct _KSTART_FRAME
|
typedef struct _KSTART_FRAME
|
||||||
{
|
{
|
||||||
PKSYSTEM_ROUTINE SystemRoutine;
|
ULONG P1Home;
|
||||||
PKSTART_ROUTINE StartRoutine;
|
ULONG P2Home;
|
||||||
PVOID StartContext;
|
ULONG P3Home;
|
||||||
BOOLEAN UserMode;
|
BOOLEAN UserMode;
|
||||||
|
ULONG Return;
|
||||||
} KSTART_FRAME, *PKSTART_FRAME;
|
} KSTART_FRAME, *PKSTART_FRAME;
|
||||||
|
|
||||||
/* Switch frame definition */
|
/* Switch frame definition */
|
||||||
typedef struct _KSWITCH_FRAME
|
typedef struct _KSWITCH_FRAME
|
||||||
{
|
{
|
||||||
PVOID ExceptionList;
|
PVOID ExceptionList;
|
||||||
BOOLEAN ApcBypassDisabled;
|
KRUNLEVEL ApcBypass;
|
||||||
PVOID Return;
|
ULONG Return;
|
||||||
} KSWITCH_FRAME, *PKSWITCH_FRAME;
|
} KSWITCH_FRAME, *PKSWITCH_FRAME;
|
||||||
|
|
||||||
/* Trap frame definition */
|
/* Trap frame definition */
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ KE::Dispatcher::SwitchThreadStack(IN PKTHREAD CurrentThread,
|
|||||||
:
|
:
|
||||||
: [FrameSize] "i" (sizeof(KSWITCH_FRAME) - 4),
|
: [FrameSize] "i" (sizeof(KSWITCH_FRAME) - 4),
|
||||||
[PrcbcCurrentThread] "i" (FIELD_OFFSET(KPROCESSOR_BLOCK, Prcb.CurrentThread)),
|
[PrcbcCurrentThread] "i" (FIELD_OFFSET(KPROCESSOR_BLOCK, Prcb.CurrentThread)),
|
||||||
[SwApcBypass] "i" (FIELD_OFFSET(KSWITCH_FRAME, ApcBypassDisabled)),
|
[SwApcBypass] "i" (FIELD_OFFSET(KSWITCH_FRAME, ApcBypass)),
|
||||||
[SwExceptionList] "i" (FIELD_OFFSET(KSWITCH_FRAME, ExceptionList)),
|
[SwExceptionList] "i" (FIELD_OFFSET(KSWITCH_FRAME, ExceptionList)),
|
||||||
[SwitchRoutine] "i" (SwitchThreadContext),
|
[SwitchRoutine] "i" (SwitchThreadContext),
|
||||||
[ThrdInfoExceptions] "i" (FIELD_OFFSET(THREAD_INFORMATION_BLOCK, ExceptionList)),
|
[ThrdInfoExceptions] "i" (FIELD_OFFSET(THREAD_INFORMATION_BLOCK, ExceptionList)),
|
||||||
|
|||||||
@@ -121,14 +121,14 @@ KE::KThread::InitializeThreadContext(IN PKTHREAD Thread,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize thread startup information */
|
/* Initialize thread startup information */
|
||||||
ThreadFrame->StartFrame.StartContext = StartContext;
|
ThreadFrame->StartFrame.P1Home = (ULONG)StartContext;
|
||||||
ThreadFrame->StartFrame.StartRoutine = StartRoutine;
|
ThreadFrame->StartFrame.P2Home = (ULONG)StartRoutine;
|
||||||
ThreadFrame->StartFrame.SystemRoutine = SystemRoutine;
|
ThreadFrame->StartFrame.P3Home = (ULONG)SystemRoutine;
|
||||||
|
|
||||||
/* Initialize switch frame */
|
/* Initialize switch frame */
|
||||||
ThreadFrame->SwitchFrame.ApcBypassDisabled = TRUE;
|
ThreadFrame->SwitchFrame.ApcBypass = APC_LEVEL;
|
||||||
ThreadFrame->SwitchFrame.ExceptionList = (PEXCEPTION_REGISTRATION_RECORD) - 1;
|
ThreadFrame->SwitchFrame.ExceptionList = (PEXCEPTION_REGISTRATION_RECORD) - 1;
|
||||||
ThreadFrame->SwitchFrame.Return = (PVOID)(ULONG)RunThread;
|
ThreadFrame->SwitchFrame.Return = (ULONG)RunThread;
|
||||||
|
|
||||||
/* Set thread stack boundaries */
|
/* Set thread stack boundaries */
|
||||||
Thread->InitialStack = (PVOID)&ThreadFrame->NpxFrame;
|
Thread->InitialStack = (PVOID)&ThreadFrame->NpxFrame;
|
||||||
|
|||||||
Reference in New Issue
Block a user