forked from auracaster/openocd
rtos: turn stack alignment into a function pointer
Some targets (Cortex M) require more complicated calculations for turning the stored stack pointer back into a process stack pointer. For example, the Cortex M stores a bit in the auto-stacked xPSR indicating that alignment had to be performed and an additional 4 byte padding is present before the exception stacking. This change only sets up the framework for Cortex-M unstacking and does not add Cortex-M support. Note: this also fixes the alignment calculation nearly addressed by change #2301 entitled rtos/rtos.c: fix stack alignment calculation. Updated calculation is in rtos_generic_stack_align. Change-Id: I0f662cad0df81cbe5866219ad0fef980dcb3e44f Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com> Cc: Paul Fertser <fercerpav@gmail.com> Cc: Andreas Fritiofson <andreas.fritiofson@gmail.com> Cc: Evan Hunter <evanhunter920@gmail.com> Cc: Jon Burgess <jburgess777@gmail.com> Reviewed-on: http://openocd.zylin.com/3002 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
This commit is contained in:
committed by
Freddie Chopin
parent
ddc3317c54
commit
9413a7a814
+9
-1
@@ -83,7 +83,15 @@ struct rtos_register_stacking {
|
||||
unsigned char stack_registers_size;
|
||||
signed char stack_growth_direction;
|
||||
unsigned char num_output_registers;
|
||||
unsigned char stack_alignment;
|
||||
/* Some targets require evaluating the stack to determine the
|
||||
* actual stack pointer for a process. If this field is NULL,
|
||||
* just use stacking->stack_registers_size * stack_growth_direction
|
||||
* to calculate adjustment.
|
||||
*/
|
||||
int64_t (*calculate_process_stack)(struct target *target,
|
||||
const uint8_t *stack_data,
|
||||
const struct rtos_register_stacking *stacking,
|
||||
int64_t stack_ptr);
|
||||
const struct stack_register_offset *register_offsets;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user