Author: sir_richard
Date: Thu Jul 22 03:22:43 2010
New Revision: 48176
URL:
http://svn.reactos.org/svn/reactos?rev=48176&view=rev
Log:
[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.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
trunk/reactos/ntoskrnl/mm/procsup.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Thu Jul 22 03:22:43 2010
@@ -24,6 +24,29 @@
PVOID BaseAddress);
/* PRIVATE FUNCTIONS **********************************************************/
+
+VOID
+NTAPI
+MiRosTakeOverPebTebRanges(IN PEPROCESS Process)
+{
+ NTSTATUS Status;
+ PMEMORY_AREA MemoryArea;
+ PHYSICAL_ADDRESS BoundaryAddressMultiple;
+ PVOID AllocatedBase = (PVOID)MI_LOWEST_VAD_ADDRESS;
+ BoundaryAddressMultiple.QuadPart = 0;
+
+ Status = MmCreateMemoryArea(&Process->Vm,
+ MEMORY_AREA_OWNED_BY_ARM3,
+ &AllocatedBase,
+ ((ULONG_PTR)MM_HIGHEST_VAD_ADDRESS - 1) -
+ (ULONG_PTR)MI_LOWEST_VAD_ADDRESS,
+ PAGE_READWRITE,
+ &MemoryArea,
+ TRUE,
+ 0,
+ BoundaryAddressMultiple);
+ ASSERT(NT_SUCCESS(Status));
+}
VOID
NTAPI
@@ -394,8 +417,8 @@
//
Peb = MiCreatePebOrTeb(Process,
(PVOID)((ULONG_PTR)MM_HIGHEST_VAD_ADDRESS + 1));
- ASSERT(Peb == (PVOID)0x7FFDF000);
-
+ if (!Peb) return STATUS_INSUFFICIENT_RESOURCES;
+
//
// Map NLS Tables
//
Modified: trunk/reactos/ntoskrnl/mm/procsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/procsup.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/procsup.c [iso-8859-1] Thu Jul 22 03:22:43 2010
@@ -13,8 +13,10 @@
#define NDEBUG
#include <debug.h>
+VOID NTAPI MiRosTakeOverPebTebRanges(IN PEPROCESS Process);
+
/* FUNCTIONS *****************************************************************/
-
+
PVOID
NTAPI
MiCreatePebOrTeb(PEPROCESS Process,
@@ -111,6 +113,9 @@
FALSE,
0,
BoundaryAddressMultiple);
+
+ /* Lock the VAD, ARM3-owned ranges away */
+ MiRosTakeOverPebTebRanges(Process);
return Status;
}
@@ -192,7 +197,10 @@
{
DPRINT1("Failed to create Shared User Data\n");
goto exit;
- }
+ }
+
+ /* Lock the VAD, ARM3-owned ranges away */
+ MiRosTakeOverPebTebRanges(Process);
/* The process now has an address space */
Process->HasAddressSpace = TRUE;
@@ -319,6 +327,7 @@
case MEMORY_AREA_SHARED_DATA:
case MEMORY_AREA_NO_ACCESS:
+ case MEMORY_AREA_OWNED_BY_ARM3:
MmFreeMemoryArea(&Process->Vm,
MemoryArea,
NULL,