mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-11 15:29:18 +00:00
x32 is now compiling
This commit is contained in:
@ -103,7 +103,7 @@ namespace Xalloc
|
||||
{
|
||||
if (this->SMAPUsed)
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
#if defined(a64) || defined(a32)
|
||||
asm volatile("stac" ::
|
||||
: "cc");
|
||||
#endif
|
||||
@ -114,7 +114,7 @@ namespace Xalloc
|
||||
{
|
||||
if (this->SMAPUsed)
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
#if defined(a64) || defined(a32)
|
||||
asm volatile("clac" ::
|
||||
: "cc");
|
||||
#endif
|
||||
|
@ -39,7 +39,7 @@ NIF void tracepagetable(PageTable4 *pt)
|
||||
{
|
||||
for (int i = 0; i < 512; i++)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
#if defined(a64)
|
||||
if (pt->Entries[i].Present)
|
||||
debug("Entry %03d: %x %x %x %x %x %x %x %p-%#llx", i,
|
||||
pt->Entries[i].Present, pt->Entries[i].ReadWrite,
|
||||
@ -47,8 +47,8 @@ NIF void tracepagetable(PageTable4 *pt)
|
||||
pt->Entries[i].CacheDisable, pt->Entries[i].Accessed,
|
||||
pt->Entries[i].ExecuteDisable, pt->Entries[i].Address << 12,
|
||||
pt->Entries[i]);
|
||||
#elif defined(__i386__)
|
||||
#elif defined(__aarch64__)
|
||||
#elif defined(a32)
|
||||
#elif defined(aa64)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -232,9 +232,9 @@ NIF void InitializeMemoryManagement(BootInfo *Info)
|
||||
tracepagetable(UserspaceKernelOnlyPageTable);
|
||||
#endif
|
||||
KPT = KernelPageTable;
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
#if defined(a64) || defined(a32)
|
||||
asmv("mov %0, %%cr3" ::"r"(KPT));
|
||||
#elif defined(__aarch64__)
|
||||
#elif defined(aa64)
|
||||
asmv("msr ttbr0_el1, %0" ::"r"(KPT));
|
||||
#endif
|
||||
debug("Page table updated.");
|
||||
|
@ -192,7 +192,11 @@ namespace Memory
|
||||
if (PageTable)
|
||||
this->PageTable = PageTable;
|
||||
else
|
||||
#if defined(a64)
|
||||
this->PageTable = (PageTable4 *)CPU::x64::readcr3().raw;
|
||||
#elif defined(a32)
|
||||
this->PageTable = (PageTable4 *)CPU::x32::readcr3().raw;
|
||||
#endif
|
||||
|
||||
this->Directory = Directory;
|
||||
debug("+ %#lx", this);
|
||||
|
@ -4,7 +4,7 @@ namespace Memory
|
||||
{
|
||||
Virtual::PageMapIndexer::PageMapIndexer(uintptr_t VirtualAddress)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
#if defined(a64)
|
||||
uintptr_t Address = VirtualAddress;
|
||||
Address >>= 12;
|
||||
this->PTEIndex = Address & 0x1FF;
|
||||
@ -14,7 +14,7 @@ namespace Memory
|
||||
this->PDPTEIndex = Address & 0x1FF;
|
||||
Address >>= 9;
|
||||
this->PMLIndex = Address & 0x1FF;
|
||||
#elif defined(__i386__)
|
||||
#elif defined(a32)
|
||||
uintptr_t Address = VirtualAddress;
|
||||
Address >>= 12;
|
||||
this->PTEIndex = Address & 0x3FF;
|
||||
@ -22,7 +22,7 @@ namespace Memory
|
||||
this->PDEIndex = Address & 0x3FF;
|
||||
Address >>= 10;
|
||||
this->PDPTEIndex = Address & 0x3FF;
|
||||
#elif defined(__aarch64__)
|
||||
#elif defined(aa64)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -101,11 +101,11 @@ namespace Memory
|
||||
PTE.SetAddress((uintptr_t)PhysicalAddress >> 12);
|
||||
PTEPtr->Entries[Index.PTEIndex] = PTE;
|
||||
|
||||
#if defined(__amd64__)
|
||||
#if defined(a64)
|
||||
CPU::x64::invlpg(VirtualAddress);
|
||||
#elif defined(__i386__)
|
||||
#elif defined(a32)
|
||||
CPU::x32::invlpg(VirtualAddress);
|
||||
#elif defined(__aarch64__)
|
||||
#elif defined(aa64)
|
||||
asmv("dsb sy");
|
||||
asmv("tlbi vae1is, %0"
|
||||
:
|
||||
@ -180,11 +180,11 @@ namespace Memory
|
||||
PTE.Present = false;
|
||||
PTEPtr->Entries[Index.PTEIndex] = PTE;
|
||||
|
||||
#if defined(__amd64__)
|
||||
#if defined(a64)
|
||||
CPU::x64::invlpg(VirtualAddress);
|
||||
#elif defined(__i386__)
|
||||
#elif defined(a32)
|
||||
CPU::x32::invlpg(VirtualAddress);
|
||||
#elif defined(__aarch64__)
|
||||
#elif defined(aa64)
|
||||
asmv("dsb sy");
|
||||
asmv("tlbi vae1is, %0"
|
||||
:
|
||||
|
Reference in New Issue
Block a user