Now there is only one user left of HEAP_BASE: The alloc() function its self. Fold the definition to mem.c.
Signed-off-by: Ralf Ramsauer <[email protected]> --- inmates/demos/x86/apic-demo.c | 10 ++++++---- inmates/lib/x86/inmate.h | 1 - inmates/lib/x86/mem.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/inmates/demos/x86/apic-demo.c b/inmates/demos/x86/apic-demo.c index 6657ca37..d6455055 100644 --- a/inmates/demos/x86/apic-demo.c +++ b/inmates/demos/x86/apic-demo.c @@ -51,9 +51,8 @@ static void init_apic(void) asm volatile("sti"); } -static void pollute_cache(void) +static void pollute_cache(char *mem) { - char *mem = (char *)HEAP_BASE; unsigned long cpu_cache_line_size, ebx; unsigned long n; @@ -71,12 +70,15 @@ void inmate_main(void) bool terminate = false; unsigned long tsc_freq; bool cache_pollution; + char *mem; comm_region->cell_state = JAILHOUSE_CELL_RUNNING_LOCKED; cache_pollution = cmdline_parse_bool("pollute-cache"); - if (cache_pollution) + if (cache_pollution) { + mem = alloc(PAGE_SIZE, PAGE_SIZE); printk("Cache pollution enabled\n"); + } tsc_freq = tsc_init(); printk("Calibrated TSC frequency: %lu.%03u kHz\n", tsc_freq / 1000, @@ -88,7 +90,7 @@ void inmate_main(void) asm volatile("hlt"); if (cache_pollution) - pollute_cache(); + pollute_cache(mem); switch (comm_region->msg_to_cell) { case JAILHOUSE_MSG_SHUTDOWN_REQUEST: diff --git a/inmates/lib/x86/inmate.h b/inmates/lib/x86/inmate.h index 19942dcf..0636420c 100644 --- a/inmates/lib/x86/inmate.h +++ b/inmates/lib/x86/inmate.h @@ -39,7 +39,6 @@ #ifndef _JAILHOUSE_INMATE_H #define _JAILHOUSE_INMATE_H -#define HEAP_BASE ((unsigned long)stack_top) #define COMM_REGION_BASE 0x100000 #define INMATE_CS32 0x8 diff --git a/inmates/lib/x86/mem.c b/inmates/lib/x86/mem.c index 06a08a5d..42b193d6 100644 --- a/inmates/lib/x86/mem.c +++ b/inmates/lib/x86/mem.c @@ -43,7 +43,7 @@ #define PG_PS 0x80 #define PG_PCD 0x10 -static unsigned long heap_pos = HEAP_BASE; +static unsigned long heap_pos = (unsigned long)stack_top; void *alloc(unsigned long size, unsigned long align) { -- 2.17.0 -- 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]. For more options, visit https://groups.google.com/d/optout.
