[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/LIBGO PATCH] Use uk_posix_memalign() for stack allocation



Recent changes in Unikraft modified uk_palloc()'s signature and
guarantees: allocation sizes are given with the number of pages and
the returned memory is not necessarily aligned to the size.
By using uk_posix_memalign() we restore our assumptions in the code.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 glue.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/glue.c b/glue.c
index 94a96b9..44d2e08 100644
--- a/glue.c
+++ b/glue.c
@@ -187,7 +187,10 @@ void makecontext1 (ucontext_t *__ucp, void (*__func) 
(void), int __argc, ...)
 void *alloc_stack()
 {
        struct uk_sched *sched = uk_sched_get_default();
-       void *stack = uk_palloc(sched->allocator, __STACK_SIZE_PAGE_ORDER);
+       void *stack;
+
+       uk_posix_memalign(sched->allocator,
+                         &stack, __STACK_SIZE, __STACK_SIZE);
        if (stack == NULL)
                printf("error allocating stack\n");
        return stack;
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.