Rename max_physical_address -> physical_address_limit
This commit is contained in:
parent
59890868c1
commit
b9f051017c
@ -144,7 +144,7 @@ private bool set_graphics_mode()
|
||||
/**
|
||||
* Walk the EFI memory map and translate it to the HULK bootinfo format.
|
||||
*/
|
||||
private void get_memory_map(ulong * bss_phys, ulong * stack_phys, ulong * max_physical_address, UINTN * memory_map_key)
|
||||
private void get_memory_map(ulong * bss_phys, ulong * stack_phys, ulong * physical_address_limit, UINTN * memory_map_key)
|
||||
{
|
||||
immutable static ubyte[] efi_to_hulk_memory_map_type = [
|
||||
BootInfo.MemoryRegion.Type.Reserved, // EfiReservedMemoryType
|
||||
@ -162,7 +162,7 @@ private void get_memory_map(ulong * bss_phys, ulong * stack_phys, ulong * max_ph
|
||||
BootInfo.MemoryRegion.Type.MemoryMappedIOPortSpace, // EfiMemoryMappedIOPortSpace
|
||||
BootInfo.MemoryRegion.Type.PalCode, // EfiPalCode
|
||||
];
|
||||
*max_physical_address = 0u;
|
||||
*physical_address_limit = 0u;
|
||||
UINTN memory_map_size = scratch.free();
|
||||
UINTN descriptor_size;
|
||||
UINT32 descriptor_version;
|
||||
@ -191,7 +191,7 @@ private void get_memory_map(ulong * bss_phys, ulong * stack_phys, ulong * max_ph
|
||||
}
|
||||
EFI_MEMORY_DESCRIPTOR * descriptor = cast(EFI_MEMORY_DESCRIPTOR *)&scratch_base[count * descriptor_size];
|
||||
ulong end_address = descriptor.PhysicalStart + descriptor.NumberOfPages * 4096u;
|
||||
if ((end_address > *max_physical_address) &&
|
||||
if ((end_address > *physical_address_limit) &&
|
||||
((descriptor.Type == EfiLoaderCode) ||
|
||||
(descriptor.Type == EfiLoaderData) ||
|
||||
(descriptor.Type == EfiBootServicesCode) ||
|
||||
@ -200,7 +200,7 @@ private void get_memory_map(ulong * bss_phys, ulong * stack_phys, ulong * max_ph
|
||||
(descriptor.Type == EfiRuntimeServicesData) ||
|
||||
(descriptor.Type == EfiConventionalMemory)))
|
||||
{
|
||||
*max_physical_address = end_address;
|
||||
*physical_address_limit = end_address;
|
||||
}
|
||||
if (descriptor.Type >= efi_to_hulk_memory_map_type.length)
|
||||
{
|
||||
@ -358,13 +358,13 @@ private void map_hulk(PageTableEntry * pt_base, ulong bss_phys, ulong stack_phys
|
||||
/**
|
||||
* Build page tables in preparation to jump to HULK.
|
||||
*
|
||||
* @param max_physical_address Maximum physical address to identity map.
|
||||
* @param physical_address_limit Maximum physical address to identity map.
|
||||
*/
|
||||
private void build_page_tables(ulong max_physical_address, ulong bss_phys, ulong stack_phys)
|
||||
private void build_page_tables(ulong physical_address_limit, ulong bss_phys, ulong stack_phys)
|
||||
{
|
||||
PageTableEntry * pt_base = new_page_table();
|
||||
/* Map physical RAM. */
|
||||
for (size_t addr = 0u; addr < max_physical_address; addr += (2u * 1024u * 1024u))
|
||||
for (size_t addr = 0u; addr < physical_address_limit; addr += (2u * 1024u * 1024u))
|
||||
{
|
||||
map2m(addr, addr, pt_base);
|
||||
}
|
||||
@ -372,7 +372,7 @@ private void build_page_tables(ulong max_physical_address, ulong bss_phys, ulong
|
||||
for (size_t i = 0u; i < bootinfo().memory_map_count; i++)
|
||||
{
|
||||
ulong addr = bootinfo().memory_map[i].base;
|
||||
if (addr >= max_physical_address)
|
||||
if (addr >= physical_address_limit)
|
||||
{
|
||||
map4kregion(addr, addr, bootinfo().memory_map[i].size, pt_base);
|
||||
}
|
||||
@ -424,11 +424,11 @@ extern (C) EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * st)
|
||||
|
||||
ulong bss_phys;
|
||||
ulong stack_phys;
|
||||
ulong max_physical_address;
|
||||
ulong physical_address_limit;
|
||||
UINTN memory_map_key;
|
||||
for (;;)
|
||||
{
|
||||
get_memory_map(&bss_phys, &stack_phys, &max_physical_address, &memory_map_key);
|
||||
get_memory_map(&bss_phys, &stack_phys, &physical_address_limit, &memory_map_key);
|
||||
|
||||
EFI_STATUS status = st.BootServices.ExitBootServices(image_handle, memory_map_key);
|
||||
if (status == EFI_INVALID_PARAMETER)
|
||||
@ -444,7 +444,7 @@ extern (C) EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * st)
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
build_page_tables(max_physical_address, bss_phys, stack_phys);
|
||||
build_page_tables(physical_address_limit, bss_phys, stack_phys);
|
||||
|
||||
bootinfo().hulk_phys = hulk_bin_phys();
|
||||
bootinfo().bss_phys = bss_phys;
|
||||
|
Loading…
x
Reference in New Issue
Block a user