From 5a8894498ba0a03b3aac9ba8c73b47eedd36aa5a Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Thu, 14 Jul 2016 18:42:26 -0400 Subject: [PATCH] add System::free_pages() --- src/core/System.cc | 5 +++++ src/core/System.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/core/System.cc b/src/core/System.cc index c653b7c..14a7924 100644 --- a/src/core/System.cc +++ b/src/core/System.cc @@ -54,3 +54,8 @@ void * System::alloc_pages(int num) -1, 0); } + +void System::free_pages(void * addr, int num) +{ + (void)munmap(addr, num << System::page_size_log); +} diff --git a/src/core/System.h b/src/core/System.h index a37aeb2..764bac9 100644 --- a/src/core/System.h +++ b/src/core/System.h @@ -6,6 +6,7 @@ class System public: static bool init(); static void * alloc_pages(int num); + static void free_pages(void * addr, int num); static unsigned long page_size; static unsigned int page_size_log;