2020-11-27 05:42:13 -05:00
|
|
|
#ifndef KERNAUX_INCLUDED_PFA
|
|
|
|
#define KERNAUX_INCLUDED_PFA 1
|
2020-11-27 04:28:13 -05:00
|
|
|
|
2020-12-06 05:16:15 -05:00
|
|
|
#include <stdbool.h>
|
2020-11-30 17:54:09 -05:00
|
|
|
|
|
|
|
#define KERNAUX_PFA_PAGE_SIZE (4 * 1024)
|
|
|
|
#define KERNAUX_PFA_PAGES_COUNT_MAX (1024 * 1024)
|
|
|
|
|
2020-11-27 04:28:13 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-11-30 17:54:09 -05:00
|
|
|
struct KernAux_PFA {
|
2020-12-06 05:16:15 -05:00
|
|
|
bool pages[KERNAUX_PFA_PAGES_COUNT_MAX];
|
2020-11-30 17:54:09 -05:00
|
|
|
};
|
|
|
|
|
2020-11-30 18:38:55 -05:00
|
|
|
void KernAux_PFA_initialize(struct KernAux_PFA *pfa)
|
2020-11-30 17:54:09 -05:00
|
|
|
__attribute__((nonnull));
|
|
|
|
|
|
|
|
void KernAux_PFA_mark_available(
|
|
|
|
struct KernAux_PFA *pfa,
|
|
|
|
unsigned int start,
|
|
|
|
unsigned int end
|
|
|
|
)
|
|
|
|
__attribute__((nonnull));
|
|
|
|
|
2020-12-03 22:04:42 -05:00
|
|
|
void KernAux_PFA_mark_unavailable(
|
|
|
|
struct KernAux_PFA *pfa,
|
|
|
|
unsigned int start,
|
|
|
|
unsigned int end
|
|
|
|
)
|
|
|
|
__attribute__((nonnull));
|
|
|
|
|
2020-11-30 18:38:55 -05:00
|
|
|
unsigned int KernAux_PFA_alloc_page(struct KernAux_PFA *pfa)
|
|
|
|
__attribute__((nonnull));
|
|
|
|
|
|
|
|
void KernAux_PFA_free_page(struct KernAux_PFA *pfa, unsigned int page_addr)
|
|
|
|
__attribute__((nonnull));
|
|
|
|
|
2020-11-27 04:28:13 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|