ReactOS 0.4.17-dev-1190-g4c812f4
x2apic.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Hardware Abstraction Layer
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: x2APIC detection and mode enable
5 * COPYRIGHT: Copyright 2026 Alex Mendoza <05alex.mendozaa@gmail.com>
6 */
7
8/* INCLUDES *******************************************************************/
9
10#include <hal.h>
11#include <x86x64/Cpuid.h>
12#include "x2apicp.h"
13
14#define NDEBUG
15#include <debug.h>
16
17/* FUNCTIONS ******************************************************************/
18
29{
31
33
34 return VersionInfo.Ecx.Bits.x2APIC != 0;
35}
36
37
49VOID
52{
54
55 BaseRegister.LongLong = __readmsr(MSR_APIC_BASE);
56
57 /* xAPIC (Enable) must already be set before x2APIC can be enabled */
58 BaseRegister.Enable = 1;
59 BaseRegister.EnableX2Apic = 1;
60
61 __writemsr(MSR_APIC_BASE, BaseRegister.LongLong);
62}
#define CPUID_VERSION_INFO
Definition: Cpuid.h:81
unsigned char BOOLEAN
Definition: actypes.h:127
#define MSR_APIC_BASE
Definition: apicp.h:121
OSVERSIONINFOW VersionInfo
Definition: wkssvc.c:40
PPC_QUAL void __writemsr(const unsigned long Value)
Definition: intrin_ppc.h:748
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682
PPC_QUAL unsigned long long __readmsr()
Definition: intrin_ppc.h:741
#define NTAPI
Definition: typedefs.h:36
VOID NTAPI X2ApicEnable(VOID)
Switches the current processor's local APIC into x2APIC mode.
Definition: x2apic.c:51
BOOLEAN NTAPI X2ApicIsSupported(VOID)
Checks whether the current processor supports x2APIC mode.
Definition: x2apic.c:28