Skip to content

Commit

Permalink
ARM: Set EABI stack alignment for all ARM architectures (remove OABI …
Browse files Browse the repository at this point in the history
…code)
  • Loading branch information
David Cabecinhas committed Mar 16, 2017
1 parent 08e92ab commit 4b65817
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 62 deletions.
23 changes: 6 additions & 17 deletions arch/arm/src/common/up_createstack.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,11 @@
# define HAVE_KERNEL_HEAP 1
#endif

/* ARM requires at least a 4-byte stack alignment. For use with EABI and
* floating point, the stack must be aligned to 8-byte addresses.
/* For use with EABI and floating point, the stack must be aligned to 8-byte
* addresses.
*/

#ifndef CONFIG_STACK_ALIGNMENT

/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
*/

# ifdef __ARM_EABI__
# define CONFIG_STACK_ALIGNMENT 8
# else
# define CONFIG_STACK_ALIGNMENT 4
# endif
#endif
#define CONFIG_STACK_ALIGNMENT 8

/* Stack alignment macros */

Expand Down Expand Up @@ -233,9 +222,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)

top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;

/* The ARM stack must be aligned; 4 byte alignment for OABI and
* 8-byte alignment for EABI. If necessary top_of_stack must be
* rounded down to the next boundary
/* The ARM stack must be aligned to 8-byte alignment for EABI.
* If necessary top_of_stack must be rounded down to the next
* boundary
*/

top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
Expand Down
17 changes: 3 additions & 14 deletions arch/arm/src/common/up_stackframe.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,11 @@
* Pre-processor Macros
****************************************************************************/

/* ARM requires at least a 4-byte stack alignment. For use with EABI and
* floating point, the stack must be aligned to 8-byte addresses.
/* For use with EABI and floating point, the stack must be aligned to 8-byte
* addresses.
*/

#ifndef CONFIG_STACK_ALIGNMENT

/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
*/

# ifdef __ARM_EABI__
# define CONFIG_STACK_ALIGNMENT 8
# else
# define CONFIG_STACK_ALIGNMENT 4
# endif
#endif
#define CONFIG_STACK_ALIGNMENT 8

/* Stack alignment macros */

Expand Down
23 changes: 6 additions & 17 deletions arch/arm/src/common/up_usestack.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,11 @@
* Pre-processor Macros
****************************************************************************/

/* ARM requires at least a 4-byte stack alignment. For use with EABI and
* floating point, the stack must be aligned to 8-byte addresses.
/* For use with EABI and floating point, the stack must be aligned to 8-byte
* addresses.
*/

#ifndef CONFIG_STACK_ALIGNMENT

/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
*/

# ifdef __ARM_EABI__
# define CONFIG_STACK_ALIGNMENT 8
# else
# define CONFIG_STACK_ALIGNMENT 4
# endif
#endif
#define CONFIG_STACK_ALIGNMENT 8

/* Stack alignment macros */

Expand Down Expand Up @@ -143,9 +132,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)

top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;

/* The ARM stack must be aligned; 4 byte alignment for OABI and 8-byte
* alignment for EABI. If necessary top_of_stack must be rounded down
* to the next boundary
/* The ARM stack must be aligned to 8-byte alignment for EABI.
* If necessary top_of_stack must be rounded down to the next
* boundary
*/

top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
Expand Down
17 changes: 3 additions & 14 deletions arch/arm/src/common/up_vfork.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,11 @@
* Pre-processor Definitions
****************************************************************************/

/* ARM requires at least a 4-byte stack alignment. For use with EABI and
* floating point, the stack must be aligned to 8-byte addresses.
/* For use with EABI and floating point, the stack must be aligned to 8-byte
* addresses.
*/

#ifndef CONFIG_STACK_ALIGNMENT

/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
*/

# ifdef __ARM_EABI__
# define CONFIG_STACK_ALIGNMENT 8
# else
# define CONFIG_STACK_ALIGNMENT 4
# endif
#endif
#define CONFIG_STACK_ALIGNMENT 8

/****************************************************************************
* Public Functions
Expand Down

0 comments on commit 4b65817

Please sign in to comment.