-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpages.h
More file actions
26 lines (20 loc) · 678 Bytes
/
pages.h
File metadata and controls
26 lines (20 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
* Copyright (C) 2019 Ricardo Leite. All rights reserved.
* Licenced under the MIT licence. See COPYING file in the project root for
* details.
*/
#ifndef __PAGES_H
#define __PAGES_H
#include <cinttypes>
#include <cstddef>
#include "lrmalloc.h"
// return page address for page containing a
#define PAGE_ADDR2BASE(a) ((void*)((uintptr)(a) & ~PAGE_MASK))
// returns a set of continous pages, totaling to size bytes
void* PageAlloc(size_t size);
// explictely allow overcommiting
// used for array-based page map
void* PageAllocOvercommit(size_t size);
// free a set of continous pages, totaling to size bytes
void PageFree(void* ptr, size_t size);
#endif // __PAGES_H