Add allocate_pages to boot services

This commit is contained in:
Justin C. Miller
2020-02-22 14:26:52 -08:00
parent baa6c56044
commit 3767a07d8e
2 changed files with 32 additions and 2 deletions

View File

@@ -9,10 +9,12 @@
#include <stdint.h> #include <stdint.h>
#include <uefi/tables.h> #include <uefi/tables.h>
#include <uefi/types.h>
namespace uefi { namespace uefi {
namespace bs_impl { namespace bs_impl {
using locate_protocol = uefi::status (*)(const uefi::guid *, void *, void **); using allocate_pages = status (*)(allocate_type, memory_type, uint64_t, uintptr_t*);
using locate_protocol = status (*)(const guid *, void *, void **);
} }
struct boot_services { struct boot_services {
@@ -25,7 +27,7 @@ struct boot_services {
void *restore_tpl; void *restore_tpl;
// Memory Services // Memory Services
void *allocate_pages; bs_impl::allocate_pages allocate_pages;
void *free_pages; void *free_pages;
void *get_memory_map; void *get_memory_map;
void *allocate_pool; void *allocate_pool;

View File

@@ -28,6 +28,34 @@ enum class status : uint64_t
}; };
inline bool is_error(status s) { return static_cast<uint64_t>(s) & error_bit; } inline bool is_error(status s) { return static_cast<uint64_t>(s) & error_bit; }
inline bool is_warning(status s) { return !is_error(s) && s != status::success; }
enum class memory_type : uint32_t
{
reserved_memory_type,
loader_code,
loader_data,
boot_services_code,
boot_services_data,
runtime_services_code,
runtime_services_data,
conventional_memory,
unusable_memory,
acpi_reclaim_memory,
acpi_memory_nvs,
memory_mapped_io,
memory_mapped_io_port_space,
pal_code,
persistent_memory,
max_memory_type
};
enum class allocate_type : uint32_t
{
any_pages,
max_address,
address
};
} // namespace uefi } // namespace uefi