Author: ros-arm-bringup
Date: Sun Jun 28 02:39:03 2009
New Revision: 41649
URL:
http://svn.reactos.org/svn/reactos?rev=41649&view=rev
Log:
- Actually it seems MmGetPhysicalMemoryRanges uses the MmPhysicalMemoryBlock, so go ahead
and implement that function.
- Thanks to Matthieu Suiche
(
http://www.msuiche.net/2008/09/17/retrieving-mmphysicalmemoryblock-regardle…).
- Move physical.c into ARM3 and call it dynamic.c since these functions are for Dynamic
Memory (Hotplug) for Server 2003.
- Remove the old copyright header, as copy-pasting 5 DDK function definitions and
rewriting them to say UNIMPLEMENTED isn't much of a copyright.
Added:
trunk/reactos/ntoskrnl/mm/ARM3/dynamic.c
- copied, changed from r41647, trunk/reactos/ntoskrnl/mm/physical.c
Removed:
trunk/reactos/ntoskrnl/mm/physical.c
Modified:
trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild
Copied: trunk/reactos/ntoskrnl/mm/ARM3/dynamic.c (from r41647,
trunk/reactos/ntoskrnl/mm/physical.c)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/dynamic.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/physical.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/dynamic.c [iso-8859-1] Sun Jun 28 02:39:03 2009
@@ -1,16 +1,20 @@
/*
* PROJECT: ReactOS Kernel
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: ntoskrnl/mm/physical.c
- * PURPOSE: Physical Memory Manipulation Routines
- * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ * LICENSE: BSD - See COPYING.ARM in the top level directory
+ * FILE: ntoskrnl/mm/ARM3/dynamic.c
+ * PURPOSE: ARM Memory Manager Dynamic Physical Memory Support
+ * PROGRAMMERS: ReactOS Portable Systems Group
*/
-/* INCLUDES *****************************************************************/
+/* INCLUDES *******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
+
+#line 15 "ARM³::DYNAMIC"
+#define MODULE_INVOLVED_IN_ARM3
+#include "../ARM3/miarm.h"
/* FUNCTIONS *****************************************************************/
@@ -63,12 +67,61 @@
}
/*
- * @unimplemented
+ * @implemented
*/
PPHYSICAL_MEMORY_RANGE
NTAPI
MmGetPhysicalMemoryRanges(VOID)
{
- UNIMPLEMENTED;
- return 0;
+ ULONG Size, i;
+ PPHYSICAL_MEMORY_RANGE Entry, Buffer;
+ KIRQL OldIrql;
+ ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);
+
+ //
+ // Calculate how much memory we'll need
+ //
+ Size = sizeof(PHYSICAL_MEMORY_RANGE) * (MmPhysicalMemoryBlock->NumberOfRuns + 1);
+
+ //
+ // Allocate a copy
+ //
+ Entry = Buffer = ExAllocatePoolWithTag(NonPagedPool, Size, 'hPmM');
+ if (!Buffer) return NULL;
+
+ //
+ // Lock the PFN database
+ //
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+
+ //
+ // Make sure it hasn't changed before we had acquired the lock
+ //
+ ASSERT(Size == (sizeof(PHYSICAL_MEMORY_RANGE) *
+ (MmPhysicalMemoryBlock->NumberOfRuns + 1)));
+
+ //
+ // Now loop our block
+ //
+ for (i = 0; i < MmPhysicalMemoryBlock->NumberOfRuns; i++)
+ {
+ //
+ // Copy the data, but format it into bytes
+ //
+ Entry->BaseAddress.QuadPart = MmPhysicalMemoryBlock->Run[i].BasePage
<< PAGE_SHIFT;
+ Entry->NumberOfBytes.QuadPart = MmPhysicalMemoryBlock->Run[i].PageCount
<< PAGE_SHIFT;
+ Entry++;
+ }
+
+ //
+ // Last entry is empty
+ //
+ Entry->BaseAddress.QuadPart = 0;
+ Entry->NumberOfBytes.QuadPart = 0;
+
+ //
+ // Release the lock and return
+ //
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
+ return Buffer;
}
Removed: trunk/reactos/ntoskrnl/mm/physical.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/physical.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/physical.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/physical.c (removed)
@@ -1,74 +1,0 @@
-/*
- * PROJECT: ReactOS Kernel
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: ntoskrnl/mm/physical.c
- * PURPOSE: Physical Memory Manipulation Routines
- * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <debug.h>
-
-/* FUNCTIONS *****************************************************************/
-
-/*
- * @unimplemented
- */
-NTSTATUS
-NTAPI
-MmAddPhysicalMemory (IN PPHYSICAL_ADDRESS StartAddress,
- IN OUT PLARGE_INTEGER NumberOfBytes)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS
-NTAPI
-MmMarkPhysicalMemoryAsBad(IN PPHYSICAL_ADDRESS StartAddress,
- IN OUT PLARGE_INTEGER NumberOfBytes)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS
-NTAPI
-MmMarkPhysicalMemoryAsGood(IN PPHYSICAL_ADDRESS StartAddress,
- IN OUT PLARGE_INTEGER NumberOfBytes)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS
-NTAPI
-MmRemovePhysicalMemory(IN PPHYSICAL_ADDRESS StartAddress,
- IN OUT PLARGE_INTEGER NumberOfBytes)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-/*
- * @unimplemented
- */
-PPHYSICAL_MEMORY_RANGE
-NTAPI
-MmGetPhysicalMemoryRanges(VOID)
-{
- UNIMPLEMENTED;
- return 0;
-}
Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-generic.…
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Sun Jun 28 02:39:03 2009
@@ -360,6 +360,7 @@
</directory>
</if>
<directory name="ARM3">
+ <file>dynamic.c</file>
<file>hypermap.c</file>
<file>init.c</file>
<file>iosup.c</file>
@@ -384,7 +385,6 @@
<file>pagefile.c</file>
<file>pageop.c</file>
<file>pe.c</file>
- <file>physical.c</file>
<file>pool.c</file>
<file>ppool.c</file>
<file>procsup.c</file>