!587 fix: cortex-m55栈优化

Merge pull request !587 from Harylee/m55
This commit is contained in:
openharmony_ci 2022-02-10 13:37:30 +00:00 committed by Gitee
commit a68323683d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 79 additions and 89 deletions

View File

@ -41,6 +41,16 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
typedef struct TagTskContext { typedef struct TagTskContext {
UINT32 uwEXCLR;
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ #if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined(__FPU_USED) && (__FPU_USED == 1U))) (defined(__FPU_USED) && (__FPU_USED == 1U)))
UINT32 S16; UINT32 S16;
@ -60,15 +70,6 @@ typedef struct TagTskContext {
UINT32 S30; UINT32 S30;
UINT32 S31; UINT32 S31;
#endif #endif
UINT32 uwR4;
UINT32 uwR5;
UINT32 uwR6;
UINT32 uwR7;
UINT32 uwR8;
UINT32 uwR9;
UINT32 uwR10;
UINT32 uwR11;
UINT32 uwPriMask;
UINT32 uwR0; UINT32 uwR0;
UINT32 uwR1; UINT32 uwR1;
UINT32 uwR2; UINT32 uwR2;

View File

@ -112,8 +112,10 @@ LITE_OS_SEC_TEXT_INIT VOID *ArchTskStackInit(UINT32 taskID, UINT32 stackSize, VO
context->S15 = 0xAA00000F; context->S15 = 0xAA00000F;
context->FPSCR = 0x00000000; context->FPSCR = 0x00000000;
context->NO_NAME = 0xAA000011; context->NO_NAME = 0xAA000011;
context->uwEXCLR = 0xFFFFFFEDL;
#else
context->uwEXCLR = 0xFFFFFFFDL;
#endif #endif
context->uwR4 = 0x04040404L; context->uwR4 = 0x04040404L;
context->uwR5 = 0x05050505L; context->uwR5 = 0x05050505L;
context->uwR6 = 0x06060606L; context->uwR6 = 0x06060606L;

View File

@ -33,13 +33,10 @@
.fpu vfpv3-d16-fp16 .fpu vfpv3-d16-fp16
.thumb .thumb
.equ OS_FPU_CPACR, 0xE000ED88
.equ OS_FPU_CPACR_ENABLE, 0x00F00000
.equ OS_NVIC_INT_CTRL, 0xE000ED04 .equ OS_NVIC_INT_CTRL, 0xE000ED04
.equ OS_NVIC_SYSPRI3, 0xE000ED20 .equ OS_NVIC_SYSPRI3, 0xE000ED20
.equ OS_NVIC_PENDSV_PRI, 0xF0F00000 .equ OS_NVIC_PENDSV_PRI, 0xF0F00000
.equ OS_NVIC_PENDSVSET, 0x10000000 .equ OS_NVIC_PENDSVSET, 0x10000000
.equ OS_TASK_STATUS_RUNNING, 0x0010
.section .text .section .text
.thumb .thumb
@ -70,13 +67,12 @@ HalStartToRun:
ldr r0, [r1, #4] ldr r0, [r1, #4]
ldr r12, [r0] ldr r12, [r0]
ldr.w r1, =OS_FPU_CPACR ldr r2, [r12]
ldr r1, [r1] tst r2, #0x10
and r1, r1, #OS_FPU_CPACR_ENABLE it ne
cmp r1, #OS_FPU_CPACR_ENABLE
bne __DisabledFPU bne __DisabledFPU
add r12, r12, #100 add r12, r12, #104
ldmfd r12!, {r0-r7} ldmfd r12!, {r0-r7}
add r12, r12, #72 add r12, r12, #72
msr psp, r12 msr psp, r12
@ -88,7 +84,7 @@ HalStartToRun:
bx r6 bx r6
__DisabledFPU: __DisabledFPU:
add r12, r12, #36 add r12, r12, #40
ldmfd r12!, {r0-r7} ldmfd r12!, {r0-r7}
msr psp, r12 msr psp, r12
@ -167,16 +163,12 @@ HalTaskSwitch:
TaskContextSwitch: TaskContextSwitch:
mov lr, r0 mov lr, r0
mrs r0, psp mrs r0, psp
stmfd r0!, {r4-r12} tst lr, #0x10
it eq
vstmdbeq r0!, {d8-d15}
mov r3, lr
stmfd r0!, {r3-r12}
ldr.w r3, =OS_FPU_CPACR
ldr r3, [r3]
and r3, r3, #OS_FPU_CPACR_ENABLE
cmp r3, #OS_FPU_CPACR_ENABLE
bne __DisabledFPU1
vstmdb r0!, {d8-d15}
__DisabledFPU1:
ldr r5, =g_losTask ldr r5, =g_losTask
ldr r6, [r5] ldr r6, [r5]
str r0, [r6] str r0, [r6]
@ -186,15 +178,10 @@ __DisabledFPU1:
ldr r1, [r0] ldr r1, [r0]
SignalContextRestore: SignalContextRestore:
ldr.w r3, =OS_FPU_CPACR ldmfd r1!, {r3-r12}
ldr r3, [r3] tst r3, #0x10
and r3, r3, #OS_FPU_CPACR_ENABLE it eq
cmp r3, #OS_FPU_CPACR_ENABLE vldmiaeq r1!, {d8-d15}
bne __DisabledFPU2
VLDMIA r1!, {d8-d15}
__DisabledFPU2:
ldmfd r1!, {r4-r12}
msr psp, r1 msr psp, r1
msr PRIMASK, r12 msr PRIMASK, r12

View File

@ -248,7 +248,7 @@ osExcDispatch:
.fnstart .fnstart
.cantunwind .cantunwind
LDR R2, =OS_NVIC_ACT_BASE LDR R2, =OS_NVIC_ACT_BASE
MOV R12, #8 // R12 is hwi check loop counter MOV R12, #16 // R12 is hwi check loop counter
.fnend .fnend
.type _hwiActiveCheck, %function .type _hwiActiveCheck, %function