Page MenuHomeFreeBSD

x86/local_apic.c: Properly calculate the number of LVT entries
ClosedPublic

Authored by kib on Jan 19 2026, 12:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Feb 18, 9:33 AM
Unknown Object (File)
Wed, Feb 18, 2:27 AM
Unknown Object (File)
Mon, Feb 16, 1:09 AM
Unknown Object (File)
Sun, Feb 15, 10:46 PM
Unknown Object (File)
Sat, Feb 14, 6:28 AM
Unknown Object (File)
Sun, Feb 8, 3:24 PM
Unknown Object (File)
Sun, Feb 8, 3:34 AM
Unknown Object (File)
Sun, Feb 8, 2:44 AM
Subscribers

Details

Summary
First, the CMCI entry index is APIC_LVT_MAX, so it was excluded
unconditionall [1].

Second, the number of entries is reported by the version register, and
we must not access past the last reported entry.

Reported by:    olivier [1]
Fixes:  11f954b021a1aadde1d03d40ed5d6b529e14da98


x86/local_apic.c: add lapic_maxlvt() helper

that calculates the max index of the present LVT entry from the value of
the LAPIC version register.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Jan 19 2026, 12:14 PM
kib edited the summary of this revision. (Show Details)

Add helper

markj added inline comments.
sys/x86/x86/local_apic.c
322

You can use this helper in a few other places, e.g., lapic_dump().

This revision is now accepted and ready to land.Jan 19 2026, 2:38 PM
kib marked an inline comment as done.

Use lapic_maxlvt() everywhere.

This revision now requires review to proceed.Jan 19 2026, 4:07 PM
This revision is now accepted and ready to land.Jan 19 2026, 4:14 PM