Author: mbosma
Date: Fri Jul 14 14:10:39 2006
New Revision: 23058
URL:
http://svn.reactos.org/svn/reactos?rev=23058&view=rev
Log:
Merge changes from PS rewrite.
Modified:
branches/cache_manager_rewrite/mm/mm.c
branches/cache_manager_rewrite/mm/process.c
Modified: branches/cache_manager_rewrite/mm/mm.c
URL:
http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/mm/mm.c?r…
==============================================================================
--- branches/cache_manager_rewrite/mm/mm.c (original)
+++ branches/cache_manager_rewrite/mm/mm.c Fri Jul 14 14:10:39 2006
@@ -22,65 +22,11 @@
PVOID MmHighestUserAddress = NULL;
PBOOLEAN Mm64BitPhysicalAddress = FALSE;
PVOID MmSystemRangeStart = NULL;
+ULONG MmReadClusterSize;
MM_STATS MmStats;
/* FUNCTIONS ****************************************************************/
-
-
-NTSTATUS
-NTAPI
-MmReleaseMmInfo(PEPROCESS Process)
-{
- PVOID Address;
- PMEMORY_AREA MemoryArea;
-
- DPRINT("MmReleaseMmInfo(Process %x (%s))\n", Process,
- Process->ImageFileName);
-
- MmLockAddressSpace((PMADDRESS_SPACE)&Process->VadRoot);
-
- while ((MemoryArea = ((PMADDRESS_SPACE)&Process->VadRoot)->MemoryAreaRoot)
!= NULL)
- {
- switch (MemoryArea->Type)
- {
- case MEMORY_AREA_SECTION_VIEW:
- Address = (PVOID)MemoryArea->StartingAddress;
- MmUnlockAddressSpace((PMADDRESS_SPACE)&Process->VadRoot);
- MmUnmapViewOfSection((PEPROCESS)Process, Address);
- MmLockAddressSpace((PMADDRESS_SPACE)&Process->VadRoot);
- break;
-
- case MEMORY_AREA_VIRTUAL_MEMORY:
- case MEMORY_AREA_PEB_OR_TEB:
- MmFreeVirtualMemory(Process, MemoryArea);
- break;
-
- case MEMORY_AREA_SHARED_DATA:
- case MEMORY_AREA_NO_ACCESS:
- MmFreeMemoryArea((PMADDRESS_SPACE)&Process->VadRoot,
- MemoryArea,
- NULL,
- NULL);
- break;
-
- case MEMORY_AREA_MDL_MAPPING:
- KEBUGCHECK(PROCESS_HAS_LOCKED_PAGES);
- break;
-
- default:
- KEBUGCHECK(0);
- }
- }
-
- Mmi386ReleaseMmInfo(Process);
-
- MmUnlockAddressSpace((PMADDRESS_SPACE)&Process->VadRoot);
- MmDestroyAddressSpace((PMADDRESS_SPACE)&Process->VadRoot);
-
- DPRINT("Finished MmReleaseMmInfo()\n");
- return(STATUS_SUCCESS);
-}
/*
* @implemented
Modified: branches/cache_manager_rewrite/mm/process.c
URL:
http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/mm/proces…
==============================================================================
--- branches/cache_manager_rewrite/mm/process.c (original)
+++ branches/cache_manager_rewrite/mm/process.c Fri Jul 14 14:10:39 2006
@@ -22,6 +22,33 @@
(PVOID)((ULONG_PTR)MM_HIGHEST_USER_ADDRESS - (16 * PAGE_SIZE))
/* FUNCTIONS *****************************************************************/
+
+LCID
+NTAPI
+MmGetSessionLocaleId(VOID)
+{
+ PEPROCESS Process;
+ PAGED_CODE();
+
+ /* Get the current process */
+ Process = PsGetCurrentProcess();
+
+ /* Check if it's the Session Leader */
+ if (Process->Vm.Flags.SessionLeader)
+ {
+ /* Make sure it has a valid Session */
+ if (Process->Session)
+ {
+ /* Get the Locale ID */
+#if ROS_HAS_SESSIONS
+ return ((PMM_SESSION_SPACE)Process->Session)->LocaleId;
+#endif
+ }
+ }
+
+ /* Not a session leader, return the default */
+ return PsDefaultThreadLocaleId;
+}
PVOID
STDCALL
@@ -489,6 +516,9 @@
goto exit;
}
+ /* The process now has an address space */
+ Process->HasAddressSpace = TRUE;
+
/* Check if there's a Section Object */
if (Section)
{
@@ -559,3 +589,64 @@
/* Return status to caller */
return Status;
}
+
+VOID
+NTAPI
+MmCleanProcessAddressSpace(IN PEPROCESS Process)
+{
+ /* FIXME: Add part of MmDeleteProcessAddressSpace here */
+}
+
+NTSTATUS
+NTAPI
+MmDeleteProcessAddressSpace(PEPROCESS Process)
+{
+ PVOID Address;
+ PMEMORY_AREA MemoryArea;
+
+ DPRINT("MmDeleteProcessAddressSpace(Process %x (%s))\n", Process,
+ Process->ImageFileName);
+
+ MmLockAddressSpace((PMADDRESS_SPACE)&Process->VadRoot);
+
+ while ((MemoryArea = ((PMADDRESS_SPACE)&Process->VadRoot)->MemoryAreaRoot)
!= NULL)
+ {
+ switch (MemoryArea->Type)
+ {
+ case MEMORY_AREA_SECTION_VIEW:
+ Address = (PVOID)MemoryArea->StartingAddress;
+ MmUnlockAddressSpace((PMADDRESS_SPACE)&Process->VadRoot);
+ MmUnmapViewOfSection(Process, Address);
+ MmLockAddressSpace((PMADDRESS_SPACE)&Process->VadRoot);
+ break;
+
+ case MEMORY_AREA_VIRTUAL_MEMORY:
+ case MEMORY_AREA_PEB_OR_TEB:
+ MmFreeVirtualMemory(Process, MemoryArea);
+ break;
+
+ case MEMORY_AREA_SHARED_DATA:
+ case MEMORY_AREA_NO_ACCESS:
+ MmFreeMemoryArea((PMADDRESS_SPACE)&Process->VadRoot,
+ MemoryArea,
+ NULL,
+ NULL);
+ break;
+
+ case MEMORY_AREA_MDL_MAPPING:
+ KEBUGCHECK(PROCESS_HAS_LOCKED_PAGES);
+ break;
+
+ default:
+ KEBUGCHECK(0);
+ }
+ }
+
+ Mmi386ReleaseMmInfo(Process);
+
+ MmUnlockAddressSpace((PMADDRESS_SPACE)&Process->VadRoot);
+ MmDestroyAddressSpace((PMADDRESS_SPACE)&Process->VadRoot);
+
+ DPRINT("Finished MmReleaseMmInfo()\n");
+ return(STATUS_SUCCESS);
+}