mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
Change #defines of bios memory types to a proper enum. Makes it easier to distinguish BIOS memory types and FreeLoader's memory types (in future).
svn path=/trunk/; revision=24238
This commit is contained in:
parent
0e779901fc
commit
cd007816d8
8 changed files with 30 additions and 28 deletions
|
@ -235,11 +235,11 @@ PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
|
|||
/* Conventional memory */
|
||||
BiosMemoryMap[0].BaseAddress = 0;
|
||||
BiosMemoryMap[0].Length = PcMemGetConventionalMemorySize() * 1024;
|
||||
BiosMemoryMap[0].Type = MEMTYPE_USABLE;
|
||||
BiosMemoryMap[0].Type = BiosMemoryUsable;
|
||||
/* Extended memory */
|
||||
BiosMemoryMap[1].BaseAddress = 1024 * 1024;
|
||||
BiosMemoryMap[1].Length = PcMemGetExtendedMemorySize() * 1024;
|
||||
BiosMemoryMap[1].Type = MEMTYPE_USABLE;
|
||||
BiosMemoryMap[1].Type = BiosMemoryUsable;
|
||||
EntryCount = 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
|
|||
/* Available RAM block */
|
||||
BiosMemoryMap[0].BaseAddress = 0;
|
||||
BiosMemoryMap[0].Length = AvailableMemoryMb * 1024 * 1024;
|
||||
BiosMemoryMap[0].Type = MEMTYPE_USABLE;
|
||||
BiosMemoryMap[0].Type = BiosMemoryUsable;
|
||||
EntryCount = 1;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
|
|||
/* Video memory */
|
||||
BiosMemoryMap[1].BaseAddress = AvailableMemoryMb * 1024 * 1024;
|
||||
BiosMemoryMap[1].Length = (InstalledMemoryMb - AvailableMemoryMb) * 1024 * 1024;
|
||||
BiosMemoryMap[1].Type = MEMTYPE_RESERVED;
|
||||
BiosMemoryMap[1].Type = BiosMemoryReserved;
|
||||
EntryCount = 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ ULONG PpcGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
|
|||
ULONG MaxMemoryMapSize ) {
|
||||
printf("GetMemoryMap(chosen=%x)\n", chosen_package);
|
||||
|
||||
BiosMemoryMap[0].Type = MEMTYPE_USABLE;
|
||||
BiosMemoryMap[0].Type = BiosMemoryUsable;
|
||||
BiosMemoryMap[0].BaseAddress = 0;
|
||||
BiosMemoryMap[0].Length = 32 * 1024 * 1024; /* Assume 32 meg for now */
|
||||
|
||||
|
|
|
@ -21,11 +21,13 @@
|
|||
#ifndef __MEMORY_H
|
||||
#define __MEMORY_H
|
||||
|
||||
|
||||
#define MEMTYPE_USABLE 0x01
|
||||
#define MEMTYPE_RESERVED 0x02
|
||||
#define MEMTYPE_ACPI_RECLAIM 0x03
|
||||
#define MEMTYPE_ACPI_NVS 0x04
|
||||
typedef enum
|
||||
{
|
||||
BiosMemoryUsable=1,
|
||||
BiosMemoryReserved,
|
||||
BiosMemoryAcpiReclaim,
|
||||
BiosMemoryAcpiNvs
|
||||
} BIOS_MEMORY_TYPE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -27,16 +27,16 @@ typedef struct
|
|||
{
|
||||
ULONG Type;
|
||||
UCHAR TypeString[20];
|
||||
} MEMORY_TYPE, *PMEMORY_TYPE;
|
||||
} FREELDR_MEMORY_TYPE, *PFREELDR_MEMORY_TYPE;
|
||||
|
||||
ULONG MemoryTypeCount = 5;
|
||||
MEMORY_TYPE MemoryTypeArray[] =
|
||||
FREELDR_MEMORY_TYPE MemoryTypeArray[] =
|
||||
{
|
||||
{ 0, "Unknown Memory" },
|
||||
{ MEMTYPE_USABLE, "Usable Memory" },
|
||||
{ MEMTYPE_RESERVED, "Reserved Memory" },
|
||||
{ MEMTYPE_ACPI_RECLAIM, "ACPI Reclaim Memory" },
|
||||
{ MEMTYPE_ACPI_NVS, "ACPI NVS Memory" },
|
||||
{ BiosMemoryUsable, "Usable Memory" },
|
||||
{ BiosMemoryReserved, "Reserved Memory" },
|
||||
{ BiosMemoryAcpiReclaim, "ACPI Reclaim Memory" },
|
||||
{ BiosMemoryAcpiNvs, "ACPI NVS Memory" },
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -192,7 +192,7 @@ PVOID MmFindLocationForPageLookupTable(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG Map
|
|||
{
|
||||
// If this is usable memory with a big enough length
|
||||
// then we'll put our page lookup table here
|
||||
if (TempBiosMemoryMap[Index].Type == MEMTYPE_USABLE && TempBiosMemoryMap[Index].Length >= PageLookupTableSize)
|
||||
if (TempBiosMemoryMap[Index].Type == BiosMemoryUsable && TempBiosMemoryMap[Index].Length >= PageLookupTableSize)
|
||||
{
|
||||
PageLookupTableMemAddress = (PVOID)(ULONG)(TempBiosMemoryMap[Index].BaseAddress + (TempBiosMemoryMap[Index].Length - PageLookupTableSize));
|
||||
break;
|
||||
|
@ -248,20 +248,20 @@ VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount, PBIOS_ME
|
|||
MemoryMapStartPage = MmGetPageNumberFromAddress((PVOID)(ULONG)BiosMemoryMap[Index].BaseAddress);
|
||||
MemoryMapEndPage = MmGetPageNumberFromAddress((PVOID)(ULONG)(BiosMemoryMap[Index].BaseAddress + BiosMemoryMap[Index].Length - 1));
|
||||
MemoryMapPageCount = (MemoryMapEndPage - MemoryMapStartPage) + 1;
|
||||
MemoryMapPageAllocated = (BiosMemoryMap[Index].Type == MEMTYPE_USABLE) ? 0 : BiosMemoryMap[Index].Type;
|
||||
MemoryMapPageAllocated = (BiosMemoryMap[Index].Type == BiosMemoryUsable) ? 0 : BiosMemoryMap[Index].Type;
|
||||
DbgPrint((DPRINT_MEMORY, "Marking pages as type %d: StartPage: %d PageCount: %d\n", MemoryMapPageAllocated, MemoryMapStartPage, MemoryMapPageCount));
|
||||
MmMarkPagesInLookupTable(PageLookupTable, MemoryMapStartPage, MemoryMapPageCount, MemoryMapPageAllocated);
|
||||
}
|
||||
|
||||
// Mark the low memory region below 1MB as reserved (256 pages in region)
|
||||
DbgPrint((DPRINT_MEMORY, "Marking the low 1MB region as reserved.\n"));
|
||||
MmMarkPagesInLookupTable(PageLookupTable, 0, 256, MEMTYPE_RESERVED);
|
||||
MmMarkPagesInLookupTable(PageLookupTable, 0, 256, BiosMemoryReserved);
|
||||
|
||||
// Mark the pages that the lookup tabel occupies as reserved
|
||||
PageLookupTableStartPage = MmGetPageNumberFromAddress(PageLookupTable);
|
||||
PageLookupTablePageCount = MmGetPageNumberFromAddress((PVOID)((ULONG_PTR)PageLookupTable + ROUND_UP(TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM), MM_PAGE_SIZE))) - PageLookupTableStartPage;
|
||||
DbgPrint((DPRINT_MEMORY, "Marking the page lookup table pages as reserved StartPage: %d PageCount: %d\n", PageLookupTableStartPage, PageLookupTablePageCount));
|
||||
MmMarkPagesInLookupTable(PageLookupTable, PageLookupTableStartPage, PageLookupTablePageCount, MEMTYPE_RESERVED);
|
||||
MmMarkPagesInLookupTable(PageLookupTable, PageLookupTableStartPage, PageLookupTablePageCount, BiosMemoryReserved);
|
||||
}
|
||||
|
||||
VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PageCount, ULONG PageAllocated)
|
||||
|
@ -414,7 +414,7 @@ VOID MmFixupSystemMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG* MapCount)
|
|||
// If the entry type isn't usable then remove
|
||||
// it from the memory map (this will help reduce
|
||||
// the size of our lookup table)
|
||||
if (BiosMemoryMap[Index].Type != MEMTYPE_USABLE)
|
||||
if (BiosMemoryMap[Index].Type != BiosMemoryUsable)
|
||||
{
|
||||
// Slide every entry after this down one
|
||||
for (Index2=Index; Index2<(*MapCount - 1); Index2++)
|
||||
|
|
|
@ -392,13 +392,13 @@ VOID DumpMemoryAllocMap(VOID)
|
|||
case 1:
|
||||
DbgPrint((DPRINT_MEMORY, "A"));
|
||||
break;
|
||||
case MEMTYPE_RESERVED:
|
||||
case BiosMemoryReserved:
|
||||
DbgPrint((DPRINT_MEMORY, "R"));
|
||||
break;
|
||||
case MEMTYPE_ACPI_RECLAIM:
|
||||
case BiosMemoryAcpiReclaim:
|
||||
DbgPrint((DPRINT_MEMORY, "M"));
|
||||
break;
|
||||
case MEMTYPE_ACPI_NVS:
|
||||
case BiosMemoryAcpiNvs:
|
||||
DbgPrint((DPRINT_MEMORY, "N"));
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -615,7 +615,7 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
|
|||
DbgPrint((DPRINT_REACTOS, "dumping memory map:\n"));
|
||||
for (i=0; i<(LoaderBlock.MmapLength/sizeof(memory_map_t)); i++)
|
||||
{
|
||||
if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
|
||||
if (BiosMemoryUsable == reactos_memory_map[i].type &&
|
||||
0 == reactos_memory_map[i].base_addr_low)
|
||||
{
|
||||
LoaderBlock.MemLower = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024;
|
||||
|
@ -624,7 +624,7 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
|
|||
LoaderBlock.MemLower = 640;
|
||||
}
|
||||
}
|
||||
if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
|
||||
if (BiosMemoryUsable == reactos_memory_map[i].type &&
|
||||
reactos_memory_map[i].base_addr_low <= 1024 * 1024 &&
|
||||
1024 * 1024 <= reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low)
|
||||
{
|
||||
|
|
|
@ -325,7 +325,7 @@ VOID RunLoader(VOID)
|
|||
reactos_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24
|
||||
for (i = 0; i < (LoaderBlock.MmapLength / sizeof(memory_map_t)); i++)
|
||||
{
|
||||
if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
|
||||
if (BiosMemoryUsable == reactos_memory_map[i].type &&
|
||||
0 == reactos_memory_map[i].base_addr_low)
|
||||
{
|
||||
LoaderBlock.MemLower = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024;
|
||||
|
@ -334,7 +334,7 @@ VOID RunLoader(VOID)
|
|||
LoaderBlock.MemLower = 640;
|
||||
}
|
||||
}
|
||||
if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
|
||||
if (BiosMemoryUsable == reactos_memory_map[i].type &&
|
||||
reactos_memory_map[i].base_addr_low <= 1024 * 1024 &&
|
||||
1024 * 1024 <= reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue