ReactOS  0.4.15-dev-2095-g7caf9e9
data.c File Reference
#include <ntoskrnl.h>
#include "newmm.h"
#include <cache/newcc.h>
#include <debug.h>
#include <mm/ARM3/miarm.h>
Include dependency graph for data.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define DPRINTC   DPRINT
 

Functions

VOID NTAPI _MmLockSectionSegment (PMM_SECTION_SEGMENT Segment, const char *file, int line)
 
VOID NTAPI _MmUnlockSectionSegment (PMM_SECTION_SEGMENT Segment, const char *file, int line)
 
VOID NTAPI MiFreeSegmentPage (PMM_SECTION_SEGMENT Segment, PLARGE_INTEGER FileOffset)
 
VOID MmFreeCacheSectionPage (PVOID Context, MEMORY_AREA *MemoryArea, PVOID Address, PFN_NUMBER Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
 

Variables

LIST_ENTRY MiSegmentList
 
KEVENT MpwThreadEvent
 
KSPIN_LOCK MiSectionPageTableLock
 
PMMWSL MmWorkingSetList
 

Macro Definition Documentation

◆ DPRINTC

#define DPRINTC   DPRINT

Definition at line 84 of file data.c.

◆ NDEBUG

#define NDEBUG

Definition at line 80 of file data.c.

Function Documentation

◆ _MmLockSectionSegment()

VOID NTAPI _MmLockSectionSegment ( PMM_SECTION_SEGMENT  Segment,
const char file,
int  line 
)

Definition at line 98 of file data.c.

99 {
100  //DPRINT("MmLockSectionSegment(%p,%s:%d)\n", Segment, file, line);
101  ExAcquireFastMutex(&Segment->Lock);
102  Segment->Locked = TRUE;
103 }
#define TRUE
Definition: types.h:120
_Inout_ PVOID Segment
Definition: exfuncs.h:1101
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23

◆ _MmUnlockSectionSegment()

VOID NTAPI _MmUnlockSectionSegment ( PMM_SECTION_SEGMENT  Segment,
const char file,
int  line 
)

Definition at line 107 of file data.c.

108 {
109  ASSERT(Segment->Locked);
110  Segment->Locked = FALSE;
111  ExReleaseFastMutex(&Segment->Lock);
112  //DPRINT("MmUnlockSectionSegment(%p,%s:%d)\n", Segment, file, line);
113 }
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
#define FALSE
Definition: types.h:117
_Inout_ PVOID Segment
Definition: exfuncs.h:1101
#define ASSERT(a)
Definition: mode.c:45

◆ MiFreeSegmentPage()

VOID NTAPI MiFreeSegmentPage ( PMM_SECTION_SEGMENT  Segment,
PLARGE_INTEGER  FileOffset 
)

Definition at line 617 of file data.c.

619 {
621  PFILE_OBJECT FileObject = Segment->FileObject;
622 
624  DPRINTC("MiFreeSegmentPage(%p:%I64x -> Entry %Ix\n",
625  Segment,
626  FileOffset->QuadPart,
627  Entry);
628 
629  if (Entry && !IS_SWAP_FROM_SSE(Entry))
630  {
631  // The segment is carrying a dirty page.
632  PFN_NUMBER OldPage = PFN_FROM_SSE(Entry);
633  if (IS_DIRTY_SSE(Entry) && FileObject)
634  {
635  DPRINT("MiWriteBackPage(%p,%wZ,%I64x)\n",
636  Segment,
637  &FileObject->FileName,
638  FileOffset->QuadPart);
639 
641  }
642  DPRINTC("Free page %Ix (off %I64x from %p) (ref ct %lu, ent %Ix, dirty? %s)\n",
643  OldPage,
644  FileOffset->QuadPart,
645  Segment,
646  MmGetReferenceCountPage(OldPage),
647  Entry,
648  IS_DIRTY_SSE(Entry) ? "true" : "false");
649 
651  MmReleasePageMemoryConsumer(MC_CACHE, OldPage);
652  }
653  else if (IS_SWAP_FROM_SSE(Entry))
654  {
655  DPRINT("Free swap\n");
657  }
658 
659  DPRINT("Done\n");
660 }
#define DPRINTC
Definition: data.c:84
#define MmGetPageEntrySectionSegment(S, O)
Definition: mm.h:1448
struct _Entry Entry
Definition: kefuncs.h:627
#define PFN_FROM_SSE(E)
Definition: mm.h:1237
NTSTATUS NTAPI MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
Definition: balance.c:77
#define MmSetPageEntrySectionSegment(S, O, E)
Definition: mm.h:1446
uint32_t ULONG_PTR
Definition: typedefs.h:65
ULONG PFN_NUMBER
Definition: ke.h:9
#define IS_DIRTY_SSE(E)
Definition: mm.h:1246
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
_Inout_ PVOID Segment
Definition: exfuncs.h:1101
* PFILE_OBJECT
Definition: iotypes.h:1995
ULONG NTAPI MmGetReferenceCountPage(PFN_NUMBER Page)
Definition: freelist.c:538
#define PAGE_SIZE
Definition: env_spec_w32.h:49
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define IS_SWAP_FROM_SSE(E)
Definition: mm.h:1238
#define DPRINT
Definition: sndvol32.h:71
#define SWAPENTRY_FROM_SSE(E)
Definition: mm.h:1242
base of all file and directory entries
Definition: entries.h:82
VOID NTAPI MmFreeSwapPage(SWAPENTRY Entry)
Definition: pagefile.c:274
#define MiWriteBackPage(F, O, L, P)
Definition: newmm.h:166

◆ MmFreeCacheSectionPage()

VOID MmFreeCacheSectionPage ( PVOID  Context,
MEMORY_AREA MemoryArea,
PVOID  Address,
PFN_NUMBER  Page,
SWAPENTRY  SwapEntry,
BOOLEAN  Dirty 
)

Definition at line 663 of file data.c.

669 {
671  PVOID *ContextData = Context;
676 
677  DPRINT("MmFreeSectionPage(%p,%p,%Ix,%Ix,%u)\n",
678  MmGetAddressSpaceOwner(ContextData[0]),
679  Address,
680  Page,
681  SwapEntry,
682  Dirty);
683 
684  AddressSpace = ContextData[0];
687  Segment = ContextData[1];
689  MemoryArea->Data.SectionData.ViewOffset.QuadPart;
690 
692 
693  if (Page != 0 && PFN_FROM_SSE(Entry) == Page && Dirty)
694  {
695  DPRINT("Freeing section page %p:%I64x -> %Ix\n", Segment, Offset.QuadPart, Entry);
697  }
698  if (Page)
699  {
700  DPRINT("Removing page %p:%I64x -> %x\n", Segment, Offset.QuadPart, Entry);
705  }
706  if (SwapEntry != 0)
707  {
708  MmFreeSwapPage(SwapEntry);
709  }
710 }
#define MmGetPageEntrySectionSegment(S, O)
Definition: mm.h:1448
struct _Entry Entry
Definition: kefuncs.h:627
#define PFN_FROM_SSE(E)
Definition: mm.h:1237
VOID NTAPI MmDeleteRmap(PFN_NUMBER Page, struct _EPROCESS *Process, PVOID Address)
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2268
NTSTATUS NTAPI MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
Definition: balance.c:77
#define PAGE_ROUND_DOWN(x)
Definition: mmtypes.h:36
#define MmSetPageEntrySectionSegment(S, O, E)
Definition: mm.h:1446
#define DIRTY_SSE(E)
Definition: mm.h:1244
uint32_t ULONG_PTR
Definition: typedefs.h:65
static WCHAR Address[46]
Definition: ping.c:68
VOID NTAPI MmDeleteVirtualMapping(struct _EPROCESS *Process, PVOID Address, BOOLEAN *WasDirty, PPFN_NUMBER Page)
PFN_NUMBER Page
Definition: section.c:4843
void * PVOID
Definition: retypes.h:9
_Inout_ PVOID Segment
Definition: exfuncs.h:1101
#define MA_GetStartingAddress(_MemoryArea)
Definition: mm.h:212
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
FORCEINLINE PEPROCESS MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace)
Definition: mm.h:1533
#define NULL
Definition: types.h:112
struct _MEMORY_AREA::@1775 SectionData
VOID NTAPI MmSetSavedSwapEntryPage(PFN_NUMBER Page, SWAPENTRY SavedSwapEntry)
Definition: freelist.c:483
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
struct tagContext Context
Definition: acpixf.h:1034
#define ULONG_PTR
Definition: config.h:101
#define DPRINT
Definition: sndvol32.h:71
base of all file and directory entries
Definition: entries.h:82
VOID NTAPI MmFreeSwapPage(SWAPENTRY Entry)
Definition: pagefile.c:274

Variable Documentation

◆ MiSectionPageTableLock

KSPIN_LOCK MiSectionPageTableLock

◆ MiSegmentList

LIST_ENTRY MiSegmentList

Definition at line 86 of file data.c.

Referenced by MiRosTrimCache(), and MmInitSystem().

◆ MmWorkingSetList

PMMWSL MmWorkingSetList

Definition at line 21 of file procsup.c.

Referenced by MiInitMachineDependent(), and MmCreateProcessAddressSpace().

◆ MpwThreadEvent

KEVENT MpwThreadEvent