Author: tkreuzer Date: Tue Mar 11 22:51:22 2014 New Revision: 62481
URL: http://svn.reactos.org/svn/reactos?rev=62481&view=rev Log: [NTOSKRNL] Massive cleanup of old and deprecated "Ros-Mm"-Code
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c trunk/reactos/ntoskrnl/ke/powerpc/stubs.c trunk/reactos/ntoskrnl/mm/amd64/page.c trunk/reactos/ntoskrnl/mm/arm/page.c trunk/reactos/ntoskrnl/mm/arm/stubs.c trunk/reactos/ntoskrnl/mm/freelist.c trunk/reactos/ntoskrnl/mm/i386/page.c trunk/reactos/ntoskrnl/mm/i386/pagepae.c trunk/reactos/ntoskrnl/mm/marea.c trunk/reactos/ntoskrnl/mm/pagefile.c trunk/reactos/ntoskrnl/mm/powerpc/page.c
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/m... ============================================================================== --- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -9,18 +9,12 @@ extern PMMSUPPORT MmKernelAddressSpace; extern PFN_COUNT MiFreeSwapPages; extern PFN_COUNT MiUsedSwapPages; -extern SIZE_T MmTotalPagedPoolQuota; -extern SIZE_T MmTotalNonPagedPoolQuota; -extern PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress; extern PFN_COUNT MmNumberOfPhysicalPages; extern UCHAR MmDisablePagingExecutive; extern PFN_NUMBER MmLowestPhysicalPage; extern PFN_NUMBER MmHighestPhysicalPage; extern PFN_NUMBER MmAvailablePages; extern PFN_NUMBER MmResidentAvailablePages; - -extern PMEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptor; -extern MEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptorOrg;
extern LIST_ENTRY MmLoadedUserImageList;
@@ -43,8 +37,8 @@ extern SIZE_T MmPeakCommitment; extern SIZE_T MmtotalCommitLimitMaximum;
-extern PVOID MiDebugMapping; -extern PMMPTE MmDebugPte; +extern PVOID MiDebugMapping; // internal +extern PMMPTE MmDebugPte; // internal
struct _KTRAP_FRAME; struct _EPROCESS; @@ -66,7 +60,7 @@ // #define MMDBG_COPY_MAX_SIZE 0x8
-#if defined(_X86_) +#if defined(_X86_) // intenal for marea.c #define MI_STATIC_MEMORY_AREAS (14) #else #define MI_STATIC_MEMORY_AREAS (13) @@ -76,19 +70,6 @@ #define MEMORY_AREA_CACHE (2) #define MEMORY_AREA_OWNED_BY_ARM3 (15) #define MEMORY_AREA_STATIC (0x80000000) - -#define MM_PHYSICAL_PAGE_MPW_PENDING (0x8) - -#define MM_CORE_DUMP_TYPE_NONE (0x0) -#define MM_CORE_DUMP_TYPE_MINIMAL (0x1) -#define MM_CORE_DUMP_TYPE_FULL (0x2) - -/* Number of list heads to use */ -#define MI_FREE_POOL_LISTS 4 - - -/* Signature of free pool blocks */ -#define MM_FREE_POOL_TAG 'lprF'
/* Although Microsoft says this isn't hardcoded anymore, they won't be able to change it. Stuff depends on it */ @@ -119,31 +100,12 @@ #define SESSION_POOL_MASK 32 #define VERIFIER_POOL_MASK 64
-#define MM_PAGED_POOL_SIZE (100*1024*1024) -#define MM_NONPAGED_POOL_SIZE (100*1024*1024) - -/* - * Paged and non-paged pools are 8-byte aligned - */ -#define MM_POOL_ALIGNMENT 8 - +// FIXME: use ALIGN_UP_BY #define MM_ROUND_UP(x,s) \ ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
#define MM_ROUND_DOWN(x,s) \ ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1))) - -#define PAGE_FLAGS_VALID_FROM_USER_MODE \ - (PAGE_READONLY | \ - PAGE_READWRITE | \ - PAGE_WRITECOPY | \ - PAGE_EXECUTE | \ - PAGE_EXECUTE_READ | \ - PAGE_EXECUTE_READWRITE | \ - PAGE_EXECUTE_WRITECOPY | \ - PAGE_GUARD | \ - PAGE_NOACCESS | \ - PAGE_NOCACHE)
#define PAGE_FLAGS_VALID_FOR_SECTION \ (PAGE_READONLY | \ @@ -331,9 +293,10 @@ USHORT RemovalRequested:1; USHORT CacheAttribute:2; USHORT Rom:1; - USHORT ParityError:1; // HasRmap + USHORT ParityError:1; } MMPFNENTRY;
+// Mm internal typedef struct _MMPFN { union @@ -427,6 +390,7 @@ LIST_ENTRY RegionListEntry; } MM_REGION, *PMM_REGION;
+// Mm internal /* Entry describing free pool memory */ typedef struct _MMFREE_POOL_ENTRY { @@ -531,9 +495,10 @@ PVOID Address );
+// fixme: unused? ULONG_PTR NTAPI -MmFindGapAtAddress( +MmFindGapAtAddress_( PMMSUPPORT AddressSpace, PVOID Address ); @@ -556,10 +521,6 @@ PVOID FreePageContext );
-VOID -NTAPI -MmDumpMemoryAreas(PMMSUPPORT AddressSpace); - PMEMORY_AREA NTAPI MmLocateMemoryAreaByRegion( @@ -579,14 +540,6 @@
VOID NTAPI -MmReleaseMemoryAreaIfDecommitted( - struct _EPROCESS *Process, - PMMSUPPORT AddressSpace, - PVOID BaseAddress -); - -VOID -NTAPI MmMapMemoryArea(PVOID BaseAddress, SIZE_T Length, ULONG Consumer, @@ -605,14 +558,6 @@
VOID NTAPI -MiDebugDumpNonPagedPool(BOOLEAN NewOnly); - -VOID -NTAPI -MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly); - -VOID -NTAPI MiInitializeNonPagedPool(VOID);
PVOID @@ -634,70 +579,7 @@ IN PVOID StartingAddress );
-PVOID -NTAPI -MmGetMdlPageAddress( - PMDL Mdl, - PVOID Offset -); - /* pool.c *******************************************************************/ - -PVOID -NTAPI -ExAllocateNonPagedPoolWithTag( - POOL_TYPE type, - ULONG size, - ULONG Tag, - PVOID Caller -); - -PVOID -NTAPI -ExAllocatePagedPoolWithTag( - POOL_TYPE Type, - ULONG size, - ULONG Tag -); - -VOID -NTAPI -ExFreeNonPagedPool(PVOID block); - -VOID -NTAPI -ExFreePagedPool(IN PVOID Block); - -BOOLEAN -NTAPI -ExpIsPoolTagDebuggable(ULONG Tag); - -PVOID -NTAPI -ExpAllocateDebugPool( - POOL_TYPE Type, - ULONG Size, - ULONG Tag, - PVOID Caller, - BOOLEAN EndOfPage -); - -VOID -NTAPI -ExpFreeDebugPool(PVOID Block, BOOLEAN PagedPool); - -VOID -NTAPI -MmInitializePagedPool(VOID); - -PVOID -NTAPI -MiAllocateSpecialPool( - IN POOL_TYPE PoolType, - IN SIZE_T NumberOfBytes, - IN ULONG Tag, - IN ULONG Underrun -);
BOOLEAN NTAPI @@ -720,10 +602,6 @@
VOID NTAPI -MiShutdownMemoryManager(VOID); - -VOID -NTAPI MmInit1( VOID ); @@ -733,23 +611,12 @@ MmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock);
-VOID -NTAPI -MiFreeInitMemory(VOID); - -VOID -NTAPI -MmInitializeMdlImplementation(VOID);
/* pagefile.c ****************************************************************/
SWAPENTRY NTAPI MmAllocSwapPage(VOID); - -VOID -NTAPI -MmDereserveSwapPages(ULONG Nr);
VOID NTAPI @@ -770,31 +637,12 @@ PFN_NUMBER Page );
-BOOLEAN -NTAPI -MmReserveSwapPages(ULONG Nr); - NTSTATUS NTAPI MmWriteToSwapPage( SWAPENTRY SwapEntry, PFN_NUMBER Page ); - -NTSTATUS -NTAPI -MmDumpToPagingFile( - ULONG BugCode, - ULONG BugCodeParameter1, - ULONG BugCodeParameter2, - ULONG BugCodeParameter3, - ULONG BugCodeParameter4, - struct _KTRAP_FRAME* TrapFrame -); - -BOOLEAN -NTAPI -MmIsAvailableSwapPage(VOID);
VOID NTAPI @@ -908,74 +756,7 @@ IN PVOID TrapInformation );
-/* anonmem.c *****************************************************************/ - -NTSTATUS -NTAPI -MmNotPresentFaultVirtualMemory( - PMMSUPPORT AddressSpace, - MEMORY_AREA* MemoryArea, - PVOID Address -); - -NTSTATUS -NTAPI -MmPageOutVirtualMemory( - PMMSUPPORT AddressSpace, - PMEMORY_AREA MemoryArea, - PVOID Address, - PFN_NUMBER Page -); - -NTSTATUS -NTAPI -MmQueryAnonMem( - PMEMORY_AREA MemoryArea, - PVOID Address, - PMEMORY_BASIC_INFORMATION Info, - PSIZE_T ResultLength -); - -VOID -NTAPI -MmFreeVirtualMemory( - struct _EPROCESS* Process, - PMEMORY_AREA MemoryArea -); - -NTSTATUS -NTAPI -MmProtectAnonMem( - PMMSUPPORT AddressSpace, - PMEMORY_AREA MemoryArea, - PVOID BaseAddress, - SIZE_T Length, - ULONG Protect, - PULONG OldProtect -); - -NTSTATUS -NTAPI -MmWritePageVirtualMemory( - PMMSUPPORT AddressSpace, - PMEMORY_AREA MArea, - PVOID Address, - PFN_NUMBER Page -); - /* kmap.c ********************************************************************/ - -PVOID -NTAPI -ExAllocatePage(VOID); - -VOID -NTAPI -ExUnmapPage(PVOID Addr); - -PVOID -NTAPI -ExAllocatePageWithPhysPage(PFN_NUMBER Page);
NTSTATUS NTAPI @@ -983,16 +764,6 @@ PFN_NUMBER NewPage, PFN_NUMBER OldPage ); - -NTSTATUS -NTAPI -MiZeroPage(PFN_NUMBER Page); - -/* memsafe.s *****************************************************************/ - -PVOID -FASTCALL -MmSafeReadPtr(PVOID Source);
/* process.c *****************************************************************/
@@ -1151,36 +922,8 @@
VOID NTAPI -MmLockPage(PFN_NUMBER Page); - -VOID -NTAPI -MmUnlockPage(PFN_NUMBER Page); - -ULONG -NTAPI -MmGetLockCountPage(PFN_NUMBER Page); - -VOID -NTAPI -MmInitializePageList( - VOID -); - -VOID -NTAPI MmDumpArmPfnDatabase( IN BOOLEAN StatusOnly -); - -PFN_NUMBER -NTAPI -MmGetContinuousPages( - ULONG NumberOfBytes, - PHYSICAL_ADDRESS LowestAcceptableAddress, - PHYSICAL_ADDRESS HighestAcceptableAddress, - PHYSICAL_ADDRESS BoundaryAddressMultiple, - BOOLEAN ZeroPages );
VOID @@ -1233,22 +976,6 @@
NTSTATUS NTAPI -MmCreateVirtualMappingForKernel( - PVOID Address, - ULONG flProtect, - PPFN_NUMBER Pages, - ULONG PageCount -); - -NTSTATUS -NTAPI -MmCommitPagedPoolAddress( - PVOID Address, - BOOLEAN Locked -); - -NTSTATUS -NTAPI MmCreateVirtualMapping( struct _EPROCESS* Process, PVOID Address, @@ -1301,13 +1028,6 @@
VOID NTAPI -MmEnableVirtualMapping( - struct _EPROCESS *Process, - PVOID Address -); - -VOID -NTAPI MmGetPageFileMapping( struct _EPROCESS *Process, PVOID Address, @@ -1338,13 +1058,6 @@
VOID NTAPI -MmTransferOwnershipPage( - PFN_NUMBER Page, - ULONG NewConsumer -); - -VOID -NTAPI MmSetDirtyPage( struct _EPROCESS *Process, PVOID Address @@ -1356,16 +1069,6 @@ ULONG Consumer );
-LONG -NTAPI -MmAllocPagesSpecifyRange( - ULONG Consumer, - PHYSICAL_ADDRESS LowestAddress, - PHYSICAL_ADDRESS HighestAddress, - ULONG NumberOfPages, - PPFN_NUMBER Pages -); - VOID NTAPI MmDereferencePage(PFN_NUMBER Page); @@ -1398,10 +1101,6 @@ struct _EPROCESS *Process, PVOID Address ); - -NTSTATUS -NTAPI -MmCreatePageTable(PVOID PAddress);
VOID NTAPI @@ -1441,19 +1140,11 @@
NTSTATUS NTAPI -MmReleaseMmInfo(struct _EPROCESS *Process); - -NTSTATUS -NTAPI MmSetExecuteOptions(IN ULONG ExecuteOptions);
NTSTATUS NTAPI MmGetExecuteOptions(IN PULONG ExecuteOptions); - -VOID -NTAPI -MmDeleteProcessPageDirectory(struct _EPROCESS *Process);
VOID NTAPI @@ -1471,30 +1162,6 @@ struct _EPROCESS *Process, PVOID Address ); - -VOID -NTAPI -MmMarkPageMapped(PFN_NUMBER Page); - -VOID -NTAPI -MmMarkPageUnmapped(PFN_NUMBER Page); - -VOID -NTAPI -MmUpdatePageDir( - struct _EPROCESS *Process, - PVOID Address, - ULONG Size -); - -VOID -NTAPI -MiInitPageDirectoryMap(VOID); - -ULONG -NTAPI -MiGetUserPageDirectoryCount(VOID);
/* wset.c ********************************************************************/
@@ -1565,13 +1232,6 @@ OUT POBJECT_NAME_INFORMATION *ModuleName );
-PVOID -NTAPI -MmAllocateSection( - IN SIZE_T Length, - PVOID BaseAddress -); - NTSTATUS NTAPI MmQuerySectionView( @@ -1630,41 +1290,6 @@ NTAPI MmFreeSectionSegments(PFILE_OBJECT FileObject);
-/* mpw.c *********************************************************************/ - -NTSTATUS -NTAPI -MmInitMpwThread(VOID); - -NTSTATUS -NTAPI -MmInitBsmThread(VOID); - -/* pager.c *******************************************************************/ - -BOOLEAN -NTAPI -MiIsPagerThread(VOID); - -VOID -NTAPI -MiStartPagerThread(VOID); - -VOID -NTAPI -MiStopPagerThread(VOID); - -NTSTATUS -FASTCALL -MiQueryVirtualMemory( - IN HANDLE ProcessHandle, - IN PVOID Address, - IN MEMORY_INFORMATION_CLASS VirtualMemoryInformationClass, - OUT PVOID VirtualMemoryInformation, - IN SIZE_T Length, - OUT PSIZE_T ResultLength -); - /* sysldr.c ******************************************************************/
VOID
Modified: trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/powerpc/kiinit.... ============================================================================== --- trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -189,7 +189,7 @@ InitThread->Affinity = 1 << Number; InitThread->WaitIrql = DISPATCH_LEVEL; InitProcess->ActiveProcessors = 1 << Number; - + /* HACK for MmUpdatePageDir */ ((PETHREAD)InitThread)->ThreadsProcess = (PEPROCESS)InitProcess;
@@ -228,11 +228,8 @@ Prcb->DpcStack = DpcStack; }
- /* Free Initial Memory */ - // MiFreeInitMemory(); - KfRaiseIrql(DISPATCH_LEVEL); - + KeSetPriorityThread(InitThread, 0); /* Setup decrementer exception */ KiSetupDecrementerTrap(); @@ -297,7 +294,7 @@
/* Skip initial setup if this isn't the Boot CPU */ if (Cpu) goto AppCpuInit; - + /* Initialize the PCR */ RtlZeroMemory(Pcr, PAGE_SIZE); KiInitializePcr(Cpu,
Modified: trunk/reactos/ntoskrnl/ke/powerpc/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/powerpc/stubs.c... ============================================================================== --- trunk/reactos/ntoskrnl/ke/powerpc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/powerpc/stubs.c [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -151,13 +151,6 @@ return TRUE; }
-NTSTATUS -NTAPI -Mmi386ReleaseMmInfo(PEPROCESS Process) -{ - return STATUS_UNSUCCESSFUL; -} - VOID NTAPI KeI386VdmInitialize(VOID)
Modified: trunk/reactos/ntoskrnl/mm/amd64/page.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/amd64/page.c?re... ============================================================================== --- trunk/reactos/ntoskrnl/mm/amd64/page.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/amd64/page.c [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -138,57 +138,6 @@ }
static -VOID -MmDeletePageTablePfn(PFN_NUMBER PageFrameNumber, ULONG Level) -{ - PMMPTE PageTable; - KIRQL OldIrql; - PMMPFN PfnEntry; - ULONG i, NumberEntries; - - /* Check if this is a page table */ - if (Level > 0) - { - NumberEntries = (Level == 4) ? MiAddressToPxi(MmHighestUserAddress)+1 : 512; - - /* Map the page table in hyperspace */ - PageTable = (PMMPTE)MmCreateHyperspaceMapping(PageFrameNumber); - - /* Loop all page table entries */ - for (i = 0; i < NumberEntries; i++) - { - /* Check if the entry is valid */ - if (PageTable[i].u.Hard.Valid) - { - /* Recursively free the page that backs it */ - MmDeletePageTablePfn(PageTable[i].u.Hard.PageFrameNumber, Level - 1); - } - } - - /* Delete the hyperspace mapping */ - MmDeleteHyperspaceMapping(PageTable); - } - - /* Check if this is a legacy allocation */ - PfnEntry = MiGetPfnEntry(PageFrameNumber); - if (MI_IS_ROS_PFN(PfnEntry)) - { - /* Free it using the legacy API */ - MmReleasePageMemoryConsumer(MC_SYSTEM, PageFrameNumber); - } - else - { - OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); - - /* Free it using the ARM3 API */ - MI_SET_PFN_DELETED(PfnEntry); - MiDecrementShareCount(PfnEntry, PageFrameNumber); - - KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); - } -} - -static PMMPTE MiGetPteForProcess( PEPROCESS Process, @@ -497,15 +446,6 @@ MiFlushTlb(Pte, Address); }
- -NTSTATUS -NTAPI -Mmi386ReleaseMmInfo(PEPROCESS Process) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; -} - VOID NTAPI MmDeleteVirtualMapping( @@ -559,15 +499,6 @@ { UNIMPLEMENTED; } - - -VOID -NTAPI -MmEnableVirtualMapping(PEPROCESS Process, PVOID Address) -{ - UNIMPLEMENTED; -} -
NTSTATUS NTAPI
Modified: trunk/reactos/ntoskrnl/mm/arm/page.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/arm/page.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/mm/arm/page.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/arm/page.c [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -137,16 +137,6 @@ return FALSE; }
-VOID -NTAPI -MmUpdatePageDir(IN PEPROCESS Process, - IN PVOID Address, - IN ULONG Size) -{ - /* Nothing to do */ - return; -} - PULONG NTAPI MmGetPageDirectory(VOID) @@ -309,19 +299,3 @@ } }
-/* PUBLIC FUNCTIONS ***********************************************************/ - -/* - * @implemented - */ -PHYSICAL_ADDRESS -NTAPI -MmGetPhysicalAddress(IN PVOID Address) -{ - PHYSICAL_ADDRESS PhysicalAddress; - PhysicalAddress.QuadPart = 0; - - UNIMPLEMENTED_DBGBREAK(); - - return PhysicalAddress; -}
Modified: trunk/reactos/ntoskrnl/mm/arm/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/arm/stubs.c?rev... ============================================================================== --- trunk/reactos/ntoskrnl/mm/arm/stubs.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/arm/stubs.c [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -237,58 +237,6 @@ return Pte; }
-VOID -NTAPI -MmDeletePageTable(IN PEPROCESS Process, - IN PVOID Address) -{ - PMMPDE_HARDWARE PointerPde; - - // - // Not valid for kernel addresses - // - DPRINT("MmDeletePageTable(%p, %p)\n", Process, Address); - ASSERT(Address < MmSystemRangeStart); - - // - // Check if this is for a different process - // - if ((Process) && (Process != PsGetCurrentProcess())) - { - // - // FIXME-USER: Need to attach to the process - // - ASSERT(FALSE); - } - - // - // Get the PDE - // - PointerPde = MiGetPdeAddress(Address); - - // - // On ARM, we use a section mapping for the original low-memory mapping - // - if ((Address) || (PointerPde->u.Hard.Section.Valid == 0)) - { - // - // Make sure it's valid - // - ASSERT(PointerPde->u.Hard.Coarse.Valid == 1); - } - - // - // Clear the PDE - // - PointerPde->u.Hard.AsUlong = 0; - ASSERT(PointerPde->u.Hard.Coarse.Valid == 0); - - // - // Invalidate the TLB entry - // - MiFlushTlb((PMMPTE)PointerPde, MiGetPteAddress(Address)); -} - BOOLEAN NTAPI MmCreateProcessAddressSpace(IN ULONG MinWs, @@ -367,17 +315,6 @@ return TRUE; }
-NTSTATUS -NTAPI -Mmi386ReleaseMmInfo(IN PEPROCESS Process) -{ - // - // FIXME-USER: Need to delete address space - // - UNIMPLEMENTED_DBGBREAK(); - return STATUS_NOT_IMPLEMENTED; -} - PULONG NTAPI MmGetPageDirectory(VOID) @@ -386,17 +323,6 @@ // Return the TTB // return (PULONG)KeArmTranslationTableRegisterGet().AsUlong; -} - -VOID -NTAPI -MmEnableVirtualMapping(IN PEPROCESS Process, - IN PVOID Address) -{ - // - // TODO - // - UNIMPLEMENTED_DBGBREAK(); }
NTSTATUS @@ -484,24 +410,6 @@
NTSTATUS NTAPI -MmCreateVirtualMappingForKernel(IN PVOID Address, - IN ULONG Protection, - IN PPFN_NUMBER Pages, - IN ULONG PageCount) -{ - // - // Call the internal version - // - return MmCreateVirtualMappingInternal(NULL, - Address, - Protection, - Pages, - PageCount, - FALSE); -} - -NTSTATUS -NTAPI MmCreateVirtualMappingUnsafe(IN PEPROCESS Process, IN PVOID Address, IN ULONG Protection, @@ -774,59 +682,6 @@ } }
-VOID -NTAPI -MiInitPageDirectoryMap(VOID) -{ - MEMORY_AREA* MemoryArea = NULL; - PVOID BaseAddress; - NTSTATUS Status; - - // - // Create memory area for the PTE area - // - BaseAddress = (PVOID)PTE_BASE; - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_OWNED_BY_ARM3, - &BaseAddress, - 0x1000000, - PAGE_READWRITE, - &MemoryArea, - TRUE, - 0, - PAGE_SIZE); - ASSERT(NT_SUCCESS(Status)); - - // - // Create memory area for the PDE area - // - BaseAddress = (PVOID)PDE_BASE; - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_OWNED_BY_ARM3, - &BaseAddress, - 0x100000, - PAGE_READWRITE, - &MemoryArea, - TRUE, - 0, - PAGE_SIZE); - ASSERT(NT_SUCCESS(Status)); - - // - // And finally, hyperspace - // - BaseAddress = (PVOID)HYPER_SPACE; - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_OWNED_BY_ARM3, - &BaseAddress, - PAGE_SIZE, - PAGE_READWRITE, - &MemoryArea, - TRUE, - 0, - PAGE_SIZE); - ASSERT(NT_SUCCESS(Status)); -}
/* PUBLIC FUNCTIONS ***********************************************************/
Modified: trunk/reactos/ntoskrnl/mm/freelist.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/freelist.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -13,10 +13,6 @@ #include <ntoskrnl.h> #define NDEBUG #include <debug.h> - -#if defined (ALLOC_PRAGMA) -#pragma alloc_text(INIT, MmInitializePageList) -#endif
#define MODULE_INVOLVED_IN_ARM3 #include "ARM3/miarm.h"
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?rev... ============================================================================== --- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -16,7 +16,6 @@
#if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, MmInitGlobalKernelPageDirectory) -#pragma alloc_text(INIT, MiInitPageDirectoryMap) #endif
@@ -592,35 +591,6 @@ } }
-VOID -NTAPI -MmEnableVirtualMapping(PEPROCESS Process, PVOID Address) -{ - PULONG Pt; - ULONG Pte; - - Pt = MmGetPageTableForProcess(Process, Address, FALSE); - if (Pt == NULL) - { - //HACK to get DPH working, waiting for MM rewrite :-/ - //KeBugCheck(MEMORY_MANAGEMENT); - return; - } - - /* Do not mark a 0 page as present */ - if(0 == InterlockedCompareExchangePte(Pt, 0, 0)) - return; - - do - { - Pte = *Pt; - } while (Pte != InterlockedCompareExchangePte(Pt, Pte | PA_PRESENT, Pte)); - - /* We don't need to flush the TLB here because it - * won't cache translations for non-present pages */ - MmUnmapPageTable(Pt); -} - BOOLEAN NTAPI MmIsPagePresent(PEPROCESS Process, PVOID Address)
Modified: trunk/reactos/ntoskrnl/mm/i386/pagepae.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/pagepae.c?... ============================================================================== --- trunk/reactos/ntoskrnl/mm/i386/pagepae.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/i386/pagepae.c [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -15,7 +15,6 @@
#if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, MmInitGlobalKernelPageDirectory) -#pragma alloc_text(INIT, MiInitPageDirectoryMap) #endif
@@ -56,17 +55,6 @@ #define PAE_PTE_TO_PFN(X) (PAE_PAGE_MASK(X) >> PAGE_SHIFT) #define PAE_PFN_TO_PTE(X) ((X) << PAGE_SHIFT)
-#if defined(__GNUC__) -#define PTE_TO_PAGE(X) ((LARGE_INTEGER)(LONGLONG)(PAGE_MASK(X))) -#else -__inline LARGE_INTEGER PTE_TO_PAGE(ULONG npage) -{ - LARGE_INTEGER dummy; - dummy.QuadPart = (LONGLONG)(PAGE_MASK(npage)); - return dummy; -} -#endif - extern BOOLEAN Ke386Pae; extern BOOLEAN Ke386NoExecute;
@@ -196,149 +184,6 @@ #define PAE_ADDR_TO_PDE_OFFSET(v) (((ULONG_PTR)(v))/ (512 * PAGE_SIZE))
#define PAE_ADDR_TO_PTE_OFFSET(v) ((((ULONG_PTR)(v)) % (512 * PAGE_SIZE)) / PAGE_SIZE) - - -NTSTATUS -NTAPI -Mmi386ReleaseMmInfo(PEPROCESS Process) -{ - PUSHORT LdtDescriptor; - ULONG LdtBase; - ULONG i, j; - - DPRINT("Mmi386ReleaseMmInfo(Process %x)\n",Process); - - LdtDescriptor = (PUSHORT) &Process->Pcb.LdtDescriptor; - LdtBase = LdtDescriptor[1] | - ((LdtDescriptor[2] & 0xff) << 16) | - ((LdtDescriptor[3] & ~0xff) << 16); - - DPRINT("LdtBase: %x\n", LdtBase); - - if (LdtBase) - { - ExFreePool((PVOID) LdtBase); - } - - if (Ke386Pae) - { - PULONGLONG PageDirTable; - PULONGLONG PageDir; - PULONGLONG Pde; - ULONG k; - - PageDirTable = (PULONGLONG)MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart)); - for (i = 0; i < 4; i++) - { - PageDir = (PULONGLONG)MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(PageDirTable[i])); - if (i < PAE_ADDR_TO_PDTE_OFFSET(MmSystemRangeStart)) - { - for (j = 0; j < 512; j++) - { - if (PageDir[j] != 0LL) - { - DPRINT1("ProcessId %d, Pde for %08x - %08x is not freed, RefCount %d\n", - Process->UniqueProcessId, - (i * 512 + j) * 512 * PAGE_SIZE, (i * 512 + j + 1) * 512 * PAGE_SIZE - 1, - ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable[i*512 + j]); - Pde = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(PageDir[j])); - for (k = 0; k < 512; k++) - { - if(Pde[k] != 0) - { - if (Pde[k] & PA_PRESENT) - { - DPRINT1("Page at %08x is not freed\n", - (i * 512 + j) * 512 * PAGE_SIZE + k * PAGE_SIZE); - } - else - { - DPRINT1("Swapentry %x at %x is not freed\n", - (i * 512 + j) * 512 * PAGE_SIZE + k * PAGE_SIZE); - } - } - } - MmDeleteHyperspaceMapping(Pde); - MmReleasePageMemoryConsumer(MC_NPPOOL, PAE_PTE_TO_PFN(PageDir[j])); - } - } - } - if (i == PAE_ADDR_TO_PDTE_OFFSET(HYPERSPACE)) - { - MmReleasePageMemoryConsumer(MC_NPPOOL, PAE_PTE_TO_PFN(PageDir[PAE_ADDR_TO_PDE_PAGE_OFFSET(HYPERSPACE)])); - MmReleasePageMemoryConsumer(MC_NPPOOL, PAE_PTE_TO_PFN(PageDir[PAE_ADDR_TO_PDE_PAGE_OFFSET(HYPERSPACE)+1])); - } - MmDeleteHyperspaceMapping(PageDir); - MmReleasePageMemoryConsumer(MC_NPPOOL, PAE_PTE_TO_PFN(PageDirTable[i])); - } - MmDeleteHyperspaceMapping((PVOID)PageDirTable); - MmReleasePageMemoryConsumer(MC_NPPOOL, PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart)); - } - else - { - PULONG Pde; - PULONG PageDir; - PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); - for (i = 0; i < ADDR_TO_PDE_OFFSET(MmSystemRangeStart); i++) - { - if (PageDir[i] != 0) - { - DPRINT1("Pde for %08x - %08x is not freed, RefCount %d\n", - i * 4 * 1024 * 1024, (i + 1) * 4 * 1024 * 1024 - 1, - ((PMADDRESS_SPACE)&Process->VadRoot)->PageTableRefCountTable[i]); - Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(PageDir[i])); - for (j = 0; j < 1024; j++) - { - if(Pde[j] != 0) - { - if (Pde[j] & PA_PRESENT) - { - DPRINT1("Page at %08x is not freed\n", - i * 4 * 1024 * 1024 + j * PAGE_SIZE); - } - else - { - DPRINT1("Swapentry %x at %x is not freed\n", - Pde[j], i * 4 * 1024 * 1024 + j * PAGE_SIZE); - } - } - } - MmDeleteHyperspaceMapping(Pde); - MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(PageDir[i])); - } - } - MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(PageDir[ADDR_TO_PDE_OFFSET(HYPERSPACE)])); - MmDeleteHyperspaceMapping(PageDir); - MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); - } - -#if defined(__GNUC__) - - Process->Pcb.DirectoryTableBase.QuadPart = 0LL; -#else - - Process->Pcb.DirectoryTableBase.QuadPart = 0; -#endif - - DPRINT("Finished Mmi386ReleaseMmInfo()\n"); - return(STATUS_SUCCESS); -} - -NTSTATUS -NTAPI -MmInitializeHandBuiltProcess(IN PEPROCESS Process, - IN PLARGE_INTEGER DirectoryTableBase) -{ - /* Share the directory base with the idle process */ - *DirectoryTableBase = PsGetCurrentProcess()->Pcb.DirectoryTableBase; - - /* Initialize the Addresss Space */ - MmInitializeAddressSpace(Process, (PMADDRESS_SPACE)&Process->VadRoot); - - /* The process now has an address space */ - Process->HasAddressSpace = TRUE; - return STATUS_SUCCESS; -}
BOOLEAN NTAPI @@ -418,39 +263,6 @@ DirectoryTableBase->QuadPart = PFN_TO_PTE(Pfn[0]); DPRINT("Finished MmCopyMmInfo(): %I64x\n", DirectoryTableBase->QuadPart); return TRUE; -} - -VOID -NTAPI -MmDeletePageTable(PEPROCESS Process, PVOID Address) -{ - PEPROCESS CurrentProcess = PsGetCurrentProcess(); - - if (Process != NULL && Process != CurrentProcess) - { - KeAttachProcess(&Process->Pcb); - } - - if (Ke386Pae) - { - ULONGLONG ZeroPde = 0LL; - (void)ExfpInterlockedExchange64UL(PAE_ADDR_TO_PDE(Address), &ZeroPde); - MiFlushTlb((PULONG)PAE_ADDR_TO_PDE(Address), PAE_ADDR_TO_PTE(Address)); - } - else - { - *(ADDR_TO_PDE(Address)) = 0; - MiFlushTlb(ADDR_TO_PDE(Address), ADDR_TO_PTE(Address)); - } - if (Address >= MmSystemRangeStart) - { - ASSERT(FALSE); - // MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0; - } - if (Process != NULL && Process != CurrentProcess) - { - KeDetachProcess(); - } }
VOID @@ -1105,73 +917,6 @@ } }
-BOOLEAN -NTAPI -MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address) -{ - if (Address < MmSystemRangeStart && Process == NULL) - { - DPRINT1("MmIsAccessedAndResetAccessPage is called for user space without a process.\n"); - ASSERT(FALSE); - } - if (Ke386Pae) - { - PULONGLONG Pt; - ULONGLONG Pte; - ULONGLONG tmpPte; - - Pt = MmGetPageTableForProcessForPAE(Process, Address, FALSE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - - do - { - Pte = *Pt; - tmpPte = Pte & ~PA_ACCESSED; - } while (Pte != ExfInterlockedCompareExchange64UL(Pt, &tmpPte, &Pte)); - - if (Pte & PA_ACCESSED) - { - MiFlushTlb((PULONG)Pt, Address); - return TRUE; - } - else - { - MmUnmapPageTable((PULONG)Pt); - return FALSE; - } - } - else - { - PULONG Pt; - ULONG Pte; - - Pt = MmGetPageTableForProcess(Process, Address, FALSE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - - 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; - } - } -} - VOID NTAPI MmSetCleanPage(PEPROCESS Process, PVOID Address) @@ -1298,62 +1043,6 @@ } }
-VOID -NTAPI -MmEnableVirtualMapping(PEPROCESS Process, PVOID Address) -{ - if (Ke386Pae) - { - PULONGLONG Pt; - ULONGLONG Pte; - ULONGLONG tmpPte; - - Pt = MmGetPageTableForProcessForPAE(Process, Address, FALSE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - - do - { - Pte = *Pt; - tmpPte = Pte | PA_PRESENT; - } while (Pte != ExfInterlockedCompareExchange64UL(Pt, &tmpPte, &Pte)); - if (!(Pte & PA_PRESENT)) - { - MiFlushTlb((PULONG)Pt, Address); - } - else - { - MmUnmapPageTable((PULONG)Pt); - } - } - else - { - PULONG Pt; - ULONG Pte; - - Pt = MmGetPageTableForProcess(Process, Address, FALSE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - - do - { - Pte = *Pt; - } while (Pte != InterlockedCompareExchangeUL(Pt, Pte | PA_PRESENT, Pte)); - if (!(Pte & PA_PRESENT)) - { - MiFlushTlb(Pt, Address); - } - else - { - MmUnmapPageTable(Pt); - } - } -} - BOOLEAN NTAPI MmIsPagePresent(PEPROCESS Process, PVOID Address) @@ -1384,134 +1073,6 @@ Entry = MmGetPageEntryForProcess(Process, Address); return !(Entry & PA_PRESENT) && Entry != 0 ? TRUE : FALSE; } -} - -NTSTATUS -NTAPI -MmCreateVirtualMappingForKernel(PVOID Address, - ULONG flProtect, - PPFN_NUMBER Pages, - ULONG PageCount) -{ - ULONG Attributes; - ULONG i; - PVOID Addr; - ULONG PdeOffset, oldPdeOffset; - BOOLEAN NoExecute = FALSE; - - DPRINT("MmCreateVirtualMappingForKernel(%x, %x, %x, %d)\n", - Address, flProtect, Pages, PageCount); - - if (Address < MmSystemRangeStart) - { - DPRINT1("MmCreateVirtualMappingForKernel is called for user space\n"); - ASSERT(FALSE); - } - - Attributes = ProtectToPTE(flProtect); - if (Attributes & 0x80000000) - { - NoExecute = TRUE; - } - Attributes &= 0xfff; - if (Ke386GlobalPagesEnabled) - { - Attributes |= PA_GLOBAL; - } - - Addr = Address; - - if (Ke386Pae) - { - PULONGLONG Pt = NULL; - ULONGLONG Pte; - - oldPdeOffset = PAE_ADDR_TO_PDE_OFFSET(Addr) + 1; - for (i = 0; i < PageCount; i++, Addr = (PVOID)((ULONG_PTR)Addr + PAGE_SIZE)) - { - if (!(Attributes & PA_PRESENT) && Pages[i] != 0) - { - DPRINT1("Setting physical address but not allowing access at address " - "0x%.8X with attributes %x/%x.\n", - Addr, Attributes, flProtect); - ASSERT(FALSE); - } - - PdeOffset = PAE_ADDR_TO_PDE_OFFSET(Addr); - if (oldPdeOffset != PdeOffset) - { - Pt = MmGetPageTableForProcessForPAE(NULL, Addr, TRUE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - } - else - { - Pt++; - } - oldPdeOffset = PdeOffset; - - Pte = PFN_TO_PTE(Pages[i]) | Attributes; - if (NoExecute) - { - Pte |= 0x8000000000000000LL; - } - Pte = ExfpInterlockedExchange64UL(Pt, &Pte); - if (Pte != 0LL) - { - ASSERT(FALSE); - } - } - } - else - { - PULONG Pt; - ULONG Pte; - - oldPdeOffset = ADDR_TO_PDE_OFFSET(Addr); - Pt = MmGetPageTableForProcess(NULL, Addr, TRUE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - Pt--; - - for (i = 0; i < PageCount; i++, Addr = (PVOID)((ULONG_PTR)Addr + PAGE_SIZE)) - { - if (!(Attributes & PA_PRESENT) && Pages[i] != 0) - { - DPRINT1("Setting physical address but not allowing access at address " - "0x%.8X with attributes %x/%x.\n", - Addr, Attributes, flProtect); - ASSERT(FALSE); - } - - PdeOffset = ADDR_TO_PDE_OFFSET(Addr); - if (oldPdeOffset != PdeOffset) - { - Pt = MmGetPageTableForProcess(NULL, Addr, TRUE); - if (Pt == NULL) - { - ASSERT(FALSE); - } - } - else - { - Pt++; - } - oldPdeOffset = PdeOffset; - - Pte = *Pt; - if (Pte != 0) - { - ASSERT(FALSE); - } - (void)InterlockedExchangeUL(Pt, PFN_TO_PTE(Pages[i]) | Attributes); - } - } - - return(STATUS_SUCCESS); }
NTSTATUS @@ -1949,49 +1510,6 @@ } }
-/* - * @implemented - */ -PHYSICAL_ADDRESS NTAPI -MmGetPhysicalAddress(PVOID vaddr) -/* - * FUNCTION: Returns the physical address corresponding to a virtual address - */ -{ - PHYSICAL_ADDRESS p; - - DPRINT("MmGetPhysicalAddress(vaddr %x)\n", vaddr); - if (Ke386Pae) - { - ULONGLONG Pte; - Pte = MmGetPageEntryForProcessForPAE(NULL, vaddr); - if (Pte != 0 && Pte & PA_PRESENT) - { - p.QuadPart = PAE_PAGE_MASK(Pte); - p.u.LowPart |= (ULONG_PTR)vaddr & (PAGE_SIZE - 1); - } - else - { - p.QuadPart = 0; - } - } - else - { - ULONG Pte; - Pte = MmGetPageEntryForProcess(NULL, vaddr); - if (Pte != 0 && Pte & PA_PRESENT) - { - p.QuadPart = PAGE_MASK(Pte); - p.u.LowPart |= (ULONG_PTR)vaddr & (PAGE_SIZE - 1); - } - else - { - p.QuadPart = 0; - } - } - return p; -} - PVOID NTAPI MmCreateHyperspaceMapping(PFN_NUMBER Page) @@ -2123,28 +1641,6 @@
PFN_NUMBER NTAPI -MmChangeHyperspaceMapping(PVOID Address, PFN_NUMBER NewPage) -{ - PFN_NUMBER Pfn; - ASSERT (IS_HYPERSPACE(Address)); - if (Ke386Pae) - { - ULONGLONG Entry = PAE_PFN_TO_PTE(NewPage) | PA_PRESENT | PA_READWRITE; - Entry = (ULONG)ExfpInterlockedExchange64UL(PAE_ADDR_TO_PTE(Address), &Entry); - Pfn = PAE_PTE_TO_PFN(Entry); - } - else - { - ULONG Entry; - Entry = InterlockedExchange((PLONG)ADDR_TO_PTE(Address), PFN_TO_PTE(NewPage) | PA_PRESENT | PA_READWRITE); - Pfn = PTE_TO_PFN(Entry); - } - __invlpg(Address); - return Pfn; -} - -PFN_NUMBER -NTAPI MmDeleteHyperspaceMapping(PVOID Address) { PFN_NUMBER Pfn; @@ -2166,91 +1662,6 @@ }
VOID -NTAPI -MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size) -{ - ULONG StartOffset, EndOffset, Offset; - - if (Address < MmSystemRangeStart) - { - ASSERT(FALSE); - } - if (Ke386Pae) - { - PULONGLONG PageDirTable; - PULONGLONG Pde; - ULONGLONG ZeroPde = 0LL; - ULONG i; - - for (i = PAE_ADDR_TO_PDTE_OFFSET(Address); i <= PAE_ADDR_TO_PDTE_OFFSET((PVOID)((ULONG_PTR)Address + Size)); i++) - { - if (i == PAE_ADDR_TO_PDTE_OFFSET(Address)) - { - StartOffset = PAE_ADDR_TO_PDE_PAGE_OFFSET(Address); - } - else - { - StartOffset = 0; - } - if (i == PAE_ADDR_TO_PDTE_OFFSET((PVOID)((ULONG_PTR)Address + Size))) - { - EndOffset = PAE_ADDR_TO_PDE_PAGE_OFFSET((PVOID)((ULONG_PTR)Address + Size)); - } - else - { - EndOffset = 511; - } - - if (Process != NULL && Process != PsGetCurrentProcess()) - { - PageDirTable = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart)); - Pde = (PULONGLONG)MmCreateHyperspaceMapping(PTE_TO_PFN(PageDirTable[i])); - MmDeleteHyperspaceMapping(PageDirTable); - } - else - { - Pde = (PULONGLONG)PAE_PAGEDIRECTORY_MAP + i*512; - } - - for (Offset = StartOffset; Offset <= EndOffset; Offset++) - { - if (i * 512 + Offset < PAE_ADDR_TO_PDE_OFFSET(PAGETABLE_MAP) || i * 512 + Offset >= PAE_ADDR_TO_PDE_OFFSET(PAGETABLE_MAP)+4) - { - (void)ExfInterlockedCompareExchange64UL(&Pde[Offset], &MmGlobalKernelPageDirectoryForPAE[i*512 + Offset], &ZeroPde); - } - } - MmUnmapPageTable((PULONG)Pde); - } - } - else - { - PULONG Pde; - StartOffset = ADDR_TO_PDE_OFFSET(Address); - EndOffset = ADDR_TO_PDE_OFFSET((PVOID)((ULONG_PTR)Address + Size)); - - if (Process != NULL && Process != PsGetCurrentProcess()) - { - Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); - } - else - { - Pde = (PULONG)PAGEDIRECTORY_MAP; - } - for (Offset = StartOffset; Offset <= EndOffset; Offset++) - { - if (Offset != ADDR_TO_PDE_OFFSET(PAGETABLE_MAP)) - { - (void)InterlockedCompareExchangeUL(&Pde[Offset], MmGlobalKernelPageDirectory[Offset], 0); - } - } - if (Pde != (PULONG)PAGEDIRECTORY_MAP) - { - MmDeleteHyperspaceMapping(Pde); - } - } -} - -VOID INIT_FUNCTION NTAPI MmInitGlobalKernelPageDirectory(VOID) @@ -2297,53 +1708,4 @@ } }
-ULONG -NTAPI -MiGetUserPageDirectoryCount(VOID) -{ - return Ke386Pae ? PAE_ADDR_TO_PDE_OFFSET(MmSystemRangeStart) : ADDR_TO_PDE_OFFSET(MmSystemRangeStart); -} - -VOID -INIT_FUNCTION -NTAPI -MiInitPageDirectoryMap(VOID) -{ - MEMORY_AREA* kernel_map_desc = NULL; - MEMORY_AREA* hyperspace_desc = NULL; - PVOID BaseAddress; - NTSTATUS Status; - - DPRINT("MiInitPageDirectoryMap()\n"); - - BaseAddress = (PVOID)PAGETABLE_MAP; - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_SYSTEM, - &BaseAddress, - Ke386Pae ? 0x800000 : 0x400000, - PAGE_READWRITE, - &kernel_map_desc, - TRUE, - 0, - PAGE_SIZE); - if (!NT_SUCCESS(Status)) - { - ASSERT(FALSE); - } - BaseAddress = (PVOID)HYPERSPACE; - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_SYSTEM, - &BaseAddress, - 0x400000, - PAGE_READWRITE, - &hyperspace_desc, - TRUE, - 0, - PAGE_SIZE); - if (!NT_SUCCESS(Status)) - { - ASSERT(FALSE); - } -} - /* EOF */
Modified: trunk/reactos/ntoskrnl/mm/marea.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/marea.c?rev=624... ============================================================================== --- trunk/reactos/ntoskrnl/mm/marea.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/marea.c [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -1205,7 +1205,7 @@
MmUnlockAddressSpace(&Process->Vm);
- DPRINT("Finished MmReleaseMmInfo()\n"); + DPRINT("Finished MmDeleteProcessAddressSpace()\n"); MmDeleteProcessAddressSpace2(Process); return(STATUS_SUCCESS); }
Modified: trunk/reactos/ntoskrnl/mm/pagefile.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pagefile.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/mm/pagefile.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/pagefile.c [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -351,37 +351,6 @@ MiPagingFileCount = 0; }
-BOOLEAN -NTAPI -MmReserveSwapPages(ULONG Nr) -{ - KIRQL oldIrql; - ULONG MiAvailSwapPages; - - KeAcquireSpinLock(&PagingFileListLock, &oldIrql); - MiAvailSwapPages = - (MiFreeSwapPages * MM_PAGEFILE_COMMIT_RATIO) + MM_PAGEFILE_COMMIT_GRACE; - MiReservedSwapPages = MiReservedSwapPages + Nr; - if ((MM_PAGEFILE_COMMIT_RATIO != 0) && (MiAvailSwapPages < MiReservedSwapPages)) - { - KeReleaseSpinLock(&PagingFileListLock, oldIrql); - return(FALSE); - } - KeReleaseSpinLock(&PagingFileListLock, oldIrql); - return(TRUE); -} - -VOID -NTAPI -MmDereserveSwapPages(ULONG Nr) -{ - KIRQL oldIrql; - - KeAcquireSpinLock(&PagingFileListLock, &oldIrql); - MiReservedSwapPages = MiReservedSwapPages - Nr; - KeReleaseSpinLock(&PagingFileListLock, oldIrql); -} - static ULONG MiAllocPageFromPagingFile(PPAGINGFILE PagingFile) { @@ -437,13 +406,6 @@
KeReleaseSpinLockFromDpcLevel(&PagingFileList[i]->AllocMapLock); KeReleaseSpinLock(&PagingFileListLock, oldIrql); -} - -BOOLEAN -NTAPI -MmIsAvailableSwapPage(VOID) -{ - return(MiFreeSwapPages > 0); }
SWAPENTRY
Modified: trunk/reactos/ntoskrnl/mm/powerpc/page.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/powerpc/page.c?... ============================================================================== --- trunk/reactos/ntoskrnl/mm/powerpc/page.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/powerpc/page.c [iso-8859-1] Tue Mar 11 22:51:22 2014 @@ -17,7 +17,6 @@
#if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, MmInitGlobalKernelPageDirectory) -#pragma alloc_text(INIT, MiInitPageDirectoryMap) #endif
/* GLOBALS *****************************************************************/ @@ -103,22 +102,6 @@ return(STATUS_SUCCESS); }
-NTSTATUS -NTAPI -MmInitializeHandBuiltProcess(IN PEPROCESS Process, - IN PLARGE_INTEGER DirectoryTableBase) -{ - /* Share the directory base with the idle process */ - *DirectoryTableBase = PsGetCurrentProcess()->Pcb.DirectoryTableBase; - - /* Initialize the Addresss Space */ - MmInitializeAddressSpace(Process, (PMADDRESS_SPACE)&Process->VadRoot); - - /* The process now has an address space */ - Process->HasAddressSpace = TRUE; - return STATUS_SUCCESS; -} - BOOLEAN NTAPI MmCreateProcessAddressSpace(IN ULONG MinWs, @@ -175,20 +158,6 @@ info.addr = (vaddr_t)Addr; MmuInqPage(&info, 1); return (PVOID)info.phys; -} - -/* - * @implemented - */ -PHYSICAL_ADDRESS NTAPI -MmGetPhysicalAddress(PVOID vaddr) -/* - * FUNCTION: Returns the physical address corresponding to a virtual address - */ -{ - PHYSICAL_ADDRESS Addr; - Addr.QuadPart = (ULONG)MmGetPhysicalAddressProcess(PsGetCurrentProcess()->UniqueProcessId, vaddr); - return Addr; }
PFN_NUMBER @@ -274,24 +243,6 @@ return !!(info.flags & MMU_PAGE_DIRTY); }
-BOOLEAN -NTAPI -MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address) -{ - ppc_map_info_t info = { 0 }; - - if (Address < MmSystemRangeStart && Process == NULL) - { - DPRINT1("MmIsAccessedAndResetAccessPage is called for user space without a process.\n"); - ASSERT(FALSE); - } - - info.proc = Process ? (int)Process->UniqueProcessId : 0; - info.addr = (vaddr_t)Address; - MmuInqPage(&info, 1); - return !!(info.flags /*& MMU_PAGE_ACCESS*/); -} - VOID NTAPI MmSetCleanPage(PEPROCESS Process, PVOID Address) @@ -301,12 +252,6 @@ VOID NTAPI MmSetDirtyPage(PEPROCESS Process, PVOID Address) -{ -} - -VOID -NTAPI -MmEnableVirtualMapping(PEPROCESS Process, PVOID Address) { }
@@ -333,44 +278,6 @@ ULONG Entry; Entry = MmGetPageEntryForProcess(Process, Address); return !(Entry & PA_PRESENT) && Entry != 0 ? TRUE : FALSE; -} - -NTSTATUS -NTAPI -MmCreateVirtualMappingForKernel(PVOID Address, - ULONG flProtect, - PPFN_NUMBER Pages, - ULONG PageCount) -{ - ULONG i; - PVOID Addr; - - DPRINT("MmCreateVirtualMappingForKernel(%x, %x, %x, %d)\n", - Address, flProtect, Pages, PageCount); - - if (Address < MmSystemRangeStart) - { - DPRINT1("MmCreateVirtualMappingForKernel is called for user space\n"); - ASSERT(FALSE); - } - - Addr = Address; - - for (i = 0; i < PageCount; i++, Addr = (PVOID)((ULONG_PTR)Addr + PAGE_SIZE)) - { -#if 0 - if (!(Attributes & PA_PRESENT) && Pages[i] != 0) - { - DPRINT1("Setting physical address but not allowing access at address " - "0x%.8X with attributes %x/%x.\n", - Addr, Attributes, flProtect); - ASSERT(FALSE); - } - (void)InterlockedExchangeUL(Pt, PFN_TO_PTE(Pages[i]) | Attributes); -#endif - } - - return(STATUS_SUCCESS); }
NTSTATUS @@ -570,32 +477,15 @@
PFN_NUMBER NTAPI -MmChangeHyperspaceMapping(PVOID Address, PFN_NUMBER NewPage) -{ - PFN_NUMBER OldPage; - ppc_map_info_t info = { 0 }; +MmDeleteHyperspaceMapping(PVOID Address) +{ + ppc_map_info_t info = { 0 }; + ASSERT (IS_HYPERSPACE(Address));
info.proc = 0; info.addr = (vaddr_t)Address; + MmuUnmapPage(&info, 1); - OldPage = info.phys; - info.phys = (paddr_t)NewPage; - MmuMapPage(&info, 1); - - return NewPage; -} - -PFN_NUMBER -NTAPI -MmDeleteHyperspaceMapping(PVOID Address) -{ - ppc_map_info_t info = { 0 }; - ASSERT (IS_HYPERSPACE(Address)); - - info.proc = 0; - info.addr = (vaddr_t)Address; - - MmuUnmapPage(&info, 1);
return (PFN_NUMBER)info.phys; } @@ -604,26 +494,6 @@ INIT_FUNCTION NTAPI MmInitGlobalKernelPageDirectory(VOID) -{ -} - -VOID -INIT_FUNCTION -NTAPI -MiInitPageDirectoryMap(VOID) -{ -} - -ULONG -NTAPI -MiGetUserPageDirectoryCount(VOID) -{ - return 0; -} - -VOID -NTAPI -MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size) { }