#ifndef _MM_HH_ #define _MM_HH_ #include #include "exceptions.hh" namespace mm { // Initialize memory management // Physical memory management must be initialized before calling mm::init void init(); // Allocate 'pages' pages of virtual address space in the I/O region uintptr_t virtalloc_io(unsigned pages); // Allocate in pagecache region uintptr_t virtalloc_pc(unsigned pages); void virtfree_pc(uintptr_t base); // Grow the kernel heap by 'pages' pages // Allocate and map the desired amount of memory // Return the new heap end uintptr_t grow_heap(unsigned pages); uintptr_t get_heap_end(); class bad_alloc : public ex::bad_alloc {}; } #endif