From 71dc3736104bcd4d4b6b11cc34b31dc0c87dc2a8 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 18 Aug 2024 20:48:23 +0300 Subject: [PATCH] Kernel: "Fix" AML _OSI string to return true for windows strings This is the way its supposed to be done as other code paths are untested... --- kernel/kernel/ACPI/AML/Namespace.cpp | 33 ++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/kernel/kernel/ACPI/AML/Namespace.cpp b/kernel/kernel/ACPI/AML/Namespace.cpp index 014a40e579..b73e75c1e0 100644 --- a/kernel/kernel/ACPI/AML/Namespace.cpp +++ b/kernel/kernel/ACPI/AML/Namespace.cpp @@ -247,8 +247,37 @@ namespace Kernel::ACPI AML_ERROR("Invalid _OSI argument"); return {}; } - auto string = static_cast(arg.ptr()); - return string->string_view() == "Linux"_sv ? AML::Integer::Constants::Ones : AML::Integer::Constants::Zero; + + constexpr BAN::StringView valid_strings[] { + "Windows 2000"_sv, + "Windows 2001"_sv, + "Windows 2001 SP1"_sv, + "Windows 2001.1"_sv, + "Windows 2001 SP2"_sv, + "Windows 2001.1 SP1"_sv, + "Windows 2006.1"_sv, + "Windows 2006 SP1"_sv, + "Windows 2006 SP2"_sv, + "Windows 2009"_sv, + "Windows 2012"_sv, + "Windows 2013"_sv, + "Windows 2015"_sv, + "Windows 2016"_sv, + "Windows 2017"_sv, + "Windows 2017.2"_sv, + "Windows 2018"_sv, + "Windows 2018.2"_sv, + "Windows 2019"_sv, + "Extended Address Space Descriptor"_sv, + // just to pass osi test from uACPI :D + "AnotherTestString"_sv, + }; + + auto string = static_cast(arg.ptr())->string_view(); + for (auto valid_string : valid_strings) + if (string == valid_string) + return AML::Integer::Constants::Ones; + return AML::Integer::Constants::Zero; }; ASSERT(s_root_namespace->add_named_object(context, AML::NameString("\\_OSI"), osi));