The initial heap needs to be within the initially mapped memory in order to allocate page tables from it for mapping more. On x86, growing the heap beyond the first MB is blocked by the comm region that has to be located in lower memory in order to avoid conflicts with PCI resources. Therefore, it is needed to relocate the heap after mapping its additional space. Inmates should be able to do that by setting heap_pos. So, make this pointer global.
Signed-off-by: Jan Kiszka <[email protected]> --- inmates/lib/alloc.c | 2 +- inmates/lib/include/inmate_common.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/inmates/lib/alloc.c b/inmates/lib/alloc.c index 3ada047c..e68e6cc1 100644 --- a/inmates/lib/alloc.c +++ b/inmates/lib/alloc.c @@ -38,7 +38,7 @@ #include <inmate.h> -static unsigned long heap_pos = (unsigned long)stack_top; +unsigned long heap_pos = (unsigned long)stack_top; void *alloc(unsigned long size, unsigned long align) { diff --git a/inmates/lib/include/inmate_common.h b/inmates/lib/include/inmate_common.h index c85f1383..f2de578e 100644 --- a/inmates/lib/include/inmate_common.h +++ b/inmates/lib/include/inmate_common.h @@ -75,6 +75,8 @@ void arch_init_early(void); void __attribute__((format(printf, 1, 2))) printk(const char *fmt, ...); +extern unsigned long heap_pos; + void *alloc(unsigned long size, unsigned long align); void *memset(void *s, int c, unsigned long n); -- 2.16.4 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/91db4318-79c8-e019-d399-01b9da406718%40siemens.com. For more options, visit https://groups.google.com/d/optout.
