Kernel: Fix HPET validation
This commit is contained in:
@@ -136,8 +136,7 @@ namespace Kernel
|
||||
auto* header = static_cast<const ACPI::HPET*>(ACPI::ACPI::get().get_header("HPET"_sv, 0));
|
||||
if (header == nullptr)
|
||||
return BAN::Error::from_errno(ENODEV);
|
||||
|
||||
if (header->hardware_rev_id == 0)
|
||||
if (header->length < sizeof(ACPI::HPET))
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
|
||||
if (!InterruptController::get().is_using_apic() && !header->legacy_replacement_irq_routing_cable)
|
||||
@@ -153,6 +152,12 @@ namespace Kernel
|
||||
|
||||
auto& regs = registers();
|
||||
|
||||
if ((regs.capabilities & 0xFF) == 0)
|
||||
{
|
||||
dwarnln("HPET: Invalid revision");
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
}
|
||||
|
||||
#if ARCH(x86_64)
|
||||
m_is_64bit = regs.capabilities & COUNT_SIZE_CAP;
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user