From 546efd37d0d9e6631a5d5070fddc339db3b27a72 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 6 Mar 2023 03:33:34 +0200 Subject: [PATCH] Added new kernel param --- Core/Interrupts/IntManager.cpp | 2 +- KConfig.cpp | 18 ++++++++++++++++-- include/kconfig.hpp | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Core/Interrupts/IntManager.cpp b/Core/Interrupts/IntManager.cpp index 8e10279..8bbd188 100644 --- a/Core/Interrupts/IntManager.cpp +++ b/Core/Interrupts/IntManager.cpp @@ -74,7 +74,7 @@ namespace Interrupts { // TODO: This function is called by SMP too. Do not initialize timers that doesn't support multiple cores. apic[Core] = new APIC::APIC(Core); - if (Core == 0) // Redirect IRQs to the BSP + if (Core == Config.IOAPICInterruptCore) // Redirect IRQs to the specified core. ((APIC::APIC *)apic[Core])->RedirectIRQs(Core); } else diff --git a/KConfig.cpp b/KConfig.cpp index 1a9927f..0082208 100644 --- a/KConfig.cpp +++ b/KConfig.cpp @@ -36,6 +36,12 @@ static struct cag_option ConfigOptions[] = { .value_name = "VALUE", .description = "Number of cores to use (0 = all; 1 is the first code, not 0)"}, + {.identifier = 'p', + .access_letters = "pP", + .access_name = "ioapicirq", + .value_name = "VALUE", + .description = "Which core will be used for I/O APIC interrupts"}, + {.identifier = 't', .access_letters = "tT", .access_name = "tasking", @@ -77,11 +83,12 @@ KernelConfig ParseConfig(char *Config) int argc = 0; char **argv = nullptr; - struct KernelConfig config = {Memory::MemoryAllocatorType::Pages, + struct KernelConfig config = {Memory::MemoryAllocatorType::XallocV1, 0, {'/', 's', 'y', 's', 't', 'e', 'm', '/', 'd', 'r', 'i', 'v', 'e', 'r', 's', '\0'}, {'/', 's', 'y', 's', 't', 'e', 'm', '/', 'i', 'n', 'i', 't', '\0'}, - false, + true, + 0, 0, false}; @@ -320,6 +327,13 @@ ParseSuccess: config.Cores = atoi(value); break; } + case 'p': + { + value = cag_option_get_value(&context); + KPrint("\eAAFFAARedirecting I/O APIC interrupts to %s%s", atoi(value) ? "core " : "", atoi(value) ? value : "BSP"); + config.IOAPICInterruptCore = atoi(value); + break; + } case 't': { value = cag_option_get_value(&context); diff --git a/include/kconfig.hpp b/include/kconfig.hpp index cca7375..e78c222 100644 --- a/include/kconfig.hpp +++ b/include/kconfig.hpp @@ -12,6 +12,7 @@ struct KernelConfig char InitPath[256]; bool InterruptsOnCrash; int Cores; + int IOAPICInterruptCore; bool UnlockDeadLock; };