mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[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 svn path=/trunk/; revision=63405
This commit is contained in:
parent
16a52a9e08
commit
bbbef82de9
3 changed files with 11 additions and 11 deletions
|
@ -1100,11 +1100,11 @@ MI_WS_OWNER(IN PEPROCESS Process)
|
|||
/* 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) ||
|
||||
|
|
|
@ -1291,10 +1291,10 @@ MiGetPageProtection(IN PMMPTE PointerPte)
|
|||
}
|
||||
|
||||
/* 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];
|
||||
}
|
||||
|
||||
|
|
|
@ -988,6 +988,7 @@ MmCreateMemoryArea(PMMSUPPORT AddressSpace,
|
|||
{
|
||||
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 @@ MmCreateMemoryArea(PMMSUPPORT AddressSpace,
|
|||
|
||||
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 @@ MmCreateMemoryArea(PMMSUPPORT AddressSpace,
|
|||
}
|
||||
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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue