ReactOS 0.4.15-dev-7968-g24a56f8
shutdown.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/mm/shutdown.c
5 * PURPOSE: Memory Manager Shutdown
6 * PROGRAMMERS:
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include <ntoskrnl.h>
12#define NDEBUG
13#include <debug.h>
14
15#define MODULE_INVOLVED_IN_ARM3
16#include "ARM3/miarm.h"
17
18/* PRIVATE FUNCTIONS *********************************************************/
19
20VOID
22{
23 ULONG i;
25 BOOLEAN Dirty;
26
27 /* Loop through all the paging files */
28 for (i = 0; i < MmNumberOfPagingFiles; i++)
29 {
30 /* Free page file name */
31 ASSERT(MmPagingFile[i]->PageFileName.Buffer != NULL);
32 ExFreePoolWithTag(MmPagingFile[i]->PageFileName.Buffer, TAG_MM);
34
35 /* And close them */
37 }
38
39 /* Loop through all the pages owned by the legacy Mm and page them out, if needed. */
40 /* We do it as long as there are dirty pages, since flushing can cause the FS to dirtify new ones. */
41 do
42 {
43 Dirty = FALSE;
44
46 while (Page)
47 {
48 LARGE_INTEGER SegmentOffset;
50
51 if (Segment)
52 {
53 if ((*Segment->Flags) & MM_DATAFILE_SEGMENT)
54 {
56
58
60 {
61 Dirty = TRUE;
62 MmCheckDirtySegment(Segment, &SegmentOffset, FALSE, TRUE);
63 }
64
66 }
67
68 MmDereferenceSegment(Segment);
69 }
70
72 }
73 } while (Dirty);
74}
75
76VOID
78{
79 if (Phase == 0)
80 {
82 }
83 else if (Phase == 1)
84 {
85 ULONG i;
86
87 /* Loop through all the paging files */
88 for (i = 0; i < MmNumberOfPagingFiles; i++)
89 {
90 /* And dereference them */
92 }
93 }
94 else
95 {
96 ASSERT(Phase == 2);
97
99 }
100}
unsigned char BOOLEAN
#define UNIMPLEMENTED
Definition: debug.h:115
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
PMMPAGING_FILE MmPagingFile[MAX_PAGING_FILES]
Definition: pagefile.c:57
#define MmGetPageEntrySectionSegment(S, O)
Definition: mm.h:1602
#define MmLockSectionSegment(x)
Definition: mm.h:1397
#define MmUnlockSectionSegment(x)
Definition: mm.h:1405
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1306
#define IS_DIRTY_SSE(E)
Definition: mm.h:1377
PFN_NUMBER NTAPI MmGetLRUFirstUserPage(VOID)
Definition: freelist.c:45
BOOLEAN NTAPI MmCheckDirtySegment(PMM_SECTION_SEGMENT Segment, PLARGE_INTEGER Offset, BOOLEAN ForceDirty, BOOLEAN PageOut)
ULONG MmNumberOfPagingFiles
Definition: pagefile.c:63
PFN_NUMBER NTAPI MmGetLRUNextUserPage(PFN_NUMBER PreviousPage, BOOLEAN MoveToLast)
Definition: freelist.c:125
#define IS_SWAP_FROM_SSE(E)
Definition: mm.h:1369
#define MM_DATAFILE_SEGMENT
Definition: mm.h:238
VOID MmShutdownSystem(IN ULONG Phase)
Definition: shutdown.c:77
VOID MiShutdownSystem(VOID)
Definition: shutdown.c:21
ULONG PFN_NUMBER
Definition: ke.h:9
PMM_SECTION_SEGMENT NTAPI MmGetSectionAssociation(PFN_NUMBER Page, PLARGE_INTEGER Offset)
Definition: sptab.c:374
base of all file and directory entries
Definition: entries.h:83
UNICODE_STRING PageFileName
Definition: mm.h:507
#define TAG_MM
Definition: tag.h:113
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Inout_ PVOID Segment
Definition: exfuncs.h:1101
#define ObDereferenceObject
Definition: obfuncs.h:203