[kernel] Unify CPUs' control register settings

Previously, the CPU control registers were being set in a number of
different ways. Now, since the APs' need this to be set in the CPU
initialization code, always do it there. This removes some of the
settings from the bootloader, and some unused ones from smp.s.
Additionally, the control registers' flags are now enums in cpu.h and
manipulated via util::bitset.
This commit is contained in:
Justin C. Miller
2022-03-13 17:45:16 -07:00
parent cca07d97b5
commit 90663a674a
4 changed files with 69 additions and 20 deletions

View File

@@ -60,12 +60,7 @@ setup_control_regs()
{
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;
cr4 |= 0x000080; // Enable global pages
asm volatile ( "mov %0, %%cr4" :: "r" (cr4) );
// Set up IA32_EFER