From 9064567e4ac13d3e75a44351e8947a5b2f1f835e Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Wed, 6 May 2020 00:18:33 -0700 Subject: [PATCH] Add get_memory_map and copy_mem to boot_services --- include/uefi/boot_services.h | 14 ++++++++------ include/uefi/types.h | 9 +++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/include/uefi/boot_services.h b/include/uefi/boot_services.h index 7b98c02..7303b17 100644 --- a/include/uefi/boot_services.h +++ b/include/uefi/boot_services.h @@ -13,12 +13,14 @@ namespace uefi { namespace bs_impl { - using allocate_pages = status (*)(allocate_type, memory_type, uint64_t, void**); + using allocate_pages = status (*)(allocate_type, memory_type, size_t, void**); + using get_memory_map = status (*)(size_t*, memory_descriptor*, size_t*, size_t*, uint32_t*); using allocate_pool = status (*)(memory_type, uint64_t, void**); - using handle_protocol = status (*)(handle, const guid *, void **); + using handle_protocol = status (*)(handle, const guid*, void**); using create_event = status (*)(evt, tpl, event_notify, void*, event*); - using locate_protocol = status (*)(const guid *, void *, void **); - using set_mem = void (*)(void *, uint64_t, uint8_t); + using locate_protocol = status (*)(const guid*, void*, void**); + using copy_mem = void (*)(void*, void*, size_t); + using set_mem = void (*)(void*, uint64_t, uint8_t); } struct boot_services { @@ -33,7 +35,7 @@ struct boot_services { // Memory Services bs_impl::allocate_pages allocate_pages; void *free_pages; - void *get_memory_map; + bs_impl::get_memory_map get_memory_map; bs_impl::allocate_pool allocate_pool; void *free_pool; @@ -88,7 +90,7 @@ struct boot_services { void *calculate_crc32; // Miscellaneous Services - void *copy_mem; + bs_impl::copy_mem copy_mem; bs_impl::set_mem set_mem; void *create_event_ex; }; diff --git a/include/uefi/types.h b/include/uefi/types.h index c870f02..3fa3747 100644 --- a/include/uefi/types.h +++ b/include/uefi/types.h @@ -84,6 +84,15 @@ enum class allocate_type : uint32_t address }; +struct memory_descriptor +{ + memory_type type; + uintptr_t physical_start; + uintptr_t virtual_start; + uint64_t number_of_pages; + uint64_t attribute; +}; + // // Event handling defitions