KPCR recovery without memory change
This commit is contained in:
parent
f488a05cdc
commit
0bcc81215c
|
@ -92,10 +92,7 @@ void EmuKeSetPcr(xboxkrnl::KPCR *Pcr)
|
|||
// the user data-slot of each Windows thread Cxbx uses for an
|
||||
// Xbox thread.
|
||||
//
|
||||
__asm {
|
||||
mov eax, Pcr
|
||||
mov fs : [TIB_ArbitraryDataSlot], eax
|
||||
}
|
||||
__writefsdword(TIB_ArbitraryDataSlot, (DWORD)Pcr);
|
||||
}
|
||||
|
||||
__declspec(naked) void EmuFS_CmpEsiFs00()
|
||||
|
|
|
@ -138,12 +138,16 @@ BOOLEAN KiInsertTreeTimer(
|
|||
// ******************************************************************
|
||||
xboxkrnl::KPCR* KeGetPcr()
|
||||
{
|
||||
xboxkrnl::KPCR* Pcr;
|
||||
xboxkrnl::PKPCR Pcr;
|
||||
|
||||
// See EmuKeSetPcr()
|
||||
__asm {
|
||||
mov eax, fs : [TIB_ArbitraryDataSlot]
|
||||
mov Pcr, eax
|
||||
Pcr = (xboxkrnl::PKPCR)__readfsdword(TIB_ArbitraryDataSlot);
|
||||
|
||||
if (Pcr == nullptr) {
|
||||
EmuWarning("KeGetPCR returned nullptr: Was this called from a non-xbox thread?");
|
||||
// Attempt to salvage the situation by calling InitXboxThread to setup KPCR in place
|
||||
InitXboxThread(g_CPUXbox);
|
||||
Pcr = (xboxkrnl::PKPCR)__readfsdword(TIB_ArbitraryDataSlot);
|
||||
}
|
||||
|
||||
return Pcr;
|
||||
|
|
Loading…
Reference in New Issue