1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

Kernel: Move CPU feature detection to Arch/x86/CPU.{cpp.h}

We now refuse to boot on machines that don't support PAE since all
of our paging code depends on it.

Also let's only enable SSE and PGE support if the CPU advertises it.
This commit is contained in:
Andreas Kling 2020-01-01 12:56:21 +01:00
parent 3d59db4be4
commit 5aeaab601e
6 changed files with 70 additions and 44 deletions

View file

@ -5,8 +5,8 @@
#include "Scheduler.h"
#include "kstdio.h"
#include <AK/Types.h>
#include <Kernel/Arch/i386/CPU.h>
#include <Kernel/Arch/i386/APIC.h>
#include <Kernel/Arch/i386/CPU.h>
#include <Kernel/Arch/i386/PIC.h>
#include <Kernel/Arch/i386/PIT.h>
#include <Kernel/CMOS.h>
@ -199,7 +199,7 @@ extern "C" {
multiboot_info_t* multiboot_info_ptr;
}
typedef void (*ctor_func_t)();
typedef void (*ctor_func_t)();
// Defined in the linker script
extern ctor_func_t start_ctors;
@ -207,9 +207,9 @@ extern ctor_func_t end_ctors;
// Define some Itanium C++ ABI methods to stop the linker from complaining
// If we actually call these something has gone horribly wrong
void* __dso_handle __attribute__((visibility ("hidden")));
void* __dso_handle __attribute__((visibility("hidden")));
extern "C" int __cxa_atexit ( void (*)(void *), void *, void *)
extern "C" int __cxa_atexit(void (*)(void*), void*, void*)
{
ASSERT_NOT_REACHED();
return 0;
@ -236,7 +236,7 @@ extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables)
if (multiboot_info_ptr->cmdline && bad_prefix_check(reinterpret_cast<const char*>(multiboot_info_ptr->cmdline), "serial_debug"))
set_serial_debug(true);
sse_init();
detect_cpu_features();
kmalloc_init();
slab_alloc_init();
@ -251,6 +251,13 @@ extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables)
auto console = make<Console>();
kprintf("Starting SerenityOS...\n");
if (g_cpu_supports_sse) {
sse_init();
kprintf("x86: SSE support enabled\n");
}
RTC::initialize();
PIC::initialize();
gdt_init();
@ -275,8 +282,6 @@ extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables)
tty1 = new VirtualConsole(1);
VirtualConsole::switch_to(0);
kprintf("Starting SerenityOS...\n");
MemoryManager::initialize(physical_address_for_kernel_page_tables);
if (APIC::init())