- Removed the process member from the memory area structure. - Add the copyright notice and all programmers. Modified: trunk/reactos/ntoskrnl/include/internal/mm.h Modified: trunk/reactos/ntoskrnl/mm/anonmem.c Modified: trunk/reactos/ntoskrnl/mm/marea.c Modified: trunk/reactos/ntoskrnl/mm/section.c _____
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h --- trunk/reactos/ntoskrnl/include/internal/mm.h 2005-06-07 16:54:15 UTC (rev 15831) +++ trunk/reactos/ntoskrnl/include/internal/mm.h 2005-06-07 17:07:34 UTC (rev 15832) @@ -1,5 +1,40 @@
-/* - * Higher level memory managment definitions +/* $Id$ + * + * Copyright (C) 1998-2005 ReactOS Team (and the authors from the programmers section) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/include/internal/mm.h + * PURPOSE: level memory managment definitions + * + * PROGRAMMERS: David Welch + * Casper Hornstrup + * Hartmut Birr + * Ge van Geldorp + * Eric Kohl + * silverblade + * James Tabor + * Alex Ionescu + * tamlin + * Thomas Weidenmueller + * Filip Navara + * KJK::Hyperion + * Gregor Anich + * Steven Edwards */
#ifndef __INCLUDE_INTERNAL_MM_H @@ -218,7 +253,6 @@ ULONG Type; ULONG Attributes; ULONG LockCount; - struct _EPROCESS* Process; /* FIXME: We don't need this! */ BOOLEAN DeleteInProgress; ULONG PageOpCount; union _____
Modified: trunk/reactos/ntoskrnl/mm/anonmem.c --- trunk/reactos/ntoskrnl/mm/anonmem.c 2005-06-07 16:54:15 UTC (rev 15831) +++ trunk/reactos/ntoskrnl/mm/anonmem.c 2005-06-07 17:07:34 UTC (rev 15832) @@ -1,11 +1,42 @@
/* $Id$ * - * COPYRIGHT: See COPYING in the top level directory + * Copyright (C) 2002-2005 ReactOS Team (and the authors from the programmers section) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/anonmem.c * PURPOSE: Implementing anonymous memory. * * PROGRAMMERS: David Welch + * Hartmut Birr + * Casper Hornstrup + * KJK::Hyperion + * Ge van Geldorp + * Eric Kohl + * Royce Mitchell III + * Aleksey Bragin + * Jason Filby + * Art Yerkes + * Gunnar Andre' Dalsnes + * Filip Navara + * Thomas Weidenmueller + * Alex Ionescu + * Trevor McCort + * Steven Edwards */
/* INCLUDE *****************************************************************/ @@ -42,7 +73,7 @@ /* * Get that the page actually is dirty. */ - if (!MmIsDirtyPage(MemoryArea->Process, Address)) + if (!MmIsDirtyPage(AddressSpace->Process, Address)) { PageOp->Status = STATUS_SUCCESS; KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE); @@ -53,7 +84,7 @@ /* * Speculatively set the mapping to clean. */ - MmSetCleanPage(MemoryArea->Process, Address); + MmSetCleanPage(AddressSpace->Process, Address);
/* * If necessary, allocate an entry in the paging file for this page @@ -64,7 +95,7 @@ SwapEntry = MmAllocSwapPage(); if (SwapEntry == 0) { - MmSetDirtyPage(MemoryArea->Process, Address); + MmSetDirtyPage(AddressSpace->Process, Address); PageOp->Status = STATUS_PAGEFILE_QUOTA_EXCEEDED; KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE); MmReleasePageOp(PageOp); @@ -80,7 +111,7 @@ { DPRINT1("MM: Failed to write to swap page (Status was 0x%.8X)\n", Status); - MmSetDirtyPage(MemoryArea->Process, Address); + MmSetDirtyPage(AddressSpace->Process, Address); PageOp->Status = STATUS_UNSUCCESSFUL; KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE); MmReleasePageOp(PageOp); @@ -125,7 +156,7 @@ /* * Disable the virtual mapping. */ - MmDisableVirtualMapping(MemoryArea->Process, Address, + MmDisableVirtualMapping(AddressSpace->Process, Address, &WasDirty, &Page);
if (Page == 0) @@ -138,11 +169,11 @@ */ if (!WasDirty) { - MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE, NULL, NULL); + MmDeleteVirtualMapping(AddressSpace->Process, Address, FALSE, NULL, NULL); MmDeleteAllRmaps(Page, NULL, NULL); if ((SwapEntry = MmGetSavedSwapEntryPage(Page)) != 0) { - MmCreatePageFileMapping(MemoryArea->Process, Address, SwapEntry); + MmCreatePageFileMapping(AddressSpace->Process, Address, SwapEntry); MmSetSavedSwapEntryPage(Page, 0); } MmReleasePageMemoryConsumer(MC_USER, Page); @@ -162,7 +193,7 @@ if (SwapEntry == 0) { MmShowOutOfSpaceMessagePagingFile(); - MmEnableVirtualMapping(MemoryArea->Process, Address); + MmEnableVirtualMapping(AddressSpace->Process, Address); PageOp->Status = STATUS_UNSUCCESSFUL; KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE); MmReleasePageOp(PageOp); @@ -178,7 +209,7 @@ { DPRINT1("MM: Failed to write to swap page (Status was 0x%.8X)\n", Status); - MmEnableVirtualMapping(MemoryArea->Process, Address); + MmEnableVirtualMapping(AddressSpace->Process, Address); PageOp->Status = STATUS_UNSUCCESSFUL; KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE); MmReleasePageOp(PageOp); @@ -189,8 +220,8 @@ * Otherwise we have succeeded, free the page */ DPRINT("MM: Swapped out virtual memory page 0x%.8X!\n", Page << PAGE_SHIFT); - MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE, NULL, NULL); - MmCreatePageFileMapping(MemoryArea->Process, Address, SwapEntry); + MmDeleteVirtualMapping(AddressSpace->Process, Address, FALSE, NULL, NULL); + MmCreatePageFileMapping(AddressSpace->Process, Address, SwapEntry); MmDeleteAllRmaps(Page, NULL, NULL); MmSetSavedSwapEntryPage(Page, 0); MmReleasePageMemoryConsumer(MC_USER, Page); @@ -256,7 +287,7 @@ /* * Get or create a page operation */ - PageOp = MmGetPageOp(MemoryArea, MemoryArea->Process->UniqueProcessId, + PageOp = MmGetPageOp(MemoryArea, AddressSpace->Process->UniqueProcessId, (PVOID)PAGE_ROUND_DOWN(Address), NULL, 0, MM_PAGEOP_PAGEIN, FALSE); if (PageOp == NULL) @@ -344,7 +375,7 @@ { SWAPENTRY SwapEntry;
- MmDeletePageFileMapping(MemoryArea->Process, Address, &SwapEntry); + MmDeletePageFileMapping(AddressSpace->Process, Address, &SwapEntry); Status = MmReadFromSwapPage(SwapEntry, Page); if (!NT_SUCCESS(Status)) { @@ -357,7 +388,7 @@ * Set the page. If we fail because we are out of memory then * try again */ - Status = MmCreateVirtualMapping(MemoryArea->Process, + Status = MmCreateVirtualMapping(AddressSpace->Process, (PVOID)PAGE_ROUND_DOWN(Address), Region->Protect, &Page, @@ -365,7 +396,7 @@ while (Status == STATUS_NO_MEMORY) { MmUnlockAddressSpace(AddressSpace); - Status = MmCreateVirtualMapping(MemoryArea->Process, + Status = MmCreateVirtualMapping(AddressSpace->Process, Address, Region->Protect, &Page, @@ -382,7 +413,7 @@ /* * Add the page to the process's working set */ - MmInsertRmap(Page, MemoryArea->Process, (PVOID)PAGE_ROUND_DOWN(Address)); + MmInsertRmap(Page, AddressSpace->Process, (PVOID)PAGE_ROUND_DOWN(Address));
/* * Finish the operation _____
Modified: trunk/reactos/ntoskrnl/mm/marea.c --- trunk/reactos/ntoskrnl/mm/marea.c 2005-06-07 16:54:15 UTC (rev 15831) +++ trunk/reactos/ntoskrnl/mm/marea.c 2005-06-07 17:07:34 UTC (rev 15832) @@ -1,11 +1,44 @@
/* $Id$ * - * COPYRIGHT: See COPYING in the top level directory + * Copyright (C) 1998-2005 ReactOS Team (and the authors from the programmers section) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/marea.c * PURPOSE: Implements memory areas * - * PROGRAMMERS: David Welch (welch@mcmail.com) + * PROGRAMMERS: Rex Jolliff + * David Welch + * Eric Kohl + * Philip Susi + * Casper Hornstrup + * Hartmut Birr + * Eric Kohl + * Ge van Geldorp + * Royce Mitchell III + * Aleksey Bragin + * Jason Filby + * Thomas Weidenmueller + * Gunnar Andre' Dalsnes + * tamlin + * Alex Ionescu + * Filip Navara + * Herve Poussineau + * Steven Edwards */
/* INCLUDES *****************************************************************/ @@ -974,7 +1007,6 @@ MemoryArea->EndingAddress = (PVOID)((ULONG_PTR)*BaseAddress + tmpLength); MemoryArea->Attributes = Attributes; MemoryArea->LockCount = 0; - MemoryArea->Process = Process; MemoryArea->PageOpCount = 0; MemoryArea->DeleteInProgress = FALSE;
_____
Modified: trunk/reactos/ntoskrnl/mm/section.c --- trunk/reactos/ntoskrnl/mm/section.c 2005-06-07 16:54:15 UTC (rev 15831) +++ trunk/reactos/ntoskrnl/mm/section.c 2005-06-07 17:07:34 UTC (rev 15832) @@ -1,11 +1,47 @@
/* $Id$ * - * COPYRIGHT: See COPYING in the top level directory + * Copyright (C) 1998-2005 ReactOS Team (and the authors from the programmers section) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/section.c * PURPOSE: Implements section objects * - * PROGRAMMERS: David Welch (welch@mcmail.com) + * PROGRAMMERS: Rex Jolliff + * David Welch + * Eric Kohl + * Emanuele Aliberti + * Eugene Ingerman + * Hartmut Birr + * Casper Hornstrup + * KJK::Hyperion + * Guido de Jong + * Ge van Geldorp + * Royce Mitchell III + * Filip Navara + * Aleksey Bragin + * Jason Filby + * Thomas Weidenmueller + * Gunnar Andre' Dalsnes + * tamlin + * Alex Ionescu + * Gregor Anich + * Steven Edwards + * Herve Poussineau */
/* INCLUDES *****************************************************************/ @@ -727,7 +763,7 @@ /* FIXME: Should we call MmCreateVirtualMappingUnsafe if * (Section->AllocationAttributes & SEC_PHYSICALMEMORY) is true? */ - Status = MmCreateVirtualMapping(MemoryArea->Process, + Status = MmCreateVirtualMapping(AddressSpace->Process, Address, Attributes, &Page, @@ -737,7 +773,7 @@ DbgPrint("Unable to create virtual mapping\n"); KEBUGCHECK(0); } - MmInsertRmap(Page, MemoryArea->Process, (PVOID)PAddress); + MmInsertRmap(Page, AddressSpace->Process, (PVOID)PAddress); } if (Locked) { @@ -1540,14 +1576,14 @@ */ if (Context.Private) { - Status = MmCreateVirtualMapping(MemoryArea->Process, + Status = MmCreateVirtualMapping(AddressSpace->Process, Address, MemoryArea->Attributes, &Page, 1); - MmSetDirtyPage(MemoryArea->Process, Address); + MmSetDirtyPage(AddressSpace->Process, Address); MmInsertRmap(Page, - MemoryArea->Process, + AddressSpace->Process, Address); } else @@ -1557,14 +1593,14 @@ * set it back into the section segment entry so we don't loose * our copy. Otherwise it will be handled by the cache manager. */ - Status = MmCreateVirtualMapping(MemoryArea->Process, + Status = MmCreateVirtualMapping(AddressSpace->Process, Address, MemoryArea->Attributes, &Page, 1); - MmSetDirtyPage(MemoryArea->Process, Address); + MmSetDirtyPage(AddressSpace->Process, Address); MmInsertRmap(Page, - MemoryArea->Process, + AddressSpace->Process, Address); Entry = MAKE_SSE(Page << PAGE_SHIFT, 1); MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry); @@ -1589,26 +1625,26 @@ */ if (Context.Private) { - Status = MmCreateVirtualMapping(MemoryArea->Process, + Status = MmCreateVirtualMapping(AddressSpace->Process, Address, MemoryArea->Attributes, &Page, 1); - MmSetDirtyPage(MemoryArea->Process, Address); + MmSetDirtyPage(AddressSpace->Process, Address); MmInsertRmap(Page, - MemoryArea->Process, + AddressSpace->Process, Address); } else { - Status = MmCreateVirtualMapping(MemoryArea->Process, + Status = MmCreateVirtualMapping(AddressSpace->Process, Address, MemoryArea->Attributes, &Page, 1); - MmSetDirtyPage(MemoryArea->Process, Address); + MmSetDirtyPage(AddressSpace->Process, Address); MmInsertRmap(Page, - MemoryArea->Process, + AddressSpace->Process, Address); Entry = MAKE_SSE(Page << PAGE_SHIFT, 1); MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry); @@ -1635,7 +1671,7 @@
if (Context.Private) { - Status = MmCreatePageFileMapping(MemoryArea->Process, + Status = MmCreatePageFileMapping(AddressSpace->Process, Address, SwapEntry); if (!NT_SUCCESS(Status)) @@ -3641,7 +3677,6 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, PFN_TYPE Page, SWAPENTRY SwapEntry, BOOLEAN Dirty) { - PMEMORY_AREA MArea; ULONG Entry; PFILE_OBJECT FileObject; PBCB Bcb; @@ -3651,23 +3686,24 @@ NTSTATUS Status; PSECTION_OBJECT Section; PMM_SECTION_SEGMENT Segment; + PMADDRESS_SPACE AddressSpace;
- MArea = (PMEMORY_AREA)Context; + AddressSpace = (PMADDRESS_SPACE)Context;
Address = (PVOID)PAGE_ROUND_DOWN(Address);
- Offset = ((ULONG_PTR)Address - (ULONG_PTR)MArea->StartingAddress) + + Offset = ((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress) + MemoryArea->Data.SectionData.ViewOffset;
- Section = MArea->Data.SectionData.Section; - Segment = MArea->Data.SectionData.Segment; + Section = MemoryArea->Data.SectionData.Section; + Segment = MemoryArea->Data.SectionData.Segment;
- PageOp = MmCheckForPageOp(MArea, NULL, NULL, Segment, Offset); + PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL, Segment, Offset);
while (PageOp) { MmUnlockSectionSegment(Segment); - MmUnlockAddressSpace(&MArea->Process->AddressSpace); + MmUnlockAddressSpace(AddressSpace);
Status = MmspWaitForPageOpCompletionEvent(PageOp); if (Status != STATUS_SUCCESS) @@ -3676,10 +3712,10 @@ KEBUGCHECK(0); }
- MmLockAddressSpace(&MArea->Process->AddressSpace); + MmLockAddressSpace(AddressSpace); MmLockSectionSegment(Segment); MmspCompleteAndReleasePageOp(PageOp); - PageOp = MmCheckForPageOp(MArea, NULL, NULL, Segment, Offset); + PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL, Segment, Offset); }
Entry = MmGetPageEntrySectionSegment(Segment, Offset); @@ -3733,12 +3769,12 @@ MmFreeSwapPage(SavedSwapEntry); MmSetSavedSwapEntryPage(Page, 0); } - MmDeleteRmap(Page, MArea->Process, Address); + MmDeleteRmap(Page, AddressSpace->Process, Address); MmReleasePageMemoryConsumer(MC_USER, Page); } else { - MmDeleteRmap(Page, MArea->Process, Address); + MmDeleteRmap(Page, AddressSpace->Process, Address); MmUnsharePageEntrySectionSegment(Section, Segment, Offset, Dirty, FALSE); } } @@ -3789,7 +3825,7 @@ Status = MmFreeMemoryArea(AddressSpace, MemoryArea, MmFreeSectionPage, - MemoryArea); + AddressSpace); } MmUnlockSectionSegment(Segment); ObDereferenceObject(Section);