From ac5a5581cd1dea4fcb9ec971adbfa5825eb16640 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Thu, 6 Sep 2007 17:18:42 +0000 Subject: [PATCH] - Fix LoaderPagesSpanned calculation. svn path=/trunk/; revision=28903 --- reactos/ntoskrnl/ke/freeldr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/reactos/ntoskrnl/ke/freeldr.c b/reactos/ntoskrnl/ke/freeldr.c index 38244d09cd1..55b94b170cf 100644 --- a/reactos/ntoskrnl/ke/freeldr.c +++ b/reactos/ntoskrnl/ke/freeldr.c @@ -1111,11 +1111,13 @@ KiRosFrldrLpbToNtLpb(IN PROS_LOADER_PARAMETER_BLOCK RosLoaderBlock, LoaderBlock->Extension->MajorVersion = 5; LoaderBlock->Extension->MinorVersion = 2; - /* Save the number of pages the kernel images take */ - LoaderBlock->Extension->LoaderPagesSpanned = - PAGE_ROUND_UP(KeRosLoaderBlock-> - ModsAddr[KeRosLoaderBlock->ModsCount - 1].ModEnd) - - KeRosLoaderBlock->ModsAddr[0].ModStart; + /* FreeLDR hackllocates 1536 static pages for the initial boot images */ + LoaderBlock->Extension->LoaderPagesSpanned = 1536 * PAGE_SIZE; + + /* ReactOS always boots the kernel at 0x80800000 (just like NT 5.2) */ + LoaderBlock->Extension->LoaderPagesSpanned += 0x80800000 - KSEG0_BASE; + + /* Now convert to pages */ LoaderBlock->Extension->LoaderPagesSpanned /= PAGE_SIZE; /* Now setup the setup block if we have one */