Keep usermode stack 4-byte aligned

svn path=/trunk/; revision=13227
This commit is contained in:
Gé van Geldorp 2005-01-23 20:48:19 +00:00
parent e9c80bcd6f
commit c377a52fa4

View file

@ -292,7 +292,8 @@ NtW32Call (IN ULONG RoutineIndex,
memcpy((char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA),
Thread->Tcb.TrapFrame, sizeof(KTRAP_FRAME) - (4 * sizeof(DWORD)));
NewFrame = (PKTRAP_FRAME)((char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA));
NewFrame->Esp -= (ArgumentLength + (4 * sizeof(ULONG)));
/* We need the stack pointer to remain 4-byte aligned */
NewFrame->Esp -= (((ArgumentLength + 3) & (~ 0x3)) + (4 * sizeof(ULONG)));
NewFrame->Eip = (ULONG)LdrpGetSystemDllCallbackDispatcher();
UserEsp = (PULONG)NewFrame->Esp;
UserEsp[0] = 0; /* Return address. */