Preserve caller esp value

This commit is contained in:
Anthony Miles 2019-07-20 18:49:24 +12:00
parent f62030a548
commit 5e1851fcad
1 changed files with 9 additions and 6 deletions

View File

@ -364,7 +364,7 @@ __declspec(naked) void EmuFS_MovzxEaxBytePtrFs24()
movzx eax, byte ptr[eax + 24h] movzx eax, byte ptr[eax + 24h]
call UnlockFS call UnlockFS
ret ret
} }
UnlockFS(); UnlockFS();
} }
@ -420,14 +420,17 @@ __declspec(naked) void EmuFS_MovFs00Esp()
{ {
// Note : eax must be preserved here, hence the push/pop // Note : eax must be preserved here, hence the push/pop
__asm __asm
{ {
pushfd
call LockFS call LockFS
call EmuFS_RefreshKPCR call EmuFS_RefreshKPCR
push eax push eax
mov eax, fs : [TIB_ArbitraryDataSlot] mov eax, fs : [TIB_ArbitraryDataSlot]
mov [eax], esp mov [eax], esp
add [eax], 12 // account for esp changes from pushed registers and return address
pop eax pop eax
call UnlockFS call UnlockFS
popfd
ret ret
} }
} }