fix: trustzone 中断适配

【背景】当前无法使用 trustzone。

【修改方案】
由于tz需要使用svc中断,因此删除之前使用的HalExcSvcCall的地方,改为HalSVCHandler

【影响】
对现有的产品编译不会有影响。

re #I42TFV
Signed-off-by: wangchen <253227059@qq.com>
This commit is contained in:
wangchen 2021-07-28 17:19:46 +08:00
parent 6b732ca351
commit 15a2c17f79
10 changed files with 12 additions and 29 deletions

View File

@ -61,7 +61,7 @@ static_library("kernel") {
} else if ("$board_cpu" == "cortex-m7") { } else if ("$board_cpu" == "cortex-m7") {
deps = [ "arch/arm/cortex-m7/gcc/:arch" ] deps = [ "arch/arm/cortex-m7/gcc/:arch" ]
} else if ("$board_cpu" == "cortex-m33") { } else if ("$board_cpu" == "cortex-m33") {
deps = [ "arch/arm/cortex-m33/gcc/:arch" ] deps = [ "arch/arm/cortex-m33/gcc/TZ:arch" ]
} else if ("$board_cpu" == "") { } else if ("$board_cpu" == "") {
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") { if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {
deps = [ "arch/risc-v/riscv32/gcc:arch" ] deps = [ "arch/risc-v/riscv32/gcc:arch" ]

View File

@ -545,7 +545,7 @@ VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID); VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID); VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID); VOID HalExcUsageFault(VOID);
VOID HalExcSvcCall(VOID); VOID HalSVCHandler(VOID);
VOID HalHwiInit(); VOID HalHwiInit();

View File

@ -41,7 +41,7 @@
.global HalExcMemFault .global HalExcMemFault
.global HalExcBusFault .global HalExcBusFault
.global HalExcUsageFault .global HalExcUsageFault
.global HalExcSvcCall .global HalSVCHandler
.extern HalExcHandleEntry .extern HalExcHandleEntry
.extern g_uwExcTbl .extern g_uwExcTbl
@ -148,9 +148,9 @@ osHFExcCommonBMU:
B osExcDispatch B osExcDispatch
.fnend .fnend
.type HalExcSvcCall, %function .type HalSVCHandler, %function
.global HalExcSvcCall .global HalSVCHandler
HalExcSvcCall: HalSVCHandler:
.fnstart .fnstart
.cantunwind .cantunwind
TST LR, #0x4 TST LR, #0x4

View File

@ -497,7 +497,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault; g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault; g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault; g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall; g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV; g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler; g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;

View File

@ -41,6 +41,8 @@ static_library("arch") {
] ]
include_dirs = [ include_dirs = [
"./non_secure",
"./secure",
"../../../../../../kernel/arch/include", "../../../../../../kernel/arch/include",
"../../../../../../kernel/arch/include", "../../../../../../kernel/arch/include",
"../../../../../../kernel/include", "../../../../../../kernel/include",

View File

@ -545,7 +545,7 @@ VOID HalExcHardFault(VOID);
VOID HalExcMemFault(VOID); VOID HalExcMemFault(VOID);
VOID HalExcBusFault(VOID); VOID HalExcBusFault(VOID);
VOID HalExcUsageFault(VOID); VOID HalExcUsageFault(VOID);
VOID HalExcSvcCall(VOID); VOID HalSVCHandler(VOID);
VOID HalHwiInit(); VOID HalHwiInit();

View File

@ -48,8 +48,6 @@
.type HalStartFirstTask, %function .type HalStartFirstTask, %function
.global HalStartFirstTask .global HalStartFirstTask
HalStartFirstTask: HalStartFirstTask:
.fnstart
.cantunwind
MOV R0, #2 MOV R0, #2
MSR CONTROL, R0 MSR CONTROL, R0
@ -77,7 +75,6 @@ __DisabledFPU1:
MSR PSP, R12 MSR PSP, R12
CPSIE I CPSIE I
BX R3 BX R3
.fnend
.type HalIntLock, %function .type HalIntLock, %function
.global HalIntLock .global HalIntLock

View File

@ -41,7 +41,6 @@
.global HalExcMemFault .global HalExcMemFault
.global HalExcBusFault .global HalExcBusFault
.global HalExcUsageFault .global HalExcUsageFault
.global HalExcSvcCall
.extern HalExcHandleEntry .extern HalExcHandleEntry
.extern g_uwExcTbl .extern g_uwExcTbl
@ -148,21 +147,6 @@ osHFExcCommonBMU:
B osExcDispatch B osExcDispatch
.fnend .fnend
.type HalExcSvcCall, %function
.global HalExcSvcCall
HalExcSvcCall:
.fnstart
.cantunwind
TST LR, #0x4
ITE EQ
MRSEQ R0, MSP
MRSNE R0, PSP
LDR R1, [R0,#24]
LDRB R0, [R1,#-2]
MOV R1, #0
B osExcDispatch
.fnend
.type HalExcBusFault, %function .type HalExcBusFault, %function
.global HalExcBusFault .global HalExcBusFault
HalExcBusFault: HalExcBusFault:

View File

@ -497,7 +497,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault; g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault; g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault; g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall; g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalSVCHandler;
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV; g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler; g_hwiForm[SysTick_IRQn + OS_SYS_VECTOR_CNT] = OsTickHandler;

View File

@ -94,7 +94,7 @@ HalSecureContextSaveAsm:
MOV R0, #0 MOV R0, #0
MSR PSPLIM, R0 /* No PSPLIM for the current task. */ MSR PSPLIM, R0 /* No PSPLIM for the current task. */
MSR PSP, R0 /* No secure stack for the current task. */ MSR PSP, R0 /* No secure stack for the current task. */
.fnend
__ThreadMode: __ThreadMode:
BX LR BX LR
.fnend