Compiles on x86 but everything is broken

This commit is contained in:
Alex
2022-12-21 02:11:49 +02:00
parent a677f3c159
commit 985d614be2
16 changed files with 1834 additions and 29 deletions

View File

@ -124,7 +124,13 @@ SafeFunction void PageFaultExceptionHandler(CHArchTrapFrame *Frame)
uintptr_t CheckPageFaultAddress = 0;
CheckPageFaultAddress = CPU::x64::readcr2().PFLA;
if (CheckPageFaultAddress == 0)
#ifdef __amd64__
CheckPageFaultAddress = Frame->rip;
#elif defined(__i386__)
CheckPageFaultAddress = Frame->eip;
#elif defined(__aarch64__)
CheckPageFaultAddress = 0;
#endif
Memory::Virtual vma = Memory::Virtual(((Memory::PageTable4 *)CPU::x64::readcr3().raw));
bool PageAvailable = vma.Check((void *)CheckPageFaultAddress);

View File

@ -14,6 +14,7 @@
#if defined(__amd64__)
#include "../../Architecture/amd64/cpu/gdt.hpp"
#elif defined(__i386__)
#include "../../Architecture/i686/cpu/gdt.hpp"
#elif defined(__aarch64__)
#endif

View File

@ -40,7 +40,12 @@ namespace CrashHandler
#elif defined(__aarch64__)
#endif
{
#if defined(__amd64__)
EHPrint("Invalid rbp pointer: %p\n", Frame->rbp);
#elif defined(__i386__)
EHPrint("Invalid ebp pointer: %p\n", Frame->ebp);
#elif defined(__aarch64__)
#endif
return;
}

View File

@ -61,9 +61,9 @@ namespace CrashHandler
uintptr_t LastRIP = 0;
for (int i = 0; i < 128; i++)
{
if (data.Thread->RIPHistory[i] == 0)
if (data.Thread->IPHistory[i] == 0)
break;
if (data.Thread->RIPHistory[i] == LastRIP)
if (data.Thread->IPHistory[i] == LastRIP)
{
SameItr++;
if (SameItr > 3)
@ -71,11 +71,11 @@ namespace CrashHandler
}
else
SameItr = 0;
LastRIP = data.Thread->RIPHistory[i];
LastRIP = data.Thread->IPHistory[i];
if (!sh)
EHPrint("\n\e2565CC%p", data.Thread->RIPHistory[i]);
EHPrint("\n\e2565CC%p", data.Thread->IPHistory[i]);
else
EHPrint("\n\e2565CC%p\e7925CC-\e25CCC9%s", data.Thread->RIPHistory[i], sh->GetSymbolFromAddress(data.Thread->RIPHistory[i]));
EHPrint("\n\e2565CC%p\e7925CC-\e25CCC9%s", data.Thread->IPHistory[i], sh->GetSymbolFromAddress(data.Thread->IPHistory[i]));
}
EHPrint("\n\e7925CCNote: \e2565CCSame RIPs are not shown more than 3 times.\n");
}