add System::free_pages()

This commit is contained in:
Josh Holtrop 2016-07-14 18:42:26 -04:00
parent ef6abd8ed7
commit 5a8894498b
2 changed files with 6 additions and 0 deletions

View File

@ -54,3 +54,8 @@ void * System::alloc_pages(int num)
-1, -1,
0); 0);
} }
void System::free_pages(void * addr, int num)
{
(void)munmap(addr, num << System::page_size_log);
}

View File

@ -6,6 +6,7 @@ class System
public: public:
static bool init(); static bool init();
static void * alloc_pages(int num); static void * alloc_pages(int num);
static void free_pages(void * addr, int num);
static unsigned long page_size; static unsigned long page_size;
static unsigned int page_size_log; static unsigned int page_size_log;