{
PUSHORT LdtDescriptor;
ULONG LdtBase;
+ PULONG Pde;
+ PULONG PageDir;
ULONG i, j;
DPRINT("Mmi386ReleaseMmInfo(Process %x)\n",Process);
ExFreePool((PVOID) LdtBase);
}
-
- PULONG Pde;
- PULONG PageDir;
PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart));
for (i = 0; i < ADDR_TO_PDE_OFFSET(MmSystemRangeStart); i++)
{
NTSTATUS Status;
ULONG i, j;
PFN_TYPE Pfn[2];
+ PULONG PageDirectory;
DPRINT("MmCopyMmInfo(Src %x, Dest %x)\n", MinWs, Process);
}
}
- PULONG PageDirectory;
PageDirectory = MmCreateHyperspaceMapping(Pfn[0]);
memcpy(PageDirectory + ADDR_TO_PDE_OFFSET(MmSystemRangeStart),
PEPROCESS CurrentProcess = PsGetCurrentProcess();
ULONG i;
PFN_TYPE Pfn;
+ PULONG PageTable;
DPRINT("ProcessId %d, Address %x\n", Process->UniqueProcessId, Address);
if (Process != NULL && Process != CurrentProcess)
KeAttachProcess(&Process->Pcb);
}
- PULONG PageTable;
PageTable = (PULONG)PAGE_ROUND_DOWN((PVOID)ADDR_TO_PTE(Address));
for (i = 0; i < 1024; i++)
{
{
BOOLEAN WasValid = FALSE;
PFN_TYPE Pfn;
+ ULONG Pte;
+ PULONG Pt;
DPRINT("MmDeleteVirtualMapping(%x, %x, %d, %x, %x)\n",
Process, Address, FreePage, WasDirty, Page);
- ULONG Pte;
- PULONG Pt;
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
NTAPI
MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address)
{
- if (Address < MmSystemRangeStart && Process == NULL)
- {
- DPRINT1("MmIsAccessedAndResetAccessPage is called for user space without a process.\n");
- KEBUGCHECK(0);
- }
+ PULONG Pt;
+ ULONG Pte;
- PULONG Pt;
- ULONG Pte;
+ if (Address < MmSystemRangeStart && Process == NULL)
+ {
+ DPRINT1("MmIsAccessedAndResetAccessPage is called for user space without a process.\n");
+ KEBUGCHECK(0);
+ }
- Pt = MmGetPageTableForProcess(Process, Address, FALSE);
- if (Pt == NULL)
- {
- KEBUGCHECK(0);
- }
+ Pt = MmGetPageTableForProcess(Process, Address, FALSE);
+ if (Pt == NULL)
+ {
+ KEBUGCHECK(0);
+ }
- do
- {
- Pte = *Pt;
- } while (Pte != InterlockedCompareExchangeUL(Pt, Pte & ~PA_ACCESSED, Pte));
+ do
+ {
+ Pte = *Pt;
+ } while (Pte != InterlockedCompareExchangeUL(Pt, Pte & ~PA_ACCESSED, Pte));
- if (Pte & PA_ACCESSED)
- {
- MiFlushTlb(Pt, Address);
- return TRUE;
- }
- else
- {
- MmUnmapPageTable(Pt);
- return FALSE;
- }
+ if (Pte & PA_ACCESSED)
+ {
+ MiFlushTlb(Pt, Address);
+ return TRUE;
+ }
+ else
+ {
+ MmUnmapPageTable(Pt);
+ return FALSE;
+ }
}
VOID
NTAPI
MmSetCleanPage(PEPROCESS Process, PVOID Address)
{
- if (Address < MmSystemRangeStart && Process == NULL)
- {
- DPRINT1("MmSetCleanPage is called for user space without a process.\n");
- KEBUGCHECK(0);
- }
+ PULONG Pt;
+ ULONG Pte;
- PULONG Pt;
- ULONG Pte;
+ if (Address < MmSystemRangeStart && Process == NULL)
+ {
+ DPRINT1("MmSetCleanPage is called for user space without a process.\n");
+ KEBUGCHECK(0);
+ }
- Pt = MmGetPageTableForProcess(Process, Address, FALSE);
+ Pt = MmGetPageTableForProcess(Process, Address, FALSE);
- if (Pt == NULL)
- {
- KEBUGCHECK(0);
- }
+ if (Pt == NULL)
+ {
+ KEBUGCHECK(0);
+ }
- do
- {
- Pte = *Pt;
- } while (Pte != InterlockedCompareExchangeUL(Pt, Pte & ~PA_DIRTY, Pte));
+ do
+ {
+ Pte = *Pt;
+ } while (Pte != InterlockedCompareExchangeUL(Pt, Pte & ~PA_DIRTY, Pte));
- if (Pte & PA_DIRTY)
- {
- MiFlushTlb(Pt, Address);
- }
- else
- {
- MmUnmapPageTable(Pt);
- }
+ if (Pte & PA_DIRTY)
+ {
+ MiFlushTlb(Pt, Address);
+ }
+ else
+ {
+ MmUnmapPageTable(Pt);
+ }
}
VOID
NTAPI
MmSetDirtyPage(PEPROCESS Process, PVOID Address)
{
+ PULONG Pt;
+ ULONG Pte;
+
if (Address < MmSystemRangeStart && Process == NULL)
{
DPRINT1("MmSetDirtyPage is called for user space without a process.\n");
KEBUGCHECK(0);
}
- PULONG Pt;
- ULONG Pte;
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
if (Pt == NULL)
ULONG i;
PVOID Addr;
ULONG PdeOffset, oldPdeOffset;
+ PULONG Pt;
+ ULONG Pte;
BOOLEAN NoExecute = FALSE;
DPRINT("MmCreateVirtualMappingForKernel(%x, %x, %x, %d)\n",
Addr = Address;
- PULONG Pt;
- ULONG Pte;
-
oldPdeOffset = ADDR_TO_PDE_OFFSET(Addr);
Pt = MmGetPageTableForProcess(NULL, Addr, TRUE);
if (Pt == NULL)
PVOID Address,
SWAPENTRY SwapEntry)
{
+ PULONG Pt;
+ ULONG Pte;
+
if (Process == NULL && Address < MmSystemRangeStart)
{
DPRINT1("No process\n");
KEBUGCHECK(0);
}
- PULONG Pt;
- ULONG Pte;
-
Pt = MmGetPageTableForProcess(Process, Address, TRUE);
if (Pt == NULL)
{
PVOID Addr;
ULONG i;
ULONG oldPdeOffset, PdeOffset;
+ PULONG Pt = NULL;
+ ULONG Pte;
BOOLEAN NoExecute = FALSE;
DPRINT("MmCreateVirtualMappingUnsafe(%x, %x, %x, %x (%x), %d)\n",
}
Addr = Address;
-
- PULONG Pt = NULL;
- ULONG Pte;
oldPdeOffset = ADDR_TO_PDE_OFFSET(Addr) + 1;
for (i = 0; i < PageCount; i++, Addr = (PVOID)((ULONG_PTR)Addr + PAGE_SIZE))
{
{
ULONG Attributes = 0;
BOOLEAN NoExecute = FALSE;
+ PULONG Pt;
DPRINT("MmSetPageProtect(Process %x Address %x flProtect %x)\n",
Process, Address, flProtect);
{
Attributes |= PA_USER;
}
- PULONG Pt;
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
if (Pt == NULL)
*/
{
PHYSICAL_ADDRESS p;
+ ULONG Pte;
DPRINT("MmGetPhysicalAddress(vaddr %x)\n", vaddr);
- ULONG Pte;
Pte = MmGetPageEntryForProcess(NULL, vaddr);
if (Pte != 0 && Pte & PA_PRESENT)
{
MmChangeHyperspaceMapping(PVOID Address, PFN_TYPE NewPage)
{
PFN_TYPE Pfn;
+ ULONG Entry;
+
ASSERT (IS_HYPERSPACE(Address));
- ULONG Entry;
Entry = InterlockedExchange((PLONG)ADDR_TO_PTE(Address), PFN_TO_PTE(NewPage) | PA_PRESENT | PA_READWRITE);
Pfn = PTE_TO_PFN(Entry);
MmDeleteHyperspaceMapping(PVOID Address)
{
PFN_TYPE Pfn;
+ ULONG Entry;
+
ASSERT (IS_HYPERSPACE(Address));
- ULONG Entry;
Entry = InterlockedExchange((PLONG)ADDR_TO_PTE(Address), 0);
Pfn = PTE_TO_PFN(Entry);
MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size)
{
ULONG StartOffset, EndOffset, Offset;
+ PULONG Pde;
if (Address < MmSystemRangeStart)
{
KEBUGCHECK(0);
}
- PULONG Pde;
StartOffset = ADDR_TO_PDE_OFFSET(Address);
EndOffset = ADDR_TO_PDE_OFFSET((PVOID)((ULONG_PTR)Address + Size));
MmInitGlobalKernelPageDirectory(VOID)
{
ULONG i;
+ PULONG CurrentPageDirectory = (PULONG)PAGEDIRECTORY_MAP;
DPRINT("MmInitGlobalKernelPageDirectory()\n");
- PULONG CurrentPageDirectory = (PULONG)PAGEDIRECTORY_MAP;
for (i = ADDR_TO_PDE_OFFSET(MmSystemRangeStart); i < 1024; i++)
{
if (i != ADDR_TO_PDE_OFFSET(PAGETABLE_MAP) &&