Author: tkreuzer
Date: Mon Oct 19 17:51:57 2009
New Revision: 43604
URL:
http://svn.reactos.org/svn/reactos?rev=43604&view=rev
Log:
[FREELDR]
- Add MempIsPageMapped for debugging puposes
- Map pages for kernel, too in MempSetupPaging
Now we reach the kernel's entry point again.
Modified:
branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c
Modified:
branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/boot/…
==============================================================================
--- branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c
[iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c
[iso-8859-1] Mon Oct 19 17:51:57 2009
@@ -125,6 +125,35 @@
return TRUE;
}
+BOOLEAN
+MempIsPageMapped(PVOID VirtualAddress)
+{
+ PPAGE_DIRECTORY_AMD64 pDir;
+ ULONG Index;
+
+ pDir = pPML4;
+ Index = VAtoPXI(VirtualAddress);
+ if (!pDir->Pde[Index].Valid)
+ return FALSE;
+
+ pDir = (PPAGE_DIRECTORY_AMD64)((ULONG64)(pDir->Pde[Index].PageFrameNumber) *
PAGE_SIZE);
+ Index = VAtoPPI(VirtualAddress);
+ if (!pDir->Pde[Index].Valid)
+ return FALSE;
+
+ pDir = (PPAGE_DIRECTORY_AMD64)((ULONG64)(pDir->Pde[Index].PageFrameNumber) *
PAGE_SIZE);
+ Index = VAtoPDI(VirtualAddress);
+ if (!pDir->Pde[Index].Valid)
+ return FALSE;
+
+ pDir = (PPAGE_DIRECTORY_AMD64)((ULONG64)(pDir->Pde[Index].PageFrameNumber) *
PAGE_SIZE);
+ Index = VAtoPTI(VirtualAddress);
+ if (!pDir->Pde[Index].Valid)
+ return FALSE;
+
+ return TRUE;
+}
+
ULONG
MempMapRangeOfPages(ULONGLONG VirtualAddress, ULONGLONG PhysicalAddress, ULONG cPages)
{
@@ -146,13 +175,24 @@
MempSetupPaging(IN ULONG StartPage,
IN ULONG NumberOfPages)
{
- DPRINTM(DPRINT_WINDOWS,">>> MempSetupPaging(0x%lx, %ld)\n",
StartPage, NumberOfPages);
-
+ DPRINTM(DPRINT_WINDOWS,">>> MempSetupPaging(0x%lx, %ld, %p)\n",
+ StartPage, NumberOfPages, StartPage * PAGE_SIZE + KSEG0_BASE);
+
+ /* Identity mapping */
if (MempMapRangeOfPages(StartPage * PAGE_SIZE,
StartPage * PAGE_SIZE,
NumberOfPages) != NumberOfPages)
{
- DPRINTM(DPRINT_WINDOWS,"Failed to map pages\n");
+ DPRINTM(DPRINT_WINDOWS,"Failed to map pages 1\n");
+ return FALSE;
+ }
+
+ /* Kernel mapping */
+ if (MempMapRangeOfPages(StartPage * PAGE_SIZE + KSEG0_BASE,
+ StartPage * PAGE_SIZE,
+ NumberOfPages) != NumberOfPages)
+ {
+ DPRINTM(DPRINT_WINDOWS,"Failed to map pages 2\n");
return FALSE;
}