ReactOS 0.4.16-dev-1311-g81a4d83
|
#include <ntoskrnl.h>
#include <cache/newcc.h>
#include <cache/section/newmm.h>
#include <debug.h>
#include <reactos/exeformat.h>
#include "ARM3/miarm.h"
Go to the source code of this file.
Classes | |
struct | MM_SECTION_PAGEOUT_CONTEXT |
Macros | |
#define | NDEBUG |
#define | MmSetPageEntrySectionSegment(S, O, E) |
#define | DIE(ARGS_) { DPRINT ARGS_; goto l_Return; } |
Variables | |
MMSESSION | MmSession |
static LARGE_INTEGER | TinyTime = {{-1L, -1L}} |
KEVENT | MmWaitPageEvent |
POBJECT_TYPE | MmSectionObjectType = NULL |
ULONG_PTR | MmSubsectionBase |
static ULONG | SectionCharacteristicsToProtect [16] |
ACCESS_MASK | MmMakeFileAccess [8] |
static GENERIC_MAPPING | MmpSectionMapping |
static PEXEFMT_LOADER | ExeFmtpLoaders [] |
PLARGE_INTEGER | Offset |
PLARGE_INTEGER BOOLEAN | ForceDirty |
PLARGE_INTEGER BOOLEAN BOOLEAN | PageOut |
NTSTATUS | Status |
PFN_NUMBER | Page |
Entry = MmGetPageEntrySectionSegment(Segment, Offset) | |
return | FALSE |
_Requires_exclusive_lock_held_ | ( | Segment-> | Lock | ) |
_When_ | ( | OldIrql | = = MM_NOIRQL , |
_IRQL_requires_max_(DISPATCH_LEVEL) | |||
) |
Definition at line 988 of file section.c.
ASSERT | ( | Segment-> | Locked | ) |
C_ASSERT | ( | EXEFMT_LOAD_HEADER_SIZE >= | sizeofIMAGE_DOS_HEADER | ) |
C_ASSERT | ( | FIELD_OFFSET(IMAGE_NT_HEADERS32, OptionalHeader) | = =FIELD_OFFSET(IMAGE_NT_HEADERS64, OptionalHeader) | ) |
C_ASSERT | ( | PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, AddressOfEntryPoint) | ) |
C_ASSERT | ( | PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, FileAlignment) | ) |
C_ASSERT | ( | PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, Magic) | ) |
C_ASSERT | ( | PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, MajorSubsystemVersion) | ) |
C_ASSERT | ( | PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, MinorSubsystemVersion) | ) |
C_ASSERT | ( | PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SectionAlignment) | ) |
C_ASSERT | ( | PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SizeOfCode) | ) |
C_ASSERT | ( | PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SizeOfHeaders) | ) |
C_ASSERT | ( | PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, Subsystem) | ) |
C_ASSERT | ( | RTL_SIZEOF_THROUGH_FIELD(IMAGE_NT_HEADERS32, FileHeader) | = =RTL_SIZEOF_THROUGH_FIELD(IMAGE_NT_HEADERS64, FileHeader) | ) |
C_ASSERT | ( | sizeof(IMAGE_NT_HEADERS32)<=sizeof(IMAGE_NT_HEADERS64) | ) |
C_ASSERT | ( | TYPE_ALIGNMENT(IMAGE_NT_HEADERS32) | = =TYPE_ALIGNMENT(IMAGE_NT_HEADERS64) | ) |
DPRINT | ( | "Checking segment for file %wZ at offset 0x%I64X.\n" | , |
&Segment->FileObject-> | FileName, | ||
Offset-> | QuadPart | ||
) |
NTSTATUS NTAPI ElfFmtCreateSection | ( | IN CONST VOID * | FileHeader, |
IN SIZE_T | FileHeaderSize, | ||
IN PVOID | File, | ||
OUT PMM_IMAGE_SECTION_OBJECT | ImageSectionObject, | ||
OUT PULONG | Flags, | ||
IN PEXEFMT_CB_READ_FILE | ReadFileCb, | ||
IN PEXEFMT_CB_ALLOCATE_SEGMENTS | AllocateSegmentsCb | ||
) |
|
static |
Definition at line 2603 of file section.c.
Referenced by ExeFmtpCreateImageSection().
NTSTATUS ExeFmtpCreateImageSection | ( | PFILE_OBJECT | FileObject, |
PMM_IMAGE_SECTION_OBJECT | ImageSectionObject | ||
) |
Definition at line 3037 of file section.c.
Referenced by MmCreateImageSection().
|
static |
Definition at line 2623 of file section.c.
Referenced by ExeFmtpCreateImageSection().
|
static |
Definition at line 960 of file section.c.
Referenced by _When_().
if | ( | !IS_DIRTY_SSE(Entry) &&(SHARE_COUNT_FROM_SSE(Entry)==0) && | PageOut | ) |
Definition at line 5292 of file section.c.
if | ( | Entry | = = 0 | ) |
Definition at line 5156 of file section.c.
PMM_IMAGE_SECTION_OBJECT ImageSectionObjectFromSegment | ( | PMM_SECTION_SEGMENT | Segment | ) |
|
static |
Definition at line 1170 of file section.c.
Referenced by MmAccessFaultSectionView().
|
static |
Definition at line 90 of file section.c.
Referenced by MmCanFileBeTruncated(), MmFlushSegment(), MmIsDataSectionResident(), MmMakeDataSectionResident(), MmMakeSegmentDirty(), and MmPurgeSegment().
NTSTATUS MiMapViewInSystemSpace | ( | IN PVOID | Section, |
IN PVOID | Session, | ||
OUT PVOID * | MappedBase, | ||
IN OUT PSIZE_T | ViewSize, | ||
IN PLARGE_INTEGER | SectionOffset | ||
) |
|
static |
Definition at line 4322 of file section.c.
Referenced by MmFlushImageSection().
Definition at line 4569 of file section.c.
Referenced by MmUnmapViewInSystemSpace().
NTSTATUS NTAPI MiRosUnmapViewOfSection | ( | _In_ PEPROCESS | Process, |
_In_ PMEMORY_AREA | MemoryArea, | ||
_In_ PVOID | BaseAddress, | ||
_In_ BOOLEAN | SkipDebuggerNotify | ||
) |
Definition at line 3602 of file section.c.
Referenced by MiRosCleanupMemoryArea(), and MiUnmapViewOfSection().
NTSTATUS NTAPI MiWritePage | ( | PMM_SECTION_SEGMENT | Segment, |
LONGLONG | SegOffset, | ||
PFN_NUMBER | Page | ||
) |
Definition at line 238 of file section.c.
Referenced by FreeSegmentPage().
NTSTATUS NTAPI MmAccessFaultSectionView | ( | PMMSUPPORT | AddressSpace, |
MEMORY_AREA * | MemoryArea, | ||
PVOID | Address, | ||
BOOLEAN | Locked | ||
) |
Definition at line 1915 of file section.c.
Referenced by MmpAccessFault().
|
static |
Definition at line 1446 of file section.c.
Referenced by MmAccessFaultSectionView(), MmNotPresentFaultSectionView(), and MmProtectSectionView().
BOOLEAN NTAPI MmCanFileBeTruncated | ( | _In_ PSECTION_OBJECT_POINTERS | SectionObjectPointer, |
_In_opt_ PLARGE_INTEGER | NewFileSize | ||
) |
Definition at line 4267 of file section.c.
Referenced by Ext2SetFileInformation(), Ext2SupersedeOrOverWriteFile(), NtfsSetEndOfFile(), open_file2(), RxCommonSetInformation(), set_end_of_file_information(), SetAttributeDataLength(), UDFCommonCreate(), UDFSetAllocationInformation(), UDFSetEOF(), VfatSetAllocationSizeInformation(), and VfatSetInformation().
NTSTATUS NTAPI MmCreateArm3Section | ( | OUT PVOID * | SectionObject, |
IN ACCESS_MASK | DesiredAccess, | ||
IN POBJECT_ATTRIBUTES ObjectAttributes | OPTIONAL, | ||
IN PLARGE_INTEGER | InputMaximumSize, | ||
IN ULONG | SectionPageProtection, | ||
IN ULONG | AllocationAttributes, | ||
IN HANDLE FileHandle | OPTIONAL, | ||
IN PFILE_OBJECT FileObject | OPTIONAL | ||
) |
Definition at line 2102 of file section.c.
Referenced by MmCreateSection().
|
static |
Definition at line 2340 of file section.c.
Referenced by MmCreateSection().
NTSTATUS MmCreateImageSection | ( | PSECTION * | SectionObject, |
ACCESS_MASK | DesiredAccess, | ||
POBJECT_ATTRIBUTES | ObjectAttributes, | ||
PLARGE_INTEGER | UMaximumSize, | ||
ULONG | SectionPageProtection, | ||
ULONG | AllocationAttributes, | ||
PFILE_OBJECT | FileObject | ||
) |
Definition at line 3190 of file section.c.
Referenced by MmCreateSection().
Definition at line 2216 of file section.c.
Referenced by MmInitSectionImplementation().
NTSTATUS NTAPI MmCreateSection | ( | OUT PVOID * | Section, |
IN ACCESS_MASK | DesiredAccess, | ||
IN POBJECT_ATTRIBUTES ObjectAttributes | OPTIONAL, | ||
IN PLARGE_INTEGER | MaximumSize, | ||
IN ULONG | SectionPageProtection, | ||
IN ULONG | AllocationAttributes, | ||
IN HANDLE FileHandle | OPTIONAL, | ||
IN PFILE_OBJECT FileObject | OPTIONAL | ||
) |
Definition at line 4632 of file section.c.
Referenced by CcpAllocateSection(), CcRosInitializeFileCache(), EngCreateSection(), EngCreateSectionHack(), EngLoadModuleEx(), InitGdiHandleTable(), IntGdiAddFontResourceSingle(), NtCreateSection(), TestCreateSection(), TestPhysicalMemorySection(), and UserCreateHeap().
Definition at line 5390 of file section.c.
Referenced by CcSetFileSizes(), and NtExtendSection().
BOOLEAN NTAPI MmFlushImageSection | ( | IN PSECTION_OBJECT_POINTERS | SectionObjectPointer, |
IN MMFLUSH_TYPE | FlushType | ||
) |
Definition at line 4368 of file section.c.
Referenced by _Requires_lock_held_(), Ext2CreateFile(), Ext2IsFileRemovable(), Ext2PurgeFile(), Ext2PurgeVolume(), FatSetRenameInfo(), open_file3(), RxCommonSetInformation(), RxPurgeFcbInSystemCache(), RxPurgeFobx(), RxPurgeNetFcb(), set_disposition_information(), UDFCloseAllXXXDelayedInDir(), UDFCommonCreate(), UDFMarkStreamsForDeletion(), UDFSetDispositionInformation(), VfatCreateFile(), vfatPrepareTargetForRename(), and VfatSetDispositionInformation().
NTSTATUS NTAPI MmFlushSegment | ( | _In_ PSECTION_OBJECT_POINTERS | SectionObjectPointer, |
_In_opt_ PLARGE_INTEGER | Offset, | ||
_In_ ULONG | Length, | ||
_Out_opt_ PIO_STATUS_BLOCK | Iosb | ||
) |
Definition at line 5058 of file section.c.
Referenced by CcFlushCache(), CcRosDeleteFileCache(), CcRosFlushVacb(), and MiRosUnmapViewOfSection().
|
static |
Definition at line 3454 of file section.c.
Referenced by MmUnmapViewOfSegment().
Definition at line 2307 of file section.c.
Referenced by MmInitSystem().
BOOLEAN NTAPI MmIsDataSectionResident | ( | _In_ PSECTION_OBJECT_POINTERS | SectionObjectPointer, |
_In_ LONGLONG | Offset, | ||
_In_ ULONG | Length | ||
) |
Definition at line 4939 of file section.c.
Referenced by CcRosEnsureVacbResident().
NTSTATUS NTAPI MmMakeDataSectionResident | ( | _In_ PSECTION_OBJECT_POINTERS | SectionObjectPointer, |
_In_ LONGLONG | Offset, | ||
_In_ ULONG | Length, | ||
_In_ PLARGE_INTEGER | ValidDataLength | ||
) |
Definition at line 4981 of file section.c.
Referenced by CcRosEnsureVacbResident().
NTSTATUS NTAPI MmMakeSegmentDirty | ( | _In_ PSECTION_OBJECT_POINTERS | SectionObjectPointer, |
_In_ LONGLONG | Offset, | ||
_In_ ULONG | Length | ||
) |
Definition at line 5001 of file section.c.
Referenced by CcCopyWrite(), CcSetDirtyPinnedData(), and CcZeroData().
|
static |
Definition at line 1192 of file section.c.
Referenced by MmMakeDataSectionResident(), and MmNotPresentFaultSectionView().
NTSTATUS NTAPI MmMapViewInSystemSpace | ( | IN PVOID | SectionObject, |
OUT PVOID * | MappedBase, | ||
IN OUT PSIZE_T | ViewSize | ||
) |
Definition at line 4459 of file section.c.
Referenced by ExpInitNls(), IntGdiAddFontResourceSingle(), and MmMapViewInSessionSpace().
NTSTATUS NTAPI MmMapViewInSystemSpaceEx | ( | _In_ PVOID | SectionObject, |
_Outptr_result_bytebuffer_ *ViewSize PVOID * | MappedBase, | ||
_Inout_ PSIZE_T | ViewSize, | ||
_Inout_ PLARGE_INTEGER | SectionOffset, | ||
_In_ ULONG_PTR | Flags | ||
) |
Definition at line 4472 of file section.c.
Referenced by CcRosCreateVacb(), and MmMapViewInSystemSpace().
NTSTATUS NTAPI MmMapViewOfArm3Section | ( | IN PVOID | SectionObject, |
IN PEPROCESS | Process, | ||
IN OUT PVOID * | BaseAddress, | ||
IN ULONG_PTR | ZeroBits, | ||
IN SIZE_T | CommitSize, | ||
IN OUT PLARGE_INTEGER SectionOffset | OPTIONAL, | ||
IN OUT PSIZE_T | ViewSize, | ||
IN SECTION_INHERIT | InheritDisposition, | ||
IN ULONG | AllocationType, | ||
IN ULONG | Protect | ||
) |
Definition at line 2531 of file section.c.
Referenced by MmMapViewOfSection().
NTSTATUS NTAPI MmMapViewOfSection | ( | IN PVOID | SectionObject, |
IN PEPROCESS | Process, | ||
IN OUT PVOID * | BaseAddress, | ||
IN ULONG_PTR | ZeroBits, | ||
IN SIZE_T | CommitSize, | ||
IN OUT PLARGE_INTEGER SectionOffset | OPTIONAL, | ||
IN OUT PSIZE_T | ViewSize, | ||
IN SECTION_INHERIT | InheritDisposition, | ||
IN ULONG | AllocationType, | ||
IN ULONG | Protect | ||
) |
Definition at line 4009 of file section.c.
Referenced by _Function_class_(), _Success_(), ExpInitNls(), GDI_MapHandleTable(), IntMapDesktopView(), IntUserHeapCreate(), MapGlobalUserHeap(), MiLoadImageSection(), MmCreatePeb(), MmInitializeProcessAddressSpace(), NtMapViewOfSection(), NtSecureConnectPort(), and PspMapSystemDll().
|
static |
Definition at line 3375 of file section.c.
Referenced by MmMapViewInSystemSpaceEx(), and MmMapViewOfSection().
NTSTATUS NTAPI MmNotPresentFaultSectionView | ( | PMMSUPPORT | AddressSpace, |
MEMORY_AREA * | MemoryArea, | ||
PVOID | Address, | ||
BOOLEAN | Locked | ||
) |
Definition at line 1537 of file section.c.
Referenced by MmAccessFaultSectionView(), and MmNotPresentFault().
VOID NTAPI MmpCloseSection | ( | IN PEPROCESS Process | OPTIONAL, |
IN PVOID | Object, | ||
IN ACCESS_MASK | GrantedAccess, | ||
IN ULONG | ProcessHandleCount, | ||
IN ULONG | SystemHandleCount | ||
) |
Definition at line 2151 of file section.c.
Referenced by MmInitSectionImplementation().
VOID NTAPI MmpFreePageFileSegment | ( | PMM_SECTION_SEGMENT | Segment | ) |
NTSTATUS NTAPI MmProtectSectionView | ( | PMMSUPPORT | AddressSpace, |
PMEMORY_AREA | MemoryArea, | ||
PVOID | BaseAddress, | ||
SIZE_T | Length, | ||
ULONG | Protect, | ||
PULONG | OldProtect | ||
) |
Definition at line 2068 of file section.c.
Referenced by MiProtectVirtualMemory().
BOOLEAN NTAPI MmPurgeSegment | ( | _In_ PSECTION_OBJECT_POINTERS | SectionObjectPointer, |
_In_opt_ PLARGE_INTEGER | Offset, | ||
_In_ ULONG | Length | ||
) |
Definition at line 4844 of file section.c.
Referenced by CcPurgeCacheSection().
NTSTATUS NTAPI MmQuerySectionView | ( | PMEMORY_AREA | MemoryArea, |
PVOID | Address, | ||
PMEMORY_BASIC_INFORMATION | Info, | ||
PSIZE_T | ResultLength | ||
) |
Definition at line 2112 of file section.c.
Referenced by MiQueryMemoryBasicInformation().
VOID NTAPI MmSharePageEntrySectionSegment | ( | PMM_SECTION_SEGMENT | Segment, |
PLARGE_INTEGER | Offset | ||
) |
Definition at line 1064 of file section.c.
Referenced by MmNotPresentFaultSectionView().
|
static |
Definition at line 2720 of file section.c.
Referenced by MmspCheckSegmentBounds().
|
static |
Definition at line 2742 of file section.c.
Referenced by MmspPageAlignSegments().
|
static |
Definition at line 2706 of file section.c.
Referenced by MmspAssertSegmentsNoOverlap(), and MmspSortSegments().
|
static |
Definition at line 2802 of file section.c.
Referenced by ExeFmtpCreateImageSection().
Definition at line 2757 of file section.c.
Referenced by MmspSortSegments().
|
static |
Definition at line 2853 of file section.c.
Referenced by ExeFmtpCreateImageSection().
|
static |
Definition at line 2777 of file section.c.
Referenced by ExeFmtpCreateImageSection().
NTSTATUS MmspWaitForFileLock | ( | PFILE_OBJECT | File | ) |
Definition at line 907 of file section.c.
Referenced by MmCreateDataFileSection(), and MmCreateImageSection().
|
static |
Definition at line 3538 of file section.c.
Referenced by MiRosUnmapViewInSystemSpace(), MiRosUnmapViewOfSection(), and MmMapViewOfSection().
BOOLEAN NTAPI MmUnsharePageEntrySectionSegment | ( | PMEMORY_AREA | MemoryArea, |
PMM_SECTION_SEGMENT | Segment, | ||
PLARGE_INTEGER | Offset, | ||
BOOLEAN | Dirty, | ||
BOOLEAN | PageOut, | ||
ULONG_PTR * | InEntry | ||
) |
Definition at line 1089 of file section.c.
Referenced by MmAccessFaultSectionView(), MmFreeSectionPage(), and MmPageOutPhysicalAddress().
NTSTATUS NTAPI NtQuerySection | ( | _In_ HANDLE | SectionHandle, |
_In_ SECTION_INFORMATION_CLASS | SectionInformationClass, | ||
_Out_ PVOID | SectionInformation, | ||
_In_ SIZE_T | SectionInformationLength, | ||
_Out_opt_ PSIZE_T | ResultLength | ||
) |
Queries the information of a section object.
SectionHandle | Handle to the section object. It must be opened with SECTION_QUERY access. |
SectionInformationClass | Index to a certain information structure. Can be either SectionBasicInformation or SectionImageInformation. The latter is valid only for sections that were created with the SEC_IMAGE flag. |
SectionInformation | Caller supplies storage for resulting information. |
Length | Size of the supplied storage. |
ResultLength | Data written. |
@implemented
Definition at line 3781 of file section.c.
Referenced by CreateProcessInternalW(), get_binary_type(), QuerySbi(), and Test_SectionBasicInformation().
NTSTATUS NTAPI PeFmtCreateSection | ( | IN CONST VOID * | FileHeader, |
IN SIZE_T | FileHeaderSize, | ||
IN PVOID | File, | ||
OUT PMM_IMAGE_SECTION_OBJECT | ImageSectionObject, | ||
OUT PULONG | Flags, | ||
IN PEXEFMT_CB_READ_FILE | ReadFileCb, | ||
IN PEXEFMT_CB_ALLOCATE_SEGMENTS | AllocateSegmentsCb | ||
) |
Definition at line 285 of file section.c.
|
static |
Definition at line 2592 of file section.c.
Referenced by ExeFmtpCreateImageSection().
PLARGE_INTEGER BOOLEAN ForceDirty |
|
extern |
Definition at line 32 of file section.c.
Referenced by MmCreateArm3Section(), and MmCreateSection().
|
static |
Definition at line 223 of file section.c.
Referenced by MmInitSectionImplementation().
POBJECT_TYPE MmSectionObjectType = NULL |
Definition at line 194 of file section.c.
Referenced by CheckSection_(), ExpInitNls(), MmCreateArm3Section(), MmCreateDataFileSection(), MmCreateImageSection(), MmCreatePhysicalMemorySection(), MmInitSectionImplementation(), MmLoadSystemImage(), NtExtendSection(), NtMapViewOfSection(), NtOpenSection(), NtQuerySection(), NtSecureConnectPort(), ObpLookupObjectName(), PsLocateSystemDll(), PspCreateProcess(), and TestObjectTypes().
|
extern |
Definition at line 107 of file section.c.
Referenced by MiInitializeSystemSpaceMap(), MiInsertInSystemSpace(), MiMapViewInSystemSpace(), MmMapViewInSystemSpaceEx(), and MmUnmapViewInSystemSpace().
ULONG_PTR MmSubsectionBase |
Definition at line 196 of file section.c.
Referenced by MI_MAKE_SUBSECTION_PTE(), and MiInitMachineDependent().
KEVENT MmWaitPageEvent |
Definition at line 66 of file section.c.
Referenced by MmInitSystem().
Definition at line 5141 of file section.c.
Referenced by ExeFmtpCreateImageSection(), ExeFmtpReadFile(), MiPurgeImageSegment(), MmAccessFaultSectionView(), MmAlterViewAttributes(), MmFlushSegment(), MmFreeSectionPage(), MmIsDataSectionResident(), MmMakeSegmentDirty(), MmNotPresentFaultSectionView(), and MmpFreePageFileSegment().
PFN_NUMBER Page |
Definition at line 5147 of file section.c.
Referenced by FreeSegmentPage(), if(), MiWritePage(), MmAlterViewAttributes(), MmFreeSectionPage(), MmNotPresentFaultSectionView(), MmpFreePageFileSegment(), and MmUnsharePageEntrySectionSegment().
PLARGE_INTEGER BOOLEAN BOOLEAN PageOut |
Definition at line 5143 of file section.c.
Referenced by MmUnsharePageEntrySectionSegment().
|
static |
|
static |
Definition at line 63 of file section.c.
Referenced by MiGrabDataSection(), MmAlterViewAttributes(), MmCreateDataFileSection(), MmCreateImageSection(), MmFlushImageSection(), MmFreeSectionPage(), MmMakeSegmentDirty(), MmMakeSegmentResident(), MmNotPresentFaultSectionView(), MmPurgeSegment(), and MmRequestPageMemoryConsumer().