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");
}

View File

@ -772,7 +772,7 @@ namespace PCI
}
#endif
void PCI::EnumerateFunction(uintptr_t DeviceAddress, uintptr_t Function)
void PCI::EnumerateFunction(uintptr_t DeviceAddress, uint64_t Function)
{
uintptr_t Offset = Function << 12;
uintptr_t FunctionAddress = DeviceAddress + Offset;
@ -788,7 +788,7 @@ namespace PCI
#endif
}
void PCI::EnumerateDevice(uintptr_t BusAddress, uintptr_t Device)
void PCI::EnumerateDevice(uintptr_t BusAddress, uint64_t Device)
{
uintptr_t Offset = Device << 15;
uintptr_t DeviceAddress = BusAddress + Offset;
@ -802,7 +802,7 @@ namespace PCI
EnumerateFunction(DeviceAddress, Function);
}
void PCI::EnumerateBus(uintptr_t BaseAddress, uintptr_t Bus)
void PCI::EnumerateBus(uintptr_t BaseAddress, uint64_t Bus)
{
uintptr_t Offset = Bus << 20;
uintptr_t BusAddress = BaseAddress + Offset;

View File

@ -12,7 +12,7 @@
namespace Time
{
void time::Sleep(uintptr_t Milliseconds)
void time::Sleep(uint64_t Milliseconds)
{
#if defined(__amd64__) || defined(__i386__)
uintptr_t Target = mminq(&((HPET *)hpet)->MainCounterValue) + (Milliseconds * 1000000000) / clk;