mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* ntoskrnl/ke/i386/exp.c (KiDoubleFaultHandler): Print CR3 correctly. 2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk> * ntoskrnl/include/internal/ps.h: Added KTHREAD_STACK_LIMIT definition. * ntoskrnl/ke/i386/tskswitch.S (Ki386ContextSwitch): Force all the pages of the kernel stack to be accessible from this process. 2002-06-04 David Welch <welch@cwcom.net> * ntoskrnl/cc/view.c (ReadCacheSegmentChain): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/cc/copy.c (CcRosCreateCacheSegment): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/cc/copy.c (CcFreeCachePage): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/include/internal/mm.h: Changed prototypes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/include/internal/ps.h (KPROCESS): Changed type of page directory base to PHYSICAL_ADDRESS. * ntoskrnl/include/internal/i386/mm.h: Changed prototypes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/ke/kthread.c (KeFreeStackPage): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/ke/kthread.c (KeInitializeThread): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/ke/process.c (KeAttachProcess, KeDetachProcess): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/ke/kernel.c (PcrPages, KeApplicationProcessorInit): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/balance.c (MM_ALLOCATION_REQUEST): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/balance.c (MmReleasePageMemoryConsumer): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/balance.c (MmRequestPageMemoryConsumer): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/cont.c (MmFreeContinuousPage): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/cont.c (MmAllocateContinuousAlignedMemory): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/freelist.c (MmTransferOwnershipPage, MmGetLRUFirstUserPage, MmGetLRUNextUserPage, MmGetContinuousPages, MmInitializePageList, MmSetFlagsPage, MmSetRmapListHeadPage, MmGetRmapListHeadPage, MmMarkPageMapped, MmMarkPageUnmapped, MmGetFlagsPage, MmSetSavedSwapEntryPage, MmGetSavedSwapEntryPage, MmReferencePage, MmGetReferenceCountPage, MmIsUsablePage, MmDereferencePage, MmGetLockCountPage, MmLockPage, MmUnlockPage, MmAllocPage): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/iospace.c (MmMapIoSpace): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/kmap.c (ExAllocatePage, MiZeroPage, MiCopyFromUserPage, ExAllocatePageWithPhysPage): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/marea.c (MmFreeMemoryArea): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/mdl.c (MmUnlockPages, MmMapLockedPages, MmProbeAndLockPages): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/mm.c (MmSharedDataPagePhysicalAddress, MmCommitPagedPoolAddress, MmNotPresentFault): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/mminit.c (MmInitVirtualMemory): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/ncache.c (MmAllocateNonCachedMemory, MmFreeNonCachedPage): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/npool.c (grow_kernel_pool): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/rmap.c (MmPageOutPhysicalAddress, MmInsertRmap, MmDeleteAllRmaps, MmDeleteRmap): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/section.c (MiReadPage, MmNotPresentFaultSectionView, MmAccessFaultSectionView, MmPageOutDeleteMapping, MmPageOutSectionView, MmFreeSectionPage): Changes to use PHYSICAL_ADDRESS type for physical addresses. * ntoskrnl/mm/slab.c (ExGrowSlabCache): Changes to use PHYSICAL_ADDRESS type for physical address. * ntoskrnl/mm/virtual.c (MmPageOutVirtualMemory, MmNotPresentFaultVirtualMemory, MmFreeVirtualMemoryPage): Changes to use PHYSICAL_ADDRESS type for physical address. * ntoskrnl/mm/wset.c (MmTrimUserMemory): Changes to use PHYSICAL_ADDRESS type for physical address. * ntoskrnl/mm/page.c (Mmi386ReleaseMmInfo, MmCopyMmInfo, MmGetPhysicalAddressForProcess, MmCreateVirtualMapping, MmCreateVirtualMappingUnsafe, MmCreateVirtualMappingForProcess, MmDeleteVirtualMapping): Changes to use PHYSICAL_ADDRESS type for physical address. * ntoskrnl/ps/process (PsInitProcessManagment): Changes to use PHYSICAL_ADDRESS type for physical address. * ntoskrnl/ps/thread.c (PsAllocateCallbackStack): Changes to use PHYSICAL_ADDRESS type for physical address. 2002-06-04 David Welch <welch@cwcom.net> * Lots of change since the ChangeLog was last updated. svn path=/trunk/; revision=3000
This commit is contained in:
parent
a7a6f4a353
commit
3d3be3df27
31 changed files with 603 additions and 457 deletions
|
@ -1,4 +1,104 @@
|
|||
2001-03-18 David Welch <welch@cwcom>
|
||||
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* ntoskrnl/ke/i386/exp.c (KiDoubleFaultHandler): Print CR3
|
||||
correctly.
|
||||
|
||||
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* ntoskrnl/include/internal/ps.h: Added KTHREAD_STACK_LIMIT definition.
|
||||
* ntoskrnl/ke/i386/tskswitch.S (Ki386ContextSwitch): Force all the
|
||||
pages of the kernel stack to be accessible from this process.
|
||||
|
||||
2002-06-04 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/cc/view.c (ReadCacheSegmentChain): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/cc/copy.c (CcRosCreateCacheSegment): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/cc/copy.c (CcFreeCachePage): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/include/internal/mm.h: Changed prototypes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/include/internal/ps.h (KPROCESS): Changed type of
|
||||
page directory base to PHYSICAL_ADDRESS.
|
||||
* ntoskrnl/include/internal/i386/mm.h: Changed prototypes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/ke/kthread.c (KeFreeStackPage): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/ke/kthread.c (KeInitializeThread): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/ke/process.c (KeAttachProcess, KeDetachProcess): Changes
|
||||
to use PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/ke/kernel.c (PcrPages, KeApplicationProcessorInit): Changes
|
||||
to use PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/balance.c (MM_ALLOCATION_REQUEST): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/balance.c (MmReleasePageMemoryConsumer): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/balance.c (MmRequestPageMemoryConsumer): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/cont.c (MmFreeContinuousPage): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/cont.c (MmAllocateContinuousAlignedMemory): Changes to
|
||||
use PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/freelist.c (MmTransferOwnershipPage,
|
||||
MmGetLRUFirstUserPage, MmGetLRUNextUserPage, MmGetContinuousPages,
|
||||
MmInitializePageList, MmSetFlagsPage, MmSetRmapListHeadPage,
|
||||
MmGetRmapListHeadPage, MmMarkPageMapped, MmMarkPageUnmapped,
|
||||
MmGetFlagsPage, MmSetSavedSwapEntryPage, MmGetSavedSwapEntryPage,
|
||||
MmReferencePage, MmGetReferenceCountPage, MmIsUsablePage,
|
||||
MmDereferencePage, MmGetLockCountPage, MmLockPage, MmUnlockPage,
|
||||
MmAllocPage): Changes to use PHYSICAL_ADDRESS type for physical
|
||||
addresses.
|
||||
* ntoskrnl/mm/iospace.c (MmMapIoSpace): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/kmap.c (ExAllocatePage, MiZeroPage, MiCopyFromUserPage,
|
||||
ExAllocatePageWithPhysPage): Changes to use PHYSICAL_ADDRESS type for
|
||||
physical addresses.
|
||||
* ntoskrnl/mm/marea.c (MmFreeMemoryArea): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/mdl.c (MmUnlockPages, MmMapLockedPages,
|
||||
MmProbeAndLockPages): Changes to use PHYSICAL_ADDRESS type for
|
||||
physical addresses.
|
||||
* ntoskrnl/mm/mm.c (MmSharedDataPagePhysicalAddress,
|
||||
MmCommitPagedPoolAddress, MmNotPresentFault): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/mminit.c (MmInitVirtualMemory): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/ncache.c (MmAllocateNonCachedMemory,
|
||||
MmFreeNonCachedPage): Changes to use PHYSICAL_ADDRESS type for
|
||||
physical addresses.
|
||||
* ntoskrnl/mm/npool.c (grow_kernel_pool): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/rmap.c (MmPageOutPhysicalAddress, MmInsertRmap,
|
||||
MmDeleteAllRmaps, MmDeleteRmap): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/section.c (MiReadPage, MmNotPresentFaultSectionView,
|
||||
MmAccessFaultSectionView, MmPageOutDeleteMapping,
|
||||
MmPageOutSectionView, MmFreeSectionPage): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/slab.c (ExGrowSlabCache): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical address.
|
||||
* ntoskrnl/mm/virtual.c (MmPageOutVirtualMemory,
|
||||
MmNotPresentFaultVirtualMemory, MmFreeVirtualMemoryPage): Changes to
|
||||
use PHYSICAL_ADDRESS type for physical address.
|
||||
* ntoskrnl/mm/wset.c (MmTrimUserMemory): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical address.
|
||||
* ntoskrnl/mm/page.c (Mmi386ReleaseMmInfo, MmCopyMmInfo,
|
||||
MmGetPhysicalAddressForProcess, MmCreateVirtualMapping,
|
||||
MmCreateVirtualMappingUnsafe, MmCreateVirtualMappingForProcess,
|
||||
MmDeleteVirtualMapping): Changes to use PHYSICAL_ADDRESS type for
|
||||
physical address.
|
||||
* ntoskrnl/ps/process (PsInitProcessManagment): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical address.
|
||||
* ntoskrnl/ps/thread.c (PsAllocateCallbackStack): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical address.
|
||||
|
||||
2002-06-04 David Welch <welch@cwcom.net>
|
||||
|
||||
* Lots of change since the ChangeLog was last updated.
|
||||
|
||||
2001-03-18 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/ke/apc.c (KiDeliverApc): Bug fix.
|
||||
* ntoskrnl/ke/apc.c (KeInsertQueueApc): More comments.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: copy.c,v 1.4 2002/01/26 21:21:02 dwelch Exp $
|
||||
/* $Id: copy.c,v 1.5 2002/06/04 15:26:55 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -97,10 +97,10 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
|
|||
for (i = 0; i < (Bcb->CacheSegmentSize / PAGESIZE); i++)
|
||||
{
|
||||
PVOID address;
|
||||
ULONG page;
|
||||
PHYSICAL_ADDRESS page;
|
||||
address = current2->BaseAddress + (i * PAGESIZE);
|
||||
page = MmGetPhysicalAddressForProcess(NULL, address);
|
||||
((PULONG)(Mdl + 1))[offset] = page;
|
||||
((PULONG)(Mdl + 1))[offset] = page.u.LowPart;
|
||||
offset++;
|
||||
}
|
||||
current2 = current2->NextInChain;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: view.c,v 1.41 2002/05/19 14:09:35 dwelch Exp $
|
||||
/* $Id: view.c,v 1.42 2002/06/04 15:26:55 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -292,7 +292,7 @@ CcRosCreateCacheSegment(PBCB Bcb,
|
|||
ExReleaseFastMutex(&ViewLock);
|
||||
for (i = 0; i < (Bcb->CacheSegmentSize / PAGESIZE); i++)
|
||||
{
|
||||
PVOID Page;
|
||||
PHYSICAL_ADDRESS Page;
|
||||
|
||||
Status = MmRequestPageMemoryConsumer(MC_CACHE, TRUE, &Page);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -303,7 +303,7 @@ CcRosCreateCacheSegment(PBCB Bcb,
|
|||
Status = MmCreateVirtualMapping(NULL,
|
||||
current->BaseAddress + (i * PAGESIZE),
|
||||
PAGE_READWRITE,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -462,12 +462,12 @@ CcRosRequestCacheSegment(PBCB Bcb,
|
|||
|
||||
STATIC VOID
|
||||
CcFreeCachePage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||
ULONG PhysAddr, SWAPENTRY SwapEntry, BOOLEAN Dirty)
|
||||
PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry, BOOLEAN Dirty)
|
||||
{
|
||||
assert(SwapEntry == 0);
|
||||
if (PhysAddr != 0)
|
||||
if (PhysAddr.QuadPart != 0)
|
||||
{
|
||||
MmReleasePageMemoryConsumer(MC_CACHE, (PVOID)PhysAddr);
|
||||
MmReleasePageMemoryConsumer(MC_CACHE, PhysAddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,22 +54,4 @@ extern inline PULONG get_page_directory(void)
|
|||
#define VADDR_TO_PT_OFFSET(x) (((x/1024)%4096))
|
||||
#define VADDR_TO_PD_OFFSET(x) ((x)/(4*1024*1024))
|
||||
|
||||
NTSTATUS MmCreateVirtualMapping(struct _EPROCESS* Process,
|
||||
PVOID Address,
|
||||
ULONG flProtect,
|
||||
ULONG PhysicalAddress,
|
||||
BOOLEAN MayWait);
|
||||
NTSTATUS
|
||||
MmCreateVirtualMappingUnsafe(struct _EPROCESS* Process,
|
||||
PVOID Address,
|
||||
ULONG flProtect,
|
||||
ULONG PhysicalAddress,
|
||||
BOOLEAN MayWait);
|
||||
|
||||
VOID MmSetPageProtect(struct _EPROCESS* Process,
|
||||
PVOID Address,
|
||||
ULONG flProtect);
|
||||
BOOLEAN MmIsPagePresent(struct _EPROCESS* Process,
|
||||
PVOID Address);
|
||||
|
||||
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_MM_H */
|
||||
|
|
|
@ -180,7 +180,7 @@ NTSTATUS MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
|
|||
PVOID BaseAddress,
|
||||
ULONG Length,
|
||||
VOID (*FreePage)(PVOID Context, MEMORY_AREA* MemoryArea,
|
||||
PVOID Address, ULONG PhysAddr, SWAPENTRY SwapEntry,
|
||||
PVOID Address, PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry,
|
||||
BOOLEAN Dirty),
|
||||
PVOID FreePageContext);
|
||||
VOID MmDumpMemoryAreas(PLIST_ENTRY ListHead);
|
||||
|
@ -197,17 +197,17 @@ PMEMORY_AREA MmSplitMemoryArea(struct _EPROCESS* Process,
|
|||
ULONG Length,
|
||||
ULONG NewType,
|
||||
ULONG NewAttributes);
|
||||
PVOID MmInitializePageList(PVOID FirstPhysKernelAddress,
|
||||
PVOID LastPhysKernelAddress,
|
||||
ULONG MemorySizeInPages,
|
||||
ULONG LastKernelBase,
|
||||
PADDRESS_RANGE BIOSMemoryMap,
|
||||
ULONG AddressRangeCount);
|
||||
|
||||
PVOID
|
||||
MmInitializePageList(PVOID FirstPhysKernelAddress,
|
||||
PVOID LastPhysKernelAddress,
|
||||
ULONG MemorySizeInPages,
|
||||
ULONG LastKernelBase,
|
||||
PADDRESS_RANGE BIOSMemoryMap,
|
||||
ULONG AddressRangeCount);
|
||||
PHYSICAL_ADDRESS
|
||||
MmAllocPage(ULONG Consumer, SWAPENTRY SavedSwapEntry);
|
||||
VOID MmDereferencePage(PVOID PhysicalAddress);
|
||||
VOID MmReferencePage(PVOID PhysicalAddress);
|
||||
VOID MmDereferencePage(PHYSICAL_ADDRESS PhysicalAddress);
|
||||
VOID MmReferencePage(PHYSICAL_ADDRESS PhysicalAddress);
|
||||
VOID MmDeletePageTable(struct _EPROCESS* Process,
|
||||
PVOID Address);
|
||||
NTSTATUS MmCopyMmInfo(struct _EPROCESS* Src,
|
||||
|
@ -219,7 +219,7 @@ MmDeleteVirtualMapping(struct _EPROCESS* Process,
|
|||
PVOID Address,
|
||||
BOOL FreePage,
|
||||
BOOL* WasDirty,
|
||||
ULONG* PhysicalPage);
|
||||
PHYSICAL_ADDRESS* PhysicalPage);
|
||||
|
||||
#define MM_PAGE_CLEAN (0)
|
||||
#define MM_PAGE_DIRTY (1)
|
||||
|
@ -227,8 +227,9 @@ MmDeleteVirtualMapping(struct _EPROCESS* Process,
|
|||
VOID MmBuildMdlFromPages(PMDL Mdl, PULONG Pages);
|
||||
PVOID MmGetMdlPageAddress(PMDL Mdl, PVOID Offset);
|
||||
VOID MiShutdownMemoryManager(VOID);
|
||||
ULONG MmGetPhysicalAddressForProcess(struct _EPROCESS* Process,
|
||||
PVOID Address);
|
||||
PHYSICAL_ADDRESS
|
||||
MmGetPhysicalAddressForProcess(struct _EPROCESS* Process,
|
||||
PVOID Address);
|
||||
NTSTATUS STDCALL
|
||||
MmUnmapViewOfSection(struct _EPROCESS* Process, PVOID BaseAddress);
|
||||
VOID MmInitPagingFile(VOID);
|
||||
|
@ -342,21 +343,21 @@ MmWriteToSwapPage(SWAPENTRY SwapEntry, PMDL Mdl);
|
|||
NTSTATUS
|
||||
MmReadFromSwapPage(SWAPENTRY SwapEntry, PMDL Mdl);
|
||||
VOID
|
||||
MmSetFlagsPage(PVOID PhysicalAddress, ULONG Flags);
|
||||
MmSetFlagsPage(PHYSICAL_ADDRESS PhysicalAddress, ULONG Flags);
|
||||
ULONG
|
||||
MmGetFlagsPage(PVOID PhysicalAddress);
|
||||
VOID MmSetSavedSwapEntryPage(PVOID PhysicalAddress,
|
||||
MmGetFlagsPage(PHYSICAL_ADDRESS PhysicalAddress);
|
||||
VOID MmSetSavedSwapEntryPage(PHYSICAL_ADDRESS PhysicalAddress,
|
||||
SWAPENTRY SavedSwapEntry);
|
||||
SWAPENTRY MmGetSavedSwapEntryPage(PVOID PhysicalAddress);
|
||||
SWAPENTRY MmGetSavedSwapEntryPage(PHYSICAL_ADDRESS PhysicalAddress);
|
||||
VOID MmSetCleanPage(struct _EPROCESS* Process, PVOID Address);
|
||||
VOID MmLockPage(PVOID PhysicalPage);
|
||||
VOID MmUnlockPage(PVOID PhysicalPage);
|
||||
VOID MmLockPage(PHYSICAL_ADDRESS PhysicalPage);
|
||||
VOID MmUnlockPage(PHYSICAL_ADDRESS PhysicalPage);
|
||||
|
||||
NTSTATUS MmSafeCopyFromUser(PVOID Dest, PVOID Src, ULONG Count);
|
||||
NTSTATUS MmSafeCopyToUser(PVOID Dest, PVOID Src, ULONG Count);
|
||||
NTSTATUS
|
||||
MmCreatePhysicalMemorySection(VOID);
|
||||
PVOID
|
||||
PHYSICAL_ADDRESS
|
||||
MmGetContinuousPages(ULONG NumberOfBytes,
|
||||
PHYSICAL_ADDRESS HighestAcceptableAddress,
|
||||
ULONG Alignment);
|
||||
|
@ -371,11 +372,11 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
ULONG
|
||||
MmGetPageProtect(struct _EPROCESS* Process, PVOID Address);
|
||||
PVOID
|
||||
ExAllocatePageWithPhysPage(ULONG PhysPage);
|
||||
ExAllocatePageWithPhysPage(PHYSICAL_ADDRESS PhysPage);
|
||||
ULONG
|
||||
MmGetReferenceCountPage(PVOID PhysicalAddress);
|
||||
MmGetReferenceCountPage(PHYSICAL_ADDRESS PhysicalAddress);
|
||||
BOOLEAN
|
||||
MmIsUsablePage(PVOID PhysicalAddress);
|
||||
MmIsUsablePage(PHYSICAL_ADDRESS PhysicalAddress);
|
||||
|
||||
#define MM_PAGEOP_PAGEIN (1)
|
||||
#define MM_PAGEOP_PAGEOUT (2)
|
||||
|
@ -425,9 +426,9 @@ MiDebugDumpNonPagedPool(BOOLEAN NewOnly);
|
|||
VOID
|
||||
MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly);
|
||||
VOID
|
||||
MmMarkPageMapped(PVOID PhysicalAddress);
|
||||
MmMarkPageMapped(PHYSICAL_ADDRESS PhysicalAddress);
|
||||
VOID
|
||||
MmMarkPageUnmapped(PVOID PhysicalAddress);
|
||||
MmMarkPageUnmapped(PHYSICAL_ADDRESS PhysicalAddress);
|
||||
VOID
|
||||
MmFreeSectionSegments(PFILE_OBJECT FileObject);
|
||||
|
||||
|
@ -440,21 +441,36 @@ typedef struct _MM_IMAGE_SECTION_OBJECT
|
|||
VOID
|
||||
MmFreeVirtualMemory(struct _EPROCESS* Process, PMEMORY_AREA MemoryArea);
|
||||
NTSTATUS
|
||||
MiCopyFromUserPage(ULONG DestPhysPage, PVOID SourceAddress);
|
||||
MiCopyFromUserPage(PHYSICAL_ADDRESS DestPhysPage, PVOID SourceAddress);
|
||||
NTSTATUS
|
||||
MiZeroPage(ULONG PhysPage);
|
||||
MiZeroPage(PHYSICAL_ADDRESS PhysPage);
|
||||
BOOLEAN
|
||||
MmIsAccessedAndResetAccessPage(struct _EPROCESS* Process, PVOID Address);
|
||||
SWAPENTRY
|
||||
MmGetSavedSwapEntryPage(PVOID PhysicalAddress);
|
||||
|
||||
#define STATUS_MM_RESTART_OPERATION (0xD0000001)
|
||||
|
||||
NTSTATUS
|
||||
MmCreateVirtualMappingForKernel(PVOID Address,
|
||||
ULONG flProtect,
|
||||
ULONG PhysicalAddress);
|
||||
PHYSICAL_ADDRESS PhysicalAddress);
|
||||
NTSTATUS MmCommitPagedPoolAddress(PVOID Address);
|
||||
NTSTATUS MmCreateVirtualMapping(struct _EPROCESS* Process,
|
||||
PVOID Address,
|
||||
ULONG flProtect,
|
||||
PHYSICAL_ADDRESS PhysicalAddress,
|
||||
BOOLEAN MayWait);
|
||||
NTSTATUS
|
||||
MmCreateVirtualMappingUnsafe(struct _EPROCESS* Process,
|
||||
PVOID Address,
|
||||
ULONG flProtect,
|
||||
PHYSICAL_ADDRESS PhysicalAddress,
|
||||
BOOLEAN MayWait);
|
||||
|
||||
VOID MmSetPageProtect(struct _EPROCESS* Process,
|
||||
PVOID Address,
|
||||
ULONG flProtect);
|
||||
BOOLEAN MmIsPagePresent(struct _EPROCESS* Process,
|
||||
PVOID Address);
|
||||
|
||||
/* Memory balancing. */
|
||||
VOID
|
||||
|
@ -464,9 +480,10 @@ MmInitializeMemoryConsumer(ULONG Consumer,
|
|||
VOID
|
||||
MmInitializeBalancer(ULONG NrAvailablePages);
|
||||
NTSTATUS
|
||||
MmReleasePageMemoryConsumer(ULONG Consumer, PVOID Page);
|
||||
MmReleasePageMemoryConsumer(ULONG Consumer, PHYSICAL_ADDRESS Page);
|
||||
NTSTATUS
|
||||
MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait, PVOID* AllocatedPage);
|
||||
MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
||||
PHYSICAL_ADDRESS* AllocatedPage);
|
||||
|
||||
#define MC_CACHE (0)
|
||||
#define MC_USER (1)
|
||||
|
@ -475,24 +492,27 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait, PVOID* AllocatedPag
|
|||
#define MC_MAXIMUM (4)
|
||||
|
||||
VOID
|
||||
MmSetRmapListHeadPage(PVOID PhysicalAddress, struct _MM_RMAP_ENTRY* ListHead);
|
||||
MmSetRmapListHeadPage(PHYSICAL_ADDRESS PhysicalAddress,
|
||||
struct _MM_RMAP_ENTRY* ListHead);
|
||||
struct _MM_RMAP_ENTRY*
|
||||
MmGetRmapListHeadPage(PVOID PhysicalAddress);
|
||||
MmGetRmapListHeadPage(PHYSICAL_ADDRESS PhysicalAddress);
|
||||
VOID
|
||||
MmInsertRmap(PVOID PhysicalAddress, PEPROCESS Process, PVOID Address);
|
||||
MmInsertRmap(PHYSICAL_ADDRESS PhysicalAddress, PEPROCESS Process,
|
||||
PVOID Address);
|
||||
VOID
|
||||
MmDeleteAllRmaps(PVOID PhysicalAddress, PVOID Context,
|
||||
MmDeleteAllRmaps(PHYSICAL_ADDRESS PhysicalAddress, PVOID Context,
|
||||
VOID (*DeleteMapping)(PVOID Context, PEPROCESS Process, PVOID Address));
|
||||
VOID
|
||||
MmDeleteRmap(PVOID PhysicalAddress, PEPROCESS Process, PVOID Address);
|
||||
MmDeleteRmap(PHYSICAL_ADDRESS PhysicalAddress, PEPROCESS Process,
|
||||
PVOID Address);
|
||||
VOID
|
||||
MmInitializeRmapList(VOID);
|
||||
PVOID
|
||||
MmGetLRUNextUserPage(PVOID PreviousPhysicalAddress);
|
||||
PVOID
|
||||
PHYSICAL_ADDRESS
|
||||
MmGetLRUNextUserPage(PHYSICAL_ADDRESS PreviousPhysicalAddress);
|
||||
PHYSICAL_ADDRESS
|
||||
MmGetLRUFirstUserPage(VOID);
|
||||
NTSTATUS
|
||||
MmPageOutPhysicalAddress(PVOID PhysicalAddress);
|
||||
MmPageOutPhysicalAddress(PHYSICAL_ADDRESS PhysicalAddress);
|
||||
NTSTATUS
|
||||
MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages);
|
||||
|
||||
|
@ -507,9 +527,10 @@ MmCreatePageFileMapping(PEPROCESS Process,
|
|||
SWAPENTRY SwapEntry);
|
||||
BOOLEAN MmIsPageSwapEntry(PEPROCESS Process, PVOID Address);
|
||||
VOID
|
||||
MmTransferOwnershipPage(PVOID PhysicalAddress, ULONG NewConsumer);
|
||||
MmTransferOwnershipPage(PHYSICAL_ADDRESS PhysicalAddress, ULONG NewConsumer);
|
||||
VOID MmSetDirtyPage(PEPROCESS Process, PVOID Address);
|
||||
VOID
|
||||
MmInitializeMdlImplementation(VOID);
|
||||
extern PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: ps.h,v 1.33 2002/05/14 21:19:17 dwelch Exp $
|
||||
/* $Id: ps.h,v 1.34 2002/06/04 15:26:55 dwelch Exp $
|
||||
*
|
||||
* FILE: ntoskrnl/ke/kthread.c
|
||||
* PURPOSE: Process manager definitions
|
||||
|
@ -32,6 +32,7 @@
|
|||
* Defines for accessing KPCR and KTHREAD structure members
|
||||
*/
|
||||
#define KTHREAD_INITIAL_STACK 0x18
|
||||
#define KTHREAD_STACK_LIMIT 0x1C
|
||||
#define KTHREAD_TEB 0x20
|
||||
#define KTHREAD_KERNEL_STACK 0x28
|
||||
#define KTHREAD_PREVIOUS_MODE 0x137
|
||||
|
@ -303,7 +304,7 @@ typedef struct _KPROCESS
|
|||
* We use the first member of this array to hold the physical address of
|
||||
* the page directory for this process.
|
||||
*/
|
||||
PVOID DirectoryTableBase[2]; /* 018 */
|
||||
PHYSICAL_ADDRESS DirectoryTableBase; /* 018 */
|
||||
/*
|
||||
* Presumably a descriptor for the process's LDT, currently unused.
|
||||
*/
|
||||
|
|
|
@ -117,11 +117,10 @@ static NTSTATUS ExceptionToNtStatus[] =
|
|||
STATUS_ACCESS_VIOLATION
|
||||
};
|
||||
|
||||
extern unsigned int _text_start__, _text_end__;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
extern unsigned int _text_start__, _text_end__;
|
||||
|
||||
STATIC BOOLEAN
|
||||
print_address(PVOID address)
|
||||
{
|
||||
|
@ -230,6 +229,7 @@ KiDoubleFaultHandler(VOID)
|
|||
ULONG ExceptionNr = 8;
|
||||
KTSS* OldTss;
|
||||
PULONG Frame;
|
||||
ULONG OldCr3;
|
||||
#if 0
|
||||
ULONG i, j;
|
||||
static PVOID StackTrace[MM_STACK_SIZE / sizeof(PVOID)];
|
||||
|
@ -239,12 +239,22 @@ KiDoubleFaultHandler(VOID)
|
|||
BOOLEAN FoundRepeat;
|
||||
#endif
|
||||
|
||||
/* Use the address of the trap frame as approximation to the ring0 esp */
|
||||
OldTss = KeGetCurrentKPCR()->TSS;
|
||||
Esp0 = OldTss->Esp;
|
||||
|
||||
|
||||
/* Get CR2 */
|
||||
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2));
|
||||
|
||||
if (PsGetCurrentThread() != NULL &&
|
||||
PsGetCurrentThread()->ThreadsProcess != NULL)
|
||||
{
|
||||
OldCr3 =
|
||||
PsGetCurrentThread()->ThreadsProcess->Pcb.DirectoryTableBase.QuadPart;
|
||||
}
|
||||
else
|
||||
{
|
||||
OldCr3 = 0xBEADF0AL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for stack underflow
|
||||
|
@ -272,7 +282,7 @@ KiDoubleFaultHandler(VOID)
|
|||
DbgPrint("CS:EIP %x:%x ", OldTss->Cs, OldTss->Eip);
|
||||
print_address((PVOID)OldTss->Eip);
|
||||
DbgPrint("\n");
|
||||
DbgPrint("cr2 %x cr3 %x ", cr2, OldTss->Cr3);
|
||||
DbgPrint("cr2 %x cr3 %x ", cr2, OldCr3);
|
||||
DbgPrint("Proc: %x ",PsGetCurrentProcess());
|
||||
if (PsGetCurrentProcess() != NULL)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
ULONG KiPcrInitDone = 0;
|
||||
static ULONG PcrsAllocated = 0;
|
||||
static PVOID PcrPages[MAXIMUM_PROCESSORS];
|
||||
static PHYSICAL_ADDRESS PcrPages[MAXIMUM_PROCESSORS];
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
@ -64,7 +64,7 @@ KeApplicationProcessorInit(VOID)
|
|||
KPCR = (PKPCR)(KPCR_BASE + (Offset * PAGESIZE));
|
||||
MmCreateVirtualMappingForKernel((PVOID)KPCR,
|
||||
PAGE_READWRITE,
|
||||
(ULONG)PcrPages[Offset]);
|
||||
PcrPages[Offset]);
|
||||
memset(KPCR, 0, PAGESIZE);
|
||||
KPCR->ProcessorNumber = Offset;
|
||||
KPCR->Self = KPCR;
|
||||
|
|
|
@ -29,9 +29,10 @@
|
|||
#include <internal/i386/segment.h>
|
||||
#include <internal/ps.h>
|
||||
#include <ddk/i386/tss.h>
|
||||
|
||||
#include <internal/ntoskrnl.h>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
||||
.globl _Ki386ContextSwitch
|
||||
_Ki386ContextSwitch:
|
||||
/*
|
||||
|
@ -97,6 +98,7 @@ _Ki386ContextSwitch:
|
|||
movl %esp, KTHREAD_KERNEL_STACK(%ebx)
|
||||
movl 8(%ebp), %ebx
|
||||
movl KTHREAD_KERNEL_STACK(%ebx), %esp
|
||||
movl KTHREAD_STACK_LIMIT(%ebx), %edi
|
||||
|
||||
/*
|
||||
* Set the stack pointer in this processors TSS
|
||||
|
@ -110,8 +112,25 @@ _Ki386ContextSwitch:
|
|||
*/
|
||||
movl ETHREAD_THREADS_PROCESS(%ebx), %ebx
|
||||
movl KPROCESS_DIRECTORY_TABLE_BASE(%ebx), %eax
|
||||
movl %eax, %cr3
|
||||
movl %eax, %cr3
|
||||
|
||||
/*
|
||||
* Set up the PDE for the top of the new stack.
|
||||
*/
|
||||
movl $0, %ebx
|
||||
.L2: movl %edi, %esi
|
||||
shr $22, %esi
|
||||
movl 0xF03C0000(,%esi, 4), %eax
|
||||
cmpl $0, %eax
|
||||
jne .L1
|
||||
movl _MmGlobalKernelPageDirectory(,%esi, 4), %eax
|
||||
movl %eax, 0xF03C0000(,%esi, 4)
|
||||
.L1:
|
||||
addl $4096, %edi
|
||||
incl %ebx
|
||||
cmp $(MM_STACK_SIZE / 4096), %ebx
|
||||
jl .L2
|
||||
|
||||
/*
|
||||
* FIXME: Restore floating point state
|
||||
*/
|
||||
|
|
|
@ -79,7 +79,6 @@ Ki386ApplicationProcessorInitializeTSS(VOID)
|
|||
/* Initialize the boot TSS. */
|
||||
Tss->Esp0 = (ULONG)Ki386InitialStackArray[Id];
|
||||
Tss->Ss0 = KERNEL_DS;
|
||||
// Tss.IoMapBase = FIELD_OFFSET(KTSS, IoBitmap);
|
||||
Tss->IoMapBase = 0xFFFF; /* No i/o bitmap */
|
||||
Tss->IoBitmap[0] = 0xFF;
|
||||
Tss->Ldt = LDT_SELECTOR;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: kthread.c,v 1.25 2002/05/14 21:19:18 dwelch Exp $
|
||||
/* $Id: kthread.c,v 1.26 2002/06/04 15:26:56 dwelch Exp $
|
||||
*
|
||||
* FILE: ntoskrnl/ke/kthread.c
|
||||
* PURPOSE: Microkernel thread support
|
||||
|
@ -44,13 +44,13 @@
|
|||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
VOID
|
||||
KeFreeStackPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, ULONG PhysAddr,
|
||||
SWAPENTRY SwapEntry, BOOLEAN Dirty)
|
||||
KeFreeStackPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||
PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry, BOOLEAN Dirty)
|
||||
{
|
||||
assert(SwapEntry == 0);
|
||||
if (PhysAddr != 0)
|
||||
if (PhysAddr.QuadPart != 0)
|
||||
{
|
||||
MmDereferencePage((PVOID)PhysAddr);
|
||||
MmDereferencePage(PhysAddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
|
|||
}
|
||||
for (i = 0; i < (MM_STACK_SIZE / PAGESIZE); i++)
|
||||
{
|
||||
PVOID Page;
|
||||
PHYSICAL_ADDRESS Page;
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &Page);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
|
|||
Status = MmCreateVirtualMapping(NULL,
|
||||
KernelStack + (i * PAGESIZE),
|
||||
PAGE_EXECUTE_READWRITE,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
TRUE);
|
||||
}
|
||||
Thread->InitialStack = KernelStack + MM_STACK_SIZE;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: process.c,v 1.8 2001/04/16 02:02:04 dwelch Exp $
|
||||
/* $Id: process.c,v 1.9 2002/06/04 15:26:56 dwelch Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/process.c
|
||||
|
@ -60,7 +60,7 @@ KeAttachProcess (PEPROCESS Process)
|
|||
|
||||
CurrentThread->OldProcess = PsGetCurrentProcess();
|
||||
CurrentThread->ThreadsProcess = Process;
|
||||
PageDir = (ULONG)CurrentThread->ThreadsProcess->Pcb.DirectoryTableBase[0];
|
||||
PageDir = CurrentThread->ThreadsProcess->Pcb.DirectoryTableBase.u.LowPart;
|
||||
DPRINT("Switching process context to %x\n",PageDir)
|
||||
__asm__("movl %0,%%cr3\n\t"
|
||||
: /* no inputs */
|
||||
|
@ -91,7 +91,7 @@ KeDetachProcess (VOID)
|
|||
|
||||
CurrentThread->ThreadsProcess = CurrentThread->OldProcess;
|
||||
CurrentThread->OldProcess = NULL;
|
||||
PageDir = (ULONG)CurrentThread->ThreadsProcess->Pcb.DirectoryTableBase[0];
|
||||
PageDir = CurrentThread->ThreadsProcess->Pcb.DirectoryTableBase.u.LowPart;
|
||||
__asm__("movl %0,%%cr3\n\t"
|
||||
: /* no inputs */
|
||||
: "r" (PageDir));
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: balance.c,v 1.8 2002/05/14 21:19:18 dwelch Exp $
|
||||
/* $Id: balance.c,v 1.9 2002/06/04 15:26:56 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -47,7 +47,7 @@ typedef struct _MM_MEMORY_CONSUMER
|
|||
|
||||
typedef struct _MM_ALLOCATION_REQUEST
|
||||
{
|
||||
PVOID Page;
|
||||
PHYSICAL_ADDRESS Page;
|
||||
LIST_ENTRY ListEntry;
|
||||
KEVENT Event;
|
||||
} MM_ALLOCATION_REQUEST, *PMM_ALLOCATION_REQUEST;
|
||||
|
@ -93,13 +93,13 @@ MmInitializeMemoryConsumer(ULONG Consumer,
|
|||
}
|
||||
|
||||
NTSTATUS
|
||||
MmReleasePageMemoryConsumer(ULONG Consumer, PVOID Page)
|
||||
MmReleasePageMemoryConsumer(ULONG Consumer, PHYSICAL_ADDRESS Page)
|
||||
{
|
||||
PMM_ALLOCATION_REQUEST Request;
|
||||
PLIST_ENTRY Entry;
|
||||
KIRQL oldIrql;
|
||||
|
||||
if (Page == NULL)
|
||||
if (Page.QuadPart == 0LL)
|
||||
{
|
||||
DPRINT1("Tried to release page zero.\n");
|
||||
KeBugCheck(0);
|
||||
|
@ -173,11 +173,12 @@ MiRebalanceMemoryConsumers(VOID)
|
|||
}
|
||||
|
||||
NTSTATUS
|
||||
MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait, PVOID* AllocatedPage)
|
||||
MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
||||
PHYSICAL_ADDRESS* AllocatedPage)
|
||||
{
|
||||
ULONG OldUsed;
|
||||
ULONG OldAvailable;
|
||||
PVOID Page;
|
||||
PHYSICAL_ADDRESS Page;
|
||||
KIRQL oldIrql;
|
||||
|
||||
/*
|
||||
|
@ -211,7 +212,7 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait, PVOID* AllocatedPag
|
|||
}
|
||||
|
||||
/* Insert an allocation request. */
|
||||
Request.Page = NULL;
|
||||
Request.Page.QuadPart = 0LL;
|
||||
KeInitializeEvent(&Request.Event, NotificationEvent, FALSE);
|
||||
InterlockedIncrement(&MiPagesRequired);
|
||||
|
||||
|
@ -234,7 +235,7 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait, PVOID* AllocatedPag
|
|||
{
|
||||
Page = MmAllocPage(Consumer, 0);
|
||||
KeReleaseSpinLock(&AllocationListLock, oldIrql);
|
||||
if (Page == NULL)
|
||||
if (Page.QuadPart == 0LL)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
@ -251,7 +252,7 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait, PVOID* AllocatedPag
|
|||
NULL);
|
||||
|
||||
Page = Request.Page;
|
||||
if (Page == NULL)
|
||||
if (Page.QuadPart == 0LL)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
@ -264,7 +265,7 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait, PVOID* AllocatedPag
|
|||
* Actually allocate the page.
|
||||
*/
|
||||
Page = MmAllocPage(Consumer, 0);
|
||||
if (Page == NULL)
|
||||
if (Page.QuadPart == 0LL)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: cont.c,v 1.19 2002/05/14 21:19:19 dwelch Exp $
|
||||
/* $Id: cont.c,v 1.20 2002/06/04 15:26:56 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -20,13 +20,14 @@
|
|||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
VOID STATIC
|
||||
MmFreeContinuousPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, ULONG PhysAddr,
|
||||
SWAPENTRY SwapEntry, BOOLEAN Dirty)
|
||||
MmFreeContinuousPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||
PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry,
|
||||
BOOLEAN Dirty)
|
||||
{
|
||||
assert(SwapEntry == 0);
|
||||
if (PhysAddr != 0)
|
||||
if (PhysAddr.QuadPart != 0)
|
||||
{
|
||||
MmDereferencePage((PVOID)PhysAddr);
|
||||
MmDereferencePage(PhysAddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +39,7 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
|||
PMEMORY_AREA MArea;
|
||||
NTSTATUS Status;
|
||||
PVOID BaseAddress = 0;
|
||||
PVOID PBase;
|
||||
PHYSICAL_ADDRESS PBase;
|
||||
ULONG i;
|
||||
|
||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||
|
@ -60,7 +61,7 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
|||
PBase = MmGetContinuousPages(NumberOfBytes,
|
||||
HighestAcceptableAddress,
|
||||
Alignment);
|
||||
if (PBase == NULL)
|
||||
if (PBase.QuadPart == 0LL)
|
||||
{
|
||||
MmFreeMemoryArea(MmGetKernelAddressSpace(),
|
||||
BaseAddress,
|
||||
|
@ -74,7 +75,7 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
|||
MmCreateVirtualMapping(NULL,
|
||||
BaseAddress + (i * 4096),
|
||||
PAGE_EXECUTE_READWRITE | PAGE_SYSTEM,
|
||||
(ULONG)(PBase + (i * 4096)),
|
||||
(LARGE_INTEGER)(PBase.QuadPart + (i * 4096)),
|
||||
TRUE);
|
||||
}
|
||||
return(BaseAddress);
|
||||
|
|
|
@ -50,9 +50,9 @@ static LIST_ENTRY BiosPageListHead;
|
|||
/* FUNCTIONS *************************************************************/
|
||||
|
||||
VOID
|
||||
MmTransferOwnershipPage(PVOID PhysicalAddress, ULONG NewConsumer)
|
||||
MmTransferOwnershipPage(PHYSICAL_ADDRESS PhysicalAddress, ULONG NewConsumer)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
|
||||
KeAcquireSpinLock(&PageListLock, &oldIrql);
|
||||
|
@ -62,11 +62,11 @@ MmTransferOwnershipPage(PVOID PhysicalAddress, ULONG NewConsumer)
|
|||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
}
|
||||
|
||||
PVOID
|
||||
PHYSICAL_ADDRESS
|
||||
MmGetLRUFirstUserPage(VOID)
|
||||
{
|
||||
PLIST_ENTRY NextListEntry;
|
||||
ULONG Next;
|
||||
PHYSICAL_ADDRESS Next;
|
||||
PHYSICAL_PAGE* PageDescriptor;
|
||||
KIRQL oldIrql;
|
||||
|
||||
|
@ -75,21 +75,21 @@ MmGetLRUFirstUserPage(VOID)
|
|||
if (NextListEntry == &UsedPageListHeads[MC_USER])
|
||||
{
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return(NULL);
|
||||
return((LARGE_INTEGER)0LL);
|
||||
}
|
||||
PageDescriptor = CONTAINING_RECORD(NextListEntry, PHYSICAL_PAGE, ListEntry);
|
||||
Next = (ULONG)((ULONG)PageDescriptor - (ULONG)MmPageArray);
|
||||
Next = (Next / sizeof(PHYSICAL_PAGE)) * PAGESIZE;
|
||||
Next.QuadPart = (ULONG)((ULONG)PageDescriptor - (ULONG)MmPageArray);
|
||||
Next.QuadPart = (Next.QuadPart / sizeof(PHYSICAL_PAGE)) * PAGESIZE;
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return((PVOID)Next);
|
||||
return(Next);
|
||||
}
|
||||
|
||||
PVOID
|
||||
MmGetLRUNextUserPage(PVOID PreviousPhysicalAddress)
|
||||
PHYSICAL_ADDRESS
|
||||
MmGetLRUNextUserPage(PHYSICAL_ADDRESS PreviousPhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PreviousPhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PreviousPhysicalAddress.u.LowPart / PAGESIZE;
|
||||
PLIST_ENTRY NextListEntry;
|
||||
ULONG Next;
|
||||
PHYSICAL_ADDRESS Next;
|
||||
PHYSICAL_PAGE* PageDescriptor;
|
||||
KIRQL oldIrql;
|
||||
|
||||
|
@ -105,16 +105,16 @@ MmGetLRUNextUserPage(PVOID PreviousPhysicalAddress)
|
|||
if (NextListEntry == &UsedPageListHeads[MC_USER])
|
||||
{
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return(NULL);
|
||||
return((LARGE_INTEGER)0LL);
|
||||
}
|
||||
PageDescriptor = CONTAINING_RECORD(NextListEntry, PHYSICAL_PAGE, ListEntry);
|
||||
Next = (ULONG)((ULONG)PageDescriptor - (ULONG)MmPageArray);
|
||||
Next = (Next / sizeof(PHYSICAL_PAGE)) * PAGESIZE;
|
||||
Next.QuadPart = (ULONG)((ULONG)PageDescriptor - (ULONG)MmPageArray);
|
||||
Next.QuadPart = (Next.QuadPart / sizeof(PHYSICAL_PAGE)) * PAGESIZE;
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return((PVOID)Next);
|
||||
return(Next);
|
||||
}
|
||||
|
||||
PVOID
|
||||
PHYSICAL_ADDRESS
|
||||
MmGetContinuousPages(ULONG NumberOfBytes,
|
||||
PHYSICAL_ADDRESS HighestAcceptableAddress,
|
||||
ULONG Alignment)
|
||||
|
@ -162,7 +162,7 @@ MmGetContinuousPages(ULONG NumberOfBytes,
|
|||
if (start == -1 || length != NrPages)
|
||||
{
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return(NULL);
|
||||
return((LARGE_INTEGER)(LONGLONG)0);
|
||||
}
|
||||
for (i = start; i < (start + length); i++)
|
||||
{
|
||||
|
@ -176,21 +176,21 @@ MmGetContinuousPages(ULONG NumberOfBytes,
|
|||
&MmPageArray[i].ListEntry);
|
||||
}
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return((PVOID)(start * 4096));
|
||||
return((LARGE_INTEGER)((LONGLONG)start * 4096));
|
||||
}
|
||||
|
||||
VOID MiParseRangeToFreeList(
|
||||
PADDRESS_RANGE Range)
|
||||
VOID
|
||||
MiParseRangeToFreeList(PADDRESS_RANGE Range)
|
||||
{
|
||||
ULONG i, first, last;
|
||||
|
||||
/* FIXME: Not 64-bit ready */
|
||||
|
||||
|
||||
DPRINT("Range going to free list (Base 0x%X, Length 0x%X, Type 0x%X)\n",
|
||||
Range->BaseAddrLow,
|
||||
Range->LengthLow,
|
||||
Range->Type);
|
||||
|
||||
Range->BaseAddrLow,
|
||||
Range->LengthLow,
|
||||
Range->Type);
|
||||
|
||||
first = (Range->BaseAddrLow + PAGESIZE - 1) / PAGESIZE;
|
||||
last = first + ((Range->LengthLow + PAGESIZE - 1) / PAGESIZE);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -198,25 +198,25 @@ VOID MiParseRangeToFreeList(
|
|||
if (MmPageArray[i].Flags == 0)
|
||||
{
|
||||
MmPageArray[i].Flags = MM_PHYSICAL_PAGE_FREE;
|
||||
MmPageArray[i].ReferenceCount = 0;
|
||||
InsertTailList(&FreeUnzeroedPageListHead,
|
||||
&MmPageArray[i].ListEntry);
|
||||
MmPageArray[i].ReferenceCount = 0;
|
||||
InsertTailList(&FreeUnzeroedPageListHead,
|
||||
&MmPageArray[i].ListEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VOID MiParseRangeToBiosList(
|
||||
PADDRESS_RANGE Range)
|
||||
VOID
|
||||
MiParseRangeToBiosList(PADDRESS_RANGE Range)
|
||||
{
|
||||
ULONG i, first, last;
|
||||
|
||||
|
||||
/* FIXME: Not 64-bit ready */
|
||||
|
||||
|
||||
DPRINT("Range going to bios list (Base 0x%X, Length 0x%X, Type 0x%X)\n",
|
||||
Range->BaseAddrLow,
|
||||
Range->LengthLow,
|
||||
Range->Type);
|
||||
|
||||
Range->BaseAddrLow,
|
||||
Range->LengthLow,
|
||||
Range->Type);
|
||||
|
||||
first = (Range->BaseAddrLow + PAGESIZE - 1) / PAGESIZE;
|
||||
last = first + ((Range->LengthLow + PAGESIZE - 1) / PAGESIZE);
|
||||
for (i = first; i < last; i++)
|
||||
|
@ -226,25 +226,25 @@ VOID MiParseRangeToBiosList(
|
|||
{
|
||||
RemoveEntryList(&MmPageArray[i].ListEntry);
|
||||
}
|
||||
|
||||
|
||||
if (MmPageArray[i].Flags != MM_PHYSICAL_PAGE_BIOS)
|
||||
{
|
||||
MmPageArray[i].Flags = MM_PHYSICAL_PAGE_BIOS;
|
||||
MmPageArray[i].ReferenceCount = 1;
|
||||
InsertTailList(&BiosPageListHead,
|
||||
&MmPageArray[i].ListEntry);
|
||||
MmPageArray[i].ReferenceCount = 1;
|
||||
InsertTailList(&BiosPageListHead,
|
||||
&MmPageArray[i].ListEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VOID MiParseBIOSMemoryMap(
|
||||
ULONG MemorySizeInPages,
|
||||
PADDRESS_RANGE BIOSMemoryMap,
|
||||
ULONG AddressRangeCount)
|
||||
VOID
|
||||
MiParseBIOSMemoryMap(ULONG MemorySizeInPages,
|
||||
PADDRESS_RANGE BIOSMemoryMap,
|
||||
ULONG AddressRangeCount)
|
||||
{
|
||||
PADDRESS_RANGE p;
|
||||
ULONG i;
|
||||
|
||||
|
||||
p = BIOSMemoryMap;
|
||||
for (i = 0; i < AddressRangeCount; i++)
|
||||
{
|
||||
|
@ -322,26 +322,27 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
|
|||
|
||||
for (i = 0; i < Reserved; i++)
|
||||
{
|
||||
if (!MmIsPagePresent(NULL,
|
||||
(PVOID)((ULONG)MmPageArray + (i * PAGESIZE))))
|
||||
{
|
||||
Status =
|
||||
MmCreateVirtualMappingUnsafe(NULL,
|
||||
(PVOID)((ULONG)MmPageArray +
|
||||
(i * PAGESIZE)),
|
||||
PAGE_READWRITE,
|
||||
(ULONG)(LastPhysKernelAddress
|
||||
- (Reserved * PAGESIZE) + (i * PAGESIZE)),
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("Unable to create virtual mapping\n");
|
||||
KeBugCheck(0);
|
||||
}
|
||||
}
|
||||
memset((PVOID)MmPageArray + (i * PAGESIZE), 0, PAGESIZE);
|
||||
PVOID Address = (PVOID)(ULONG)MmPageArray + (i * PAGESIZE);
|
||||
if (!MmIsPagePresent(NULL, Address))
|
||||
{
|
||||
ULONG PhysicalAddress;
|
||||
PhysicalAddress = (ULONG)LastPhysKernelAddress -
|
||||
(Reserved * PAGESIZE) + (i * PAGESIZE);
|
||||
Status =
|
||||
MmCreateVirtualMappingUnsafe(NULL,
|
||||
Address,
|
||||
PAGE_READWRITE,
|
||||
(PHYSICAL_ADDRESS)(LONGLONG)PhysicalAddress,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("Unable to create virtual mapping\n");
|
||||
KeBugCheck(0);
|
||||
}
|
||||
}
|
||||
memset((PVOID)MmPageArray + (i * PAGESIZE), 0, PAGESIZE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Page zero is reserved
|
||||
*/
|
||||
|
@ -455,10 +456,10 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
|
|||
return((PVOID)LastKernelAddress);
|
||||
}
|
||||
|
||||
VOID MmSetFlagsPage(PVOID PhysicalAddress,
|
||||
ULONG Flags)
|
||||
VOID
|
||||
MmSetFlagsPage(PHYSICAL_ADDRESS PhysicalAddress, ULONG Flags)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
|
||||
KeAcquireSpinLock(&PageListLock, &oldIrql);
|
||||
|
@ -467,25 +468,26 @@ VOID MmSetFlagsPage(PVOID PhysicalAddress,
|
|||
}
|
||||
|
||||
VOID
|
||||
MmSetRmapListHeadPage(PVOID PhysicalAddress, struct _MM_RMAP_ENTRY* ListHead)
|
||||
MmSetRmapListHeadPage(PHYSICAL_ADDRESS PhysicalAddress,
|
||||
struct _MM_RMAP_ENTRY* ListHead)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
|
||||
MmPageArray[Start].RmapListHead = ListHead;
|
||||
}
|
||||
|
||||
struct _MM_RMAP_ENTRY*
|
||||
MmGetRmapListHeadPage(PVOID PhysicalAddress)
|
||||
MmGetRmapListHeadPage(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
|
||||
return(MmPageArray[Start].RmapListHead);
|
||||
}
|
||||
|
||||
VOID
|
||||
MmMarkPageMapped(PVOID PhysicalAddress)
|
||||
MmMarkPageMapped(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
|
||||
KeAcquireSpinLock(&PageListLock, &oldIrql);
|
||||
|
@ -494,9 +496,9 @@ MmMarkPageMapped(PVOID PhysicalAddress)
|
|||
}
|
||||
|
||||
VOID
|
||||
MmMarkPageUnmapped(PVOID PhysicalAddress)
|
||||
MmMarkPageUnmapped(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
|
||||
KeAcquireSpinLock(&PageListLock, &oldIrql);
|
||||
|
@ -504,9 +506,10 @@ MmMarkPageUnmapped(PVOID PhysicalAddress)
|
|||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
}
|
||||
|
||||
ULONG MmGetFlagsPage(PVOID PhysicalAddress)
|
||||
ULONG
|
||||
MmGetFlagsPage(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
ULONG Flags;
|
||||
|
||||
|
@ -518,10 +521,11 @@ ULONG MmGetFlagsPage(PVOID PhysicalAddress)
|
|||
}
|
||||
|
||||
|
||||
VOID MmSetSavedSwapEntryPage(PVOID PhysicalAddress,
|
||||
SWAPENTRY SavedSwapEntry)
|
||||
VOID
|
||||
MmSetSavedSwapEntryPage(PHYSICAL_ADDRESS PhysicalAddress,
|
||||
SWAPENTRY SavedSwapEntry)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
|
||||
KeAcquireSpinLock(&PageListLock, &oldIrql);
|
||||
|
@ -530,9 +534,9 @@ VOID MmSetSavedSwapEntryPage(PVOID PhysicalAddress,
|
|||
}
|
||||
|
||||
SWAPENTRY
|
||||
MmGetSavedSwapEntryPage(PVOID PhysicalAddress)
|
||||
MmGetSavedSwapEntryPage(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
SWAPENTRY SavedSwapEntry;
|
||||
KIRQL oldIrql;
|
||||
|
||||
|
@ -543,14 +547,15 @@ MmGetSavedSwapEntryPage(PVOID PhysicalAddress)
|
|||
return(SavedSwapEntry);
|
||||
}
|
||||
|
||||
VOID MmReferencePage(PVOID PhysicalAddress)
|
||||
VOID
|
||||
MmReferencePage(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
|
||||
DPRINT("MmReferencePage(PhysicalAddress %x)\n", PhysicalAddress);
|
||||
|
||||
if (((ULONG)PhysicalAddress) == 0)
|
||||
if (PhysicalAddress.u.LowPart == 0)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
@ -568,15 +573,15 @@ VOID MmReferencePage(PVOID PhysicalAddress)
|
|||
}
|
||||
|
||||
ULONG
|
||||
MmGetReferenceCountPage(PVOID PhysicalAddress)
|
||||
MmGetReferenceCountPage(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
ULONG RCount;
|
||||
|
||||
DPRINT("MmGetReferenceCountPage(PhysicalAddress %x)\n", PhysicalAddress);
|
||||
|
||||
if (((ULONG)PhysicalAddress) == 0)
|
||||
if (PhysicalAddress.u.LowPart == 0)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
@ -596,13 +601,13 @@ MmGetReferenceCountPage(PVOID PhysicalAddress)
|
|||
}
|
||||
|
||||
BOOLEAN
|
||||
MmIsUsablePage(PVOID PhysicalAddress)
|
||||
MmIsUsablePage(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
|
||||
DPRINT("MmGetReferenceCountPage(PhysicalAddress %x)\n", PhysicalAddress);
|
||||
|
||||
if (((ULONG)PhysicalAddress) == 0)
|
||||
if (PhysicalAddress.u.LowPart == 0)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
@ -616,15 +621,15 @@ MmIsUsablePage(PVOID PhysicalAddress)
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
VOID MmDereferencePage(PVOID PhysicalAddress)
|
||||
VOID
|
||||
MmDereferencePage(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
|
||||
DPRINT("MmDereferencePage(PhysicalAddress %x)\n", PhysicalAddress);
|
||||
|
||||
if (((ULONG)PhysicalAddress) == 0)
|
||||
if (PhysicalAddress.u.LowPart == 0)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
@ -678,15 +683,16 @@ VOID MmDereferencePage(PVOID PhysicalAddress)
|
|||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
}
|
||||
|
||||
ULONG MmGetLockCountPage(PVOID PhysicalAddress)
|
||||
ULONG
|
||||
MmGetLockCountPage(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
ULONG LockCount;
|
||||
|
||||
DPRINT("MmGetLockCountPage(PhysicalAddress %x)\n", PhysicalAddress);
|
||||
|
||||
if (((ULONG)PhysicalAddress) == 0)
|
||||
if (PhysicalAddress.u.LowPart == 0)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
@ -705,14 +711,15 @@ ULONG MmGetLockCountPage(PVOID PhysicalAddress)
|
|||
return(LockCount);
|
||||
}
|
||||
|
||||
VOID MmLockPage(PVOID PhysicalAddress)
|
||||
VOID
|
||||
MmLockPage(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
|
||||
DPRINT("MmLockPage(PhysicalAddress %x)\n", PhysicalAddress);
|
||||
|
||||
if (((ULONG)PhysicalAddress) == 0)
|
||||
if (PhysicalAddress.u.LowPart == 0)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
@ -729,14 +736,15 @@ VOID MmLockPage(PVOID PhysicalAddress)
|
|||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
}
|
||||
|
||||
VOID MmUnlockPage(PVOID PhysicalAddress)
|
||||
VOID
|
||||
MmUnlockPage(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||
ULONG Start = PhysicalAddress.u.LowPart / PAGESIZE;
|
||||
KIRQL oldIrql;
|
||||
|
||||
DPRINT("MmUnlockPage(PhysicalAddress %x)\n", PhysicalAddress);
|
||||
DPRINT("MmUnlockPage(PhysicalAddress %llx)\n", PhysicalAddress);
|
||||
|
||||
if (((ULONG)PhysicalAddress) == 0)
|
||||
if (PhysicalAddress.u.LowPart == 0)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
@ -753,69 +761,63 @@ VOID MmUnlockPage(PVOID PhysicalAddress)
|
|||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
}
|
||||
|
||||
|
||||
PVOID
|
||||
PHYSICAL_ADDRESS
|
||||
MmAllocPage(ULONG Consumer, SWAPENTRY SavedSwapEntry)
|
||||
{
|
||||
ULONG offset;
|
||||
PLIST_ENTRY ListEntry;
|
||||
PPHYSICAL_PAGE PageDescriptor;
|
||||
KIRQL oldIrql;
|
||||
BOOLEAN NeedClear = FALSE;
|
||||
PHYSICAL_ADDRESS PageOffset;
|
||||
PLIST_ENTRY ListEntry;
|
||||
PPHYSICAL_PAGE PageDescriptor;
|
||||
KIRQL oldIrql;
|
||||
BOOLEAN NeedClear = FALSE;
|
||||
|
||||
DPRINT("MmAllocPage()\n");
|
||||
|
||||
KeAcquireSpinLock(&PageListLock, &oldIrql);
|
||||
if (IsListEmpty(&FreeZeroedPageListHead))
|
||||
{
|
||||
if (IsListEmpty(&FreeUnzeroedPageListHead))
|
||||
{
|
||||
DPRINT1("MmAllocPage(): Out of memory\n");
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return((PHYSICAL_ADDRESS)0LL);
|
||||
}
|
||||
ListEntry = RemoveTailList(&FreeUnzeroedPageListHead);
|
||||
|
||||
PageDescriptor = CONTAINING_RECORD(ListEntry, PHYSICAL_PAGE, ListEntry);
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
|
||||
NeedClear = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ListEntry = RemoveTailList(&FreeZeroedPageListHead);
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
|
||||
PageDescriptor = CONTAINING_RECORD(ListEntry, PHYSICAL_PAGE, ListEntry);
|
||||
}
|
||||
|
||||
if (PageDescriptor->Flags != MM_PHYSICAL_PAGE_FREE)
|
||||
{
|
||||
DbgPrint("Got non-free page from freelist\n");
|
||||
KeBugCheck(0);
|
||||
}
|
||||
PageDescriptor->Flags = MM_PHYSICAL_PAGE_USED;
|
||||
PageDescriptor->ReferenceCount = 1;
|
||||
PageDescriptor->LockCount = 0;
|
||||
PageDescriptor->MapCount = 0;
|
||||
PageDescriptor->SavedSwapEntry = SavedSwapEntry;
|
||||
ExInterlockedInsertTailList(&UsedPageListHeads[Consumer], ListEntry,
|
||||
&PageListLock);
|
||||
|
||||
MmStats.NrSystemPages++;
|
||||
MmStats.NrFreePages--;
|
||||
|
||||
if (SavedSwapEntry == 0x17)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
||||
DPRINT("MmAllocPage()\n");
|
||||
|
||||
KeAcquireSpinLock(&PageListLock, &oldIrql);
|
||||
if (IsListEmpty(&FreeZeroedPageListHead))
|
||||
{
|
||||
if (IsListEmpty(&FreeUnzeroedPageListHead))
|
||||
{
|
||||
DPRINT1("MmAllocPage(): Out of memory\n");
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
return(NULL);
|
||||
}
|
||||
ListEntry = RemoveTailList(&FreeUnzeroedPageListHead);
|
||||
|
||||
PageDescriptor = CONTAINING_RECORD(ListEntry, PHYSICAL_PAGE, ListEntry);
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
|
||||
NeedClear = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ListEntry = RemoveTailList(&FreeZeroedPageListHead);
|
||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||
|
||||
PageDescriptor = CONTAINING_RECORD(ListEntry, PHYSICAL_PAGE, ListEntry);
|
||||
}
|
||||
|
||||
if (PageDescriptor->Flags != MM_PHYSICAL_PAGE_FREE)
|
||||
{
|
||||
DbgPrint("Got non-free page from freelist\n");
|
||||
KeBugCheck(0);
|
||||
}
|
||||
PageDescriptor->Flags = MM_PHYSICAL_PAGE_USED;
|
||||
PageDescriptor->ReferenceCount = 1;
|
||||
PageDescriptor->LockCount = 0;
|
||||
PageDescriptor->MapCount = 0;
|
||||
PageDescriptor->SavedSwapEntry = SavedSwapEntry;
|
||||
ExInterlockedInsertTailList(&UsedPageListHeads[Consumer], ListEntry,
|
||||
&PageListLock);
|
||||
|
||||
MmStats.NrSystemPages++;
|
||||
MmStats.NrFreePages--;
|
||||
|
||||
offset = (ULONG)((ULONG)PageDescriptor - (ULONG)MmPageArray);
|
||||
offset = (offset / sizeof(PHYSICAL_PAGE)) * PAGESIZE;
|
||||
if (NeedClear)
|
||||
{
|
||||
MiZeroPage(offset);
|
||||
}
|
||||
DPRINT("MmAllocPage() = %x\n",offset);
|
||||
return((PVOID)offset);
|
||||
PageOffset.QuadPart = (ULONG)((ULONG)PageDescriptor - (ULONG)MmPageArray);
|
||||
PageOffset.QuadPart =
|
||||
(PageOffset.QuadPart / sizeof(PHYSICAL_PAGE)) * PAGESIZE;
|
||||
if (NeedClear)
|
||||
{
|
||||
MiZeroPage(PageOffset);
|
||||
}
|
||||
return(PageOffset);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: page.c,v 1.36 2002/05/14 21:19:20 dwelch Exp $
|
||||
/* $Id: page.c,v 1.37 2002/06/04 15:26:57 dwelch Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/i386/page.c
|
||||
|
@ -61,6 +61,8 @@
|
|||
|
||||
ULONG MmGlobalKernelPageDirectory[1024] = {0, };
|
||||
|
||||
#define PTE_TO_PAGE(X) ((LARGE_INTEGER)(LONGLONG)(PAGE_MASK(X)))
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
PULONG
|
||||
|
@ -122,8 +124,8 @@ NTSTATUS Mmi386ReleaseMmInfo(PEPROCESS Process)
|
|||
{
|
||||
DPRINT("Mmi386ReleaseMmInfo(Process %x)\n",Process);
|
||||
|
||||
MmDereferencePage(Process->Pcb.DirectoryTableBase[0]);
|
||||
Process->Pcb.DirectoryTableBase[0] = NULL;
|
||||
MmDereferencePage(Process->Pcb.DirectoryTableBase);
|
||||
Process->Pcb.DirectoryTableBase.QuadPart = 0LL;
|
||||
|
||||
DPRINT("Finished Mmi386ReleaseMmInfo()\n");
|
||||
return(STATUS_SUCCESS);
|
||||
|
@ -131,7 +133,7 @@ NTSTATUS Mmi386ReleaseMmInfo(PEPROCESS Process)
|
|||
|
||||
NTSTATUS MmCopyMmInfo(PEPROCESS Src, PEPROCESS Dest)
|
||||
{
|
||||
PULONG PhysPageDirectory;
|
||||
PHYSICAL_ADDRESS PhysPageDirectory;
|
||||
PULONG PageDirectory;
|
||||
PULONG CurrentPageDirectory;
|
||||
PKPROCESS KProcess = &Dest->Pcb;
|
||||
|
@ -144,8 +146,8 @@ NTSTATUS MmCopyMmInfo(PEPROCESS Src, PEPROCESS Dest)
|
|||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
PhysPageDirectory = (PULONG)(MmGetPhysicalAddress(PageDirectory)).u.LowPart;
|
||||
KProcess->DirectoryTableBase[0] = PhysPageDirectory;
|
||||
PhysPageDirectory = MmGetPhysicalAddress(PageDirectory);
|
||||
KProcess->DirectoryTableBase = PhysPageDirectory;
|
||||
CurrentPageDirectory = (PULONG)PAGEDIRECTORY_MAP;
|
||||
|
||||
memset(PageDirectory,0,PAGESIZE);
|
||||
|
@ -159,7 +161,7 @@ NTSTATUS MmCopyMmInfo(PEPROCESS Src, PEPROCESS Dest)
|
|||
}
|
||||
DPRINT("Addr %x\n",PAGETABLE_MAP / (4*1024*1024));
|
||||
PageDirectory[PAGETABLE_MAP / (4*1024*1024)] =
|
||||
(ULONG)PhysPageDirectory | 0x7;
|
||||
(ULONG)PhysPageDirectory.QuadPart | 0x7;
|
||||
|
||||
ExUnmapPage(PageDirectory);
|
||||
|
||||
|
@ -214,7 +216,7 @@ VOID MmFreePageTable(PEPROCESS Process, PVOID Address)
|
|||
{
|
||||
MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0;
|
||||
}
|
||||
MmDereferencePage((PVOID)PAGE_MASK(npage));
|
||||
MmDereferencePage(PTE_TO_PAGE(npage));
|
||||
FLUSH_TLB;
|
||||
if (Process != NULL && Process != CurrentProcess)
|
||||
{
|
||||
|
@ -229,7 +231,7 @@ NTSTATUS MmGetPageEntry2(PVOID PAddress, PULONG* Pte, BOOLEAN MayWait)
|
|||
{
|
||||
PULONG Pde;
|
||||
ULONG Address = (ULONG)PAddress;
|
||||
ULONG npage;
|
||||
PHYSICAL_ADDRESS npage;
|
||||
|
||||
DPRINT("MmGetPageEntry(Address %x)\n", Address);
|
||||
|
||||
|
@ -245,12 +247,12 @@ NTSTATUS MmGetPageEntry2(PVOID PAddress, PULONG* Pte, BOOLEAN MayWait)
|
|||
else
|
||||
{
|
||||
NTSTATUS Status;
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, MayWait, (PVOID*)&npage);
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, MayWait, &npage);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
(*Pde) = npage | 0x7;
|
||||
(*Pde) = npage.QuadPart | 0x7;
|
||||
if (Address >= KERNEL_BASE)
|
||||
{
|
||||
MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] =
|
||||
|
@ -327,8 +329,9 @@ ULONG MmGetPageEntryForProcess1(PEPROCESS Process, PVOID Address)
|
|||
}
|
||||
|
||||
|
||||
ULONG MmGetPhysicalAddressForProcess(PEPROCESS Process,
|
||||
PVOID Address)
|
||||
PHYSICAL_ADDRESS
|
||||
MmGetPhysicalAddressForProcess(PEPROCESS Process,
|
||||
PVOID Address)
|
||||
{
|
||||
ULONG PageEntry;
|
||||
|
||||
|
@ -336,9 +339,9 @@ ULONG MmGetPhysicalAddressForProcess(PEPROCESS Process,
|
|||
|
||||
if (!(PageEntry & PA_PRESENT))
|
||||
{
|
||||
return(0);
|
||||
return((LARGE_INTEGER)0LL);
|
||||
}
|
||||
return(PAGE_MASK(PageEntry));
|
||||
return(PTE_TO_PAGE(PageEntry));
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -412,7 +415,7 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOL* WasDirty, ULONG*
|
|||
|
||||
VOID
|
||||
MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage,
|
||||
BOOL* WasDirty, ULONG* PhysicalAddr)
|
||||
BOOL* WasDirty, PHYSICAL_ADDRESS* PhysicalAddr)
|
||||
/*
|
||||
* FUNCTION: Delete a virtual mapping
|
||||
*/
|
||||
|
@ -454,7 +457,7 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage,
|
|||
}
|
||||
if (PhysicalAddr != NULL)
|
||||
{
|
||||
*PhysicalAddr = 0;
|
||||
*PhysicalAddr = (LARGE_INTEGER)0LL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -467,11 +470,11 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage,
|
|||
WasValid = (PAGE_MASK(Pte) != 0);
|
||||
if (WasValid)
|
||||
{
|
||||
MmMarkPageUnmapped((PVOID)PAGE_MASK(Pte));
|
||||
MmMarkPageUnmapped(PTE_TO_PAGE(Pte));
|
||||
}
|
||||
if (FreePage && WasValid)
|
||||
{
|
||||
MmDereferencePage((PVOID)PAGE_MASK(Pte));
|
||||
MmDereferencePage(PTE_TO_PAGE(Pte));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -516,7 +519,7 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage,
|
|||
}
|
||||
if (PhysicalAddr != NULL)
|
||||
{
|
||||
*PhysicalAddr = PAGE_MASK(Pte);
|
||||
*PhysicalAddr = PTE_TO_PAGE(Pte);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -636,7 +639,7 @@ NTSTATUS MmCreatePageTable(PVOID PAddress)
|
|||
{
|
||||
PULONG page_dir;
|
||||
ULONG Address = (ULONG)PAddress;
|
||||
ULONG npage;
|
||||
PHYSICAL_ADDRESS npage;
|
||||
|
||||
DPRINT("MmGetPageEntry(Address %x)\n", Address);
|
||||
|
||||
|
@ -651,12 +654,12 @@ NTSTATUS MmCreatePageTable(PVOID PAddress)
|
|||
if ((*page_dir) == 0)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, (PVOID*)&npage);
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &npage);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
(*page_dir) = npage | 0x7;
|
||||
(*page_dir) = npage.QuadPart | 0x7;
|
||||
memset((PVOID)PAGE_ROUND_DOWN(ADDR_TO_PTE(Address)), 0, PAGESIZE);
|
||||
FLUSH_TLB;
|
||||
}
|
||||
|
@ -671,7 +674,7 @@ PULONG MmGetPageEntry(PVOID PAddress)
|
|||
PULONG page_tlb;
|
||||
PULONG page_dir;
|
||||
ULONG Address = (ULONG)PAddress;
|
||||
ULONG npage;
|
||||
PHYSICAL_ADDRESS npage;
|
||||
|
||||
DPRINT("MmGetPageEntry(Address %x)\n", Address);
|
||||
|
||||
|
@ -686,12 +689,12 @@ PULONG MmGetPageEntry(PVOID PAddress)
|
|||
if ((*page_dir) == 0)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, (PVOID*)&npage);
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &npage);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
(*page_dir) = npage | 0x7;
|
||||
(*page_dir) = npage.QuadPart | 0x7;
|
||||
memset((PVOID)PAGE_ROUND_DOWN(ADDR_TO_PTE(Address)), 0, PAGESIZE);
|
||||
FLUSH_TLB;
|
||||
}
|
||||
|
@ -800,7 +803,7 @@ BOOLEAN MmIsPageSwapEntry(PEPROCESS Process, PVOID Address)
|
|||
NTSTATUS
|
||||
MmCreateVirtualMappingForKernel(PVOID Address,
|
||||
ULONG flProtect,
|
||||
ULONG PhysicalAddress)
|
||||
PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
PEPROCESS CurrentProcess;
|
||||
ULONG Attributes;
|
||||
|
@ -849,9 +852,9 @@ MmCreateVirtualMappingForKernel(PVOID Address,
|
|||
}
|
||||
if (PAGE_MASK((*Pte)) != 0)
|
||||
{
|
||||
MmMarkPageUnmapped((PVOID)PAGE_MASK((*Pte)));
|
||||
MmMarkPageUnmapped(PTE_TO_PAGE((*Pte)));
|
||||
}
|
||||
*Pte = PhysicalAddress | Attributes;
|
||||
*Pte = PhysicalAddress.QuadPart | Attributes;
|
||||
if (Process != NULL &&
|
||||
Process->AddressSpace.PageTableRefCountTable != NULL &&
|
||||
ADDR_TO_PAGE_TABLE(Address) < 768 &&
|
||||
|
@ -920,7 +923,7 @@ MmCreatePageFileMapping(PEPROCESS Process,
|
|||
}
|
||||
if (PAGE_MASK((*Pte)) != 0)
|
||||
{
|
||||
MmMarkPageUnmapped((PVOID)PAGE_MASK((*Pte)));
|
||||
MmMarkPageUnmapped(PTE_TO_PAGE((*Pte)));
|
||||
}
|
||||
*Pte = SwapEntry << 1;
|
||||
if (Process != NULL &&
|
||||
|
@ -945,7 +948,7 @@ NTSTATUS
|
|||
MmCreateVirtualMappingUnsafe(PEPROCESS Process,
|
||||
PVOID Address,
|
||||
ULONG flProtect,
|
||||
ULONG PhysicalAddress,
|
||||
PHYSICAL_ADDRESS PhysicalAddress,
|
||||
BOOLEAN MayWait)
|
||||
{
|
||||
PEPROCESS CurrentProcess;
|
||||
|
@ -972,10 +975,10 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
|
|||
DPRINT1("Setting kernel address with process context\n");
|
||||
KeBugCheck(0);
|
||||
}
|
||||
MmMarkPageMapped((PVOID)PhysicalAddress);
|
||||
MmMarkPageMapped(PhysicalAddress);
|
||||
|
||||
Attributes = ProtectToPTE(flProtect);
|
||||
if (!(Attributes & PA_PRESENT) && PhysicalAddress != 0)
|
||||
if (!(Attributes & PA_PRESENT) && PhysicalAddress.QuadPart != 0)
|
||||
{
|
||||
DPRINT1("Setting physical address but not allowing access at address "
|
||||
"0x%.8X with attributes %x/%x.\n",
|
||||
|
@ -1003,9 +1006,9 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
|
|||
}
|
||||
if (PAGE_MASK((*Pte)) != 0)
|
||||
{
|
||||
MmMarkPageUnmapped((PVOID)PAGE_MASK((*Pte)));
|
||||
MmMarkPageUnmapped(PTE_TO_PAGE((*Pte)));
|
||||
}
|
||||
*Pte = PhysicalAddress | Attributes;
|
||||
*Pte = PhysicalAddress.QuadPart | Attributes;
|
||||
if (Process != NULL &&
|
||||
Process->AddressSpace.PageTableRefCountTable != NULL &&
|
||||
ADDR_TO_PAGE_TABLE(Address) < 768 &&
|
||||
|
@ -1029,10 +1032,10 @@ NTSTATUS
|
|||
MmCreateVirtualMapping(PEPROCESS Process,
|
||||
PVOID Address,
|
||||
ULONG flProtect,
|
||||
ULONG PhysicalAddress,
|
||||
PHYSICAL_ADDRESS PhysicalAddress,
|
||||
BOOLEAN MayWait)
|
||||
{
|
||||
if (!MmIsUsablePage((PVOID)PhysicalAddress))
|
||||
if (!MmIsUsablePage(PhysicalAddress))
|
||||
{
|
||||
DPRINT1("Page at address %x not usable\n", PhysicalAddress);
|
||||
KeBugCheck(0);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: iospace.c,v 1.12 2001/08/03 09:36:18 ei Exp $
|
||||
/* $Id: iospace.c,v 1.13 2002/06/04 15:26:56 dwelch Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/iospace.c
|
||||
|
@ -99,10 +99,11 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress,
|
|||
for (i = 0; (i < ((NumberOfBytes + PAGESIZE - 1) / PAGESIZE)); i++)
|
||||
{
|
||||
Status =
|
||||
MmCreateVirtualMappingForKernel (
|
||||
(Result + (i * PAGESIZE)),
|
||||
Attributes,
|
||||
PhysicalAddress.u.LowPart + (i * PAGESIZE));
|
||||
MmCreateVirtualMappingForKernel(Result + (i * PAGESIZE),
|
||||
Attributes,
|
||||
(PHYSICAL_ADDRESS)
|
||||
(PhysicalAddress.QuadPart +
|
||||
(i * PAGESIZE)));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("Unable to create virtual mapping\n");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: kmap.c,v 1.16 2002/05/14 21:19:19 dwelch Exp $
|
||||
/* $Id: kmap.c,v 1.17 2002/06/04 15:26:56 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -50,10 +50,10 @@ ExUnmapPage(PVOID Addr)
|
|||
PVOID
|
||||
ExAllocatePage(VOID)
|
||||
{
|
||||
ULONG PhysPage;
|
||||
PHYSICAL_ADDRESS PhysPage;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, (PVOID*)&PhysPage);
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &PhysPage);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(NULL);
|
||||
|
@ -63,7 +63,7 @@ ExAllocatePage(VOID)
|
|||
}
|
||||
|
||||
NTSTATUS
|
||||
MiZeroPage(ULONG PhysPage)
|
||||
MiZeroPage(PHYSICAL_ADDRESS PhysPage)
|
||||
{
|
||||
PVOID TempAddress;
|
||||
|
||||
|
@ -78,7 +78,7 @@ MiZeroPage(ULONG PhysPage)
|
|||
}
|
||||
|
||||
NTSTATUS
|
||||
MiCopyFromUserPage(ULONG DestPhysPage, PVOID SourceAddress)
|
||||
MiCopyFromUserPage(PHYSICAL_ADDRESS DestPhysPage, PVOID SourceAddress)
|
||||
{
|
||||
PVOID TempAddress;
|
||||
|
||||
|
@ -93,7 +93,7 @@ MiCopyFromUserPage(ULONG DestPhysPage, PVOID SourceAddress)
|
|||
}
|
||||
|
||||
PVOID
|
||||
ExAllocatePageWithPhysPage(ULONG PhysPage)
|
||||
ExAllocatePageWithPhysPage(PHYSICAL_ADDRESS PhysPage)
|
||||
{
|
||||
KIRQL oldlvl;
|
||||
ULONG addr;
|
||||
|
|
|
@ -295,7 +295,7 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
|
|||
PVOID BaseAddress,
|
||||
ULONG Length,
|
||||
VOID (*FreePage)(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||
ULONG PhysAddr, SWAPENTRY SwapEntry, BOOLEAN Dirty),
|
||||
PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry, BOOLEAN Dirty),
|
||||
PVOID FreePageContext)
|
||||
{
|
||||
MEMORY_AREA* MemoryArea;
|
||||
|
@ -313,7 +313,7 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
|
|||
}
|
||||
for (i=0; i<(PAGE_ROUND_UP(MemoryArea->Length)/PAGESIZE); i++)
|
||||
{
|
||||
ULONG PhysAddr = 0;
|
||||
PHYSICAL_ADDRESS PhysAddr = (PHYSICAL_ADDRESS)0LL;
|
||||
BOOL Dirty;
|
||||
SWAPENTRY SwapEntry = 0;
|
||||
|
||||
|
@ -333,7 +333,8 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
|
|||
if (FreePage != NULL)
|
||||
{
|
||||
FreePage(FreePageContext, MemoryArea,
|
||||
MemoryArea->BaseAddress + (i * PAGESIZE), PhysAddr, SwapEntry, Dirty);
|
||||
MemoryArea->BaseAddress + (i * PAGESIZE), PhysAddr,
|
||||
SwapEntry, Dirty);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mdl.c,v 1.40 2002/05/17 23:01:56 dwelch Exp $
|
||||
/* $Id: mdl.c,v 1.41 2002/06/04 15:26:56 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -107,8 +107,8 @@ MmUnlockPages(PMDL Mdl)
|
|||
MdlPages = (PULONG)(Mdl + 1);
|
||||
for (i=0; i<(PAGE_ROUND_UP(Mdl->ByteCount+Mdl->ByteOffset)/PAGESIZE); i++)
|
||||
{
|
||||
MmUnlockPage((PVOID)MdlPages[i]);
|
||||
MmDereferencePage((PVOID)MdlPages[i]);
|
||||
MmUnlockPage((LARGE_INTEGER)(LONGLONG)MdlPages[i]);
|
||||
MmDereferencePage((LARGE_INTEGER)(LONGLONG)MdlPages[i]);
|
||||
}
|
||||
Mdl->MdlFlags = Mdl->MdlFlags & (~MDL_PAGES_LOCKED);
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ MmMapLockedPages(PMDL Mdl, KPROCESSOR_MODE AccessMode)
|
|||
Status = MmCreateVirtualMapping(NULL,
|
||||
(PVOID)((ULONG)Base+(i*PAGESIZE)),
|
||||
PAGE_READWRITE,
|
||||
MdlPages[i],
|
||||
(LARGE_INTEGER)(LONGLONG)MdlPages[i],
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -322,15 +322,15 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
|||
{
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
MmUnlockPage((PVOID)MdlPages[j]);
|
||||
MmDereferencePage((PVOID)MdlPages[j]);
|
||||
MmUnlockPage((LARGE_INTEGER)(LONGLONG)MdlPages[j]);
|
||||
MmDereferencePage((LARGE_INTEGER)(LONGLONG)MdlPages[j]);
|
||||
}
|
||||
ExRaiseStatus(Status);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
if ((Operation == IoWriteAccess || Operation == IoModifyAccess) &&
|
||||
(!(MmGetPageProtect(NULL, (PVOID)Address) & PAGE_READWRITE)))
|
||||
|
@ -340,14 +340,15 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
|||
{
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
MmUnlockPage((PVOID)MdlPages[j]);
|
||||
MmDereferencePage((PVOID)MdlPages[j]);
|
||||
MmUnlockPage((LARGE_INTEGER)(LONGLONG)MdlPages[j]);
|
||||
MmDereferencePage(
|
||||
(LARGE_INTEGER)(LONGLONG)MdlPages[j]);
|
||||
}
|
||||
ExRaiseStatus(Status);
|
||||
}
|
||||
}
|
||||
MdlPages[i] = MmGetPhysicalAddressForProcess(NULL, Address);
|
||||
MmReferencePage((PVOID)MdlPages[i]);
|
||||
MdlPages[i] = MmGetPhysicalAddressForProcess(NULL, Address).u.LowPart;
|
||||
MmReferencePage((LARGE_INTEGER)(LONGLONG)MdlPages[i]);
|
||||
}
|
||||
MmUnlockAddressSpace(&Mdl->Process->AddressSpace);
|
||||
if (Mdl->Process != CurrentProcess)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: mm.c,v 1.56 2002/05/14 21:19:19 dwelch Exp $
|
||||
/* $Id: mm.c,v 1.57 2002/06/04 15:26:56 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -44,7 +44,6 @@
|
|||
PVOID EXPORTED MmUserProbeAddress = NULL;
|
||||
PVOID EXPORTED MmHighestUserAddress = NULL;
|
||||
MM_STATS MmStats;
|
||||
extern PVOID MmSharedDataPagePhysicalAddress;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
@ -245,7 +244,7 @@ NTSTATUS MmAccessFault(KPROCESSOR_MODE Mode,
|
|||
NTSTATUS MmCommitPagedPoolAddress(PVOID Address)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PVOID AllocatedPage;
|
||||
PHYSICAL_ADDRESS AllocatedPage;
|
||||
Status = MmRequestPageMemoryConsumer(MC_PPOOL, FALSE, &AllocatedPage);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -257,7 +256,7 @@ NTSTATUS MmCommitPagedPoolAddress(PVOID Address)
|
|||
MmCreateVirtualMapping(NULL,
|
||||
(PVOID)PAGE_ROUND_DOWN(Address),
|
||||
PAGE_READWRITE,
|
||||
(ULONG)AllocatedPage,
|
||||
AllocatedPage,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -266,7 +265,7 @@ NTSTATUS MmCommitPagedPoolAddress(PVOID Address)
|
|||
MmCreateVirtualMapping(NULL,
|
||||
(PVOID)PAGE_ROUND_DOWN(Address),
|
||||
PAGE_READWRITE,
|
||||
(ULONG)AllocatedPage,
|
||||
AllocatedPage,
|
||||
FALSE);
|
||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||
}
|
||||
|
@ -366,7 +365,7 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
|
|||
MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(Address),
|
||||
PAGE_READONLY,
|
||||
(ULONG)MmSharedDataPagePhysicalAddress,
|
||||
MmSharedDataPagePhysicalAddress,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -375,7 +374,7 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
|
|||
MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(Address),
|
||||
PAGE_READONLY,
|
||||
(ULONG)MmSharedDataPagePhysicalAddress,
|
||||
MmSharedDataPagePhysicalAddress,
|
||||
TRUE);
|
||||
MmLockAddressSpace(&PsGetCurrentProcess()->AddressSpace);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mminit.c,v 1.34 2002/05/17 23:01:56 dwelch Exp $
|
||||
/* $Id: mminit.c,v 1.35 2002/06/04 15:26:57 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -48,7 +48,7 @@ static MEMORY_AREA* kernel_pool_desc = NULL;
|
|||
static MEMORY_AREA* kernel_shared_data_desc = NULL;
|
||||
static MEMORY_AREA* MiPagedPoolDescriptor = NULL;
|
||||
|
||||
PVOID MmSharedDataPagePhysicalAddress = NULL;
|
||||
PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
@ -179,11 +179,12 @@ VOID MmInitVirtualMemory(ULONG LastKernelAddress,
|
|||
0,
|
||||
&kernel_shared_data_desc,
|
||||
FALSE);
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &MmSharedDataPagePhysicalAddress);
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE,
|
||||
&MmSharedDataPagePhysicalAddress);
|
||||
Status = MmCreateVirtualMapping(NULL,
|
||||
(PVOID)KI_USER_SHARED_DATA,
|
||||
PAGE_READWRITE,
|
||||
(ULONG)MmSharedDataPagePhysicalAddress,
|
||||
MmSharedDataPagePhysicalAddress,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: ncache.c,v 1.17 2002/05/14 21:19:19 dwelch Exp $
|
||||
/* $Id: ncache.c,v 1.18 2002/06/04 15:26:57 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -73,26 +73,27 @@ MmAllocateNonCachedMemory(IN ULONG NumberOfBytes)
|
|||
PAGE_WRITETHROUGH;
|
||||
for (i = 0; i <= (NumberOfBytes / PAGESIZE); i++)
|
||||
{
|
||||
PVOID NPage;
|
||||
PHYSICAL_ADDRESS NPage;
|
||||
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &NPage);
|
||||
MmCreateVirtualMapping (NULL,
|
||||
Result + (i * PAGESIZE),
|
||||
Attributes,
|
||||
(ULONG)NPage,
|
||||
NPage,
|
||||
TRUE);
|
||||
}
|
||||
return ((PVOID)Result);
|
||||
}
|
||||
|
||||
VOID STATIC
|
||||
MmFreeNonCachedPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, ULONG PhysAddr,
|
||||
SWAPENTRY SwapEntry, BOOLEAN Dirty)
|
||||
MmFreeNonCachedPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||
PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry,
|
||||
BOOLEAN Dirty)
|
||||
{
|
||||
assert(SwapEntry == 0);
|
||||
if (PhysAddr != 0)
|
||||
if (PhysAddr.QuadPart != 0)
|
||||
{
|
||||
MmDereferencePage((PVOID)PhysAddr);
|
||||
MmDereferencePage(PhysAddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: npool.c,v 1.57 2002/05/14 21:19:19 dwelch Exp $
|
||||
/* $Id: npool.c,v 1.58 2002/06/04 15:26:57 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -706,7 +706,7 @@ static BLOCK_HDR* grow_kernel_pool(unsigned int size, ULONG Tag, PVOID Caller)
|
|||
|
||||
for (i=0;i<nr_pages;i++)
|
||||
{
|
||||
PVOID Page;
|
||||
PHYSICAL_ADDRESS Page;
|
||||
/* FIXME: Check whether we can really wait here. */
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &Page);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -717,7 +717,7 @@ static BLOCK_HDR* grow_kernel_pool(unsigned int size, ULONG Tag, PVOID Caller)
|
|||
Status = MmCreateVirtualMapping(NULL,
|
||||
(PVOID)(start + (i*PAGESIZE)),
|
||||
PAGE_READWRITE,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: rmap.c,v 1.5 2002/05/14 21:19:19 dwelch Exp $
|
||||
/* $Id: rmap.c,v 1.6 2002/06/04 15:26:57 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -58,7 +58,7 @@ MmInitializeRmapList(VOID)
|
|||
}
|
||||
|
||||
NTSTATUS
|
||||
MmPageOutPhysicalAddress(PVOID PhysicalAddress)
|
||||
MmPageOutPhysicalAddress(PHYSICAL_ADDRESS PhysicalAddress)
|
||||
{
|
||||
PMM_RMAP_ENTRY entry;
|
||||
PMEMORY_AREA MemoryArea;
|
||||
|
@ -155,7 +155,8 @@ MmPageOutPhysicalAddress(PVOID PhysicalAddress)
|
|||
}
|
||||
|
||||
VOID
|
||||
MmInsertRmap(PVOID PhysicalAddress, PEPROCESS Process, PVOID Address)
|
||||
MmInsertRmap(PHYSICAL_ADDRESS PhysicalAddress, PEPROCESS Process,
|
||||
PVOID Address)
|
||||
{
|
||||
PMM_RMAP_ENTRY current_entry;
|
||||
PMM_RMAP_ENTRY new_entry;
|
||||
|
@ -170,8 +171,8 @@ MmInsertRmap(PVOID PhysicalAddress, PEPROCESS Process, PVOID Address)
|
|||
new_entry->Address = Address;
|
||||
new_entry->Process = Process;
|
||||
|
||||
if (MmGetPhysicalAddressForProcess(Process, Address) !=
|
||||
(ULONG)PhysicalAddress)
|
||||
if (MmGetPhysicalAddressForProcess(Process, Address).QuadPart !=
|
||||
PhysicalAddress.QuadPart)
|
||||
{
|
||||
DPRINT1("Insert rmap (%d, 0x%.8X) 0x%.8X which doesn't match physical "
|
||||
"address 0x%.8X\n", Process->UniqueProcessId, Address,
|
||||
|
@ -188,7 +189,7 @@ MmInsertRmap(PVOID PhysicalAddress, PEPROCESS Process, PVOID Address)
|
|||
}
|
||||
|
||||
VOID
|
||||
MmDeleteAllRmaps(PVOID PhysicalAddress, PVOID Context,
|
||||
MmDeleteAllRmaps(PHYSICAL_ADDRESS PhysicalAddress, PVOID Context,
|
||||
VOID (*DeleteMapping)(PVOID Context, PEPROCESS Process,
|
||||
PVOID Address))
|
||||
{
|
||||
|
@ -218,7 +219,8 @@ MmDeleteAllRmaps(PVOID PhysicalAddress, PVOID Context,
|
|||
}
|
||||
|
||||
VOID
|
||||
MmDeleteRmap(PVOID PhysicalAddress, PEPROCESS Process, PVOID Address)
|
||||
MmDeleteRmap(PHYSICAL_ADDRESS PhysicalAddress, PEPROCESS Process,
|
||||
PVOID Address)
|
||||
{
|
||||
PMM_RMAP_ENTRY current_entry, previous_entry;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: section.c,v 1.84 2002/05/19 14:09:35 dwelch Exp $
|
||||
/* $Id: section.c,v 1.85 2002/06/04 15:26:57 dwelch Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/section.c
|
||||
|
@ -306,7 +306,7 @@ MmUnsharePageEntrySectionSegment(PSECTION_OBJECT Section,
|
|||
NTSTATUS
|
||||
MiReadPage(PMEMORY_AREA MemoryArea,
|
||||
PLARGE_INTEGER Offset,
|
||||
PVOID* Page)
|
||||
PHYSICAL_ADDRESS* Page)
|
||||
/*
|
||||
* FUNCTION: Read a page for a section backed memory area.
|
||||
* PARAMETERS:
|
||||
|
@ -381,7 +381,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
|||
*/
|
||||
Addr = MmGetPhysicalAddress(BaseAddress +
|
||||
Offset->QuadPart - BaseOffset);
|
||||
(*Page) = (PVOID)(ULONG)Addr.QuadPart;
|
||||
(*Page) = Addr;
|
||||
MmReferencePage((*Page));
|
||||
|
||||
CcRosReleaseCacheSegment(Fcb->Bcb, CacheSeg, TRUE, FALSE, TRUE);
|
||||
|
@ -423,7 +423,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
BOOLEAN Locked)
|
||||
{
|
||||
LARGE_INTEGER Offset;
|
||||
PVOID Page;
|
||||
LARGE_INTEGER Page;
|
||||
NTSTATUS Status;
|
||||
ULONG PAddress;
|
||||
PSECTION_OBJECT Section;
|
||||
|
@ -442,7 +442,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
{
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
@ -534,14 +534,14 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
return(STATUS_MM_RESTART_OPERATION);
|
||||
}
|
||||
|
||||
Page = (PVOID)(PAGE_FROM_SSE(Entry));
|
||||
Page = (LARGE_INTEGER)(LONGLONG)(PAGE_FROM_SSE(Entry));
|
||||
MmReferencePage(Page);
|
||||
MmSharePageEntrySectionSegment(Segment, Offset.u.LowPart);
|
||||
|
||||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
Attributes,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -553,7 +553,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
}
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
MmUnlockSectionSegment(Segment);
|
||||
MmUnlockSection(Section);
|
||||
|
@ -592,7 +592,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
MemoryArea->Attributes,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
FALSE);
|
||||
while (Status == STATUS_NO_MEMORY)
|
||||
{
|
||||
|
@ -600,7 +600,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
MemoryArea->Attributes,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
TRUE);
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
*/
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
PageOp->Status = STATUS_SUCCESS;
|
||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||
|
@ -647,7 +647,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
MemoryArea->Attributes,
|
||||
Offset.QuadPart,
|
||||
Offset,
|
||||
FALSE);
|
||||
/*
|
||||
* Don't add an rmap entry since the page mapped could be for
|
||||
|
@ -655,7 +655,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
*/
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -690,13 +690,13 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
MemoryArea->Attributes,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
FALSE);
|
||||
MmInsertRmap(Page, PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(Address));
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -791,14 +791,14 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
* Mark the offset within the section as having valid, in-memory
|
||||
* data
|
||||
*/
|
||||
Entry = (ULONG)Page;
|
||||
Entry = Page.u.LowPart;
|
||||
MmSetPageEntrySectionSegment(Segment, Offset.QuadPart, Entry);
|
||||
MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
|
||||
|
||||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
Attributes,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -808,7 +808,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
Attributes,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -827,7 +827,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
}
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
PageOp->Status = STATUS_SUCCESS;
|
||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||
|
@ -887,7 +887,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
* Mark the offset within the section as having valid, in-memory
|
||||
* data
|
||||
*/
|
||||
Entry = (ULONG)Page;
|
||||
Entry = Page.u.LowPart;
|
||||
MmSetPageEntrySectionSegment(Segment, Offset.QuadPart, Entry);
|
||||
MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
|
||||
|
||||
|
@ -899,7 +899,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
Attributes,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
FALSE);
|
||||
MmInsertRmap(Page, PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(Address));
|
||||
|
@ -910,7 +910,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
}
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
PageOp->Status = STATUS_SUCCESS;
|
||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||
|
@ -927,14 +927,14 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
* take another reference to the page
|
||||
*/
|
||||
|
||||
Page = (PVOID)PAGE_FROM_SSE(Entry);
|
||||
Page = (LARGE_INTEGER)(LONGLONG)PAGE_FROM_SSE(Entry);
|
||||
MmReferencePage(Page);
|
||||
MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
|
||||
|
||||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
Attributes,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
FALSE);
|
||||
MmInsertRmap(Page, PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(Address));
|
||||
|
@ -945,7 +945,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
}
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
PageOp->Status = STATUS_SUCCESS;
|
||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||
|
@ -964,8 +964,8 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
{
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
PSECTION_OBJECT Section;
|
||||
ULONG OldPage;
|
||||
PVOID NewPage;
|
||||
PHYSICAL_ADDRESS OldPage;
|
||||
PHYSICAL_ADDRESS NewPage;
|
||||
PVOID NewAddress;
|
||||
NTSTATUS Status;
|
||||
ULONG PAddress;
|
||||
|
@ -1079,7 +1079,7 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
*/
|
||||
OldPage = MmGetPhysicalAddressForProcess(NULL, Address);
|
||||
|
||||
NewAddress = ExAllocatePageWithPhysPage((ULONG)NewPage);
|
||||
NewAddress = ExAllocatePageWithPhysPage(NewPage);
|
||||
memcpy(NewAddress, (PVOID)PAGE_ROUND_DOWN(Address), PAGESIZE);
|
||||
ExUnmapPage(NewAddress);
|
||||
|
||||
|
@ -1095,7 +1095,7 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
MemoryArea->Attributes,
|
||||
(ULONG)NewPage,
|
||||
NewPage,
|
||||
FALSE);
|
||||
MmInsertRmap(NewPage, PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(Address));
|
||||
|
@ -1106,16 +1106,16 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
}
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
|
||||
/*
|
||||
* Unshare the old page.
|
||||
*/
|
||||
MmUnsharePageEntrySectionSegment(Section, Segment, Offset.QuadPart, FALSE);
|
||||
MmDeleteRmap((PVOID)OldPage, PsGetCurrentProcess(),
|
||||
MmDeleteRmap(OldPage, PsGetCurrentProcess(),
|
||||
(PVOID)PAGE_ROUND_DOWN(Address));
|
||||
MmDereferencePage((PVOID)OldPage);
|
||||
MmDereferencePage(OldPage);
|
||||
|
||||
PageOp->Status = STATUS_SUCCESS;
|
||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||
|
@ -1128,14 +1128,14 @@ MmPageOutDeleteMapping(PVOID Context, PEPROCESS Process, PVOID Address)
|
|||
{
|
||||
MM_SECTION_PAGEOUT_CONTEXT* PageOutContext;
|
||||
BOOL WasDirty;
|
||||
PVOID PhysicalAddress;
|
||||
PHYSICAL_ADDRESS PhysicalAddress;
|
||||
|
||||
PageOutContext = (MM_SECTION_PAGEOUT_CONTEXT*)Context;
|
||||
MmDeleteVirtualMapping(Process,
|
||||
Address,
|
||||
FALSE,
|
||||
&WasDirty,
|
||||
(PULONG)&PhysicalAddress);
|
||||
&PhysicalAddress);
|
||||
if (WasDirty)
|
||||
{
|
||||
PageOutContext->WasDirty = TRUE;
|
||||
|
@ -1159,7 +1159,7 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
LARGE_INTEGER Offset;
|
||||
PSECTION_OBJECT Section;
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
PVOID PhysicalAddress;
|
||||
PHYSICAL_ADDRESS PhysicalAddress;
|
||||
MM_SECTION_PAGEOUT_CONTEXT Context;
|
||||
SWAPENTRY SwapEntry;
|
||||
PMDL Mdl;
|
||||
|
@ -1221,8 +1221,7 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
KeBugCheck(0);
|
||||
}
|
||||
PhysicalAddress =
|
||||
(PVOID)MmGetPhysicalAddressForProcess(AddressSpace->Process,
|
||||
Address);
|
||||
MmGetPhysicalAddressForProcess(AddressSpace->Process, Address);
|
||||
SwapEntry = MmGetSavedSwapEntryPage(PhysicalAddress);
|
||||
|
||||
/*
|
||||
|
@ -1234,7 +1233,7 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Context.WasDirty = FALSE;
|
||||
if (Segment->Characteristics & IMAGE_SECTION_CHAR_BSS ||
|
||||
IS_SWAP_FROM_SSE(Entry) ||
|
||||
(PVOID)(PAGE_FROM_SSE(Entry)) != PhysicalAddress)
|
||||
(LONGLONG)PAGE_FROM_SSE(Entry) != PhysicalAddress.QuadPart)
|
||||
{
|
||||
Context.Private = Private = TRUE;
|
||||
}
|
||||
|
@ -1361,7 +1360,7 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
if (DirectMapped && !Private)
|
||||
{
|
||||
assert(SwapEntry == 0);
|
||||
MmDereferencePage((PVOID)PhysicalAddress);
|
||||
MmDereferencePage(PhysicalAddress);
|
||||
PageOp->Status = STATUS_SUCCESS;
|
||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||
MmReleasePageOp(PageOp);
|
||||
|
@ -1371,7 +1370,7 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
/*
|
||||
* If necessary, allocate an entry in the paging file for this page
|
||||
*/
|
||||
SwapEntry = MmGetSavedSwapEntryPage((PVOID)PhysicalAddress);
|
||||
SwapEntry = MmGetSavedSwapEntryPage(PhysicalAddress);
|
||||
if (SwapEntry == 0)
|
||||
{
|
||||
SwapEntry = MmAllocSwapPage();
|
||||
|
@ -1385,7 +1384,7 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(MemoryArea->Process,
|
||||
Address,
|
||||
MemoryArea->Attributes,
|
||||
(ULONG)PhysicalAddress,
|
||||
PhysicalAddress,
|
||||
FALSE);
|
||||
MmSetDirtyPage(MemoryArea->Process, Address);
|
||||
MmInsertRmap(PhysicalAddress,
|
||||
|
@ -1402,14 +1401,14 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(MemoryArea->Process,
|
||||
Address,
|
||||
MemoryArea->Attributes,
|
||||
(ULONG)PhysicalAddress,
|
||||
PhysicalAddress,
|
||||
FALSE);
|
||||
MmSetDirtyPage(MemoryArea->Process, Address);
|
||||
MmInsertRmap(PhysicalAddress,
|
||||
MemoryArea->Process,
|
||||
Address);
|
||||
MmSetPageEntrySectionSegment(Segment, Offset.QuadPart,
|
||||
(ULONG)PhysicalAddress);
|
||||
PhysicalAddress.u.LowPart);
|
||||
MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
|
||||
}
|
||||
PageOp->Status = STATUS_UNSUCCESSFUL;
|
||||
|
@ -1438,7 +1437,7 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(MemoryArea->Process,
|
||||
Address,
|
||||
MemoryArea->Attributes,
|
||||
(ULONG)PhysicalAddress,
|
||||
PhysicalAddress,
|
||||
FALSE);
|
||||
MmSetDirtyPage(MemoryArea->Process, Address);
|
||||
MmInsertRmap(PhysicalAddress,
|
||||
|
@ -1450,14 +1449,14 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(MemoryArea->Process,
|
||||
Address,
|
||||
MemoryArea->Attributes,
|
||||
(ULONG)PhysicalAddress,
|
||||
PhysicalAddress,
|
||||
FALSE);
|
||||
MmSetDirtyPage(MemoryArea->Process, Address);
|
||||
MmInsertRmap(PhysicalAddress,
|
||||
MemoryArea->Process,
|
||||
Address);
|
||||
MmSetPageEntrySectionSegment(Segment, Offset.QuadPart,
|
||||
(ULONG)PhysicalAddress);
|
||||
PhysicalAddress.u.LowPart);
|
||||
MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
|
||||
}
|
||||
PageOp->Status = STATUS_UNSUCCESSFUL;
|
||||
|
@ -2556,8 +2555,9 @@ NtMapViewOfSection(HANDLE SectionHandle,
|
|||
}
|
||||
|
||||
VOID STATIC
|
||||
MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, ULONG PhysAddr,
|
||||
SWAPENTRY SwapEntry, BOOLEAN Dirty)
|
||||
MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||
PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry,
|
||||
BOOLEAN Dirty)
|
||||
{
|
||||
PMEMORY_AREA MArea;
|
||||
ULONG Entry;
|
||||
|
@ -2568,7 +2568,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, ULONG P
|
|||
{
|
||||
MmFreeSwapPage(SwapEntry);
|
||||
}
|
||||
else if (PhysAddr != 0)
|
||||
else if (PhysAddr.QuadPart != 0)
|
||||
{
|
||||
ULONG Offset;
|
||||
|
||||
|
@ -2582,13 +2582,13 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, ULONG P
|
|||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
else if (PhysAddr != (PAGE_FROM_SSE(Entry)))
|
||||
else if (PhysAddr.QuadPart != (PAGE_FROM_SSE(Entry)))
|
||||
{
|
||||
/*
|
||||
* Just dereference private pages
|
||||
*/
|
||||
MmDeleteRmap((PVOID)PhysAddr, MArea->Process, Address);
|
||||
MmDereferencePage((PVOID)PhysAddr);
|
||||
MmDeleteRmap(PhysAddr, MArea->Process, Address);
|
||||
MmDereferencePage(PhysAddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2596,8 +2596,8 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, ULONG P
|
|||
MArea->Data.SectionData.Segment,
|
||||
Offset,
|
||||
Dirty);
|
||||
MmDeleteRmap((PVOID)PhysAddr, MArea->Process, Address);
|
||||
MmDereferencePage((PVOID)PhysAddr);
|
||||
MmDeleteRmap(PhysAddr, MArea->Process, Address);
|
||||
MmDereferencePage(PhysAddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2854,7 +2854,7 @@ MmAllocateSection (IN ULONG Length)
|
|||
DPRINT("Result %p\n",Result);
|
||||
for (i = 0; (i <= (Length / PAGESIZE)); i++)
|
||||
{
|
||||
PVOID Page;
|
||||
PHYSICAL_ADDRESS Page;
|
||||
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &Page);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -2865,7 +2865,7 @@ MmAllocateSection (IN ULONG Length)
|
|||
Status = MmCreateVirtualMapping (NULL,
|
||||
(Result + (i * PAGESIZE)),
|
||||
PAGE_READWRITE,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: slab.c,v 1.4 2002/05/14 21:19:19 dwelch Exp $
|
||||
/* $Id: slab.c,v 1.5 2002/06/04 15:26:57 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -103,7 +103,7 @@ PSLAB_CACHE_PAGE
|
|||
ExGrowSlabCache(PSLAB_CACHE Slab)
|
||||
{
|
||||
PSLAB_CACHE_PAGE SlabPage;
|
||||
PVOID PhysicalPage;
|
||||
PHYSICAL_ADDRESS PhysicalPage;
|
||||
PVOID Page;
|
||||
NTSTATUS Status;
|
||||
ULONG i;
|
||||
|
@ -116,7 +116,7 @@ ExGrowSlabCache(PSLAB_CACHE Slab)
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
Page = ExAllocatePageWithPhysPage((ULONG)PhysicalPage);
|
||||
Page = ExAllocatePageWithPhysPage(PhysicalPage);
|
||||
if (Page == NULL)
|
||||
{
|
||||
MmReleasePageMemoryConsumer(MC_NPPOOL, PhysicalPage);
|
||||
|
@ -299,7 +299,7 @@ ExDestroySlabCache(PSLAB_CACHE Slab)
|
|||
while (current_entry != &Slab->PageListHead)
|
||||
{
|
||||
PVOID Base;
|
||||
PVOID PhysicalPage;
|
||||
PHYSICAL_ADDRESS PhysicalPage;
|
||||
|
||||
current = CONTAINING_RECORD(current_entry,
|
||||
SLAB_CACHE_PAGE,
|
||||
|
@ -314,7 +314,7 @@ ExDestroySlabCache(PSLAB_CACHE Slab)
|
|||
Slab->Destructor(Object, Slab->BaseSize);
|
||||
}
|
||||
}
|
||||
PhysicalPage = (PVOID)MmGetPhysicalAddressForProcess(NULL, Base);
|
||||
PhysicalPage = MmGetPhysicalAddressForProcess(NULL, Base);
|
||||
ExUnmapPage(Base);
|
||||
MmReleasePageMemoryConsumer(MC_NPPOOL, PhysicalPage);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: virtual.c,v 1.58 2002/05/14 21:19:19 dwelch Exp $
|
||||
/* $Id: virtual.c,v 1.59 2002/06/04 15:26:57 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -101,7 +101,7 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
PVOID Address,
|
||||
PMM_PAGEOP PageOp)
|
||||
{
|
||||
PVOID PhysicalAddress;
|
||||
PHYSICAL_ADDRESS PhysicalAddress;
|
||||
BOOL WasDirty;
|
||||
SWAPENTRY SwapEntry;
|
||||
NTSTATUS Status;
|
||||
|
@ -117,7 +117,7 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
(MemoryArea->Attributes & PAGE_EXECUTE_READ))
|
||||
{
|
||||
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE,
|
||||
NULL, (PULONG)&PhysicalAddress);
|
||||
NULL, &PhysicalAddress);
|
||||
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
|
||||
if (MmGetSavedSwapEntryPage(PhysicalAddress) != 0)
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
*/
|
||||
MmDisableVirtualMapping(MemoryArea->Process, Address,
|
||||
&WasDirty, (PULONG)&PhysicalAddress);
|
||||
if (PhysicalAddress == 0)
|
||||
if (PhysicalAddress.QuadPart == 0)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
/*
|
||||
* If necessary, allocate an entry in the paging file for this page
|
||||
*/
|
||||
SwapEntry = MmGetSavedSwapEntryPage((PVOID)PhysicalAddress);
|
||||
SwapEntry = MmGetSavedSwapEntryPage(PhysicalAddress);
|
||||
if (SwapEntry == 0)
|
||||
{
|
||||
SwapEntry = MmAllocSwapPage();
|
||||
|
@ -221,7 +221,7 @@ MmNotPresentFaultVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
* NOTES: This function is called with the address space lock held.
|
||||
*/
|
||||
{
|
||||
PVOID Page;
|
||||
PHYSICAL_ADDRESS Page;
|
||||
NTSTATUS Status;
|
||||
PMM_SEGMENT Segment;
|
||||
PVOID CurrentAddress;
|
||||
|
@ -236,7 +236,7 @@ MmNotPresentFaultVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
{
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ MmNotPresentFaultVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
MmLockAddressSpace(AddressSpace);
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
MmReleasePageOp(PageOp);
|
||||
return(STATUS_SUCCESS);
|
||||
|
@ -355,7 +355,7 @@ MmNotPresentFaultVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
MemoryArea->Attributes,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
FALSE);
|
||||
while (Status == STATUS_NO_MEMORY)
|
||||
{
|
||||
|
@ -363,7 +363,7 @@ MmNotPresentFaultVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||
Address,
|
||||
MemoryArea->Attributes,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
TRUE);
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ MmNotPresentFaultVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
|||
*/
|
||||
if (Locked)
|
||||
{
|
||||
MmLockPage((PVOID)MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
MmLockPage(MmGetPhysicalAddressForProcess(NULL, Address));
|
||||
}
|
||||
PageOp->Status = STATUS_SUCCESS;
|
||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||
|
@ -432,11 +432,11 @@ MmModifyAttributes(PMADDRESS_SPACE AddressSpace,
|
|||
MmDeleteVirtualMapping(AddressSpace->Process,
|
||||
BaseAddress + (i*PAGESIZE),
|
||||
FALSE, NULL, NULL);
|
||||
if (PhysicalAddr.u.LowPart != 0)
|
||||
if (PhysicalAddr.QuadPart != 0)
|
||||
{
|
||||
MmDeleteRmap((PVOID)PhysicalAddr.u.LowPart, AddressSpace->Process,
|
||||
MmDeleteRmap(PhysicalAddr, AddressSpace->Process,
|
||||
BaseAddress + (i * PAGESIZE));
|
||||
MmDereferencePage((PVOID)(ULONG)(PhysicalAddr.u.LowPart));
|
||||
MmDereferencePage(PhysicalAddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1053,16 +1053,16 @@ VOID STATIC
|
|||
MmFreeVirtualMemoryPage(PVOID Context,
|
||||
MEMORY_AREA* MemoryArea,
|
||||
PVOID Address,
|
||||
ULONG PhysicalAddr,
|
||||
PHYSICAL_ADDRESS PhysicalAddr,
|
||||
SWAPENTRY SwapEntry,
|
||||
BOOLEAN Dirty)
|
||||
{
|
||||
PEPROCESS Process = (PEPROCESS)Context;
|
||||
|
||||
if (PhysicalAddr != 0)
|
||||
if (PhysicalAddr.QuadPart != 0)
|
||||
{
|
||||
MmDeleteRmap((PVOID)PhysicalAddr, Process, Address);
|
||||
MmDereferencePage((PVOID)PhysicalAddr);
|
||||
MmDeleteRmap(PhysicalAddr, Process, Address);
|
||||
MmDereferencePage(PhysicalAddr);
|
||||
}
|
||||
else if (SwapEntry != 0)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: wset.c,v 1.13 2002/05/14 21:19:19 dwelch Exp $
|
||||
/* $Id: wset.c,v 1.14 2002/06/04 15:26:57 dwelch Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/wset.c
|
||||
|
@ -41,14 +41,14 @@
|
|||
NTSTATUS
|
||||
MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
|
||||
{
|
||||
PVOID CurrentPhysicalAddress;
|
||||
PVOID NextPhysicalAddress;
|
||||
PHYSICAL_ADDRESS CurrentPhysicalAddress;
|
||||
PHYSICAL_ADDRESS NextPhysicalAddress;
|
||||
NTSTATUS Status;
|
||||
|
||||
(*NrFreedPages) = 0;
|
||||
|
||||
CurrentPhysicalAddress = MmGetLRUFirstUserPage();
|
||||
while (CurrentPhysicalAddress != NULL && Target > 0)
|
||||
while (CurrentPhysicalAddress.QuadPart != 0 && Target > 0)
|
||||
{
|
||||
NextPhysicalAddress = MmGetLRUNextUserPage(CurrentPhysicalAddress);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: process.c,v 1.79 2002/04/26 13:12:34 ekohl Exp $
|
||||
/* $Id: process.c,v 1.80 2002/06/04 15:26:57 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -251,7 +251,8 @@ PsInitProcessManagment(VOID)
|
|||
MmInitializeAddressSpace(PsInitialSystemProcess,
|
||||
&PsInitialSystemProcess->AddressSpace);
|
||||
ObCreateHandleTable(NULL,FALSE,PsInitialSystemProcess);
|
||||
KProcess->DirectoryTableBase[0] = MmGetPageDirectory();
|
||||
KProcess->DirectoryTableBase =
|
||||
(LARGE_INTEGER)(LONGLONG)(ULONG)MmGetPageDirectory();
|
||||
PsInitialSystemProcess->UniqueProcessId =
|
||||
InterlockedIncrement(&PiNextProcessUniqueId);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: thread.c,v 1.93 2002/05/17 23:01:56 dwelch Exp $
|
||||
/* $Id: thread.c,v 1.94 2002/06/04 15:26:58 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -594,7 +594,7 @@ PsAllocateCallbackStack(ULONG StackSize)
|
|||
}
|
||||
for (i = 0; i < (StackSize / PAGESIZE); i++)
|
||||
{
|
||||
PVOID Page;
|
||||
PHYSICAL_ADDRESS Page;
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &Page);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -603,7 +603,7 @@ PsAllocateCallbackStack(ULONG StackSize)
|
|||
Status = MmCreateVirtualMapping(NULL,
|
||||
KernelStack + (i * PAGESIZE),
|
||||
PAGE_EXECUTE_READWRITE,
|
||||
(ULONG)Page,
|
||||
Page,
|
||||
TRUE);
|
||||
}
|
||||
return(KernelStack);
|
||||
|
|
Loading…
Reference in a new issue