diff options
author | Pekka Enberg <penberg@kernel.org> | 2012-01-13 17:17:27 +0200 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-01-13 17:17:27 +0200 |
commit | 15dacee29e048dbc0d6de81574dbabb0adeb715e (patch) | |
tree | 7b94be8f0b91209d32c6689e728055a12c5e63a7 | |
parent | 04dc44c497bee6f589ccba7f709f1cb1be876968 (diff) | |
download | jato-15dacee29e048dbc0d6de81574dbabb0adeb715e.tar.gz |
x86: Align stack pointer to 16 bytes
SSE instructions that operate on the stack require stack pointer to be aligned
to 16 bytes. This patch is needed to be able to fix too large stack frame
sizes on x86.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r-- | arch/x86/include/arch/stack-frame.h | 2 | ||||
-rw-r--r-- | arch/x86/stack-frame.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86/include/arch/stack-frame.h b/arch/x86/include/arch/stack-frame.h index 216f7613..fc0ab27c 100644 --- a/arch/x86/include/arch/stack-frame.h +++ b/arch/x86/include/arch/stack-frame.h @@ -8,6 +8,8 @@ struct vm_method; struct expression; struct compilation_unit; +#define X86_STACK_ALIGN 16 + struct native_stack_frame { void *prev; /* previous stack frame link */ unsigned long return_address; diff --git a/arch/x86/stack-frame.c b/arch/x86/stack-frame.c index 25680e5c..f691a4e4 100644 --- a/arch/x86/stack-frame.c +++ b/arch/x86/stack-frame.c @@ -105,11 +105,15 @@ unsigned long slot_offset_64(struct stack_slot *slot) unsigned long frame_locals_size(struct stack_frame *frame) { unsigned long nr_locals; + unsigned long size; assert(frame->nr_local_slots >= frame->nr_args); nr_locals = frame->nr_local_slots - frame->nr_args; - return __index_to_offset(nr_locals + frame->nr_spill_slots); + + size = __index_to_offset(nr_locals + frame->nr_spill_slots); + + return ALIGN(size, X86_STACK_ALIGN); } /* |