2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/ke/i386/patpge.c
5 * PURPOSE: Support for PAT and PGE (Large Pages)
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
9 /* INCLUDES ******************************************************************/
15 /* GLOBALS *******************************************************************/
17 ULONG Ke386GlobalPagesEnabled
;
19 /* FUNCTIONS *****************************************************************/
23 Ki386EnableGlobalPage(IN
volatile ULONG_PTR Context
)
25 volatile PLONG Count
= (PLONG
)Context
;
28 /* Disable interrupts */
31 /* Decrease CPU Count and loop until it's reached 0 */
32 do {InterlockedDecrement(Count
);} while (!*Count
);
34 /* Now check if this is the Boot CPU */
35 if (!KeGetPcr()->Number
)
37 /* It is.FIXME: Patch KeFlushCurrentTb */
40 /* Now get CR4 and make sure PGE is masked out */
42 __writecr4(Cr4
& ~CR4_PGE
);
49 __writecr4(Cr4
| CR4_PGE
);
50 Ke386GlobalPagesEnabled
= TRUE
;
52 /* Restore interrupts */
61 /* FIXME: Support this */
62 DPRINT1("Advanced Memory features detected but not yet taken advantage of.\n");