Memory heap and allocator
This commit is contained in:
13
main.c
13
main.c
@@ -207,6 +207,17 @@ static void loader_shutdown(void)
|
||||
uefi_call_wrapper(RT->ResetSystem, 4, EfiResetShutdown, EFI_SUCCESS, 0, NULL);
|
||||
}
|
||||
|
||||
static EFI_STATUS loader_alloc_pages(UINTN pages, EFI_PHYSICAL_ADDRESS *addr)
|
||||
{
|
||||
return uefi_call_wrapper(BS->AllocatePages, 4,
|
||||
AllocateAnyPages, EfiLoaderData, pages, addr);
|
||||
}
|
||||
|
||||
static EFI_STATUS loader_free_pages(EFI_PHYSICAL_ADDRESS addr, UINTN pages)
|
||||
{
|
||||
return uefi_call_wrapper(BS->FreePages, 2, addr, pages);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
|
||||
@@ -241,6 +252,8 @@ efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
|
||||
Boot.set_attribute = loader_set_attribute;
|
||||
Boot.read_key = loader_read_key;
|
||||
Boot.shutdown = loader_shutdown;
|
||||
Boot.alloc_pages = loader_alloc_pages;
|
||||
Boot.free_pages = loader_free_pages;
|
||||
|
||||
EntryFn = (KernelEntryFn)(UINTN)KernelEntry;
|
||||
EntryFn(&Boot);
|
||||
|
||||
Reference in New Issue
Block a user