On 05/24/2018 02:29 PM, Jan Kiszka wrote:
> On 2018-05-24 14:24, Ralf Ramsauer wrote:
>> 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 | 2 +-
>>  inmates/lib/x86/inmate.h      | 1 -
>>  inmates/lib/x86/mem.c         | 2 +-
>>  3 files changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/inmates/demos/x86/apic-demo.c b/inmates/demos/x86/apic-demo.c
>> index 6657ca37..e62e22a3 100644
>> --- a/inmates/demos/x86/apic-demo.c
>> +++ b/inmates/demos/x86/apic-demo.c
>> @@ -53,7 +53,7 @@ static void init_apic(void)
>>  
>>  static void pollute_cache(void)
>>  {
>> -    char *mem = (char *)HEAP_BASE;
>> +    char *mem = alloc(PAGE_SIZE, PAGE_SIZE);
> 
> Nice idea - but this is called in a loop...

Yikes, my bad! But that's fixable by passing the address to
pollute_cache(mem).

I'd like to get rid of HEAP_BASE... Helps me later when generalising the
allocator.

Thanks
  Ralf

> 
> Jan
> 
>>      unsigned long cpu_cache_line_size, ebx;
>>      unsigned long n;
>>  
>> 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)
>>  {
>>
> 

-- 
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.

Reply via email to