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