[NTOSKRNL]

Fix a number of 64bit issues.

svn path=/trunk/; revision=58050
This commit is contained in:
Timo Kreuzer 2012-12-30 11:54:40 +00:00
parent df929fa5cf
commit 2f067ab47a
4 changed files with 21 additions and 4 deletions

View file

@ -876,7 +876,8 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
NTSTATUS Status;
PMMPTE SuperProtoPte;
PMMPFN Pfn1, OutPfn = NULL;
PFN_NUMBER PageFrameIndex, PteCount, ProcessedPtes;
PFN_NUMBER PageFrameIndex;
PFN_COUNT PteCount, ProcessedPtes;
DPRINT("ARM3 Page Fault Dispatcher for address: %p in process: %p\n",
Address,
Process);
@ -1055,7 +1056,7 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
if (ProcessedPtes)
{
/* Bump the transition count */
InterlockedExchangeAdd(&KeGetCurrentPrcb()->MmTransitionCount, ProcessedPtes);
InterlockedExchangeAddSizeT(&KeGetCurrentPrcb()->MmTransitionCount, ProcessedPtes);
ProcessedPtes--;
/* Loop all the processing we did */
@ -1208,9 +1209,15 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction,
if (TrapInformation)
{
PKTRAP_FRAME TrapFrame = TrapInformation;
#ifdef _M_IX86
DbgPrint("MM:***EIP %p, EFL %p\n", TrapFrame->Eip, TrapFrame->EFlags);
DbgPrint("MM:***EAX %p, ECX %p EDX %p\n", TrapFrame->Eax, TrapFrame->Ecx, TrapFrame->Edx);
DbgPrint("MM:***EBX %p, ESI %p EDI %p\n", TrapFrame->Ebx, TrapFrame->Esi, TrapFrame->Edi);
#elif defined(_M_AMD64)
DbgPrint("MM:***RIP %p, EFL %p\n", TrapFrame->Rip, TrapFrame->EFlags);
DbgPrint("MM:***RAX %p, RCX %p RDX %p\n", TrapFrame->Rax, TrapFrame->Rcx, TrapFrame->Rdx);
DbgPrint("MM:***RBX %p, RSI %p RDI %p\n", TrapFrame->Rbx, TrapFrame->Rsi, TrapFrame->Rdi);
#endif
}
/* Tell the trap handler to fail */

View file

@ -1324,8 +1324,10 @@ MiInitializeSessionPool(VOID)
/* Initialize the first page table */
Index = (ULONG_PTR)MmSessionSpace->PagedPoolStart - (ULONG_PTR)MmSessionBase;
Index >>= 22;
#ifndef _M_AMD64 // FIXME
ASSERT(MmSessionSpace->PageTables[Index].u.Long == 0);
MmSessionSpace->PageTables[Index] = *PointerPde;
#endif
/* Bump up counters */
InterlockedIncrementSizeT(&MmSessionSpace->NonPageablePages);

View file

@ -1580,7 +1580,9 @@ MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE SessionGlobal)
DPRINT1("Last process in sessino %d going down!!!\n", SessionId);
/* Free the session page tables */
#ifndef _M_AMD64
ExFreePool(SessionGlobal->PageTables);
#endif
ASSERT(!MI_IS_PHYSICAL_ADDRESS(SessionGlobal));
/* Capture the data page PFNs */
@ -1744,8 +1746,9 @@ MiSessionInitializeWorkingSetList(VOID)
/* Add this into the list */
Index = ((ULONG_PTR)WorkingSetList - (ULONG_PTR)MmSessionBase) >> 22;
#ifndef _M_AMD64
MmSessionSpace->PageTables[Index] = TempPte;
#endif
/* Initialize the page directory page, and now zero the working set list itself */
MiInitializePfnForOtherProcess(PageFrameIndex,
PointerPde,
@ -1977,8 +1980,10 @@ MiSessionCreateInternal(OUT PULONG SessionId)
MmSessionSpace->Color = Color;
MmSessionSpace->NonPageablePages = MiSessionCreateCharge;
MmSessionSpace->CommittedPages = MiSessionCreateCharge;
#ifndef _M_AMD64
MmSessionSpace->PageTables = PageTables;
MmSessionSpace->PageTables[PointerPde - MiAddressToPde(MmSessionBase)] = *PointerPde;
#endif
InitializeListHead(&MmSessionSpace->ImageList);
DPRINT1("Session %d is ready to go: 0x%p 0x%p, %lx 0x%p\n",
*SessionId, MmSessionSpace, SessionGlobal, SessionPageDirIndex, PageTables);

View file

@ -906,9 +906,10 @@ MiSessionCommitPageTables(IN PVOID StartVa,
Index = ((ULONG_PTR)StartVa - (ULONG_PTR)MmSessionBase) >> 22;
while (StartPde <= EndPde)
{
#ifndef _M_AMD64
/* If we don't already have a page table for it, increment count */
if (MmSessionSpace->PageTables[Index].u.Long == 0) PageCount++;
#endif
/* Move to the next one */
StartPde++;
Index++;
@ -924,6 +925,7 @@ MiSessionCommitPageTables(IN PVOID StartVa,
/* Loop each PDE while holding the working set lock */
// MiLockWorkingSet(PsGetCurrentThread(),
// &MmSessionSpace->GlobalVirtualAddress->Vm);
#ifndef _M_AMD64
while (StartPde <= EndPde)
{
/* Check if we already have a page table */
@ -966,6 +968,7 @@ MiSessionCommitPageTables(IN PVOID StartVa,
StartPde++;
Index++;
}
#endif
/* Make sure we didn't do more pages than expected */
ASSERT(ActualPages <= PageCount);