hardened_malloc/pages.h

18 lines
482 B
C
Raw Normal View History

2018-09-02 11:33:27 +05:30
#ifndef PAGES_H
#define PAGES_H
#include <stdbool.h>
#include <stddef.h>
#define PAGE_SHIFT 12
2018-12-05 12:37:05 +05:30
#ifndef PAGE_SIZE
2018-09-02 11:33:27 +05:30
#define PAGE_SIZE ((size_t)1 << PAGE_SHIFT)
2018-12-05 12:37:05 +05:30
#endif
#define PAGE_CEILING(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
2018-09-02 11:33:27 +05:30
void *allocate_pages(size_t usable_size, size_t guard_size, bool unprotect);
void deallocate_pages(void *usable, size_t usable_size, size_t guard_size);
void *allocate_pages_aligned(size_t usable_size, size_t alignment, size_t guard_size);
#endif