From 855384aeada15a3c6a01744fb6f0b30f54184151 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 Mar 2023 06:23:57 +0200 Subject: [PATCH] Fix for SIMD not being initialized --- Core/CPU.cpp | 5 ++++- KConfig.cpp | 6 +++--- Kernel.cpp | 20 ++++++++++---------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Core/CPU.cpp b/Core/CPU.cpp index ad75a03..4ff4d01 100644 --- a/Core/CPU.cpp +++ b/Core/CPU.cpp @@ -218,8 +218,11 @@ namespace CPU SSESupport = true; } - if (!Config.SIMD) + if (Config.SIMD == false) + { + debug("Disabling SSE support..."); SSESupport = false; + } if (PGESupport) { diff --git a/KConfig.cpp b/KConfig.cpp index 730472b..bf05d4f 100644 --- a/KConfig.cpp +++ b/KConfig.cpp @@ -378,21 +378,21 @@ ParseSuccess: case 'o': { value = cag_option_get_value(&context); - strcmp(value, "true") ? config.InterruptsOnCrash = false : config.InterruptsOnCrash = true; + strcmp(value, "true") == 0 ? config.InterruptsOnCrash = true : config.InterruptsOnCrash = false; KPrint("\eAAFFAAInterrupts on crash: %s", value); break; } case 'l': { value = cag_option_get_value(&context); - strcmp(value, "true") ? config.UnlockDeadLock = false : config.UnlockDeadLock = true; + strcmp(value, "true") == 0 ? config.UnlockDeadLock = true : config.UnlockDeadLock = false; KPrint("\eAAFFAAUnlocking the deadlock after 10 retries"); break; } case 's': { value = cag_option_get_value(&context); - strcmp(value, "true") ? config.SIMD = false : config.SIMD = true; + strcmp(value, "true") == 0 ? config.SIMD = true : config.SIMD = false; KPrint("\eAAFFAASingle Instruction, Multiple Data (SIMD): %s", value); break; } diff --git a/Kernel.cpp b/Kernel.cpp index e3f8371..fe854c6 100644 --- a/Kernel.cpp +++ b/Kernel.cpp @@ -182,6 +182,8 @@ EXTERNC NIF void Main(BootInfo *Info) KPrint("CPU: \e8822AA%s \e8888FF%s (\e058C19%s\e8888FF)", CPU::Vendor(), CPU::Name(), CPU::Hypervisor()); KPrint("Initializing GDT and IDT"); Interrupts::Initialize(0); + KPrint("Reading Kernel Parameters"); + Config = ParseConfig((char *)bInfo->Kernel.CommandLine); KPrint("Initializing CPU Features"); CPU::InitializeFeatures(0); @@ -193,8 +195,6 @@ EXTERNC NIF void Main(BootInfo *Info) KPrint("Loading Kernel Symbols"); KernelSymbolTable = new SymbolResolver::Symbols((uintptr_t)Info->Kernel.FileBase); - KPrint("Reading Kernel Parameters"); - Config = ParseConfig((char *)bInfo->Kernel.CommandLine); KPrint("Initializing Power Manager"); PowerManager = new Power::Power; KPrint("Initializing PCI Manager"); @@ -380,17 +380,17 @@ EXTERNC __no_stack_protector NIF void BeforeShutdown() /* TODO: Announce shutdown */ trace("\n\n\n#################### SYSTEM SHUTTING DOWN ####################\n\n"); - delete NIManager; + delete NIManager, NIManager = nullptr; - delete DiskManager; - delete DriverManager; + delete DiskManager, DiskManager = nullptr; + delete DriverManager, DriverManager = nullptr; TaskManager->SignalShutdown(); - delete TaskManager; + delete TaskManager, TaskManager = nullptr; if (RecoveryScreen) - delete RecoveryScreen; - delete vfs; - delete TimeManager; - delete Display; + delete RecoveryScreen, RecoveryScreen = nullptr; + delete vfs, vfs = nullptr; + delete TimeManager, TimeManager = nullptr; + delete Display, Display = nullptr; // PowerManager should not be called // https://wiki.osdev.org/Calling_Global_Constructors