Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos M
提交
c7b91d7a
K
Kernel Liteos M
项目概览
OpenHarmony
/
Kernel Liteos M
大约 1 年 前同步成功
通知
20
Star
28
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos M
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c7b91d7a
编写于
7月 14, 2021
作者:
O
openharmony_ci
提交者:
Gitee
7月 14, 2021
浏览文件
操作
浏览文件
下载
差异文件
!222 优化arm9调度汇编代码,任务执行默认system模式,解决多种模式使用混乱问题
Merge pull request !222 from JerryH/arm9
上级
73a99977
97b5b083
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
106 addition
and
137 deletion
+106
-137
kernel/arch/arm/arm9/gcc/los_arch_context.h
kernel/arch/arm/arm9/gcc/los_arch_context.h
+1
-0
kernel/arch/arm/arm9/gcc/los_context.c
kernel/arch/arm/arm9/gcc/los_context.c
+8
-4
kernel/arch/arm/arm9/gcc/los_dispatch.S
kernel/arch/arm/arm9/gcc/los_dispatch.S
+93
-38
kernel/arch/arm/arm9/gcc/los_exc.S
kernel/arch/arm/arm9/gcc/los_exc.S
+0
-91
kernel/arch/arm/arm9/gcc/reset_vector.S
kernel/arch/arm/arm9/gcc/reset_vector.S
+4
-4
未找到文件。
kernel/arch/arm/arm9/gcc/los_arch_context.h
浏览文件 @
c7b91d7a
...
...
@@ -70,6 +70,7 @@ typedef struct TagTskContext {
UINT32
r10
;
UINT32
r11
;
UINT32
r12
;
UINT32
sp
;
UINT32
lr
;
UINT32
pc
;
}
TaskContext
;
...
...
kernel/arch/arm/arm9/gcc/los_context.c
浏览文件 @
c7b91d7a
...
...
@@ -39,8 +39,6 @@
#include "los_arch_timer.h"
#include "los_debug.h"
UINT32
g_sysNeedSched
=
0
;
/* ****************************************************************************
Function : HalArchInit
Description : arch init function
...
...
@@ -104,14 +102,15 @@ LITE_OS_SEC_TEXT_INIT VOID *HalTskStackInit(UINT32 taskID, UINT32 stackSize, VOI
context
->
r10
=
0x10101010L
;
context
->
r11
=
0x11111111L
;
context
->
r12
=
0x12121212L
;
context
->
sp
=
(
UINTPTR
)
topStack
+
stackSize
;
context
->
lr
=
(
UINTPTR
)
HalSysExit
;
if
((
UINTPTR
)
taskCB
->
taskEntry
&
0x01
)
{
context
->
pc
=
(
UINTPTR
)
OsTaskEntryThumb
;
context
->
spsr
=
PSR_MODE_S
VC
_THUMB
;
/* thumb mode */
context
->
spsr
=
PSR_MODE_S
YS
_THUMB
;
/* thumb mode */
}
else
{
context
->
pc
=
(
UINTPTR
)
OsTaskEntryArm
;
context
->
spsr
=
PSR_MODE_S
VC
_ARM
;
/* arm mode */
context
->
spsr
=
PSR_MODE_S
YS
_ARM
;
/* arm mode */
}
return
(
VOID
*
)
context
;
...
...
@@ -131,6 +130,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 HalStartSchedule(OS_TICK_HANDLER handler)
return
LOS_OK
;
/* never return */
}
LITE_OS_SEC_TEXT_INIT
VOID
HalTaskSchedule
(
VOID
)
{
__asm__
__volatile__
(
"swi 0"
);
}
LITE_OS_SEC_TEXT_INIT
VOID
dmb
(
VOID
)
{
__asm__
__volatile__
(
""
:
:
:
"memory"
);
...
...
kernel/arch/arm/arm9/gcc/los_dispatch.S
浏览文件 @
c7b91d7a
...
...
@@ -42,73 +42,128 @@
.
equ
OS_PSR_MODE_UND
,
0x1B
U
.
equ
OS_PSR_MODE_SYS
,
0x1F
U
.
global
HalExceptIrqHdl
.
global
HalTaskSchedule
.
global
HalStartToRun
.
global
OsTaskEntryArm
.
global
OsTaskEntryThumb
.
global
HalExceptSwiHdl
.
global
HalExceptFiqHdl
.
global
HalExceptIrqHdl
.
extern
OsTaskEntry
.
extern
OsSchedTaskSwitch
.
extern
g_sysNeedSched
.
extern
HalInterrupt
.
extern
g_losTask
.
code
32
.
text
HalStartToRun
:
MSR
CPSR_c
,
#(
OS_PSR_INT_DIS
| OS_PSR_FIQ_DIS |
OS_PSR_MODE_SVC
)
.
macro
SAVE_CONTEXT
STMFD
SP
!,
{
R0
}
LDR
R1
,
=
g_losTask
LDR
R0
,
[
R1
,
#
4
]
LDR
SP
,
[
R0
]
MRS
R0
,
SPSR
AND
R0
,
R0
,
#
OS_PSR_MODE_SYS
CMP
R0
,
#
OS_PSR_MODE_SYS
BNE
1
f
STMFD
SP
!,
{
SP
}^
LDMFD
SP
!,
{
R0
}
MSR
SPSR_cxsf
,
R0
LDMFD
SP
!,
{
R0
-
R12
,
LR
,
PC
}^
STMFD
R0
!,
{
LR
}
MOV
LR
,
R0
LDMFD
SP
!,
{
R0
}
HalTaskSchedule
:
STMFD
SP
!,
{
LR
}
STMFD
SP
!,
{
LR
}
STMFD
SP
!,
{
R0
-
R12
}
STMFD
LR
,
{
R0
-
R14
}^
MRS
R0
,
CPSR
MRS
R1
,
CPSR
ORR
R1
,
#
OS_PSR_IRQ_DIS
MSR
CPSR
,
R1
SUB
LR
,
LR
,
#
60
MRS
R0
,
SPSR
STMFD
LR
!,
{
R0
}
LDR
R1
,
=
g_losTask
LDR
R1
,
[
R1
]
STR
LR
,
[
R1
]
B
2
f
TST
LR
,
#
1
ORRNE
R0
,
R0
,
#
OS_PSR_THUMB
1
:
LDMFD
SP
!,
{
R0
}
STMFD
SP
!,
{
R0
-
R12
,
LR
}
MRS
R0
,
SPSR
STMFD
SP
!,
{
R0
}
LDR
R1
,
=
g_sysNeedSched
MOV
R2
,
#
1
STR
R2
,
[
R1
]
2
:
.
endm
LDR
R0
,
=
g_intCount
LDR
R0
,
[
R0
]
CMP
R0
,
#
0
BNE
TaskContextLoad
STR
R0
,
[
R1
]
.
macro
RETSORE_CONTEXT
MRS
R0
,
SPSR
AND
R0
,
R0
,
#
OS_PSR_MODE_SYS
CMP
R0
,
#
OS_PSR_MODE_SYS
BNE
3
f
LDR
R1
,
=
g_losTask
LDR
R1
,
[
R1
]
LDR
LR
,
[
R1
]
LDMFD
LR
!,
{
R0
}
MSR
SPSR_cxsf
,
R0
LDMFD
LR
,
{
R0
-
R14
}^
ADD
LR
,
LR
,
#
60
LDMFD
LR
!,
{PC}
^
3
:
LDMFD
SP
!,
{
R0
}
MSR
SPSR_cxsf
,
R0
LDMFD
SP
!,
{
R0
-
R12
,
LR
}
MOVS
PC
,
LR
.
endm
.
macro
TASK_SWITCH
MRS
R0
,
CPSR
ORR
R0
,
R0
,
#
OS_PSR_INT_DIS
MSR
CPSR
,
R0
BLX
OsSchedTaskSwitch
CMP
R0
,
#
0
BNE
NewTaskContextSwitch
B
TaskContextLoad
BEQ
4
f
NewTaskContextSwitch
:
LDR
R0
,
=
g_losTask
LDR
R1
,
[
R0
]
STR
SP
,
[
R1
]
LDR
R1
,
[
R0
,
#
4
]
STR
R1
,
[
R0
]
LDR
SP
,
[
R1
]
TaskContextLoad
:
LDMFD
SP
!,
{
R0
}
4
:
.
endm
HalStartToRun
:
LDR
R1
,
=
g_losTask
LDR
R0
,
[
R1
,
#
4
]
LDR
LR
,
[
R0
]
LDMFD
LR
!,
{
R0
}
MSR
SPSR_cxsf
,
R0
LDMFD
SP
!,
{
R0
-
R12
,
LR
,
PC
}^
LDMFD
LR
,
{
R0
-
R14
}^
ADD
LR
,
LR
,
#
60
LDMFD
LR
!,
{PC}
^
HalExceptSwiHdl
:
SAVE_CONTEXT
TASK_SWITCH
RETSORE_CONTEXT
HalExceptFiqHdl
:
SUB
LR
,
LR
,
#
4
SAVE_CONTEXT
BLX
HalInterrupt
RETSORE_CONTEXT
HalExceptIrqHdl
:
SUB
LR
,
LR
,
#
4
SAVE_CONTEXT
BLX
HalInterrupt
RETSORE_CONTEXT
OsTaskEntryArm
:
STMFD
SP
!,
{
LR
}
...
...
kernel/arch/arm/arm9/gcc/los_exc.S
浏览文件 @
c7b91d7a
...
...
@@ -50,23 +50,13 @@
.
equ
OS_EXCEPT_ADDR_ABORT
,
0x06
.
equ
OS_EXCEPT_IRQ
,
0x07
.
global
HalExceptFiqHdl
.
global
HalExceptAddrAbortHdl
.
global
HalExceptDataAbortHdl
.
global
HalExceptPrefetchAbortHdl
.
global
HalExceptSwiHdl
.
global
HalExceptUndefInstrHdl
.
global
HalExceptIrqHdl
.
extern
g_sysNeedSched
.
extern
g_losTaskLock
.
extern
HalExcHandleEntry
.
extern
HalInterrupt
.
extern
OsSchedTaskSwitch
.
extern
__svc_stack_top
.
extern
__exc_stack_top
.
extern
__irq_stack_top
.
code
32
.
text
...
...
@@ -76,19 +66,6 @@ HalExceptUndefInstrHdl:
MOV
R0
,
#
OS_EXCEPT_UNDEF_INSTR
B
_osExceptDispatch
HalExceptSwiHdl
:
STMFD
SP
!,
{
LR
}
STMFD
SP
!,
{
LR
}
STMFD
SP
!,
{
SP
}
STMFD
SP
!,
{
R0
-
R12
}
MRS
R1
,
SPSR
STMFD
SP
!,
{
R1
}
MOV
R0
,
#
OS_EXCEPT_SWI
B
_osExceptionSwi
HalExceptPrefetchAbortHdl
:
SUB
LR
,
LR
,
#
4
STMFD
SP
!,
{
R0
-
R5
}
...
...
@@ -113,72 +90,6 @@ HalExceptAddrAbortHdl:
B
_osExceptDispatch
HalExceptFiqHdl
:
SUB
LR
,
LR
,
#
4
STMFD
SP
!,
{
R0
-
R5
}
MOV
R0
,
#
OS_EXCEPT_FIQ
B
_osExceptDispatch
HalExceptIrqHdl
:
SUB
LR
,
LR
,
#
4
STMFD
SP
!,
{
R0
-
R2
}
MOV
R0
,
SP
MRS
R1
,
SPSR
MOV
R2
,
LR
MSR
CPSR_c
,
#(
OS_PSR_INT_DIS
| OS_PSR_FIQ_DIS |
OS_PSR_MODE_SVC
)
STMFD
SP
!,
{
R2
}
STMFD
SP
!,
{
LR
}
STMFD
SP
!,
{
R3
-
R12
}
LDMFD
R0
!,
{
R5
-
R7
}
STMFD
SP
!,
{
R5
-
R7
}
STMFD
SP
!,
{
R1
}
LDR
R2
,
=
g_losTask
LDR
R3
,
[
R2
]
STR
SP
,
[
R3
]
LDR
SP
,
=
__svc_stack_top
BLX
HalInterrupt
LDR
R0
,
=
g_losTaskLock
LDR
R0
,
[
R0
]
CMP
R0
,
#
0
BNE
NoTaskContextSwitch
LDR
R0
,
=
g_sysNeedSched
LDR
R0
,
[
R0
]
CMP
R0
,
#
0
BNE
NeedTaskSwitch
B
NoTaskContextSwitch
NeedTaskSwitch
:
LDR
R0
,
=
g_sysNeedSched
MOV
R1
,
#
0
STR
R1
,
[
R0
]
BLX
OsSchedTaskSwitch
CMP
R0
,
#
0
BEQ
NoTaskContextSwitch
LDR
R0
,
=
g_losTask
LDR
R1
,
[
R0
,
#
4
]
STR
R1
,
[
R0
]
LDR
SP
,
[
R1
]
B
TaskContextLoad
NoTaskContextSwitch
:
LDR
R1
,
=
g_losTask
LDR
R1
,
[
R1
]
LDR
SP
,
[
R1
]
TaskContextLoad
:
LDMFD
SP
!,
{
R0
}
MSR
SPSR_cxsf
,
R0
LDMFD
SP
!,
{
R0
-
R12
,
LR
,
PC
}^
_osExceptDispatch
:
MRS
R1
,
SPSR
MOV
R2
,
LR
...
...
@@ -196,8 +107,6 @@ _osExceptDispatch:
LDMFD
R4
!,
{
R6
-
R12
}
STMFD
SP
!,
{
R6
-
R11
}
STMFD
SP
!,
{
R1
}
_osExceptionSwi
:
MOV
R3
,
SP
_osExceptionGetSP
:
...
...
kernel/arch/arm/arm9/gcc/reset_vector.S
浏览文件 @
c7b91d7a
...
...
@@ -79,7 +79,6 @@ _vector_start:
B
HalExceptIrqHdl
B
HalExceptFiqHdl
.
globl
HalResetVector
.
section
".boot"
,
"ax"
...
...
@@ -133,17 +132,18 @@ __abt_stack:
__abt_stack_top
:
__irq_stack
:
.
space
6
4
.
space
102
4
__irq_stack_top
:
__fiq_stack
:
.
space
6
4
.
space
102
4
__fiq_stack_top
:
__svc_stack
:
.
space
4096
.
space
1024
__svc_stack_top
:
__exc_stack
:
.
space
512
__exc_stack_top
:
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录