ReactOS  0.4.15-dev-506-ga3ec01c
dynamic.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: ntoskrnl/mm/ARM3/dynamic.c
5  * PURPOSE: ARM Memory Manager Dynamic Physical Memory Support
6  * PROGRAMMERS: ReactOS Portable Systems Group
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 <mm/ARM3/miarm.h>
17 
18 /* FUNCTIONS *****************************************************************/
19 
20 /*
21  * @unimplemented
22  */
24 NTAPI
27 {
30 }
31 
32 /*
33  * @unimplemented
34  */
36 NTAPI
39 {
42 }
43 
44 /*
45  * @unimplemented
46  */
48 NTAPI
51 {
54 }
55 
56 /*
57  * @unimplemented
58  */
60 NTAPI
63 {
66 }
67 
68 /*
69  * @implemented
70  */
72 NTAPI
74 {
75  ULONG Size, i;
77  KIRQL OldIrql;
79 
80  //
81  // Calculate how much memory we'll need
82  //
84 
85  //
86  // Allocate a copy
87  //
89  if (!Buffer) return NULL;
90 
91  //
92  // Lock the PFN database
93  //
95 
96  //
97  // Make sure it hasn't changed before we had acquired the lock
98  //
99  ASSERT(Size == (sizeof(PHYSICAL_MEMORY_RANGE) *
101 
102  //
103  // Now loop our block
104  //
105  for (i = 0; i < MmPhysicalMemoryBlock->NumberOfRuns; i++)
106  {
107  //
108  // Copy the data, but format it into bytes
109  //
110  Entry->BaseAddress.QuadPart = MmPhysicalMemoryBlock->Run[i].BasePage << PAGE_SHIFT;
111  Entry->NumberOfBytes.QuadPart = MmPhysicalMemoryBlock->Run[i].PageCount << PAGE_SHIFT;
112  Entry++;
113  }
114 
115  //
116  // Last entry is empty
117  //
118  Entry->BaseAddress.QuadPart = 0;
119  Entry->NumberOfBytes.QuadPart = 0;
120 
121  //
122  // Release the lock and return
123  //
125  return Buffer;
126 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
#define IN
Definition: typedefs.h:39
PHYSICAL_MEMORY_RANGE
Definition: mmtypes.h:162
struct _Entry Entry
Definition: kefuncs.h:627
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
LONG NTSTATUS
Definition: precomp.h:26
PFN_NUMBER PageCount
Definition: miarm.h:425
FORCEINLINE KIRQL MiAcquirePfnLock(VOID)
Definition: mm.h:901
PHYSICAL_MEMORY_RUN Run[1]
Definition: miarm.h:432
NTSTATUS NTAPI MmMarkPhysicalMemoryAsGood(IN PPHYSICAL_ADDRESS StartAddress, IN OUT PLARGE_INTEGER NumberOfBytes)
Definition: dynamic.c:49
FORCEINLINE VOID MiReleasePfnLock(_In_ KIRQL OldIrql)
Definition: mm.h:908
UCHAR KIRQL
Definition: env_spec_w32.h:591
NTSTATUS NTAPI MmAddPhysicalMemory(IN PPHYSICAL_ADDRESS StartAddress, IN OUT PLARGE_INTEGER NumberOfBytes)
Definition: dynamic.c:25
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
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
PFN_NUMBER BasePage
Definition: miarm.h:424
NTSTATUS NTAPI MmRemovePhysicalMemory(IN PPHYSICAL_ADDRESS StartAddress, IN OUT PLARGE_INTEGER NumberOfBytes)
Definition: dynamic.c:61
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock
Definition: init.c:45
* PPHYSICAL_MEMORY_RANGE
Definition: mmtypes.h:162
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
PPHYSICAL_MEMORY_RANGE NTAPI MmGetPhysicalMemoryRanges(VOID)
Definition: dynamic.c:73
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1000
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:115
NTSTATUS NTAPI MmMarkPhysicalMemoryAsBad(IN PPHYSICAL_ADDRESS StartAddress, IN OUT PLARGE_INTEGER NumberOfBytes)
Definition: dynamic.c:37
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
base of all file and directory entries
Definition: entries.h:82