2020-11-27 15:42:13 +05:00
|
|
|
#ifndef KERNAUX_INCLUDED_PFA
|
|
|
|
#define KERNAUX_INCLUDED_PFA 1
|
2020-11-27 14:28:13 +05:00
|
|
|
|
2021-12-14 01:46:58 +05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-12-06 15:16:15 +05:00
|
|
|
#include <stdbool.h>
|
2021-12-14 03:59:51 +05:00
|
|
|
#include <stddef.h>
|
2020-12-01 03:54:09 +05:00
|
|
|
|
|
|
|
#define KERNAUX_PFA_PAGE_SIZE (4 * 1024)
|
|
|
|
#define KERNAUX_PFA_PAGES_COUNT_MAX (1024 * 1024)
|
2021-12-14 23:41:11 +05:00
|
|
|
#define KERNAUX_PFA_FLAGS_SIZE (KERNAUX_PFA_PAGES_COUNT_MAX / 8)
|
2020-12-01 03:54:09 +05:00
|
|
|
|
2021-12-14 04:03:13 +05:00
|
|
|
typedef struct KernAux_PFA *KernAux_PFA;
|
|
|
|
|
2020-12-01 03:54:09 +05:00
|
|
|
struct KernAux_PFA {
|
2021-12-14 23:41:11 +05:00
|
|
|
unsigned char flags[KERNAUX_PFA_FLAGS_SIZE];
|
2020-12-01 03:54:09 +05:00
|
|
|
};
|
|
|
|
|
2021-12-14 04:03:13 +05:00
|
|
|
void KernAux_PFA_initialize(KernAux_PFA pfa)
|
2020-12-01 03:54:09 +05:00
|
|
|
__attribute__((nonnull));
|
|
|
|
|
2021-12-14 04:10:05 +05:00
|
|
|
bool KernAux_PFA_is_available(KernAux_PFA pfa, size_t page_addr)
|
|
|
|
__attribute__((nonnull));
|
|
|
|
|
2021-12-14 04:03:13 +05:00
|
|
|
void KernAux_PFA_mark_available(KernAux_PFA pfa, size_t start, size_t end)
|
2020-12-01 03:54:09 +05:00
|
|
|
__attribute__((nonnull));
|
|
|
|
|
2021-12-14 04:03:13 +05:00
|
|
|
void KernAux_PFA_mark_unavailable(KernAux_PFA pfa, size_t start, size_t end)
|
2020-12-04 08:04:42 +05:00
|
|
|
__attribute__((nonnull));
|
|
|
|
|
2021-12-14 05:39:54 +05:00
|
|
|
size_t KernAux_PFA_alloc_pages(KernAux_PFA pfa, size_t mem_size)
|
|
|
|
__attribute__((nonnull));
|
|
|
|
|
|
|
|
void KernAux_PFA_free_pages(KernAux_PFA pfa, size_t page_addr, size_t mem_size)
|
|
|
|
__attribute__((nonnull));
|
|
|
|
|
2020-11-27 14:28:13 +05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|