[ros-diffs] [fireball] 32039: - Fix an incorrect type of memory behind PDE, HAL mapping and kernel segment pagetables. They should be MemoryData. (and change allocation algorithm slightly). - With this change Windows 2003 boots up to the BSOD showing ACPI_BIOS_ERROR.

fireball at svn.reactos.org fireball at svn.reactos.org
Mon Jan 28 19:50:29 CET 2008


Author: fireball
Date: Mon Jan 28 21:50:29 2008
New Revision: 32039

URL: http://svn.reactos.org/svn/reactos?rev=32039&view=rev
Log:
- Fix an incorrect type of memory behind PDE, HAL mapping and kernel segment pagetables. They should be MemoryData. (and change allocation algorithm slightly).
- With this change Windows 2003 boots up to the BSOD showing ACPI_BIOS_ERROR.

Modified:
    trunk/reactos/boot/freeldr/freeldr/windows/wlmemory.c

Modified: trunk/reactos/boot/freeldr/freeldr/windows/wlmemory.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windows/wlmemory.c?rev=32039&r1=32038&r2=32039&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/wlmemory.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/wlmemory.c Mon Jan 28 21:50:29 2008
@@ -129,11 +129,23 @@
 
 	// Allocate memory block for all these things:
 	// PDE, HAL mapping page table, physical mapping, kernel mapping
-	// FIXME: PDE+HAL+KernelPTEs == FirmwarePermanent, Physical PTEs = FirmwareTemporary
 	TotalSize = (1+1+NumPageTables*2)*MM_PAGE_SIZE;
-	Buffer = MmAllocateMemoryWithType(TotalSize, LoaderFirmwarePermanent);
-
-	if (Buffer == NULL)
+
+	// Physical PTEs = FirmwareTemporary
+	PhysicalPageTablesBuffer = MmAllocateMemoryWithType(
+		NumPageTables*MM_PAGE_SIZE, LoaderFirmwareTemporary);
+
+	// PDE+HAL+KernelPTEs == MemoryData
+	Buffer = MmAllocateMemoryWithType(
+		TotalSize - NumPageTables*MM_PAGE_SIZE, LoaderMemoryData);
+
+	if (Buffer + (TotalSize - NumPageTables*MM_PAGE_SIZE) !=
+		PhysicalPageTablesBuffer)
+	{
+		DbgPrint((DPRINT_WINDOWS, "There was a problem allocating two adjacent blocks of memory!"));
+	}
+
+	if (Buffer == NULL || PhysicalPageTablesBuffer == NULL)
 	{
 		UiMessageBox("Impossible to allocate memory block for page tables!");
 		return FALSE;
@@ -158,12 +170,8 @@
 	PDE[1023].Valid = 1;
 	PDE[1023].Write = 1;
 
-	// Store pointers to the tables for easier access
-	PhysicalPageTablesBuffer = &Buffer[MM_PAGE_SIZE*2];
-	KernelPageTablesBuffer = PhysicalPageTablesBuffer + NumPageTables*MM_PAGE_SIZE;
-
-	// Mark physical PTE's buffer as FirmwareTemporary
-	//MmSetMemoryType(KernelPageTablesBuffer, NumPageTables*MM_PAGE_SIZE, LoaderFirmwareTemporary);
+	// Store pointer to the table for easier access
+	KernelPageTablesBuffer = &Buffer[MM_PAGE_SIZE*2];
 
 	// Zero counters of page tables used
 	PhysicalPageTables = 0;




More information about the Ros-diffs mailing list