Author: akorotaev
Date: Wed Jan 2 22:36:10 2008
New Revision: 31568
URL:
http://svn.reactos.org/svn/reactos?rev=31568&view=rev
Log:
Merge that too. Now it links, but asserts at early boot phase.
Modified:
branches/cache_manager_rewrite/mm/i386/page.c
Modified: branches/cache_manager_rewrite/mm/i386/page.c
URL:
http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/mm/i386/p…
==============================================================================
--- branches/cache_manager_rewrite/mm/i386/page.c (original)
+++ branches/cache_manager_rewrite/mm/i386/page.c Wed Jan 2 22:36:10 2008
@@ -75,22 +75,23 @@
BOOLEAN MmUnmapPageTable(PULONG Pt);
-VOID
-STDCALL
-MiFlushTlbIpiRoutine(PVOID Address)
-{
- if (Address == (PVOID)0xffffffff)
+ULONG_PTR
+NTAPI
+MiFlushTlbIpiRoutine(ULONG_PTR Address)
+{
+ if (Address == (ULONG_PTR)-1)
{
KeFlushCurrentTb();
}
- else if (Address == (PVOID)0xfffffffe)
+ else if (Address == (ULONG_PTR)-2)
{
KeFlushCurrentTb();
}
else
{
- __invlpg(Address);
- }
+ __invlpg((PVOID)Address);
+ }
+ return 0;
}
VOID
@@ -101,13 +102,13 @@
{
MmUnmapPageTable(Pt);
}
- if (KeNumberProcessors>1)
- {
- KeIpiGenericCall(MiFlushTlbIpiRoutine, Address);
- }
- else
- {
- MiFlushTlbIpiRoutine(Address);
+ if (KeNumberProcessors > 1)
+ {
+ KeIpiGenericCall(MiFlushTlbIpiRoutine, (ULONG_PTR)Address);
+ }
+ else
+ {
+ MiFlushTlbIpiRoutine((ULONG_PTR)Address);
}
#else
if ((Pt && MmUnmapPageTable(Pt)) || Address >= MmSystemRangeStart)
@@ -325,17 +326,33 @@
}
NTSTATUS
+NTAPI
+MmInitializeHandBuiltProcess(IN PEPROCESS Process,
+ IN PLARGE_INTEGER DirectoryTableBase)
+{
+ /* Share the directory base with the idle process */
+ *DirectoryTableBase = PsGetCurrentProcess()->Pcb.DirectoryTableBase;
+
+ /* Initialize the Addresss Space */
+ MmInitializeAddressSpace(Process, (PMADDRESS_SPACE)&Process->VadRoot);
+
+ /* The process now has an address space */
+ Process->HasAddressSpace = TRUE;
+ return STATUS_SUCCESS;
+}
+
+BOOLEAN
STDCALL
-MmCopyMmInfo(PEPROCESS Src,
- PEPROCESS Dest,
- PPHYSICAL_ADDRESS DirectoryTableBase)
+MmCreateProcessAddressSpace(IN ULONG MinWs,
+ IN PEPROCESS Process,
+ IN PLARGE_INTEGER DirectoryTableBase)
{
NTSTATUS Status;
ULONG i, j;
PFN_TYPE Pfn[7];
ULONG Count;
- DPRINT("MmCopyMmInfo(Src %x, Dest %x)\n", Src, Dest);
+ DPRINT("MmCopyMmInfo(Src %x, Dest %x)\n", MinWs, Process);
Count = Ke386Pae ? 7 : 2;
@@ -344,11 +361,12 @@
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn[i]);
if (!NT_SUCCESS(Status))
{
- for (j = 0; j < i; j++)
- {
- MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn[j]);
- }
- return Status;
+ for (j = 0; j < i; j++)
+ {
+ MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn[j]);
+ }
+
+ return FALSE;
}
}
@@ -400,7 +418,7 @@
DirectoryTableBase->QuadPart = PFN_TO_PTE(Pfn[0]);
DPRINT("Finished MmCopyMmInfo(): %I64x\n",
DirectoryTableBase->QuadPart);
- return(STATUS_SUCCESS);
+ return TRUE;
}
VOID
@@ -625,7 +643,7 @@
if (Address < MmSystemRangeStart && Process && Process !=
PsGetCurrentProcess())
{
- PageDir =
MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart));
+ PageDir =
MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.LowPart));
if (PageDir == NULL)
{
KEBUGCHECK(0);
@@ -1925,8 +1943,16 @@
{
if (!MmIsUsablePage(Pages[i]))
{
- DPRINT1("Page at address %x not usable\n", PFN_TO_PTE(Pages[i]));
- KEBUGCHECK(0);
+ /* Is this an attempt to map KUSER_SHARED_DATA? */
+ if ((Address == (PVOID)0x7FFE0000) && (PageCount == 1) &&
(Pages[0] == 2))
+ {
+ // allow
+ }
+ else
+ {
+ DPRINT1("Page at address %x not usable\n", PFN_TO_PTE(Pages[i]));
+ KEBUGCHECK(0);
+ }
}
}