ReactOS 0.4.15-dev-7842-g558ab78
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);
102 Segment->Locked = TRUE;
103}
#define TRUE
Definition: types.h:120
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
_Inout_ PVOID Segment
Definition: exfuncs.h:1101

◆ _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;
112 //DPRINT("MmUnlockSectionSegment(%p,%s:%d)\n", Segment, file, line);
113}
#define FALSE
Definition: types.h:117
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
#define ASSERT(a)
Definition: mode.c:44

◆ 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
630 {
631 // The segment is carrying a dirty page.
632 PFN_NUMBER OldPage = PFN_FROM_SSE(Entry);
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,
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}
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
#define PAGE_SIZE
Definition: env_spec_w32.h:49
ULONG MmGetReferenceCountPageWithoutLock(PFN_NUMBER Page)
Definition: newcc.h:165
#define MiWriteBackPage(F, O, L, P)
Definition: newmm.h:156
#define DPRINTC
Definition: data.c:84
#define MmGetPageEntrySectionSegment(S, O)
Definition: mm.h:1602
#define MmSetPageEntrySectionSegment(S, O, E)
Definition: mm.h:1600
#define IS_DIRTY_SSE(E)
Definition: mm.h:1377
#define SWAPENTRY_FROM_SSE(E)
Definition: mm.h:1373
VOID NTAPI MmFreeSwapPage(SWAPENTRY Entry)
Definition: pagefile.c:291
#define PFN_FROM_SSE(E)
Definition: mm.h:1368
#define IS_SWAP_FROM_SSE(E)
Definition: mm.h:1369
NTSTATUS NTAPI MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
Definition: balance.c:72
ULONG PFN_NUMBER
Definition: ke.h:9
#define DPRINT
Definition: sndvol32.h:71
base of all file and directory entries
Definition: entries.h:83
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
* PFILE_OBJECT
Definition: iotypes.h:1998

◆ 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 NULL
Definition: types.h:112
#define ULONG_PTR
Definition: config.h:101
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
#define PAGE_ROUND_DOWN(x)
Definition: mmtypes.h:36
_In_ PMEMORY_AREA MemoryArea
Definition: newmm.h:207
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define DIRTY_SSE(E)
Definition: mm.h:1375
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1306
#define MA_GetStartingAddress(_MemoryArea)
Definition: mm.h:244
FORCEINLINE PEPROCESS MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace)
Definition: mm.h:1711
VOID NTAPI MmSetSavedSwapEntryPage(PFN_NUMBER Page, SWAPENTRY SavedSwapEntry)
Definition: freelist.c:483
VOID NTAPI MmDeleteRmap(PFN_NUMBER Page, struct _EPROCESS *Process, PVOID Address)
VOID NTAPI MmDeleteVirtualMapping(IN PEPROCESS Process, IN PVOID Address, OUT PBOOLEAN WasDirty, OUT PPFN_NUMBER Page)
Definition: page.c:177
static WCHAR Address[46]
Definition: ping.c:68
struct _MEMORY_AREA::@1787 SectionData
void * PVOID
Definition: typedefs.h:50
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2274

Variable Documentation

◆ MiSectionPageTableLock

KSPIN_LOCK MiSectionPageTableLock
extern

◆ MiSegmentList

LIST_ENTRY MiSegmentList

Definition at line 86 of file data.c.

Referenced by MiRosTrimCache(), and MmInitSystem().

◆ MmWorkingSetList

◆ MpwThreadEvent

KEVENT MpwThreadEvent
extern