arch: arm: aarch32: cortex_a_r: Dump callee saved registers on fault
Some of these registers may contain nuggets of information that would be beneficial when debugging, so include them in the fault dump. Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
This commit is contained in:
parent
c96ae584bf
commit
92a3209c5c
|
@ -29,6 +29,7 @@ config CPU_CORTEX_R
|
|||
select CPU_CORTEX
|
||||
select HAS_CMSIS_CORE
|
||||
select HAS_FLASH_LOAD_OFFSET
|
||||
select ARCH_HAS_EXTRA_EXCEPTION_INFO
|
||||
help
|
||||
This option signifies the use of a CPU of the Cortex-R family.
|
||||
|
||||
|
|
|
@ -65,17 +65,52 @@ SECTION_SUBSEC_FUNC(TEXT, __exc, z_arm_undef_instruction)
|
|||
stmfd sp, {r0-r3, r12, lr}^
|
||||
sub sp, #24
|
||||
|
||||
/*
|
||||
* Create new esf struct for exception handler debug. The first
|
||||
* time the basic stack frame is saved is for getting in and out
|
||||
* of the exception.
|
||||
*/
|
||||
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
|
||||
sub sp, #___callee_saved_t_SIZEOF
|
||||
sub sp, #___extra_esf_info_t_SIZEOF
|
||||
#endif
|
||||
|
||||
srsdb sp!, #MODE_UND
|
||||
stmfd sp, {r0-r3, r12, lr}^
|
||||
sub sp, #24
|
||||
|
||||
/* Increment exception nesting count */
|
||||
ldr r2, =_kernel
|
||||
ldr r0, [r2, #_kernel_offset_to_nested]
|
||||
add r0, r0, #1
|
||||
str r0, [r2, #_kernel_offset_to_nested]
|
||||
|
||||
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
|
||||
/* Pointer to extra esf info */
|
||||
add r0, sp, #___basic_sf_t_SIZEOF
|
||||
mov r1, #0
|
||||
str r1, [r0, #4]
|
||||
str r1, [r0, #8]
|
||||
|
||||
/* Pointer to callee saved registers */
|
||||
add r1, r0, #___extra_esf_info_t_SIZEOF
|
||||
str r1, [r0]
|
||||
|
||||
cps #MODE_SYS
|
||||
stm r1, {r4-r11, sp}
|
||||
cps #MODE_UND
|
||||
#endif
|
||||
|
||||
/* Invoke fault handler */
|
||||
mov r0, sp
|
||||
bl z_arm_fault_undef_instruction
|
||||
|
||||
/* Exit exception */
|
||||
add sp, sp, #___basic_sf_t_SIZEOF
|
||||
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
|
||||
add sp, #___extra_esf_info_t_SIZEOF
|
||||
add sp, #___callee_saved_t_SIZEOF
|
||||
#endif
|
||||
b z_arm_exc_exit
|
||||
|
||||
/**
|
||||
|
@ -99,17 +134,52 @@ SECTION_SUBSEC_FUNC(TEXT, __exc, z_arm_prefetch_abort)
|
|||
stmfd sp, {r0-r3, r12, lr}^
|
||||
sub sp, #24
|
||||
|
||||
/*
|
||||
* Create new esf struct for exception handler debug. The first
|
||||
* time the basic stack frame is saved is for getting in and out
|
||||
* of the exception.
|
||||
*/
|
||||
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
|
||||
sub sp, #___callee_saved_t_SIZEOF
|
||||
sub sp, #___extra_esf_info_t_SIZEOF
|
||||
#endif
|
||||
|
||||
srsdb sp!, #MODE_ABT
|
||||
stmfd sp, {r0-r3, r12, lr}^
|
||||
sub sp, #24
|
||||
|
||||
/* Increment exception nesting count */
|
||||
ldr r2, =_kernel
|
||||
ldr r0, [r2, #_kernel_offset_to_nested]
|
||||
add r0, r0, #1
|
||||
str r0, [r2, #_kernel_offset_to_nested]
|
||||
|
||||
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
|
||||
/* Pointer to extra esf info */
|
||||
add r0, sp, #___basic_sf_t_SIZEOF
|
||||
mov r1, #0
|
||||
str r1, [r0, #4]
|
||||
str r1, [r0, #8]
|
||||
|
||||
/* Pointer to callee saved registers */
|
||||
add r1, r0, #___extra_esf_info_t_SIZEOF
|
||||
str r1, [r0]
|
||||
|
||||
cps #MODE_SYS
|
||||
stm r1, {r4-r11, sp}
|
||||
cps #MODE_ABT
|
||||
#endif
|
||||
|
||||
/* Invoke fault handler */
|
||||
mov r0, sp
|
||||
bl z_arm_fault_prefetch
|
||||
|
||||
/* Exit exception */
|
||||
add sp, sp, #___basic_sf_t_SIZEOF
|
||||
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
|
||||
add sp, #___extra_esf_info_t_SIZEOF
|
||||
add sp, #___callee_saved_t_SIZEOF
|
||||
#endif
|
||||
b z_arm_exc_exit
|
||||
|
||||
/**
|
||||
|
@ -134,15 +204,50 @@ SECTION_SUBSEC_FUNC(TEXT, __exc, z_arm_data_abort)
|
|||
stmfd sp, {r0-r3, r12, lr}^
|
||||
sub sp, #24
|
||||
|
||||
/*
|
||||
* Create new esf struct for exception handler debug. The first
|
||||
* time the basic stack frame is saved is for getting in and out
|
||||
* of the exception.
|
||||
*/
|
||||
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
|
||||
sub sp, #___callee_saved_t_SIZEOF
|
||||
sub sp, #___extra_esf_info_t_SIZEOF
|
||||
#endif
|
||||
|
||||
srsdb sp!, #MODE_ABT
|
||||
stmfd sp, {r0-r3, r12, lr}^
|
||||
sub sp, #24
|
||||
|
||||
/* Increment exception nesting count */
|
||||
ldr r2, =_kernel
|
||||
ldr r0, [r2, #_kernel_offset_to_nested]
|
||||
add r0, r0, #1
|
||||
str r0, [r2, #_kernel_offset_to_nested]
|
||||
|
||||
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
|
||||
/* Pointer to extra esf info */
|
||||
add r0, sp, #___basic_sf_t_SIZEOF
|
||||
mov r1, #0
|
||||
str r1, [r0, #4]
|
||||
str r1, [r0, #8]
|
||||
|
||||
/* Pointer to callee saved registers */
|
||||
add r1, r0, #___extra_esf_info_t_SIZEOF
|
||||
str r1, [r0]
|
||||
|
||||
cps #MODE_SYS
|
||||
stm r1, {r4-r11, sp}
|
||||
cps #MODE_ABT
|
||||
#endif
|
||||
|
||||
/* Invoke fault handler */
|
||||
mov r0, sp
|
||||
bl z_arm_fault_data
|
||||
|
||||
/* Exit exception */
|
||||
add sp, sp, #___basic_sf_t_SIZEOF
|
||||
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
|
||||
add sp, #___extra_esf_info_t_SIZEOF
|
||||
add sp, #___callee_saved_t_SIZEOF
|
||||
#endif
|
||||
b z_arm_exc_exit
|
||||
|
|
|
@ -51,6 +51,7 @@ GEN_OFFSET_SYM(_basic_sf_t, ip);
|
|||
GEN_OFFSET_SYM(_basic_sf_t, lr);
|
||||
GEN_OFFSET_SYM(_basic_sf_t, pc);
|
||||
GEN_OFFSET_SYM(_basic_sf_t, xpsr);
|
||||
GEN_ABSOLUTE_SYM(___basic_sf_t_SIZEOF, sizeof(_basic_sf_t));
|
||||
|
||||
#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
|
||||
GEN_OFFSET_SYM(_esf_t, s);
|
||||
|
@ -73,6 +74,10 @@ GEN_OFFSET_SYM(_callee_saved_t, psp);
|
|||
|
||||
GEN_ABSOLUTE_SYM(___callee_saved_t_SIZEOF, sizeof(struct _callee_saved));
|
||||
|
||||
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
|
||||
GEN_ABSOLUTE_SYM(___extra_esf_info_t_SIZEOF, sizeof(struct __extra_esf_info));
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_THREAD_STACK_INFO)
|
||||
GEN_OFFSET_SYM(_thread_stack_info_t, start);
|
||||
|
||||
|
|
Loading…
Reference in New Issue