From 7c1492c71221d45d71849eb7d4d8871ed00698e5 Mon Sep 17 00:00:00 2001 From: ReactOS Portable Systems Group Date: Mon, 28 Jul 2008 01:11:19 +0000 Subject: [PATCH] The address space creation lock is a guarded mutex, not a pushlock, in NT 5.2. While it is commendable to attempt using Vista optimizations (it is a push lock on Vista) in order to speed up the kernel, it is entirely stupid to do so by completing ignoring the ramifications of this change, and furthermore, to pollute the kernel with typecasts, as well as to introduce non-standard behavior. Ironically it is ion himself who made this change. svn path=/trunk/; revision=34879 --- reactos/ntoskrnl/include/internal/mm.h | 6 ++---- reactos/ntoskrnl/mm/i386/page.c | 1 + reactos/ntoskrnl/mm/procsup.c | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/mm.h b/reactos/ntoskrnl/include/internal/mm.h index 9fcecf66a08..bccfd98a031 100644 --- a/reactos/ntoskrnl/include/internal/mm.h +++ b/reactos/ntoskrnl/include/internal/mm.h @@ -1574,16 +1574,14 @@ FORCEINLINE VOID MmLockAddressSpace(PMADDRESS_SPACE AddressSpace) { - KeEnterCriticalRegion(); - ExAcquirePushLockExclusive((PEX_PUSH_LOCK)&CONTAINING_RECORD(AddressSpace, EPROCESS, VadRoot)->AddressCreationLock); + KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, VadRoot)->AddressCreationLock); } FORCEINLINE VOID MmUnlockAddressSpace(PMADDRESS_SPACE AddressSpace) { - ExReleasePushLock((PEX_PUSH_LOCK)&CONTAINING_RECORD(AddressSpace, EPROCESS, VadRoot)->AddressCreationLock); - KeLeaveCriticalRegion(); + KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, VadRoot)->AddressCreationLock); } FORCEINLINE diff --git a/reactos/ntoskrnl/mm/i386/page.c b/reactos/ntoskrnl/mm/i386/page.c index 8c99a9aa2cc..c4d017baa48 100644 --- a/reactos/ntoskrnl/mm/i386/page.c +++ b/reactos/ntoskrnl/mm/i386/page.c @@ -196,6 +196,7 @@ MmInitializeHandBuiltProcess(IN PEPROCESS Process, *DirectoryTableBase = PsGetCurrentProcess()->Pcb.DirectoryTableBase; /* Initialize the Addresss Space */ + KeInitializeGuardedMutex(&Process->AddressCreationLock); MmInitializeAddressSpace(Process, (PMADDRESS_SPACE)&Process->VadRoot); /* The process now has an address space */ diff --git a/reactos/ntoskrnl/mm/procsup.c b/reactos/ntoskrnl/mm/procsup.c index 995f96b5b46..2e34da55bba 100644 --- a/reactos/ntoskrnl/mm/procsup.c +++ b/reactos/ntoskrnl/mm/procsup.c @@ -520,6 +520,7 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process, BoundaryAddressMultiple.QuadPart = 0; /* Initialize the Addresss Space */ + KeInitializeGuardedMutex(&Process->AddressCreationLock); MmInitializeAddressSpace(Process, ProcessAddressSpace); /* Acquire the Lock */