Author: tkreuzer
Date: Mon Jan 26 21:11:58 2015
New Revision: 66091
URL:
http://svn.reactos.org/svn/reactos?rev=66091&view=rev
Log:
[FREELDR]
Fix/improve range check.
CORE-8995 #resolve
CORE-8997 #resolve
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c
trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c [iso-8859-1] Mon Jan 26 21:11:58
2015
@@ -203,7 +203,7 @@
REGS Regs;
ULONGLONG RealBaseAddress, EndAddress, RealSize;
TYPE_OF_MEMORY MemoryType;
- ULONG Size;
+ ULONG Size, RequiredSize;
ASSERT(PcBiosMapCount == 0);
TRACE("GetBiosMemoryMap()\n");
@@ -212,17 +212,18 @@
bit value at address 0x413 inside the BDA, which gives us the usable size
in KB */
Size = (*(PUSHORT)(ULONG_PTR)0x413) * 1024;
- if (Size < MEMORY_MARGIN)
+ RequiredSize = FREELDR_BASE + FrLdrImageSize + PAGE_SIZE;
+ if (Size < RequiredSize)
{
FrLdrBugCheckWithMessage(
MEMORY_INIT_FAILURE,
__FILE__,
__LINE__,
- "The BIOS reported a usable memory range up to 0x%x, which is too
small!\n\n"
+ "The BIOS reported a usable memory range up to 0x%x, which is too
small!\n"
+ "Required size is 0x%x\n\n"
"If you see this, please report to the ReactOS team!",
- Size);
- }
-
+ Size, RequiredSize);
+ }
/* Int 15h AX=E820h
* Newer BIOSes - GET SYSTEM MEMORY MAP
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1]
(original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1] Mon Jan 26
21:11:58 2015
@@ -16,7 +16,7 @@
#define STACKADDR HEX(F000) /* The 32/64-bit stack top will be at 0000:F000, or
0xF000 */
#define FREELDR_BASE HEX(F800)
#define FREELDR_PE_BASE HEX(10000)
-#define MEMORY_MARGIN HEX(90000) /* We need this much memory */
+#define MEMORY_MARGIN HEX(88000) /* We need this much memory */
#define BIOSCALLBUFSEGMENT (BIOSCALLBUFFER/16) /* Buffer to store temporary data for any
Int386() call */
#define BIOSCALLBUFOFFSET HEX(0000) /* Buffer to store temporary data for any Int386()
call */