UEFIStarter
a simple UEFI framework
memory.h
Go to the documentation of this file.
1 
11 #ifndef __MEMORY_H
12 #define __MEMORY_H
13 
22 #define MEMORY_PAGE_LIST_MAX_ENTRY_COUNT 510
23 
25 #define POOL_MEMORY_LIST_MAX_ENTRY_COUNT 1022
26 
27 
29 typedef struct
30 {
31  UINTN pages;
32  void *address;
34 
36 typedef struct
37 {
38  UINTN entry_count;
42 
44 typedef struct
45 {
46  UINTN entry_count;
50 
51 
53 
54 
55 void *allocate_pages(UINTN pages);
56 BOOLEAN free_pages(void *address, UINTN pages);
57 
58 void *allocate_pages_ex(UINTN pages, BOOLEAN track, EFI_ALLOCATE_TYPE type, void *target_address);
59 BOOLEAN free_pages_ex(void *address, UINTN pages, BOOLEAN track);
60 
61 
62 void track_pool_memory(void *address);
64 
65 
68 
70 UINTN stop_tracking_memory();
71 
72 
73 #endif
type for a single tracked allocation of memory pages
Definition: memory.h:29
type for a list node of tracked memory page allocations
Definition: memory.h:36
UINTN entry_count
the number of entries in this node
Definition: memory.h:38
void * address
the memory location of the first page
Definition: memory.h:32
void track_pool_memory(void *address)
Starts tracking a pool memory address.
Definition: memory.c:242
void * allocate_pages_ex(UINTN pages, BOOLEAN track, EFI_ALLOCATE_TYPE type, void *target_address)
internal: allocates memory pages.
Definition: memory.c:130
void * allocate_pages(UINTN pages)
Allocate tracked memory pages.
Definition: memory.c:169
UINTN free_pool_memory_entries()
Frees all currently tracked pool memory entries.
Definition: memory.c:281
void print_pool_memory_list()
Debugging function: prints a human-readable list of tracked pool memory entries.
Definition: memory.c:268
struct memory_page_list_t * next
the next list node, may be null
Definition: memory.h:40
BOOLEAN free_pages(void *address, UINTN pages)
Frees tracked memory pages.
Definition: memory.c:226
void reset_memory_tracking()
Resets the internal memory tracking.
Definition: memory.c:58
UINTN entry_count
the number of entries in this node
Definition: memory.h:46
UINTN pages
the number of pages allocated
Definition: memory.h:31
void print_memory_page_list()
Debugging function: prints a human-readable list of tracked memory pages.
Definition: memory.c:32
void init_tracking_memory()
Initialize the memory tracker.
Definition: memory.c:305
UINTN stop_tracking_memory()
Stops tracking all memory.
Definition: memory.c:317
#define MEMORY_PAGE_LIST_MAX_ENTRY_COUNT
maximum number of entries per memory page list node
Definition: memory.h:22
type for a list node of tracked pool memory
Definition: memory.h:44
BOOLEAN free_pages_ex(void *address, UINTN pages, BOOLEAN track)
internal: frees memory pages.
Definition: memory.c:183
#define POOL_MEMORY_LIST_MAX_ENTRY_COUNT
like MEMORY_PAGE_LIST_MAX_ENTRY_COUNT, but for pool_memory_list_t
Definition: memory.h:25
struct pool_memory_list_t * next
the next list node, may be null
Definition: memory.h:48
memory_page_list_entry_t entries[MEMORY_PAGE_LIST_MAX_ENTRY_COUNT]
the allocation entries in this node
Definition: memory.h:39