Skip to content

Commit 779b660

Browse files
iLauncherDevDistroHopper39B
authored andcommitted
Hack the low page allocation to allocate above 2MB
1 parent 048cf5f commit 779b660

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

boot/freeldr/freeldr/lib/mm/meminit.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#include <debug.h>
2424
DBG_DEFAULT_CHANNEL(MEMORY);
2525

26+
/* For some weird reason windows vista doesn't work when loading stuff on first 1MB */
27+
#define MM_RESERVED_PAGES MM_SIZE_TO_PAGES(0x100000)
28+
2629
PVOID PageLookupTableAddress = NULL;
2730
PFN_NUMBER TotalPagesInLookupTable = 0;
2831
PFN_NUMBER FreePagesInLookupTable = 0;
@@ -600,7 +603,7 @@ PFN_NUMBER MmFindAvailablePages(PVOID PageLookupTable, PFN_NUMBER TotalPageCount
600603
if (FromEnd)
601604
{
602605
/* Allocate "high" (from end) pages */
603-
for (Index=LastFreePageHint-1; Index>0; Index--)
606+
for (Index=LastFreePageHint-1; Index>MM_RESERVED_PAGES; Index--)
604607
{
605608
if (RealPageLookupTable[Index].PageAllocated != LoaderFree)
606609
{
@@ -622,7 +625,7 @@ PFN_NUMBER MmFindAvailablePages(PVOID PageLookupTable, PFN_NUMBER TotalPageCount
622625
{
623626
TRACE("Alloc low memory, LastFreePageHint 0x%x, TPC 0x%x\n", LastFreePageHint, TotalPageCount);
624627
/* Allocate "low" pages */
625-
for (Index=1; Index < LastFreePageHint; Index++)
628+
for (Index=max(1,MM_RESERVED_PAGES); Index < LastFreePageHint; Index++)
626629
{
627630
if (RealPageLookupTable[Index].PageAllocated != LoaderFree)
628631
{

0 commit comments

Comments
 (0)