17 static constexpr uint32_t ApicBaseMsr = 0x1B;
18 static constexpr uint64_t BootstrapProcessor = 1ULL << 8;
19 static constexpr uint32_t ProgrammableFields = 0x0001A7FF;
20 static constexpr uint32_t ExtInt = 7U << 8;
21 static constexpr uint32_t Masked = 1U << 16;
22 static constexpr uint32_t BootstrapValue = ExtInt;
23 static constexpr uint32_t ApplicationProcessorValue = Masked | 0xFF;
25 static bool isBootstrapProcessor(uint64_t apicBase) {
26 return (apicBase & BootstrapProcessor) != 0;
29 static uint32_t configuredValue(uint32_t current, uint64_t apicBase) {
30 const uint32_t desired =
31 isBootstrapProcessor(apicBase) ? BootstrapValue : ApplicationProcessorValue;
32 return (current & ~ProgrammableFields) | desired;
35 static bool routesLegacyPic(uint32_t value) {
36 return (value & (Masked | 0x700)) == ExtInt;
39 static bool matchesRole(uint32_t value, uint64_t apicBase) {
40 const uint32_t expected =
41 isBootstrapProcessor(apicBase) ? BootstrapValue : ApplicationProcessorValue;
42 return (value & ProgrammableFields) == expected;