Files
Undefine 14b039b24f Kernel+LibACPI: Move table validation code to LibACPI
It will be used outside of the kernel. While at it clean the function
up a bit to make it a little more readable.
2026-10-21 19:03:12 +02:00

24 lines
425 B
C++

/*
* Copyright (c) 2026, Undefine <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "Table.h"
#include <AK/BitCast.h>
namespace ACPI {
bool validate_table(::ACPI::Structures::SDTHeader const& header)
{
auto const* sdt = reinterpret_cast<u8 const*>(&header);
u8 checksum = 0;
for (size_t i = 0; i < header.length; i++)
checksum += sdt[i];
return checksum == 0;
}
}