forked from Imagelibrary/rtems
bsps/aarch64: RTEMS_DEBUG stack alignment faults
Run with stack alignment faults enabled under RTEMS_DEBUG to catch any stack misalignments early. This makes it easier to track them down should they ever occur.
This commit is contained in:
committed by
Joel Sherrill
parent
9d77c0f425
commit
9951cee08f
@@ -90,6 +90,14 @@ _start:
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Initialize SCTLR_EL1 */
|
||||||
|
mov x0, XZR
|
||||||
|
#if defined(RTEMS_DEBUG)
|
||||||
|
/* Enable Stack alignment checking */
|
||||||
|
orr x0, x0, #(1<<3)
|
||||||
|
#endif
|
||||||
|
msr SCTLR_EL1, x0
|
||||||
|
|
||||||
#ifdef RTEMS_SMP
|
#ifdef RTEMS_SMP
|
||||||
/* Read MPIDR and get current processor index */
|
/* Read MPIDR and get current processor index */
|
||||||
mrs x7, mpidr_el1
|
mrs x7, mpidr_el1
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
* TODO(kmoore) The current implementation here assumes that SP is not
|
* TODO(kmoore) The current implementation here assumes that SP is not
|
||||||
* misaligned.
|
* misaligned.
|
||||||
*/
|
*/
|
||||||
.macro JUMP_HANDLER
|
.macro JUMP_HANDLER_SHORT
|
||||||
/* Mask to use in BIC, lower 7 bits */
|
/* Mask to use in BIC, lower 7 bits */
|
||||||
mov x0, #0x7f
|
mov x0, #0x7f
|
||||||
/* LR contains PC, mask off to the base of the current vector */
|
/* LR contains PC, mask off to the base of the current vector */
|
||||||
@@ -113,6 +113,10 @@
|
|||||||
nop
|
nop
|
||||||
nop
|
nop
|
||||||
nop
|
nop
|
||||||
|
.endm
|
||||||
|
|
||||||
|
.macro JUMP_HANDLER
|
||||||
|
JUMP_HANDLER_SHORT
|
||||||
nop
|
nop
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@@ -182,10 +186,12 @@ curr_el_sp0_serror_get_pc: /* The current PC is now in LR */
|
|||||||
* the current SP.
|
* the current SP.
|
||||||
*/
|
*/
|
||||||
curr_el_spx_sync:
|
curr_el_spx_sync:
|
||||||
|
msr SCTLR_EL1, XZR
|
||||||
stp x0, lr, [sp, #-0x10]! /* Push x0,lr on to the stack */
|
stp x0, lr, [sp, #-0x10]! /* Push x0,lr on to the stack */
|
||||||
bl curr_el_spx_sync_get_pc /* Get current execution address */
|
bl curr_el_spx_sync_get_pc /* Get current execution address */
|
||||||
curr_el_spx_sync_get_pc: /* The current PC is now in LR */
|
curr_el_spx_sync_get_pc: /* The current PC is now in LR */
|
||||||
JUMP_HANDLER
|
/* Use short jump handler since this has an extra instruction to clear SCTLR */
|
||||||
|
JUMP_HANDLER_SHORT
|
||||||
JUMP_TARGET_SPx
|
JUMP_TARGET_SPx
|
||||||
.balign 0x80
|
.balign 0x80
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user