Skip to content

Commit

Permalink
ARM: Fix off-by-one interrupt stack allocation in 8-byte aligned arch…
Browse files Browse the repository at this point in the history
…itectures
  • Loading branch information
David Cabecinhas authored and dcabecinhas committed Mar 14, 2017
1 parent b9bb9ea commit 86400a2
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion arch/arm/src/armv7-m/gnu/up_exception.S
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ exception_common:
.global g_intstackbase
.align 8
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
g_intstackbase:
.size g_intstackalloc, .-g_intstackalloc
#endif
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/armv7-m/gnu/up_lazyexception.S
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ exception_common:
*
* Here:
* r0 = Address of the register save area
* NOTE: It is a requirement that up_restorefpu() preserve the value of
* r0!
*/
Expand Down Expand Up @@ -355,7 +355,7 @@ exception_common:
.global g_intstackbase
.align 8
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
g_intstackbase:
.size g_intstackalloc, .-g_intstackalloc
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/common/up_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static inline void up_color_intstack(void)
uint32_t *ptr = (uint32_t *)&g_intstackalloc;
ssize_t size;

for (size = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
for (size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
size > 0;
size -= sizeof(uint32_t))
{
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/kinetis/kinetis_vectors.S
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ exception_common:
.global g_intstackbase
.align 8
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
g_intstackbase:
.size g_intstackalloc, .-g_intstackalloc
#endif
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/lpc17xx/lpc17_vectors.S
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ exception_common:
*
* Here:
* r0 = Address of the register save area
* NOTE: It is a requirement that up_restorefpu() preserve the value of
* r0!
*/
Expand Down Expand Up @@ -468,7 +468,7 @@ exception_common:
.global g_intstackbase
.align 8
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
g_intstackbase:
.size g_intstackalloc, .-g_intstackalloc
#endif
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/sam34/sam_vectors.S
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ exception_common:
*
* Here:
* r0 = Address of the register save area
* NOTE: It is a requirement that up_restorefpu() preserve the value of
* r0!
*/
Expand Down Expand Up @@ -482,7 +482,7 @@ exception_common:
.global g_intstackbase
.align 8
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
g_intstackbase:
.size g_intstackalloc, .-g_intstackalloc
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/stm32/gnu/stm32_vectors.S
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ exception_common:
.global g_intstackbase
.align 8
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
g_intstackbase:
.size g_intstackalloc, .-g_intstackalloc
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/stm32/iar/stm32_vectors.S
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ l5:
.global g_intstackbase
.align 8
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
g_intstackbase:
.size g_intstackalloc, .-g_intstackalloc
#endif
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/tiva/tiva_vectors.S
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ exception_common:
*
* Here:
* r0 = Address of the register save area
* NOTE: It is a requirement that up_restorefpu() preserve the value of
* r0!
*/
Expand Down Expand Up @@ -459,7 +459,7 @@ exception_common:
.global g_intstackbase
.align 8
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
g_intstackbase:
.size g_intstackalloc, .-g_intstackalloc
#endif
Expand Down

0 comments on commit 86400a2

Please sign in to comment.