mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[boot] Set up CR4 in bootloader
Moving the initial CR4 settings from the kernel's `memory_initialize` (where it doesn't really fit anyway) to the bootloader's `hardware.cpp`.
This commit is contained in:
@@ -36,6 +36,19 @@ find_acpi_table(uefi::system_table *st)
|
||||
return reinterpret_cast<void*>(acpi1_table);
|
||||
}
|
||||
|
||||
void
|
||||
setup_cr4()
|
||||
{
|
||||
uint64_t cr4 = 0;
|
||||
asm volatile ( "mov %%cr4, %0" : "=r" (cr4) );
|
||||
cr4 |=
|
||||
0x000080 | // Enable global pages
|
||||
0x000200 | // Enable FXSAVE/FXRSTOR
|
||||
0x010000 | // Enable FSGSBASE
|
||||
0x020000 | // Enable PCIDs
|
||||
0;
|
||||
asm volatile ( "mov %0, %%cr4" :: "r" (cr4) );
|
||||
}
|
||||
|
||||
} // namespace hw
|
||||
} // namespace boot
|
||||
|
||||
Reference in New Issue
Block a user