parlib: Align the stack when saving FP state
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 16 Mar 2017 19:06:42 +0000 (15:06 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 21 Mar 2017 18:29:06 +0000 (14:29 -0400)
We need the sigdata struct to be aligned properly for the FPU save/restore.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/parlib/signal.c

index 2900694..e44516e 100644 (file)
@@ -162,6 +162,7 @@ static void __prep_sighandler(struct uthread *uthread,
                assert(current_uthread == uthread);
                ctx = &vcpd_of(vcore_id())->uthread_ctx;
                stack = get_user_ctx_sp(ctx) - sizeof(struct sigdata);
+               stack = ROUNDDOWN(stack, __alignof__(struct sigdata));
                assert(stack_ptr_is_sane(stack));
                uthread->sigstate.data = (struct sigdata*)stack;
                save_fp_state(&uthread->sigstate.data->as);