ReactOS 0.4.17-dev-1190-g4c812f4
x2apic.c File Reference
#include <hal.h>
#include <x86x64/Cpuid.h>
#include "x2apicp.h"
#include <debug.h>
Include dependency graph for x2apic.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOLEAN NTAPI X2ApicIsSupported (VOID)
 Checks whether the current processor supports x2APIC mode.
 
VOID NTAPI X2ApicEnable (VOID)
 Switches the current processor's local APIC into x2APIC mode.
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file x2apic.c.

Function Documentation

◆ X2ApicEnable()

VOID NTAPI X2ApicEnable ( VOID  )

Switches the current processor's local APIC into x2APIC mode.

Remarks
This must only be called after verifying support with X2ApicIsSupported, and before you try to do any MSR based register access.
Returns
None.

Definition at line 51 of file x2apic.c.

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 MSR_APIC_BASE
Definition: apicp.h:121
PPC_QUAL void __writemsr(const unsigned long Value)
Definition: intrin_ppc.h:748
PPC_QUAL unsigned long long __readmsr()
Definition: intrin_ppc.h:741

◆ X2ApicIsSupported()

BOOLEAN NTAPI X2ApicIsSupported ( VOID  )

Checks whether the current processor supports x2APIC mode.

Returns
TRUE if CPUID.01H:ECX.x2APIC[bit 21] is set, FALSE otherwise.

Definition at line 28 of file x2apic.c.

29{
31
33
34 return VersionInfo.Ecx.Bits.x2APIC != 0;
35}
#define CPUID_VERSION_INFO
Definition: Cpuid.h:81
OSVERSIONINFOW VersionInfo
Definition: wkssvc.c:40
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682