aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/arch/x86/mm.c
diff options
context:
space:
mode:
Diffstat (limited to 'extras/mini-os/arch/x86/mm.c')
-rw-r--r--extras/mini-os/arch/x86/mm.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/extras/mini-os/arch/x86/mm.c b/extras/mini-os/arch/x86/mm.c
index 082527d098..dd556e4741 100644
--- a/extras/mini-os/arch/x86/mm.c
+++ b/extras/mini-os/arch/x86/mm.c
@@ -448,6 +448,15 @@ static unsigned long demand_map_area_start;
#define DEMAND_MAP_PAGES ((2ULL << 30) / PAGE_SIZE)
#endif
+#ifdef HAVE_LIBC
+unsigned long heap, brk, heap_mapped, heap_end;
+#ifdef __x86_64__
+#define HEAP_PAGES ((128ULL << 30) / PAGE_SIZE)
+#else
+#define HEAP_PAGES ((1ULL << 30) / PAGE_SIZE)
+#endif
+#endif
+
void arch_init_demand_mapping_area(unsigned long cur_pfn)
{
cur_pfn++;
@@ -455,6 +464,14 @@ void arch_init_demand_mapping_area(unsigned long cur_pfn)
demand_map_area_start = (unsigned long) pfn_to_virt(cur_pfn);
cur_pfn += DEMAND_MAP_PAGES;
printk("Demand map pfns at %lx-%lx.\n", demand_map_area_start, pfn_to_virt(cur_pfn));
+
+#ifdef HAVE_LIBC
+ cur_pfn++;
+ heap_mapped = brk = heap = (unsigned long) pfn_to_virt(cur_pfn);
+ cur_pfn += HEAP_PAGES;
+ heap_end = (unsigned long) pfn_to_virt(cur_pfn);
+ printk("Heap resides at %lx-%lx.\n", brk, heap_end);
+#endif
}
#define MAP_BATCH ((STACK_SIZE / 2) / sizeof(mmu_update_t))