[ros-diffs] [sir_richard] 48202: [NTOS]: Stop creating a memory area for the shared user data page. [NTOS]: Also stop creating a memory area for the illegal user-mode parts of address space. [NTOS]: Instead, mark the area between MM_HIGHEST_VAD_ADDRESS and MM_HIGHEST_USER_ADDRESS as being ARM3 as well: this way, ARM3 will get the illegal access (and fault), and it will also get the shared user data page access. [NTOS]: With the previous commit, ARM3 knows how to handle the shared user data page access, and does so succesfully. End result: two more MAREA types have been removed, and the address space setup code is now much simpler.
sir_richard at svn.reactos.org
sir_richard at svn.reactos.org
Thu Jul 22 20:54:38 UTC 2010
- Previous message: [ros-diffs] [sir_richard] 48201: Note: this patch only implements the code paths, they are not excercised yet. [NTOS]: Implement handling a very special case of "prototype PTE", the one used to map the shared user data for user-mode applications. [NTOS]: MiCheckVirtualAddress detects this (Windows behavior) and returns a prototype PTE that's marked MM_READONLY. This is our MmSharedUserDataPte from before. This gets sent to MiDispatchFault which calls MiResolveProtoPteFault to handle it. In turn, this calls MiCompleteProtoPteFault. All these code paths have heavy ASSERTions to only allow them to be hit for the shared user data page, however, in the far distant future when prototype PTEs are used for section objects, we'll at least have the right checks and code flow (many of these ASSERTions will then have to be removed). [NTOS]: The end result is that we also now have STATUS_PAGE_FAULT_TRANSITION, not just STATUS_PAGE_FAULT_DEMAND_ZERO, and that prototype PTEs are somewhat understood and some assumptions have been removed.
- Next message: [ros-diffs] [dreimer] 48203: Update FireFox, KDE, MirandaIM, Mono, Opera, RosBE64, SeaMonkey, ThunderBird, uTorrent, VLC in rapps.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: sir_richard
Date: Thu Jul 22 20:54:37 2010
New Revision: 48202
URL: http://svn.reactos.org/svn/reactos?rev=48202&view=rev
Log:
[NTOS]: Stop creating a memory area for the shared user data page.
[NTOS]: Also stop creating a memory area for the illegal user-mode parts of address space.
[NTOS]: Instead, mark the area between MM_HIGHEST_VAD_ADDRESS and MM_HIGHEST_USER_ADDRESS as being ARM3 as well: this way, ARM3 will get the illegal access (and fault), and it will also get the shared user data page access.
[NTOS]: With the previous commit, ARM3 knows how to handle the shared user data page access, and does so succesfully. End result: two more MAREA types have been removed, and the address space setup code is now much simpler.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
trunk/reactos/ntoskrnl/mm/mmfault.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?rev=48202&r1=48201&r2=48202&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Thu Jul 22 20:54:37 2010
@@ -33,7 +33,7 @@
Status = MmCreateMemoryArea(&Process->Vm,
MEMORY_AREA_OWNED_BY_ARM3,
&AllocatedBase,
- ((ULONG_PTR)MM_HIGHEST_VAD_ADDRESS - 1) -
+ ((ULONG_PTR)MM_HIGHEST_USER_ADDRESS - 1) -
(ULONG_PTR)MI_LOWEST_VAD_ADDRESS,
PAGE_READWRITE,
&MemoryArea,
Modified: trunk/reactos/ntoskrnl/mm/mmfault.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mmfault.c?rev=48202&r1=48201&r2=48202&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mmfault.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mmfault.c [iso-8859-1] Thu Jul 22 20:54:37 2010
@@ -105,10 +105,6 @@
switch (MemoryArea->Type)
{
- case MEMORY_AREA_SYSTEM:
- Status = STATUS_ACCESS_VIOLATION;
- break;
-
case MEMORY_AREA_PAGED_POOL:
Status = STATUS_SUCCESS;
break;
@@ -124,10 +120,6 @@
Status = STATUS_ACCESS_VIOLATION;
break;
- case MEMORY_AREA_SHARED_DATA:
- Status = STATUS_ACCESS_VIOLATION;
- break;
-
default:
Status = STATUS_ACCESS_VIOLATION;
break;
@@ -153,7 +145,6 @@
MEMORY_AREA* MemoryArea;
NTSTATUS Status;
BOOLEAN Locked = FromMdl;
- extern PMMPTE MmSharedUserDataPte;
DPRINT("MmNotPresentFault(Mode %d, Address %x)\n", Mode, Address);
@@ -211,10 +202,6 @@
break;
}
- case MEMORY_AREA_SYSTEM:
- Status = STATUS_ACCESS_VIOLATION;
- break;
-
case MEMORY_AREA_SECTION_VIEW:
Status = MmNotPresentFaultSectionView(AddressSpace,
MemoryArea,
@@ -223,16 +210,10 @@
break;
case MEMORY_AREA_VIRTUAL_MEMORY:
- case MEMORY_AREA_PEB_OR_TEB:
Status = MmNotPresentFaultVirtualMemory(AddressSpace,
MemoryArea,
(PVOID)Address,
Locked);
- break;
-
- case MEMORY_AREA_SHARED_DATA:
- *MiAddressToPte(USER_SHARED_DATA) = *MmSharedUserDataPte;
- Status = STATUS_SUCCESS;
break;
default:
@@ -284,7 +265,7 @@
* can go away.
*/
MemoryArea = MmLocateMemoryAreaByAddress(MmGetKernelAddressSpace(), Address);
- if (!(MemoryArea) && (Address <= MM_HIGHEST_VAD_ADDRESS))
+ if (!(MemoryArea) && (Address <= MM_HIGHEST_USER_ADDRESS))
{
/* Could this be a VAD fault from user-mode? */
MemoryArea = MmLocateMemoryAreaByAddress(MmGetCurrentAddressSpace(), Address);
Modified: trunk/reactos/ntoskrnl/mm/procsup.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/procsup.c?rev=48202&r1=48201&r2=48202&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/procsup.c [iso-8859-1] Thu Jul 22 20:54:37 2010
@@ -14,35 +14,16 @@
#include <debug.h>
VOID NTAPI MiRosTakeOverPebTebRanges(IN PEPROCESS Process);
+
+/* FUNCTIONS *****************************************************************/
-/* FUNCTIONS *****************************************************************/
-
NTSTATUS
NTAPI
MmInitializeHandBuiltProcess2(IN PEPROCESS Process)
{
- PVOID BaseAddress;
- PMEMORY_AREA MemoryArea;
- PHYSICAL_ADDRESS BoundaryAddressMultiple;
- NTSTATUS Status;
- PMMSUPPORT ProcessAddressSpace = &Process->Vm;
- BoundaryAddressMultiple.QuadPart = 0;
-
- /* Create the shared data page */
- BaseAddress = (PVOID)USER_SHARED_DATA;
- Status = MmCreateMemoryArea(ProcessAddressSpace,
- MEMORY_AREA_SHARED_DATA,
- &BaseAddress,
- PAGE_SIZE,
- PAGE_EXECUTE_READ,
- &MemoryArea,
- FALSE,
- 0,
- BoundaryAddressMultiple);
-
/* Lock the VAD, ARM3-owned ranges away */
MiRosTakeOverPebTebRanges(Process);
- return Status;
+ return STATUS_SUCCESS;
}
NTSTATUS
@@ -53,15 +34,11 @@
IN OUT PULONG Flags,
IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL)
{
- NTSTATUS Status;
+ NTSTATUS Status = STATUS_SUCCESS;
PMMSUPPORT ProcessAddressSpace = &Process->Vm;
- PVOID BaseAddress;
- PMEMORY_AREA MemoryArea;
- PHYSICAL_ADDRESS BoundaryAddressMultiple;
SIZE_T ViewSize = 0;
PVOID ImageBase = 0;
PROS_SECTION_OBJECT SectionObject = Section;
- BoundaryAddressMultiple.QuadPart = 0;
/* Initialize the Addresss Space lock */
KeInitializeGuardedMutex(&Process->AddressCreationLock);
@@ -73,59 +50,8 @@
/* Acquire the Lock */
MmLockAddressSpace(ProcessAddressSpace);
-
- /* Protect the highest 64KB of the process address space */
- BaseAddress = (PVOID)MmUserProbeAddress;
- Status = MmCreateMemoryArea(ProcessAddressSpace,
- MEMORY_AREA_NO_ACCESS,
- &BaseAddress,
- 0x10000,
- PAGE_NOACCESS,
- &MemoryArea,
- FALSE,
- 0,
- BoundaryAddressMultiple);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to protect last 64KB\n");
- goto exit;
- }
-
- /* Protect the 60KB above the shared user page */
- BaseAddress = (char*)USER_SHARED_DATA + PAGE_SIZE;
- Status = MmCreateMemoryArea(ProcessAddressSpace,
- MEMORY_AREA_NO_ACCESS,
- &BaseAddress,
- 0x10000 - PAGE_SIZE,
- PAGE_NOACCESS,
- &MemoryArea,
- FALSE,
- 0,
- BoundaryAddressMultiple);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to protect the memory above the shared user page\n");
- goto exit;
- }
-
- /* Create the shared data page */
- BaseAddress = (PVOID)USER_SHARED_DATA;
- Status = MmCreateMemoryArea(ProcessAddressSpace,
- MEMORY_AREA_SHARED_DATA,
- &BaseAddress,
- PAGE_SIZE,
- PAGE_EXECUTE_READ,
- &MemoryArea,
- FALSE,
- 0,
- BoundaryAddressMultiple);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to create Shared User Data\n");
- goto exit;
- }
- /* Lock the VAD, ARM3-owned ranges away */
+ /* Lock the VAD, ARM3-owned ranges away */
MiRosTakeOverPebTebRanges(Process);
/* The process now has an address space */
@@ -207,7 +133,6 @@
return Status;
}
-exit:
/* Unlock the Address Space */
DPRINT("Unlocking\n");
MmUnlockAddressSpace(ProcessAddressSpace);
@@ -247,22 +172,15 @@
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:
case MEMORY_AREA_OWNED_BY_ARM3:
MmFreeMemoryArea(&Process->Vm,
MemoryArea,
NULL,
NULL);
break;
-
- case MEMORY_AREA_MDL_MAPPING:
- KeBugCheck(PROCESS_HAS_LOCKED_PAGES);
- break;
default:
KeBugCheck(MEMORY_MANAGEMENT);
- Previous message: [ros-diffs] [sir_richard] 48201: Note: this patch only implements the code paths, they are not excercised yet. [NTOS]: Implement handling a very special case of "prototype PTE", the one used to map the shared user data for user-mode applications. [NTOS]: MiCheckVirtualAddress detects this (Windows behavior) and returns a prototype PTE that's marked MM_READONLY. This is our MmSharedUserDataPte from before. This gets sent to MiDispatchFault which calls MiResolveProtoPteFault to handle it. In turn, this calls MiCompleteProtoPteFault. All these code paths have heavy ASSERTions to only allow them to be hit for the shared user data page, however, in the far distant future when prototype PTEs are used for section objects, we'll at least have the right checks and code flow (many of these ASSERTions will then have to be removed). [NTOS]: The end result is that we also now have STATUS_PAGE_FAULT_TRANSITION, not just STATUS_PAGE_FAULT_DEMAND_ZERO, and that prototype PTEs are somewhat understood and some assumptions have been removed.
- Next message: [ros-diffs] [dreimer] 48203: Update FireFox, KDE, MirandaIM, Mono, Opera, RosBE64, SeaMonkey, ThunderBird, uTorrent, VLC in rapps.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Ros-diffs
mailing list