Compare commits

...

2 Commits

Author SHA1 Message Date
Bananymous d8bb0b53f8 LibImage: Fix PNG palette decoding
I was only loading third of the palette to wrong indices :D
2025-02-12 10:09:03 +02:00
Bananymous 83c66901f8 Kernel: Fix reboot when ACPI is disabled
If ACPI was disabled ACPI::reset() would page fault when accessing
namespace instead of checking wheter namespace is initialized :D
2025-02-11 21:53:20 +02:00
2 changed files with 11 additions and 5 deletions

View File

@ -469,6 +469,9 @@ acpi_release_global_lock:
BAN::ErrorOr<void> ACPI::prepare_sleep(uint8_t sleep_state) BAN::ErrorOr<void> ACPI::prepare_sleep(uint8_t sleep_state)
{ {
if (!m_namespace)
return BAN::Error::from_errno(EFAULT);
auto [pts_path, pts_object] = TRY(m_namespace->find_named_object({}, MUST(AML::NameString::from_string("\\_PTS")))); auto [pts_path, pts_object] = TRY(m_namespace->find_named_object({}, MUST(AML::NameString::from_string("\\_PTS"))));
if (pts_object == nullptr) if (pts_object == nullptr)
return {}; return {};
@ -584,6 +587,9 @@ acpi_release_global_lock:
return BAN::Error::from_errno(EFAULT); return BAN::Error::from_errno(EFAULT);
} }
if (!m_namespace)
dwarnln("ACPI namespace not initialized, will not evaluate \\_S5");
else
TRY(prepare_sleep(5)); TRY(prepare_sleep(5));
dprintln("Resetting system"); dprintln("Resetting system");

View File

@ -773,11 +773,11 @@ namespace LibImage
return BAN::Error::from_errno(EINVAL); return BAN::Error::from_errno(EINVAL);
} }
TRY(palette.resize(chunk.data.size() / 3)); TRY(palette.resize(chunk.data.size() / 3));
for (size_t i = 0; i < palette.size(); i += 3) for (size_t i = 0; i < palette.size(); i++)
{ {
palette[i].r = chunk.data[i + 0]; palette[i].r = chunk.data[3 * i + 0];
palette[i].g = chunk.data[i + 1]; palette[i].g = chunk.data[3 * i + 1];
palette[i].b = chunk.data[i + 2]; palette[i].b = chunk.data[3 * i + 2];
palette[i].a = 0xFF; palette[i].a = 0xFF;
} }
} }