summaryrefslogtreecommitdiff
path: root/loader/memory_efi.c
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2021-03-17 12:38:27 +0000
committerAda Christine <adachristine18@gmail.com>2021-03-17 12:38:27 +0000
commit53ca88735db910c746d6190cca39fcd70d66b650 (patch)
treeab0da3a88009f0ddf0e6e2634d0962c364393203 /loader/memory_efi.c
initial commit
Diffstat (limited to 'loader/memory_efi.c')
-rw-r--r--loader/memory_efi.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/loader/memory_efi.c b/loader/memory_efi.c
new file mode 100644
index 0000000..3dae44f
--- /dev/null
+++ b/loader/memory_efi.c
@@ -0,0 +1,30 @@
+#include "loader_efi.h"
+
+void *efi_allocate(size_t size)
+{
+ EFI_STATUS status;
+ void *buffer;
+
+ status = e_bs->AllocatePool(EfiLoaderData, size, &buffer);
+
+ if (EFI_ERROR(status))
+ {
+ e_last_error = status;
+ buffer = NULL;
+ }
+
+ return buffer;
+}
+
+void efi_free(void *buffer)
+{
+ EFI_STATUS status;
+
+ status = e_bs->FreePool(buffer);
+
+ if (EFI_ERROR(status))
+ {
+ e_last_error = status;
+ }
+}
+