[FREELDR]

Fix/improve range check. 
CORE-8995 #resolve 
CORE-8997 #resolve

svn path=/trunk/; revision=66091
This commit is contained in:
Timo Kreuzer 2015-01-26 21:11:58 +00:00
parent 890e37805d
commit e7d852bc11
2 changed files with 7 additions and 6 deletions

View file

@ -203,7 +203,7 @@ PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSi
REGS Regs;
ULONGLONG RealBaseAddress, EndAddress, RealSize;
TYPE_OF_MEMORY MemoryType;
ULONG Size;
ULONG Size, RequiredSize;
ASSERT(PcBiosMapCount == 0);
TRACE("GetBiosMemoryMap()\n");
@ -212,18 +212,19 @@ PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSi
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
*

View file

@ -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 */