Author: ros-arm-bringup
Date: Sat Jun 27 11:14:52 2009
New Revision: 41634
URL: http://svn.reactos.org/svn/reactos?rev=41634&view=rev
Log:
- Allocate enough space for the ARM3 PFN database, and fixup the calculation of the initial nonpaged pool.
- The ARM3 PFN database is more of a "shadow" database not to interfere with the real ReactOS PFN database. It starts at 0xB0000000, which is where the initial nonpaged pool started (which now starts somewhere after the ARM3 PFN database).
- No new behavior has been introduced other than additional physical memory consumption for the PFN DB pages, and updated memory layout in the ARM3 world.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/init.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/init.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/init.c [iso-8859-1] Sat Jun 27 11:14:52 2009
@@ -52,8 +52,8 @@
// immediately follows the PFN database, typically sharing the same PDE. It is
// a very small resource (32MB on a 1GB system), and capped at 128MB.
//
-// Right now, we call this the "ARM Pool" and it begins at 0xB0000000 since we
-// don't want to interefere with the ReactOS memory manager PFN database (yet).
+// Right now, we call this the "ARM Pool" and it begins somewhere after the ARM
+// PFN database (which starts at 0xB0000000).
//
// The expansion nonpaged pool, on the other hand, can grow much bigger (400MB
// for a 1GB system). On ARM³ however, it is currently capped at 128MB.
@@ -101,6 +101,18 @@
// aligned up to a PDE boundary (4MB).
//
ULONG MmNumberOfSystemPtes;
+
+//
+// This is how many pages the PFN database will take up
+// In Windows, this includes the Quark Color Table, but not in ARM³
+//
+ULONG MxPfnAllocation;
+
+
+//
+// The ARM³ PFN Database
+//
+PMMPFN MmArmPfnDatabase;
/* PRIVATE FUNCTIONS **********************************************************/
@@ -276,6 +288,12 @@
}
//
+ // Calculate the number of bytes, and then convert to pages
+ //
+ MxPfnAllocation = (MmHighestPhysicalPage + 1) * sizeof(MMPFN);
+ MxPfnAllocation >>= PAGE_SHIFT;
+
+ //
// Now calculate the nonpaged pool expansion VA region
//
MmNonPagedPoolStart = (PVOID)((ULONG_PTR)MmNonPagedPoolEnd -
@@ -315,32 +333,44 @@
MmNumberOfSystemPtes--;
ASSERT(MmNumberOfSystemPtes > 1000);
}
+
+ //
+ // Normally, the PFN database should start after the loader images.
+ // This is already the case in ReactOS, but for now we want to co-exist
+ // with the old memory manager, so we'll create a "Shadow PFN Database"
+ // instead, and arbitrarly start it at 0xB0000000.
+ //
+ MmArmPfnDatabase = (PVOID)0xB0000000;
+ ASSERT(((ULONG_PTR)MmArmPfnDatabase & ((4 * 1024 * 1024) - 1)) == 0);
//
- // Non paged pool should come after the PFN database, but since we are
- // co-existing with the ReactOS NP pool, our "ARM Pool" will instead
- // start at this arbitrarly chosen base address.
- // When ARM pool becomes non paged pool, this needs to be changed.
+ // Non paged pool comes after the PFN database
//
DPRINT1("System PTE VA starts at: %p\n", MmNonPagedSystemStart);
DPRINT1("NP Expansion VA begins at: %p and ends at: %p\n",
MmNonPagedPoolStart, MmNonPagedPoolEnd);
- MmNonPagedPoolStart = (PVOID)0xB0000000;
+ MmNonPagedPoolStart = (PVOID)((ULONG_PTR)MmArmPfnDatabase +
+ (MxPfnAllocation << PAGE_SHIFT));
//
// Now we actually need to get these many physical pages. Nonpaged pool
// is actually also physically contiguous (but not the expansion)
//
- PageFrameIndex = MmGetContinuousPages(MmSizeOfNonPagedPoolInBytes,
+ PageFrameIndex = MmGetContinuousPages(MmSizeOfNonPagedPoolInBytes +
+ (MxPfnAllocation << PAGE_SHIFT),
Low,
High,
BoundaryAddressMultiple,
FALSE);
ASSERT(PageFrameIndex != 0);
+ DPRINT1("PFN DB VA begins at: %p and ends at: %p\n",
+ MmArmPfnDatabase,
+ (ULONG_PTR)MmArmPfnDatabase + (MxPfnAllocation << PAGE_SHIFT));
+ DPRINT1("PFN DB PA PFN begins at: %lx\n", PageFrameIndex);
DPRINT1("NP VA begins at: %p and ends at: %p\n",
MmNonPagedPoolStart,
(ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes);
- DPRINT1("NP PA PFN begins at: %lx\n", PageFrameIndex);
+ DPRINT1("NP PA PFN begins at: %lx\n", PageFrameIndex + MxPfnAllocation);
//
// Now we need some pages to create the page tables for the NP system VA
@@ -377,7 +407,7 @@
//
// Now we need pages for the page tables which will map initial NP
//
- StartPde = MiAddressToPde(MmNonPagedPoolStart);
+ StartPde = MiAddressToPde(MmArmPfnDatabase);
EndPde = MiAddressToPde((PVOID)((ULONG_PTR)MmNonPagedPoolStart +
MmSizeOfNonPagedPoolInBytes - 1));
while (StartPde <= EndPde)
Author: cgutman
Date: Sat Jun 27 10:59:22 2009
New Revision: 41632
URL: http://svn.reactos.org/svn/reactos?rev=41632&view=rev
Log:
- The timeout value passed to tsleep is in milliseconds and so_linger is in seconds so convert to milliseconds
Modified:
trunk/reactos/lib/drivers/oskittcp/oskittcp/uipc_socket.c
Modified: trunk/reactos/lib/drivers/oskittcp/oskittcp/uipc_socket.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/oskittcp/oskit…
==============================================================================
--- trunk/reactos/lib/drivers/oskittcp/oskittcp/uipc_socket.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/oskittcp/oskittcp/uipc_socket.c [iso-8859-1] Sat Jun 27 10:59:22 2009
@@ -190,7 +190,7 @@
goto drop;
while (so->so_state & SS_ISCONNECTED) {
error = tsleep((caddr_t)&so->so_timeo,
- PSOCK | PCATCH, netcls, so->so_linger);
+ PSOCK | PCATCH, netcls, so->so_linger * 1000);
if (error)
break;
}
Author: ros-arm-bringup
Date: Sat Jun 27 09:32:53 2009
New Revision: 41631
URL: http://svn.reactos.org/svn/reactos?rev=41631&view=rev
Log:
- Blow away the bottom 2GB of virtual address space in the ARM^3 initializer. Previously this was kind of done with MmUnmapPageTable in MmInit1, but this code (And the function, which had only been used for this purpose, are gone)
- Also set the Page Directory for the system/idle process in a slightly more correct way, instead of depending on the CR3 value. Do this in ARM^3 now, and remove the older code (and the MmGetPageDirectory function, which was only used by this).
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/init.c
trunk/reactos/ntoskrnl/mm/i386/page.c
trunk/reactos/ntoskrnl/mm/mminit.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/init.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/init.c [iso-8859-1] Sat Jun 27 09:32:53 2009
@@ -146,6 +146,20 @@
if (Phase == 0)
{
//
+ // Set CR3 for the system process
+ //
+ PointerPte = MiAddressToPde(PAGETABLE_MAP);
+ PageFrameIndex = PFN_FROM_PTE(PointerPte) << PAGE_SHIFT;
+ PsGetCurrentProcess()->Pcb.DirectoryTableBase[0] = PageFrameIndex;
+
+ //
+ // Blow away user-mode
+ //
+ StartPde = MiAddressToPde(0);
+ EndPde = MiAddressToPde(KSEG0_BASE);
+ RtlZeroMemory(StartPde, (EndPde - StartPde) * sizeof(MMPTE));
+
+ //
// Check if this is a machine with less than 19MB of RAM
//
if (MmNumberOfPhysicalPages < MI_MIN_PAGES_FOR_SYSPTE_TUNING)
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Sat Jun 27 09:32:53 2009
@@ -71,12 +71,6 @@
}
}
-PULONG
-MmGetPageDirectory(VOID)
-{
- return (PULONG)(ULONG_PTR)__readcr3();
-}
-
static ULONG
ProtectToPTE(ULONG flProtect)
{
@@ -224,32 +218,6 @@
DirectoryTableBase[1] = 0;
DPRINT("Finished MmCopyMmInfo(): 0x%x\n", DirectoryTableBase[0]);
return TRUE;
-}
-
-VOID
-NTAPI
-MmDeletePageTable(PEPROCESS Process, PVOID Address)
-{
- PEPROCESS CurrentProcess = PsGetCurrentProcess();
-
- if (Process != NULL && Process != CurrentProcess)
- {
- KeAttachProcess(&Process->Pcb);
- }
-
- MiAddressToPde(Address)->u.Long = 0;
- MiFlushTlb((PULONG)MiAddressToPde(Address),
- MiAddressToPte(Address));
-
- if (Address >= MmSystemRangeStart)
- {
- KeBugCheck(MEMORY_MANAGEMENT);
- // MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0;
- }
- if (Process != NULL && Process != CurrentProcess)
- {
- KeDetachProcess();
- }
}
static PULONG
Modified: trunk/reactos/ntoskrnl/mm/mminit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=4…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Sat Jun 27 09:32:53 2009
@@ -305,9 +305,6 @@
/* Dump memory descriptors */
if (MiDbgEnableMdDump) MiDbgDumpMemoryDescriptors();
- /* Set the page directory */
- PsGetCurrentProcess()->Pcb.DirectoryTableBase[0] = (ULONG)MmGetPageDirectory();
-
/* Get the size of FreeLDR's image allocations */
MmBootImageSize = KeLoaderBlock->Extension->LoaderPagesSpanned;
MmBootImageSize *= PAGE_SIZE;
@@ -377,9 +374,6 @@
/* Initialize the page list */
MmInitializePageList();
-
- /* Unmap low memory */
- MmDeletePageTable(NULL, 0);
//
// Initialize ARM³