Author: ros-arm-bringup Date: Thu Oct 15 21:12:43 2009 New Revision: 43488
URL: http://svn.reactos.org/svn/reactos?rev=43488&view=rev Log: - Collapse MmInit1 into MmInitSystem. - Check for ARM3-owned memory areas during a page fault, and crash the system as this shouldn't happen yet. - Use portable PTE macro instead of setting the owner bit directly, fixing an ARM port build issue.
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h trunk/reactos/ntoskrnl/mm/mmfault.c trunk/reactos/ntoskrnl/mm/mminit.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?re... ============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Thu Oct 15 21:12:43 2009 @@ -157,6 +157,22 @@ extern ULONG MmSizeOfPagedPoolInBytes; extern PMMPTE MmSystemPagePtes;
+NTSTATUS +NTAPI +MmArmInitSystem( + IN ULONG Phase, + IN PLOADER_PARAMETER_BLOCK LoaderBlock +); + +NTSTATUS +NTAPI +MmArmAccessFault( + IN BOOLEAN StoreInstruction, + IN PVOID Address, + IN KPROCESSOR_MODE Mode, + IN PVOID TrapInformation +); + VOID NTAPI MiInitializeArmPool(
Modified: trunk/reactos/ntoskrnl/mm/mmfault.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mmfault.c?rev=4... ============================================================================== --- trunk/reactos/ntoskrnl/mm/mmfault.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/mmfault.c [iso-8859-1] Thu Oct 15 21:12:43 2009 @@ -12,6 +12,9 @@ #define NDEBUG #include <debug.h>
+#define MODULE_INVOLVED_IN_ARM3 +#include "ARM3/miarm.h" + /* PRIVATE FUNCTIONS **********************************************************/
VOID @@ -256,6 +259,8 @@ IN KPROCESSOR_MODE Mode, IN PVOID TrapInformation) { + PMEMORY_AREA MemoryArea; + /* Cute little hack for ROS */ if ((ULONG_PTR)Address >= (ULONG_PTR)MmSystemRangeStart) { @@ -268,6 +273,20 @@ } #endif } + + // + // Check if this is an ARM3 memory area + // + MemoryArea = MmLocateMemoryAreaByAddress(MmGetKernelAddressSpace(), Address); + if ((MemoryArea) && (MemoryArea->Type == MEMORY_AREA_OWNED_BY_ARM3)) + { + // + // Hand it off to more competent hands... + // + UNIMPLEMENTED; + KeBugCheckEx(MEMORY_AREA_OWNED_BY_ARM3, Mode, (ULONG_PTR)Address, 0, 0); + //return MmArmAccessFault(StoreInstruction, Address, Mode, TrapInformation); + }
/* Keep same old ReactOS Behaviour */ if (StoreInstruction)
Modified: trunk/reactos/ntoskrnl/mm/mminit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=43... ============================================================================== --- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Thu Oct 15 21:12:43 2009 @@ -54,7 +54,6 @@ PMMPTE MmSharedUserDataPte; PMMSUPPORT MmKernelAddressSpace; extern KMUTANT MmSystemLoadLock; -extern ULONG MmBootImageSize; BOOLEAN MiDbgEnableMdDump = #ifdef _ARM_ TRUE; @@ -313,55 +312,6 @@ DPRINT1("Total: %08lX (%d MB)\n", TotalPages, (TotalPages * PAGE_SIZE) / 1024 / 1024); }
-NTSTATUS -NTAPI -MmArmInitSystem(IN ULONG Phase, - IN PLOADER_PARAMETER_BLOCK LoaderBlock); - -VOID -INIT_FUNCTION -NTAPI -MmInit1(VOID) -{ - /* Initialize the kernel address space */ - KeInitializeGuardedMutex(&PsGetCurrentProcess()->AddressCreationLock); - MmKernelAddressSpace = MmGetCurrentAddressSpace(); - MmInitGlobalKernelPageDirectory(); - - /* Dump memory descriptors */ - if (MiDbgEnableMdDump) MiDbgDumpMemoryDescriptors(); - - // - // Initialize ARM³ in phase 0 - // - MmArmInitSystem(0, KeLoaderBlock); - - /* Initialize the page list */ - MmInitializePageList(); - - // - // Initialize ARM³ in phase 1 - // - MmArmInitSystem(1, KeLoaderBlock); - - /* Put the paged pool after the loaded modules */ - MmPagedPoolBase = (PVOID)PAGE_ROUND_UP((ULONG_PTR)MmSystemRangeStart + - MmBootImageSize); - MmPagedPoolSize = MM_PAGED_POOL_SIZE; - - /* Intialize system memory areas */ - MiInitSystemMemoryAreas(); - - /* Dump the address space */ - MiDbgDumpAddressSpace(); - - /* Initialize paged pool */ - MmInitializePagedPool(); - - /* Initialize working sets */ - MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory); -} - BOOLEAN NTAPI MmInitSystem(IN ULONG Phase, @@ -374,8 +324,43 @@
if (Phase == 0) { - /* Initialize Mm bootstrap */ - MmInit1(); + /* Initialize the kernel address space */ + KeInitializeGuardedMutex(&PsGetCurrentProcess()->AddressCreationLock); + MmKernelAddressSpace = MmGetCurrentAddressSpace(); + MmInitGlobalKernelPageDirectory(); + + /* Dump memory descriptors */ + if (MiDbgEnableMdDump) MiDbgDumpMemoryDescriptors(); + + // + // Initialize ARM³ in phase 0 + // + MmArmInitSystem(0, KeLoaderBlock); + + /* Initialize the page list */ + MmInitializePageList(); + + // + // Initialize ARM³ in phase 1 + // + MmArmInitSystem(1, KeLoaderBlock); + + /* Put the paged pool after the loaded modules */ + MmPagedPoolBase = (PVOID)PAGE_ROUND_UP((ULONG_PTR)MmSystemRangeStart + + MmBootImageSize); + MmPagedPoolSize = MM_PAGED_POOL_SIZE; + + /* Intialize system memory areas */ + MiInitSystemMemoryAreas(); + + /* Dump the address space */ + MiDbgDumpAddressSpace(); + + /* Initialize paged pool */ + MmInitializePagedPool(); + + /* Initialize working sets */ + MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
/* Initialize the Loader Lock */ KeInitializeMutant(&MmSystemLoadLock, FALSE); @@ -422,7 +407,7 @@ // // Now write a copy of it // - TempPte.u.Hard.Owner = 1; + MI_MAKE_OWNER_PAGE(&TempPte); TempPte.u.Hard.PageFrameNumber = PageFrameNumber; *MmSharedUserDataPte = TempPte;