mirror of
https://github.com/reactos/reactos.git
synced 2024-07-31 00:28:56 +00:00
[FORMATTING]
- Change comments to match kernel coding style - Remove EOL spaces. svn path=/trunk/; revision=40290
This commit is contained in:
parent
c1ff41171d
commit
46689e8b55
|
@ -28,15 +28,11 @@ MiInitHyperSpace(VOID)
|
||||||
{
|
{
|
||||||
PMMPTE PointerPte;
|
PMMPTE PointerPte;
|
||||||
|
|
||||||
//
|
/* Get the hyperspace PTE and zero out the page table */
|
||||||
// Get the hyperspace PTE and zero out the page table
|
|
||||||
//
|
|
||||||
PointerPte = MiAddressToPte(HYPER_SPACE);
|
PointerPte = MiAddressToPte(HYPER_SPACE);
|
||||||
RtlZeroMemory(PointerPte, PAGE_SIZE);
|
RtlZeroMemory(PointerPte, PAGE_SIZE);
|
||||||
|
|
||||||
//
|
/* Setup mapping PTEs */
|
||||||
// Setup mapping PTEs
|
|
||||||
//
|
|
||||||
MmFirstReservedMappingPte = MiAddressToPte(MI_MAPPING_RANGE_START);
|
MmFirstReservedMappingPte = MiAddressToPte(MI_MAPPING_RANGE_START);
|
||||||
MmLastReservedMappingPte = MiAddressToPte(MI_MAPPING_RANGE_END);
|
MmLastReservedMappingPte = MiAddressToPte(MI_MAPPING_RANGE_END);
|
||||||
MmFirstReservedMappingPte->u.Hard.PageFrameNumber = MI_HYPERSPACE_PTES;
|
MmFirstReservedMappingPte->u.Hard.PageFrameNumber = MI_HYPERSPACE_PTES;
|
||||||
|
@ -53,57 +49,39 @@ MiMapPageInHyperSpace(IN PEPROCESS Process,
|
||||||
PFN_NUMBER Offset;
|
PFN_NUMBER Offset;
|
||||||
PVOID Address;
|
PVOID Address;
|
||||||
|
|
||||||
//
|
/* Never accept page 0 */
|
||||||
// Never accept page 0
|
|
||||||
//
|
|
||||||
ASSERT(Page != 0);
|
ASSERT(Page != 0);
|
||||||
|
|
||||||
//
|
/* Build the PTE */
|
||||||
// Build the PTE
|
|
||||||
//
|
|
||||||
TempPte = HyperTemplatePte;
|
TempPte = HyperTemplatePte;
|
||||||
TempPte.u.Hard.PageFrameNumber = Page;
|
TempPte.u.Hard.PageFrameNumber = Page;
|
||||||
|
|
||||||
//
|
/* Pick the first hyperspace PTE */
|
||||||
// Pick the first hyperspace PTE
|
|
||||||
//
|
|
||||||
PointerPte = MmFirstReservedMappingPte;
|
PointerPte = MmFirstReservedMappingPte;
|
||||||
|
|
||||||
//
|
/* Acquire the hyperlock */
|
||||||
// Acquire the hyperlock
|
|
||||||
//
|
|
||||||
ASSERT(Process == PsGetCurrentProcess());
|
ASSERT(Process == PsGetCurrentProcess());
|
||||||
KeAcquireSpinLock(&Process->HyperSpaceLock, OldIrql);
|
KeAcquireSpinLock(&Process->HyperSpaceLock, OldIrql);
|
||||||
|
|
||||||
//
|
/* Now get the first free PTE */
|
||||||
// Now get the first free PTE
|
|
||||||
//
|
|
||||||
Offset = PFN_FROM_PTE(PointerPte);
|
Offset = PFN_FROM_PTE(PointerPte);
|
||||||
if (!Offset)
|
if (!Offset)
|
||||||
{
|
{
|
||||||
//
|
/* Reset the PTEs */
|
||||||
// Reset the PTEs
|
|
||||||
//
|
|
||||||
Offset = MI_HYPERSPACE_PTES;
|
Offset = MI_HYPERSPACE_PTES;
|
||||||
KeFlushProcessTb();
|
KeFlushProcessTb();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/* Prepare the next PTE */
|
||||||
// Prepare the next PTE
|
|
||||||
//
|
|
||||||
PointerPte->u.Hard.PageFrameNumber = Offset - 1;
|
PointerPte->u.Hard.PageFrameNumber = Offset - 1;
|
||||||
|
|
||||||
//
|
/* Write the current PTE */
|
||||||
// Write the current PTE
|
|
||||||
//
|
|
||||||
PointerPte += Offset;
|
PointerPte += Offset;
|
||||||
ASSERT(PointerPte->u.Hard.Valid == 0);
|
ASSERT(PointerPte->u.Hard.Valid == 0);
|
||||||
ASSERT(TempPte.u.Hard.Valid == 1);
|
ASSERT(TempPte.u.Hard.Valid == 1);
|
||||||
*PointerPte = TempPte;
|
*PointerPte = TempPte;
|
||||||
|
|
||||||
//
|
/* Return the address */
|
||||||
// Return the address
|
|
||||||
//
|
|
||||||
Address = (PVOID)((ULONG_PTR)PointerPte << 10);
|
Address = (PVOID)((ULONG_PTR)PointerPte << 10);
|
||||||
return Address;
|
return Address;
|
||||||
}
|
}
|
||||||
|
@ -116,14 +94,10 @@ MiUnmapPageInHyperSpace(IN PEPROCESS Process,
|
||||||
{
|
{
|
||||||
ASSERT(Process == PsGetCurrentProcess());
|
ASSERT(Process == PsGetCurrentProcess());
|
||||||
|
|
||||||
//
|
/* Blow away the mapping */
|
||||||
// Blow away the mapping
|
|
||||||
//
|
|
||||||
MiAddressToPte(Address)->u.Long = 0;
|
MiAddressToPte(Address)->u.Long = 0;
|
||||||
|
|
||||||
//
|
/* Release the hyperlock */
|
||||||
// Release the hyperlock
|
|
||||||
//
|
|
||||||
ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
|
ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
|
||||||
KeReleaseSpinLock(&Process->HyperSpaceLock, OldIrql);
|
KeReleaseSpinLock(&Process->HyperSpaceLock, OldIrql);
|
||||||
}
|
}
|
||||||
|
@ -136,36 +110,24 @@ MiMapPageToZeroInHyperSpace(IN PFN_NUMBER Page)
|
||||||
PMMPTE PointerPte;
|
PMMPTE PointerPte;
|
||||||
PVOID Address;
|
PVOID Address;
|
||||||
|
|
||||||
//
|
/* Never accept page 0 */
|
||||||
// Never accept page 0
|
|
||||||
//
|
|
||||||
ASSERT(Page != 0);
|
ASSERT(Page != 0);
|
||||||
|
|
||||||
//
|
/* Build the PTE */
|
||||||
// Build the PTE
|
|
||||||
//
|
|
||||||
TempPte = HyperTemplatePte;
|
TempPte = HyperTemplatePte;
|
||||||
TempPte.u.Hard.PageFrameNumber = Page;
|
TempPte.u.Hard.PageFrameNumber = Page;
|
||||||
|
|
||||||
//
|
/* Get the Zero PTE and its address */
|
||||||
// Get the Zero PTE and its address
|
|
||||||
//
|
|
||||||
PointerPte = MiAddressToPte(MI_ZERO_PTE);
|
PointerPte = MiAddressToPte(MI_ZERO_PTE);
|
||||||
Address = (PVOID)((ULONG_PTR)PointerPte << 10);
|
Address = (PVOID)((ULONG_PTR)PointerPte << 10);
|
||||||
|
|
||||||
//
|
/* Invalidate the old address */
|
||||||
// Invalidate the old address
|
|
||||||
//
|
|
||||||
__invlpg(Address);
|
__invlpg(Address);
|
||||||
|
|
||||||
//
|
/* Write the current PTE */
|
||||||
// Write the current PTE
|
|
||||||
//
|
|
||||||
TempPte.u.Hard.PageFrameNumber = Page;
|
TempPte.u.Hard.PageFrameNumber = Page;
|
||||||
*PointerPte = TempPte;
|
*PointerPte = TempPte;
|
||||||
|
|
||||||
//
|
/* Return the address */
|
||||||
// Return the address
|
|
||||||
//
|
|
||||||
return Address;
|
return Address;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue