Skip to content
Snippets Groups Projects
Commit 11b4d732 authored by Avi Kivity's avatar Avi Kivity
Browse files

memory: count up total physical memory

parent 990ae584
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,7 @@ void arch_setup_free_memory()
while (p < tmp + mb.mmap_length) {
auto ent = static_cast<e820ent*>(p);
if (ent->type == 1) {
memory::phys_mem_size += ent->size;
if (ent->addr < edata) {
u64 adjust = std::min(edata - ent->addr, ent->size);
ent->addr += adjust;
......
......@@ -8,6 +8,8 @@
namespace memory {
size_t phys_mem_size;
// Memory allocation strategy
//
// The chief requirement is to be able to deduce the object size.
......
......@@ -11,6 +11,8 @@ using std::size_t;
const size_t page_size = 4096;
extern size_t phys_mem_size;
void* alloc_page();
void free_page(void* page);
void* alloc_page_range(size_t bytes);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment