From: Paul Brook Date: Thu, 28 Dec 2006 00:54:16 +0000 (+0100) Subject: [ARM] 4074/1: Flat loader stack alignment X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4cc2f7a84d64d25a16bb9383148c1467284e2356;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [ARM] 4074/1: Flat loader stack alignment The ARM EABI requires doubleword (8-byte) stack alignment at all public entry points. The patch below makes the bFLT loader honour this. It's always safe to start with a doubleword aligned stack so it doesn't seem worth making this conditional on CONFIG_AEABI. Paul Signed-off-by: Paul Brook Signed-off-by: Russell King --- diff --git a/include/asm-arm/flat.h b/include/asm-arm/flat.h index 966946478589..16f5375e57b8 100644 --- a/include/asm-arm/flat.h +++ b/include/asm-arm/flat.h @@ -5,7 +5,9 @@ #ifndef __ARM_FLAT_H__ #define __ARM_FLAT_H__ -#define flat_stack_align(sp) /* nothing needed */ +/* An odd number of words will be pushed after this alignment, so + deliberately misalign the value. */ +#define flat_stack_align(sp) sp = (void *)(((unsigned long)(sp) - 4) | 4) #define flat_argvp_envp_on_stack() 1 #define flat_old_ram_flag(flags) (flags) #define flat_reloc_valid(reloc, size) ((reloc) <= (size))