avoid redefining PAGE_SIZE/PAGE_MASK

pull/69/head
Daniel Micay 2018-12-05 02:07:05 -05:00
parent 9fd0670aac
commit f90fb3199d
1 changed files with 3 additions and 2 deletions

View File

@ -5,9 +5,10 @@
#include <stddef.h> #include <stddef.h>
#define PAGE_SHIFT 12 #define PAGE_SHIFT 12
#ifndef PAGE_SIZE
#define PAGE_SIZE ((size_t)1 << PAGE_SHIFT) #define PAGE_SIZE ((size_t)1 << PAGE_SHIFT)
#define PAGE_MASK ((size_t)(PAGE_SIZE - 1)) #endif
#define PAGE_CEILING(s) (((s) + PAGE_MASK) & ~PAGE_MASK) #define PAGE_CEILING(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
void *allocate_pages(size_t usable_size, size_t guard_size, bool unprotect); 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 deallocate_pages(void *usable, size_t usable_size, size_t guard_size);