- 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.


svn path=/trunk/; revision=43488
This commit is contained in:
ReactOS Portable Systems Group 2009-10-15 19:12:43 +00:00
parent b452b0b30a
commit 3b34847f3e
3 changed files with 73 additions and 53 deletions

View file

@ -157,6 +157,22 @@ extern PVOID MiSessionSpaceEnd;
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(

View file

@ -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 @@ MmAccessFault(IN BOOLEAN StoreInstruction,
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 @@ MmAccessFault(IN BOOLEAN StoreInstruction,
}
#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)

View file

@ -54,7 +54,6 @@ MM_STATS MmStats;
PMMPTE MmSharedUserDataPte;
PMMSUPPORT MmKernelAddressSpace;
extern KMUTANT MmSystemLoadLock;
extern ULONG MmBootImageSize;
BOOLEAN MiDbgEnableMdDump =
#ifdef _ARM_
TRUE;
@ -313,55 +312,6 @@ MiDbgDumpMemoryDescriptors(VOID)
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 @@ MmInitSystem(IN ULONG Phase,
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 @@ MmInitSystem(IN ULONG Phase,
//
// Now write a copy of it
//
TempPte.u.Hard.Owner = 1;
MI_MAKE_OWNER_PAGE(&TempPte);
TempPte.u.Hard.PageFrameNumber = PageFrameNumber;
*MmSharedUserDataPte = TempPte;