*pMemoryAtOneMB = (*pMemoryAtOneMB << 8);
TRACE("Int15h Failed\n");
- TRACE("CMOS reports: 0x%x\n", *pMemoryAtOneMB);
+ TRACE("CMOS reports: 0x%lx\n", *pMemoryAtOneMB);
if (*pMemoryAtOneMB != 0)
{
{
REGS Regs;
- TRACE("GetConventionalMemorySize()\n");
+ TRACE("PcMemGetConventionalMemorySize()\n");
/* Int 12h
* BIOS - GET MEMORY SIZE
ULONGLONG RealBaseAddress, EndAddress, RealSize;
TYPE_OF_MEMORY MemoryType;
ULONG Size, RequiredSize;
+
ASSERT(PcBiosMapCount == 0);
- TRACE("GetBiosMemoryMap()\n");
+ TRACE("PcMemGetBiosMemoryMap()\n");
/* Make sure the usable memory is large enough. To do this we check the 16
bit value at address 0x413 inside the BDA, which gives us the usable size
MEMORY_INIT_FAILURE,
__FILE__,
__LINE__,
- "The BIOS reported a usable memory range up to 0x%x, which is too small!\n"
- "Required size is 0x%x\n\n"
+ "The BIOS reported a usable memory range up to 0x%lx, which is too small!\n"
+ "Required size is 0x%lx\n\n"
"If you see this, please report to the ReactOS team!",
Size, RequiredSize);
}
Regs.w.di = BIOSCALLBUFOFFSET;
Int386(0x15, &Regs, &Regs);
- TRACE("Memory Map Entry %d\n", PcBiosMapCount);
+ TRACE("Memory Map Entry %lu\n", PcBiosMapCount);
TRACE("Int15h AX=E820h\n");
- TRACE("EAX = 0x%x\n", Regs.x.eax);
- TRACE("EBX = 0x%x\n", Regs.x.ebx);
- TRACE("ECX = 0x%x\n", Regs.x.ecx);
+ TRACE("EAX = 0x%lx\n", Regs.x.eax);
+ TRACE("EBX = 0x%lx\n", Regs.x.ebx);
+ TRACE("ECX = 0x%lx\n", Regs.x.ecx);
TRACE("CF set = %s\n", (Regs.x.eflags & EFLAGS_CF) ? "TRUE" : "FALSE");
/* If the BIOS didn't return 'SMAP' in EAX then
- * it doesn't support this call. If CF is set, we're done */
- if (Regs.x.eax != 0x534D4150 || !INT386_SUCCESS(Regs))
+ * it doesn't support this call. */
+ if (Regs.x.eax != 0x534D4150)
+ {
+ WARN("BIOS doesn't support Int15h AX=E820h!\n\n");
+ break;
+ }
+
+ /* If the carry flag is set,
+ * then this call was past the last entry, so we're done. */
+ if (!INT386_SUCCESS(Regs))
{
+ TRACE("End of System Memory Map! (Past last)\n\n");
break;
}
if (EndAddress <= RealBaseAddress)
{
/* This doesn't span any page, so continue with next range */
+ TRACE("Skipping aligned range < PAGE_SIZE. (PcBiosMapCount = %lu, BaseAddress = %lu, Length = %lu)\n",
+ PcBiosMapCount,
+ PcBiosMemoryMap[PcBiosMapCount].BaseAddress,
+ PcBiosMemoryMap[PcBiosMapCount].Length);
continue;
}
}
/* Check if we can add this descriptor */
- if ((RealSize >= MM_PAGE_SIZE) && (PcMapCount < MaxMemoryMapSize))
+ if (RealSize < MM_PAGE_SIZE)
+ {
+ TRACE("Skipping aligned range < MM_PAGE_SIZE. (PcBiosMapCount = %lu, BaseAddress = %lu, Length = %lu)\n",
+ PcBiosMapCount,
+ PcBiosMemoryMap[PcBiosMapCount].BaseAddress,
+ PcBiosMemoryMap[PcBiosMapCount].Length);
+ }
+ else if (PcMapCount >= MaxMemoryMapSize)
+ {
+ ERR("PcMemoryMap is already full! (PcBiosMapCount = %lu, PcMapCount = %lu (>= %lu))\n",
+ PcBiosMapCount, PcMapCount, MaxMemoryMapSize);
+ }
+ else
{
/* Add the descriptor */
PcMapCount = AddMemoryDescriptor(PcMemoryMap,
PcBiosMapCount++;
- /* If the continuation value is zero or the
- * carry flag is set then this was
- * the last entry so we're done */
+ /* If the continuation value is zero,
+ * then this was the last entry, so we're done. */
if (Regs.x.ebx == 0x00000000)
{
- TRACE("End Of System Memory Map!\n\n");
+ TRACE("End of System Memory Map! (Reset)\n\n");
break;
}
}
- TRACE("GetBiosMemoryMap end, PcBiosMapCount = %ld\n", PcBiosMapCount);
+ TRACE("PcMemGetBiosMemoryMap end: PcBiosMapCount = %lu\n", PcBiosMapCount);
return PcBiosMapCount;
}
ULONG ExtendedMemorySizeAtOneMB;
ULONG ExtendedMemorySizeAtSixteenMB;
ULONG EbdaBase, EbdaSize;
+
TRACE("PcMemGetMemoryMap()\n");
EntryCount = PcMemGetBiosMemoryMap(PcMemoryMap, MAX_BIOS_DESCRIPTORS);