mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
Kernel: Address all 32 HPET comparators correctly
Instead of declaring a reserved area from byte 0x160 to 0x400, we change the declaration of TimerStructure array to be 32 units. Also, a static_assert was added, to ensure that the calculation is right.
This commit is contained in:
parent
bbe1d7e239
commit
b807e725e0
Notes:
sideshowbarker
2024-07-18 21:40:22 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/b807e725e05 Pull-request: https://github.com/SerenityOS/serenity/pull/5666 Issue: https://github.com/SerenityOS/serenity/issues/5530
1 changed files with 6 additions and 2 deletions
|
@ -92,14 +92,18 @@ struct [[gnu::packed]] HPETRegistersBlock {
|
|||
u8 reserved2[0xF0 - 0x28];
|
||||
HPETRegister main_counter_value;
|
||||
u64 reserved3;
|
||||
TimerStructure timers[3];
|
||||
u8 reserved4[0x400 - 0x160];
|
||||
TimerStructure timers[32];
|
||||
};
|
||||
|
||||
static_assert(__builtin_offsetof(HPETRegistersBlock, main_counter_value) == 0xf0);
|
||||
static_assert(__builtin_offsetof(HPETRegistersBlock, timers[0]) == 0x100);
|
||||
static_assert(__builtin_offsetof(HPETRegistersBlock, timers[1]) == 0x120);
|
||||
|
||||
// Note: The HPET specification says it reserves the range of byte 0x160 to
|
||||
// 0x400 for comparators 3-31, but for implementing all 32 comparators the HPET
|
||||
// MMIO space has to be 1280 bytes and not 1024 bytes.
|
||||
static_assert(sizeof(HPETRegistersBlock) == 0x500);
|
||||
|
||||
static u64 read_register_safe64(const HPETRegister& reg)
|
||||
{
|
||||
// As per 2.4.7 this reads the 64 bit value in a consistent manner
|
||||
|
|
Loading…
Add table
Reference in a new issue