32 lines
749 B
C++
32 lines
749 B
C++
#ifndef _PHYS_MM_HH_
|
|
#define _PHYS_MM_HH_
|
|
|
|
#include <cstdint>
|
|
|
|
#include "exceptions.hh"
|
|
|
|
namespace phys_mm {
|
|
/* Initialize the physical memory management
|
|
Initializes internal data structures and
|
|
sets the RAM containing the kernel image to used */
|
|
void init();
|
|
|
|
// Allocate 'count' consecutive pages of physical memory
|
|
// Optionally alligned to 'align' pages
|
|
uintptr_t alloc(unsigned count);
|
|
|
|
// Free 'count' consecutive pages of physical memory starting at 'base'
|
|
void free(uintptr_t base);
|
|
|
|
void print_state();
|
|
|
|
// Returns the end of the initial physical allocation containing kernel image and data
|
|
// For use by mm::init
|
|
uintptr_t get_end_of_kernel_alloc();
|
|
|
|
class bad_alloc : public ex::bad_alloc {};
|
|
}
|
|
|
|
|
|
#endif
|