Author: tkreuzer Date: Thu May 22 10:08:44 2014 New Revision: 63405
URL: http://svn.reactos.org/svn/reactos?rev=63405&view=rev Log: [NTOSKRNL] - Do not align the size of a memory area to the allocation granularity, but to PAGE_SIZE. Fixes OllyDbg regression from r61108. CORE-8168 #resolve - Clarify the size calculation in MmCreateMemoryArea - Silence a few DPRINTs
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h trunk/reactos/ntoskrnl/mm/ARM3/virtual.c trunk/reactos/ntoskrnl/mm/marea.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?re... ============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Thu May 22 10:08:44 2014 @@ -1100,11 +1100,11 @@ /* Check if this process is the owner, and that the thread owns the WS */ if (PsGetCurrentThread()->OwnsProcessWorkingSetExclusive == 0) { - DPRINT1("Thread: %p is not an owner\n", PsGetCurrentThread()); + DPRINT("Thread: %p is not an owner\n", PsGetCurrentThread()); } if (KeGetCurrentThread()->ApcState.Process != &Process->Pcb) { - DPRINT1("Current thread %p is attached to another process %p\n", PsGetCurrentThread(), Process); + DPRINT("Current thread %p is attached to another process %p\n", PsGetCurrentThread(), Process); } return ((KeGetCurrentThread()->ApcState.Process == &Process->Pcb) && ((PsGetCurrentThread()->OwnsProcessWorkingSetExclusive) ||
Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/virtual.c?... ============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] Thu May 22 10:08:44 2014 @@ -1291,10 +1291,10 @@ }
/* This is software PTE */ - DPRINT1("Prototype PTE: %lx %p\n", TempPte.u.Hard.PageFrameNumber, Pfn); - DPRINT1("VA: %p\n", MiPteToAddress(&TempPte)); - DPRINT1("Mask: %lx\n", TempPte.u.Soft.Protection); - DPRINT1("Mask2: %lx\n", Pfn->OriginalPte.u.Soft.Protection); + DPRINT("Prototype PTE: %lx %p\n", TempPte.u.Hard.PageFrameNumber, Pfn); + DPRINT("VA: %p\n", MiPteToAddress(&TempPte)); + DPRINT("Mask: %lx\n", TempPte.u.Soft.Protection); + DPRINT("Mask2: %lx\n", Pfn->OriginalPte.u.Soft.Protection); return MmProtectToValue[TempPte.u.Soft.Protection]; }
Modified: trunk/reactos/ntoskrnl/mm/marea.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/marea.c?rev=634... ============================================================================== --- trunk/reactos/ntoskrnl/mm/marea.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/marea.c [iso-8859-1] Thu May 22 10:08:44 2014 @@ -988,6 +988,7 @@ { ULONG_PTR tmpLength; PMEMORY_AREA MemoryArea; + ULONG_PTR EndingAddress;
DPRINT("MmCreateMemoryArea(Type 0x%lx, BaseAddress %p, " "*BaseAddress %p, Length %p, AllocationFlags %x, " @@ -997,7 +998,7 @@
if ((*BaseAddress) == 0 && !FixedAddress) { - tmpLength = (ULONG_PTR)MM_ROUND_UP(Length, Granularity); + tmpLength = (ULONG_PTR)MM_ROUND_UP(Length, PAGE_SIZE); *BaseAddress = MmFindGap(AddressSpace, tmpLength, Granularity, @@ -1010,10 +1011,9 @@ } else { - tmpLength = Length + ((ULONG_PTR) *BaseAddress - - (ULONG_PTR) MM_ROUND_DOWN(*BaseAddress, Granularity)); - tmpLength = (ULONG_PTR)MM_ROUND_UP(tmpLength, Granularity); - *BaseAddress = MM_ROUND_DOWN(*BaseAddress, Granularity); + EndingAddress = ((ULONG_PTR)*BaseAddress + Length - 1) | (PAGE_SIZE - 1); + *BaseAddress = ALIGN_DOWN_POINTER_BY(*BaseAddress, Granularity); + tmpLength = EndingAddress + 1 - (ULONG_PTR)*BaseAddress;
if (!MmGetAddressSpaceOwner(AddressSpace) && *BaseAddress < MmSystemRangeStart) {