summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-01-28 15:41:59 +0100
committerRichard Braun <rbraun@sceen.net>2018-01-28 15:41:59 +0100
commitb174f7fb7f936ca0365a851d3fd486e6baba357e (patch)
treeda4f0c8dfe6141602baed5556c78a5f5800dffe0
parent4778a84feb6c53e08fd2f15e33f2d1df64c0737f (diff)
mem: fix alignment
-rw-r--r--src/mem.c4
-rw-r--r--src/thread.c8
2 files changed, 2 insertions, 10 deletions
diff --git a/src/mem.c b/src/mem.c
index 185da4f..3392011 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -151,7 +151,7 @@
*
* See the description of mem_alloc() in the public header.
*/
-#define MEM_ALIGN 4
+#define MEM_ALIGN 8
/*
* Minimum size of a block.
@@ -208,7 +208,7 @@ struct mem_btag {
*/
struct mem_block {
struct mem_btag btag;
- char payload[];
+ char payload[] __aligned(MEM_ALIGN);
};
/*
diff --git a/src/thread.c b/src/thread.c
index 6687191..bb5ddc4 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -592,14 +592,6 @@ thread_init(struct thread *thread, thread_fn_t fn, void *arg,
const char *name, char *stack, size_t stack_size,
unsigned int priority)
{
- if (!P2ALIGNED((uint32_t)stack, CPU_STACK_ALIGN)) {
- char *aligned_stack;
-
- aligned_stack = (char *)(P2ALIGN((uintptr_t)stack, CPU_STACK_ALIGN));
- stack_size -= (stack - aligned_stack);
- stack = aligned_stack;
- }
-
/*
* New threads are created in a state that is similar to preempted threads,
* since it makes running them for the first time indistinguishable from