diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp index 94109ea450..3155dd6bdc 100644 --- a/Kernel/CommandLine.cpp +++ b/Kernel/CommandLine.cpp @@ -25,34 +25,21 @@ */ #include -#include namespace Kernel { -static char s_cmd_line[1024]; static CommandLine* s_the; -void CommandLine::early_initialize(const char* cmd_line) -{ - if (!cmd_line) - return; - size_t length = strlen(cmd_line); - if (length >= sizeof(s_cmd_line)) - length = sizeof(s_cmd_line) -1; - memcpy(s_cmd_line, cmd_line, length); - s_cmd_line[length] = '\0'; -} - const CommandLine& kernel_command_line() { ASSERT(s_the); return *s_the; } -void CommandLine::initialize() +void CommandLine::initialize(const String& string) { ASSERT(!s_the); - s_the = new CommandLine(s_cmd_line); + s_the = new CommandLine(string); } CommandLine::CommandLine(const String& string) diff --git a/Kernel/CommandLine.h b/Kernel/CommandLine.h index 0d68f024bc..ec50cd4e9f 100644 --- a/Kernel/CommandLine.h +++ b/Kernel/CommandLine.h @@ -36,8 +36,7 @@ class CommandLine { AK_MAKE_ETERNAL; public: - static void early_initialize(const char* cmd_line); - static void initialize(); + static void initialize(const String&); const String& string() const { return m_string; } Optional lookup(const String& key) const; diff --git a/Kernel/init.cpp b/Kernel/init.cpp index d38b91da18..200d852c8a 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -113,10 +113,6 @@ extern "C" [[noreturn]] void init() { setup_serial_debug(); - // We need to copy the command line before kmalloc is initialized, - // as it may overwrite parts of multiboot! - CommandLine::early_initialize(reinterpret_cast(low_physical_to_virtual(multiboot_info_ptr->cmdline))); - s_bsp_processor.early_initialize(0); // Invoke the constructors needed for the kernel heap @@ -127,7 +123,7 @@ extern "C" [[noreturn]] void init() s_bsp_processor.initialize(0); - CommandLine::initialize(); + CommandLine::initialize(reinterpret_cast(low_physical_to_virtual(multiboot_info_ptr->cmdline))); MemoryManager::initialize(0); // Invoke all static global constructors in the kernel.