[NTOS]: Disable support for global pages since it does not seem to work right on real hardware. Additionally, the code had been previously enabling global pages before the variable determining the support for such pages was even enabled, causing non-global pages to be used initially, followed later by global pages once the variable had been setup. To fix this mess, remove all global page support for now. Fixes booting on certain real hardware (or fixes other random memory corruptions).

Thanks to Caemyr.

svn path=/trunk/; revision=45627
This commit is contained in:
Sir Richard 2010-02-19 22:43:34 +00:00
parent 69a020df26
commit 3bdd2efbc3
4 changed files with 4 additions and 25 deletions

View file

@ -439,7 +439,6 @@ extern ULONG KeI386EFlagsOrMaskV86;
extern BOOLEAN KeI386VirtualIntExtensions;
extern KIDTENTRY KiIdt[MAXIMUM_IDTVECTOR];
extern KDESCRIPTOR KiIdtDescriptor;
extern ULONG Ke386GlobalPagesEnabled;
extern BOOLEAN KiI386PentiumLockErrataPresent;
extern ULONG KeI386NpxPresent;
extern ULONG KeI386XMMIPresent;

View file

@ -12,10 +12,6 @@
#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/
ULONG Ke386GlobalPagesEnabled;
/* FUNCTIONS *****************************************************************/
ULONG_PTR
@ -46,8 +42,8 @@ Ki386EnableGlobalPage(IN volatile ULONG_PTR Context)
__writecr3(Cr3);
/* Now enable PGE */
__writecr4(Cr4 | CR4_PGE);
Ke386GlobalPagesEnabled = TRUE;
DPRINT1("Global page support detected but not yet taken advantage of\n");
//__writecr4(Cr4 | CR4_PGE);
/* Restore interrupts */
_enable();

View file

@ -175,13 +175,14 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
}
/* Check for global bit */
#if 0
if (KeFeatureBits & KF_GLOBAL_PAGE)
{
/* Set it on the template PTE and PDE */
ValidKernelPte.u.Hard.Global = TRUE;
ValidKernelPde.u.Hard.Global = TRUE;
}
#endif
/* Now templates are ready */
TempPte = ValidKernelPte;
TempPde = ValidKernelPde;

View file

@ -284,10 +284,6 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
KeBugCheck(MEMORY_MANAGEMENT);
}
Entry = PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE;
if (Ke386GlobalPagesEnabled)
{
Entry |= PA_GLOBAL;
}
if(0 != InterlockedCompareExchangePte(&MmGlobalKernelPageDirectory[PdeOffset], Entry, 0))
{
MmReleasePageMemoryConsumer(MC_SYSTEM, Pfn);
@ -758,10 +754,6 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
if (Address >= MmSystemRangeStart)
{
Attributes &= ~PA_USER;
if (Ke386GlobalPagesEnabled)
{
Attributes |= PA_GLOBAL;
}
}
else
{
@ -907,10 +899,6 @@ MmSetPageProtect(PEPROCESS Process, PVOID Address, ULONG flProtect)
if (Address >= MmSystemRangeStart)
{
Attributes &= ~PA_USER;
if (Ke386GlobalPagesEnabled)
{
Attributes |= PA_GLOBAL;
}
}
else
{
@ -1017,11 +1005,6 @@ MmInitGlobalKernelPageDirectory(VOID)
0 == MmGlobalKernelPageDirectory[i] && 0 != CurrentPageDirectory[i])
{
MmGlobalKernelPageDirectory[i] = CurrentPageDirectory[i];
if (Ke386GlobalPagesEnabled)
{
MmGlobalKernelPageDirectory[i] |= PA_GLOBAL;
CurrentPageDirectory[i] |= PA_GLOBAL;
}
}
}
}