Commit c9393ec5 authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

rst alloc: align on reporting cpos too

Since we align in rst_mem_alloc, we should also align when reporting the
current position; if we don't and things get unlucky, we report a different
position than where the pointer is actually allocated, which fucks things
up quite bad :)

Closes #111
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 7fe2bee8
...@@ -128,7 +128,7 @@ unsigned long rst_mem_cpos(int type) ...@@ -128,7 +128,7 @@ unsigned long rst_mem_cpos(int type)
{ {
struct rst_mem_type_s *t = &rst_mems[type]; struct rst_mem_type_s *t = &rst_mems[type];
BUG_ON(!t->remapable || !t->enabled); BUG_ON(!t->remapable || !t->enabled);
return t->free_mem - t->buf; return ((void*) round_up((unsigned long)t->free_mem, sizeof(void *))) - t->buf;
} }
void *rst_mem_remap_ptr(unsigned long pos, int type) void *rst_mem_remap_ptr(unsigned long pos, int type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment