2005-07-31 12:11:56 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
2008-05-22 13:40:42 +00:00
|
|
|
* FILE: ntoskrnl/mm/procsup.c
|
2005-07-31 12:11:56 +00:00
|
|
|
* PURPOSE: Memory functions related to Processes
|
|
|
|
*
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
|
|
|
#include <ntoskrnl.h>
|
|
|
|
#define NDEBUG
|
2008-08-30 16:31:06 +00:00
|
|
|
#include <debug.h>
|
2005-07-31 12:11:56 +00:00
|
|
|
|
[NTOS]: MiRosTakeOverPebTebRanges now creates a small ~1MB ARM3 memory range on top of the ReactOS per-process VA. This does a couple of things: First of all, it changes the default PEB address to another static address. Still not dynamic like it will be soon, but at least it changes it a bit so we can test if anything breaks due to that. It also likewise changes the addresses of the TEBs (Shifted down by 1MB, basically). Finally, it blocks off that part of address space, which nobody should be using now, to see if anyone does indeed touch it.
[NTOS]: Knowing if this change causes issues will help later in determining regressions due to TEB/PEBs mapped as VADs by ARM3, and regressions simply due to the change in VA layout.
[NTOS]: When implemented, the VAD mapping for PEB/TEB will only use that ~1MB, which yes, will limit ReactOS processes to each have only 256 threads. That is obviously a temporary limitation, one I doubt we'll even hit, but I'm putting it out here so you know.
svn path=/trunk/; revision=48176
2010-07-22 03:22:43 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
2010-07-22 20:54:37 +00:00
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
NTSTATUS
|
2006-07-09 18:54:13 +00:00
|
|
|
NTAPI
|
|
|
|
MmDeleteProcessAddressSpace(PEPROCESS Process)
|
|
|
|
{
|
|
|
|
PVOID Address;
|
|
|
|
PMEMORY_AREA MemoryArea;
|
|
|
|
|
|
|
|
DPRINT("MmDeleteProcessAddressSpace(Process %x (%s))\n", Process,
|
|
|
|
Process->ImageFileName);
|
|
|
|
|
2010-09-12 19:02:39 +00:00
|
|
|
RemoveEntryList(&Process->MmProcessLinks);
|
|
|
|
|
2009-04-27 10:12:57 +00:00
|
|
|
MmLockAddressSpace(&Process->Vm);
|
2006-07-09 18:54:13 +00:00
|
|
|
|
2009-04-27 10:12:57 +00:00
|
|
|
while ((MemoryArea = (PMEMORY_AREA)Process->Vm.WorkingSetExpansionLinks.Flink) != NULL)
|
2006-07-09 18:54:13 +00:00
|
|
|
{
|
|
|
|
switch (MemoryArea->Type)
|
|
|
|
{
|
|
|
|
case MEMORY_AREA_SECTION_VIEW:
|
|
|
|
Address = (PVOID)MemoryArea->StartingAddress;
|
2009-04-27 10:12:57 +00:00
|
|
|
MmUnlockAddressSpace(&Process->Vm);
|
2006-07-09 18:54:13 +00:00
|
|
|
MmUnmapViewOfSection(Process, Address);
|
2009-04-27 10:12:57 +00:00
|
|
|
MmLockAddressSpace(&Process->Vm);
|
2006-07-09 18:54:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MEMORY_AREA_VIRTUAL_MEMORY:
|
|
|
|
MmFreeVirtualMemory(Process, MemoryArea);
|
|
|
|
break;
|
|
|
|
|
[NTOS]: MiRosTakeOverPebTebRanges now creates a small ~1MB ARM3 memory range on top of the ReactOS per-process VA. This does a couple of things: First of all, it changes the default PEB address to another static address. Still not dynamic like it will be soon, but at least it changes it a bit so we can test if anything breaks due to that. It also likewise changes the addresses of the TEBs (Shifted down by 1MB, basically). Finally, it blocks off that part of address space, which nobody should be using now, to see if anyone does indeed touch it.
[NTOS]: Knowing if this change causes issues will help later in determining regressions due to TEB/PEBs mapped as VADs by ARM3, and regressions simply due to the change in VA layout.
[NTOS]: When implemented, the VAD mapping for PEB/TEB will only use that ~1MB, which yes, will limit ReactOS processes to each have only 256 threads. That is obviously a temporary limitation, one I doubt we'll even hit, but I'm putting it out here so you know.
svn path=/trunk/; revision=48176
2010-07-22 03:22:43 +00:00
|
|
|
case MEMORY_AREA_OWNED_BY_ARM3:
|
2009-04-27 10:12:57 +00:00
|
|
|
MmFreeMemoryArea(&Process->Vm,
|
2006-07-09 18:54:13 +00:00
|
|
|
MemoryArea,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2008-12-07 18:05:28 +00:00
|
|
|
KeBugCheck(MEMORY_MANAGEMENT);
|
2006-07-09 18:54:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-27 10:12:57 +00:00
|
|
|
MmUnlockAddressSpace(&Process->Vm);
|
2006-07-09 18:54:13 +00:00
|
|
|
|
|
|
|
DPRINT("Finished MmReleaseMmInfo()\n");
|
|
|
|
return(STATUS_SUCCESS);
|
|
|
|
}
|
2008-05-22 13:40:42 +00:00
|
|
|
|