summaryrefslogtreecommitdiff
path: root/loader/memory_efi.c
blob: 3dae44f94446564cdaddfa830603542bac1b4706 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
    }
}