1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-11-13 11:04:27 -05:00
libkernaux/include/kernaux/pfa.h

37 lines
881 B
C
Raw Normal View History

#ifndef KERNAUX_INCLUDED_PFA
2021-12-20 01:17:53 -05:00
#define KERNAUX_INCLUDED_PFA
2020-11-27 04:28:13 -05:00
2021-12-13 15:46:58 -05:00
#ifdef __cplusplus
extern "C" {
#endif
2020-12-06 05:16:15 -05:00
#include <stdbool.h>
#include <stddef.h>
2021-12-17 14:22:28 -05:00
#include <stdint.h>
#define KERNAUX_PFA_PAGE_SIZE (4 * 1024)
#define KERNAUX_PFA_PAGES_COUNT_MAX (1024 * 1024)
2021-12-14 13:41:11 -05:00
#define KERNAUX_PFA_FLAGS_SIZE (KERNAUX_PFA_PAGES_COUNT_MAX / 8)
2021-12-13 18:03:13 -05:00
typedef struct KernAux_PFA *KernAux_PFA;
struct KernAux_PFA {
2021-12-17 14:22:28 -05:00
uint8_t flags[KERNAUX_PFA_FLAGS_SIZE];
};
2021-12-14 17:10:28 -05:00
void KernAux_PFA_initialize(KernAux_PFA pfa);
2021-12-14 17:10:28 -05:00
bool KernAux_PFA_is_available(KernAux_PFA pfa, size_t page_addr);
2021-12-13 18:10:05 -05:00
2021-12-14 17:10:28 -05:00
void KernAux_PFA_mark_available(KernAux_PFA pfa, size_t start, size_t end);
void KernAux_PFA_mark_unavailable(KernAux_PFA pfa, size_t start, size_t end);
2021-12-14 17:10:28 -05:00
size_t KernAux_PFA_alloc_pages(KernAux_PFA pfa, size_t mem_size);
void KernAux_PFA_free_pages(KernAux_PFA pfa, size_t page_addr, size_t mem_size);
2020-11-27 04:28:13 -05:00
#ifdef __cplusplus
}
#endif
#endif