diff --git a/kernel/src/arch/x86/peripherals/hpet.rs b/kernel/src/arch/x86/peripherals/hpet.rs index 16734e6f..248aa522 100644 --- a/kernel/src/arch/x86/peripherals/hpet.rs +++ b/kernel/src/arch/x86/peripherals/hpet.rs @@ -123,8 +123,12 @@ impl InterruptHandler for HpetTimer { impl Device for HpetTimer { unsafe fn init(self: Arc) -> Result<(), Error> { - // TODO support arbitrary configurations - assert!(self.bits64); + if self.period > u32::MAX as u64 && !self.bits64 { + log::error!( + "HPET period is >32bit and the HPET itself does not support 64bit counters" + ); + return Err(Error::InvalidArgument); + } let intc = external_interrupt_controller()?;