fix: m4核在任务中异常时backtrace使用的是MSP所在的栈,而不是PSP所在的栈

m4核开启浮点运算时,异常处理流程未将浮点压栈,导致异常上下文信息错位,
进而导致backtrace时使用的SP值错误,从而出现backtrace时使用的栈信息不对。

close: #I4D7GE

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: If7d5198d1f808de4f1cd9c2bc5c6f68185a4ffac
This commit is contained in:
zff 2021-10-18 11:16:19 +08:00
parent 28bdb690ba
commit 3e8aea224e
2 changed files with 10 additions and 8 deletions

View File

@ -30,7 +30,7 @@
*/ */
.syntax unified .syntax unified
.arch armv7e-m .arch armv7e-m
.fpu fpv5-d16 .fpu fpv4-sp-d16
.thumb .thumb
.equ OS_FPU_CPACR, 0xE000ED88 .equ OS_FPU_CPACR, 0xE000ED88

View File

@ -29,9 +29,10 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
.syntax unified .syntax unified
.arch armv7e-m .arch armv7e-m
.thumb .fpu fpv4-sp-d16
.thumb
.section .text .section .text
@ -281,7 +282,7 @@ _ExcInMSP:
PUSH {R3} PUSH {R3}
MRS R12, PRIMASK // store message-->exc: disable int? MRS R12, PRIMASK // store message-->exc: disable int?
PUSH {R4-R12} // store message-->exc: {R4-R12} PUSH {R4-R12} // store message-->exc: {R4-R12}
#VPUSH {D8-D15} // FPU VPUSH {D8-D15} // FPU
B _handleEntry B _handleEntry
.fnend .fnend
@ -337,12 +338,13 @@ _hwiActiveCheckNext:
MRS R12, PRIMASK MRS R12, PRIMASK
PUSH {R4-R12} PUSH {R4-R12}
VPUSH {D8-D15} // FPU
// copy auto saved task register // copy auto saved task register
LDMFD R3!, {R4-R11} // R4-R11 store PSP reg(auto push when exc in task) LDMFD R3!, {R4-R11} // R4-R11 store PSP reg(auto push when exc in task)
#VLDMIA R3!, {D8-D15} // FPU VLDMIA R3!, {D8-D15} // FPU
#VSTMDB R2!, {D8-D15} // FPU VSTMDB R2!, {D8-D15} // FPU
STMFD R2!, {R4-R11} STMFD R2!, {R4-R11}
B _handleEntry B _handleEntry
.fnend .fnend