Compare commits

...

1220 Commits

Author SHA1 Message Date
openharmony_ci
173cdeb077 !1166 fix: 修复告警
Merge pull request !1166 from Zhaotianyu/20230526fix_codecheck
2023-09-05 13:36:55 +00:00
openharmony_ci
e28271d650 !1174 fix:SysMqNotify系统调用安全增强
Merge pull request !1174 from zhangdengyu/mq_0904
2023-09-04 13:19:17 +00:00
zhangdengyu
27eb4e2334 fix:SysMqNotify系统调用安全增强
Close: #I7YG58

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: Iee5a6c24cd2226e9cab0c4fd37e76194ad068862
2023-09-04 20:43:40 +08:00
openharmony_ci
bd57ef7e2c !1161 添加unittest用例测试工具
Merge pull request !1161 from zhushengle/unittest_tools
2023-09-04 09:12:43 +00:00
zhushengle
342a3eb5c1 feat: 添加unittest用例测试工具
Close #I73IZ3

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I899978a8d8d2edeb30f0ba4d896f6f5abc8a6939
2023-09-04 11:57:15 +08:00
openharmony_ci
63885154d2 !1173 test:调整测试用例
Merge pull request !1173 from zhangdengyu/test_0831
2023-08-31 03:47:11 +00:00
zhangdengyu
95d1eb890a test: 调整测试用例
Close: #I7XBLH

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: Ie58907ea40c062fd1604035945810c53dc7f0bf2
2023-08-31 09:04:51 +08:00
openharmony_ci
0bc453c2cd !1169 修复swtmr遍历不全导致的用例问题
Merge pull request !1169 from wangchen/0726_a
2023-07-26 02:39:24 +00:00
wangchen
73bcf0ec9a Fix: 修复swtmr只在当前核遍历链表的问题
Close #I7NZDT
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-07-26 09:35:58 +08:00
openharmony_ci
49bfc90a63 !1167 容器代码container目录位置变更
Merge pull request !1167 from zwx1232718/master
2023-06-09 09:21:56 +00:00
zwx1232718
b0708886fa container dir change
Signed-off-by: zwx1232718 <zhenghui23@huawei.com>
2023-06-09 16:29:23 +08:00
openharmony_ci
a388a3f565 !1148 修复一些typo错误
Merge pull request !1148 from 景涛/master
2023-06-06 13:36:01 +00:00
arvinzzz
145ff76ab6 refactor: fix codecheck
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ib35ca40dc837d78a4c9dc03e44d117088865a5a6
2023-05-26 15:44:47 +08:00
openharmony_ci
280769ae42 !1163 GN脚本规范化
Merge pull request !1163 from zhushengle/GN
2023-05-23 08:43:40 +00:00
zhushengle
1f3a6c8143 feat: GN脚本规范化
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I80b055091a0ff333a859cd35447a851296a67103
2023-05-23 15:56:45 +08:00
openharmony_ci
6c0b0dde23 !1157 test:调整TDD测试用例
Merge pull request !1157 from zhangdengyu/fixTest0424
2023-05-18 12:14:47 +00:00
zhangdengyu
76228c3617 test: TDD用例调整
方案描述:
1、门禁流水线跑单个测试用例.bin文件有时间限制,将用时过长的bin按类型拆分;
2、缩短EDF测试用例的时间;
3、dynload用例改变当前工作路径未恢复导致执行结果的xml文件未生成,在用例结束退出之前恢复当前工作路径。

Close:#I6YIX6

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I8c6118f9589e8801000ccb0cae9b81e0925696f4
2023-05-18 15:46:12 +08:00
openharmony_ci
5de241eb2a !1160 部件化整改
Merge pull request !1160 from zhushengle/deps
2023-05-09 14:55:31 +00:00
zhushengle
5e68558280 feat: 部件化整改
Close #I71QQ2

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I6f4db7c3775907df06b7186310628fcdee71bdb6
2023-05-09 21:40:00 +08:00
openharmony_ci
9c71de6a2e !1158 Fix : 部件化需求整改
Merge pull request !1158 from yinjiaming/bundle
2023-05-05 08:33:35 +00:00
openharmony_ci
243b1e26a4 !1159 test:修复llvm升级导致tdd用例部分失败问题
Merge pull request !1159 from zhangdengyu/fixLlvmBug0428
2023-05-05 05:14:54 +00:00
yinjiaming
47a4fe030b fix:部件需求整改
修复了脚本扫描出的bundle.json的问题,整改了
不符合规范的路径引用

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I11c321f8707d3e44dd7ee40dac35cf99907fb864
2023-05-04 11:32:59 +08:00
zhangdengyu
577d29aaba test: 修复llvm升级导致tdd用例部分失败问题
方案描述:
1、llvm升级之后对while(1)死循环和给空指针赋值的场景有错误优化的情况;
   用例中在相关函数之前添加__attribute__((optnone))禁止编译器进行错误优化。

Close:#I6V2LN

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: Ic7150909c12a599aeeb0a55b983dfad7a0631cdc
2023-05-04 09:42:38 +08:00
openharmony_ci
d9e9631286 !1156 Fix : 文档失效链接清理
Merge pull request !1156 from yinjiaming/link
2023-04-23 10:59:05 +00:00
yinjiaming
2bd5b686cf fix:文档失效链接清理
文档中部分链接已失效,现予以清理并更换为有效链接

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ib9dfa1e3ec74ed85049aca7c064a6d10a1a3ab46
2023-04-23 18:46:42 +08:00
openharmony_ci
8452488bdb !1149 feat:修复测试用例
Merge pull request !1149 from zhangdengyu/muslUpdate0419
2023-04-21 07:33:16 +00:00
openharmony_ci
a04ab13c76 !1152 修复获取容器信息失败
Merge pull request !1152 from zhushengle/container_bug
2023-04-21 06:40:08 +00:00
zhushengle
338f5d7e7d fix: 修复获取容器信息失败
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ie612d14337f7c24812c74f1510c0a8e6fca1c200
2023-04-20 22:35:20 +08:00
zhangdengyu
fa68ebfcd1 feat: 修复测试用例
方案描述:
musl升级修改了接口部分场景下的错误码,测试用例同步修改。

BREAKING CHANGE:
修复测试用例对外变更描述:
1、socket接口v1.2.0中传入错误参数返回EINVAL错误码,更新之后将返回ENOENT错误码;
2、__nscd_query接口v1.2.0中给传入错误参数返回EAFNOSUPPORT错误码,更新之后将返回ENOENT错误码。

Close: #I6WWES

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: Ib8a1e52b164cf78df917dc28c90f02056a80e1ed
2023-04-19 16:43:20 +08:00
”景涛“
24aa6858ee fix some typo errors
Signed-off-by: ”景涛“ <jingtao3@hust.edu.cn>
2023-04-15 22:16:32 +08:00
openharmony_ci
5fb9165c08 !1139 feat: support EDF
Merge pull request !1139 from zhangdengyu/supportEDF0404
2023-04-09 12:38:18 +00:00
zhangdengyu
13f68dcf9c feat: support EDF
方案描述:
1、liteos_a调度框架支持EDF调度算法,默认优先调度EDF策略的任务
2、用户态musl_c库适配新增调度算法,同步修改相关接口以支持用户态创建EDF进程与线程

BREAKING CHANGE:
support EDF对外变更描述:
以下接口支持SCHED_DEADLINE调度策略:
pthread_attr_getschedparam
pthread_attr_setschedparam
pthread_getschedparam
pthread_setschedparam
pthread_create
sched_getscheduler
sched_getparam
sched_setparam
sched_setscheduler

Close:#I6T3P3

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: Ic9fe6896fcae42ae4ee7fe5dfb8e858a6ed19740
2023-04-09 19:46:26 +08:00
openharmony_ci
f332a06e4c !1134 Ignore warnings for llvm15 upgrade
Merge pull request !1134 from enable_llvm15
2023-04-04 07:03:22 +00:00
guzhihao4
1ba32406bb Ignore warnings for enable llvm15
Issue: #I6LPWU

Signed-off-by: guzhihao4 <guzhihao4@huawei.com>
Change-Id: I7b558fa46239081890ae005de65ba8d2bba1d134
2023-04-03 16:42:22 +08:00
openharmony_ci
249ea71a11 !1135 修复 hm_liteipc.c 处的 typo
Merge pull request !1135 from 邹亚龙/master
2023-04-03 07:53:57 +00:00
Yalong Zou
814f5affd0 fix: 修复 hm_liteipc.c 处的 typo
应拼写成 Receive, 因此此处的函数名称应当是 CheckReceivedMsg.

Signed-off-by: Yalong Zou <yalongz@hust.edu.cn>
2023-03-15 23:04:21 +08:00
openharmony_ci
4ff66c7f40 !1133 fix: 修复网络容器测试失败问题
Merge pull request !1133 from zhushengle/container_net
2023-03-15 02:10:46 +00:00
zhushengle
8f937c8771 fix: 修复网络容器测试失败问题
1.修复网络容器测试失败问题
2.调整测试用例之间的顺序,提高测试用例的稳定性
3.极限压测用例增加延时,等待系统资源回收,增加用例稳定性
4.优化网络容器测试用例重复代码

Close #I6L7VF
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: If800793430c872c432f5fdf2d9c2d968fafb3973
2023-03-09 14:18:24 +08:00
openharmony_ci
2845efe801 !1129 fix:修复内核调用栈解析脚本bug
Merge pull request !1129 from zhangdengyu/fix_debug_script
2023-03-04 06:21:52 +00:00
openharmony_ci
8cc5209181 !1132 feat:修复使用不规范的测试用例
Merge pull request !1132 from zhangdengyu/muslUpdate0303
2023-03-04 05:55:16 +00:00
zhangdengyu
f995c7c7af feat:修复使用不规范的测试用例
1、在编译kernel/liteos_a测试用例时process、extended、libc三个模块出现报错,主要分为以下几种类型:
   1.1、函数返回值为int或其它类型,错误使用了返回NULL的断言宏。修改断言宏返回正确的类型。
   1.2、函数返回值为int或其它类型,错误的return了NULL。修改成正确的返回值类型。
   1.3、waitpid函数第三个参数为int类型,错误传入了NULL。修改成正确的入参类型。
   1.4、使用的断言宏传入的参数一个为int或其他类型,一个为NULL,类似不匹配。修改成匹配的类型。
   1.5、testsuites/unittest/process/basic/pthread/smoke/pthread_test_012.cpp中调用Syscall接口,
        第二个参数为in类型,错误的传入了NULL。修改入参为正确的类型。
2、hb set选择ipcamera_hispark_taurus,编译之后使用nfs将out/hispark_taurus/ipcamera_hispark_taurus/test/unittest/kernel/bin目录中的
   9个测试用例放到单板上进行测试,运行结果全部通过,并生成对应结果从xml文件,其中liteos_a_basic_unittest.bin无xml文件生成是由于gtest框架升级引入。

Close: #I6J7QK

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: Ifa977658bfc47ba85484e06465735cdffef3dbe2
2023-03-03 13:52:19 +08:00
openharmony_ci
a104497e08 !1127 feature: 内核libc升级
Merge pull request !1127 from Zhaotianyu/20230224libc_update
2023-02-28 11:34:24 +00:00
arvinzzz
b5ae9e25c6 feature: fix liteos_a_newlib_kernel compiler error & libc update
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I4a8c2cfb2ba044f000026f738c6da1781cb7db35
2023-02-28 11:07:14 +08:00
openharmony_ci
c2b5a5897f !1126 feat: 支持网络容器
Merge pull request !1126 from zhushengle/net_container
2023-02-28 03:02:24 +00:00
zhangdengyu
f924cc775b fix:修复内核调用栈解析脚本bug
方案描述:
1、修复内核调用栈解析脚本parse_mem_info.sh的bug,将多余符号(`)去除

BREAKING CHANGE:
无

Close:#I6I6BA

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I0b0d7e5f6e79313e5f517f89395f4195883cfe06
2023-02-27 19:01:03 +08:00
zhushengle
5dc9a0f1a6 feat: 支持网络容器
BREAKING CHANGE:
支持网络容器对外变更:
1.支持网络容器
2.setns, clone, unshare接口支持CLONE_NEWNET

Close #I6HPH2

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ibaa11056982d465d4006680c8d3fa4ae2b9f25b5
2023-02-25 12:30:09 +08:00
openharmony_ci
806bd80841 !1125 支持容器限额
Merge pull request !1125 from zhushengle/container_limit
2023-02-24 01:09:47 +00:00
zhushengle
c141a92544 feat 支持容器限额
BREAKING CHANGE:
支持容器限额对外变更:
1.在proc目录下增加sys/user目录,支持max_容器_container 配额文件

Close #I6HDQK

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ieaac046182f679a6f49cbdc74593ab39fcb31f5f
2023-02-23 22:16:18 +08:00
openharmony_ci
10c5e2e666 !1124 限制对资源控制器的删除以及添加资源控制器测试用例
Merge pull request !1124 from zhushengle/cgroups_test
2023-02-23 09:02:50 +00:00
zhushengle
da9ce464dd feat: 添加cgroups测试用例
Close #I6H2AR

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I31a432b69ea5fbad137aa1bb947fff4b6fc307df
2023-02-23 16:16:31 +08:00
openharmony_ci
f0a435dce1 !1123 支持资源限额控制器
Merge pull request !1123 from zhushengle/cgroups_2
2023-02-23 03:50:44 +00:00
zhushengle
b45cdbda3e feat: 支持cgroups
BREAKING CHANGE:
支持cgroups对外变更:
1.在proc目录下支持plimits目录,支持ipc, pid, memory, devices, sched控制器

Close #I6GVPL

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ib996e07bf148abce9e40290d6188b763b52e89bb
2023-02-23 09:32:17 +08:00
openharmony_ci
57455849ca !1116 支持用户容器
Merge pull request !1116 from zhushengle/user_container
2023-02-16 12:29:01 +00:00
openharmony_ci
ea825345c2 !1115 修复xts用例失败的问题
Merge pull request !1115 from zhangdengyu/fixXtsTestCase
2023-02-11 08:30:42 +00:00
zhushengle
f397c63fbd feat: 支持user容器
Close #I6EC0A
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I5314959e66090b0614ad8d2058dc9dff4f0031b0
2023-02-11 16:21:59 +08:00
zhangdengyu
fe6ab18cd9 feat:修复xts用例中ActsNFSTest失败的问题
1、在kernel/liteos_a/fs/proc/os_adapt/proc_vfs.c中VfsProcfsRead等接口中,
   使用spin_lock造成使用锁失败。

Close: #I6E3AU

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I00e57d10bc4e4cf7cbc020903fe229a3aa303ae5
2023-02-11 15:09:08 +08:00
openharmony_ci
c0f5d437d8 !1112 feat: 支持setns接口
Merge pull request !1112 from zhushengle/setns
2023-02-09 12:13:51 +00:00
zhushengle
1ef64e26a1 feat: 支持setns接口
BREAKING CHANGE:
支持setns接口对外变更:
1.新增setns接口

Close #I6D9Y0

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I9aacf9e5b8463e8e6c743a0041a5b2b18fdb0e12
2023-02-09 13:52:54 +08:00
openharmony_ci
77b1b208d1 !1109 Fix : 删除冗余函数
Merge pull request !1109 from yinjiaming/fix
2023-02-08 07:04:45 +00:00
yinjiaming
d17bc9d4ea fix:删除冗余的函数
代码扫描工具发现代码中有被注释的多余函数,现删除。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I26980061390924d53c77e467b2cab2f56b192a82
2023-02-07 16:46:31 +08:00
openharmony_ci
be50721826 !1108 feat: 支持pid容器内访问进程挂载目录
Merge pull request !1108 from zhushengle/proc_pid_dir
2023-02-07 04:07:53 +00:00
zhushengle
4e7d2edbe1 feat: 支持pid容器内访问进程挂载目录
Close #I6DCM8

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ie1002ca48f9a73429e767136c1f11b1a8b137b48
2023-02-07 11:42:44 +08:00
openharmony_ci
58610ea87c !1104 Fix : 修复使用无符号数接收sprintf_s的结果
Merge pull request !1104 from yinjiaming/fix
2023-02-06 12:08:27 +00:00
openharmony_ci
c6ff38edd2 !1107 支持proc/self目录
Merge pull request !1107 from zhushengle/proc_self
2023-02-06 10:41:45 +00:00
zhushengle
1c18c48b1e feat: 支持proc/self目录
BREAKING CHANGE:
支持proc/self目录对外变更:
1.支持/proc/self挂载目录,用于获取进程信息

Close #I6CZ72

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I465278785bd9e27ddbf4d34ee7b5457e39f98b5b
2023-02-06 14:45:59 +08:00
openharmony_ci
bea394a75e !1103 fuzz测试用例
Merge pull request !1103 from 权飞燕/fuzz-master
2023-02-06 03:19:54 +00:00
gaorui
272c490618 增加fuzz测试用例
Change-Id: Ib07c89fe4fb840f2be4eec40a379a8f13e5ef2b6
Signed-off-by: gaorui <gaorui23@huawei.com>
2023-02-03 19:12:17 +08:00
openharmony_ci
dd041bef5a !1106 fix: 修复容器相关问题
Merge pull request !1106 from zhushengle/mem_free
2023-02-03 05:54:19 +00:00
zhushengle
fd925a8163 fix: 修复容器内存泄露问题
1.修复内存泄露
2.修复获取内核信息单位、描述错误

Close #I6CD5C
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I875bec616064517b21af8e69ef8d6e177ec01ce1
2023-02-03 12:21:26 +08:00
openharmony_ci
e8e21fcc3e !1091 LMS特性安全合规整改
Merge pull request !1091 from JerryH/lms
2023-02-02 01:42:15 +00:00
huangjieliang
c592fe73ec feat:LMS模块及堆内存模块非安全函数安全合规整改
Close #I68LEO

Signed-off-by: huangjieliang <huangjieliang@huawei.com>
Change-Id: I6f1a8e647220170b00f771117bb018e5f82997ed
2023-02-01 16:50:11 +08:00
yinjiaming
4174654bdd fix:修复使用无符号数接收sprintf_s的结果的问题
sprintf_s的返回值是有符号数,应使用有符号数来接收返回值

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Icb1248e0a75a77c1258f64dfa25eef0a7f5dd14e
2023-02-01 10:45:20 +08:00
openharmony_ci
f3a7a9c602 !1102 fix: 修复proc静态问题
Merge pull request !1102 from zhushengle/proc_fix
2023-01-31 02:13:26 +00:00
zhushengle
c8dbdaeb12 fix: 修复proc静态问题
1.proc存在静态问题
2.删除proc节点后,vnode未同步删除,导致系统崩溃

Close #I6BT1F

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I91deecfe1d055a4ad1c2d2cda65acf04e4c53d4c
2023-01-30 19:36:51 +08:00
openharmony_ci
1f05c6a24d !1101 feat: 支持unshare
Merge pull request !1101 from zhushengle/unshare
2023-01-30 08:41:37 +00:00
zhushengle
325b4a49e4 feta: 支持unshare接口
BREAKING CHANGE:
支持unshare接口对外变更
1.支持unshare接口,flags支持:CLONE_NEWPID, CLONE_NEWTIME, CLONE_NEWUTS

Close #I6BE5A

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ib61abad2fa03a7100bf808e93830f2094fa1c5a6
2023-01-30 10:30:54 +08:00
openharmony_ci
1d1f1b06c3 !1100 支持time容器
Merge pull request !1100 from zhushengle/time_container
2023-01-19 07:48:27 +00:00
zhushengle
16ed05e844 feat: 支持time容器
BREAKING CHANGE:
支持ipc容器及增强对外变更:
1.clone 支持CLONE_NEWTIME
2.增加”/proc/[pid]/container/time" 用于查询容器信息
3.增加”/proc/[pid]/container/time_for_children" 用于查询容器信息
4.增加”/proc/[pid]/container/pid_for_children" 用于查询容器信息
5.增加”/proc/[pid]/time_offsets" 用于查询和配置time容器信息

Close #I6B0A3

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I54d79937ca608a10a4384f61e11c88757f833edf
2023-01-19 15:03:18 +08:00
openharmony_ci
7e0dfb79f7 !1099 feat: 支持IPC容器
Merge pull request !1099 from zhushengle/ipc_container
2023-01-18 06:58:09 +00:00
zhushengle
34814c58a3 feat: 支持IPC容器
BREAKING CHANGE:
支持ipc容器及增强对外变更:
1.clone 支持CLONE_NEWIPC
2.增加”/proc/[pid]/container/ipc" 用于查询容器信息

Close #I6AVMY

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I6a3c248d2d66a5342994c6e0b0aecddea8e32c72
2023-01-18 10:59:25 +08:00
openharmony_ci
c0c9bbdfb4 !1098 支持mnt容器及增强能力
Merge pull request !1098 from zhushengle/mnt_container
2023-01-17 06:20:48 +00:00
zhushengle
e2d903b663 feat: 支持mnt容器及增强能力
BREAKING CHANGE:
支持mnt容器及增强对外变更:
1.clone 支持CLONE_NEWNS
2.增加”/proc/[pid]/container/mnt" 用于查询容器信息
3.新增chroot接口

Close #I6APW2

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I5e8843a0f59bb5b0e6a66a6810dc552e8184a03e
2023-01-16 21:00:17 +08:00
openharmony_ci
d4794ebc38 !1097 feat: 支持系统、进程信息获取
Merge pull request !1097 from zhushengle/info
2023-01-16 06:26:14 +00:00
zhushengle
3be7409a28 feat: 支持系统、进程信息获取
BREAKING CHANGE:
支持系统、进程信息获取对外变更:
1.添加"/proc/meminfo" 获取系统内存使用情况
2.添加"/proc/filesystems" 获取文件系统信息
3.添加"/proc/[pid]/meminfo" 获取进程的内存占用信息
4.添加"/proc/[pid]/cpup" 获取进程的CPUP信息

Close #I6AMVG

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I8c1cab0bf956ced0cf16401907d869058d98cfa6
2023-01-16 09:41:57 +08:00
openharmony_ci
0c7dd0f911 !1096 feat: 支持进程挂载目录和进程命名空间增强
Merge pull request !1096 from zhushengle/process_proc
2023-01-14 09:02:35 +00:00
zhushengle
41619f004d feat: 支持进程挂载目录和进程命名空间增强
BREAKING CHANGE:
支持进程挂载目录和进程命名空间增强对外变更:
1.支持进程挂载目录,在/proc下可以看到进程挂载目录
2.支持pid容器和uts容器信息查询

Close #I6AEVV

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I6777889552d77e49da81249063f9f3db0af96f34
2023-01-14 15:36:11 +08:00
openharmony_ci
be9cee4c21 !1095 支持uts容器
Merge pull request !1095 from zhushengle/uts_container
2023-01-13 06:50:27 +00:00
zhushengle
6c8735cb9e feat: 支持uts容器
BREAKING CHANGE:
支持uts容器对外变更:
支持sethostname

Close #I6A7C8

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I2504f77c37bb4149861673c81688bd112563c24b
2023-01-12 16:42:11 +08:00
openharmony_ci
8701e73c9f !1094 feat: 添加pid容器测试用例
Merge pull request !1094 from zhushengle/pid_container_test
2023-01-12 03:06:10 +00:00
zhushengle
c403fdf8ed feat: 添加pid容器测试用例
Close #I69Z22

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: If2d737766f4cecef70a57be9574cf3785b6900a8
2023-01-11 17:33:21 +08:00
openharmony_ci
251abede16 !1090 支持pid容器
Merge pull request !1090 from zhushengle/pid_container
2023-01-11 09:08:44 +00:00
zhushengle
20782299ce feat: 支持pid容器
BREAKING CHANGE:
支持pid容器对外变更描述:
1.支持pid容器,使用clone(CLONE_NEWPID)创建
2.shell命令 task -a 不再显示线程信息,只显示系统所有进程信息
3.task命令新增参数-p, task -p pid 可查看改进程下的所有线程信息
4.使用LOS_TaskCreateOnly创建任务时, TSK_INIT_PARAM_S中的processID由原来的记录进程ID修改为记录进程控制块PCB
Close #I68LVW
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I0895da9099cb285b3195af5e383d0fdeaf5c0087

Change-Id: I46a7642eeee73a4531c241e3ba6290dd302600a7
2023-01-11 11:13:34 +08:00
openharmony_ci
0b141e052b !1079 Fix : 将测试用例移植过程中的修改同步回A核
Merge pull request !1079 from yinjiaming/test
2023-01-10 07:02:38 +00:00
openharmony_ci
46cc84331a !1089 Fix : 内核告警清理
Merge pull request !1089 from yinjiaming/fix
2023-01-06 03:51:23 +00:00
yinjiaming
e816896dc4 Fix: 将测试用例移植过程中的修改同步回A核
Change-Id: I021e11f3e36bd71358a7cc674ec83dd5d98bc97e
Signed-off-by: yinjiaming <yinjiaming@huawei.com>
2023-01-05 17:21:02 +08:00
yinjiaming
ebc3f30524 fix:修复codecheck扫描出的告警
给宏定义中的参数加上了括号,删除了多余的函数声明

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I8853f6a9717ede96578cd674b83b716c8e63f0d8
2023-01-04 15:17:45 +08:00
openharmony_ci
3119d83a6a !1087 feat: README添加内核编码规范指导
Merge pull request !1087 from zhushengle/README
2022-12-05 12:57:14 +00:00
zhushengle
8482c9d7be feat: README新增内核编码规范
Close #I644XN
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I733a65111f7557e155b0bb7be87944aaa377e928
2022-12-01 16:08:38 +08:00
openharmony_ci
248e9f7089 !1082 fix: 修复README失效链接
Merge pull request !1082 from zhushengle/README
2022-11-29 11:43:57 +00:00
zhushengle
f2a35262bd fix: 修复README失效链接
Close #I63RAH

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Iebff2bacd5d85ad126cf6039d4f9be1dab64815f
2022-11-29 17:42:07 +08:00
openharmony_ci
794cdae65f !1080 feat: 更新PR模板, 添加对外变确认项
Merge pull request !1080 from zhushengle/pr
2022-11-29 01:53:25 +00:00
zhushengle
7975f5c8ef feat: 更新PR模板, 添加对外变确认项
1.更新PR模板, 添加对外变确认项
2.添加历史版本的CHANGELOG

Close #I63L3D

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I22f64cd0bc5ad083806edd4ff00d955cb81bef0e
2022-11-28 22:24:16 +08:00
openharmony_ci
fc4c694235 !1078 fix: codecheck问题清零
Merge pull request !1078 from zhushengle/codecheck
2022-11-28 13:36:55 +00:00
openharmony_ci
ead4da80ba !1071 fix:增强对LOS_ArchCopyToUser接口的安全防护
Merge pull request !1071 from zhangdengyu/fix_kernelStack_1115
2022-11-28 09:07:57 +00:00
zhushengle
8d980ded54 fix: codecheck问题清零
1.shell初始化异常流程double free
2.los_disk_init中冗余初始化
3.OsKProcessPmUsage 中OsUProcessPmUsage异常退出时,存在使用未初始化的变量
4.HiLogHeadInit异常推出后,存在使用未初始化的变量
5.api_shell.c 中存在冗余初始化

fix #I63H5G

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: If17d8ed1e6f2276e20fbce24b32de169bfd22e54
2022-11-28 16:09:10 +08:00
zhangdengyu
07e3feb456 fix: 增强对LOS_ArchCopyToUser接口的安全防护
Close: #I61CLY

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I0faf8e5849c24b108f290e483124f3edaf70ef50
2022-11-25 11:47:56 +08:00
openharmony_ci
b5ce4d34df !1058 更新liteos_a 内核架构图
Merge pull request !1058 from zhushengle/Arch
2022-11-25 01:52:49 +00:00
zhushengle
99c81c4ffa feat: 更新liteos_a内核架构图
fix #I61OYY

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I038f1cae44f0138ef924bf4905f3a5b0dc24841e
2022-11-24 12:34:08 +08:00
openharmony_ci
4d1fd22b1c !1060 LTS 补丁升级适配
Merge pull request !1060 from gaochao/master
2022-11-14 09:16:06 +00:00
openharmony_ci
efa336ab26 !1061 time相关系统调用内核栈信息泄露排查
Merge pull request !1061 from zhushengle/time
2022-11-11 06:44:21 +00:00
zhushengle
0b05a46691 task: time相关系统调用内核栈信息泄露排查
解决方案:
    在涉及从内核拷贝数据到用户态的场景时,先将内核的数据进行清零操作,再填充内核数据
Close #I60M1P

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ia61d4e39b9e190accea477ff5b361e41d0eed2af
2022-11-11 14:24:07 +08:00
gaochao
177f32283f LTS 补丁升级适配
Signed-off-by: gaochao <gaochao49@huawei.com>
2022-11-10 16:32:48 +08:00
openharmony_ci
6888193e3f !1052 LTS 5.10 补丁升级适配
Merge pull request !1052 from gaochao/master
2022-11-04 07:23:25 +00:00
gc1202
6c352a7b10 LTS 补丁升级适配
Signed-off-by: gc1202 <gaochao49@huawei.com>
2022-11-02 14:23:47 +08:00
openharmony_ci
73a9587f02 !1046 Fix : 内核告警清理
Merge pull request !1046 from yinjiaming/fix
2022-10-27 12:50:29 +00:00
openharmony_ci
cbd03bd7e0 !913 删除PLATFORM_QEMU_ARM_VIRT_CA7侵入内核的所有代码
Merge pull request !913 from laokz/jffs2fat
2022-10-26 03:52:16 +00:00
yinjiaming
8d55bb1d8c fix: 内核告警清理
【背景】
内核告警清理

【修改方案】
删去了多余的空格,更改了魔数字

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

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Iba21be6cb23027dfb369576847d7d21e85f936b4
2022-10-26 10:57:08 +08:00
openharmony_ci
e7daa28200 !1025 清除一些静态检查工具发现的问题
Merge pull request !1025 from Far/master
2022-10-17 01:39:02 +00:00
Far
987a722d2d fix: 修复一些静态检查工具发现的问题
Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I2b93259d55a9eb1a9dfd5887fd7821c15274bb7f
2022-10-15 17:36:45 +08:00
openharmony_ci
ccdfa72431 !1016 修复执行测试用例执行时间过长等问题
Merge pull request !1016 from 夏不白/fix_unittest
2022-10-12 06:29:16 +00:00
openharmony_ci
557a71c1c3 !1020 jffs2.patch 文件适配LTS补丁升级
Merge pull request !1020 from 闻飞/master
2022-10-08 11:28:25 +00:00
wenfei
569aecb6ea jffs2.patch update
Signed-off-by: wenfei <wenfei9@huawei.com>
2022-09-30 11:23:29 +08:00
xiacong
8c0b7d0f38 <fix>
修复测试用例不过的问题

<body>
1.修复执行liteos_a_basic_unittest.bin时间过长的问题
2.修复测试shm系列系统调用函数用例失败的问题

Signed-off-by: xiacong <xiacong4@huawei.com>
Change-Id: Iabc541cb1c0e97dac0fe13aaeb98e85404e5bf6f
Signed-off-by: xiacong <xiacong4@huawei.com>
2022-09-28 17:24:14 +08:00
openharmony_ci
c488817b32 !1008 修复内核告警信息
Merge pull request !1008 from zhangdengyu/fix_preferused
2022-09-26 12:52:00 +00:00
openharmony_ci
43d47a27e3 !1011 fix: 修复shell_lk.c告警清零带来的逻辑修改
Merge pull request !1011 from 夏不白/module_fix
2022-09-26 11:22:57 +00:00
xiacong
a83f916298 <fix>
恢复告警清零带来的逻辑改变

Signed-off-by: xiacong <xiacong4@huawei.com>
Change-Id: I8d34d2b9c43ea54e5474cbddcde0048658cbb891
Signed-off-by: xiacong <xiacong4@huawei.com>
2022-09-26 17:29:08 +08:00
zhangdengyu
8dbfd3846e fix: 修复告警
Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
2022-09-26 17:08:56 +08:00
openharmony_ci
f34762c105 !1001 修复函数返回错误等问题
Merge pull request !1001 from zhangdengyu/fix_tsacn
2022-09-25 06:42:18 +00:00
zhangdengyu
043e84dfcb fix:修复函数返回错误等问题
Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
2022-09-25 10:09:29 +08:00
openharmony_ci
453c376198 !997 Fix : 内核告警清理
Merge pull request !997 from yinjiaming/fix
2022-09-22 11:33:00 +00:00
yinjiaming
204d7a4abb fix: 内核告警清理
【背景】
内核中经扫描有可以修改的告警之处

【修改方案】
优化了代码的格式

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

re #I5SHM2

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I89be86a8317637f9eb54257131712b5b79f1e454
2022-09-22 16:53:11 +08:00
openharmony_ci
f2861a84bf !987 Fix : 内核告警清理
Merge pull request !987 from yinjiaming/fix
2022-09-21 04:42:42 +00:00
yinjiaming
96b2d557ac fix: 内核告警修复
【背景】
经代码扫描工具检测,内核代码中存在
可以修复的告警

【修改方案】
1.将单语句的if, while等加上括号
2.将C语言风格的类型转换变为C++风格

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

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I7d4a04a8904abb3c33e843049bf15f4386d3efd8
2022-09-21 11:38:51 +08:00
openharmony_ci
ffa11535ca !991 【OpenHarmony开源贡献者计划2022】fix warning: expression result unused
Merge pull request !991 from xiwen1225/void
2022-09-19 03:19:16 +00:00
openharmony_ci
b581207045 !992 【OpenHarmony开源贡献者计划2022】fix warning for signal_test_016.cpp
Merge pull request !992 from queuechen/warn
2022-09-19 02:44:00 +00:00
ookami78
5105249ecf fix warning for signal_test_016.cpp
Signed-off-by: ookami78 <ookami78@mymailcr.com>
2022-09-18 14:21:46 +08:00
cunwen
a61e2cf16e fix warning: expression result unused
Signed-off-by: cunwen <cunwen181168@liuxiuhai.cn>
2022-09-18 11:29:44 +08:00
openharmony_ci
39e25c5220 !989 Fix : 修复测试用例返回值问题
Merge pull request !989 from yinjiaming/dev
2022-09-13 12:38:03 +00:00
yinjiaming
5541965365 fix: 修复测试用例中函数返回值的问题
【背景】
测试用例中有函数的返回值不正确

【修改方案】
将返回值为VOID *的函数的返回值改为
retrun NULL

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

re #I5O3LH

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I6d3ce9efbe9afe14b1e9dd12538b80e69928fd71
2022-09-09 15:28:22 +08:00
openharmony_ci
edd2223083 !983 【OpenHarmony开源贡献者计划2022】删除未使用的变量 count
Merge pull request !983 from leijiawei/master
2022-09-06 06:20:52 +00:00
openharmony_ci
22392965b5 !947 Fix : 版权头时间更新
Merge pull request !947 from yinjiaming/dev
2022-09-06 02:55:30 +00:00
yinjiaming
d906bb91ea fix: 版权头时间更新问题
【背景】
一些代码文件经过修改后需要更新版权头

【修改方案】
更新了需要更新的版权头时间

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

re #I5LG22

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I7963bf6ce5746707bad688dd4c634ae9d72b3c04
2022-09-05 16:03:30 +08:00
leijiawei
51f6a20723 fix warning:unused variable 'count' & add return value
Signed-off-by: leijiawei <18691361562@163.com>
2022-08-31 15:28:27 +08:00
leibanli
325ea29df3 fix warning:unused variable 'count'
Signed-off-by: leijiawei <18691361562@163.com>
2022-08-31 15:01:32 +08:00
leibanli
c2f9f6705f 【openHarmony开源贡献者计划2022】18691361562@163.com
Signed-off-by: leibanli <18691361562@163.com>
2022-08-30 21:53:58 +08:00
openharmony_ci
71e51d8813 !971 非安全函数告警清理
Merge pull request !971 from xuxinyu/function_s
2022-08-26 04:45:29 +00:00
xuxinyu
e0b4fcb23d test: replace unsecure function with secure function
Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: Ie120ffa529798f0f087ddfcd34f5d9c5802b6766
2022-08-25 23:08:58 +08:00
openharmony_ci
7d62d3d62b !979 style: shell脚本中不同函数使用不同变量
Merge pull request !979 from Hongjin Li/dev
2022-08-25 03:32:45 +00:00
Hongjin Li
69f3bf3a2a style: using different variable in different functions
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: I814dcccefcd6248ea32cae94bfde567f3077c7cd
2022-08-25 10:16:45 +08:00
openharmony_ci
2590e34346 !969 编译构建规范优化
Merge pull request !969 from Hongjin Li/dev
2022-08-23 12:55:42 +00:00
Hongjin Li
660b314f90 style: string format in python
Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: Ie84a97ca5e0250991aa774b737eb7787e27d80af
2022-08-23 20:22:13 +08:00
openharmony_ci
44ec199465 !951 【OpenHarmony开源贡献者计划2022】fix moudule to module
Merge pull request !951 from bingge88/module
2022-08-12 02:16:38 +00:00
openharmony_ci
7437408f65 !950 OpenHarmony开源贡献者计划2022】fix: change szie to size
Merge pull request !950 from Dream_Liu/master
2022-08-12 02:15:42 +00:00
binge889
1134332a58 fix moudule to module
Signed-off-by: binge889 <binge889@liuxiuhai.cn>
2022-08-11 23:31:52 +08:00
Dream_Liu
8099f6578d fix:change szie to size
Signed-off-by: Dream_Liu <lxm201x@163.com>
2022-08-11 23:14:20 +08:00
openharmony_ci
ba23a26f95 !928 Fix : 内核告警清理
Merge pull request !928 from yinjiaming/fix
2022-08-09 08:37:34 +00:00
yinjiaming
2dc24da826 fix: 内核告警清理
【背景】
内核代码经代码扫描工具发现存在一些关于代码格式的告警,
现经修改解除掉告警.

【修改方案】
修改了代码中格式不规范的地方,修改的点有:
1.代码中一行过长
2.没有合理的添加空格和空行
3.没有按照规范进行缩进
4.括号的格式没有按照规范
5.注释的格式不对以及存在魔数字
6.函数的声明与定义的格式不一致
并更新了修改文件的版权头时间

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

re #I5H6F5

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ie46b5b3238fd88c25f99542b8ccd138b956c6458
2022-08-08 13:09:54 +00:00
openharmony_ci
6302c5f767 !938 修复用例告警
Merge pull request !938 from xuxinyu/master
2022-07-29 03:46:59 +00:00
xuxinyu
f0d5959576 fix: 修复用例告警问题
re #I5I21P

Signed-off-by: xuxinyu <xuxinyu6@huawei.com>
Change-Id: Iedab5b6fddafc2042c7fd23fbcd82061629f87d8
2022-07-26 11:07:02 +08:00
openharmony_ci
65790b67d5 !937 拼写错误修正
Merge pull request !937 from yinjiaming/dev
2022-07-25 11:06:35 +00:00
openharmony_ci
9eff5cff1d !934 refactor: sysroot部件化
Merge pull request !934 from Zhaotianyu/20220716sysroot_lite
2022-07-22 08:57:25 +00:00
yinjiaming
99ea8d4ed2 fix: 拼写错误修正
【背景】
代码中存在拼写错误

【修改方案】
修改存在拼写错误的地方

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

re #I5IA7P

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Idd5d7fc9705e5ec661596aa6533402e8d4a8a117
2022-07-21 11:05:11 +00:00
arvinzzz
1568c317bb refactor: sysroot部件化
close: #I5HF8S

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I727b10c3b419fc71e228f5ad92abc107e756bbac
2022-07-19 12:32:32 +08:00
openharmony_ci
5e70129199 !917 【OpenHarmony开源贡献者计划2022】fix warning: unused variable
Merge pull request !917 from rtos_ming/unused
2022-07-04 01:24:28 +00:00
zhumingxian
089376994a fix warning: unused variable
Signed-off-by: zhumingxian <zhumingxian@ohos.com.cn>
2022-06-30 20:49:50 +08:00
openharmony_ci
12adfd5832 !915 【OpenHarmony开源贡献者计划2022】Fixed typos.
Merge pull request !915 from Mr_YX/master
2022-06-30 06:11:01 +00:00
openharmony_ci
c46c5a640d !905 「OpenHarmony贡献者计划2022」update signal_test_020.cpp
Merge pull request !905 from Mr_YX/master
2022-06-30 06:09:18 +00:00
mr-yx
c812b0c27b fixed typos
Signed-off-by: mr-yx <496043997@qq.com>
2022-06-28 23:48:24 +08:00
openharmony_ci
51528ec39c !906 【OpenHarmony开源贡献者计划2022】Optimized conversion instructions.
Merge pull request !906 from Mr_YX/master
2022-06-27 09:31:08 +00:00
laokz
059c1c22b1 fix(PLATFORM_QEMU_ARM_VIRT_CA7): remove all invasive code
arm-virt emulation rootfs change to vfat from jffs2,
root device change to eMMC from CFI flash

Signed-off-by: laokz <laokz@foxmail.com>
Change-Id: If284809b989918cf10f5d32803df42c8c57830b2
2022-06-25 18:25:39 +08:00
openharmony_ci
beb03bfc81 !903 【OpenHarmony开源贡献者计划2022】fix typos for net
Merge pull request !903 from c01dface/master
2022-06-23 14:54:42 +00:00
openharmony_ci
bbbd96784e !904 修复liteos_a仓库中存在的一些拼写错误
Merge pull request !904 from Hongjin Li/dev
2022-06-23 04:15:03 +00:00
lihongjin
1c0de289ec style: Misspelling
Signed-off-by: lihongjin <lihongjin1@huawei.com>
Change-Id: I13163f2e4d1e4b6e6c6bedaf9d4e705544df926b
2022-06-23 09:45:46 +08:00
openharmony_ci
a3d757c8e1 !898 【轻量级 PR】:「OpenHarmony开源贡献者计划2022」update testsuites/unittest/libc/util/smoke/util_test_005.cpp.
Merge pull request !898 from Mr_YX/N/A
2022-06-23 01:02:42 +00:00
openharmony_ci
6fede4eb92 !892 【OpenHarmony开源贡献者计划2022】更新readme中的目录结构
Merge pull request !892 from wanggang/master
2022-06-23 00:43:57 +00:00
Mr_YX
7be302633f Signed-off-by: mr-yx <496043997@qq.com> 2022-06-20 18:08:19 +00:00
Mr_YX
0164461b33 Signed-off-by: mr-yx <496043997@qq.com> 2022-06-20 15:16:02 +00:00
Neil Chen
9bb4be5e13 fix typos for net
Signed-off-by: Neil Chen <jingsi.chen@petalmail.com>
2022-06-19 14:10:19 +08:00
openharmony_ci
4acf1e9f8d !896 feat: normalize drivers framework component and repos
Merge pull request !896 from yuanbo/master
2022-06-17 06:39:48 +00:00
openharmony_ci
870221452d !900 【轻量级 PR】:remove tzdriver Kconfig
Merge pull request !900 from WoolenSky/N/A
2022-06-17 03:16:48 +00:00
WoolenSky
30c3fb086e remove tzdriver Kconfig
Signed-off-by: YuanHao<yuanhao34@huawei.com>
2022-06-16 11:59:28 +00:00
Mr_YX
9b1e0a186b update testsuites/unittest/libc/util/smoke/util_test_005.cpp.
Signed-off-by: mr-yx <496043997@qq.com>
2022-06-15 14:05:19 +00:00
yuanbo
00dbf1e5d5 feat: normalize drivers framework component and repos
Signed-off-by: yuanbo <yuanbo@huawei.com>
2022-06-15 20:02:05 +08:00
openharmony_ci
16fdbdf650 !885 【OpenHarmony开源贡献者计划2022】代码打印中sucess修改为success
Merge pull request !885 from lingxin_2019/master
2022-06-14 01:57:54 +00:00
openharmony_ci
bee3d97163 !890 fix:修复llvm编译告警
Merge pull request !890 from Zhaotianyu/0601llvm_apt
2022-06-13 02:20:53 +00:00
wanggang
9fb176b827 update readme
Signed-off-by: wanggang <wanggang@kaihongdigi.com>
2022-06-10 10:11:17 +08:00
openharmony_ci
398f4a6ada !891 fix : 修复测试用例中部分测试内容硬编码的问题
Merge pull request !891 from yinjiaming/master
2022-06-09 12:42:07 +00:00
yinjiaming
19553f73e1 fix: 修复测试用例中部分测试内容硬编码的问题
【背景】
A核测试用例中有一些敏感字符串需要修改

【修改方案】
将敏感的字符串改为随机生成

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

re #I5ALBS

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ib9b023ace6be1d58248c993f7b9919a96afbea96
2022-06-09 02:28:05 +00:00
arvinzzz
de24efadfa fix: llvm10.0->12.0
close: I5AM0I

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I02ae045208411c6dac1234372b706ce0dbec5cef
2022-06-07 15:35:33 +08:00
openharmony_ci
0057fb0dd5 !886 修复文档链接失效问题
Merge pull request !886 from xuxinyu/master
2022-05-30 08:50:35 +00:00
x_xiny
bcf7e8ee02 修复文档链接失效问题
re #I59PF7

Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: Idc498604fbaadd8a00db4a5690de094883b280c4
2022-05-30 15:43:46 +08:00
lingxin_2019
0b9cac2cd3 Signed-off-by: 贺婷婷 <596256905@qq.com> 2022-05-26 08:09:56 +00:00
lingxin_2019
9958f647f5 Signed-off-by: 贺婷婷 <596256905@qq.com> 2022-05-26 12:24:46 +08:00
openharmony_ci
fa6b2d352c !880 【OpenHarmony开源贡献者计划2022】readme表达规范性和OAT英文表达规范性
Merge pull request !880 from king_he/master
2022-05-17 07:09:56 +00:00
openharmony_ci
7f57e11ef9 !881 修改jffs2引用路径
Merge pull request !881 from xuxinyu/master
2022-05-11 07:02:30 +00:00
x_xiny
1097d41a40 修改jffs2引用路径
Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: Id4ab149ff33747f1957b3a6843a1d8e43447e00e
2022-05-11 11:27:11 +08:00
openharmony_ci
90d6ff9a6f !871 fix: newlib for liteos_a and clip for liteos_a_mini
Merge pull request !871 from Harylee/qemu
2022-05-05 08:41:34 +00:00
king_he
eebe85fe31 update README_zh.md.
Signed-off-by: king_he <6384784@qq.com>
2022-04-30 03:41:16 +00:00
king_he
b126f1cb5f update README_zh.md.
Signed-off-by: king_he <6384784@qq.com>
2022-04-30 03:35:27 +00:00
king_he
639160f517 update OAT.xml.
Signed-off-by: king_he <6384784@qq.com>
2022-04-30 03:26:01 +00:00
Haryslee
7fef6ac8d9 fix: newlib for liteos_a and clip for liteos_a_mini
close #I53VW6

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I591b4ffaeb220311b63bd95f19400e0b9fde3c45
2022-04-29 14:12:29 +08:00
openharmony_ci
2f44d18618 !877 LiteOS-A内核jffs2文件系统停止使用third_party下的Linux_Kernel
Merge pull request !877 from Far/master
2022-04-29 03:32:22 +00:00
Far
fbc81cd821 fix: LiteOS-A内核jffs2文件系统停止使用third_party下的Linux_Kernel
Close #I5564N
Signed-off-by: Far <yesiyuan2@huawei.com>
2022-04-29 10:46:39 +08:00
openharmony_ci
a6e17fea9b !875 LiteIpc驱动增强:增加版本控制命令、增加handle特殊处理机制。
Merge pull request !875 from 万晓庆/master
2022-04-27 01:45:22 +00:00
openharmony_ci
18f7ab1380 !874 fix:进程退出后还能获取其调度参数的问题
Merge pull request !874 from Zhaotianyu/0426sched_fix
2022-04-26 13:27:49 +00:00
arvinzzz
d205cfa65a fix: 进程退出后获取其调度参数有问题
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I0e98fef07e4919a5fbb051899ecb45a224225f91
2022-04-26 18:35:19 +08:00
万晓庆
11b35fe795 LiteIpc驱动增强:增加版本控制命令、增加handle特殊处理机制。
Signed-off-by: 万晓庆 <wanxiaoqing@huawei.com>
2022-04-26 17:40:17 +08:00
openharmony_ci
b086195e97 !869 chore:精简冗余语句
Merge pull request !869 from Zhaotianyu/0326libc_opt
2022-04-11 02:53:22 +00:00
openharmony_ci
b90531e366 !869 chore:精简冗余语句
Merge pull request !869 from Zhaotianyu/0326libc_opt
2022-04-11 02:53:21 +00:00
arvinzzz
a1a6286500 feature: 高频函数优化
精简冗余语句

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: If7716d6ce6b751b3525c41fe3c95ff608ef64136
2022-04-08 17:14:23 +08:00
openharmony_ci
e1027b5902 !866 fix: 修复前后台进程支持
Merge pull request !866 from zhushengle/shell_
2022-04-07 11:19:32 +00:00
openharmony_ci
b9a445ca44 !866 fix: 修复前后台进程支持
Merge pull request !866 from zhushengle/shell_
2022-04-07 11:19:32 +00:00
zhushengle
338044cd9c fix: 修复前后台进程支持
1.优化shell机制,删除无用的线程
2.修复前后台进程支持

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I8bb13e53f290989455260dd5fb3f604ddebc9c8b
2022-04-06 16:47:49 +08:00
openharmony_ci
18a2fc8e8d !769 fix: 修复hm_liteipc.c的double unlock错误
Merge pull request !769 from niejianglei/master
2022-04-06 03:14:21 +00:00
openharmony_ci
fa0e803ac9 !865 add stm32mp157 development board
Merge pull request !865 from Laowang-BearPi/master
2022-04-01 06:38:31 +00:00
Laowang-BearPi
4f641cc145 删除GN中特殊构建命令
Signed-off-by: Laowang-BearPi <wangcheng@holdiot.com>
2022-03-31 23:08:50 +08:00
Laowang-BearPi
9063a45d5a 修改部分板级配置
Signed-off-by: Laowang-BearPi <wangcheng@holdiot.com>
2022-03-31 22:12:44 +08:00
Laowang-BearPi
4b4e1264f5 add stm32mp157 development board
Signed-off-by: Laowang-BearPi <wangcheng@holdiot.com>
2022-03-30 18:46:02 +08:00
openharmony_ci
3f5307e7bb !855 feat: 支持调度框架
Merge pull request !855 from zhushengle/sched_frame
2022-03-30 09:27:43 +00:00
zhushengle
eddcb840d3 feat: 支持调度框架
Close #I4Z3BL

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I5f32d1001ffabc0f725ce65b51ed9b3791e97f2b
2022-03-30 15:54:47 +08:00
openharmony_ci
a0e205eb0a !864 update readme
Merge pull request !864 from LeonChan/master
2022-03-30 03:44:30 +00:00
LeonChan
707028dfe1 update README
Signed-off-by: leonchan5 <chenwei26@huawei.com>
2022-03-29 07:15:46 +00:00
openharmony_ci
49d72afc8e !810 fix:优化修改epoll系统调用接口
Merge pull request !810 from Kiita/220224_epoll
2022-03-28 08:41:06 +00:00
zhangyan
c11ff67869 fix:优化修改epoll_create系统调用接口和epoll_create实现方式
re #I4STTF
Signed-off-by: Kiita <zhanyan@huawei.com>
Change-Id: I4d5dcfbe6937659489a3f688d188706398e25ec0
2022-03-28 04:13:54 +00:00
zhangyan
b6a49e7c89 fix:优化修改epoll_create系统调用接口和epoll_create实现方式
re #I4STTF
Signed-off-by: Kiita <zhanyan@huawei.com>
Change-Id: I06a8bb79376ca3799fa45732bc612c977e0a7ac9
2022-03-28 04:10:11 +00:00
lnlan
e847c8b468 fix:优化修改epoll_create系统调用接口和epoll_create实现方式
re #I4STTF
Signed-off-by: Kiita <zhanyan@huawei.com>
Change-Id: Ifec720eb5dd7aef8283875048d23b6a3d66b5436
2022-03-28 04:07:59 +00:00
openharmony_ci
faeeaf294c !862 fix: 修复魔法键无法显示进程信息的问题
Merge pull request !862 from zhushengle/magickey
2022-03-26 06:52:05 +00:00
zhushengle
b2caf46b4e fix: 修复魔法键无法显示进程信息的问题
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I9787fb3420da73cf289c434995fd2371e3fe5117
2022-03-26 11:54:39 +08:00
openharmony_ci
ccbc55df60 !861 feat: 优化调度debug功能
Merge pull request !861 from zhushengle/sched_stat
2022-03-26 02:19:22 +00:00
zhushengle
7f4294af00 feat: 优化调度debug功能
1.删除废弃功能
2.优化调度debug功能
3.删除sched_sq目录

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: If2e60fb334f4c3a3f6008d724d7619cdcb3baf51
2022-03-26 09:58:54 +08:00
openharmony_ci
4a63bacc47 !860 fix:修复readme链接指向问题
Merge pull request !860 from xuxinyu/master
2022-03-24 13:10:28 +00:00
x_xiny
ee6f3f0d79 fix:修复readme链接指向问题
Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: Ieb18e3e525c9222aea8605875bb6c141420ae13f
2022-03-24 21:01:55 +08:00
openharmony_ci
e05300cdf0 !858 fix:修复readme链接指向问题
Merge pull request !858 from xuxinyu/master
2022-03-24 12:37:53 +00:00
openharmony_ci
b8951e2cd9 !858 fix:修复readme链接指向问题
Merge pull request !858 from xuxinyu/master
2022-03-24 12:37:53 +00:00
x_xiny
e3ce27536c fix:修复readme链接指向问题
Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: Iac679135e78e895f0bb6fb2fd12df017db3534c9
2022-03-24 20:23:34 +08:00
openharmony_ci
a6c5309a5f !856 fix: 修复类型不匹配问题
Merge pull request !856 from zhushengle/type
2022-03-24 03:59:05 +00:00
zhushengle
65d5526c70 fix: 修复类型不匹配问题
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I31e16c9716de1223db7e4de916af3e010ca5f4e4
2022-03-24 11:24:34 +08:00
openharmony_ci
33c4e194b8 !851 增加队列支持变长读操作
Merge pull request !851 from chenliming_kh/master
2022-03-24 01:51:29 +00:00
openharmony_ci
1b11caa45c !853 检视问题修复
Merge pull request !853 from wangchen/0322_up
2022-03-22 13:46:47 +00:00
wangchen
6ba17fc862 fix: kora工具检视问题修复
【背景】kora工具检视问题修复

【修改方案】
1,对部分代码问题进行整改

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

Signed-off-by: wangchen <wangchen64@huawei.com>
Change-Id: Iafc58b7c71e5d139e11a0ae9d98ca5a57fc6549f
2022-03-22 13:24:07 +00:00
openharmony_ci
f61ecd7669 !849 fix: 删除无效用例
Merge pull request !849 from zhushengle/de
2022-03-22 11:14:27 +00:00
chenliming
ec3c8be6ee chenliming@kaihongdigi.com: 队列支持变长读操作
Signed-off-by: chenliming <chenliming@kaihongdigi.com>
2022-03-22 18:36:24 +08:00
zhushengle
3cd28f32ca fix: 删除无效用例
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I8d932d850705f2ef9d54a53403fef2a44e77a2fc
2022-03-22 18:24:45 +08:00
openharmony_ci
4b6a6e806f !846 fix: 编码规范修复
Merge pull request !846 from zhushengle/xxx
2022-03-21 13:40:48 +00:00
zhushengle
216c124854 fix: 编码规范修复
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Idddb6f081546d880560d075395079d95e4112599
2022-03-21 20:47:46 +08:00
openharmony_ci
e26d969ca8 !751 OsFutexWait接口当absTime为0时,返回值不正确,导致用户态c库处理不当,触发当前线程卡死
Merge pull request !751 from zhangfanfan2/other
2022-03-21 04:03:26 +00:00
openharmony_ci
45f66359cd !841 fix:3.1代码检视问题修改
Merge pull request !841 from xuxinyu/master
2022-03-19 12:50:31 +00:00
x_xiny
5b87a530f5 fix:3.1代码检视
Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: I0e0b59cdc22b292ccf0a790010c037d43793a934
2022-03-19 20:22:59 +08:00
openharmony_ci
5280a45434 !840 fix: 修复內源检视问题
Merge pull request !840 from zhushengle/xxx
2022-03-19 10:37:45 +00:00
zhushengle
f7a8630584 fix: 修复內源检视问题
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I3e4e26d55dedc1eb079911eaee59a8bddf4e8eee
2022-03-19 17:50:04 +08:00
openharmony_ci
cb67dd5498 !834 feat: swtmr机制与调度分离,调度只针对通用线程,不针对特殊功能
Merge pull request !834 from zhushengle/swtmr
2022-03-19 07:59:45 +00:00
zhushengle
6d8cef40c8 feat: swtmr机制与调度分离,调度只针对通用线程,不针对特殊功能
背景:
原调度机制与软件定时器实现混合,调度时间链表存在两个链表,
任务切换时需要遍历两个链表才可以获取到最终的tick响应时间。
软件定时作为一个独立的功能,不应该和调度强耦合,而且软件定时
器作为一个任务,某个软件定时器的响应时间应该是软件定时器任务的
响应时间,不应该直接做为tick中断的响应时间。

方案描述:
1.将软件定时器从调度分离,作为一个独立的机制,从调度角度看其就是一个任务
2.软件定时器从调度分离之后,其timelist遍历从tick中断移动至软件定时器任务中
3.优化软件定时器的均衡调度

优势:
1.将软件定时器与调度完全分离,使得调度功能单一化,便于后续其它调度算法的引入
2.优化tick中断,减小tick中断耗时
3.优化通过写队列唤醒软件定时器任务去执行软件定时器钩子为插队列,减少软件定时
器机制本身的耗时,提升软件定时器的实时性
4.优化软件定时器均衡调度,使得软件定时器均匀分布于多核,提升软件定时器的实时性

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I07c01f134e69c1d9b7061ddf5a231df1ee99b68e
2022-03-19 11:23:36 +08:00
openharmony_ci
41b80ad20a !838 fix: 内源检视问题修复
Merge pull request !838 from Zhaotianyu/0318codex_fix_1
2022-03-18 08:42:36 +00:00
arvinzzz
47fac7158e fix: 内源检视问题修复
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I7c0b8f4026d8fbd4b0d985d4ce82187e56f1d6ec
2022-03-18 16:06:23 +08:00
openharmony_ci
6c0e1b1f04 !836 内核内源代码检视问题修改
Merge pull request !836 from wangchen/0317_lfx_a
2022-03-18 07:21:54 +00:00
wangchen
b06520ac7c fix: 内核内源代码检视问题修改
【背景】内源代码检视问题

【修改方案】
1,按检视意见,进行拼写等问题的修改

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

Signed-off-by: wangchen <wangchen64@huawei.com>
2022-03-17 12:33:01 +00:00
openharmony_ci
e4cad073a9 !835 fix: 修复任务部分接口防护
Merge pull request !835 from zhushengle/task
2022-03-16 12:22:41 +00:00
zhushengle
b151fa6b65 fix: 修复任务部分接口防护
1.LosTaskDelete接口未对锁调度做检查
2.LOS_SetTaskScheduler未校验任务有效性
3.LOS_TaskJoin未对系统任务做校验

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I2c0a83ed5825706f3fa2609574e9e440a0d8eb1f
2022-03-16 19:51:18 +08:00
openharmony_ci
40329e182c !832 fix: 修复部分内核态测试用例
Merge pull request !832 from zhushengle/test
2022-03-16 09:45:59 +00:00
zhushengle
0f38ecb863 fix: 修复部分内核态测试用例
1.修复删除任务后调度不及时的问题
2.修复部分内核态测试用例

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I4cb29f6a7dce96bfdad68e0d89a004b5f5e33036
2022-03-16 17:16:55 +08:00
openharmony_ci
3f43438017 !831 fix:修复拼写错误
Merge pull request !831 from xuxinyu/master
2022-03-14 14:43:36 +00:00
x_xiny
bc70db58a7 fix:修复拼写错误
Signed-off-by: x_xiny <1301913191@qq.com>
Change-Id: I1cc4897e5d37dd98696221f0cc70220cef45e7d4
2022-03-14 22:22:56 +08:00
openharmony_ci
ac9399d2b7 !830 C库gn修改
Merge pull request !830 from Zhaotianyu/0314libc_opt
2022-03-14 14:13:07 +00:00
arvinzzz
89850d0715 feature: libc opt
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I6efb8c61179b29c0415ec6df060d8a4c7ede88ab
2022-03-14 19:57:39 +08:00
openharmony_ci
86be540829 !829 fix:修改拼写错误
Merge pull request !829 from xuxinyu/FixSpellingMisstakes
2022-03-14 10:45:10 +00:00
x_xiny
0f75bf01a6 fix:内源代码检视拼写错误修改
【背景】3.1代码review问题修改

    【修改方案】
     根据检视意见对拼写错误进行修改

     Signed-off-by: xuiny <xuxinyu6@huawei.com>

Change-Id: I9fb982a8ba2052fa4d56e91eec33c96ab4035a90
2022-03-14 17:34:46 +08:00
openharmony_ci
395c0be775 !828 fix: 内源代码检视问题修改
Merge pull request !828 from zhushengle/sample
2022-03-14 08:26:48 +00:00
zhushengle
a40f8383ee fix: 内源代码检视问题修改
1.删除测试用例中的需求单号和问题单号
2.部分格式问题
3.使用非安全函数问题

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I348bd9730f584fd3ebeb6d4245fe4a84c0c90c7d
2022-03-14 15:14:44 +08:00
openharmony_ci
87a7df48b8 !821 fix: 源代码检视问题修复
Merge pull request !821 from xuxinyu/master
2022-03-10 12:13:18 +00:00
openharmony_ci
2df39a7e51 !825 A核内源代码检视问题修改2
Merge pull request !825 from wangchen/0310_a
2022-03-10 12:12:21 +00:00
openharmony_ci
9f8127cc54 !824 fix: 源码检视修复
Merge pull request !824 from yinjiaming/master
2022-03-10 08:19:06 +00:00
wangchen
2f1ed39bc1 fix: 内源代码检视问题
【背景】内源代码检视问题

【修改方案】
1,按检视意见,进行资源泄露等问题的修改

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

re #I4WV56
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-03-10 07:47:56 +00:00
x_xiny
0770e5f972 fix:内源代码检视修改(安全函数)
【背景】3.1代码review问题修改

【修改方案】
 根据检视意见对安全函数,版权等信息进行修改

 re #I4WV56

 Signed-off-by: xuiny <xuxinyu6@huawei.com>

Change-Id: Ia2a6ba828700006f6bfe810714e2cd88fc2ccddc
2022-03-10 14:40:58 +08:00
openharmony_ci
0fb16312dc !823 添加一些启动注释
Merge pull request !823 from Zhaotianyu/0309reset
2022-03-10 04:06:28 +00:00
yinjiaming
9a030d6930 fix: 修复3.1源码检视的问题
【背景】
3.1 代码检视过程中有一些问题需要修复

【修改方案】
修改了失效的文档链接,更改了一些非可执行文件的权限

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

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: If87ac9a3e17ba679f4712552f5a89cc13349287e
2022-03-09 09:34:31 +00:00
arvinzzz
29dde5d752 refactor: 启动加注释
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I124e24f42b52c7ac1d848cbdeeb2e111d5813d33
2022-03-09 17:28:16 +08:00
openharmony_ci
b797f50596 !813 主干告警清零
Merge pull request !813 from yinjiaming/master
2022-03-09 03:51:33 +00:00
openharmony_ci
913d22bf83 !822 A核内源代码检视问题修改
Merge pull request !822 from wangchen/0308_a
2022-03-09 03:29:42 +00:00
wangchen
3824d1e9e4 【背景】内源代码检视问题
【修改方案】
1,按检视意见,进行资源泄露等问题的修改

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

re #I4WV56
Signed-off-by: wangchen <wangchen64@huawei.com>
2022-03-08 09:45:17 +00:00
openharmony_ci
7941b93d1c !816 fix: codex及合规修复
Merge pull request !816 from Zhaotianyu/0307codex_fix
2022-03-08 08:06:29 +00:00
openharmony_ci
d376efbe46 !815 feat: 优化shell 命令
Merge pull request !815 from zhushengle/shell
2022-03-08 02:14:59 +00:00
arvinzzz
64ddb1ff07 fix:codex及合规问题修复
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I5a738c243a07325b7cc314956a1658a69e768559
2022-03-07 19:34:50 +08:00
zhushengle
f02d40d25d feat: 优化shell 命令
1.优化task 命令关中断时间较长的问题
  2.优化hwi 命令,可以查看不同核的中断分布情况
  3.丰富hiw 命令,统计每个中断在一定时间内的平均执行时间和最大执行时间
  4.丰富swtmr 命令,在debug模式下支持查看各软件定时器的运行情况, 默认关闭

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I01cfe50c918da51f9de5b460e9eb91a863e1de36
2022-03-07 15:25:38 +08:00
yinjiaming
672bc729a6 fix: 主干告警清理
【背景】
主干告警清理

【修改方案】
在需要的地方添加了强制类型转换

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

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Id6693137310d8c2e63f4e5489564d7c01c016a18
2022-03-03 12:04:22 +00:00
openharmony_ci
31403e0e45 !808 修复A核文档失效的问题
Merge pull request !808 from yinjiaming/docs-01
2022-02-18 08:06:30 +00:00
yinjiaming
456d255a81 fix: 修复A核文档失效的问题
【背景】
【内核子系统】查看Ubuntu编译环境准备 不存在

【修改方案】
源文档中的链接已经失效,现修改链接指向新的文档
【影响】
对现有的产品编译不会有影响。

re #I4U7TF

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: If566f598fa9d19c5deafbb62990fdc20c9050a58
2022-02-18 07:28:36 +00:00
openharmony_ci
8c44c82723 !807 修复A核测试用例失败的问题
Merge pull request !807 from yinjiaming/sys_test
2022-02-17 12:10:12 +00:00
openharmony_ci
4c024f757e !806 修复A核测试用例失败的问题
Merge pull request !806 from yinjiaming/master
2022-02-17 12:09:28 +00:00
yinjiaming
59329ce7c6 fix: 修复A核测试用例失败的问题
【背景】
【OpenHarmony】【master】L1 liteos测试执行liteos_a_libc_unittest.bin 测试模块,测试套TimeTimerTest 3条用例Fail

【修改方案】
将一个测试用例中创建的无限循环的线程
在测试用例末尾关闭

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

re #I4SQDR

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I390f411502fe1a6a04071e0d7e02d936e3388cd7
2022-02-17 07:34:48 +00:00
yinjiaming
be68dc8bca fix: 修复A核测试用例失败的问题
【背景】
【OpenHarmony】【master】L1 liteos测试执行liteos_a_libc_unittest.bin 测试模块,测试套SysTest 1条用例Fail

【修改方案】
将先前更改locale的地方将locale设置为默认值

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

re #I4SQDP

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I4cd5d5d59aa3ff8ece469ee7a61054f3d4635f45
2022-02-17 07:15:27 +00:00
openharmony_ci
74f8d3aa07 !804 feat: 调度去进程化,优化进程线程依赖关系
Merge pull request !804 from zhushengle/sched_process
2022-01-27 12:03:34 +00:00
zhushengle
dc479fb7bd feat: 调度去进程化,优化进程线程依赖关系
1.移动LosTaskCB 至los_sched_pri.h, 解决调度与task的依赖关系
2.调度去进程化

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ibd3b618cee59f0b323e2b4fb14354c088b60b733
2022-01-27 14:30:50 +08:00
openharmony_ci
91bdcbd3c2 !801 kernel部件化编译构建(liteos_a仓库修改)
Merge pull request !801 from Hongjin Li/lihongjin/br_dev
2022-01-24 13:27:50 +00:00
Hongjin Li
422f22f5d2 chore: kernel部件化
编译构建入口整改为bundle.json

Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: I0d21acbeefbdbdad2a7f3d9308f648c59179ff49
2022-01-24 16:18:32 +08:00
openharmony_ci
6c0865dd46 !779 liteos-a kernel 部件标准化
Merge pull request !779 from Hongjin Li/lihongjin/br_dev
2022-01-22 09:59:39 +00:00
openharmony_ci
0257a0a14f !714 Fix : 修改了与musl库net模块中新增测试API相关的测试用例
Merge pull request !714 from yinjiaming/yjm-kernel-net-20211124
2022-01-22 08:10:06 +00:00
openharmony_ci
046d8defdf !791 feat: 调度相关模块间依赖优化
Merge pull request !791 from zhushengle/sched_rq
2022-01-22 06:14:50 +00:00
openharmony_ci
7938d2e569 !798 fix: pr模板补充说明
Merge pull request !798 from Harylee/mmu
2022-01-22 00:54:54 +00:00
yinjiaming
3d00a7d23a fix: 实现了musl库net模块中的一些函数接口和相应的测试用例
【背景】
musl库中关于net模块有一些API需要实现,相应的测试用例设计得不是非常合理.

【修改方案】
删去了与实现的API不相关的测试用例,修改了测试用例中一些错误的地方,
修改了测试用例中依赖硬件环境的一些地方。

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

re #I4JQI1

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: If57f50b025c84aa79107691efb091dde8e7b2156
2022-01-21 12:11:24 +00:00
Haryslee
e3cd485db5 fix: pr模板补充说明
Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: If717ba28495cd657fee965f9464d7165aa0e4168
2022-01-21 17:17:21 +08:00
zhushengle
0e3936c4f8 feat: 调度相关模块间依赖优化
背景:
    调度、线程、软件定时器、sortlink、percpu、异常、workqueue模块相互耦合,存在很多不属于本模块的实现,
导致这几个模块间依赖混乱、且到处引用其它模块的内部成员。

方案描述:
    解决上述依赖混乱的问题,为后续调度框架打基础,优化后依赖关系:

                                                              | ---> los_swtmr_pri.h --> workqueue
los_sortlink_pri.h: ---> los_sched_pri.h --> los_task_pri.h -->
   作为基础算法                                               | ---> ipc
(现在为双向链表),
做到功能最小化,
便于后续其它算法替换

调度框架大体方案描述:

1.cpu run queue ----> 任务延时队列

                                         |---- 调度队列
                   |----  EDF        --->
                   |                     |---- 方法(Delay、Suspend、Resume、EntReadyQue、Exit等)
                   |
                   |                     |---- 调度队列
2.task ---> 调度策略----> SCHED_RR   --->
                   |                     |---- 方法(Delay、Suspend、Resume、EntReadyQue、Exit等)
                   |
                   |                     |---- 调度队列
                   |----> SCHED_IDLE --->
                                         |---- 方法(Delay、Suspend、Resume、EntReadyQue、Exit等)

Close #I4RPRW
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ia54dc1b8a4801a225a52e40555490c1dce0bd75e
2022-01-21 15:52:51 +08:00
openharmony_ci
95248d4482 !784 fix: 针对pr是否同步至release分支,增加原因说明规则
Merge pull request !784 from Harylee/mmu
2022-01-21 03:47:03 +00:00
Hongjin Li
1ecda9c033 chore: kernel部件化
1、添加HPM包描述文件bundle.json
2、依赖的三方开源软件,由直接引用路径,改为import对应的gni文件,引用变量

Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
Change-Id: Ice783c19a477626d422a37faf3d420c4965f8ea6
2022-01-20 16:44:34 +08:00
openharmony_ci
9018eab20f !782 feat: 调度tick响应时间计算优化
Merge pull request !782 from zhushengle/calc_sched
2022-01-19 09:20:34 +00:00
openharmony_ci
e6bdfbb7a5 !783 refactor: 删除冗余测试套
Merge pull request !783 from Zhaotianyu/0118test_old_delete
2022-01-19 07:44:10 +00:00
arvinzzz
a28fcee1c5 refactor: 删除旧测试套,拆分process用例适配门禁90s规则
close: #I4RE80
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>

Change-Id: I353fe4aa10e4f03e7cbaca572c8e73289c599c29
2022-01-19 14:29:21 +08:00
zhushengle
f47da44b39 feat: 调度tick响应时间计算优化
1.tick timer与调度进一步剥离
2.性能敏感函数内敛化

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Icf62f002fa57d452cdd23a4c7b5e6610e2785f8e
2022-01-18 20:50:35 +08:00
Haryslee
b37a7b7929 fix: 针对pr是否同步至release分支,增加原因说明规则
Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: Iaea4676f20ff2b2d2f00c594cb46c2ab12c5f2c7
2022-01-18 19:01:19 +08:00
openharmony_ci
8e356c99c7 !781 refactor: 内核测试套整改,简化分类
Merge pull request !781 from Zhaotianyu/0114test_refactor
2022-01-18 08:53:08 +00:00
arvinzzz
a1ae2ecc13 refactor: 内核测试套整改,简化分类
close: #I4OX3O
Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>

Change-Id: I3ba65509135cee2ae3af82fec923a01e00ffdbe8
2022-01-18 14:50:09 +08:00
openharmony_ci
b7d624208b !780 L1-liteos-tdd测试liteos_a_process_unittest.bin,liteos_a_security_vid_unittest.bin和liteos_a_time_clock_unittest.bin模块用例un
Merge pull request !780 from xuxinyu/master
2022-01-14 06:26:11 +00:00
x_xiny
87b8e6b0ad fix: L1-liteos-tdd测试liteos_a_process_unittest.bin,liteos_a_security_vid_unittest.bin和liteos_a_time_clock_unittest.bin模块用例un
【背景】L1-liteos-tdd测试liteos_a_process_unittest.bin,liteos_a_security_vid_unittest.bin和liteos_a_time_clock_unittest.bin模块用例un

【修改方案】
 1.暂时将musl中的exit()接口中的原子操作改为使用mutex方式实现
 2.删除内核中不必要的打印

re #I4K9A5

Signed-off-by: xuiny <xuxinyu6@huawei.com>
Change-Id: Ifdbb9154c7541b863670bb4e3bcde2587970df38
2022-01-13 21:26:43 +08:00
openharmony_ci
321018cee0 !765 处理A核编译告警
Merge pull request !765 from yinjiaming/yjm-kernel-20220105
2022-01-13 11:39:28 +00:00
openharmony_ci
b0c046f8ac !776 修复toybox mv指令能够移动成功,但提示错误22的BUG
Merge pull request !776 from Far/master
2022-01-12 02:22:29 +00:00
Far
f2861ddfb4 fix: 修复futime提示错误22的BUG
调用futime时,系统调用接口函数直接使用了file结构体的f_path字段,该字段在退出前被错误地释放了。
避免该问题需要拷贝一份路径

Signed-off-by: Far <yesiyuan2@huawei.com>
Change-Id: I519ccb38bec323c93aa8cff920143bb3f9931c22
2022-01-11 16:05:36 +08:00
openharmony_ci
48f5481c65 !771 【轻量级 PR】:reduce print log if hilog ringbuffer is full
Merge pull request !771 from shenchenkai/N/A
2022-01-11 06:29:13 +00:00
openharmony_ci
c18b51182b !759 fix: MMU竞态问题修复
Merge pull request !759 from Harylee/mmu
2022-01-10 13:07:43 +00:00
openharmony_ci
d6dc0642c5 !764 Codex告警清除
Merge pull request !764 from xuxinyu/master
2022-01-10 04:56:46 +00:00
Haryslee
748e0d8ffb fix: MMU竞态问题修复
背景:同一个进程的多个线程读写同一个PTE时,由于PTE无保护,存在竞态问题。
方案:新增spinlock保护PTE,包括大锁跟小锁。大锁:一个进程只有一个spinlock锁,多个线程
读写PTE时竞争一把锁,锁的内存占用小,但系统性能降低;小锁:每个页表持有一把spinlock,
由于锁是page结构体的一个字段,内存消耗较大,但是相对大锁性能较优。系统默认使用大锁,用
户可根据具体需要配置使用大锁还是小锁。

close #I2WARC

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I5612eeac1f65507160035eae16af61f285182eda
2022-01-08 14:55:45 +08:00
x-xiny
1cdd7307f3 Codex告警清除
【背景】
 Codex扫描告警清除

【修改方案】
 将不可屏蔽告警进行修复

 re #I4PNO3

 Signed-off-by: xuiny <xuxinyu6@huawei.com>

Change-Id: If6f85eb9679d47e6256f24cdc74246df78da579d
2022-01-07 09:49:47 +00:00
shenchenkai
b65897d517 reduce print log if hilog ringbuffer is full
Signed-off-by: shenchenkai <shenchenkai@huawei.com>
2022-01-07 09:47:49 +00:00
yinjiaming
6c4e4b16ab fix: 修复shcmd.h需要用宏包起来的问题
【背景】
当前仓代码存在编译告警需要处理

【修改方案】
在测试用例中屏蔽-Werror
从shell.h中删除了多余的bool定义

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

re #I4N50W

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Id131b8437b471f44d9fe35a384678903216fcfb4
2022-01-07 06:59:40 +00:00
Jianglei Nie
a0ad1a4333 fix: 修复hm_liteipc.c的double unlock错误
对g_cmsTask的访问应该加锁,但代码中LOS_MuxLock被误用为LOS_MuxUnLock,导致double unlock错误。
可以将865行的LOS_MuxUnlock改为LOS_MuxLock来解决这个问题。

Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
2022-01-07 11:28:55 +08:00
openharmony_ci
9995d8e0e4 !749 Clang triple renaming
Merge pull request !749 from maweiye/master
2022-01-07 03:19:25 +00:00
openharmony_ci
0ca4a128d2 !763 fix: 修复 virpart.c 不适配的格式化打印问题
Merge pull request !763 from Far/master
2022-01-07 02:08:49 +00:00
Far
de29140edf fix: 修复 virpart.c 不适配的格式化打印问题
Close #I4PEVP

Signed-off-by: Far <yesiyuan2@huawei.com>
2022-01-05 10:59:50 +08:00
openharmony_ci
997e61ed53 !756 fix: 修复重复执行内存用例导致系统卡死问题
Merge pull request !756 from Harylee/print
2021-12-30 08:23:14 +00:00
Haryslee
6c2b163c7d fix: 修复重复执行内存用例导致系统卡死问题
背景:重复执行内存测试用例约几百次,系统大概率出现卡死现象,经分析知,系统卡在
内存spinlock锁中,CPU1在获取内存spinlock锁后打印异常信息,此时循环buffer满了,
CPU0此时进入异常且尝试拿取内存spinlock锁,两个核都处于锁中断锁任务状态,CPU1
写事件触发调度打印输出失败,进而在write接口中死循环无法退出,导致两个核都卡住。
方案:在write接口中增加一个判断条件:当前核处于锁任务状态且循环buffer满了时候,
直接退出循环,丢弃打印信息(持有spinlock锁后一般禁止输出打印信息)。

close #I4F7PO

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I3f49a1bb211821e9c5d1d220d6867962d6a45a79
2021-12-29 14:27:43 +08:00
zff
f504cc9145 fix: OsFutexWait接口当absTime为0时,返回值不正确,导致用户态c库不当处理,触发当前线程卡死
close: #I4KGO4

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I77d73836ec550828fd74ca84a13f83b1050316ac
2021-12-25 10:37:20 +08:00
openharmony_ci
979a8a8f27 !738 fix: 修复xts权限用例压测异常问题
Merge pull request !738 from Harylee/readme
2021-12-25 02:10:18 +00:00
openharmony_ci
b6f9dbbdba !747 修改procfs默认权限为550
Merge pull request !747 from LeonChan/master
2021-12-24 09:03:50 +00:00
maweiye
e567467b8a clang triple renaming
Signed-off-by: maweiye <maweiye@huawei.com>
2021-12-24 16:43:41 +08:00
Leon Chan
a776c04a3d fix: change default permission of procfs to 0550
close: #I4NY49

Signed-off-by: Leon Chan <chenwei26@huawei.com>
2021-12-24 12:03:58 +08:00
openharmony_ci
f7932bd006 !744 LOS_Panic和魔法键功能中的使用PRINTK打印,依赖任务调度,特殊情况下存在打印不出来的问题
Merge pull request !744 from zhangfanfan2/master
2021-12-23 07:08:02 +00:00
Haryslee
b0d31cb43f fix: 修复xts权限用例压测异常问题
用例异常时出现Domain fault或者unknown fault,经分析发现是TLB缓存一致性问题,
在缺页异常入口,对上述两种异常类型做异常地址TLB缓存清理即可。

close #I3ZJ1D

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: Ib84e3e87047fcac392b83a4cf6cca0d91754e66f
2021-12-23 08:50:43 +08:00
zff
53addea304 fix: LOS_Panic和魔法键功能中的使用PRINTK打印,依赖任务调度,特殊情况下存在打印不出来的问题
close: #I4NOC7

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I7f28e79293d3388e2b1d7208c2b8ff8ff133528a
2021-12-22 17:02:58 +08:00
openharmony_ci
954e7eb0cf !735 支持产品定制化hilog内核缓存大小
Merge pull request !735 from shenchenkai/master
2021-12-18 06:52:23 +00:00
shenchenkai
0e48a0dd12 Description:[feature] support customized hilog ring buffer size
Change-Id: I5d23deaada5939bbb6fb57505f72c2348bd6afe9
Signed-off-by: shenchenkai <shenchenkai@huawei.com>
2021-12-17 15:45:53 +08:00
openharmony_ci
52c12f7c9d !730 【轻量级PR】 console.c 分支优化
Merge pull request !730 from 雷电_SWAT/master
2021-12-16 04:26:19 +00:00
openharmony_ci
1e875d921b !734 fix: Watchdog test case repair
Merge pull request !734 from 尹树清/master
2021-12-15 02:59:56 +00:00
openharmony_ci
1db7aa7ada !733 refactor:los_cir_buf.c接口整合
Merge pull request !733 from Zhaotianyu/1213cirbuf_refactor
2021-12-15 01:46:39 +00:00
openharmony_ci
6a0c169780 !732 内核的编译框架在做编译入口的统一
Merge pull request !732 from wangchen/kernel_build
2021-12-15 01:09:40 +00:00
wangchen
bdb9864436 fix: 编译框架在做编译入口的统一
【背景】编译框架在做编译入口的统一,a核两种编译方式生成结果有差异

【修改方案】
1,修改kernel依赖

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

re #I4KRQN
Signed-off-by: wangchen <253227059@qq.com>
2021-12-14 13:19:31 +00:00
yinshuqing
bc69ca104c Watchdog test case repair
Signed-off-by: yinshuqing <yinshuqing@huawei.com>
2021-12-14 20:28:32 +08:00
arvinzzz
0d325c56a1 refactor: los_cir_buf.c中接口整合
将循环buf的上/解锁操作合进读/写操作里,删除对外上/解锁接口

BREAKING CHANGE:
1. 删除 LOS_CirBufLock(),LOS_CirBufUnlock()内核对外接口
2. LOS_CirBufWrite(),LOS_CirBufRead()由原先内部不进行上/解锁操作,变为默认已包含上/解锁操作。

close: #I4MC13

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ie3cc1abde7fa0e5479ccbf4e596426e509b5cef5
2021-12-14 11:00:36 +08:00
openharmony_ci
5bed688ca6 !731 【请求检视】fix: 修复LOSCFG_FS_FAT_CACHE宏关闭后编译失败的BUG
Merge pull request !731 from Far/master
2021-12-13 10:03:58 +00:00
Far
63e71feca0 fix: 修复LOSCFG_FS_FAT_CACHE宏关闭后编译失败的BUG
1. 在必要处增加宏开关关闭部分代码的编译;
2. 由于驱动是一个独立的内核线程,在一些场景下文件系统会将用户态地址透传给驱动,这会导致内核崩溃。
因此在需要透传用户态地址时增加了一个内核buffer作为中转。

Close #I3T3N0

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-12-13 15:01:16 +08:00
lcjh
2ada41c826 分支优化
去除不必要分支,使用三元操作符优化简单分支
Signed-off-by: lcjh <120989324@qq.com>
2021-12-11 12:35:41 +08:00
openharmony_ci
9b397173fe !728 移除顶层BUILD.gn中的visibility属性设置
Merge pull request !728 from Caoruihong/remove_visibility
2021-12-08 13:57:00 +00:00
openharmony_ci
2fa85a2c72 !703 fix: 解决dmesg -s参数double lock问题
Merge pull request !703 from Kiita/1109_dmesg
2021-12-08 10:56:48 +00:00
Caoruihong
63a0fcaefb chore(build): remove visibility of the top BUILD.gn
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I83616f794d169c8637ab79b2dd96d3858d11fce7
2021-12-08 17:55:07 +08:00
openharmony_ci
144214869f !643 添加对GCC工具链的支持
Merge pull request !643 from Caoruihong/support_gcc
2021-12-08 07:20:38 +00:00
Kiita
e1512566e3 fix: 解决dmesg -s参数double lock问题
【背景】自研shell或者mksh拉起后使用dmesg -s命令出现自旋锁double lock的问题。

【修改方案】
dmesg -s参数设置dmesg缓冲区过程需要访问UartOutput所访问的全局缓冲区,这意味着两个功能模块
使用了同一把自旋锁,若在dmesg命令执行过程使用了打印,则就可能会导致double lock。因此拆分
了dmesg -s命令过程中自旋锁的使用区域,避开内核中必要的打印。

re #I4HIJK

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: Iad74c058c9a8090fd3d9f338caab7d8f2170f9ac
2021-12-06 11:28:07 +08:00
Caoruihong
6e886d4233 feat(build): support gcc toolchain
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I6f2dea19cbd2e5b562bb51e30592205a2bb4fbdb
2021-12-05 02:49:48 +08:00
openharmony_ci
67e31f7b45 !726 fix: 删除冗余的头文件los_pmm.h
Merge pull request !726 from kenneth/los_pmm.h
2021-12-03 07:02:35 +00:00
openharmony_ci
26c09d26fc !727 fix: 修改MMU模块的注释错误
Merge pull request !727 from kenneth/page_idx
2021-12-03 07:01:51 +00:00
kenneth
1a8e22dcf1 fix: 修改MMU模块的注释错误
修改los_arch_mmu.c中的page_idx 为scanIndex,修改pmm_alloc_page为LOS_PhysPageAlloc。

fix #I4KMMJ

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-12-03 11:07:18 +08:00
kenneth
8e614bb161 fix: 删除冗余的头文件
删除无用的头文件kernel\base\include\los_pmm.h

fix #I4KN63

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-12-03 10:59:20 +08:00
openharmony_ci
f88608e5a4 !722 内核ERR打印,无进程和线程信息,不方便问题定位
Merge pull request !722 from zhangfanfan2/other3
2021-12-03 02:38:15 +00:00
openharmony_ci
30d5badbce !723 用户态进程主线程退出时,其他子线程刚好进入异常处理流程会导致系统卡死
Merge pull request !723 from zhangfanfan2/master
2021-12-03 02:37:54 +00:00
openharmony_ci
c8c07261ca !724 fix: los_stat_pri.h中缺少依赖的头文件
Merge pull request !724 from zhushengle/sched
2021-12-01 07:48:13 +00:00
zhushengle
2cd03c55b7 fix: los_stat_pri.h中缺少依赖的头文件
在los_stat_pri.h中添加los_typedef.h

Close #I4KEZ1

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I19f8b79f9f559e1324432280f123a911bf8caf27
2021-12-01 09:24:52 +08:00
openharmony_ci
b3489d49d7 !721 feat: 提供低功耗默认处理框架
Merge pull request !721 from zhushengle/pm
2021-11-30 09:51:39 +00:00
zff
d955790a44 fix: 用户态进程主线程退出时,其他子线程刚好进入异常处理流程会导致系统卡死
接口OsTaskExitGroup被同一个进程的两个互等线程重入,逻辑出现死循环,导致系统卡死

close: #I4KGBT

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I484bba67473f7d0edbfdff95549ffb32bffb4988
2021-11-30 16:14:22 +08:00
zhangfanfan2
540b2017c5 fix: 内核ERR级别及以上的打印输出当前进程和线程名
Signed-off-by: zff <zhangfanfan2@huawei.com>
2021-11-30 07:41:03 +00:00
zhushengle
212d1bd1e8 feat: 提供低功耗默认处理框架
添加系统在不同低功耗下的默认处理函数。
Close #I4KBG9

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I7d9a32d03daf32998f4cfca17c57b3f0e614d4ac
2021-11-30 10:49:47 +08:00
openharmony_ci
ba8438257a !715 feat: 支持L1 低功耗框架
Merge pull request !715 from zhushengle/pm
2021-11-29 07:04:55 +00:00
zhushengle
64e49aba7c feat: 支持L1 低功耗框架
方案描述:
   和L0保持一致,上层通过proc文件系统操作:
   power_mode  支持的低功耗模式,通过对该文件进行write操作可以设置低功耗模式
   power_count powermanager模块通过对该文件操作,和内核进行交互,简要流程如下:
     while (1) {
       open  // 打开该文件
       read  // 使powermanager低功耗任务常阻塞,当系统无任何模块持锁时,会唤醒该任务
       write // 进行低功耗流程
       close // 关闭该文件
     }
   power_lock    write该文件,持锁
   power_unlock  writw该文件,释放锁

Close #I4JSO

Change-Id: I73fcdeeb5e2039484b3351a81b46a0892b349fe9
Signed-off-by: zhushengle <zhushengle@huawei.com>
2021-11-29 11:58:47 +08:00
openharmony_ci
3e7cfaa520 !708 feat: L0-L1 支持Lms轻量级地址消毒
Merge pull request !708 from LiteOS/lms
2021-11-27 07:07:52 +00:00
LiteOS2021
e748fdbe57 feat: L0~L1 支持Lms
1.【需求描述】:
   支持内核态和用户态堆内存非法访问检测,包括:越界访问、double free、释放后使用;支持libc常用高频函数内存检测;支持安全函数内存检测;读写检测可配可裁剪。
2.【方案描述】:
   L0 ~ L1:
   (1).影子内存映射与标记
   (2).编译器使能-fsanitize=kernel-address 自动插桩检测点
   (3).实时校验影子内存的合法性;
   (4).错误访问打印回溯栈

BREAKING CHANGE: 新增支持API:

LOS_LmsCheckPoolAdd使能检测指定内存池
LOS_LmsCheckPoolDel不检测指定内存池
LOS_LmsAddrProtect为指定内存段上锁,不允许访问
LOS_LmsAddrDisableProtect去能指定内存段的访问保护

Close #I4HYAV

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
Change-Id: Id8e5c890656da9edc4a22227e6a3c32205c024ce
2021-11-27 11:13:41 +08:00
openharmony_ci
48f645db84 !717 refactor:内核安全函数库编译复用三方目录安全函数库中的配置
Merge pull request !717 from Zhaotianyu/1125libsec
2021-11-26 06:46:02 +00:00
arvinzzz
d73aff846b refactor: 内核编译安全函数库复用三方安全函数库中的配置清单,减少冗余
close: #I4JUKM

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I30115a12b9244ac4821c443a838aa248b47d4fb9
2021-11-26 11:04:12 +08:00
openharmony_ci
ce4323ff16 !704 【fix】smp启动时副核冗余的启动框架调用
Merge pull request !704 from Zhaotianyu/1110smpinit_fix
2021-11-25 22:48:51 +00:00
openharmony_ci
f6a7003c16 !711 硬件随机数配置选项增加arm virt平台支持
Merge pull request !711 from laokz/rng
2021-11-25 13:57:33 +00:00
openharmony_ci
c12bef84b2 !716 [LTS-3.0]修复jffs2适配层错误释放锁的BUG
Merge pull request !716 from Far/cherry-pick-1637845785
2021-11-25 13:56:13 +00:00
openharmony_ci
7a7c67cbdd !712 修复jffs2适配层错误释放锁的BUG
Merge pull request !712 from Far/master
2021-11-25 13:56:12 +00:00
Far
d2a2f96adf fixed 011a55f from https://gitee.com/yesiyuanjim/kernel_liteos_a/pulls/712
fix: 修复jffs2适配层错误释放锁的BUG

修复重复释放jffs2全局锁的BUG

Close #I4FH9M

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-11-25 13:09:48 +00:00
openharmony_ci
5db6c62313 !710 清理YES/NO宏
Merge pull request !710 from Caoruihong/remove_yesno
2021-11-18 09:32:42 +00:00
Far
011a55ff21 fix: 修复jffs2适配层错误释放锁的BUG
修复重复释放jffs2全局锁的BUG

Close #I4FH9M

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-11-18 14:22:25 +08:00
laokz
68f9f49c2a fix(arm-virt): HW_RANDOM_ENABLE配置支持arm virt平台
Signed-off-by: laokz <laokz@foxmail.com>
Change-Id: Idb6b7327d3773abe2ddf0cbc4996650d96c85887
2021-11-17 11:41:51 +08:00
openharmony_ci
fe4082ca9e !709 A核代码静态告警定期清理
Merge pull request !709 from wangchen/1112_codex
2021-11-16 06:47:22 +00:00
openharmony_ci
ac08912230 !706 fix: 修复los_vm_scan.c中内部函数OsInactiveListIsLow冗余代码
Merge pull request !706 from kenneth/los_vm_scan
2021-11-16 00:48:50 +00:00
openharmony_ci
a32a7c4fad !707 chore: 优化函数OsVmRegionRightCheck命名
Merge pull request !707 from kenneth/OsVmRegionRightCheck
2021-11-16 00:48:26 +00:00
Caoruihong
bba832ea08 chore: replace YES/NO macros to 1/0
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I40e31e82c33418019c1afc16ac174919e72fbb07
2021-11-16 01:27:06 +08:00
openharmony_ci
09fd11bc38 !705 清理"bits/xxx.h"类头文件包含
Merge pull request !705 from Caoruihong/clean_bits
2021-11-15 09:35:09 +00:00
lnlan
9ba725c3d4 fix: A核代码静态告警定期清理
【背景】A核代码静态告警定期清理

【修改方案】
1,根据codex等工具分析结果,进行必要的规范等问题修改

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

re #I4I0O8
Signed-off-by: wangchen <253227059@qq.com>
2021-11-15 02:47:08 +00:00
kenneth
2bddff54c8 chore: 优化函数OsVmRegionRightCheck命名
函数名称OsVmRegionRightCheck修改为OsVmRegionPermissonCheck进行内存区间权限检查

close #I4HR6I

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-11-11 19:52:25 +08:00
kenneth
bc32a1ec0f fix: 修复los_vm_scan.c中内部函数OsInactiveListIsLow冗余代码
函数OsInactiveListIsLow()和InactiveListIsLow()代码重复,删除冗余代码。

close #I4HKFF

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-11-11 19:44:34 +08:00
Caoruihong
5d5df3a5d7 chore: clean "bits/xx.h" includes
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I3dcf576ceba66b0fa447573e997d064026eb8785
2021-11-11 12:03:56 +08:00
openharmony_ci
07cab40473 !696 chore: 修复社区反馈问题Percpu结构体注释错误
Merge pull request !696 from kenneth/core_typo
2021-11-11 01:29:52 +00:00
arvinzzz
5ce70a50c3 fix: smp初始化中副核冗余的启动框架调用
close: #I4F8A5

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I9a863d3265fd18051d8bfcaab51ad59216630e91
2021-11-10 19:14:29 +08:00
kenneth
0f878febb7 chore: 修复社区反馈问题Percpu结构体注释错误
修复社区反馈问题Percpu结构体注释错误,排查下其他拼写错误。

close #I4GMLH

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-11-10 10:20:33 +08:00
openharmony_ci
f63ce99399 !692 chore: 修复内存模块的一些不规范用语
Merge pull request !692 from kenneth/mmu_fix
2021-11-10 02:06:29 +00:00
openharmony_ci
e317f9b5b5 !702 fix: shell支持exit退出,完善帮助信息,特殊处理不可见字符
Merge pull request !702 from huangshan/chore
2021-11-09 09:26:47 +00:00
huangshan
cc6e11281e fix: shell支持exit退出,完善帮助信息,特殊处理不可见字符
Change-Id: Ia6dbff0faed4ec73fcf35691676f1acb2b8df78d
Signed-off-by: huangshan <huangshan9@huawei.com>
2021-11-08 18:13:38 +08:00
openharmony_ci
9525ca2826 !697 修改blackbox生成的文件和文件夹权限
Merge pull request !697 from mgceshuang/upload_teeee
2021-11-08 02:27:30 +00:00
openharmony_ci
a412bfb275 !686 增加内核epoll系统调用适配musl接口并增加测试用例
Merge pull request !686 from wangchen/tocommit
2021-11-08 01:30:05 +00:00
openharmony_ci
3b8083815c !701 按照门禁要求对所有BUILD.gn脚本进行格式化
Merge pull request !701 from Caoruihong/gnformat
2021-11-06 04:48:29 +00:00
Caoruihong
a2fed9a56c chore(build): format all BUILD.gn files
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ifd3bf13f53a27e0a0bbd051cf35662e7409e6ed0
2021-11-06 11:55:58 +08:00
lnlan
2251b8a2d1 fix: 增加内核epoll系统调用
【背景】增加内核epoll系统调用适配musl接口并增加测试用例

【修改方案】
1, 删除musl仓的porting
2,内核实现epoll对应接口及注册系统调用
3,testsuit目录添加对应的用例

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

re #I4FXPT
Signed-off-by: wangchen <253227059@qq.com>

Change-Id: Ia97ea49067aa1ff47b8c1c83675ac75e75d25955
2021-11-05 08:17:43 +00:00
openharmony_ci
5077b1793f !693 fix: 修复Ctrl+C会终止所有进程的问题
Merge pull request !693 from huangshan/fix-pgrp
2021-11-05 05:58:22 +00:00
openharmony_ci
e99aba9d0f !695 feat: 进程cpup占用率结构优化为动态分配
Merge pull request !695 from zhushengle/cpup
2021-11-04 09:03:24 +00:00
YOUR_NAME
eedde91826 Modify folder and file permissions
Signed-off-by: YOUR_NAME <mashuang9@huawei.com>
2021-11-04 14:50:42 +08:00
huangshan
cdc0877f16 修复Ctrl+C会终止所有进程的问题
Signed-off-by: huangshan <huangshan9@huawei.com>
Change-Id: I5861569c63fd6c1adf8c702797e4d79eba76211f
2021-11-04 12:23:20 +08:00
openharmony_ci
0f8ff8f545 !662 fix SYSCALL SysFstat,SysFstat64,SysFstatat64(fix struct kstat with stat) & add 19 IO testcases
Merge pull request !662 from 刘治万/1015_unitest
2021-11-04 01:46:08 +00:00
zhushengle
f06e090a10 feat: 进程cpup占用率结构优化为动态分配
Close #I4GLNT
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I7f3dd61bbf014fa157b1f9a0a089fd985fe188c2
2021-11-02 19:57:26 +08:00
openharmony_ci
38163de8f3 !687 feat: liteipc 静态内存优化
Merge pull request !687 from zhushengle/liteipc
2021-11-02 11:05:46 +00:00
openharmony_ci
fcb21ffc8a !676 修复ppoll接口"[ERR]OsMemFree check error!"报错
Merge pull request !676 from pef/ppoll-1
2021-11-02 09:35:09 +00:00
lnlan
2e3bbf1e61 修复ppoll接口"[ERR]OsMemFree check error!"报错
【背景】
1.内核中释放用户空间指针报错:"[ERR]OsMemFree check error!"
2.现有ppoll实现存在问题
3.相关用例需要整理
【修改方案】
1.去掉释放用户空间指针操作
2.更正逻辑错误
3.更正掩码设置与恢复不起作用
4.修复补充现有用例
【影响】
对现有的产品编译不会有影响。

re #I47YWZ

Change-Id: Ib2f60986e9cafb2ea5ef1097ab8552cbb1ede5b4
Signed-off-by: lnlan <lanleinan@163.com>
2021-11-02 07:04:35 +00:00
kenneth
466996b2e1 chore: 修复内存模块的一些不规范用语
layes修正为layers,alreay修正为already,Continous修正为Continuous等等

close #I4GHLR

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-11-02 12:01:59 +08:00
zhushengle
52379242c1 feat: liteipc 静态内存优化
Close #I4G4HP
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I259c792365d9747f391c5bd275e77f04b83e0792
2021-11-02 11:54:08 +08:00
openharmony_ci
e0a6e1f9f0 !679 fix: 修复OsVmPhysFreeListAdd和OsVmPhysFreeListAddUnsafe函数内容重复
Merge pull request !679 from kenneth/los_vm_phys
2021-11-02 03:00:02 +00:00
openharmony_ci
e54eb9e34d !690 chore: 修复任务调度代码中部分函数、变量命名不规范问题
Merge pull request !690 from kenneth/typos
2021-11-02 02:50:03 +00:00
kenneth
ef1d9f848d chore: 修复任务调度代码中部分函数、变量命名不规范问题
变量readTasks应该为readyTasks;函数OsSchedTaskSwicth应该为OsSchedTaskSwitch;其他拼写错误。

close #I4GFJ7

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-11-02 08:49:52 +08:00
openharmony_ci
ebfac57d54 !685 fix: 优化liteipc任务状态,删除功能重复字段
Merge pull request !685 from zhushengle/liteipc
2021-10-30 02:31:41 +00:00
openharmony_ci
3074449c79 !665 修复misc09用例因依赖hosts文件而失败
Merge pull request !665 from lnlan/sys_misc_test_fix
2021-10-30 02:15:26 +00:00
pef
78a297fd4e 修复ppoll接口"[ERR]OsMemFree check error!"报错
【背景】
内核中释放用户空间指针报错:"[ERR]OsMemFree check error!"

【修改方案】
修改SysPpoll函数。

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

re #I47YWZ

Change-Id: Id7f86036870d4f32be8fc438b9aad85cdda59546
Signed-off-by: pef <cyd1997@126.com>
2021-10-29 08:14:20 +00:00
zhushengle
5004ef4d87 fix: 优化liteipc任务状态,删除功能重复字段
LosTaskCB 中 字段waitFlag 用于专门记录任务被阻塞的原因,与ipcStatus 功能重复
Close #I4FVHK

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ie0998b987ba6e1db050596dec3b359e73ca47686
2021-10-29 12:02:00 +08:00
teamol
79839a4325 OOfix SYSCALL SysFstat,SysFstat64,SysFstatat64(fix struct kstat with stat) & add 19 IO testcases
1.modifications:
    modified:   testsuites/unittest/IO/It_test_IO.h
    modified:   testsuites/unittest/IO/full/IO_test_duplocale_001.cpp
    modified:   testsuites/unittest/IO/io_test.cpp
2.add 19 testcases:
    IO_test_dcgettext_001.cpp
    IO_test_dcgettext_002.cpp
    IO_test_dcngettext_001.cpp
    IO_test_dcngettext_002.cpp
    IO_test_dngettext_001.cpp
    IO_test_dngettext_002.cpp
    IO_test_duplocale_001.cpp
    IO_test_locale_001.cpp
    IO_test_ngettext_001.cpp
    IO_test_nl_langinfo_001.cpp
    IO_test_nl_langinfo_l_001.cpp
    IO_test_strcasecmp_l_001.cpp
    IO_test_strfmon_l_001.cpp
    IO_test_strncasecmp_l_001.cpp
    It_stdio_hasmntopt_001.cpp
    IO_test_gettext_001.cpp
    IO_test_locale_002.cpp
    IO_test_strcasecmp_l_002.cpp
    IO_test_strfmon_l_002.cpp
    IO_test_strncasecmp_l_002.cpp
3.influence:
    none

Signed-off-by: liuzhiwan <liuzhiwan2020@163.com>
Change-Id: Ib5883ddb14cfd545f2c5b1685a082f098def0965
2021-10-29 03:05:20 +00:00
openharmony_ci
b2274a009e !683 fix: 非当前进程退出时,销毁liteipc时错误的销毁了当前进程的
Merge pull request !683 from zhushengle/liteipc
2021-10-29 01:51:33 +00:00
teamol
a55f68f957 fix: fix ppoll
1.modifications:
modified:   syscall/fs_syscall.c
2.modify 2 testcases:
IO/full/IO_test_ppoll_001.cpp
IO/full/IO_test_ppoll_002.cpp
3.influence:
none

Signed-off-by: pef <cyd1997@126.com>
Change-Id: I85fc091098a6dfef1a4694a3bbc489640ee6dda2
2021-10-28 11:54:19 +00:00
zhushengle
0f0e85b7a6 fix: 非当前进程销毁时,销毁liteipc时错误的销毁了当前进程的liteipc资源
Close #I4FSA7
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I8b24a1e1554b4b867a841bc1b6765cbfd648cdbd
2021-10-28 17:30:54 +08:00
openharmony_ci
308750199f !682 fix: 修复进程process_test_045.cpp用例导致门禁概率失败
Merge pull request !682 from zhushengle/test
2021-10-28 08:18:42 +00:00
openharmony_ci
2f6cd46372 !664 feat: 支持LOS_TaskJoin 和 LOS_TaskDetach
Merge pull request !664 from zhushengle/Join
2021-10-28 08:01:08 +00:00
openharmony_ci
ea45982e1f !669 feat: 进程rlimit修改为动态分配,减少静态内存占用
Merge pull request !669 from zhushengle/rlimit
2021-10-28 02:35:27 +00:00
lnlan
f2f5c5fdc3 fix(test): misc09用例因依赖hosts文件而失败
【背景】
1.etc/hosts文件不存在,misc09依赖hosts文件而失败

【修改方案】
1.用例执行前检查是否存在这些配置文件,不存在就跳过该用例

re#I48IZ0

Change-Id: I193cb03770932c1f681cd726ceb383816aa2257a

Signed-off-by: lnlan <lanleinan@163.com>
Change-Id: I3fb7ca1ed5f8cc79a56cd1872f3b303ab325a7a9
2021-10-28 02:06:08 +00:00
openharmony_ci
91c1737d1b !670 当hilog/hievent驱动缓存出问题时,进行恢复处理
Merge pull request !670 from shenchenkai/master
2021-10-28 02:03:03 +00:00
openharmony_ci
557f4ccb66 !666 复sys部分用例因依赖passwd、group文件而失败
Merge pull request !666 from lnlan/sys_test_fixed
2021-10-28 01:36:46 +00:00
zhushengle
1ed28b4c80 fix: 修复进程用例导致门禁概率失败
Close #I4FO0N
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I9dc9819f2ebceaceea337651cc747d737e437661
2021-10-28 09:26:30 +08:00
kenneth
6827bd2a22 fix: 修复OsVmPhysFreeListAdd和OsVmPhysFreeListAddUnsafe函数内容重复
删除OsVmPhysFreeListAdd/OsVmPhysFreeListAddUnsafe、OsVmPhysFreeListDel/OsVmPhysFreeListDelUnsafe两对内部函数内容重复的部分。

close #I4FL95

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-10-27 15:35:43 +08:00
lnlan
614cdccf91 fix(test): 修复sys部分用例因依赖passwd、group文件而失败
【背景】
1.sys部分用例因依赖passwd、group文件而失败

【修改方案】
1.用例执行前检查是否存在这些配置文件,不存在就跳过该用例

re#I48IUC

Change-Id: I787ce4b200f2a7546e57290b7dd073127caa07bb
Signed-off-by: lnlan <lanleinan@163.com>
2021-10-27 01:25:38 +00:00
openharmony_ci
23c4f2b81b !673 fix: implicit declaration of function 'syscall' in apps/shell
Merge pull request !673 from uhamc/fix-apps-shell-build
2021-10-26 06:43:57 +00:00
openharmony_ci
d6f48477a4 !658 增加内核pselect系统调用适配musl pselect接口并增加测试用例。
Merge pull request !658 from wangchen/pselect
2021-10-26 01:44:20 +00:00
openharmony_ci
7676cdb886 !656 修复PR520的修改缺陷
Merge pull request !656 from lnlan/sigwait_patch
2021-10-26 01:39:06 +00:00
uhamc
bd0c0835fc fix: implicit declaration of function 'syscall' in apps/shell
Change-Id: Id3f56ac53ec5a3c86b04bcb7a4611f2eb77f4b80
Signed-off-by: uhamc <uhamc@foxmail.com>
2021-10-25 17:12:08 +08:00
openharmony_ci
24ba16a01e !671 fix: 修复进程线程不稳定用例
Merge pull request !671 from zhushengle/test
2021-10-25 03:20:45 +00:00
zhushengle
f6ac03d3e3 fix: 修复进程线程不稳定用例
Close #I4F1XL
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ifdde21a2ff4213218a0fa44ad17af0c15a426758
2021-10-25 10:15:53 +08:00
teamol
f601c16b9e fix: 增加pselect SYSCALL函数及测试用例
1.modifications:
modified:   syscall/fs_syscall.c
modified:   syscall/los_syscall.h
modified:   syscall/syscall_lookup.h
2.add 1 testcases:
modified:   testsuites/unittest/IO/BUILD.gn
modified:   testsuites/unittest/IO/full/IO_test_pselect_001.cpp
modified:   testsuites/unittest/IO/io_test.cpp
3.influence:
none

re #I45SXU
Signed-off-by: wangchen <253227059@qq.com>
Change-Id: I03a5d464fd5423c360e42f7d141035ce0d83d8a8
2021-10-22 09:25:20 +00:00
shenchenkai
c121d0eea3 Description:[fix] clean hilog/hievent ring buffer after memory verification failed
Change-Id: I9310fe807ec95721be78deb60ed9728ef9b56e48
Signed-off-by: shenchenkai <shenchenkai@huawei.com>
2021-10-22 17:00:10 +08:00
zhushengle
cf8446c941 feat: 进程rlimit修改为动态分配,减少静态内存占用
Close #I4EZY5

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I47ed0ff7a52f72e38875c3308b20e183cc5c4563
2021-10-22 11:55:52 +08:00
openharmony_ci
e328c528b1 !667 fix: 添加进程线程冒烟用例
Merge pull request !667 from zhushengle/test
2021-10-22 03:16:45 +00:00
zhushengle
2be59680f2 fix: 添加进程线程冒烟用例
Close #I4EOGA
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I0f10f81d41564d4d34fc2f89692da0b3211f5918
2021-10-21 14:39:13 +08:00
openharmony_ci
805a67ae2f !661 文件系统Open性能优化
Merge pull request !661 from Far/master
2021-10-20 09:28:40 +00:00
zhushengle
37bc11fa88 feat: 支持LOS_TaskJoin 和 LOS_TaskDetach
Close #I4EENF
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Iaa1582f567eb3524262bea383e0b8238b89b5fe2
2021-10-19 14:26:10 +08:00
openharmony_ci
0507b9e8ea !654 内核ERR打印,无进程和线程信息,不方便问题定位
Merge pull request !654 from zhangfanfan2/master
2021-10-18 03:03:28 +00:00
openharmony_ci
acd631c731 !657 【fix】los_trace.h注释修正
Merge pull request !657 from Zhaotianyu/1012trace_fix
2021-10-15 07:42:21 +00:00
Far
c1c2be2a87 refactor: 文件系统Open性能优化
优化包括:
1. 提供VnodeLookupFullpath接口,如果路径是规范化的路径,则调用此接口可减少一次vfs_normalizepath接口的调用;
2. fatfs open钩子函数FIL和buffer同时malloc,减少一次malloc调用,同时去除不必要的数据写回;
3. 其他小细节的优化。

Close #I4E0CT

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-10-15 11:59:38 +08:00
openharmony_ci
bda00e6747 !655 TCB中使用的execFile字段改为execVnode
Merge pull request !655 from LeonChan/execfile
2021-10-15 01:45:58 +00:00
zff
cb423f8454 fix: 内核ERR打印,无进程和线程信息,不方便问题定位。
close: #I4DAKM

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I5acc8b2b632633b0717eb4186773e6cae35ea0e4
2021-10-14 19:03:11 +08:00
openharmony_ci
d3b618887a !660 fix: 优化trace buffer初始化,删除swtmr 桩中的无效参数
Merge pull request !660 from LiteOS/master
2021-10-14 02:41:05 +00:00
openharmony_ci
e8f5a286aa !659 ioctl支持SIOCGIFBRDADDR选项
Merge pull request !659 from 刘建东/master
2021-10-14 01:48:15 +00:00
LiteOS2021
b551270ef5 fix: 优化trace buffer初始化,删除swtmr 桩中的无效参数
close #I4DQ1X
Signed-off-by: LiteOS2021 <dinglu@huawei.com>

Change-Id: I79b416720f5327749a5884a65a5e61db07f2a17c
2021-10-14 09:47:11 +08:00
YOUR_NAME
4ecc473843 feat: add option SIOCGIFBRDADDR for ioctl
add option SIOCGIFBRDADDR for ioctl

close: #I4DNRF

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-10-13 11:53:49 +08:00
openharmony_ci
8096d9f575 !651 fix: 修复硬随机不可用时,地址随机化不可用问题
Merge pull request !651 from Harylee/shm
2021-10-12 03:25:40 +00:00
arvinzzz
6d249618ae fix: los_trace.h接口注释错误修正
1. LOS_TraceStop接口的功能描述应该是stop

close: #I4CYPZ

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Iee0cf43f6e5ee8e544e233c0c307725c5bfebdcf
2021-10-12 10:30:30 +08:00
lnlan
40338918d9 fix: 修复PR520缺陷
【背景】
https://gitee.com/openharmony/kernel_liteos_a/pulls/520
上面修改,信号处理时才会释放申请的内存,当信号被屏蔽,且一直发送该信号时,
内存占用会不断变大
【修改方案】
1.
信号发送时已经有该信号的siginfo在链表中时,不再重新申请,重复使用之前的siginfo.

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

re#I4DEG5

Signed-off-by: lanleinan <lanleinan@163.com>

Change-Id: I74b3b7ff0b9efb0179313af9a0c8d1e12d1db5bb
2021-10-11 12:37:58 +00:00
openharmony_ci
fd4b97e3f8 !650 通过g_uart_fputc_en关闭打印后,shell进程不能正常启动
Merge pull request !650 from zhangfanfan2/master
2021-10-11 07:46:26 +00:00
openharmony_ci
13e1e70358 !652 OsFutexWaitParamCheck函数中absTime为0时,直接返回,不需要打印
Merge pull request !652 from zhangfanfan2/other
2021-10-11 07:45:35 +00:00
openharmony_ci
c360a97bab !631 fix: 进程在退出前回收vmspace中的所有Region
Merge pull request !631 from zhushengle/process
2021-10-11 03:55:22 +00:00
Haryslee
665c152c27 fix: 修复硬随机不可用时,地址随机化不可用问题
方案:硬随机不可用时,默认使用软随机数代替硬随机数

close #I4D4TK

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: Ia7d2a9583257d7b8041b8994a70a7c36149c33fb
2021-10-11 10:00:08 +08:00
zhangfanfan2
3f71be7535 fix: OsFutexWaitParamCheck函数中absTime为0时,直接返回,不需要打印
当设置的超时时间比较短时,会出现absTime为0的情况,直接返回,不需要阻塞和打印。

close: #I4D67E

Signed-off-by: zff <zhangfanfan2@huawei.com>
2021-10-10 08:49:56 +00:00
zhushengle
298ccea3fe fix: 进程退出前自己回收vmspace中的所有region
背景:
父进程fork一个子进程,调用waitpid等待子进程结束。
子进程dlopen一个文件a.so,并退出。当守护进程正在
1核回收子进程资源时,父进程在0核运行从waitpid返
回后,同时remove a.so概率失败。

Close #I4CKQC

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ie7940e7c931ced10ee357cf9aa7c64355effed49
2021-10-09 12:14:45 +08:00
openharmony_ci
56a92f9207 !641 feat: 支持AT_RANDOM以增强用户态栈保护能力
Merge pull request !641 from Harylee/shm
2021-10-08 06:01:21 +00:00
zff
d21b05c0f6 fix: 通过g_uart_fputc_en关闭打印后,shell进程不能正常启动
console层的实现中复用g_uart_fputc_en用于关闭打印的功能,代码设计上认为
g_uart_fputc_en为0时console层未使能,导致shell进程中ioctl操作失败,shell
进程不能正常启动。

close: #I4CTY2

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I0a225c1db42f2b384ad590ca05b048c4b61db99c
2021-10-08 10:01:31 +08:00
openharmony_ci
29df5dc1f2 !646 将menuconfig 与 update_config功能做成一样
Merge pull request !646 from Caoruihong/menuconfig2
2021-09-30 07:19:01 +00:00
Leon Chan
e4a06623ce fix: change the execFile field in TCB to execVnode
TEE需要借用TCB中的execFile来校验打开的文件,pagecache修改后,可执行程序在mmap之后,会被立即关闭,因此将execFile改为execVnode

close: #I4CLL9

Signed-off-by: Leon Chan <chenwei26@huawei.com>
2021-09-30 14:33:36 +08:00
openharmony_ci
e1b36bfe41 !594 临终遗言重定向内容缺失task相关信息,对应的shell命令中申请的内存需要cacheline对齐
Merge pull request !594 from zhushengle/excinfo
2021-09-30 06:17:48 +00:00
Caoruihong
3dd952b0b7 chore(make): make menuconfig same as update_config
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I5c4a1a0601865c1c7d6ae40b829abdb53f13ccd3
2021-09-30 12:04:48 +08:00
Haryslee
06ea03715f feat: 支持AT_RANDOM以增强用户态栈保护能力
背景:不开地址随机化时,用户态栈CANARY值是固定值
方案:支持AT_RANDOM,CANARY从AT_RANDOM获取随机值以增强用户态栈保护能力

close #I4CB8M

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I28cef09f7016a5096e2096d4f6aa72722fcf1fd7
2021-09-30 10:36:12 +08:00
zhushengle
48ca854bf0 fix: 临终遗言重定向内容缺失task相关信息,对应的shell命令中申请的内存需要cacheline对齐
1.内核打印的地方支持异常时重定向打印信息
2.excinfo 命令中申请的内存64对齐
Close #I482S5

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I4e8a971cc5b14f62d573bb160682089d9d50e64e
2021-09-29 16:26:31 +08:00
openharmony_ci
c7da23695c !644 Open lwip netif extern callback interface
Merge pull request !644 from steve/master
2021-09-29 06:43:48 +00:00
openharmony_ci
2c33cfce86 !599 feat: L0~L1 支持Perf
Merge pull request !599 from LiteOS/perf
2021-09-29 06:15:02 +00:00
openharmony_ci
9bf580b1f6 !634 fix(mtd): 去除mtd对hisilicon驱动的依赖
Merge pull request !634 from SimonLi/master
2021-09-29 06:07:44 +00:00
fanxiaoyu
3be31d1cfb Description:open lwip netif extern callback interface
Feature or Bugfix:Feature
Binary Source: No

Signed-off-by: fanxiaoyu <fanxiaoyu3@huawei.com>
2021-09-29 04:06:44 +00:00
openharmony_ci
ee72b21aff !640 中断中调用PRINTK概率卡死,导致系统不能正常响应中断
Merge pull request !640 from zhangfanfan2/master
2021-09-29 02:48:49 +00:00
LiteOS2021
6e0a3f10bb feat: L0-L1 支持Perf
1.【需求描述】:
         L0-L1 支持Perf,提供2种模式的配置, 及3大类型的事件配置:
         2种模式:计数模式(仅统计事件发生次数)、采样模式(收集上下文如任务ID、pc、backtrace等)。
         3种事件类型:CPU硬件事件(cycle、branch、icache、dcache等)、OS软件事件(task switch、mux pend、irq等)、高精度周期事件(cpu          clock)。
    2.【方案描述】:
         L0:
         基于事件采样原理,以性能事件为基础,当事件发生时,相应的事件计数器溢出发生中断,在中断处理函数中记录事件信息,包括当前的pc、当前运         行的任务ID以及调用栈等信息。
         L1:
         新增perf字符设备,位于“dev/perf”,通过对设备节点的read\ioctl,实现用户态perf

    BREAKING CHANGE:
    1.新增一系列perf的对外API,位于los_perf.h中.
    LOS_PerfInit配置采样数据缓冲区
    LOS_PerfStart开启Perf采样
    LOS_PerfStop停止Perf采样
    LOS_PerfConfig配置Perf采样事件
    LOS_PerfDataRead读取采样数据
    LOS_PerfNotifyHookReg 注册采样数据缓冲区的钩子函数
    LOS_PerfFlushHookReg 注册缓冲区刷cache的钩子

    2. 用户态新增perf命令
  【Usage】:
./perf [start] /[start id] Start perf.
./perf [stop] Stop perf.
./perf [read nBytes] Read nBytes raw data from perf buffer and print out.
./perf [list] List events to be used in -e.
./perf [stat] or [record] <option> <command>
         -e, event selector. use './perf list' to list available events.
         -p, event period.
         -o, perf data output filename.
         -t, taskId filter(whiltelist), if not set perf will sample all tasks.
         -s, type of data to sample defined in PerfSampleType los_perf.h.
         -P, processId filter(whiltelist), if not set perf will sample all processes.
         -d, whether to prescaler (once every 64 counts), which only take effect on cpu cycle hardware event.

    Close #I47I9A

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
Change-Id: Ieb9b7483c85d1495df7c55bc0027f4309dff9814
2021-09-28 19:28:34 +08:00
openharmony_ci
e1b85a4570 !636 修正函数声明与定义不一致的问题
Merge pull request !636 from Caoruihong/fix_decl
2021-09-28 07:18:18 +00:00
zff
9726ba11a7 fix: 中断中调用PRINTK概率卡死,导致系统不能正常响应中断
当console层的打印缓冲buffer满且打印任务被饿死时,函数ConsoleOutput会出现在for循环中
不退出的情况,导致中断打印时卡死

close: #I4C9GC

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I70b9d7c848dce7d351c5679e7b08049df27a6f10
2021-09-28 15:03:43 +08:00
openharmony_ci
0fa1310a32 !584 OsLockDepCheckIn异常处理中存在g_lockdepAvailable锁嵌套调用,导致死锁异常信息不正常输出
Merge pull request !584 from zhangfanfan2/master
2021-09-28 06:14:00 +00:00
SimonLi
f7d010dfa4 fix(mtd): 去除mtd对hisilicon驱动的依赖
【背景】
1. liteos-a内核drivers/mtd/multi_partition/用到了device/hisilicon下的驱动函数实
现,这样导致三方芯片适配时,会依赖hisilicon的驱动。
2. HDF的mtd驱动提供了这几个函数的实现,但是未暴露头文件出来。

【修改方案】
1. 修改BUILD.gn去除/device/hisilicon的依赖。
2. 修改mtd_partition.c,将hisilicon的头文件改为hdf的头文件依赖。

【遗留问题】
liteos-a内核与HDF mtd驱动的分界线还不明确,导致依赖关系不清楚

close: #I49FKL

Signed-off-by: SimonLi <likailong@huawei.com>
2021-09-28 11:19:42 +08:00
zff
bf030b6bb5 fix: OsLockDepCheckIn异常处理中存在g_lockdepAvailable锁嵌套调用,
导致死锁异常信息不正常输出

close: #I457ZZ

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: Ic54ece064a4c85103b644dcbe8ed8bbdecbfc491
2021-09-27 21:56:20 +08:00
Caoruihong
63fd8bc39b fix: fix some function declarations
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I3dfcc308de6fc24035d27bc4ed4a65a2d2b6650d
2021-09-27 21:01:46 +08:00
openharmony_ci
7d7cff4c51 !633 fix: codex清理
Merge pull request !633 from Far/master
2021-09-27 08:38:37 +00:00
Far
9ab3e351d3 fix: codex 清理
Close #I4BL3S

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-09-27 14:43:28 +08:00
openharmony_ci
492264b8e6 !629 修复dispatch单词拼写错误。
Merge pull request !629 from pef/typo
2021-09-24 10:32:58 +00:00
openharmony_ci
d59aad1f3a !580 新增解析异常和backtrace信息脚本
Merge pull request !580 from zhangfanfan2/script
2021-09-24 08:29:13 +00:00
pef
9b07aece2d fix: 修复dispatch单词拼写错误。
【背景】
打印有错误单词的提示语
[ERR] Dsipatch signals failed!, ret: 22
这里单词应该是 dispatch 。
【修改方案】
1. 将Dsipatch改为Dispatch。

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

re #I4BLE8

Change-Id: I26d4336d6d7f7bfc4811819be0a1e8ba9d7d50a8
Signed-off-by: pef <cyd1997@126.com>
2021-09-24 03:45:08 +00:00
openharmony_ci
de8bd2866a !609 三方库FatFs升级至r0.14a版本
Merge pull request !609 from Far/fatfs_update
2021-09-24 00:53:43 +00:00
openharmony_ci
1150f86d46 !628 fix: 共享内存问题修复
Merge pull request !628 from Harylee/shm
2021-09-24 00:31:51 +00:00
Haryslee
9fdb80f85f fix: 共享内存问题修复
Signed-off-by: Haryslee <lihao189@huawei.com>
背景:父进程移除共享内存并标记SHM_SEG_REMOVE,当子进程资源回收时在
ShmFindSeg接口中判断该共享内存具有SHM_SEG_REMOVE时返回空,但是此时
seg->ds.shm_nattch不为0,不应返回空。
方案:ShmFindSeg接口中增加seg->ds.shm_nattch为0的判断。

close #I47X2Z

Change-Id: I8735cd11ac237b17fa745c50313da0fd0649bb9f
2021-09-23 21:04:36 +08:00
openharmony_ci
93e74c5f0b !520 修复sigwait等待到的信号值与获取的siginfo中的值不一致
Merge pull request !520 from lnlan/fixed_sigwait
2021-09-23 03:22:04 +00:00
Far
d23f2fc73f feat:适配三方库FatFs升级至r0.14a版本
适配了_mkfs和find_volume接口的修改

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-09-22 15:00:40 +08:00
openharmony_ci
c0721f4f0b !626 处理链接器失败时关闭打开的文件
Merge pull request !626 from LeonChan/codex
2021-09-18 09:41:31 +00:00
Leon Chan
a375bf5668 fix: close file when process interpretor failed
close: #I4ATQX

Signed-off-by: Leon Chan <chenwei26@huawei.com>
2021-09-18 15:02:22 +08:00
openharmony_ci
52d1d8d8d0 !623 procfs 使用统一的权限
Merge pull request !623 from LeonChan/procfs_mode
2021-09-16 11:35:42 +00:00
Leon Chan
c79bcd028e fix: same file mode for procfs files
close: #I4ACTC

Signed-off-by: Leon Chan <chenwei26@huawei.com>
2021-09-16 16:18:02 +08:00
openharmony_ci
ecd9ca7781 !534 pagecache从filep改为使用vnode
Merge pull request !534 from LeonChan/pg
2021-09-15 03:51:50 +00:00
Leon Chan
38a6b804e9 feat: page cache backed by vnode instead of filep
1, change the owner of page to vnode
2, save the file path in vnode

close: #I44TBS
Signed-off-by: Leon Chan <chenwei26@huawei.com>
2021-09-14 15:31:33 +08:00
openharmony_ci
92f33ab9c4 !620 refactor: 清理Makefile冗余项
Merge pull request !620 from Zhaotianyu/0911refactor_makefile
2021-09-13 12:33:41 +00:00
arvinzzz
b3d96d166c refactor: 清理Makefile冗余项
清理Makefile冗余项,各模块Makefile里不需要再次引用公共路径,只需引用私有头文件路径

close: #I49MOO

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I2dd7189c866498896461f78bfed5444ae1d86876
2021-09-13 18:14:15 +08:00
openharmony_ci
0326cbf12e !619 简化make脚本
Merge pull request !619 from Caoruihong/opt_make_scripts
2021-09-10 07:53:14 +00:00
lnlan
c3facd1b95 fix: 修复sigwait等待到的信号值与获取的siginfo中的值不一致
【背景】
集成测试发送两个不同的信号,sigwait第二次等到的仍是第一个信号
经定位,信号在kill时会将相关的siginfo信息拷贝到taskcb的unbinfo中,sigwait
处理时从unbinfo拷贝给用户。若此信号发送时处于屏蔽状态,再有其他信号发送会覆盖
掉unbinfo,此时sigwait等待这个信号获取到的info已经被覆盖
【修改方案】
1. 每个任务添加一个siginfo缓存链表,在处理信号前夕从缓存链表取出info到unbinfo中

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

re #I3M12H

Signed-off-by: lanleinan <lanleinan@163.com>

Change-Id: If4b064c18773f8eca7419c665977260167b09810
2021-09-10 03:21:58 +00:00
openharmony_ci
8713997548 !617 syscall review bugfix
Merge pull request !617 from 野生毛霉君/master
2021-09-09 14:53:55 +00:00
Caoruihong
a627cdba0c chore(make): simplify build scripts
remove redundant script codes

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I67695a69cccefc220ede55add9372bce0c59d7f5
2021-09-09 18:56:47 +08:00
mucor
214f44e935 fix: syscall review bugfix
close: #149BPF
Signed-off-by: mucor <mucorwang@gmail.com>
2021-09-09 15:19:03 +08:00
openharmony_ci
ba977dd5ab !605 refactor: 内核目录结构整理
Merge pull request !605 from Zhaotianyu/0902dir_refactor
2021-09-09 01:23:33 +00:00
openharmony_ci
1ecacc15b1 !593 feat: add sync() to vfs
Merge pull request !593 from MGY917/sync
2021-09-08 08:56:12 +00:00
arvinzzz
33d0c1bd0b refactor: 内核目录结构整理
1. 原kernel/common目录下属于内核拓展组件,统一移入kernel/extend管理
2. Kconfig分层,各模块自己的配置放到自己目录下管理
3. 原platform下不属于平台的公共代码抽到kernel/common下,只留板级链接脚本和一些编译脚本指向device目录下触发平台相关的编译
4. 对外公共头文件统一抽到对外include路径
5. 废弃宏,头文件清理

close: #I48KI4

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I0cf5ea81c92a8fa7b113da9cbdc8b7bc935f5aae
2021-09-08 16:36:28 +08:00
openharmony_ci
e095e87682 !574 fix: solve SIGCHLD ignored in sigsuspend()
Merge pull request !574 from MGY917/sigsuspend
2021-09-08 08:27:12 +00:00
openharmony_ci
597ced7948 !595 fix: dyload open close failed
Merge pull request !595 from MGY917/dyload_fd
2021-09-08 08:26:55 +00:00
Guangyao Ma
f67c4dae51 feat: add sync() to vfs
新增sync方法,该方法每次调用,会遍历系统内所有的mount点,调用各个文件系统注册
的sync方法,完成对所有已挂载文件系统的sync操作。

close #I480HV

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: I57ced9c3f7685a448defd17ae56c842796b5668f
2021-09-08 15:41:52 +08:00
Guangyao Ma
5e87d8c183 fix: dyload open close failed
本次提交修复内核加载器,异常情况分支的一个bug:mksh通过exec命令(mksh内置命令
,正常情况下,该命令成功执行会复用mksh进程空间,拉起新的指定进程)。但是如果
进程没有成功加载的情况下,内核加载器的异常分支会错误释放mksh的fd句柄。最终导致
下次拉起其他进程时(fork + exec方式),新的进程会继承fd,映射了早就释放的sysfd
,此时的sysfd可能已经被复用,issue场景下这个sysfd被加载过程中打开的libc.so占用
,exec时会释放procfd->sysfd(错误的映射关系),最终新进程libc.so被关闭。
导致内核崩溃。

close #I452Z7

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: Ifca809f88b5ffcfb879dc5520d1f6adf5cf92bcd
2021-09-07 16:28:37 +08:00
openharmony_ci
de8257bc82 !551 TODOList通过issue跟踪,不在代码仓中添加
Merge pull request !551 from Denny/remove_todolist
2021-09-03 01:01:06 +00:00
openharmony_ci
19b39b1bff !600 参数化liteos_config_file配置项
Merge pull request !600 from Caoruihong/opt_20210902
2021-09-02 10:54:09 +00:00
openharmony_ci
5e07663374 !598 优化trace device初始化,不在system_init.c中调用,改为LOS_MODULE_INIT
Merge pull request !598 from LiteOS/master
2021-09-02 04:06:41 +00:00
Caoruihong
f9a907772f feat(build): make liteos_config_file available as gn argument
You can specify another config file in hb build like this:
  hb build --gn-args liteos_config_file=myconfig.config
file specified in liteos_config_file argument is relative
to "$product_path/kernel_configs" directory, or is an
absolute file path, for example:
  hb build --gn-args liteos_config_file=//path/to/myconfig.config
or
  hb build --gn-args liteos_config_file=/another/path/to/myconfig.config

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I7e98604006feff9c2487e06a8f3f2a11e5de746b
2021-09-02 10:54:15 +08:00
openharmony_ci
007f385396 !596 优化编译脚本,DEVICE_PATH下的drivers/Kconfig由可选改为必选
Merge pull request !596 from Caoruihong/opt_20210901
2021-09-01 11:07:20 +00:00
Caoruihong
463bc0546f chore(build): optimize build scripts, make Kconfig in DEVICE_PATH mandatory
$(DEVICE_PATH)/drivers/Kconfig is mandatory now.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ie9484229e2dc6e6babe0cf2daf8e4f6693163052
2021-09-01 18:45:44 +08:00
openharmony_ci
0c93a9b4f8 !597 删除tools/build/config下的配置文件,更新编译脚本
Merge pull request !597 from Caoruihong/opt_kconfig
2021-09-01 08:45:23 +00:00
LiteOS2021
d30a009ba5 move trace device init from system_init.c to drivers/char/trace.c
Signed-off-by: LiteOS2021 <dinglu@huawei.com>
Change-Id: Ie4555c57f56c82f74b5e29f0e58aec97dc6cc32d
2021-09-01 12:49:37 +08:00
Caoruihong
4bee53a610 chore(build): optimize build scripts, remove unused config files
config files under tools/build/config directory are no maintained any more,
so we delete all of them.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Idf51d55caa3c820617b7c90affda0186718632e5
2021-09-01 12:39:55 +08:00
openharmony_ci
81b474813b !565 feat: L0~L1 支持Trace
Merge pull request !565 from LiteOS/master
2021-08-31 13:32:20 +00:00
LiteOS2021
dc9ec6856f feat: L0-L1 支持Trace
1.【需求描述】
            L0~L1 支持Trace,提供两种工作模式:在线模式、离线缓存模式, 用于按时间线追踪系统事件,如任务切换、中断、ipc等。
        2.【方案描述】
            L0:
            (1).在内核模块预置静态代码桩
            (2).触发桩后,收集系统上下文信息
            (3).离线模式则写入内存,用户可通过dump导出;
            (4).在线模式通过pipeline对接IDE进行可视化解析和展示;
            L1:
            新增trace字符设备,位于"/dev/trace",通过对设备节点的read\write\ioctl,实现用户态trace;

        BREAKING CHANGE:
        1.新增一系列trace的对外API,位于los_trace.h中.
        LOS_TRACE_EASY简易插桩
        LOS_TRACE标准插桩
        LOS_TraceInit配置Trace缓冲区的地址和大小
        LOS_TraceStart开启事件记录
        LOS_TraceStop停止事件记录
        LOS_TraceRecordDump输出Trace缓冲区数据
        LOS_TraceRecordGet获取Trace缓冲区的首地址
        LOS_TraceReset清除Trace缓冲区中的事件
        LOS_TraceEventMaskSet设置事件掩码,仅记录某些模块的事件
        LOS_TraceHwiFilterHookReg注册过滤特定中断号事件的钩子函数

        Close #I46WA0

    Signed-off-by: LiteOS2021 <dinglu@huawei.com>

Change-Id: I6a8e64794c4852f2c2980993a06180e09ec6ee0d
2021-08-31 20:29:45 +08:00
openharmony_ci
658fafe83b !586 liteos补丁能力支持
Merge pull request !586 from jason_gitee/master
2021-08-31 08:16:31 +00:00
openharmony_ci
f3562e490c !588 删除zpfs冗余代码
Merge pull request !588 from 马帅/master
2021-08-31 07:40:38 +00:00
openharmony_ci
9888185fcb !590 优化编译脚本,将LTO选项做成可配置
Merge pull request !590 from Caoruihong/lto
2021-08-31 07:11:37 +00:00
Caoruihong
055295b6d1 chore: optimize build scripts and add lto config entry
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ibf8df58696b7f1ccb3b5b21154c3b94dda1e8ad2
2021-08-31 12:04:34 +08:00
openharmony_ci
c26ca519f7 !579 优化构建脚本
Merge pull request !579 from Caoruihong/optimize_build_scripts
2021-08-30 11:06:25 +00:00
Caoruihong
df35eb513d chore(make): optimize build scripts
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ibb4223ef2d032a03950263b766414ca1c021e69a
2021-08-30 17:18:21 +08:00
openharmony_ci
7cb2ad67bf !570 fix ppoll & add 2 testcases
Merge pull request !570 from guweijie/gwj-kernel-ppoll-20210825
2021-08-30 02:06:24 +00:00
jason_gitee
98ca8441fe feat: add liteos patch ability
Signed-off-by: jason_gitee <yangjie140@huawei.com>
2021-08-28 08:02:50 +00:00
maltose214
3393479c52 feat: 删除zpfs冗余代码
Signed-off-by: maltose214 <mashuai3@huawei.com>
2021-08-28 15:17:40 +08:00
openharmony_ci
aa5b2c7641 !573 适配升级optimized-routines到v21.02
Merge pull request !573 from Caoruihong/v21.02
2021-08-28 01:06:09 +00:00
openharmony_ci
7661aedcc9 !571 支持sys模块api接口:ftok、nice、getlogin、getgrgid、getgrnam等
Merge pull request !571 from wangjianjun/sys
2021-08-27 07:51:08 +00:00
openharmony_ci
c97178f2f6 !561 fix SYSCALL faccessat,fstatfs,fstatat & add 6 testcases
Merge pull request !561 from guweijie/gwj-kernel-20210819
2021-08-27 07:49:20 +00:00
openharmony_ci
8839fdd399 !544 fix killpg and waitid
Merge pull request !544 from wangjianjun/waitid
2021-08-27 07:48:25 +00:00
openharmony_ci
a3b480b18e !543 fix:fchdir
Merge pull request !543 from wcc/fs
2021-08-27 07:47:34 +00:00
teamol
defedb6fdf fix: add syscall for ppoll & add 2 testcases
1.modifications:
modified:   syscall/los_syscall.h
modified:   syscall/misc_syscall.c
modified:   syscall/syscall_lookup.h
2.add 3 testcases:
testsuites/unittest/IO/full/IO_test_ppoll_001.cpp
testsuites/unittest/IO/full/IO_test_ppoll_002.cpp
3.influence:
none

Signed-off-by: teamol <28105285@qq.com>
2021-08-27 15:37:42 +08:00
YOUR_NAME
7019fdfcbb feat: 新增解析异常和backtrace信息脚本
close: #I47EVQ

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: Id9c373bf6b36cda024317f927974b08ca61fd9ec
2021-08-27 15:09:50 +08:00
Guangyao Ma
5a80d4e1a3 fix: solve SIGCHLD ignored in sigsuspend()
在如下场景signal可能得不到及时处理:
1、进程A设置信号a阻塞
2、进程A收到信号a
3、进程A调用sigsuspend结束阻塞
原则上,步骤三应该立刻处理之前被阻塞的信号a,调用信号处理函数,并且sigsuspend
返回。现在的问题是,信号a没有得到及时处理,并且进程A阻塞在sigsuspend()调用流程
。
本次修改,在1、2、3场景下,sigsuspend()处理过程中,如果发现已经收到信号,待处理
时,会立刻进行调度切换,再次调度回来时,在调度模块中,会先主动处理已经收到的信
号,最后sigsuspend返回用户态。

close #I47CKK

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: I1b30a938a2d18c3f58989d40eee0503ceffb27b5
2021-08-26 15:36:13 +08:00
Caoruihong
1ec8d5a454 feat(libc): upgrade optimized-routines to v21.02
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I5cdca0ee82d3e8a164120fe3ecb6e94f2f89d600
2021-08-26 12:42:47 +08:00
wjj
7c577d8963 test: 添加sys模块接口的测试用例
把测试用例放在full中,需要依赖文件group和passwd,放在/etc下

Change-Id: Ie038b64db96180b52ee10d70d494da42207d3b92
Signed-off-by: wjj <502004968@qq.com>
2021-08-25 15:48:54 +08:00
openharmony_ci
6e2a4be155 !569 启用mksh和toybox的make编译
Merge pull request !569 from Caoruihong/mksh_toybox
2021-08-25 01:07:30 +00:00
Caoruihong
682ae82158 chore: enable make of mksh and toybox
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ie152b0ad21af5dc8e8c31c71f236500e5726e1c4
2021-08-25 01:46:41 +08:00
wcc0
e828cbdeac fix: add fchdir api
add fchdir and testcases

Change-Id: Iad724944e727c4a08b8801f109acbbe48f55c283
Signed-off-by: wcc0 <917033401@qq.com>
2021-08-24 17:02:40 +08:00
openharmony_ci
45a128a4f0 !504 clock模块内核unittest用例调整
Merge pull request !504 from phchang/updateclock
2021-08-24 02:33:32 +00:00
openharmony_ci
83bff88f7f !567 优化编译脚本删除冗余选项
Merge pull request !567 from Caoruihong/opt_make
2021-08-24 01:31:19 +00:00
Caoruihong
181322a3c1 chore(make): fix and optimize some build scripts
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I2e61b7ea231be78423dc10412e0ab9a710cad8ef
2021-08-23 20:47:18 +08:00
openharmony_ci
5369b6aa23 !564 优化make编译脚本
Merge pull request !564 from Caoruihong/update_makefile
2021-08-23 05:55:39 +00:00
Caoruihong
0e260949c9 feat(make): optimize makefiles and remove some unused files
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ie2dfa7334417ccd55bd56a19a7882a982ce49cab
2021-08-22 04:23:40 +08:00
openharmony_ci
8b267dc690 !563 A核 告警清零
Merge pull request !563 from wangchen/a_codex
2021-08-21 09:31:56 +00:00
wangchen
d16bfd005a fix: A核告警消除
【背景】定期A核代码消除。

【修改方案】
1,根据工具扫描结果,对代码告警进行更改

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

re #I46KF6
Signed-off-by: wangchen <253227059@qq.com>
2021-08-20 18:09:04 +08:00
openharmony_ci
40297a6dbc !487 多核启动及内存映射解耦
Merge pull request !487 from JerryH/smp-xxx
2021-08-20 03:54:23 +00:00
openharmony_ci
752aa49018 !558 减少对musl代码的侵入式修改
Merge pull request !558 from Caoruihong/update_musl
2021-08-19 11:47:37 +00:00
openharmony_ci
5569b1d1ec !558 减少对musl代码的侵入式修改
Merge pull request !558 from Caoruihong/update_musl
2021-08-19 11:47:37 +00:00
Caoruihong
9549f5ebd0 chore(musl): reduce the modifications of musl
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I32b820bc0eb7465bf54d506e7f5e759ef64101e2
2021-08-19 16:07:12 +08:00
teamol
aa1cd245a5 fix: fix syscall faccessat,fstatfs,fstatat & add 6 testcases
1.modifications:
modified:   testsuites/unittest/fs/BUILD.gn
modified:   testsuites/unittest/fs/jffs/It_vfs_jffs.h
renamed:    testsuites/unittest/fs/jffs/smoke/It_test_faccessat_001.cpp -> testsuites/unittest/fs/jffs/full/It_test_faccessat_001.cpp
renamed:    testsuites/unittest/fs/jffs/smoke/It_test_faccessat_002.cpp -> testsuites/unittest/fs/jffs/full/It_test_faccessat_002.cpp
renamed:    testsuites/unittest/fs/jffs/smoke/It_test_fstatat_001.cpp -> testsuites/unittest/fs/jffs/full/It_test_fstatat_001.cpp
renamed:    testsuites/unittest/fs/jffs/smoke/It_test_fstatat_002.cpp -> testsuites/unittest/fs/jffs/full/It_test_fstatat_002.cpp
renamed:    testsuites/unittest/fs/jffs/smoke/It_test_fstatfs_001.cpp -> testsuites/unittest/fs/jffs/full/It_test_fstatfs_001.cpp
renamed:    testsuites/unittest/fs/jffs/smoke/It_test_fstatfs_002.cpp -> testsuites/unittest/fs/jffs/full/It_test_fstatfs_002.cpp
modified:   testsuites/unittest/fs/jffs/vfs_jffs_test.cpp
2.add 6 testcases:
It_test_faccessat_001.cpp
It_test_faccessat_002.cpp
It_test_fstatat_001.cpp
It_test_fstatat_002.cpp
It_test_fstatfs_001.cpp
It_test_fstatfs_002.cpp
3.influence:
none

Signed-off-by: teamol <28105285@qq.com>
2021-08-19 15:46:04 +08:00
openharmony_ci
36cfc68a54 !538 文件系统支持sd卡热插拔
Merge pull request !538 from 野生毛霉君/master
2021-08-18 00:57:35 +00:00
openharmony_ci
4dc059f207 !557 open platform I2S
Merge pull request !557 from susha/master
2021-08-17 14:23:27 +00:00
openharmony_ci
f4409babd4 !556 更新Makefile删除一些历史遗留无用代码并优化部分逻辑
Merge pull request !556 from Caoruihong/update_makefile
2021-08-17 14:21:18 +00:00
Caoruihong
e1b9a6b185 chore(make): update Makefile
remove some unused Makefile code and optimize some code

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I1c31d07481bb6aee47b0c51d63d6b68316c38c88
2021-08-17 21:34:01 +08:00
susha
b5528e1d17 open i2s
Signed-off-by: susha <susha@huawei.com>
2021-08-17 20:12:45 +08:00
mucor
2db80ecb38 feat: vfs support sdcard hotplug
close: #I44WH1
Signed-off-by: mucor <mucorwang@gmail.com>
2021-08-17 14:56:41 +08:00
denny
ec366df863 chore: TODOList通过issue跟踪,不在代码仓中添加
Signed-off-by: denny <denny.shenwei@huawei.com>
2021-08-16 20:42:12 +08:00
openharmony_ci
e1472b494f !548 fix: 以g_sysSchedStartTime是否为0判断时间轴是否生效存在极限场景导致调度时间不生效
Merge pull request !548 from zhushengle/sched_time
2021-08-14 06:23:33 +00:00
zhushengle
67ac8c4c58 fix: 以g_sysSchedStartTime是否为0判断时间轴是否生效存在极限场景导致调度时间不生效
初始化调度时间不以g_sysSchedStartTime是否为0为界限,而以g_sysSchedStartTime是否为64位最大值
为界限,避免特殊以下场景:调度开启时系统时间为0,导致初始化的g_sysSchedStartTime还是0,导致
调度启动后获取的调度时间轴始终为0.
Close  #I45HP5

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I5272c79f06b53361ee7b931081d3a3276db59073
2021-08-14 13:04:08 +08:00
vcbchang
555e0681be test: clock用例结构调整
【背景】当前kernel的unittest下的用例全量与门禁用例结构不合理,当前上传clock修改后版本

【修改方案】
1 原来没有测试clock模块的基本场景,这里补上基本场景作为smoke用例,并命名为clock_test_smoke.cpp
2 将原来smoke用例移到full中
3 删除与xts测试重复的用例和标记宏TEST_ON_LINUX的用例(即原来版本的clock_test_002,003,004用例)
4 原来clock_test_012用例用于测试进程的运行时间,里面存在正常场景和异常场景,现在将其分成两个用例
5 对所有用例重新排序,使得结构完整

re #I44170

Signed-off-by: vcbchang <vcbchang@qq.com>

Change-Id: I30852a5f9c414668c00eddbcc9631d70818514a1
2021-08-13 16:29:38 +08:00
openharmony_ci
fb5df47b6c !541 feat: 自研shell命令回补
Merge pull request !541 from Kiita/shell_cmd_0812
2021-08-13 07:44:49 +00:00
openharmony_ci
339e937a6a !495 修复mqueue问题
Merge pull request !495 from lnlan/fix_mqueue_0803
2021-08-13 07:40:11 +00:00
openharmony_ci
5910c9ab8d !521 修复: 限制调用sync函数打印unsupport sync
Merge pull request !521 from phchang/fixsync_8
2021-08-13 02:04:31 +00:00
openharmony_ci
9fa8d27c6c !521 修复: 限制调用sync函数打印unsupport sync
Merge pull request !521 from phchang/fixsync_8
2021-08-13 02:04:30 +00:00
Kiita
7bc68f454f feat: 自研shell命令回补
【背景】liteos_a需要支持toybox缺失的自研shell命令

【修改方案】
新增自研shell命令的入口判断场景,使得mksh可以执行自研shell的命令

re #I44U0H

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: Idf08cb6df456bd6c89fe8fe505317f1c0ca61eda
2021-08-12 21:34:50 +08:00
wjj
dc3cc094a7 feat: 支持killpg和waitid
killpg:给进程组发信号
waitid:等待进程结束
修改测试用例到full里面

Change-Id: Ice058ab4a6eede8ecbaacea0894c2161e3b9dce2
Signed-off-by: wjj <502004968@qq.com>
2021-08-12 18:06:55 +08:00
openharmony_ci
1aa9f98858 !542 fix: 修复文档链接失效问题
Merge pull request !542 from Harylee/qemu
2021-08-12 07:51:41 +00:00
Haryslee
42a3a6c51b fix: 修复文档链接失效问题
close #I45297

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: Ide31fc41af0ecc72c2b7fbaed85efe9b6530467b
2021-08-12 14:21:35 +08:00
openharmony_ci
bbdb977b5e !539 fix fchmod
Merge pull request !539 from wcc/fchmod0
2021-08-12 02:29:13 +00:00
openharmony_ci
87c2d4f7e4 !287 feat(vfs): vfs支持FD_CLOEXEC标记
Merge pull request !287 from MGY917/master
2021-08-12 00:36:19 +00:00
openharmony_ci
0f4d5a4b0c !287 feat(vfs): vfs支持FD_CLOEXEC标记
Merge pull request !287 from MGY917/master
2021-08-12 00:36:19 +00:00
openharmony_ci
dd91c5c772 !536 修复最小化liteos_a编译问题
Merge pull request !536 from Caoruihong/liteos_a_mini
2021-08-11 09:34:05 +00:00
openharmony_ci
da43449939 !536 修复最小化liteos_a编译问题
Merge pull request !536 from Caoruihong/liteos_a_mini
2021-08-11 09:34:04 +00:00
openharmony_ci
d6e0d3ee7d !527 fix:合并进程栈两个地址连续的region
Merge pull request !527 from Harylee/dyn
2021-08-11 09:28:39 +00:00
Guangyao Ma
27dca4d857 feat(vfs): vfs支持FD_CLOEXEC标记
首先,POSIX规范规定文件描述符需要支持close-on-exec属性,修改前的vfs不支持close-on-exec,当exec系列函数执行时,进程所有的文件将会被关闭(0,1,2也重新被打开)。但是,系统有些时候是不能在exec时关闭全部文件的,例如在执行exec之前,就需要重定向进程的某些文件描述符时(使用dup2),就希望该文件不被关闭,继续保持重定向属性,shell执行进程并重定向其标准输出到文件,这是我们经常做的事情。

BREAKING CHANGE:
执行exec类函数后,进程拥有的文件描述符情况发生变化:修改前,默认关闭所有的进程文件描述符,0,1,2重新打开;修改后,除非文件描述符拥有FD_CLOEXEC标记,否则该描述符不会被关闭。

re #I3U81W

Change-Id: I54e841ac88e9835ec23e97de0cbc906c4e11f5a4
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-08-11 15:35:46 +08:00
openharmony_ci
70a8901c72 !502 feat:C库典型高频函数优化
Merge pull request !502 from Zhaotianyu/0731libc_opt
2021-08-11 07:08:49 +00:00
wcc0
2f214bf4de fix: add fchmod api
add fchmod api and testcases

Change-Id: I310e9e9d79bbe3fa8dbab6080bbfce8a77b79bb3
Signed-off-by: wcc0 <917033401@qq.com>
2021-08-11 14:12:37 +08:00
openharmony_ci
76507c05a8 !477 fix fstatfs api
Merge pull request !477 from wcc/fstatfs
2021-08-11 03:34:39 +00:00
openharmony_ci
9b24cc4915 !388 fix mutex&pthread mould musl api:pthread_mutexattr_getrobust/pthread_mutexattr_setrobust/pthread_mutex_consistent/pthread_getconcurrency/pthread_setconcurrency
Merge pull request !388 from 王建军/mutex
2021-08-11 03:33:17 +00:00
openharmony_ci
e64ee0f4e6 !518 fix: tick 动态化计算优化,消除中断执行时间对系统总体时间的影响,保证软件定时器的响应精度。
Merge pull request !518 from zhushengle/sched_tick
2021-08-11 03:19:48 +00:00
Caoruihong
e13cb3bcc4 fix(mini): fix compile error in mini liteos_a
Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I9ab63796e5d47ac44d24807f1ebd0bbfe46681bf
2021-08-10 23:59:34 +08:00
openharmony_ci
51da89a3fb !532 fix: 修改DoNanoSleep 以纳秒为单位
Merge pull request !532 from zhushengle/sleep
2021-08-10 11:37:44 +00:00
Haryslee
42f374dd7a fix: 合并进程栈两个地址连续的region
背景:进程加载的时候,先预申请一个页用作参数拷贝,另外通过mmap方式申请
额外的虚拟栈空间,此时便有两个地址连续的区间。
方案:新增内部接口OsStackAlloc,用于申请一个连续的虚拟地址区间,并对其
中指定区间做物理内存的映射。

close #I43QYJ

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I224cca3671c42a94c2f74b2da5a11403849e33d3
2021-08-10 17:20:17 +08:00
arvinzzz
689c2e90cf feat:C库典型高频函数优化
针对字符串类高频函数:
1. 采用单次多字节操作提升字符串类高频函数的执行效率
2. 针对armv7-a,采用neon指令进行优化

close: #I42DAK

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ic90d92f778e0006881f793585264ad7e5f644104
2021-08-10 16:30:14 +08:00
openharmony_ci
cdf96fef0c !511 make编译时不要覆盖out下已有的lib库
Merge pull request !511 from Caoruihong/preserve_libs
2021-08-10 07:57:59 +00:00
lnlan
26ee8b836e fix: 修复mqueue问题
【背景】
1.mqueue用例关于NFILE错误码压力测试中,不符合预期结果
2.mq_unlink对于fork出的mqueue不起效
3.已打开的mqueue,在fork后两进程共用一份mqpersonal不合理
【修改方案】
1. 确认是内核关于mqueue的fd_set定义位置不合理导致的,
将fd_set定义位置由mqarray结构体调未全局变量后,问题解决
2.不合理的unlink_ref++导致的,去除相关操作,使用mq_personal
链表判断何时需要删除
3.fork时内核复制一份mqpersonal
【影响】
对现有的产品编译不会有影响。

re #I43P4T

Signed-off-by: lanleinan <lanleinan@163.com>
Change-Id: I09f183cc3a88e5a65201dbc1fc4f4806f78971be
2021-08-10 07:55:13 +00:00
zhushengle
6917e08431 fix: 修改DoNanoSleep 以纳秒为单位
DoNanoSleep 接口以微秒为单位,纳秒级别的在转换成微秒时被整除为0,
导致转换成tick时为0,导致延时时触发yield,导致延时时间超大
Close #I3Z9DP

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ib662fdc80707be6040b2bb06a1b457344bd48b30
2021-08-10 11:25:49 +08:00
wcc0
4c57aa26ad fix: add fststfs api and unitest
add fststfs api and unitest

Change-Id: I5e9fedd1bc26b77f080faf2fd3f5bf2f4a1dd9f7
Signed-off-by: wcc0 <917033401@qq.com>
2021-08-10 09:35:33 +08:00
openharmony_ci
007c75eb18 !496 修复mprotect修改地址区间的权限后,相应的区间名丢失问题
Merge pull request !496 from Harylee/mem
2021-08-10 00:05:02 +00:00
Caoruihong
8118408123 fix: do not override existing libs
preserve existing newer libs under lib and libs dir

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I5f91554890186f7760a73accb246240683b0558b
2021-08-09 23:14:07 +08:00
zhushengle
8df3e8c965 fix: tick 动态化计算优化,消除中断执行时间对系统总体时间的影响,保证软件定时器的响应精度。
方案描述:
    1.周期软件定时器超时添加一个startTime字段,用于记录当前软件定时器的开始计时的时间,
    在定时器响应时,开始时间修改为上一次响应的结束时间(消除了中断执行时间对软件定时器
    的影响)。
    2.在执行tick中断的过程当中,持有tick动态计算锁,保证在该过程中不会触发tick周期
    的计算,在tick中断结束时统一计算设置。 --- 提升tick中断的执行效率
    3.在设置tick周期时,减掉tick中断执行的时间,减小周期动态化带来的时间误差
    4.新增LOSCFG_BASE_CORE_TICK_PER_SECOND_MINI配置宏,用于配置tick中断的最小响应精度
Close #I43UQJ

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Icd1159a1890046b13602b7a18dcd6234d5c61a89
2021-08-09 21:18:03 +08:00
openharmony_ci
5edd78e756 !513 fix: clang相关编译选项隔离
Merge pull request !513 from MGY917/clang_isolation
2021-08-09 07:51:53 +00:00
openharmony_ci
ba16cd34d4 !517 为内核模块的BUILD.gn自动添加默认的group
Merge pull request !517 from Caoruihong/hdf_config
2021-08-09 02:50:54 +00:00
Guangyao Ma
77dcef4bc0 fix: clang相关编译选项隔离
liteos_a在apps/mksh和apps/toybox编译中,clang相关编译选项未进行隔离。之后支持
其他类似gcc编译时,可能存在编译问题。
其中 --target=$(LLVM_TARGET) $(LLVM_SYSROOT) 是clang编译特有的编译选项,需要被
隔离。

close #I444AV

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: Ib11453aa0b3ee6bcdf3104d13d166c65f2202527
2021-08-09 10:32:14 +08:00
openharmony_ci
024a8f2771 !484 修复由clockid计算pid和tid时原来的移位操作由于有符号数与无符号数运行结果不一致的问题
Merge pull request !484 from phchang/fixclockid
2021-08-09 01:34:55 +00:00
vcbchang
3bfa995a9d fix:调用sync函数会打印出unsupport sync,但现在在fat文件系统下可以sync,这里做出修复
【背景】 当前调用sync函数会打印出unsupport sync,但实际上在fat文件系统下可以正常调用sync,而在其他文件系统下不可以,因此这里的实现不正确,故修改限制sync的打印
【修改方案】
删除musl/porting下的sync,使用原生musl下的函数,并把不支持的打印放到内核系统调用中

re #I446P5

Signed-off-by: vcbchang <vcbchang@qq.com>
Change-Id: Ideec24fb8d29263fd011af9428801d08000e17e5
2021-08-06 16:48:46 +08:00
Caoruihong
6549fd8be6 chore: add default group automatly if needed
the name of the default group is the same with
the directory name.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I3d889a361534adc44e3b1bedfec13efe8e1babf2
2021-08-06 12:05:56 +08:00
openharmony_ci
9ec208a273 !516 fix: OsGerCurrSchedTimeCycle 函数存在拼写错误
Merge pull request !516 from zhushengle/spell
2021-08-06 03:55:41 +00:00
zhushengle
53ced1a85e fix: OsGerCurrSchedTimeCycle 函数存在拼写错误
Close #I446CX
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I49e80ffe1a7b579b82aaf45f599623b287eb8e98
2021-08-06 11:25:21 +08:00
openharmony_ci
2b9c55fd90 !515 删除二进制文件,并且新增oat屏蔽
Merge pull request !515 from SimonLi/master
2021-08-05 18:06:25 +00:00
SimonLi
7a98cad11a chore(oat): 删除二进制文件,并且新增oat屏蔽
Signed-off-by: SimonLi <likailong@huawei.com>
2021-08-06 01:41:09 +08:00
openharmony_ci
827e060606 !514 修复license
Merge pull request !514 from lnlan/fix_stl
2021-08-05 15:16:54 +00:00
openharmony_ci
78e8d86611 !512 style:修改 liteos_a unittest 测试文件的 licence 注释
Merge pull request !512 from phchang/fixlience
2021-08-05 15:16:51 +00:00
openharmony_ci
30b7d34eb4 !510 style:格式化修改liteos_a unittest 测试文件头的许可注释
Merge pull request !510 from Kiita/liteos_a_unittest
2021-08-05 15:16:48 +00:00
lnlan
a23b491f8c style:修改 liteos_a unittest 测试文件的 licence 注释
【背景】解除告警
【修改方案】
 格式化修改告警文件的文件头注释格式

re #I44497

Signed-off-by: lanleinan <lanleinan@163.com>

Change-Id: If9fa5de0f896ddf8c3fc88408c8f88f633fdb3e7
2021-08-05 14:57:02 +00:00
openharmony_ci
72734a335c !509 liteos_a下nuttx文件放回原处
Merge pull request !509 from 野生毛霉君/master
2021-08-05 14:16:57 +00:00
Kiita
626b6600c0 style: 格式化修改liteos_a unittest 测试文件头的许可注释
【背景】解除告警
【修改方案】
 格式化修改告警文件的文件头注释格式

re #I44497

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: I88c7ade73b086fd0ee13574229d2a4b9795580ec
2021-08-05 22:11:59 +08:00
vcbchang
e8037dc56a style:修改 liteos_a unittest 测试文件的 licence 注释
【背景】解除告警
【修改方案】
 格式化修改告警文件的文件头注释格式

re #I44497

Signed-off-by: vcbchang <vcbchang@qq.com>
Change-Id: I7a0d31e11603f591a5370e64505879e1a324d72d
2021-08-05 21:51:30 +08:00
mucor
4c8a86ece7 fix: move nuttx head file back
close: #I4443Q
Signed-off-by: mucor <mucorwang@gmail.com>
2021-08-05 20:51:28 +08:00
openharmony_ci
3cc09763f2 !500 liteos_a toybox 命令已知问题修复
Merge pull request !500 from Kiita/toybox_update_0802
2021-08-05 11:50:28 +00:00
JerryH
3bb3173604 fix: smp启动代码解耦及内存映射关系解耦
close #I41P8Y

Signed-off-by: JerryH <huangjieliang@huawei.com>
Change-Id: I01833cf617bbc695543a865dbb994c6c22d4a0a8
2021-08-05 16:03:43 +08:00
openharmony_ci
d2fe0e788b !498 LiteOS_A BBOX Codex整改
Merge pull request !498 from pcwlno1/bbox_codex
2021-08-04 06:53:18 +00:00
pcwlno1
6a5a0326d2 fix: LiteOS_A BBOX Codex整改
1、判断安全函数的返回值。

Close #I43RQU

Signed-off-by: pcwlno1 <qidechun@huawei.com>
2021-08-04 08:32:10 +08:00
Kiita
c3245b3ce3 fix: toybox update
【背景】liteos_a toybox 命令已知问题修复

【修改方案】
1、修复ls 统计文件大小问题。

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: I64c41d3970650a434409f332b2659e31bb9223ab
2021-08-03 21:16:42 +08:00
Haryslee
e425187d17 fix: 修复mprotect修改地址区间的权限后,相应的区间名丢失问题
背景:对于mmap映射的区间,修改权限后对应的区间名丢失
方案:mprotect修改权限后,对应区间名继承原区间名

close #I43R40

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I969c93528cbecc2ded4e437e5aac8f82b8baa609
2021-08-03 20:40:41 +08:00
vcbchang
a6c02e29c1 fix:修复在使用GetCputime时由clockid计算pid或tid时出现的错误
【背景】原来代码在计算由clockid计算pid或tid时用的是移位的方式,由于对于有符号和无符号数结果可能不一致,故这里对计算方法做了修改,修改为计算clockid的逆运算。

【修改方案】
计算pid或tid为计算clockid的逆运算

re #I4249G
Signed-off-by: vcbchang <vcbchang@qq.com>
Change-Id: I2952232ec7d8fc2d0c47163b00d0c772648a2bf8
2021-08-03 20:16:29 +08:00
openharmony_ci
d169cad6b4 !490 内核的配置文件改为放到kernel_configs目录下
Merge pull request !490 from Caoruihong/kernel_configs
2021-08-03 07:09:52 +00:00
Caoruihong
4875707b37 chore: puts kernel Kconfig configs in kernel_configs dir
for historical reason, the old config dir is used only for hcs_config

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I26f25d5ec81b4b4a0e96c30c3acb3f075107e19e
2021-08-03 11:19:22 +08:00
openharmony_ci
9b4fd13c3c !485 调整IPC_MSG_DATA_SZ_MAX保持与用户态的IPC_IO_DATA_MAX约束一致
Merge pull request !485 from Caoruihong/liteipc_datasize
2021-08-03 03:08:49 +00:00
openharmony_ci
343b92661d !488 保留未strip的mksh和toybox用于调试
Merge pull request !488 from Caoruihong/unstripped_mksh_toybox
2021-08-03 03:07:32 +00:00
openharmony_ci
79982895ec !479 fix: 去掉冗余的strip操作
Merge pull request !479 from MGY917/toybox_strip_twice
2021-08-03 03:01:04 +00:00
openharmony_ci
7f7eb8374f !473 Revert "fix: 修改默认窗口宽度到400"
Merge pull request !473 from MGY917/revert_wz
2021-08-03 02:58:47 +00:00
openharmony_ci
1c8f3b98c9 !473 Revert "fix: 修改默认窗口宽度到400"
Merge pull request !473 from MGY917/revert_wz
2021-08-03 02:58:47 +00:00
Caoruihong
8de96bba65 chore: also copy unstripped version of mksh and toybox
stripped version used to pack rootfs image, unstripped
used for debug.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I07673238772d6995426ec8b1cff43f1abfea7049
2021-08-03 00:10:37 +08:00
openharmony_ci
c66681a1f9 !486 lwip_enhanced更改gn编译
Merge pull request !486 from 刘建东/master
2021-08-02 11:15:47 +00:00
YOUR_NAME
8696e1c6cb chore: enable gn build for lwip_enhanced
enable gn build for lwip_enhanced

close: #I43GEW

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-08-02 14:18:56 +08:00
Caoruihong
4dc421e3de fix: liteipc max data size too small
use IPC_IO_DATA_MAX from liteipc_adapter.h

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I94f2dd2ff148e8a03ffb2c7b38ab06a34a2d2827
2021-08-02 11:58:29 +08:00
openharmony_ci
ce66a234fc !471 fix: 将用户态内存调测解析脚本移至tools目录下
Merge pull request !471 from Harylee/mem
2021-08-02 02:34:11 +00:00
openharmony_ci
f85c27de59 !476 在内核提示No idle TCB时,增加打印当前系统任务信息,以方便问题定位。
Merge pull request !476 from zhangfanfan2/master
2021-07-31 09:19:41 +00:00
openharmony_ci
9c291a4361 !481 修复mq_close关闭后仍然占用文件描述符的问题
Merge pull request !481 from lnlan/fix_mqueue_0730
2021-07-31 06:07:35 +00:00
openharmony_ci
1722aaa80d !475 将toybox和mksh加入到gn编译代替其make编译
Merge pull request !475 from Caoruihong/gn_build_apps
2021-07-31 03:57:03 +00:00
openharmony_ci
88358ab302 !480 A核代码告警清零
Merge pull request !480 from wangchen/a_codex
2021-07-31 03:41:03 +00:00
openharmony_ci
1e5d01360b !394 fix apis: setrlimit,gethostname,gethostid
Merge pull request !394 from wcc/misc
2021-07-31 03:17:22 +00:00
openharmony_ci
a7a25bb0a3 !382 fix mq by enable mq_notify API
Merge pull request !382 from guweijie/master
2021-07-31 03:08:14 +00:00
openharmony_ci
1394b3be26 !463 BBOX使用预留物理内存缓存故障日志
Merge pull request !463 from pcwlno1/bbox_bugfix_upload2
2021-07-31 01:55:14 +00:00
lnlan
590c7b4e22 fix: 修复mq_close关闭后仍然占用文件描述符的问题
【背景】
mqueue用例压力测试中,会出现无法生成xml现象
【修改方案】
1. 确认是mq_close关闭时未清除用户态文件描述符相关位导致的,
添加清除步骤后,问题解决
【影响】
对现有的产品编译不会有影响。

re #I3ZQDA

Signed-off-by: lanleinan <lanleinan@163.com>
Change-Id: I8d467b361465f516ae7105bef38242bfd4805c60
2021-07-30 09:26:22 +00:00
wangchen
698756d1e6 fix: A核代码告警清零
【背景】定期A核代码告警清零。

【修改方案】
根据工具扫描结果,对代码告警进行更改。

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

re #I4378T
Signed-off-by: wangchen <253227059@qq.com>
2021-07-30 17:13:55 +08:00
Guangyao Ma
7819d15b36 fix: 去掉冗余的strip操作
toybox源码编译时,默认会进行strip操作,如下步骤:

//third_party/toybox/scripts/make.sh:340:
! do_loudly ${CROSS_COMPILE}${STRIP} "$UNSTRIPPED" -o "$OUTNAME"

因此在打包的Makefile中再进行STRIP操作是冗余的。

close #I43767

Change-Id: I10a9861b682eb8e556b7af7519c9109eef0b3a94
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-07-30 16:58:53 +08:00
YOUR_NAME
11a9b00d43 fix: 在内核提示No idle TCB时,增加打印当前系统任务信息,以方便问题定位。
close: #I434UC

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: If6cdb719412375c79356a50113a0efb45c8968f7
2021-07-30 12:52:31 +08:00
pcwlno1
2ad176e587 fix: BBOX使用预留物理内存缓存故障日志
1、允许用户自己指定预留物理内存的起始地址和长度。
2、在适配层中增加对预留物理内存的映射。
3、在bbox的Kcondfig中增加有关预留物理内存的编译选项。
4、在bbox的Makefile增加有关内存函数头文件的引用。

Close #I41YIZ

Signed-off-by: pcwlno1 <qidechun@huawei.com>
2021-07-30 11:02:13 +08:00
Caoruihong
c54bfa16e3 feat: enable gn build for toybox and mksh
toybox and mksh are built by gn now, and make build
for toybox and mksh are disabled now.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I46810ab418344d9841ec55cb9f1ad2dc2d15b008
2021-07-30 10:11:02 +08:00
Guangyao Ma
187884937c Revert "fix: 修改默认窗口宽度到400"
之前修改窗口宽度,为了适配流水线。流水线已经完成自适应,建议回退回80宽度。一方
面,shell显示更友好。一方面,在tty完成前,也没有更好的处理方法。

close #I42X9V

This reverts commit 09c491ca1f.

Change-Id: I17a4f4804c4530ee5b95ebf547771768ef254842
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-07-29 12:54:25 +08:00
openharmony_ci
2d8e59ccf3 !470 编译器标准头文件路径标识为系统路径(-isystem)
Merge pull request !470 from Caoruihong/isystem_std_inc
2021-07-28 09:45:53 +00:00
Haryslee
85b4cb7a67 fix: 将用户态内存调测解析脚本移至tools目录下
背景:解析脚本之前放在prebuilts目录下,该目录做了调整,该子目录下无合适的目录存放。
方案:将解析脚本移至内核tools目录下。

close #I42T9A

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I8b4af5df0cc9c9cd740fef8bd3092cf8d2bd1ec7
2021-07-28 17:29:58 +08:00
Caoruihong
66764e48fb chore: compiler's std include as a system include path
use -isystem cflags to use compiler's std include

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: If1f8e5d3bb8090397885fa1f35ae893e5d212565
2021-07-28 17:22:50 +08:00
openharmony_ci
def22d3fd1 !467 将public config中的configs改为不受module_switch影响
Merge pull request !467 from Caoruihong/decouple_hdf_config
2021-07-28 03:40:55 +00:00
openharmony_ci
08878bd99f !462 为hispark_taurus启用ADC及测试用例
Merge pull request !462 from 王亚枫/master
2021-07-27 09:24:46 +00:00
openharmony_ci
468c47b6b1 !466 构建脚本中去除安装kconfiglib有关的步骤
Merge pull request !466 from Caoruihong/kconfiglib
2021-07-27 09:23:20 +00:00
Caoruihong
f3beb4b273 feat: don't apply module_swith on configs of config
optimize the public config template

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I0275b9a945ee87ca7893f8da6f30f9f5f65fa9ae
2021-07-27 16:46:30 +08:00
yafeng_wang
c71ec9d7e8 feat: Open macro for ADC moudule 2021-07-27 16:15:12 +08:00
Caoruihong
787fae2eec chore: remove kconfiglib related building steps
kconfiglib will be install by installing ohos-build

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I49a946fcea259155f3019ac6b6b3319c3a4cec47
2021-07-27 16:02:58 +08:00
openharmony_ci
875c46290b !458 OHOS_Image改为GN编译生成
Merge pull request !458 from Caoruihong/default_gn
2021-07-27 04:05:00 +00:00
wcc
09d5bcc22d Merge branch 'master' of gitee.com:openharmony/kernel_liteos_a into misc 2021-07-27 01:40:59 +00:00
Caoruihong
abf4d8fb25 feat: build OHOS_Image from kernel
using OHOS_Image as liteos default name

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I00bcc9a6747ffde0f07f3d243150055a644df02f
2021-07-27 01:20:46 +08:00
openharmony_ci
0dc79479ff !436 toybox升级_内核依赖
Merge pull request !436 from wangchen/toybox
2021-07-23 11:21:45 +00:00
openharmony_ci
0dfa58ca5a !454 toybox update
Merge pull request !454 from Kiita/toybox_update
2021-07-23 11:21:44 +00:00
teamol
4427142d73 fix: fix mq function by enable mq_notify api
1.modifications:
modified:   compat/posix/include/mqueue.h
modified:   compat/posix/src/mqueue.c
modified:   syscall/ipc_syscall.c
modified:   syscall/los_syscall.h
modified:   syscall/syscall_lookup.h
modified:   testsuites/unittest/posix/mqueue/posix_mqueue_test.cpp

2.add 5 testcases:
It_posix_queue_205.cpp
It_posix_queue_206.cpp
It_posix_queue_207.cpp
It_posix_queue_208.cpp
It_posix_queue_209.cpp

3.influence:
none

Signed-off-by: teamol <28105285@qq.com>
2021-07-23 16:52:21 +08:00
openharmony_ci
a531bcf389 !456 fix: nanosleep 接口的rmtp参数被错误清零
Merge pull request !456 from zhushengle/nanosleep
2021-07-23 06:24:31 +00:00
zhushengle
9458de9ac6 fix: nanosleep 接口的rmtp参数被错误清零
posix/linux 标准:
nanosleep 使线程进入到了可被信号中断的状态,当线程睡眠被信号
中断,线程回复运行态时,若rmtp不为NULL,则会将sleep剩余的时间
记录在rmtp参数中返回,但是如果线程sleep过程中未被信号唤醒,
则忽略该参数。

由于鸿蒙中nanosleep是不可被打断的,即rmtp应该被忽略,而不是清零。

Close #I41U0R
Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I6622eb43d6782c2b53b99d9df5cfff5f5e1ed79c
2021-07-23 10:38:05 +08:00
Kiita
76f45b3fb2 fix: toybox命令升级
【背景】liteos_a toybox 命令升级升级

【修改方案】
1、help命令列表不支持命令删除。
2、cp命令和mv命令拷贝文件失败和文件损坏等问题修复。
3、修复du命令统计nfs文件大小为0问题修复。
4、修复ls命令nfs文件时间打印信息有误问题。
5、更新命令不支持入参列表。

re #I41N2A

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: I5f5b82e33ba9193ae06e9547182d5b7bac0a3b44
2021-07-22 23:40:40 +08:00
openharmony_ci
aaa9018acf !455 内核二进制生成到target_out_dir中,避免误打包到rootfs中
Merge pull request !455 from Caoruihong/target_out_dir
2021-07-22 11:56:12 +00:00
Caoruihong
3b5268f02a chore: output liteos binaries to target_out_dir
liteos binaries no need pack to rootfs.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Iba650c9d09302902c108760163eca55b4ec40221
2021-07-22 18:52:24 +08:00
openharmony_ci
fa056ce246 !445 toybox支持reboot命令
Merge pull request !445 from Kiita/toybox_cmd_reboot
2021-07-22 08:44:53 +00:00
openharmony_ci
0ad91713f6 !449 确保BBOX抓取的故障日志落盘
Merge pull request !449 from pcwlno1/bugfix_log_write
2021-07-22 05:44:10 +00:00
openharmony_ci
9e9c7b28d4 !448 fix: Ctrl-C move out of LOS_MAGIC_KEY_ENABLE
Merge pull request !448 from MGY917/Ctrl-C_support
2021-07-22 02:51:05 +00:00
pcwlno1
8f6a1dd33c fix: 修改某些平台保存bbox日志失败的问题
1、在日志写如完成之后执行fsync确保落盘。

Close #I41UTP

Signed-off-by: qidechun <qidechun@huawei.com>
2021-07-22 10:19:31 +08:00
openharmony_ci
77270dd783 !429 删除无用的失效的符号链接文件
Merge pull request !429 from Caoruihong/remove_unused_files
2021-07-22 01:51:25 +00:00
openharmony_ci
8755dc9d35 !443 从Make编译切换到GN编译
Merge pull request !443 from Caoruihong/build_gn
2021-07-22 01:50:19 +00:00
Caoruihong
a8805a65aa feat: add support for gn build system
add BUILD.gn for all kernel modules

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I018446427bf64615f2596d47862b219659b58b34
2021-07-21 15:52:40 +08:00
openharmony_ci
4adc15e630 !446 init进程收到子进程退出信号后,调用fork重新拉起进程,会导致系统卡死
Merge pull request !446 from zhangfanfan2/master
2021-07-21 07:39:31 +00:00
openharmony_ci
d9774e016e !447 chore: fix function and variable name spell issues
Merge pull request !447 from kenneth/chore
2021-07-21 05:29:07 +00:00
openharmony_ci
c610578d73 !433 fix: 修改默认窗口宽度到400
Merge pull request !433 from MGY917/change_winsz
2021-07-21 05:21:00 +00:00
openharmony_ci
3b9e3f8471 !438 解决shm接口死锁问题
Merge pull request !438 from JerryH/shm
2021-07-21 01:50:28 +00:00
kenneth
58d4366e1d chore: fix function and variable name spell issues
fix some spell issues in files under folder kernel/base/core:
change Recyle to Recycle, ilde to idle and Porcess to Process

close #I3R28X

Signed-off-by: kenneth <zhushangyuan@huawei.com>
2021-07-21 08:52:18 +08:00
openharmony_ci
650d2b91cd !442 feat: support .mkshrc
Merge pull request !442 from MGY917/mkshrc
2021-07-20 22:55:52 +00:00
YOUR_NAME
35a2f3af33 fix: init进程收到子进程退出信号后,调用fork重新拉起进程,会导致系统卡死
问题原因:init进程执行信号时,线程栈底预留了部分空间给信号上下文使用,
从而导致处理信号时线程栈底比线程控制块里面记录的大,这样在fork的过程中内核
从init线程栈底copy线程上下文给新进程时,copy的不是实际运行的栈底,以致于
新进程的线程上下文不对,在实际运行时跑飞,引发系统卡死。
解决方案:在fork过程copy线程上下文时,判断是否预留了信号上下文空间,如果预留
了,则copy的栈底要基于预留后的栈底去copy线程上下文。

close: #I41HOY

Signed-off-by: zff <zhangfanfan2@huawei.com>
Change-Id: I61cb05183c78919730e3a68c1c85b72fa1decd16
2021-07-20 21:11:12 +08:00
wangchen
2ff44c4938 fix: L1 toybox 命令功能实现
【背景】
解决toybox已支持命令的遗留问题,新增命令功能。

【修改方案】
1. 在内核态对toybox的系统调用进行支持。

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

re #I41N2A
Signed-off-by: wangchen <253227059@qq.com>
2021-07-20 20:56:35 +08:00
openharmony_ci
7b7d64cc87 !404 mount接口支持MS_RDONLY flag
Merge pull request !404 from Far/master
2021-07-20 12:47:43 +00:00
openharmony_ci
70c18b4a75 !444 【WIP】修改OsGetArgsAddr所在头文件
Merge pull request !444 from JING/bootargs
2021-07-20 12:19:10 +00:00
chenjing
14bd753aa8 fix: OsGetArgsAddr声明所在头文件不正确
close #I41MWM

Signed-off-by: chenjing <chenjing139@huawei.com>
Change-Id: Iad136b3b8b63fed63fa69c594ec39bd90d5513b7
2021-07-20 19:30:04 +08:00
Far
8729f6ee57 feat: 增加mount的MS_RDONLY标志的支持
增加mount的MS_RDONLY标志的支持,并修改vfs主要接口相关支持。
1. fatfs lseek接口在分区以MS_RDONLY方式和文件以只读打开时不再能够扩大文件的大小。
2. 直接在镜像中创建storage目录,而不是在挂载根文件系统时创建storage目录。
3. 增加了MS_RDONLY的测试用例。

Close #I3Z1W6

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-07-20 16:21:08 +08:00
Guangyao Ma
51a50c95b4 feat: support .mkshrc
close #I3Y5KE

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: Iea3cfe4da572b1a4e250f90cea24efa2c27ceddb
2021-07-20 14:37:30 +08:00
openharmony_ci
9d3e872454 !441 bootargs解析与rootfs挂载解耦,并支持自定义bootargs参数
Merge pull request !441 from JING/bootargs
2021-07-20 06:17:33 +00:00
chenjing
80473f0975 fix: bootargs解析与rootfs挂载解耦,并支持自定义bootargs参数
1、bootargs解析与rootfs挂载进行解耦;
2、支持开发者自定义bootargs参数,内核存储bootargs中所有参数;
3、开发者可获取bootargs中的参数内容,并自行解析。

close #I41CL8

Change-Id: If384476714854ba0cf64eb70b785eb26737dd3d2
Signed-off-by: chenjing <chenjing139@huawei.com>
2021-07-20 11:48:31 +08:00
JerryH1011
7a6e4c8155 fix:修复共享内存shmat和shmdt接口之间存在的死锁问题
close #I40QOM

Change-Id: Ib3783f5d6b1095bf2100ab024fe0235a64355823
Signed-off-by: JerryH1011 <huangjieliang@huawei.com>
2021-07-19 14:55:47 +08:00
openharmony_ci
c40e1464b9 !431 修复FATFS中不同内部接口不支持FAT12/FAT16 FAT表结标志
Merge pull request !431 from Far/fatfs
2021-07-19 06:08:09 +00:00
openharmony_ci
700c3415c4 !435 fix:修复llvm编译环境下内核态内存调测调用栈信息解析有误的问题
Merge pull request !435 from Harylee/mem
2021-07-19 01:42:47 +00:00
openharmony_ci
0973004870 !430 A核 告警清零
Merge pull request !430 from wangchen/xxx
2021-07-17 07:01:18 +00:00
wcc0
c9d69e2d1b fix: add capability and amend smoke testcase
add setrlimit,gethostname,gethostid and capability

Change-Id: I0d5f23cb87ec2731fb79e7c5cfbe1ce109ac158a
2021-07-16 09:24:44 +08:00
openharmony_ci
d79fd50693 !313 feat: active mksh & toybox
Merge pull request !313 from MGY917/toybox_active
2021-07-15 12:40:12 +00:00
Haryslee
9547133e64 fix:修复llvm编译环境下内核态内存调测调用栈信息解析有误的问题
背景:内核态内存调测调用栈信息在gcc编译环境下是准确的,但是llvm
编译环境下是错误的,分析知,gcc和llvm编译环境下fp和lr的对应关系
是有区别的。
修复:增加llvm编译环境下对lr解析的逻辑,并用编译宏控制。

close #I40TQS

Signed-off-by: Haryslee <lihao189@huawei.com>

Change-Id: If2a7b7a286d91e78dcff2bdeb136fda71e656a79
2021-07-15 19:35:04 +08:00
wjj
2d31aed27b test: 支持互斥锁的强壮性属性,测试用例
支持互斥锁强壮性标志,添加加解锁函数对robust链表的处理
2021-07-15 10:41:54 +08:00
openharmony_ci
d9ed4b4bf6 !427 fix: 修复lwip2.0 增强在futex中异常挂死问题
Merge pull request !427 from zhushengle/futex
2021-07-15 01:54:41 +00:00
openharmony_ci
60bf2fc517 !432 【DFX子系统】LiteOS_A系统信息dump工具
Merge pull request !432 from pcwlno1/upload_hidumper
2021-07-14 07:48:10 +00:00
qidechun
cb17fa50ed feat: 给开发者提供系统信息导出Hidumper工具。
给开发者提供系统信息DUMP机制,帮助开发者观察系统功能状态,发现潜在问题。

Close #I3NN7D

Signed-off-by: qidechun <qidechun@huawei.com>
2021-07-14 14:49:58 +08:00
Guangyao Ma
09c491ca1f fix: 修改默认窗口宽度到400
由于内核暂不支持tty,窗口默认宽度写死的为80。在流水线中,往往有时候需要更宽的
窗口宽度。在tty支持动态获取和设置大小之前,先调整大小为400。

re #I40LQX

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: Ic21a8b7098f47b7d608762678eebb7b8ecb67ce4
2021-07-14 14:41:40 +08:00
openharmony_ci
a531da901d !426 【DFX子系统】【BBoxDetector】LiteOS_A死机重启维测框架
Merge pull request !426 from pcwlno1/upload1
2021-07-14 02:18:05 +00:00
qidechun
a195aac9fb feat: add blackbox for liteos_a
1、在内核增加BlackBox核心框架,对外提供模块回调接口注册和故障处理接口。
2、增加默认的系统模块适配层,处理通用内核态和用户态故障日志抓取和保存。
3、BBOX特性默认关闭,若想使用此特性,请在内核配置文件中增加如下编译选项:
LOSCFG_BLACKBOX=y
LOSCFG_SAVE_EXCINFO=y
LOSCFG_SAVE_EXCINFO可以帮助抓取更多的故障日志。
4、若已经打开BBOX特性,想快速验证此特性,请添加如下编译选项:
LOSCFG_HIDUMPER=y

Close #I406NP

Signed-off-by: qidechun <qidechun@huawei.com>
2021-07-14 09:37:35 +08:00
zhushengle
1157c4a289 fix : futex requeue机制中,头节点的queueList 为NULL, 导致系统异常
queuelist中的普通节点在调整为futexList的节点时,
未校验其queueList的有效性,导致queueList未初始化,
出现访问空指针;且在从旧链表迁移节点到新链表时,
节点从旧链表删除之后又插入到另一个链表中,导致对
旧链表的为NULL判断出错。

Close #I4024F

Change-Id: I506a10fc5740ce16e682c2c419b9d92a82000b86
Signed-off-by: zhushengle <zhushengle@huawei.com>
2021-07-14 09:30:49 +08:00
openharmony_ci
0056b4ade5 !380 修复了杀死掉hilog进程后SecurityCapability门禁用例无法通过的问题
Merge pull request !380 from phchang/fixhilog
2021-07-13 08:21:41 +00:00
openharmony_ci
78a50aff99 !396 修复signal中的关于pipe部分的用例问题
Merge pull request !396 from phchang/fix_pipebug
2021-07-13 08:21:28 +00:00
openharmony_ci
7240fe3bd4 !405 修复mqueue_unittest用例存在偶尔无法通过的问题
Merge pull request !405 from phchang/fix_mq
2021-07-13 08:20:38 +00:00
vcbchang
e7c4b1963a test: 修复mqueue_unittest全量用例ItPosixQueue075与ItPosixQueue097,冒烟用例 ItPosixQueue053用例存在偶尔无法通过的问题
【背景】mqueue_unittest用例ItPosixQueue075、ItPosixQueue053 与ItPosixQueue097用例存在偶尔无法通过的问题,现在将其修复

【修改方案】ItPosixQueue075中原来是通过延时来实现线程同步,现在更改为静态全局变量实现; ItPosixQueue097中的关于g_testCount利用延时来置标志位,实现线程同步。这里通过延时来期望线程调度,写的不合理,这里更改为等待标志位来实现线程同步。

re #I3Z9H9

Signed-off-by: vcbchang <vcbchang@qq.com>
Change-Id: Ib1bb945a5393cb03f4d92e4332e20acd82eb1845
2021-07-13 11:56:50 +08:00
vcbchang
fd6f91bc9f test: 修复signal中的关于pipe部分的用例问题
【背景】signal模块中的pipe用例存在无法通过测试的问题,经查找,pipe用例存在多处bug,这里做以修复

【修改方案】
1 ItPosixPipe002用例存在pipe存在在父进程中没有关闭写端,父进程判断处有编码问题等
2 删掉了一些用例多余的close函数,精简了用例的结构
3 原来用例主子进程依靠延时来实现进程同步,这里更改为使用共享内存的方法来实现

re #I3YPQ8

Signed-off-by: vcbchang <vcbchang@qq.com>
Change-Id: Ic0d0ab20521c9af5e5f1d75e76e047162d978464
2021-07-13 11:52:57 +08:00
Far
33f5c70e6c fix: 修复FATFS中不同内部接口不支持FAT12/FAT16 FAT表结束标志
FATFS内部接口中,仅对FAT32的FAT表结束符0x0FFFFFFF做了判断,而忽略了FAT12和FAT16的结束标志。
这会导致子在FAT12/FAT16中,部分功能异常。

Close #I409R6

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-07-13 10:05:06 +08:00
wangchen
ec977a1c7e fix: A核codex修改
【背景】A核codex扫描告警消除。

【修改方案】
1. 将不可屏蔽告警进行修复。

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

re #I40B1S
Signed-off-by: wangchen <253227059@qq.com>
2021-07-12 20:16:19 +08:00
Caoruihong
92d7672b19 chore: remove unused dead symlink files
remove unused dead symlink files

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I8dd3bf4496173fd20bfcd728c256d429fb4fa077
2021-07-12 18:26:37 +08:00
openharmony_ci
390159f58a !428 kconfig配置文件跟随产品
Merge pull request !428 from Caoruihong/defconfig
2021-07-12 03:25:28 +00:00
openharmony_ci
d8be8aad65 !377 perf: assign '-1' to uninitialized variable: ret
Merge pull request !377 from Joker2770/master
2021-07-12 00:55:51 +00:00
Caoruihong
6d948a42bb chore: place .config files under config dir of products
place .config files under config dir of products

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I80c6641ae462d4888a6f3124f92b4c9d7fa1567b
2021-07-10 19:36:44 +08:00
openharmony_ci
72d9aa1bcb !414 内核Kconfig与芯片配置解耦
Merge pull request !414 from Caoruihong/kconfig
2021-07-09 09:33:50 +00:00
openharmony_ci
8390738de5 !414 内核Kconfig与芯片配置解耦
Merge pull request !414 from Caoruihong/kconfig
2021-07-09 09:33:50 +00:00
Guangyao Ma
40f239a7d4 fix: Ctrl-C move out of LOS_MAGIC_KEY_ENABLE
由于没有tty,当前的Ctrl-C实现基于uart回调特定函数实现,后续tty实现后
可以重新考虑Ctrl-C设计实现。本次将Ctrl-C移除LOS_MAGIC_KEY_ENABLE,保
证任意情况下可以生效。

Change-Id: I4e1e51b2d92535879bbdbbfa91b0229119d0e90e
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-07-09 17:12:20 +08:00
Guangyao Ma
cacb4f0103 feat: active mksh & toybox
Close #I3VEOG

Change-Id: Ibc73aacf68c65e64b88084edfd3549b3137dde07
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-07-09 17:07:06 +08:00
openharmony_ci
ee54cd8b7e !356 修复内核vfat用例
Merge pull request !356 from Far/test
2021-07-09 08:38:39 +00:00
openharmony_ci
f523d7a98c !339 修复了文件系统中jffs的全量用例和压测用例中出现的问题
Merge pull request !339 from phchang/fixjffs
2021-07-09 08:38:01 +00:00
openharmony_ci
d7387508e3 !402 消除编译告警
Merge pull request !402 from x_xiny/master
2021-07-09 08:37:20 +00:00
x_xiny
e4ff04586f fix:消除编译告警
【背景】
 消除编译告警

【修改方案】
 消除编译告警

 re #I3ZC1R

 Change-Id: I594d0f57e4cbbdb246a6bef1c978a38228123a34

 Signed-off-by: x-xiny <1301913191@qq.com>

Change-Id: I1d75cdcdcf9d06ec28e541cdfea77300da7c6bb1
2021-07-08 20:30:33 +08:00
Caoruihong
8784694686 feat: using kconfiglib instead of kconfig
kconfiglib support the kconfig macro language,
we need this feature to handle product related
Kconfig configuration.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I6bb521e93aab6c67b8bc3ac664b64f5e52089a45
2021-07-08 15:44:47 +08:00
openharmony_ci
b29d9d88ab !412 fix: mksh compile bug fix
Merge pull request !412 from MGY917/fix_waitpid
2021-07-08 03:25:08 +00:00
Guangyao Ma
d8263b1e91 fix: mksh compile bug fix
编译框架整改,需要所有交叉编译指定sysroot以及arch相关的编译选项,用来在编译链
接过程中在指定的sysroot路径下,寻找符合arch要求的依赖库。往往,sysroot选项和
arch选项需要同时出现在编译链接选项中。

close #I3ZMR7

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: If2249721e0e35615b95f5525e57241aae910c212
2021-07-08 10:48:39 +08:00
openharmony_ci
9304a683ad !397 修复内核access chmod chown接口
Merge pull request !397 from JING/kernel
2021-07-08 02:36:56 +00:00
openharmony_ci
78906f4a6c !406 修正最小编译时的错误
Merge pull request !406 from Caoruihong/qemu_mini
2021-07-07 08:29:28 +00:00
openharmony_ci
ee7eb89354 !409 回退 'Pull Request !401 : 【DFX子系统】【BBoxDetector】LiteOS_A死机重启维测框架'
Merge pull request !409 from give-me-five/revert-merge-401-master
2021-07-07 03:06:14 +00:00
Denny
55e5e29005 回退 'Pull Request !401 : 【DFX子系统】【BBoxDetector】LiteOS_A死机重启维测框架' 2021-07-07 10:29:43 +08:00
Caoruihong
ac8c2c6d5b fix: minimal compile
fix compile errors in minimal compilation

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I48f4f7b27c684e2c747c1949776c5c4f9e383dec
2021-07-07 00:26:33 +08:00
openharmony_ci
feae60c8fe !401 【DFX子系统】【BBoxDetector】LiteOS_A死机重启维测框架
Merge pull request !401 from pcwlno1/upload10
2021-07-06 08:15:48 +00:00
qidechun
425975e481 feat: add blackbox for liteos_a
1、在内核增加BlackBox核心框架,对外提供模块回调接口注册和故障处理接口。
2、增加默认的系统模块适配层,处理通用内核态和用户态故障日志抓取和保存。

Close #I3NN7V

Signed-off-by: qidechun <qidechun@huawei.com>
2021-07-06 07:49:59 +08:00
openharmony_ci
cc731d1e69 !391 add vibrator liteos defined
Merge pull request !391 from kevin/0625_maste
2021-07-05 12:29:56 +00:00
chenjing
56a95b9ec9 fix: 修复内核access chmod chown接口
1、修复内核的access chmod chown功能;
2、此三个接口的syscall直接调用内核态接口执行操作。

close #I3Z5L6

Signed-off-by: chenjing <chenjing139@huawei.com>
Change-Id: I301f00fb341252b697b04b9970db86f0e7f978df
2021-07-05 16:03:16 +08:00
kevin
3e7622ca78 Merge branch '0625_maste' of https://gitee.com/Kevin-Lau/kernel_liteos_a into 0625_maste 2021-07-05 14:55:57 +08:00
kevin
b1b4ddcc7d feat:add hdf vibrator liteos definition
Change-Id: I0a73f0de3c25e427362fe9d96547c4d847448dda
Signed-off-by: kevin <liufeihu@huawei.com>
2021-07-05 14:53:43 +08:00
Kiita
e567a10d02 feat: 新增toybox reboot命令
【背景】liteos_a测试套需要reboot命令

【修改方案】
在third_party/toybox/porting新增reboot.c文件,并作自定义修改。
新增reboot命令的支持说明。

re #I3YQ7S

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: I686a535adbad78935eee04fc283a837a4a7f13f6
2021-07-01 21:12:31 +08:00
kevin
23fd4e55a3 add vibrator liteos defined
Signed-off-by: kevin <liufeihu@huawei.com>
Change-Id: I0a73f0de3c25e427362fe9d96547c4d847448dda
2021-07-01 20:24:46 +08:00
vcbchang
e57dc7762b test: 修复了文件系统中jffs的全量用例和压测用例中出现的问题
【背景】当前的fs中的jffs用例存在运行不通过的问题,现将其一一修复。

【修改方案】
1. 默认storage文件夹没有文件,如果存在,删除后测试
2. BUG中存在判断不通过的情况,可能是移植过程中出现的变量判断错误,修改变量名正确通过
3. 移植过程中没有考虑现在falsh的大小,有时会出现写入量过多而容量不够的情况,则通过减少写入量来解决问题。
4. 为了尽量减少修改的内容,这里主要以更改全局宏大小或者在代码中修改变量的初始值。

【影响】
主要是jffs用例的写入flash的大小发生变化,其余没有影响。

Signed-off-by: vcbchang <vcbchang@qq.com>
Change-Id: I878fe3ad855e0e430bf7f36e066120893f756828
2021-07-01 18:07:51 +08:00
openharmony_ci
003810284c !384 对内核中menuconfig开关的宏使用#ifdef/#ifndef来做预编译判断
Merge pull request !384 from boxi/upload
2021-07-01 07:11:13 +00:00
openharmony_ci
379d602ab6 !376 使能QEMU arm-virt平台的FAT配置选项
Merge pull request !376 from laokz/blk
2021-07-01 06:05:57 +00:00
openharmony_ci
bf7b2c0a3e !386 支持单独编译内核
Merge pull request !386 from Caoruihong/build_alone
2021-07-01 02:41:01 +00:00
boxi
4e4f2d6d7e refactor: 对LiteOS_a内核中menuconfig开关的宏使用#ifdef/#ifndef做预编译处理
LiteOS_a中有部分配置宏进行了重复冗余定义,导致当头文件未被包含时,极易引入错误,
故对menuconfig配置宏进行统一处理,均使用#ifdef/#ifndef作为预编译判断方式

Close #I3YEGS

Change-Id: Ife6db770cc66de1d6199a4f3ba3950e9bfd0e71a
Signed-off-by: boxi <lewis.liulei@huawei.com>
2021-07-01 09:08:18 +08:00
Caoruihong
d7672d47f2 chore: make liteos_a can be built alone
in the liteos_a directory, we used to use `make clean all` command
to build liteos_a kernel for test.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I5ca689c1c44052f7de937d7faa9e4d3534d97380
2021-06-30 18:44:46 +08:00
openharmony_ci
abbeca1cb2 !359 sysroot和CPU架构参数通过BUILD.gn传递给Make
Merge pull request !359 from Caoruihong/sysroot
2021-06-29 08:14:54 +00:00
openharmony_ci
50c8abc521 !371 fix: 修复kill进程时,liteipc阻塞的进程无法退出问题
Merge pull request !371 from zhushengle/p_kill
2021-06-29 05:27:08 +00:00
openharmony_ci
0469e5b849 !378 修复了FATFS设置卷标的功能
Merge pull request !378 from Far/master
2021-06-29 05:13:41 +00:00
openharmony_ci
dfea902a08 !379 fix: 修复内核c库的makefile中被优化函数替换的高频函数依然参与了编译的问题
Merge pull request !379 from Zhaotianyu/0628libc_fix
2021-06-29 04:50:15 +00:00
openharmony_ci
339c467e71 !375 基于汇编实现内核对用户态内存清零的功能
Merge pull request !375 from Harylee/mem
2021-06-29 04:41:02 +00:00
vcbchang
455e42e5b9 test: 修复了杀死掉hilog进程后SecurityCapability门禁用例无法通过的问题
【背景】如果操作系统先执行kill hilog进程,然后再执行SecurityCapability,那么门禁用例将无法通过,原因是该用例先获取了hilog进程的id,但hilog进程已经杀掉了,所以报错

【修改方案】
1. 增加kill 0与错误码判断,如果发现进程已经被干掉的话将不执行相关内容

【影响】
无其它影响。
Signed-off-by: vcbchang <vcbchang@qq.com>
Change-Id: Icdf357800175eff19acf1f92426469642a697386
2021-06-28 20:31:28 +08:00
arvinzzz
6f6dc4f24c fix: 修复内核c库的makefile中被优化函数替换的高频函数依然参与了编译的问题
1. 更正makefile过滤时被替换函数的不正确路径
2. 防止LOCAL_SRCS再直接+= /*/*.c添加回来

close: #I3XGM8

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I3aff2a60c5a48f2d6c174afa04d30fa6f5514d7e
2021-06-28 17:34:08 +08:00
Caoruihong
9e45086d19 chore: pass sysroot and arch related cflags by BUILD.gn
sysroot and arch related cflags are pass by BUILD.gn now.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Ia6000dd7ed8a8a37e935ace49d8460a919a16566
2021-06-28 16:31:02 +08:00
Far
9515d53dcc fix: 恢复了FATFS设置卷标的功能
Liteos_a FATFS需要提供格式化时设置卷标的功能,该功能在当前系统中缺失。
现在恢复该功能,使用方法与原来一致。即使用set_label设置卷标文本后,调用format对设备格式化。

Close #I3Y5G8

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-06-28 15:43:15 +08:00
Joker2770
e0a27badde perf: assign '-1' to uninitialized variable: ret
Signed-off-by: Joker2770 <1214220480@qq.com>
2021-06-28 09:33:29 +08:00
laokz
49856dc1e0 feat(QEMU_ARM_VIRT_CA7): 使能FAT文件系统编译选项
Signed-off-by: laokz <laokz@foxmail.com>
Change-Id: I0eece39921292498243bd017f168f953a437731c
2021-06-26 18:11:15 +08:00
openharmony_ci
43bdf2f1d3 !372 信号管道用例ItPosixPipe005由于偶现性问题暂时下线
Merge pull request !372 from phchang/fix_pipe
2021-06-26 10:00:22 +00:00
openharmony_ci
eb1900d4db !374 设置qemu默认userfs大小/修改qemu驱动目录
Merge pull request !374 from MGY917/qemu_opti
2021-06-26 09:30:05 +00:00
zhushengle
7de43bb004 fix: 修复kill进程时,因liteipc阻塞的进程概率无法退出问题
kill进程时,会将因为liteipc阻塞的线程唤醒,使其调度并自动退出,由于liteipc阻塞机制为
循环阻塞方式,会导致将因liteipc阻塞的线程唤醒后又进入等待中。此处在唤醒因liteipc阻塞的
线程后检查是否已有kill标志,如果有使其按接收数据失败退出,在返回用户态之前,该线程会进
入退出流程,结束运行。

Close #I3XX7K

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Iec4e298dff4aefd2994289067a35cb5673e323f9
2021-06-26 17:08:48 +08:00
Guangyao Ma
1d952a254a fix: 设置qemu默认userfs大小/修改qemu驱动目录
驱动目录位置不合理,需要调整到/device/qemu/drivers下面

close #I3XW96 #I3XWXD

Change-Id: Ied6b90d2d0631c99f2209f5b72bbd12cdff6b1d5
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-06-26 15:38:19 +08:00
Haryslee
9db3407589 feat: 基于汇编实现内核对用户态内存清零的功能
背景:LOS_UserMemClear接口原有实现是通过在内核中
申请一块堆内存并对其清零,调用copy_to_user来达到
对用户态内存清零的目的,需要使用堆内存。
修改方案:基于汇编实现内核对用户态内存清零的功能。

close #I3XXT0

Change-Id: I27cb1e45559cb75a9b330799fe427abd54f51c15
Signed-off-by: Haryslee <lihao189@huawei.com>
2021-06-26 15:31:42 +08:00
vcbchang
bb6abd8c6b test: 信号管道用例ItPosixPipe005由于偶现性问题暂时下线
【背景】信号管道用例ItPosixPipe005偶尔会失败,经查找,发现是CPU调度所致,延时时间与期望调度不符合,增加延时时间即可

【修改方案】修复了此问题,但是考虑pipe用例整体不稳定,并且pipe用例的pipe函数存在问题,先暂时下线,等pipe部分全部修改完毕后再上线。

re #I3XXPH

Signed-off-by: vcbchang <vcbchang@qq.com>
Change-Id: I21831c9f5ef5700f3b3c8da02f945e0c37f31a6a
2021-06-26 15:27:31 +08:00
openharmony_ci
3cddcb9f66 !355 SIOCGIFCONF iotcl,用户态到内核态申请内存大小错误
Merge pull request !355 from 刘建东/master
2021-06-26 06:50:12 +00:00
YOUR_NAME
bfd27e78b2 fix: SIOCGIFCONF ioctl malloc size error in kernel
use struct ifconf and ifc_buf size malloc memory

close: #I3XEZ3

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-06-26 10:26:40 +08:00
Far
a8384b5db2 fix: 修复了内核的VFAT测试用例
修复内容包括如下:
1. 将memset_s中buffer的大小设置正确;
2. 将用例文件夹名由vfat2修改为vfat;
3. 修复了vfat用例在SetUpTestcase和TearDownTestCase;
4. 全局变量g_fatFilesystem在初始化时设置为2(即FAT32);

Close #I3XF3R

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-06-26 10:13:23 +08:00
openharmony_ci
5db839acef !362 修复在Liteos-a在FATFS中创建的文件夹在Ubuntu中不可见的BUG
Merge pull request !362 from Far/fatfs
2021-06-25 07:20:10 +00:00
openharmony_ci
f4626985fd !368 fix: Identical condition 'ret<0', second condition is always false. 🐛
Merge pull request !368 from Joker2770/master
2021-06-25 07:13:33 +00:00
openharmony_ci
68da7aefc5 !369 修复README_zh-HK.md的链接错误
Merge pull request !369 from SimonLi/fix-doc
2021-06-25 06:20:46 +00:00
SimonLi
f1b4c87bc4 fix(doc): 修复README_zh-HK.md的链接错误
Signed-off-by: SimonLi <likailong@huawei.com>
2021-06-25 14:13:32 +08:00
Joker2770
1348809807 fix: Identical condition 'ret<0', second condition is always false. 🐛
Signed-off-by: Joker2770 <1214220480@qq.com>
2021-06-25 11:26:34 +08:00
openharmony_ci
eb72f78cf1 !363 userfs分区的起始地址与大小改为通过bootargs配置
Merge pull request !363 from JING/rootfs
2021-06-25 01:05:16 +00:00
openharmony_ci
12577eade5 !358 feat: L1支持低功耗投票框架
Merge pull request !358 from zhushengle/pm_v
2021-06-25 00:26:41 +00:00
openharmony_ci
de6db86df3 !364 GetFileMappingList函数实现未加void导致gcc编译报错
Merge pull request !364 from 野生毛霉君/master
2021-06-24 12:47:37 +00:00
mucor
56b8ecaf17 fix: add (void) to GetFileMappingList method
close: #I3XPXY

Signed-off-by: mucor <mucorwang@gmail.com>
2021-06-24 20:32:47 +08:00
openharmony_ci
1e345f18b3 !338 修复rwlock门禁用例多次测试出现的超时不通过的问题
Merge pull request !338 from phchang/rwlock
2021-06-24 10:55:21 +00:00
vcbchang
f793dc1097 test:修复rwlock用例在循环处会卡死的问题
【背景】修复rwlock门禁用例多次测试出现的程序会卡死在某一个地方的问题,经查找程序会卡在循环里面

【修改方案】
1.经测试,发现用例在创建线程后对退出标志位做了初始化,但卡在循环中不动的原因是在创建线程后立刻发生了调度,没有来得及初始化,则发生了错误,故会出现卡在循环中的情况。
而且,由于卡在循环中时线程是同一优先级,可能不会发生调度,故在循环里面加了一句可以调度的语句,防止在一处循环卡的太久。
2.将该用例挪出门禁,待稳定后恢复。
【影响】
对其它用例无影响。

re #I3VUX4

Signed-off-by:vcbchang<vcbchang@qq.com>

Change-Id: Ie0f908001f59bfc832c2519104aa2e3188206910
Signed-off-by: vcbchang <vcbchang@qq.com>
2021-06-24 17:17:27 +08:00
openharmony_ci
112cdebe41 !357 修改/proc/mounts显示格式
Merge pull request !357 from JING/mount
2021-06-24 08:27:32 +00:00
openharmony_ci
a28dcc38c9 !360 增加清除文件系统缓存的维测接口
Merge pull request !360 from 野生毛霉君/master
2021-06-24 07:34:45 +00:00
mucor
3d1cf683f3 feat: add clear cache cmd to /proc/fs_cache
write "clear pathcahe" to clear pathcaches and vnodes
write "clear pagecache" to clear pagecaches
write "clear all" to clear both pathcaches and pagechaches
the cache in use will not be cleared

close: #I3XLPH

Signed-off-by: mucor <mucorwang@gmail.com>
2021-06-24 15:11:50 +08:00
Far
a9fc1e0e5d fix: Liteos-a创建的文件夹在Ubuntu中不可见
Linux的文件夹需要包含"."和".."才会被视为一个有效的目录
通过在新建的文件夹中创建"."和".."目录项修复这个BUG

Close #I3XMY6

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-06-24 15:09:12 +08:00
chenjing
2e2b14205f fix: userfs分区的起始地址与大小改为通过bootargs配置
在内核解析bootargs参数时,加入对userAddr与userSize两个字段的解析。
1、如果bootargs中配置了userAddr与userSize,则使用配置值划分storage分区。
2、如果bootargs中未配置这两个字段,则storage分区默认紧接在rootfs分区后。

close #I3XNEY

Signed-off-by: chenjing <chenjing139@huawei.com>
Change-Id: Iba63ccd7fc3f7efc1d726c4b38beee5df1d64122
2021-06-24 15:03:53 +08:00
openharmony_ci
b8e18ffdf1 !323 fix: 修复内核堆完整性检查逻辑中访问非法指针导致系统异常问题。
Merge pull request !323 from Harylee/mem
2021-06-24 06:45:45 +00:00
zhushengle
21d8ac8752 feat: L1支持低功耗投票框架
功能描述:
  在proc目录下增加power目录,添加powr_mode,power_lock,power_unlock和power_count节点,
  power_mode:节点用于查询和设置系统支持的功耗模式
  power_lock:用于查询和获取低功耗锁,持锁后,将会阻止系统进入低功耗状态
  power_unlock: 用于释放已经持有的低功耗锁,也可查询当前有那些持有低功耗锁
  power_count:用于查询当前持有低功耗锁的个数

Close #I3VS5N

Change-Id: I2e2881cc968eab3c5fa6f9dbd7e8c5e448609407
Signed-off-by: zhushengle <zhushengle@huawei.com>
2021-06-24 14:27:23 +08:00
openharmony_ci
008fa8660d !337 fix: fatfs memory leak
Merge pull request !337 from jianjian/master
2021-06-24 05:36:29 +00:00
chenjing
6860246cfa fix: 修改/proc/mounts显示格式
显示信息内容及格式修改为与posix标准一致,内容包括:
1、挂载设备名
2、挂载点路径
3、文件系统类型
4、挂载选项(此项暂不支持,打印())
5、dump频率(此项暂不支持,值为0)
6、fsck检查次序(此项暂不支持,值为0)

close #I3XGCS

Signed-off-by: chenjing <chenjing139@huawei.com>
Change-Id: I2a8cb093e7c5316feb55fb196bc1b4301d8d0249
2021-06-23 17:10:29 +08:00
openharmony_ci
8a3d188240 !347 修改lwip_enhanced编译脚本,更新lwip_enhanced lwip版本到2.1.2
Merge pull request !347 from 刘建东/master
2021-06-23 02:27:55 +00:00
openharmony_ci
8f0d25225e !351 remove HAVE_VENDOR_CONFIG from hdf Makefile in liteos_a
Merge pull request !351 from yuanbo/master
2021-06-23 02:06:49 +00:00
openharmony_ci
8fe0cc7770 !344 对proc文件系统内的节点增加uid/gid管理
Merge pull request !344 from LeonChan/proc-uid
2021-06-23 01:21:12 +00:00
openharmony_ci
ee4cf83121 !345 add /proc/fd file to dump pid/fd information
Merge pull request !345 from LeonChan/proc_fd
2021-06-23 00:42:13 +00:00
openharmony_ci
702d8d9dde !352 mqueue144与mutex18门禁用例不稳定暂时下线
Merge pull request !352 from phchang/fix_test
2021-06-22 12:14:05 +00:00
vcbchang
290a3c6f92 test: mqueue144与mutex18门禁用例不稳定暂时下线
【背景】mqueue144与mutex18门禁用例不稳定暂时下线

【修改方案】
将ItPosixQueue144.cpp与ItTestPthreadMutex018.cpp门禁用例暂时放入全量用例里面

re: #I3X4PR

Signed-off-by: vcbchang <vcbchang@qq.com>
Change-Id: I470c6bde70aa2b5956ac50a93f56776901774618
2021-06-22 18:53:03 +08:00
chenwei
600dded31e feat: add /proc/fd file to dump the pid/fd/path information
1, for users with privilege, display all users' fd info with the template "Pid  Fd  SysFd Path"
2, for normal user, display its own fd info with the template "Pid Fd Path"

close #I3WB5U

Signed-off-by: chenwei <chenwei26@huawei.com>
2021-06-22 17:27:25 +08:00
chenwei
67806596a3 feat: add uid/gid for ProcFs
close: #I3WGVP

Signed-off-by: chenwei <chenwei26@huawei.com>
2021-06-22 15:40:00 +08:00
yuanbo
88fe4eb3e1 fix: add product_path parameter for driver build
Driver use product_path in hb env as hcs config root path
by default. If it's not exit, try to use device config path.

close: #I3PQ10

Signed-off-by: yuanbo <yuanbo@huawei.com>
2021-06-22 15:18:54 +08:00
openharmony_ci
ca40c79761 !350 增加/proc/fs_cache显示文件系统缓存相关维测信息(重新合入)
Merge pull request !350 from 野生毛霉君/master
2021-06-22 07:18:45 +00:00
mucor
231cb6be27 feat: add /proc/fs_cache to display cache info
add /proc/fs_cache to display vnode, path cache, page cache.
also change some bad virable name

close: #I3WWBD

Signed-off-by: mucor <mucorwang@gmail.com>
2021-06-22 14:53:17 +08:00
openharmony_ci
7f484dfa09 !315 chore: update LOS_BitmapFfz comment
Merge pull request !315 from kenneth/LOS_BitmapFfz
2021-06-22 06:34:45 +00:00
openharmony_ci
1fa6ba3389 !314 chore: update typo in rb tree comments
Merge pull request !314 from kenneth/BR_Tree
2021-06-22 06:34:30 +00:00
openharmony_ci
b7f2df0350 !334 fix: 修改tzset测试用例运行2遍现象
Merge pull request !334 from guweijie/master
2021-06-22 06:29:34 +00:00
openharmony_ci
8bb4538de1 !349 修复当Fatfs开关关闭时,编译失败的问题
Merge pull request !349 from 野生毛霉君/master
2021-06-22 03:04:10 +00:00
kenneth
99d7072332 chore: update LOS_BitmapFfz comment
函数LOS_BitmapFfz有2个参数,注释中只描述了一个参数,丢失了对参数numBits的描述,影响导出API文档。补充函数注释的@param部分。

close #I3U3SF

Signed-off-by: kenneth <459864689@qq.com>
2021-06-22 10:22:46 +08:00
Haryslee
30f5ab89b7 fix: 修复内核堆完整性检查逻辑中访问非法指针导致系统异常问题。
内存完整性校验原有逻辑中当检测到非零异常指针后仍继续访问异常指针
next的内存域导致系统异常。
本次修改后的逻辑为:检测到非零异常指针后直接退出循环,将异常指针
的相关信息输出即可,增加了goto逻辑。对原有功能逻辑无影响。

close #I3VJZT

Change-Id: I5be06a552cf9fd74d8bd78f5cdf04db06eab4f76
Signed-off-by: Haryslee <lihao189@huawei.com>
2021-06-22 09:54:31 +08:00
mucor
fd3f4072b5 fix: compile error when fatfs disabled
close: I3WTLZ

Signed-off-by: mucor <mucorwang@gmail.com>
2021-06-22 09:50:53 +08:00
openharmony_ci
143efc0fab !348 回退 'Pull Request !342 : 增加/proc/fs_cache来显示文件系统缓存维测信息'
Merge pull request !348 from SimonLi/revert-merge-342-master
2021-06-21 13:55:51 +00:00
SimonLi
2f3d7efc24 回退 'Pull Request !342 : 增加/proc/fs_cache来显示文件系统缓存维测信息' 2021-06-21 21:33:52 +08:00
YOUR_NAME
e76c0046f7 chore: update lwip_enhanced lwip version to 2.1.2
update lwip version to 2.1.2 for lwip_enhanced

close: #I3WL4J

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-06-21 21:30:31 +08:00
openharmony_ci
b3120b5498 !342 增加/proc/fs_cache来显示文件系统缓存维测信息
Merge pull request !342 from 野生毛霉君/master
2021-06-21 17:21:02 +08:00
mucor
53c6d96c6f feat: add /proc/fs_cache to display cache info
add /proc/fs_cache to display vnode, path cache, page cache.
also change some bad virable name

close: #I3WESD

Signed-off-by: mucor <mucorwang@gmail.com>
2021-06-21 16:11:06 +08:00
openharmony_ci
3f84ed5075 !340 /proc/mounts显示格式修改
Merge pull request !340 from JING/mount
2021-06-21 15:24:32 +08:00
chenjing
e9ad6b71c3 fix: 增加表头,内容以制表符分栏。
close #I3W2M9

Signed-off-by: chenjing <chenjing139@huawei.com>
Change-Id: If8ba7047e2914a3104182bf017f437c2ae962625
2021-06-21 14:17:03 +08:00
openharmony_ci
e5a3ee6f33 !331 LOSCFG_FS_FAT_VIRTUAL_PARTITION宏开关错误作用域引起的FATFS功能错误
Merge pull request !331 from Far/master
2021-06-21 13:13:06 +08:00
jianjian
fbfd71dfe3 fix: fatfs memory leak
Signed-off-by: jianjian <xingjian_liu@yeah.net>
2021-06-20 13:42:01 +08:00
openharmony_ci
36e5124c0a !322 文件系统冗余代码和依赖删除
Merge pull request !322 from 野生毛霉君/master
2021-06-19 20:40:14 +08:00
mucor
73a777777e fix: remove redundant headfile
1.remove redundant headfile in kernel, such as:
  compiler.h;debug.h;automount.h;inode.h;syslog.h;net.h;
2.split fs.h to file.h and driver.h
3.move vnode.h and path_cache.h to vfs/include
4.remove redundant interface and defines

close: #I3RTNR

Signed-off-by: mucor <mucorwang@gmail.com>
2021-06-19 17:32:47 +08:00
teamol
e4b6ba56b9 test: fix 2 testcases for API tzset
1.modifications:
testsuites/unittest/time/timer/smoke/timer_test_tzset_001.cpp
testsuites/unittest/time/timer/smoke/timer_test_tzset_002.cpp
testsuites/unittest/time/timer/time_timer_test.cpp

2.influence:
none

Signed-off-by: teamol <28105285@qq.com>
2021-06-18 17:26:48 +08:00
openharmony_ci
5f970888ef !328 fix:修改clock_gettime接口适配posix标准测试用例011输入clk_id错误时返回值ESRCH为EINVAL.
Merge pull request !328 from guweijie/master
2021-06-18 14:26:29 +08:00
kenneth
6e95771303 chore: update rb tree comments
update typos in rb tree comment

close #I3U73B

Signed-off-by: kenneth <459864689@qq.com>
2021-06-18 11:07:53 +08:00
teamol
f8cf6e6439 fix: 修改clock_gettime接口适配posix标准测试用例011输入clk_id错误时返回值ESRCH为EINVAL.
1.修改:
compat/posix/src/time.c文件中clock_gettime接口ESRCH返回值为EINVAL.
2.影响:
无.

fix #I3OUHI

Signed-off-by: teamol <28105285@qq.com>
2021-06-18 10:42:23 +08:00
openharmony_ci
ed0041ac65 !327 增强Liteipc的多线程保护
Merge pull request !327 from Caoruihong/master
2021-06-18 09:45:48 +08:00
Far
acda419a2d fix: 修复了LOSCFG_FS_FAT_VIRTUAL_PARTITION宏开关错误作用域引起的功能错误
在init_cluster函数中,若未打开LOSCFG_FS_FAT_VIRTUAL_PARTITION会导致循环初始化
簇时,未调用sync_window函数,进而导致创建的文件夹未能正确置零。

Close #I3W1IW

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-06-17 20:56:36 +08:00
openharmony_ci
dca42b9ef6 !316 fix: update LOS_DL_LIST_IS_END comment
Merge pull request !316 from kenneth/LOS_DL_LIST_IS_END
2021-06-17 14:08:29 +08:00
openharmony_ci
fa6993381a !317 chore: rename function OsCreateUserVmSpace
Merge pull request !317 from kenneth/los_vm_map
2021-06-17 14:07:51 +08:00
openharmony_ci
37d80146db !321 chore: fix typos
Merge pull request !321 from kenneth/destroy
2021-06-17 14:06:06 +08:00
Caoruihong
7e2aef2480 fix: race condition in liteipc
global data should be accessed in protection

fix: #I3PW5Y
Change-Id: I9dfa09992eb8e78935ed367240628300fc033193
Signed-off-by: Caoruihong <crh.cao@huawei.com>
2021-06-17 12:01:25 +08:00
openharmony_ci
9169637084 !310 fatfs支持symlink与readlink功能
Merge pull request !310 from JING/link
2021-06-17 10:03:38 +08:00
openharmony_ci
acb24924be !318 fix: avoid compile warning ignored
Merge pull request !318 from MGY917/citu_clean
2021-06-17 08:57:01 +08:00
openharmony_ci
bfb74b2027 !318 fix: avoid compile warning ignored
Merge pull request !318 from MGY917/citu_clean
2021-06-17 08:57:00 +08:00
kenneth
f0b419099d chore: rename function OsCreateUserVmSpace
rename function OsCreateUserVmSpace to fix typo

close https://gitee.com/openharmony/kernel_liteos_a/issues/I3QD42

Signed-off-by: kenneth <459864689@qq.com>
2021-06-16 15:00:53 +08:00
Kenneth
81f3d59717 chore: fix typos
fix typo destroy

close https://gitee.com/openharmony/kernel_liteos_a/issues/I3RR17

Signed-off-by: Kenneth <459864689@qq.com>
2021-06-16 14:52:06 +08:00
Guangyao Ma
eca711bb64 fix: avoid compile warning ignored
Close #I3VOAO

Change-Id: I42103e0e7061e50f8d63df98ea9f5cecd49fe6f4
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-06-15 19:56:21 +08:00
kenneth
900269bd46 fix: update LOS_DL_LIST_IS_END comment
update  LOS_DL_LIST_IS_END comment

close https://gitee.com/openharmony/kernel_liteos_a/issues/I3TWU6

Signed-off-by: kenneth <459864689@qq.com>
2021-06-15 17:16:41 +08:00
chenjing
e50cf0be6f feat: fatfs支持符号链接功能
1 将fatfs_creat与fatfs_mkdir抽象成fatfs_creat_obj,通过参数type控制创建的对象类型;
2 新增fatfs_symlink与fatfs_readlink接口,其中:
   1) fatfs_symlink通过fatfs_creat_obj创建出符号链接文件,并为其申请新簇,将target内容写入簇的第一个sector;
   2) fatfs_readlink读出符号链接文件对应簇中第一个sector的内容

close #I3V8D1

Signed-off-by: chenjing <chenjing139@huawei.com>
Change-Id: I38dfaa28af156399817530923534d5b73b4c64af
2021-06-15 11:32:55 +08:00
openharmony_ci
a760c268f4 !312 musl归一化后调整和简化libc的构建
Merge pull request !312 from Caoruihong/porting2
2021-06-11 17:36:28 +08:00
Caoruihong
5c78236428 chore: build libc using third_party musl
do not copy or link file from //third_party to this repository,
just use the files needed from its origin.

Change-Id: I43f60d8aa7dc91925b8ace973933de366d6cb589
Signed-off-by: Caoruihong <crh.cao@huawei.com>
2021-06-11 00:20:09 +08:00
openharmony_ci
7ffc996b0a !311 fix: 3518平台, 异常测试进程无法正常退出
Merge pull request !311 from zhushengle/exit
2021-06-10 20:54:37 +08:00
zhushengle
23937a239f fix: 3518平台, 异常测试进程无法正常退出
用户态线程在用户态处于while(1), 在中断处理时使该线程处于READY状态,
此时进程退出时该线程无法被正常回收,导致进程无法合理退出。

Close #I3V8R5

Change-Id: I7f83f5f7fe41c03eb602bf78cfd33fff1b0acdb7
Signed-off-by: zhushengle <zhushengle@huawei.com>
2021-06-10 20:11:36 +08:00
openharmony_ci
b91fabb76c !292 新增link/symlink/readlink接口的系统调用及内核实现
Merge pull request !292 from JING/link
2021-06-10 13:02:04 +08:00
openharmony_ci
e36b0fd4d5 !307 feat: support toybox in qemu
Merge pull request !307 from MGY917/toybox_active
2021-06-10 06:04:14 +08:00
openharmony_ci
4e269d7071 !304 mmc驱动代码上库
Merge pull request !304 from liangxuewu/MMC_DRIVER_PRJECT
2021-06-09 20:46:02 +08:00
chenjing
6eddc869d3 feat: support link/symlink/readlink
新增link/symlink/readlink接口的系统调用及内核实现,当前仅支持jffs2文件系统。具体接口说明如下:

一、hard link
接口原型:
int link(const char *oldpath, const char *newpath);
int linkat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, int flags);

作用:
创建oldpath的硬链接,名为newpath。

功能说明:
1、newpath与oldpath必须在同一挂载分区内。
2、若newpath已存在,不会覆盖,错误码EEXIST。
3、oldpath必须为普通文件或者软链接文件。
4、如果oldpath是一个软链接文件,那么:
若调用link接口或者linkat(flags=0),创建出软链接文件的硬链接;
若调用linkat(flags = AT_SYMLINK_FOLLOW),创建出软链接所指向源文件的硬链接。
5、oldpath与newpath对应同一个文件,对oldpath与newpath任一名字的操作都是直接操作文件,没有“原始文件”的说法。
6、使用cp命令拷贝一个硬链接文件,生成文件的拷贝,新文件的nlink数为1。
7、删除oldpath或newpath,底层文件仍存在,可以通过另一个path访问。只有当两个path都删除之后,才会真正将文件删除,空间释放。

二、symbol link
接口原型:
int symlink(const char *target, const char *linkpath);
int symlinkat(const char *target, int newdirfd, const char *linkpath);

作用:
创建一个软链接文件linkpath,存储字符串target。

功能说明:
1、target可以为任意字符串(长度小于PATH_MAX)。
2、若linkpath文件名已存在,不会覆盖,错误码EEXIST。
3、用readlink函数可读取软链接的target内容。
4、软链接文件本身大小为target长度。
5、ls时软链接文件类型显示为 'l'。
6、symlink最大循环次数为CONFIG_FS_MAX_LNK_CNT(目前为40),超出则返回错误,错误码ELOOP。
7、使用cp命令拷贝一个软链接文件:
若target是一个文件:创建一个源文件的拷贝,类型为普通文件;
若target非文件:拷贝失败。

三、readlink
接口原型:
ssize_t readlink(const char *pathname, char *buf, size_t bufsiz);
ssize_t readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);

作用:
读取软链接文件存放的的target内容。

功能说明:
1、pathname必须为软链接文件,否则错误码EINVAL。
2、如果bufsiz小于target长度,则截断target。

close #I3Q0OD

Change-Id: I3864d6069b627b705a369e8e32dc1eb922dc0157
Signed-off-by: chenjing <chenjing139@huawei.com>
2021-06-09 16:39:41 +08:00
Guangyao Ma
561831928b feat: support toybox in qemu
Close #I3V17D

Change-Id: Idfe47eedd4b7c84cc2d15b5f3365d90a5b79232e
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-06-09 16:11:21 +08:00
openharmony_ci
6dee4ae603 !277 README_zh.md: update the incorrect link
Merge pull request !277 from zhangyanxian/master
2021-06-09 14:05:07 +08:00
openharmony_ci
413e02304d !261 fix(build): clang10.0.1支持lto,去掉冗余判断
Merge pull request !261 from SimonLi/fix-lto
2021-06-09 14:03:52 +08:00
openharmony_ci
8c5b358bb1 !263 fix(build): 去除冗余单板相关的宏配置
Merge pull request !263 from SimonLi/fix-redundant-macro
2021-06-09 14:02:52 +08:00
openharmony_ci
3bf8cbc728 !301 修复SysOpenat返回的文件句柄不正确的问题
Merge pull request !301 from JING/openat
2021-06-09 13:50:40 +08:00
openharmony_ci
36462bcd7e !305 内核态在console初始化完成后,使用printf无法正常打印
Merge pull request !305 from zhangfanfan2/master
2021-06-09 13:46:19 +08:00
openharmony_ci
1f8e5424f3 !306 refactor(mksh): reduce the mksh size by Oz
Merge pull request !306 from MGY917/mksh_size_reduce
2021-06-09 13:43:38 +08:00
openharmony_ci
ebb1305ba4 !288 修复shm用例多次执行时失败问题
Merge pull request !288 from lnlan/shm_test_fixed
2021-06-09 09:31:04 +08:00
Guangyao Ma
565b2e85cd refactor(mksh): reduce the mksh size by Oz
clang不支持“-flto,-Oz”作为链接选项,但是可以作为编译选项,且作为编译选项时,有更好的size减少效果。这里为了使用这种
编译选项组合,且为了不影响链接过程(Build.sh链接时也会使用CFLAGS),在链接选项生效的-O选项中,重置其为O2。
最终size可以从300+k,缩减为不到180k。

Close #I3UVEV

Change-Id: If29ac4a058bcd40c4c36deb484c9468c93bcd1ec
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-06-08 21:57:27 +08:00
YOUR_NAME
44ce696904 fix: 内核态在console初始化完成后,使用printf无法正常打印
printf实现流程上会调用cmd为TIOCGWINSZ的ioctl命令,该命令的实现
在console层ConsoleGetWinSize函数中,而此函数copy结果时使用函数
LOS_ArchCopyToUser,由于该过程在内核态,导致LOS_ArchCopyToUser失败,
从而引发printf无法正常打印的问题。

close: #I3UG00

Signed-off-by: zhangfanfan <zhangfanfan2@huawei.com>
Change-Id: I3e85f682429cbe30842206842ddb2a8388ec8412
2021-06-08 20:01:39 +08:00
lzl
3fa315ab0b mmc kernel adapter
Signed-off-by: lzl <sucer_fater@163.com>
2021-06-08 09:54:06 +00:00
lzl
e5ba92b4b9 mmc kernel adapter
Signed-off-by: lzl <sucer_fater@163.com>
2021-06-08 09:50:36 +00:00
lzl
6352d6e1da kernel adapter
Signed-off-by: lzl <sucer_fater@163.com>
2021-06-08 09:07:04 +00:00
openharmony_ci
1a3f3f54e7 !302 fix: Codex告警清零
Merge pull request !302 from Far/master
2021-06-08 08:48:48 +08:00
openharmony_ci
7d10057103 !300 codex问题修复
Merge pull request !300 from LeonChan/master
2021-06-08 08:48:30 +08:00
openharmony_ci
a94c6b09bd !303 对toybox侵入式修改进行分离
Merge pull request !303 from Kiita/toybox_porting_210607
2021-06-07 23:06:23 +08:00
openharmony_ci
647f3defcd !296 支持最小化特性编译,添加了一个针对qemu arm virt的样例config配置
Merge pull request !296 from Caoruihong/master
2021-06-07 22:51:46 +08:00
chenwei
101a55d119 fix: codex
1,VFS代码中不修改参数增加const修饰
2,fs_file_mapping.c: 增加安全函数的判空
3,path_cache.c: sizeof改为使用类型
4,fs_syscall.c: 对NULL解引用
5,VnodeLookup:冗余的判空,及不正确的判空

close: I3UMWD
Signed-off-by: yansira <yansira@hotmail.com>
2021-06-07 22:45:40 +08:00
Kiita
09756fe55b refactor: 对toybox侵入式修改进行分离
【背景】当前liteos_a支持的toybox命令与linux存在差别,需要特别实现,为
避免侵入式修改,采用porting的方式将修改分离。

【修改方案】
在third_party/toybox下新增porting目录,以达到分离修改的目的。本次修改
基于porting目录且只涉及liteos目前支持的命令文件。

re #I3UQCK

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: I15d5835e25d5b5de6e0a6f888c87264c2f886cdf
2021-06-07 21:54:12 +08:00
chenjing
3457c0b11d fix: SysOpenat返回值应该为进程fd,而非系统全局fd。
close #I3TNAK

Signed-off-by: chenjing <chenjing139@huawei.com>
Change-Id: Ie754259ead7fc8f4c3b0fa36ef31969dd728b235
2021-06-07 19:50:33 +08:00
lnlan
0676578aae fix(kernel_test): 内核mem/shm冒烟用例重复运行失败
【背景】内核mem/shm冒烟用例概率性失败门禁中shm冒烟用例失败,经验证
与构建,不符合预期

【修改方案】
原内核用例的源文件是通过框架自带的source_set(一种虚拟静态库)的方式组织的,
不受unittests(自定义的一种方式)控制,修改为文件列表直接加入到unittest中。

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

re #I3TH4W

Signed-off-by: lnlanc <lanleinan@163.com>
Change-Id: If5452adb033c17ee0d7c7f683968fe53013ee289
2021-06-07 18:51:28 +08:00
Far
b5370af822 fix: codex clean
1. 修复可能对NULL指针解引用的场景
2. 将不修改内容的指针入参修改为const
3. 对getpgrp的返回值进行校验后再使用
4. 修复了局部变量未初始化的问题

Close #I3UOFN

Signed-off-by: Far <yesiyuan2@huawei.com>
2021-06-07 17:08:02 +08:00
Caoruihong
744b2021b2 chore: add a mini config for qemu arm virt
support turn off as many features as possible.
current only libc and posix and bsd can not be turned off.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I1e97570c67593207a56dc11f357eca4b4a018bfd
2021-06-05 17:40:22 +08:00
openharmony_ci
c39c10c978 !294 最新1.1版本的代码3516编译报错: Disk full
Merge pull request !294 from zhangfanfan2/master
2021-06-05 17:38:20 +08:00
openharmony_ci
efbab200aa !254 memory-based romfs
Merge pull request !254 from LeonChan/lc-master
2021-06-04 23:22:25 +08:00
openharmony_ci
a580754751 !295 修复删除/dev目录下的文件但是vnode number没有减小的问题
Merge pull request !295 from LeonChan/lc-bugfix-vnode
2021-06-04 21:50:32 +08:00
openharmony_ci
e5bfe19b28 !289 A核proc文件系统在echo模式下新增write的功能
Merge pull request !289 from li_zan/master
2021-06-04 18:10:24 +08:00
chenwei
4f514a16af fix: the total used vnode number not increased after unlink a file under
/dev/

fix #I3TS1Y
Signed-off-by: yansira <yansira@hotmail.com>
2021-06-04 16:49:04 +08:00
chenwei
c4595d2504 feat(file system): add memory-based romfs
1, this RomFS's codebase is Nuttx romfs, then it is compatible with
Linux RomFS and you can create such a file system using the tool genromfs.
2, there are two major changes against with the original Nuttx romfs:
    1), it is memory-based: all contents of the fs are stored in the
        memory in the very first stage of "mount".
    2), this version of romfs is altered to be compatible with our new
        version of VFS to take advantage of vnode cache and path cache.

close: #I3S0CP
2021-06-04 16:39:51 +08:00
openharmony_ci
eb7d977b3e !290 timer_create支持SIGEV_THREAD
Merge pull request !290 from Kiita/timer_create_0603
2021-06-04 16:34:56 +08:00
li_zan
f10dd7c135 feat: A核proc文件系统在echo模式下新增write的功能
close: #I3T6MZ

Signed-off-by: li_zan <371442490@qq.com>
2021-06-04 16:14:18 +08:00
Kiita
e5f6bf0556 feat: timer_create支持以SIGEV_THREAD方式创建定时器
【背景】当前timer_create接口不支持以SIGEV_THREAD的方式创建多个定时器

【修改方案】
1、内核timer_create接口在创建software timers相应的线程时,使用线程
taskCB所携带的信息识别各个线程的信号并依据该信息分别派发出信号。
2、关于用户任务操作许可验证的修改,现在允许同一用户线程向其自身派发信
号,软件定时器计时结束,向用户态发送相应的信号,完成用户态线程的回调。

【影响】
对现有的产品暂无影响。

re #I3SRFI

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: Ia23f5ef01975bf867dd7f5db797a30c264c50501
2021-06-04 15:29:44 +08:00
YOUR_NAME
c54879b548 fix: 解决不同环境下计算的rootfs的size偏小,导致mcopy造成的disk full错误
构建环境的分区文件系统格式不同,会引起du命令计算文件夹size不同,当制作fat格式
的rootfs时,计算的rootfs文件夹的size比fat格式下的小, 则会导致mcopy过程出现
disk full错误。当前通过修正du计算的rootfs文件夹size的方式处理该问题。

close: #I3IA06

Signed-off-by: YOUR_NAME <zhangfanfan2@huawei.com>
Change-Id: I19c66e35c4382d768e020531a869e1e9186032a7
2021-06-04 14:53:09 +08:00
openharmony_ci
e93c52c091 !273 修复timer用例引起用户态挂死
Merge pull request !273 from lnlan/master0524
2021-06-04 13:56:11 +08:00
openharmony_ci
042f06e2b1 !260 【轻量级 PR】:fix: fix stored typo
Merge pull request !260 from jmxl/N/A
2021-06-04 13:54:53 +08:00
lnlan
0db43f24f5 fix(kernel_test):内核门禁稳定性调整,失败用例移除
【背景】
timer两条用例会导致测试进程异常退出

【修改方案】
将TIME_TEST_TZSET_001和TIME_TEST_TZSET_002两条用例从门禁中去掉

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

re #I3SP0J

Signed-off-by: lnlanc <lanleinan@163.com>
Change-Id: Iad89b8ef4260a8d3202c496a39f3a185aec6744e
2021-06-03 19:42:08 +08:00
openharmony_ci
2067b2f648 !256 fix: 解决kill进程时无法保证进程持有的系统资源合理释放
Merge pull request !256 from zhushengle/Sig
2021-06-03 17:00:00 +08:00
openharmony_ci
e59693e7fa !278 修复开机概率挂死
Merge pull request !278 from Zhaotianyu/0603initframework_fix
2021-06-03 14:50:39 +08:00
openharmony_ci
4d07d2e954 !274 优化内核用例架构
Merge pull request !274 from lnlan/notest_nobuild
2021-06-03 14:39:07 +08:00
openharmony_ci
db38464778 !282 fix: 修复MagicKey数组越界访问
Merge pull request !282 from MGY917/master
2021-06-03 11:52:17 +08:00
Guangyao Ma
071cd6268a fix: 修复MagicKey数组越界访问
closes #I3U4N9

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: Ic4c4c7442cd381d03d2e40a51655a17299c4c250
2021-06-03 11:11:21 +08:00
arvinzzz
2e82c361f7 fix: 修复开机概率挂死
close:#I3SWY2

Change-Id: Ied2a5828ffb682903e291dab4088020033d79230
Signed-off-by: arvinzzz <fcykztyu@163.com>
2021-06-03 09:43:27 +08:00
zhangyanxian
a00cce8128 README_zh.md: update the correct links
当前链接点进去后会提示:你所访问的页面不存在!
更新正确的链接信息

Signed-off-by: zhang yanxian <zhangyanxianmail@163.com>
2021-06-03 09:24:50 +08:00
openharmony_ci
25f1051d7a !269 修复启动框架debug模式编译问题
Merge pull request !269 from Zhaotianyu/0526initframework_fix
2021-06-02 16:50:35 +08:00
arvinzzz
4c024159a9 fix: 修复启动框架debug模式下-Werror=maybe-uninitialized告警以及符号链接不进镜像的隐患
close: #I3T5HR
Change-Id: I2e2452d59c82726614fb78d1177d3f0f03d6e315
Signed-off-by: arvinzzz <fcykztyu@163.com>

Change-Id: I7f0b44c15a296bd8d15f0bf1fbdde60f67bb0a6c
2021-06-02 09:31:51 +08:00
lnlan
9bdf716407 feat(build): 使用xts -notest选项时,内核用例不参与编译构建和用例编译配置方式调整
【背景】
1.编译新增-notest选项为了排除用例参与构建,使用该选项时内核用例仍会参与构建,不符合预期
2.用例编译配置选项太多,需调整优化
【修改方案】
1.原内核用例的源文件是通过框架自带的source_set(一种虚拟静态库)的方式组织的,
不受unittests(自定义的一种方式)控制,修改为文件列表直接加入到unittest中。
2.编译配置通过level控制
【影响】
对现有的产品编译不会有影响。

Change-Id: I2c6a96e7276346de96f222b725d417418ff0e537
2021-05-29 17:58:39 +08:00
zhushengle
cf89f016e9 fix: 解决kill进程时无法保证进程的已持有的内核资源合理释放.
背景: 当前信号实现原理是在系统调用结束和中断结束时检查是否有信号处理,
      如果有信号处理就切去处理信号,信号处理结束后回来继续按原来流程执行。
问题:当用户态线程在执行系统调用或缺页异常时,运行在内核态,如果此时有信
      号需要处理,且该线程已经持有了部分内核资源(如:锁,内存等), 此时如
      果有中断发生,则在中断结束时,就会去处理该信号,此时用户态线程持有
      了内核未释放的资源跑到了用户态去运行,如果该线程在用户态出现问题,
      那么它持有的内核资源就无法被释放了。
方案:用户态线程在执行系统调用和缺页异常时暂时屏蔽信号,防止此时有中断去
      处理信号,等系统调用结束或缺页异常结束时再去处理信号。
解决的问题:
  1. 执行系统调用或缺页异常时屏蔽信号,防止中断去处理信号
  2.解决无法kill 因为用户态的锁、ipc等阻塞的用户态线程
  3.进程退出方式转变为: 依次通过kill去杀死该进程的所有线程

Close #I3S0N0

Change-Id: I0c48b9c89382826191b8a9326c71b57ba84124c2
2021-05-24 14:29:37 +08:00
openharmony_ci
3f16f1684a !248 fix: fix length typo
Merge pull request !248 from kenneth/los_queue.h
2021-05-22 09:13:46 +08:00
openharmony_ci
bfc788e27b !267 关闭jffs和fat后,rootfs配置也被相应关闭,导致nand介质的rootfs不可用
Merge pull request !267 from zhangfanfan2/master
2021-05-21 23:26:15 +08:00
zhangfanfan2
0ea476b974 fix: 关闭jffs和fat后,rootfs配置也被相应关闭,导致nand介质的rootfs不可用。
close: #I3SBYN
2021-05-21 17:41:30 +08:00
openharmony_ci
f5c5a69162 !265 删除exc interaction残留宏以及无用函数声明
Merge pull request !265 from Zhaotianyu/0521
2021-05-21 16:21:16 +08:00
openharmony_ci
a3cef3f176 !264 补充TODOList
Merge pull request !264 from Denny/DennyShen-master-patch-73167
2021-05-21 15:17:08 +08:00
arvinzzz
d2f2679071 fix: Delete useless 'exc interaction' macros and function declarations.
close: #I3SDKY

Change-Id: I5ed9356ce2b55b6e07c3f192cdbc4a4f6fbfaa58
2021-05-21 15:10:05 +08:00
Denny
2a3e6b6d12 update TODOList.md. 2021-05-21 15:01:20 +08:00
Denny
7388c746a8 update todolist 2021-05-21 15:00:44 +08:00
Denny
5e3b50497a add todolist 2021-05-21 14:21:15 +08:00
SimonLi
471de3663e fix(build): 去除冗余单板相关的宏配置
编译工具链的选项不应该依赖单板的宏,否则每增加一块单板都需要去新增配置。

NULL_ADDRESS_PROTECT这个宏配置没有地方使用,去掉冗余宏,内存是一一映射,可以
访问0地址,且不会立马报错,需要这个功能,现在不是一一映射,而且访问空指针会
立马报错,所以不存在这个问题。
2021-05-21 12:30:51 +08:00
SimonLi
73223ae7e6 fix(build): clang10.0.1支持lto,去掉冗余判断 2021-05-21 11:21:19 +08:00
jmxl
d25560f8ac fix: fix stored typo 2021-05-21 10:16:04 +08:00
openharmony_ci
9b364500ad !252 删除冗余宏定义OFFSET_OF_FIELD
Merge pull request !252 from JerryH/list
2021-05-21 09:54:18 +08:00
openharmony_ci
04ecd87a23 !229 内核启动重构,新增启动框架
Merge pull request !229 from Zhaotianyu/0510init_framework
2021-05-20 19:33:23 +08:00
openharmony_ci
419f467df1 !259 删除问题冒烟用例
Merge pull request !259 from give-me-five/master
2021-05-20 19:14:23 +08:00
openharmony_ci
61f2c55476 !259 删除问题冒烟用例
Merge pull request !259 from give-me-five/master
2021-05-20 19:14:22 +08:00
give-me-five
21fca7c546 update testsuites/unittest/process/mutex/process_mutex_test.cpp. 2021-05-20 18:54:14 +08:00
arvinzzz
8cde768588 refactor: Refactored the kernel boot process and added a init framework
close: #I3I768

Change-Id: I4f801df4abe1a9afdf43391c28276e96a5e81513
2021-05-20 16:45:43 +08:00
openharmony_ci
8a48f4926a !249 kernel/extended/trace/los_trace.c中可能存在空指针访问
Merge pull request !249 from boxi/upload
2021-05-19 14:46:18 +08:00
kenneth
2b643b04c1 fix:fix queuePosition typo 2021-05-19 14:05:28 +08:00
openharmony_ci
6f99abfc7b !222 fix: correct spelling
Merge pull request !222 from rtos-lover/los_task
2021-05-19 13:46:10 +08:00
YOUR_NAME
9b4129c949 Remove redundant macro definition(OFFSET_OF_FIELD)
Close #I3QMN1

Change-Id: I0ddd0c4474f5f6b5a2b1dd6608d642167b5548e6
2021-05-19 11:20:09 +08:00
openharmony_ci
a5de5e0cff !251 fix: clang10 lld could not recognized Oz
Merge pull request !251 from MGY917/master
2021-05-19 11:14:19 +08:00
openharmony_ci
e1d427f8c8 !245 删除无效代码
Merge pull request !245 from Zhaotianyu/0517
2021-05-19 10:33:49 +08:00
openharmony_ci
001fdd9511 !250 signal门禁用例调整
Merge pull request !250 from vcbchang/master
2021-05-19 09:47:07 +08:00
Guangyao Ma
87a0006d5e fix: clang10 lld could not recognized Oz
Change-Id: I73055c0d9b9ceb27adb687089be4d332ec323b9c
2021-05-19 09:37:38 +08:00
kenneth
a68295d2a9 fix:change queuePosion to queuePosition 2021-05-19 08:38:33 +08:00
x_xiny
8c8a0b398d fixed the textsuite
Change-Id: Idb93d3cf8d236a3b7f13d95d08255208c04706dd
2021-05-18 22:30:32 +08:00
boxi
4d863e985b fix: Fix wrong judgment in los_trace.c to avoid null pointer access.
Fix wrong judgment in los_trace.c to avoid null pointer access.

Close #I3RT9F

Change-Id: Id37b80fc6acc085205695318232d5f4fd75472aa
2021-05-18 17:21:47 +08:00
openharmony_ci
d632356413 !206 fix time mould-kernel:fix 2 api clock_gettime、clock_getres
Merge pull request !206 from guweijie/master
2021-05-18 15:15:58 +08:00
kenneth
12d98b144b fix: fix length typo
fix typos length、there、necessary

close https://gitee.com/openharmony/kernel_liteos_a/issues/I3RSY0
2021-05-18 14:33:59 +08:00
guweijie
2534c86d6f Merge branch 'master' of gitee.com:openharmony/kernel_liteos_a into master 2021-05-18 09:56:42 +08:00
teamol
e8427a45c5 fix time mould-kernel:fix 2 api clock_gettime、clock_getres
Change-Id: I260e47c895ced01e033ef8a824744e574887c9f5
2021-05-18 09:51:11 +08:00
openharmony_ci
e7c0c5173a !246 fix: fix function name OsSchedSetIdleTaskSchedParam
Merge pull request !246 from kenneth/master
2021-05-18 09:30:24 +08:00
kenneth
8f8c038b21 fix: fix function name OsSchedSetIdleTaskSchedParam
correct function name OsSchedSetIdleTaskSchedParam

close https://gitee.com/openharmony/kernel_liteos_a/issues/I3RQ6J
2021-05-18 09:02:48 +08:00
openharmony_ci
471e47c1c2 !244 用例框架完善
Merge pull request !244 from lnlan/test_fixed
2021-05-17 20:07:49 +08:00
arvinzzz
fe05df40ae fix: Remove redundant invalid codes
close: #I3R70T
Change-Id: Idec4ba2f692cf357368c2fa437dddeba945f2e07
2021-05-17 14:34:09 +08:00
lnlan
fbe98af997 fixed that LOSCFG_USER_TEST_SMP is unuseful
Change-Id: Ib6bd11fbeaac88e69de663a7a3f2d01ac1fe9042
2021-05-15 17:16:29 +08:00
openharmony_ci
854a0c53c3 !235 删除menuconfig中无用的模块配置
Merge pull request !235 from lnlan/ktest_fixed
2021-05-15 10:13:54 +08:00
openharmony_ci
29fc5b3e3d !236 fix: modify event API description
Merge pull request !236 from MGY917/event
2021-05-15 10:05:46 +08:00
openharmony_ci
8b7d1a70a4 !238 优化mksh编译问题
Merge pull request !238 from SimonLi/fix-mksh-build
2021-05-15 10:04:37 +08:00
openharmony_ci
616ca955d5 !220 statfs不能正常显示FAT12和FAT16分区的空闲块和有效块
Merge pull request !220 from Far/fatfs
2021-05-15 10:01:28 +08:00
openharmony_ci
fa273ca817 !242 解决内存泄漏检测错误判断及删除冗余判断
Merge pull request !242 from JerryH/mem
2021-05-14 16:07:28 +08:00
openharmony_ci
935aada8bb !241 修复内核缺页异常处理导致系统异常
Merge pull request !241 from zhushengle/exc
2021-05-14 16:01:14 +08:00
马明帅
e70c0b7f0f !240 适配LLVM工具链10.0.1版本升级
Merge pull request !240 from pengzhuoli/master
2021-05-14 14:44:27 +08:00
YOUR_NAME
8da10b9439 Fix memory leak check and interity error check.
Delete redundant judgments.

Close #I3P10Y and #I3QNLT

Change-Id: Ibaf5d4da46f12c291619bb88a41ac18af4612ca1
2021-05-14 14:42:41 +08:00
zhushengle
a89fb57f57 fix: Fix kernel page fault exception handling causing system exception.
Close #I3RAN4

Change-Id: Ice9bc67371ad85476ec99b46b7555d41abd93e94
2021-05-14 13:12:57 +08:00
openharmony_ci
8d419bb029 !239 quickstart节点实现优化
Merge pull request !239 from boxi/master
2021-05-14 11:50:38 +08:00
zhuoli
967607e1c8 Update search path in llvm 2021-05-14 10:42:32 +08:00
teamol
a53ad12907 fix time mould by ChinaSoft Team
Change-Id: I391eccfa8591feb95dcb5b74fba3788f63b981bf
2021-05-14 10:39:59 +08:00
boxi
4abd2e0247 fix: Optimize quickstart node implementation
Adjust QuickstartListen parameters:
1.delete monitored process pid
2.add timeout waiting

Close #I3R8O8

Change-Id: I89c8626c80b8d6fdaea7cd46029dd9a34b555d37
2021-05-14 09:10:08 +08:00
openharmony_ci
d724a975b5 !234 用户态异常处理,进程退出时恢复系统正常运行的过程依赖编译器行为,存在风险
Merge pull request !234 from zhushengle/exc
2021-05-14 07:13:33 +08:00
SimonLi
e38f9a98c9 fix: mkdir -p is more robust 2021-05-13 19:20:26 +08:00
SimonLi
bef4ab9835 fix: rebuild mksh depends on rebuild.sh script 2021-05-13 19:03:43 +08:00
openharmony_ci
842399a4af !225 fix: do not build toybox temporarily
Merge pull request !225 from MGY917/master
2021-05-12 08:09:57 +08:00
Guangyao Ma
937734b1e9 fix: modify event API description
Change-Id: I131c70e52d907b6c52232596475f2dba16612fce
2021-05-11 21:09:24 +08:00
Guangyao Ma
044f2c7c17 fix: do not build toybox temporarily
Change-Id: I5fc289f6f657fe8dfad0131df51571892749d172
2021-05-11 20:42:37 +08:00
lnlan
0cf9748ce0 delete useless module in Kconfig
Change-Id: I748e6e82c4a09cdbbae741da668cf2bec0406690
2021-05-11 20:22:05 +08:00
zhushengle
e840188a65 fix:User-mode exception handling runs on the thread's SVC stack.
Close #I3QFXL

Change-Id: Iaa036651415d93df231916d7534364ad3a86ed3c
2021-05-11 17:19:10 +08:00
openharmony_ci
bcf7a0701a !223 add testsuites/kernel to build
Merge pull request !223 from lnlan/ktest_fixed
2021-05-11 17:02:03 +08:00
openharmony_ci
122517716e !231 冒烟用例从全量用例分离出,用于门禁看护
Merge pull request !231 from lnlan/test_bin_change_name
2021-05-11 17:01:58 +08:00
openharmony_ci
fdbd0820c2 !232 support ipc copy fd to process
Merge pull request !232 from zhOu/master
2021-05-11 15:46:37 +08:00
zhOu
f76fa4a344 feature: support ipc copy fd to process 2021-05-11 14:56:09 +08:00
openharmony_ci
ca5555e6a5 !190 fix:solve the coupling between the kernel and the structure under ARCH
Merge pull request !190 from zhushengle/Stack
2021-05-11 11:46:40 +08:00
lnlan
b27264b9f3 add testsuites/kernel to build
Change-Id: Ia14a3413b6c974771cef2e147083c7748abd1c59
2021-05-11 11:42:41 +08:00
lnlan
3aa14c9ae7 full & smoke separate
Change-Id: I885610a62b980bd3720b337aced886450338bdcf
2021-05-11 11:06:14 +08:00
zhushengle
1e308db64e fix:Fixed exception not saving stack pointer of SVC mode and abnormal signal processing issues
Close #I3OAFR

Change-Id: I25b14572809b6fabb9e9d17de89a99047c02a59b
2021-05-11 09:58:54 +08:00
openharmony_ci
5ce46e2499 !228 用例镜像添加_door
Merge pull request !228 from lnlan/test_bin_change_name
2021-05-10 22:19:21 +08:00
lnlan
f99e7b3388 test image change name, add _door
Change-Id: I5fd518e2e84df1d524d9405b665306cce485eb63
2021-05-10 21:19:36 +08:00
rtos-lover
c66fe0313f fix: correct spelling
correct some typos in los_task.c and other files

close https://gitee.com/openharmony/kernel_liteos_a/issues/I3QDB8
2021-05-08 11:23:08 +08:00
Far
9503c4a9fc fix: statfs can't get f_bfree and f_bavail of a FAT12/FAT16 partition
FAT12/FAT16 partition has no FSINFO sector storing the free cluster number,
so scanning the FAT is necessary to get the free clusters nums.

Close #I3Q0VS
2021-05-08 10:02:55 +08:00
openharmony_ci
6012acb509 !218 fix: console compile bug fix
Merge pull request !218 from MGY917/master
2021-05-07 12:52:39 +08:00
Guangyao Ma
f8441a0cde fix: console compile bug fix
Change-Id: I4c895bf7278b50d7ddf65e9556d77221b0c7ca32
2021-05-07 11:38:07 +08:00
openharmony_ci
f375e50f2d !133 feat: introduce mksh toybox to rootfs
Merge pull request !133 from MGY917/master
2021-05-07 10:31:08 +08:00
zhushengle
f6c4f6f5da fix: Solution of conflict
Change-Id: If6304999f1dfbcdfbc1670b73ace61b8024336bd
2021-05-06 21:10:22 +08:00
openharmony_ci
27ab6247a6 !216 fix telnet
Merge pull request !216 from 野生毛霉君/master
2021-05-06 20:46:12 +08:00
openharmony_ci
be4d8e74cc !201 系统异常信息保存到存储介质中的功能从shell依赖中剥离
Merge pull request !201 from zhangfanfan2/master
2021-05-06 20:44:32 +08:00
mucor
e03370f6ef fix:telnet not work
add open in console dev init process

Change-Id: Ibf9801462d6de231001f094d4e75f01cad50da1f
2021-05-06 19:54:42 +08:00
Guangyao Ma
41c7689dfa feat: introduce mksh toybox to rootfs
Change-Id: I0a6e6f2962ca6904c858898eb93a5b2f93e85b69
2021-05-06 19:20:35 +08:00
openharmony_ci
41f207516e !215 fix: Sortlink, the response time to insert the node should be inserted into the back of the existing node.
Merge pull request !215 from zhushengle/sortlink
2021-05-06 19:16:12 +08:00
YOUR_NAME
d846035f3e feature:the feature of saving system exception information to the
storage medium is separated from the shell module.

Change-Id: Id56939001d70bb92d9cc02bd7c9f55ca8b61cf5b
2021-05-06 15:18:15 +08:00
openharmony_ci
6cf17edfac !211 Delete redundant code
Merge pull request !211 from Harylee/update_osal
2021-05-06 14:42:18 +08:00
openharmony_ci
78f1de69f4 !211 Delete redundant code
Merge pull request !211 from Harylee/update_osal
2021-05-06 14:42:17 +08:00
openharmony_ci
aa8d38ce38 !214 quickstart中返回值处理错误
Merge pull request !214 from boxi/master
2021-05-06 14:19:02 +08:00
boxi
0e0ab81ff9 fix: Correctly handle the return value of LOS_EventRead in QuickstartListen.
Correctly handle the return value of LOS_EventRead in QuickstartListen.

Close #I3PSLZ

Change-Id: I7b9ab9aa0542b6072dcbe8fa78924125b95c6434
2021-05-06 11:09:04 +08:00
zhushengle
1323874389 fix: Sortlink, the response time to insert the node should be inserted into the back of the existing node.
Close #I3PSJ8

Change-Id: Ib630ba4febbc21d4f25af0961f5c996eadf4e054
2021-05-06 11:02:36 +08:00
openharmony_ci
58e5632714 !213 补充unregister_driver实现
Merge pull request !213 from 野生毛霉君/master
2021-05-06 10:19:06 +08:00
openharmony_ci
92a2aa6f77 !208 用例框架完善,问题用例修复
Merge pull request !208 from lnlan/test_fixed
2021-05-05 10:17:04 +08:00
openharmony_ci
db16ef1430 !207 错误码不符合预期问题修复
Merge pull request !207 from lnlan/ker_fixed
2021-05-05 10:16:01 +08:00
openharmony_ci
e52144539b !212 优化quickstart节点权限
Merge pull request !212 from boxi/master
2021-04-30 16:13:06 +08:00
boxi
4e24b57289 fix: Optimize /dev/quickstart permissions.
Optimize /dev/quickstart permissions.

Close #I3OYUQ

Change-Id: Ie2847efeb5dddf2bbea0251cca39bb7cb973e3f6
2021-04-30 15:43:32 +08:00
mucor
04bcb11c3c fix:add vnode destory for unregister dev node
Change-Id: I2205bbf42e7c2339f81443ace6924b12f4fa1c09
2021-04-30 15:31:03 +08:00
lnlan
6fe4a3f946 testsuites fixed
Change-Id: I7f4add72f2fd1cc3770bcf103d1909add4829822
2021-04-30 15:07:26 +08:00
openharmony_ci
206f818666 !210 补充Dac的ReadAndSearch用例
Merge pull request !210 from 野生毛霉君/master
2021-04-30 10:39:49 +08:00
Haryslee
022768ab58 Delete redundant code
Change-Id: Id75a1b146766f448838afc80ad11cfd9d990e94e
2021-04-30 10:21:49 +08:00
mucor
e64e1e7260 add testcase for capability ReadSearch
Change-Id: I19834ced919e7f03a7ac9862bfbaf360637e29bf
2021-04-30 09:30:01 +08:00
openharmony_ci
2fb1f0e77c !209 修复/userdata分区擦除后重启,无法挂载的问题
Merge pull request !209 from JING/camera
2021-04-29 21:02:47 +08:00
openharmony_ci
de3b0d7fb4 !204 添加umask时open/creat文件的权限检查测试用例
Merge pull request !204 from JING/master
2021-04-29 21:02:25 +08:00
JING
c14d95f8b5 revert irrelevant commit 2021-04-29 20:22:12 +08:00
JING
4b0e47fd03 修复/userdata分区擦除后无法挂载的问题
issue#I3O8IF的修改中,将fat无法识别的格式错误码由ENOENT改为ENOTSUP。此处修改有遗漏,造成无fat格式的userdata分区无法挂载。
2021-04-29 20:09:06 +08:00
lnlan
89e9820189 fixed, to set errno in mq_receive and shm_get
Change-Id: Iecd1a896f92522ecc75d099c23761969a83b1d29
2021-04-29 19:41:15 +08:00
openharmony_ci
c1b2b3c73e !203 fix rm -r crash when opendir failed
Merge pull request !203 from 野生毛霉君/master
2021-04-29 19:07:04 +08:00
JING
68f62d9de8 add umask open/creat test 2021-04-29 18:12:41 +08:00
JING
3d77526160 add umask open/create test 2021-04-29 17:30:43 +08:00
mucor
749420308e fix:shell cmd rm -r crash when open target dir failed
Change-Id: I1146ab12b02aeef3f9a2a0422ee45936f5e4c105
2021-04-29 16:52:13 +08:00
openharmony_ci
8592e04c78 !198 优化quickstart宏定义
Merge pull request !198 from boxi/master
2021-04-29 14:09:51 +08:00
boxi
cb140a4442 fix: Optimiz macro of quickstart cmd
Optimiz macro of quickstart cmd.

Close #I3OSYT

Change-Id: I5b96823c6ec7f7eab2c0a80eda8ad30bcf2b9d32
2021-04-29 11:40:01 +08:00
openharmony_ci
1d0a3f022b !186 将VnodeInUseIter和VnodeFreeAll函数改为非递归
Merge pull request !186 from Far/dev
2021-04-29 10:04:50 +08:00
openharmony_ci
6467ebb2dd !194 PathCacheMemoryDump内存占用统计错误
Merge pull request !194 from Far/master
2021-04-29 09:58:45 +08:00
openharmony_ci
67f9f7506c !192 format函数错误分支未释放锁
Merge pull request !192 from Far/fatfs
2021-04-29 09:57:58 +08:00
openharmony_ci
673918d0fc !196 修改quickstart中codingstyle
Merge pull request !196 from boxi/master
2021-04-28 21:14:17 +08:00
boxi
2e011b672f fix: Fix quickstart codingstyle
Fix quickstart codingstyle

Close #I3OPOM

Change-Id: I062e569b64e7cb3eb5e2d59ecadfe58b9055ef2d
2021-04-28 20:37:29 +08:00
openharmony_ci
b78b185e07 !193 新增/dev/quickstart节点,作为用户态根进程与其他进程的启动同步通信节点
Merge pull request !193 from boxi/master
2021-04-28 19:46:42 +08:00
boxi
46b63f7153 feat: Add /dev/quickstart to support synchronous communication between processes in user mode startup.
Add /dev/quickstart to support synchronous communication between processes in user mode startup.
Support ioctl cmd:
 QUICKSTART_LISTEN,QUICKSTART_STAGE1,QUICKSTART_STAGE2,QUICKSTART_STAGE3,QUICKSTART_UNREGISTER only for init process;
 QUICKSTART_NOTIFY for other app process.

Close #I3OHO5

Change-Id: If6a56123be93a5bc6b6d1069abda8d872b15fae1
2021-04-28 19:42:06 +08:00
openharmony_ci
77fca10032 !191 remove redundant code in fs
Merge pull request !191 from 野生毛霉君/master
2021-04-28 17:38:26 +08:00
openharmony_ci
d5eaed63c0 !191 remove redundant code in fs
Merge pull request !191 from 野生毛霉君/master
2021-04-28 17:38:25 +08:00
Far
5f6656cb36 fix: VnodeInUseIter and VnodeFreeAll used to be recursive
Function VnodeInUseIter and VnodeFreeAll used to be recursive.
Now we traverse the current in-use vnode list to find the vnode in
1 filesystem

Close #I3NN3U
2021-04-28 14:35:29 +08:00
Far
87da7c794c fix: PathCacheMemoryDump miscalculate the RAM usage of PathCache
PathCacheMemoryDump miscalculate the RAM usage of PathCache for not
counting the name field of PathCache, which is allocated with PathCache

Close #I3OBXY
2021-04-28 14:31:31 +08:00
mucor
aa34ffe7c7 fix:remove redundant code
Change-Id: I8662952ac9d7912aaf2e2e72f779b3def41d14c4
2021-04-28 09:57:32 +08:00
openharmony_ci
28df6989f9 !185 多核情况下当系统持有调度锁异常时,无异常信息输出
Merge pull request !185 from zhangfanfan2/master
2021-04-28 08:53:15 +08:00
openharmony_ci
e5cb9cb56e !187 remove redundant field regions in VmSpace structure
Merge pull request !187 from Harylee/dev
2021-04-28 08:52:49 +08:00
Far
9b2b700fa0 fix: some branch in format does not release the vnode mutex properly
if fatfs_mkfs returns a error, format may return without drop the vnode mutex, which may cause deadlock

Close #I3OFAY
2021-04-27 16:49:23 +08:00
openharmony_ci
34f35524aa !184 add testsuites
Merge pull request !184 from lnlan/master
2021-04-27 09:53:19 +08:00
openharmony_ci
7e698f4b22 !189 添加BOOTENV存放在RAM中的单独配置宏
Merge pull request !189 from boxi/master
2021-04-26 20:46:20 +08:00
openharmony_ci
db6ac1f57a !188 fix an inappropriate errno in FatFs.
Merge pull request !188 from JING/master
2021-04-26 20:27:13 +08:00
boxi
e28e06b08f fix: Provide a separate configuration macro for boot environment in RAM. 2021-04-26 20:15:46 +08:00
YOUR_NAME
5bf4d1c712 fix: no exception information output, when the system is abnormal
after holding the scheduling lock in SMP.

Change-Id: I6f148d7b36d7aa6d0df09300949f53ea3c3d63b7
2021-04-26 20:13:13 +08:00
boxi
bc67393a67 fix: Provide a separate configuration macro for boot environment in RAM. 2021-04-26 19:55:31 +08:00
zhushengle
6d63f75e7f fix:Solve the coupling between the kernel and the structure under ARCH.
Close #I3OAFR

Change-Id: Icea238e20adf402d0ec1fc7e47ff4e58124a5e83
2021-04-26 19:54:49 +08:00
boxi
f13b90e430 fix: Provide a separate configuration macro for boot environment in RAM.
Provide a separate configuration macro for boot environment in RAM.
Depends on: Need to copy boot environment data to the specified ram by boot.

Closes #I3OADR

Change-Id: Ie36a92c0a44f245482d1602c3a6851395944776d
2021-04-26 19:39:52 +08:00
chenjing
af61187587 fix: fix the inappropriate errno in FatFs
The errno of unrecognized fat filesystem changes from ENOENT to ENOTSUP.

Close #I3O8IF
2021-04-26 16:18:51 +08:00
Haryslee
20754539e4 remove redundant field regions in VmSpace structure
Change-Id: I626a96376fe6bee69b10ee9b56495d62849c19b7
2021-04-26 14:39:45 +08:00
YOUR_NAME
28aa777191 fix: no exception information output, when the system is abnormal
after holding the scheduling lock in SMP.

Change-Id: Ib10128fede9aa3e00269f1265089a917ffd96d88
2021-04-25 20:53:33 +08:00
YOUR_NAME
0ed8adfe3a fix: no exception information output, when the system is abnormal after holding
the scheduling lock in SMP.

Change-Id: Idb793a5446126e638af52ff78b43bb7f8271317c
2021-04-25 20:16:51 +08:00
lnlan
778c5e17c3 add testsuites
Change-Id: Ice1193d1ae7f2e0d12a2a38a306a6399407f5037
2021-04-25 17:35:47 +08:00
openharmony_ci
806ce4eb26 !183 fix: dereference NULL point bug fix
Merge pull request !183 from MGY917/signal_bug_fix
2021-04-25 14:20:21 +08:00
Guangyao Ma
deaa564a66 fix: dereference NULL point bug fix
Change-Id: Ib068696c9280105e209469e875c187d741b704d2
2021-04-25 11:47:05 +08:00
openharmony_ci
be40fa1381 !178 当从hashtable中获取Vnode缓存时,需要刷新Vnode的parent指针
Merge pull request !178 from Far/fatfs
2021-04-24 11:30:01 +08:00
openharmony_ci
fbdb808d11 !169 los_disk_cache_clear错误日志缺少换行符
Merge pull request !169 from Far/dev
2021-04-24 09:39:54 +08:00
openharmony_ci
677c5624e6 !175 编译qemu工程中制作rootfs镜像时,目标目录不存在
Merge pull request !175 from SimonLi/master
2021-04-24 09:39:09 +08:00
openharmony_ci
9e7af58b2d !181 修复PathCache结构器中的name域被错误地尝试free
Merge pull request !181 from Far/master
2021-04-24 09:33:33 +08:00
Far
9f47faff73 fix: PathCacheFree try to free name field in struct PathCache
The name field of struct PathCache is not allocated. It should not try to free it by free(nc->name)

Close #I3NTH9
2021-04-23 15:28:44 +08:00
openharmony_ci
06576f4c07 !180 用户态异常栈回溯过程LR解析的值不正确
Merge pull request !180 from zhangfanfan2/master
2021-04-23 15:17:41 +08:00
zhangfanfan2
9ab63a41b3 fix:LR value is incorrectly parsed when the user mode exception stack is backtracked 2021-04-23 11:53:06 +08:00
openharmony_ci
e93ff481bb !172 【轻量级 PR】:expand HILOG_BUFFER to reduce the probability of hilog loss
Merge pull request !172 from shenchenkai/N/A
2021-04-22 20:17:23 +08:00
openharmony_ci
6085048a95 !179 liteos_a仓中.gitignore文件对打patch生成的冲突文件做了不必要的屏蔽
Merge pull request !179 from boxi/master
2021-04-22 17:22:18 +08:00
boxi
35f7957975 fix: Show conflicting files for git apply or patch -p command
Modify the .gitignore file to display the conflicting files of git apply or patch -px.

Close #I3NNUS

Change-Id: I0ca0e312d0a83326e661d997181167e61b63e4b4
2021-04-22 16:44:46 +08:00
Far
f32caa52c6 fix: parent point of vnode found by VfsHashGet should be updated
When fatfs_lookup find a vnode from hashlist, the field parent of vnode should be updated,
because the old parent may be reclaimed.

Close #I3NNFA
2021-04-22 16:24:08 +08:00
openharmony_ci
dc90400456 !171 ftruncate新增支持FAT12与FAT16
Merge pull request !171 from JING/ftruncate
2021-04-22 15:21:21 +08:00
openharmony_ci
3e5dec4dc9 !170 若/userdata目录已存在,继续挂载userdata分区
Merge pull request !170 from JING/master
2021-04-22 15:19:54 +08:00
openharmony_ci
ba778ec212 !176 当从hashtable中获取vnode缓存时,需要刷新vnode缓存的parent指针
Merge pull request !176 from 野生毛霉君/master
2021-04-22 11:48:58 +08:00
openharmony_ci
0c1ff2ef76 !174 将NORETURN声明放到函数前,KEIL不支持放在函数后
Merge pull request !174 from Caoruihong/fix_noreturn
2021-04-22 11:26:46 +08:00
mucor
e8178d5917 refresh parent vnode when get vnode from hash table
Change-Id: I3cc042b1fcd00022bc6ba48e2a05d70f351b83de
2021-04-22 11:23:25 +08:00
JING
3027cfe543 fix ftruncate 2021-04-22 11:12:28 +08:00
SimonLi
21bf2b8899 fix(build): fix rootfsdir.sh target directory not exist
Close #I3NHQ0
2021-04-21 20:54:15 +08:00
openharmony_ci
89ed41a016 !173 [Desc] fix bug: kernel crashed after rmdir the umounted folder
Merge pull request !173 from LeonChan/lc-master
2021-04-21 19:31:12 +08:00
LeonChan
f305d1f702 fix: kernel crashed when delete a umounted folder 2021-04-21 18:35:15 +08:00
chenwei
ac0d083b1c fix: kernel crashed after rmdir the umounted folder
Close: I3NGBT
Change-Id: I70130c42061e51f5978b48befea66a5925386343
2021-04-21 17:31:28 +08:00
Caoruihong
18a98d1cb4 move noreturn attribute in front
Change-Id: Idce45c48e41b6794de21635517cab8a9d2c9ef03
2021-04-21 17:19:56 +08:00
shenchenkai
84f1519486 expand HILOG_BUFFER to reduce the probability of hilog loss 2021-04-21 16:54:40 +08:00
chenjing
b9c544d898 Description: [fix]ftruncate bugfix
Bug: #I3NEVN
Test:
2021-04-21 16:16:08 +08:00
JING
da6ca200fb update kernel/common/los_rootfs.c. 2021-04-21 15:57:15 +08:00
JING
55f84a2ead /userdata目录若已存在,仍然挂载 2021-04-21 14:58:39 +08:00
Far
5f6f683fab style: los_disk_cache_clear error message has no \n(LF)
Close #I3NCDD
2021-04-21 11:01:09 +08:00
openharmony_ci
6ee33eb893 !165 【轻量级 PR】:update fs/vfs/vnode_hash.c.
Merge pull request !165 from 冷钦街/N/A
2021-04-21 08:37:54 +08:00
openharmony_ci
7dd3b59fb0 !166 【轻量级 PR】:update fs/vfs/mount.c.
Merge pull request !166 from 冷钦街/N/A
2021-04-21 08:37:09 +08:00
openharmony_ci
41c86df7ca !168 【轻量级 PR】:update fs/vfs/path_cache.c.
Merge pull request !168 from 冷钦街/N/A
2021-04-21 08:35:44 +08:00
冷钦街
d7798fd0ab update fs/vfs/path_cache.c. 2021-04-20 22:16:09 +08:00
openharmony_ci
5605063950 !163 [Desc] add debug code to fix bug: kernel crashed after rmdir the umounted folder 3
Merge pull request !163 from LeonChan/lc-master
2021-04-20 19:09:47 +08:00
冷钦街
0566bccffa update fs/vfs/mount.c. 2021-04-20 18:35:15 +08:00
openharmony_ci
ef4341acea !162 fix: lookup new vnode may cause parent vnode freeing
Merge pull request !162 from Far/dev
2021-04-20 18:31:10 +08:00
冷钦街
9bcead9a8f update fs/vfs/vnode_hash.c. 2021-04-20 18:26:48 +08:00
chenwei
c6e921241b fix: kernel crashed when delete a umounted folder
Close: I3MZZ6
Change-Id: Iab3919a2eebb44c82531a7fa7a2f688ec4bcc5a0
2021-04-20 16:10:24 +08:00
openharmony_ci
9fcb67f731 !160 fix: misspell
Merge pull request !160 from Harylee/os
2021-04-20 12:30:37 +08:00
Far
902a11de9a fix: lookup new vnode may cause parent vnode freeing
Close #I3MYP4

Change-Id: I533f4bacaf7e6dd500f5ac3ce4f5343b3b885988
2021-04-20 11:43:14 +08:00
Haryslee
08980eac3c fix: misspell
Change-Id: I7bb8abb2c8c250373f22d0e6bec5a9765e2f52be
2021-04-20 09:24:31 +08:00
openharmony_ci
7ba0bfa800 !157 删除无用的__cplusplus,移除不必要的文件x权限
Merge pull request !157 from Caoruihong/cplusplus
2021-04-20 09:01:45 +08:00
openharmony_ci
ef37bf9037 !158 setitimer 创建的软件定时器,定时给进程发信号时,未加锁保护,导致踩内存等问题
Merge pull request !158 from zhushengle/master
2021-04-20 08:20:07 +08:00
openharmony_ci
2131237057 !152 修复LOS_RegionFind等接口竞态问题
Merge pull request !152 from JerryH/master
2021-04-20 08:16:28 +08:00
zhushengle
8f2e4bb8c9 IssueNo:#I3H7TO
fix:the setitimer signals the process to be locked at a fixed time. There is a static problem.

Change-Id: I26f12289c4b13b0fd70bf0aad30507270e0ee421
2021-04-19 21:28:04 +08:00
openharmony_ci
81cdf0c6c3 !156 代码优化
Merge pull request !156 from Caoruihong/ioremap
2021-04-19 18:48:22 +08:00
Caoruihong
7e73c929a2 remove __cplusplus guards in .c files
Change-Id: I052d930d54e63179b17b77f02c107a015f3cfc3f
2021-04-19 18:28:25 +08:00
openharmony_ci
2da9dfe67f !155 rootfsdir.sh脚本中cp未考虑目标是否与源相同
Merge pull request !155 from zhangfanfan2/master
2021-04-19 15:42:25 +08:00
Caoruihong
1ea9610ffd code optimization
Change-Id: I8d2e9f96e86f4130474da9898791240b5d42328e
2021-04-19 15:24:00 +08:00
openharmony_ci
0857e6f2ec !154 修改quickstart.c文件拼写错误
Merge pull request !154 from boxi/master
2021-04-19 12:06:15 +08:00
zhangfanfan2
e14558a834 rootfsdir.sh脚本中cp未考虑目的地址是否存在以及是否与源地址相同 2021-04-19 11:36:26 +08:00
boxi
3b2ff4b71f fix: fix typo in quickstart
rename quickstart.c

closes #I3M1S8

Change-Id: Ic85586553389d56f5188dd58e4fb7ced16463dff
2021-04-19 11:12:58 +08:00
openharmony_ci
901b21e4d9 !153 新增LOS_CurrSpaceGet函数给外部获取当前的进程vm空间
Merge pull request !153 from zhangfanfan2/master
2021-04-19 11:04:25 +08:00
openharmony_ci
75a85e4483 !151 [Desc] add debug code to fix bug: kernel crashed after rmdir the umounted folder, parentVnode->data null
Merge pull request !151 from LeonChan/lc-master
2021-04-19 11:00:57 +08:00
openharmony_ci
23ee3689da !150 Initialize a parameter
Merge pull request !150 from JING/master
2021-04-19 10:18:25 +08:00
zhangfanfan2
23037dfd38 新增函数LOS_CurrSpaceGet 2021-04-17 16:28:03 +08:00
YOUR_NAME
74af06d5cb IssueNo:#I3G1Q7
Description:Fix related interface competition issues.
Sig:liteos_a
Feature or Bugfix:Bugfix
Binary Source:No

Change-Id: I1198408be9ce577bbf0735e3da53d0834622f429
2021-04-17 16:15:35 +08:00
openharmony_ci
9920e359f8 !149 VfsProcfsOpen实现存在问题,没有调用具体procfs节点的存在的open函数
Merge pull request !149 from zhangfanfan2/master
2021-04-17 12:05:35 +08:00
chenwei
296274b60f add debug code to fix bug: kernel crashed after rmdir the umounted folder, parent->data null
Change-Id: I44981eb9475feb4604ffe91244b4dff00f7d1548
2021-04-17 11:44:03 +08:00
chenjing
9c13a59ac0 Description: [fix]Uninitialized parameter
Bug: #I2E08N
Test:
2021-04-17 10:04:29 +08:00
openharmony_ci
0e56ee6509 !147 fix capabilities in write and execute case
Merge pull request !147 from 野生毛霉君/master
2021-04-17 09:46:29 +08:00
openharmony_ci
b684b0c85d !148 为LOS_Panic添加noreturn属性
Merge pull request !148 from Caoruihong/los_panic
2021-04-17 09:24:14 +08:00
zhangfanfan2
78e1fdb971 解决issueI3J6PP 2021-04-16 18:51:09 +08:00
Caoruihong
ea794ac751 add noreturn attribute for LOS_Panic
Change-Id: Id2c76e3282d72bce18cf0925e12afaa0c3b06a90
2021-04-16 18:46:05 +08:00
mucor
c6b898ea30 fix capabilities in write and execute case
Change-Id: Ic9abc53cd0aafa1fd6272fab8191493c609ea995
2021-04-16 17:33:40 +08:00
openharmony_ci
098da53afe !146 Fix the LFN dir entry leak in fatfs.
Merge pull request !146 from JING/master
2021-04-16 17:31:45 +08:00
openharmony_ci
af2b0ac75b !144 用于检测umount栈溢出的调测功能
Merge pull request !144 from ysy4tc3/dev
2021-04-16 17:11:28 +08:00
JING
580ed3ea62 update fs/fat/virpart/src/virpart.c. 2021-04-16 15:49:35 +08:00
chenjing
77e8075f2f Description: [fix]Initialize parameter
Bug: Uninitialized parameter
Test:
2021-04-16 15:37:26 +08:00
openharmony_ci
62e708c70f !145 [Desc] add debug code to fix bug: kernel crashed after rmdir the umounted folder
Merge pull request !145 from LeonChan/lc-master
2021-04-16 15:14:25 +08:00
chenjing
b9b9d6dbaf Description: [fix] LFN dir entry leak
Bug: #I3J1IC
Test: io test 1000 time
2021-04-16 11:39:37 +08:00
chenwei
a7c5abf64c add debug code to fix bug: kernel crashed after rmdir the umounted folder
Change-Id: Ia956fd09f1bd734cd26ab631359c1e2131fe1e37
2021-04-16 11:30:04 +08:00
Far
7e0e46828b Bugfix: add vnode iteration debug feature for a bug
buginfo: when try to umount a nfs node, it may casue stack overflow.

Change-Id: I7d96f74a770607c990ca5f51cb92fb2843a08d12
2021-04-16 11:00:38 +08:00
openharmony_ci
b56c8392fd !135 watchdog没有用宏隔离
Merge pull request !135 from SimonLi/watchdog_bugfix
2021-04-16 08:45:52 +08:00
openharmony_ci
7332c00077 !139 FATFS及mmcblk 性能优化
Merge pull request !139 from ysy4tc3/dev
2021-04-15 19:19:51 +08:00
Far
beca52b61b Feature: Fatfs scandir format and mmcblk read/write optimization
1. Bcache block with high mem address is after lower mem address in RCU list when initing bcache.
2. Format will clear the bcache before writing the FAT.
3. The fatfs_readdir use the bcache writing block to reduce the chance of data switching out
4. Add performance analysing macron switch

Change-Id: I8fbc48418509d2e660d725d2c265266e931c26f8
2021-04-15 14:49:43 +08:00
openharmony_ci
b19527c5a4 !138 优化menuconfig.h的使用
Merge pull request !138 from Caoruihong/master
2021-04-15 08:56:24 +08:00
Caoruihong
d2197c801f use -include option instead of including menuconfig manually
Change-Id: Ie48b96fe9c8ab036d7234b56a169d6668171a895
2021-04-14 17:56:48 +08:00
openharmony_ci
08543cea6c !140 3518开源板系统启动后未初始化时钟寄存器CNTFRQ,导致系统延时不准
Merge pull request !140 from zhangfanfan2/master
2021-04-14 13:54:06 +08:00
zhangfanfan2
2026102cdf 初始化系统时钟 2021-04-14 11:27:40 +08:00
openharmony_ci
8ba225700b !137 random风格一致性修改
Merge pull request !137 from zhangfanfan2/master
2021-04-13 17:37:23 +08:00
zhangfanfan2
f0fc5db72d 风格修改 2021-04-12 19:41:11 +08:00
likailong
fdae508932 Issue: #I3I8MT
Description: Fix watchdog macro bug
Sig:kernel
Feature or Bugfix: Bugfix
Binary Source: No
2021-04-11 09:44:56 +08:00
openharmony_ci
b9a4f8b3f1 !115 kernel platform目录整改
Merge pull request !115 from SimonLi/master
2021-04-10 10:31:37 +08:00
openharmony_ci
432907dbf6 !96 Refactoring file system packaging process
Merge pull request !96 from pilipala195/master
2021-04-10 09:02:24 +08:00
openharmony_ci
ca41a70d7d !132 VfsJffs2Lookup中VfsHashGet获取的vnode未判断data字段的有效性
Merge pull request !132 from zhangfanfan2/jffs2
2021-04-10 09:00:27 +08:00
openharmony_ci
9dd5d56f9c !131 IsValidFP可读性优化
Merge pull request !131 from zhangfanfan2/master
2021-04-09 21:14:51 +08:00
zhangfanfan2
ee8ae574ec 回退IsValidFP的修改提交 2021-04-09 19:36:29 +08:00
zhangfanfan2
78a6bd9416 VfsJffs2Lookup中VfsHashGet获取的vnode未判断data字段的有效性 2021-04-09 19:30:40 +08:00
openharmony_ci
67b7f730d1 !110 feat: add and fix some syscall
Merge pull request !110 from MGY917/master
2021-04-09 18:14:28 +08:00
openharmony_ci
c5233a5b9f !130 修复limits.h,调整宏定义位置
Merge pull request !130 from Zhaotianyu/0406limits
2021-04-09 17:17:55 +08:00
YOUR_NAME
cd9c1d9789 [Desc] Modify IsValidFP to IsValidVaddr for issues I3HWYP
Change-Id: I0580a9328f8824869f1744f31cbfc2bf85516f66
2021-04-09 17:14:32 +08:00
openharmony_ci
3e317714fd !102 【轻量级 PR】:add README_zh-HK.md.
Merge pull request !102 from Ho Hang/N/A
2021-04-09 14:55:44 +08:00
Guangyao Ma
ce849f2145 feat: add and fix some syscall
add SysFstatat64 SysInfo SysVfork SysGetrusage
fix up SysDup SysFcntl

Change-Id: If41228da62f406312858921e48e2210e04f16a16
2021-04-09 14:45:53 +08:00
SimonLi
14362a6eda Merge branch 'master' of https://gitee.com/kkup180/kernel_liteos_a 2021-04-09 14:30:29 +08:00
SimonLi
3d3f0710f9 Merge branch 'master' of https://gitee.com/kkup180/kernel_liteos_a 2021-04-09 14:30:22 +08:00
openharmony_ci
ed7c8e4798 !129 remove redundant page free
Merge pull request !129 from 野生毛霉君/master
2021-04-09 14:23:28 +08:00
arvinzzz
13451e9d10 IssueNo:#I3HGTM
Description:Fix limits.h & Adjust some macro definition positions.
Feature or Bugfix:Bugfix
Binary Source:NA

Change-Id: Ia53c1b4b83f60862ac24c5c14a87883fe0af6db0
2021-04-09 10:44:13 +08:00
mucor
6ba93994cb remove redundant page free
Change-Id: I5ca037ef20eb65578b804e314617953bfbf6c35b
2021-04-08 20:17:11 +08:00
openharmony_ci
58f07f94a0 !123 support querying mount infomations by cat /proc/mounts
Merge pull request !123 from JING/master
2021-04-08 15:14:27 +08:00
openharmony_ci
cf5baa29f2 !127 clang编译的系统镜像内核栈回溯功能失效
Merge pull request !127 from zhangfanfan2/master
2021-04-08 14:53:13 +08:00
openharmony_ci
a8d057b8b4 !124 修复接口说明,改为与函数实际行为一致
Merge pull request !124 from Zhaotianyu/0406limits
2021-04-08 10:46:27 +08:00
SimonLi
f995312f55 Merge branch 'master' of https://gitee.com/kkup180/kernel_liteos_a 2021-04-08 09:10:42 +08:00
SimonLi
91b3d9f744 Merge branch 'master' of https://gitee.com/kkup180/kernel_liteos_a 2021-04-08 09:10:16 +08:00
openharmony_ci
a27be4a334 !128 修正LOS_CurrNanosec时间计算精度问题
Merge pull request !128 from Caoruihong/master
2021-04-08 08:42:48 +08:00
openharmony_ci
31b387fdf1 !125 Add issue and PR template for master
Merge pull request !125 from 马明帅/add_issus_pr_template_for_master
2021-04-08 08:42:00 +08:00
Caoruihong
c2e7879dbc fix accuracy of LOS_CurrNanosec
Change-Id: I5612d54d3cb92a119baaec396c723734c27a9d0c
2021-04-07 22:51:03 +08:00
YOUR_NAME
03a64228ed [Desc] Solve the problem of exception stack traceback for clang.
Change-Id: Ifdca9a23ba788fa66f3815203514c9034680df49
2021-04-07 15:43:57 +08:00
mamingshuai
a550fcc410 add issue and pr template 2021-04-07 14:49:32 +08:00
chenjing
62c039b287 proc closedir 2021-04-07 09:49:17 +08:00
arvinzzz
9fc6241057 Description: Fix the problem that the actual implementation of the function does not match the description.
Change-Id: Icdbc0182efc023734ccbe7e80b1926d64a18d01c
2021-04-06 22:35:13 +08:00
chenjing
18d5e25373 /proc/mounts 2021-04-06 17:33:49 +08:00
chenjing
7c3c92f87a /proc/mounts 2021-04-06 16:20:58 +08:00
chenjing
c13366fd92 /proc/mounts 2021-04-06 15:21:29 +08:00
openharmony_ci
a2e59ba316 !117 【轻量级 PR】:update kernel/base/core/los_process.c.
Merge pull request !117 from 冷钦街/N/A
2021-04-06 12:31:29 +08:00
SimonLi
d634ce46f7 Merge branch 'master' of https://gitee.com/kkup180/kernel_liteos_a 2021-04-06 07:26:32 +08:00
likailong
acc1b904bf Merge branch 'master' of https://gitee.com/kkup180/kernel_liteos_a 2021-04-06 07:26:03 +08:00
openharmony_ci
1ce743344a !120 【bug】sigaction中sigsuspend的后执行信号顺序与预期不符
Merge pull request !120 from give-me-five/master
2021-04-04 17:40:02 +08:00
x_xiny
a041342a69 signal
Change-Id: Ia42e914b7a19b7d519010e371f808baa1c6588c0
2021-04-02 18:27:31 +08:00
likailong
e04f712511 Merge branch 'master' of https://gitee.com/kkup180/kernel_liteos_a 2021-04-02 16:05:41 +08:00
likailong
3fe7ec0200 IssueNo: #I3EPPI
Description: platform directory refactoring
Sig: kernel
Feature or Bugfix: Feature
Binary Source: No
2021-04-02 16:03:50 +08:00
冷钦街
3194fcca08 update kernel/base/core/los_process.c. 2021-04-02 15:56:30 +08:00
likailong
d8f89448ba IssueNo: #I3EPPI
Description: platform directory refactoring
Sig: kernel
Feature or Bugfix: Feature
Binary Source: No
2021-04-02 08:18:25 +08:00
openharmony_ci
90b9c37b66 !107 Fix OHOS shell cannot ls a file
Merge pull request !107 from ysy4tc3/dev
2021-04-01 14:47:04 +08:00
openharmony_ci
be5e5fdf42 !112 修复代码段及只读段在uncache映射区域可以篡改的漏洞
Merge pull request !112 from JerryH/mmu
2021-04-01 09:51:59 +08:00
openharmony_ci
b1655de5ab !111 调度中存在有符号数与无符号数比较
Merge pull request !111 from zhushengle/sched
2021-04-01 09:02:59 +08:00
openharmony_ci
2eaf88ecbb !83 修改QEMU启动参数传入方法
Merge pull request !83 from laokz/qemugdb
2021-04-01 08:58:05 +08:00
YOUR_NAME
25ab07f136 IssueNo:#I3EH1L
Description:Fix the bug that the code segment and read-only segment can be modified in the uncache mapping area.
Sig:liteos_a
Feature or Bugfix:Bugfix
Binary Source:No

Change-Id: I030489b240d5bcbe088046392d566648fde85f0a
2021-03-31 20:16:03 +08:00
Far
704f60f687 Description: fix OHOS shell cannot ls a file
Change-Id: Ia403ada9bbb688b81a6e188f591211d10349a7f0
2021-03-31 19:12:22 +08:00
YOUR_NAME
c959d43684 IssueNo:#I3E0F2
Description:Delete VM to support only kernel mode.
Sig:liteos_a
Feature or Bugfix:Feature
Binary Source:No

Change-Id: Ie1029c8fbc0c1b85c138663933118d2d148b7769
2021-03-31 16:14:54 +08:00
zhushengle
36032f117a IssueNo:#12345
Description:Scheduling module has signed number and unsigned number comparison.
Sig:kernel
Feature or Bugfix:Bugfix
Binary Source:No

Change-Id: Ie6385e5ab779b6b542282198b38c966871b03c8e
2021-03-31 15:08:08 +08:00
openharmony_ci
1c901dce3a !109 setitimer多核静态问题
Merge pull request !109 from zhushengle/setitimer
2021-03-31 14:33:07 +08:00
laokz
349c1e46de QEMU arm platform: get 'bootargs' from flash; fix code style
Change-Id: I94175fa89a61f4f08d9f921203bedfc2dd9e53e4
2021-03-30 23:07:22 +08:00
zhushengle
7256d67a1c IssueNo:#!3456
Description:修复setitimer多核静态问题
Sig:kernel
Feature or Bugfix:Bugfix
Binary Source:No

Change-Id: I43661908d0d5248f70acb16ea95dc76fcdb6a84e
2021-03-30 17:34:23 +08:00
openharmony_ci
c70335c80d !106 fix bad code in fs codes
Merge pull request !106 from 野生毛霉君/master
2021-03-30 15:35:10 +08:00
openharmony_ci
014b40b2a2 !103 【轻量级 PR】:update shell/full/src/cmds/date_shell.c.
Merge pull request !103 from Ho Hang/N/A
2021-03-30 14:14:11 +08:00
mucor
f82be437b9 change while loop to for loop
Change-Id: Ie5c0cbca1e94c97ee2f511bf5ee3cdfb8c085a79
2021-03-30 10:54:37 +08:00
openharmony_ci
d3e78a2cac !101 【轻量级 PR】:Fixed Grammar Issues In VM_ERR
Merge pull request !101 from Ho Hang/N/A
2021-03-30 10:35:00 +08:00
openharmony_ci
f2e1e18fb4 !104 【轻量级 PR】:update kernel/user/src/los_user_init.c.
Merge pull request !104 from Ho Hang/N/A
2021-03-30 10:30:29 +08:00
openharmony_ci
e3ca50e8ad !92 fix bad code in fs codes
Merge pull request !92 from 野生毛霉君/master
2021-03-30 09:49:11 +08:00
Ho Hang
b9683cf2c8 update kernel/user/src/los_user_init.c. 2021-03-29 13:15:03 +08:00
Ho Hang
5ee7973b9c update shell/full/src/cmds/date_shell.c. 2021-03-29 12:46:03 +08:00
openharmony_ci
7387d410bf !100 解决kernel/liteos_a仓下关闭fat,编译不过的问题
Merge pull request !100 from li_zan/master
2021-03-29 12:06:31 +08:00
Ho Hang
7d8b70e677 add README_zh-HK.md. 2021-03-29 12:01:23 +08:00
Ho Hang
ea9791f8e1 Fixed Grammar Issues In VM_ERR 2021-03-29 11:56:26 +08:00
li_zan
2e47684d15 change config for fs2 2021-03-29 10:19:58 +08:00
li_zan
ee740f627f change config for fs2 2021-03-27 17:20:18 +08:00
openharmony_ci
1763f37811 !99 [Desc] 1, remove redundant code for O_APPEND flag in VfsJffs2Write; 2, fix bug for access freed memory in VfsJffs2Reclaim
Merge pull request !99 from LeonChan/master
2021-03-27 15:29:32 +08:00
gzyang
c5643b6216 wrong path fixed 2021-03-27 14:05:56 +08:00
openharmony_ci
23c2c270b8 !98 内核支持syscall关闭
Merge pull request !98 from zhangfanfan2/master
2021-03-27 09:58:48 +08:00
chenwei
b9d22b21e8 [Desc] 1, remove redundant code for O_APPEND flag in VfsJffs2Write; 2, fix bug for access freed memory in VfsJffs2Reclaim
Change-Id: Ibf8a1f352afa0c7ae608431a756ee58cec9bc262
2021-03-27 09:54:19 +08:00
openharmony_ci
f2ba6f956e !93 four code defect need to be fixed
Merge pull request !93 from ysy4tc3/master
2021-03-27 09:08:56 +08:00
openharmony_ci
c9f2b730f1 !97 解决kernel/liteos_a仓下关闭fat,编译不过的问题
Merge pull request !97 from li_zan/master
2021-03-27 09:05:24 +08:00
YOUR_NAME
b1be50cdb9 [Desc] Support to close syscall.
Change-Id: I6f7c469e96da9cc89c5c33bf7a9afe19625e175f
2021-03-26 20:12:50 +08:00
li_zan
b75c5f3cca change config for fs 2021-03-26 19:36:58 +08:00
li_zan
195172e655 change config for fs 2021-03-26 17:00:15 +08:00
pilipala195
157dfa4532 Refactoring the packaging process, copy bin and lib to out path 2021-03-26 16:56:55 +08:00
openharmony_ci
51e587ca44 !59 【轻量级 PR】:update kernel/base/ipc/los_futex.c.
Merge pull request !59 from 冷钦街/N/A
2021-03-25 11:29:52 +08:00
openharmony_ci
7d8d337b52 !64 【轻量级 PR】:update apps/shell/builtin/cd.c.
Merge pull request !64 from 冷钦街/N/A
2021-03-25 11:22:55 +08:00
openharmony_ci
da15b665b1 !86 remove unused code
Merge pull request !86 from Denny/new
2021-03-25 11:20:33 +08:00
openharmony_ci
8472f4d774 !66 【轻量级 PR】:update apps/shell/src/shcmd.c.
Merge pull request !66 from 冷钦街/N/A
2021-03-25 11:19:15 +08:00
openharmony_ci
61531ce9e0 !65 【轻量级 PR】:update apps/shell/src/shcmd.c.
Merge pull request !65 from 冷钦街/N/A
2021-03-25 11:19:13 +08:00
openharmony_ci
0f841d0eca !94 修改异常信息为Panic, 明确此处不可能返回的含义
Merge pull request !94 from zhushengle/new
2021-03-24 18:59:15 +08:00
mucor
1884fa0523 fix readdir, rename
Change-Id: Ic443742e125915f0e5332a338dedea5c40348928
2021-03-24 18:15:06 +08:00
openharmony_ci
a50adf047a !67 【轻量级 PR】:update apps/shell/src/shcmd.c.
Merge pull request !67 from 冷钦街/N/A
2021-03-24 17:31:47 +08:00
YOUR_NAME
63edd9afd1 Description: code defect fix
Change-Id: I9c49073ad2bbd668102d20da8ff7a8d680890deb
2021-03-24 17:02:25 +08:00
zhushengle
9601ecc131 IssueNo:#I29BRN
Description:Change the exception error message to Panic to clarify what normal does not return.
Sig:kernel
Feature or Bugfix:Bugfix
Binary Source:No

Change-Id: Ie7087cafe709f79604831f6d3eefcee6fe48ccbb
2021-03-24 16:36:12 +08:00
openharmony_ci
04820a2840 !88 修改产品配置文件的copy路径
Merge pull request !88 from zhangfanfan2/master
2021-03-24 09:46:03 +08:00
YOUR_NAME
6ee066ad14 [Desc]Modify the vendor configuration file path because the product_path
is changed to an absolute path.

Change-Id: I4688bae0c69c8b4c415f8aa8c137c987786227a3
2021-03-23 22:23:19 +08:00
openharmony_ci
996047a7e2 !82 轻内核VFS层重构,添加路径缓存
Merge pull request !82 from 野生毛霉君/noEmployeeNum_ChangeID_13306388_wangchenyang
2021-03-23 14:45:14 +08:00
denny
6af9d2ff16 remove unuse code
Change-Id: I608a6e18aad240c52398d744191f6df4bdd68cb5
2021-03-23 10:35:23 +08:00
openharmony_ci
8d0e58f98c !85 内核构建增加从vendor下面copy配置文件的方式
Merge pull request !85 from zhangfanfan2/master
2021-03-23 10:08:39 +08:00
zhangfanfan2
e272340b72 修改build.sh脚本 2021-03-23 08:51:44 +08:00
openharmony_ci
8ac55beb4e !70 【轻量级 PR】:update kernel/base/vm/los_vm_filemap.c.
Merge pull request !70 from 冷钦街/N/A
2021-03-22 21:04:50 +08:00
YOUR_NAME
4c012ea536 [Descirble]:Add configs searching way for vendor.
Change-Id: I86b30080016d611c16d3bd048b2684fe374b6a47
2021-03-22 19:48:11 +08:00
openharmony_ci
f890dc8473 !68 【轻量级 PR】:update apps/shell/src/shmsg.c.
Merge pull request !68 from 冷钦街/N/A
2021-03-19 19:06:26 +08:00
wangchenyang
d970750808 Description:vfs refactoring
Feature or Bugfix:Feature
Binary Source:Huawei
PrivateCode(Yes/No):Yes

Change-Id: I175d2648bc6f9078c34de2c0a5c93fda10b86c47
ChangeID:13306388
2021-03-19 13:22:46 +08:00
openharmony_ci
eb474b86bb !77 Optimization for physics memory
Merge pull request !77 from Harylee/master
2021-03-19 11:13:30 +08:00
openharmony_ci
0593715e39 !72 【轻量级 PR】:删除SysFork中的CLONE_SIGHAND flag
Merge pull request !72 from zhushengle/N/A
2021-03-18 21:32:00 +08:00
openharmony_ci
cc8570587f !81 fix:start up optimized
Merge pull request !81 from MGY917/202103171511
2021-03-18 17:44:32 +08:00
Guangyao Ma
307c3d6fad fix:start up optimized
Change-Id: Ia6907482000a06aada11feb4c52347e8f93e73b5
2021-03-17 16:09:00 +08:00
openharmony_ci
e95772c326 !79 update ReadME.md
Merge pull request !79 from Harylee/noEmployeeNum_ChangeID_13291521_lihao
2021-03-17 09:35:10 +08:00
openharmony_ci
3c849fa44f !78 内核c++编译使用-fno-omit-frame-pointer, 方便异常栈回溯
Merge pull request !78 from zhangfanfan2/master
2021-03-16 21:28:18 +08:00
l00517597
72082cfc71 TicketNo:DTS2021012805GXU8P0H00
Description:update ReadME.md

Team:OTHERS
Feature or Bugfix:Bugfix
Binary Source:NA
PrivateCode(Yes/No):Yes

Change-Id: Ida5ba9464d03d47068fb67cb5851b6dc0465ebca
Reviewed-on: http://mgit-tm.rnd.huawei.com/13291521
Tested-by: public jenkins <public_jenkins@notesmail.huawei.com>
Reviewed-by: yutao 00307180 <yutao999@huawei.com>
2021-03-16 16:54:09 +08:00
zhangfanfan2
885f349192 内核c++编译使用-fno-omit-frame-pointer, 方便异常栈回溯 2021-03-16 16:23:02 +08:00
openharmony_ci
2d1ad5e9f4 !76 组件解耦修改---支持内核态dynload和net关闭
Merge pull request !76 from zhangfanfan2/master
2021-03-16 09:10:39 +08:00
zhangfanfan2
36eb117140 组件解耦修改---支持内核态dynload和net关闭 2021-03-13 19:05:12 +08:00
Haryslee
c29806a316 Optimization for physics memory
Change-Id: Id7765f13d15014c8b19b75156b9f5971cbe99705
2021-03-13 17:37:10 +08:00
zhushengle
5b03c42d9a 删除SysFork中的CLONE_SIGHAND flag 2021-02-27 17:51:32 +08:00
冷钦街
3fe1a89b49 update kernel/base/vm/los_vm_filemap.c. 2021-02-18 16:41:29 +08:00
冷钦街
b527fded62 update apps/shell/src/shmsg.c. 2021-02-05 15:04:36 +08:00
冷钦街
5c1c24137f update apps/shell/src/shcmd.c. 2021-02-05 12:24:45 +08:00
冷钦街
6e8603557e update apps/shell/src/shcmd.c. 2021-02-05 11:01:05 +08:00
冷钦街
c2548abc2f update apps/shell/src/shcmd.c. 2021-02-05 09:57:31 +08:00
冷钦街
cfec7a63a5 update apps/shell/builtin/cd.c. 2021-02-04 20:27:22 +08:00
冷钦街
91e4e73dab update kernel/base/ipc/los_futex.c. 2021-01-15 07:13:07 +08:00
2880 changed files with 283585 additions and 23537 deletions

View File

@@ -0,0 +1,11 @@
### 该问题是怎么引起的?
### 重现步骤
### 报错信息

View File

@@ -0,0 +1,27 @@
### 相关的Issue
### 原因(目的、解决的问题等)
### 描述(做了什么,变更了什么)
### 测试用例(新增、改动、可能影响的功能)
### 是否涉及对外变更典型的如对外API规格变更、新增对外接口等等
必须选择一项在MarkDown模式下用[x]替换[ ]即可勾选对应选项):
- [ ] 是,涉及对外变更: 需要在commit message中按【[模板要求](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)】描述变更点
- [ ] 否,不涉及对外变更
### 是否需要同步至release3.0LTS ... )分支?
必须选择一项在MarkDown模式下用[x]替换[ ]即可勾选对应选项):
- [ ] 是,需要同步的分支:
- [ ]
理由:

35
.gitignore vendored
View File

@@ -1,23 +1,24 @@
/out
/test
/include
.config*
cscope*
tags
.vscode
# General ignored file types
*.o
.idea
*.img
*.swp
*.rej
*.orig
*.a
*.so
.config.cmd
*.swp
# IDE settings
.vscode
.idea
.settings
.cproject
.project
platform/include/menuconfig.h
platform/board.ld
apps/init/init
apps/shell/shell
# VIM files
cscope*
tags
# Menuconfig temp files
/config.h
/.config
/.config.old
# Build temp files
/out

428
BUILD.gn Executable file → Normal file
View File

@@ -28,55 +28,415 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/component/lite_component.gni")
import("//build/lite/config/subsystem/lite_subsystem.gni")
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
declare_args() {
tee_enable = false
liteos_name = "OHOS_Image"
liteos_container_enable = false
liteos_skip_make = false
liteos_is_mini = false
}
tee = ""
if (tee_enable) {
tee = "_tee"
}
declare_args() {
liteos_config_file = "${ohos_build_type}${tee}.config"
}
liteos_config_file =
rebase_path(liteos_config_file, "", "$product_path/kernel_configs")
print("liteos_config_file:", liteos_config_file)
exec_script("//build/lite/run_shell_cmd.py",
[ "env" + " CONFIG_=LOSCFG_" + " KCONFIG_CONFIG_HEADER='y=true'" +
" KCONFIG_CONFIG=$liteos_config_file" +
" DEVICE_PATH=$device_path" + " srctree=" + rebase_path(".") +
" genconfig" + " --header-path $LITEOS_MENUCONFIG_H" +
" --file-list kconfig_files.txt" +
" --env-list kconfig_env.txt" + " --config-out config.gni" ],
"",
[ liteos_config_file ])
import("liteos.gni")
assert(ARCH != "", "ARCH not set!")
assert(ARCH == arch, "ARCH not match! details: $ARCH != $arch")
assert(tee_enable == defined(LOSCFG_TEE_ENABLE), "TEE switch not match!")
assert(ohos_build_compiler == "clang" == defined(LOSCFG_COMPILER_CLANG_LLVM),
"compiler not match!")
generate_notice_file("kernel_notice_file") {
module_name = "kernel"
module_source_dir_list = [
"//third_party/FreeBSD",
"//third_party/musl",
"//third_party/zlib",
"//third_party/FatFs",
"//third_party/Linux_Kernel",
"//third_party/lwip",
"//third_party/NuttX",
"//third_party/mtd-utils",
"$LITEOSTHIRDPARTY/FreeBSD",
"$LITEOSTHIRDPARTY/musl",
"$LITEOSTHIRDPARTY/zlib",
"$LITEOSTHIRDPARTY/FatFs",
"$LITEOSTHIRDPARTY/lwip",
"$LITEOSTHIRDPARTY/NuttX",
"$LITEOSTHIRDPARTY/mtd-utils",
]
}
declare_args() {
enable_ohos_kernel_liteos_a_ext_build = true
LOSCFG_TEST_APPS = false
tee_enable = ""
liteos_arch_cflags = []
if (defined(LOSCFG_ARCH_ARM)) {
mcpu = LOSCFG_ARCH_CPU
if (defined(LOSCFG_ARCH_ARM_AARCH64) && defined(LOSCFG_ARCH_FPU_DISABLE)) {
mcpu += "+nofp"
}
liteos_arch_cflags += [ "-mcpu=$mcpu" ]
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
liteos_arch_cflags += [
"-mfloat-abi=softfp",
"-mfpu=$LOSCFG_ARCH_FPU",
]
}
}
lite_subsystem("kernel") {
subsystem_components = []
cc = "$ohos_current_cc_command " + string_join(" ", liteos_arch_cflags)
if (ohos_build_compiler == "clang") {
cc += " --target=$target_triple"
}
if (enable_ohos_kernel_liteos_a_ext_build == false) {
subsystem_components += [
"//kernel/liteos_a/kernel",
"//kernel/liteos_a/net",
"//kernel/liteos_a/lib",
"//kernel/liteos_a/compat",
"//kernel/liteos_a/fs",
"//kernel/liteos_a/arch:platform_cpu",
]
if (LOSCFG_SHELL) {
subsystem_components += [ "//kernel/liteos_a/shell" ]
config("arch_config") {
cflags = liteos_arch_cflags
asmflags = cflags
ldflags = cflags
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-mthumb-interwork" ]
}
} else {
deps = [ ":make" ]
}
if (defined(LOSCFG_THUMB)) {
cflags += [ "-mthumb" ]
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-mimplicit-it=thumb" ]
} else {
cflags += [ "-Wa,-mimplicit-it=thumb" ]
}
}
}
config("stdinc_config") {
std_include = exec_script("//build/lite/run_shell_cmd.py",
[ "$cc -print-file-name=include" ],
"trim string")
cflags = [
"-isystem",
std_include,
]
if (!defined(LOSCFG_LIBC_NEWLIB)) {
cflags += [ "-nostdinc" ]
}
asmflags = cflags
}
config("ssp_config") {
cflags = []
if (defined(LOSCFG_CC_STACKPROTECTOR_ALL)) {
cflags += [ "-fstack-protector-all" ]
} else if (defined(LOSCFG_CC_STACKPROTECTOR_STRONG)) {
cflags += [ "-fstack-protector-strong" ]
} else if (defined(LOSCFG_CC_STACKPROTECTOR)) {
cflags += [
"-fstack-protector",
"--param",
"ssp-buffer-size=4",
]
} else {
cflags += [ "-fno-stack-protector" ]
}
asmflags = cflags
}
config("optimize_config") {
cflags = []
if (defined(LOSCFG_COMPILE_DEBUG)) {
cflags += [
"-g",
"-gdwarf-2",
]
optimization_cflag = "-O0"
}
if (defined(LOSCFG_COMPILE_OPTIMIZE)) {
optimization_cflag = "-O2"
}
if (defined(LOSCFG_COMPILE_OPTIMIZE_SIZE)) {
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
optimization_cflag = "-Oz"
} else {
optimization_cflag = "-Os"
}
}
if (defined(LOSCFG_COMPILE_LTO)) {
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-flto=thin" ]
} else {
#cflags += [ "-flto" ]
}
}
cflags += [ optimization_cflag ]
asmflags = cflags
}
config("kconfig_config") {
cflags = [
"-imacros",
"$LITEOS_MENUCONFIG_H",
]
asmflags = cflags
}
config("warn_config") {
cflags = [
"-Wall",
"-Werror",
"-Wpointer-arith",
"-Wstrict-prototypes",
"-Winvalid-pch",
]
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-Wno-address-of-packed-member" ]
cflags += [
"-Wno-unused-but-set-variable",
"-Wno-strict-prototypes",
]
}
asmflags = cflags
}
config("dialect_config") {
cflags_c = [ "-std=c99" ]
cflags_cc = [ "-std=c++11" ]
}
config("misc_config") {
defines = [ "__LITEOS__" ]
defines += [ "__LITEOS_A__" ]
if (!defined(LOSCFG_DEBUG_VERSION)) {
defines += [ "NDEBUG" ]
}
cflags = [
"-fno-pic",
"-fno-builtin",
"-fms-extensions",
"-fno-strict-aliasing",
"-fno-common",
"-fsigned-char",
"-ffunction-sections",
"-fdata-sections",
"-fno-exceptions",
"-fno-omit-frame-pointer",
"-fno-short-enums",
"-mno-unaligned-access",
]
if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-fno-aggressive-loop-optimizations" ]
}
asmflags = cflags
}
config("container_config") {
if (liteos_container_enable) {
cflags = [
"-DLOSCFG_KERNEL_CONTAINER",
"-DLOSCFG_PID_CONTAINER",
"-DLOSCFG_UTS_CONTAINER",
"-DLOSCFG_MNT_CONTAINER",
"-DLOSCFG_CHROOT",
"-DLOSCFG_IPC_CONTAINER",
"-DLOSCFG_TIME_CONTAINER",
"-DLOSCFG_USER_CONTAINER",
"-DLOSCFG_NET_CONTAINER",
"-DLOSCFG_PROC_PROCESS_DIR",
"-DLOSCFG_KERNEL_PLIMITS",
"-DLOSCFG_KERNEL_MEM_PLIMIT",
"-DLOSCFG_KERNEL_IPC_PLIMIT",
"-DLOSCFG_KERNEL_DEV_PLIMIT",
"-DLOSCFG_KERNEL_SCHED_PLIMIT",
]
}
}
config("los_config") {
configs = [
":arch_config",
":kconfig_config",
":stdinc_config",
":dialect_config",
":optimize_config",
":ssp_config",
":warn_config",
":misc_config",
":container_config",
]
}
cmd = "if [ -f $device_path/BUILD.gn ]; then echo true; else echo false; fi"
HAVE_DEVICE_SDK = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
config("public") {
configs = [
"arch:public",
"kernel:public",
"compat:public",
"bsd:public",
"fs:public",
"drivers:public",
"security:public",
"net:public",
"shell:public",
"lib:public",
]
configs += [
"$HDFTOPDIR:public",
"$DRIVERS_LITEOS_DIR:public",
]
if (HAVE_DEVICE_SDK) {
configs += [ "$device_path:public" ]
}
}
group("modules") {
deps = [
"arch",
"bsd",
"compat",
"drivers",
"fs",
"kernel",
"lib",
"net",
"security",
"shell",
"syscall",
"testsuites/kernel:kernel_test",
]
deps += [
"$DRIVERS_LITEOS_DIR",
"$HDFTOPDIR",
]
if (HAVE_DEVICE_SDK) {
deps += [ device_path ]
}
}
group("apps") {
deps = [ "apps" ]
}
group("tests") {
deps = [ "testsuites" ]
}
group("kernel") {
deps = [ ":build_kernel_image" ]
}
group("liteos_a") {
deps = [ ":kernel" ]
if (!liteos_is_mini) {
deps += [
":apps",
":tests",
"$THIRDPARTY_MUSL_DIR/scripts/build_lite:strip",
]
if (liteos_skip_make == false) {
deps += [ ":make" ]
}
}
}
executable("liteos") {
configs = [] # clear default configs
configs += [ ":arch_config" ]
configs += [ ":public" ]
ldflags = [
"-static",
"-nostdlib",
"-Wl,--gc-sections",
"-Wl,-Map=$liteos_name.map",
"-Wl,--no-eh-frame-hdr",
]
if (defined(LOSCFG_LIBC_NEWLIB)) {
ldflags += [
"-Wl,--wrap=_free_r",
"-Wl,--wrap,_malloc_usable_size_r",
"-Wl,--wrap,_malloc_r",
"-Wl,--wrap,_memalign_r",
"-Wl,--wrap,_realloc_r",
"-Wl,--wrap,_fseeko_r",
]
ldflags -= [ "-nostdlib" ]
}
libgcc = exec_script("//build/lite/run_shell_cmd.py",
[ "$cc -print-libgcc-file-name" ],
"trim string")
libs = [ libgcc ]
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
ldflags +=
[ "-Wl,-T" + rebase_path("tools/build/liteos_llvm.ld", root_build_dir) ]
inputs = [ "tools/build/liteos_llvm.ld" ]
} else {
ldflags +=
[ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ]
ldflags += [ "-nostartfiles" ]
inputs = [ "tools/build/liteos.ld" ]
}
inputs += [ "$root_out_dir/board.ld" ]
output_dir = target_out_dir
deps = [
":modules",
"platform:copy_board.ld",
]
}
copy("copy_liteos") {
deps = [ ":liteos" ]
sources = [ "$target_out_dir/unstripped/bin/liteos" ]
outputs = [ "$root_out_dir/$liteos_name" ]
}
build_ext_component("build_kernel_image") {
deps = [ ":copy_liteos" ]
exec_path = rebase_path(root_out_dir)
objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix"
objdump = "${compile_prefix}objdump$toolchain_cmd_suffix"
command = "$objcopy -O binary $liteos_name $liteos_name.bin"
command +=
" && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'"
command += " && sh -c '$objdump -d $liteos_name >$liteos_name.asm'"
}
build_ext_component("make") {
exec_path = rebase_path(".", root_build_dir)
tee_enable = "false"
if (board_name == "hi3516dv300" && enable_tee_ree) {
tee_enable = "tee"
outdir = rebase_path("$target_out_dir/${target_name}_out")
sysroot_path = rebase_path(ohos_current_sysroot)
arch_cflags = string_join(" ", target_arch_cflags)
command = "./build.sh \"$board_name\" \"$ohos_build_compiler\" \"$root_build_dir\" \"$ohos_build_type\" \"$tee_enable\""
command += " \"$device_company\" \"$product_path\" \"$outdir\" \"$ohos_version\" \"$sysroot_path\" \"$arch_cflags\""
command += " \"$device_path\" \"$compile_prefix\" \"$liteos_config_file\""
if (liteos_skip_make) {
print("build_ext_component \"$target_name\" skipped:", command)
command = "true"
}
prebuilts = "sh build.sh ${board_name} ${ohos_build_compiler} ${root_build_dir} ${ohos_build_type} ${tee_enable} \"${device_company}\" \"${product_path}\""
outdir = rebase_path(get_path_info(".", "out_dir"))
command = "make clean OUTDIR=$outdir && make rootfs VERSION=\"${ohos_version}\" -j 16 OUTDIR=$outdir"
}

338
CHANGELOG.md Normal file
View File

@@ -0,0 +1,338 @@
# (2022-03-30)
### Bug Fixes
* **arm-virt:** HW_RANDOM_ENABLE配置支持arm virt平台 ([68f9f49](https://gitee.com/openharmony/kernel_liteos_a/commits/68f9f49c2a62d3271db14ccb896c9f9fc78a60e4))
* A核代码静态告警定期清理 ([9ba725c](https://gitee.com/openharmony/kernel_liteos_a/commits/9ba725c3d486dd28fe9b2489b0f95a65354d7d86)), closes [#I4I0O8](https://gitee.com/openharmony/kernel_liteos_a/issues/I4I0O8)
* change default permission of procfs to 0550 ([a776c04](https://gitee.com/openharmony/kernel_liteos_a/commits/a776c04a3da414f73ef7136a543c029cc6dd75be)), closes [#I4NY49](https://gitee.com/openharmony/kernel_liteos_a/issues/I4NY49)
* change the execFile field in TCB to execVnode ([e4a0662](https://gitee.com/openharmony/kernel_liteos_a/commits/e4a06623ceb49b5bead60d45c0534db88b9c666f)), closes [#I4CLL9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CLL9)
* close file when process interpretor failed ([a375bf5](https://gitee.com/openharmony/kernel_liteos_a/commits/a375bf5668a5e86e082d0e124b538e423023a259)), closes [#I4ATQX](https://gitee.com/openharmony/kernel_liteos_a/issues/I4ATQX)
* codex 清理 ([9ab3e35](https://gitee.com/openharmony/kernel_liteos_a/commits/9ab3e351d38cdae2ec083048a50a253bc2a3b604)), closes [#I4BL3S](https://gitee.com/openharmony/kernel_liteos_a/issues/I4BL3S)
* dyload open close failed ([5e87d8c](https://gitee.com/openharmony/kernel_liteos_a/commits/5e87d8c183471166294e2caa041ab4da8570c6a1)), closes [#I452Z7](https://gitee.com/openharmony/kernel_liteos_a/issues/I452Z7)
* fix ppoll ([a55f68f](https://gitee.com/openharmony/kernel_liteos_a/commits/a55f68f957e9f8ad74bd9e0c1b3d27775e0f8c75))
* fix some function declarations ([63fd8bc](https://gitee.com/openharmony/kernel_liteos_a/commits/63fd8bc39b21fffb6990f74e879eefecafad6c88))
* implicit declaration of function 'syscall' in apps/shell ([bd0c083](https://gitee.com/openharmony/kernel_liteos_a/commits/bd0c0835fc58ed5f941dbbc9adfac74253eeb874))
* LOS_Panic和魔法键功能中的使用PRINTK打印依赖任务调度特殊情况下存在打印不出来的问题 ([53addea](https://gitee.com/openharmony/kernel_liteos_a/commits/53addea304de09e0df457b690403ac652bbcea72)), closes [#I4NOC7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4NOC7)
* los_stat_pri.h中缺少依赖的头文件 ([2cd03c5](https://gitee.com/openharmony/kernel_liteos_a/commits/2cd03c55b7a614c648adc965ebfe494d491fe20f)), closes [#I4KEZ1](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KEZ1)
* los_trace.h接口注释错误修正 ([6d24961](https://gitee.com/openharmony/kernel_liteos_a/commits/6d249618aecc216388f9b1a2b48fe0ac6dd19ff2)), closes [#I4CYPZ](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CYPZ)
* MMU竞态问题修复 ([748e0d8](https://gitee.com/openharmony/kernel_liteos_a/commits/748e0d8ffb6ee9c8757ed056f575e3abc6c10702)), closes [#I2WARC](https://gitee.com/openharmony/kernel_liteos_a/issues/I2WARC)
* **mtd:** 去除mtd对hisilicon驱动的依赖 ([f7d010d](https://gitee.com/openharmony/kernel_liteos_a/commits/f7d010dfa4cb825096267528e131a9e2735d7505)), closes [#I49FKL](https://gitee.com/openharmony/kernel_liteos_a/issues/I49FKL)
* OsFutexWaitParamCheck函数中absTime为0时直接返回不需要打印 ([3f71be7](https://gitee.com/openharmony/kernel_liteos_a/commits/3f71be75355f11037d9de80cc4d7da0f01905003)), closes [#I4D67E](https://gitee.com/openharmony/kernel_liteos_a/issues/I4D67E)
* OsLockDepCheckIn异常处理中存在g_lockdepAvailable锁嵌套调用, ([bf030b6](https://gitee.com/openharmony/kernel_liteos_a/commits/bf030b6bb5843151a5b8b8736246a1376a5fb9d0)), closes [#I457ZZ](https://gitee.com/openharmony/kernel_liteos_a/issues/I457ZZ)
* pr模板补充说明 ([e3cd485](https://gitee.com/openharmony/kernel_liteos_a/commits/e3cd485db528490a16a8932d734faab263b44bc9))
* same file mode for procfs files ([c79bcd0](https://gitee.com/openharmony/kernel_liteos_a/commits/c79bcd028e1be34b45cba000077230fa2ef95e68)), closes [#I4ACTC](https://gitee.com/openharmony/kernel_liteos_a/issues/I4ACTC)
* shell支持exit退出完善帮助信息特殊处理不可见字符 ([cc6e112](https://gitee.com/openharmony/kernel_liteos_a/commits/cc6e11281e63b6bdc9be8e5d3c39f1258eb2ceaa))
* smp初始化中副核冗余的启动框架调用 ([5ce70a5](https://gitee.com/openharmony/kernel_liteos_a/commits/5ce70a50c3733b6ec8cc4b444837e366ec837f69)), closes [#I4F8A5](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F8A5)
* solve SIGCHLD ignored in sigsuspend() ([5a80d4e](https://gitee.com/openharmony/kernel_liteos_a/commits/5a80d4e1a34c94204a0bb01443bf25a4fdb12750)), closes [#I47CKK](https://gitee.com/openharmony/kernel_liteos_a/issues/I47CKK)
* syscall review bugfix ([214f44e](https://gitee.com/openharmony/kernel_liteos_a/commits/214f44e935277c29d347c50b553a31ea7df36448)), closes [#149](https://gitee.com/openharmony/kernel_liteos_a/issues/149)
* **test:** misc09用例因依赖hosts文件而失败 ([f2f5c5f](https://gitee.com/openharmony/kernel_liteos_a/commits/f2f5c5fdc3202610de173e7046adab4df5e59142)), closes [#I48IZ0](https://gitee.com/openharmony/kernel_liteos_a/issues/I48IZ0)
* **test:** 修复sys部分用例因依赖passwd、group文件而失败 ([614cdcc](https://gitee.com/openharmony/kernel_liteos_a/commits/614cdccf91bd2d220c4c76418b53400ce714c6cb)), closes [#I48IUC](https://gitee.com/openharmony/kernel_liteos_a/issues/I48IUC)
* 中断中调用PRINTK概率卡死导致系统不能正常响应中断 ([9726ba1](https://gitee.com/openharmony/kernel_liteos_a/commits/9726ba11a79f3d2d1e616e12ef0bb44e4fc5cd20)), closes [#I4C9GC](https://gitee.com/openharmony/kernel_liteos_a/issues/I4C9GC)
* 临终遗言重定向内容缺失task相关信息对应的shell命令中申请的内存需要cacheline对齐 ([48ca854](https://gitee.com/openharmony/kernel_liteos_a/commits/48ca854bf07f8dcda9657f950601043a485a1b33)), closes [#I482S5](https://gitee.com/openharmony/kernel_liteos_a/issues/I482S5)
* 优化liteipc任务状态删除功能重复字段 ([5004ef4](https://gitee.com/openharmony/kernel_liteos_a/commits/5004ef4d87b54fb6d7f748ca8212ae155bcefac5)), closes [#I4FVHK](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FVHK)
* 优化trace buffer初始化删除swtmr 桩中的无效参数 ([b551270](https://gitee.com/openharmony/kernel_liteos_a/commits/b551270ef50cb206360e2eee3dd20ace5cecccb7)), closes [#I4DQ1X](https://gitee.com/openharmony/kernel_liteos_a/issues/I4DQ1X)
* 修复 virpart.c 不适配的格式化打印问题 ([de29140](https://gitee.com/openharmony/kernel_liteos_a/commits/de29140edf2567f4847876cb1ed5e0b6857420f3)), closes [#I4PEVP](https://gitee.com/openharmony/kernel_liteos_a/issues/I4PEVP)
* 修复A核文档失效的问题 ([456d255](https://gitee.com/openharmony/kernel_liteos_a/commits/456d255a81c2031be8ebecc2bf897af80c3d3c7a)), closes [#I4U7TF](https://gitee.com/openharmony/kernel_liteos_a/issues/I4U7TF)
* 修复A核测试用例失败的问题 ([59329ce](https://gitee.com/openharmony/kernel_liteos_a/commits/59329ce7c6b6a00084df427748e6283287a773c0)), closes [#I4SQDR](https://gitee.com/openharmony/kernel_liteos_a/issues/I4SQDR)
* 修复A核测试用例失败的问题 ([be68dc8](https://gitee.com/openharmony/kernel_liteos_a/commits/be68dc8bcaf8d965039ae1d792775f00a08adfac)), closes [#I4SQDP](https://gitee.com/openharmony/kernel_liteos_a/issues/I4SQDP)
* 修复dispatch单词拼写错误。 ([9b07aec](https://gitee.com/openharmony/kernel_liteos_a/commits/9b07aece2dfa3494cf35e8b388410341508d6224)), closes [#I4BLE8](https://gitee.com/openharmony/kernel_liteos_a/issues/I4BLE8)
* 修复futime提示错误22的BUG ([f2861dd](https://gitee.com/openharmony/kernel_liteos_a/commits/f2861ddfb424af7b99c278273601ce0fab1f37e6))
* 修复jffs2适配层错误释放锁的BUG ([011a55f](https://gitee.com/openharmony/kernel_liteos_a/commits/011a55ff21d95f969abac60bcff96f4c4d7a326d)), closes [#I4FH9M](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FH9M)
* 修复los_vm_scan.c中内部函数OsInactiveListIsLow冗余代码 ([bc32a1e](https://gitee.com/openharmony/kernel_liteos_a/commits/bc32a1ec0fa5d19c6d2672bcf4a01de5e1be3afb)), closes [#I4HKFF](https://gitee.com/openharmony/kernel_liteos_a/issues/I4HKFF)
* 修复LOSCFG_FS_FAT_CACHE宏关闭后编译失败的BUG ([63e71fe](https://gitee.com/openharmony/kernel_liteos_a/commits/63e71feca05a8d46a49822c713258738740f0712)), closes [#I3T3N0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T3N0)
* 修复OsVmPhysFreeListAdd和OsVmPhysFreeListAddUnsafe函数内容重复 ([6827bd2](https://gitee.com/openharmony/kernel_liteos_a/commits/6827bd2a22b78aa05e20d6460412fc7b2d738929)), closes [#I4FL95](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FL95)
* 修复PR520缺陷 ([4033891](https://gitee.com/openharmony/kernel_liteos_a/commits/40338918d9132399ee0494d331930a05b7a13c67)), closes [#I4DEG5](https://gitee.com/openharmony/kernel_liteos_a/issues/I4DEG5)
* 修复shcmd.h需要用宏包起来的问题 ([6c4e4b1](https://gitee.com/openharmony/kernel_liteos_a/commits/6c4e4b16abe9c68fea43d40b2d39b4f0ed4bfc9c)), closes [#I4N50W](https://gitee.com/openharmony/kernel_liteos_a/issues/I4N50W)
* 修复xts权限用例压测异常问题 ([b0d31cb](https://gitee.com/openharmony/kernel_liteos_a/commits/b0d31cb43f5a8d1c3da574b2b957e3b0e98b3067)), closes [#I3ZJ1D](https://gitee.com/openharmony/kernel_liteos_a/issues/I3ZJ1D)
* 修复硬随机不可用时,地址随机化不可用问题 ([665c152](https://gitee.com/openharmony/kernel_liteos_a/commits/665c152c27bb86395ddd0395279255f6cdaf7255)), closes [#I4D4TK](https://gitee.com/openharmony/kernel_liteos_a/issues/I4D4TK)
* 修复进程用例导致门禁概率失败 ([1ed28b4](https://gitee.com/openharmony/kernel_liteos_a/commits/1ed28b4c80cfd222be08b0c2e71e6287e52bb276)), closes [#I4FO0N](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FO0N)
* 修复进程线程不稳定用例 ([f6ac03d](https://gitee.com/openharmony/kernel_liteos_a/commits/f6ac03d3e3c56236adc5734d4c059f1fbcc9e0c1)), closes [#I4F1XL](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F1XL)
* 修复重复执行内存用例导致系统卡死问题 ([6c2b163](https://gitee.com/openharmony/kernel_liteos_a/commits/6c2b163c7d7c696ef89b17a0275f3cddb3d7cefb)), closes [#I4F7PO](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F7PO)
* 修改MMU模块的注释错误 ([1a8e22d](https://gitee.com/openharmony/kernel_liteos_a/commits/1a8e22dcf15944153e013d004fd7bbf24557a8c7)), closes [#I4KMMJ](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KMMJ)
* 共享内存问题修复 ([9fdb80f](https://gitee.com/openharmony/kernel_liteos_a/commits/9fdb80f85f92d0167a0456455a94fc6f679797ce)), closes [#I47X2Z](https://gitee.com/openharmony/kernel_liteos_a/issues/I47X2Z)
* 内核ERR打印无进程和线程信息不方便问题定位。 ([cb423f8](https://gitee.com/openharmony/kernel_liteos_a/commits/cb423f845462b8cc474c3cba261dadf3943a08ef)), closes [#I4DAKM](https://gitee.com/openharmony/kernel_liteos_a/issues/I4DAKM)
* 内核ERR级别及以上的打印输出当前进程和线程名 ([540b201](https://gitee.com/openharmony/kernel_liteos_a/commits/540b2017c5460e300365d2039a08abd5945cec6b))
* 内源检视测试用例问题修复 ([a6ac759](https://gitee.com/openharmony/kernel_liteos_a/commits/a6ac7597f85043ba6de3a1b395ca676d85c65ea7))
* 删除冗余的头文件 ([8e614bb](https://gitee.com/openharmony/kernel_liteos_a/commits/8e614bb1616b75bc89eee7ad7da49b7a9c285b47)), closes [#I4KN63](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KN63)
* 增加pselect SYSCALL函数及测试用例 ([f601c16](https://gitee.com/openharmony/kernel_liteos_a/commits/f601c16b9e67d531dda51fc18389a53db4360b7b)), closes [#I45SXU](https://gitee.com/openharmony/kernel_liteos_a/issues/I45SXU)
* 增加内核epoll系统调用 ([2251b8a](https://gitee.com/openharmony/kernel_liteos_a/commits/2251b8a2d1f649422dd67f8551b085a7e0c63ec7)), closes [#I4FXPT](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FXPT)
* 实现了musl库net模块中的一些函数接口和相应的测试用例 ([3d00a7d](https://gitee.com/openharmony/kernel_liteos_a/commits/3d00a7d23a96f29c138cfc1672825b90b9e0c05e)), closes [#I4JQI1](https://gitee.com/openharmony/third_party_musl/issues/I4JQI1)
* 添加进程线程冒烟用例 ([2be5968](https://gitee.com/openharmony/kernel_liteos_a/commits/2be59680f2fb0801b43522cd38cc387c8ff38766)), closes [#I4EOGA](https://gitee.com/openharmony/kernel_liteos_a/issues/I4EOGA)
* 用户态进程主线程退出时,其他子线程刚好进入异常处理流程会导致系统卡死 ([d955790](https://gitee.com/openharmony/kernel_liteos_a/commits/d955790a44a679421798ec1ac2900b4d75dd75a4)), closes [#I4KGBT](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KGBT)
* 编码规范修改 ([d161a0b](https://gitee.com/openharmony/kernel_liteos_a/commits/d161a0b03de046c05fff45a2b625631b4e45a347))
* 编码规范问题修复 ([f60bc94](https://gitee.com/openharmony/kernel_liteos_a/commits/f60bc94cf231bc615ff6603ca0393b8fe33a8c47))
* 编译框架在做编译入口的统一 ([bdb9864](https://gitee.com/openharmony/kernel_liteos_a/commits/bdb9864436a6f128a4c3891bbd63e3c60352689f)), closes [#I4KRQN](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KRQN)
* 解决dmesg -s参数double lock问题 ([e151256](https://gitee.com/openharmony/kernel_liteos_a/commits/e1512566e322eb1fbc8f5d5997f9bfcd022feac7)), closes [#I4HIJK](https://gitee.com/openharmony/kernel_liteos_a/issues/I4HIJK)
* 进程退出前自己回收vmspace中的所有region ([298ccea](https://gitee.com/openharmony/kernel_liteos_a/commits/298ccea3fedaccc651b38973f0455fa1ce12e516)), closes [#I4CKQC](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CKQC)
* 通过g_uart_fputc_en关闭打印后shell进程不能正常启动 ([d21b05c](https://gitee.com/openharmony/kernel_liteos_a/commits/d21b05c0f69877130366ad37b852a0f30c11809d)), closes [#I4CTY2](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CTY2)
* 针对pr是否同步至release分支增加原因说明规则 ([b37a7b7](https://gitee.com/openharmony/kernel_liteos_a/commits/b37a7b79292d93dae6c4914952b5f3bb509e8721))
* 非当前进程销毁时销毁liteipc时错误的销毁了当前进程的liteipc资源 ([0f0e85b](https://gitee.com/openharmony/kernel_liteos_a/commits/0f0e85b7a6bf76d540925fbf661c483c8dba1cba)), closes [#I4FSA7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FSA7)
### Code Refactoring
* los_cir_buf.c中接口整合 ([0d325c5](https://gitee.com/openharmony/kernel_liteos_a/commits/0d325c56a1053043db05d53a6c8083f4d35f116b)), closes [#I4MC13](https://gitee.com/openharmony/kernel_liteos_a/issues/I4MC13)
### Features
* add option SIOCGIFBRDADDR for ioctl ([4ecc473](https://gitee.com/openharmony/kernel_liteos_a/commits/4ecc473843207d259613d26b8ee176d75e7f00fd)), closes [#I4DNRF](https://gitee.com/openharmony/kernel_liteos_a/issues/I4DNRF)
* add sync() to vfs ([f67c4da](https://gitee.com/openharmony/kernel_liteos_a/commits/f67c4dae5141914df2e069dce0196b14780649d8)), closes [#I480HV](https://gitee.com/openharmony/kernel_liteos_a/issues/I480HV)
* **build:** support gcc toolchain ([6e886d4](https://gitee.com/openharmony/kernel_liteos_a/commits/6e886d4233dec3b82a27642f174b920e5f98f6aa))
* L0-L1 支持Perf ([6e0a3f1](https://gitee.com/openharmony/kernel_liteos_a/commits/6e0a3f10bbbfe29d110c050da927684b6d77b961)), closes [#I47I9A](https://gitee.com/openharmony/kernel_liteos_a/issues/I47I9A)
* L0~L1 支持Lms ([e748fdb](https://gitee.com/openharmony/kernel_liteos_a/commits/e748fdbe578a1ddd8eb10b2e207042676231ba26)), closes [#I4HYAV](https://gitee.com/openharmony/kernel_liteos_a/issues/I4HYAV)
* liteipc 静态内存优化 ([5237924](https://gitee.com/openharmony/kernel_liteos_a/commits/52379242c109e0cf442784dbe811ff9d42d5f33a)), closes [#I4G4HP](https://gitee.com/openharmony/kernel_liteos_a/issues/I4G4HP)
* page cache backed by vnode instead of filep ([38a6b80](https://gitee.com/openharmony/kernel_liteos_a/commits/38a6b804e9291d2fdbd189825ebd7d56165ec51c)), closes [#I44TBS](https://gitee.com/openharmony/kernel_liteos_a/issues/I44TBS)
* 提供低功耗默认处理框架 ([212d1bd](https://gitee.com/openharmony/kernel_liteos_a/commits/212d1bd1e806530fe7e7a16ea986cb2c6fb084ed)), closes [#I4KBG9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KBG9)
* 支持AT_RANDOM以增强用户态栈保护能力 ([06ea037](https://gitee.com/openharmony/kernel_liteos_a/commits/06ea03715f0cfb8728fadd0d9c19a403dc8f6028)), closes [#I4CB8M](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CB8M)
* 支持L1 低功耗框架 ([64e49ab](https://gitee.com/openharmony/kernel_liteos_a/commits/64e49aba7c9c7d2280c5b3f29f04b17b63209855)), closes [#I4JSOT](https://gitee.com/openharmony/kernel_liteos_a/issues/I4JSOT)
* 支持LOS_TaskJoin 和 LOS_TaskDetach ([37bc11f](https://gitee.com/openharmony/kernel_liteos_a/commits/37bc11fa8837a3019a0a56702f401ec1845f6547)), closes [#I4EENF](https://gitee.com/openharmony/kernel_liteos_a/issues/I4EENF)
* 新增解析异常和backtrace信息脚本 ([7019fdf](https://gitee.com/openharmony/kernel_liteos_a/commits/7019fdfcbb33c660e8aa9fd399d5fccbd7e23b49)), closes [#I47EVQ](https://gitee.com/openharmony/kernel_liteos_a/issues/I47EVQ)
* 调度tick响应时间计算优化 ([f47da44](https://gitee.com/openharmony/kernel_liteos_a/commits/f47da44b39be7fa3e9b5031d7b79b9bef1fd4fbc))
* 调度去进程化,优化进程线程依赖关系 ([dc479fb](https://gitee.com/openharmony/kernel_liteos_a/commits/dc479fb7bd9cb8441e4e47d44b42110ea07d76a2))
* 调度相关模块间依赖优化 ([0e3936c](https://gitee.com/openharmony/kernel_liteos_a/commits/0e3936c4f8b8bcfc48d283a6d53413e0fc0619b3)), closes [#I4RPRW](https://gitee.com/openharmony/kernel_liteos_a/issues/I4RPRW)
* 进程cpup占用率结构优化为动态分配 ([f06e090](https://gitee.com/openharmony/kernel_liteos_a/commits/f06e090a1085a654fd726fbc3c3a1c2bc703d663)), closes [#I4GLNT](https://gitee.com/openharmony/kernel_liteos_a/issues/I4GLNT)
* 进程rlimit修改为动态分配,减少静态内存占用 ([cf8446c](https://gitee.com/openharmony/kernel_liteos_a/commits/cf8446c94112ed6993a2e6e71e793d83a72689d5)), closes [#I4EZY5](https://gitee.com/openharmony/kernel_liteos_a/issues/I4EZY5)
### BREAKING CHANGES
* 1. 删除 LOS_CirBufLock()LOS_CirBufUnlock()内核对外接口
2. LOS_CirBufWrite()LOS_CirBufRead()由原先内部不进行上/解锁操作,变为默认已包含上/解锁操作。
* 新增支持API:
LOS_LmsCheckPoolAdd使能检测指定内存池
LOS_LmsCheckPoolDel不检测指定内存池
LOS_LmsAddrProtect为指定内存段上锁不允许访问
LOS_LmsAddrDisableProtect去能指定内存段的访问保护
* 1.新增一系列perf的对外API位于los_perf.h中.
LOS_PerfInit配置采样数据缓冲区
LOS_PerfStart开启Perf采样
LOS_PerfStop停止Perf采样
LOS_PerfConfig配置Perf采样事件
LOS_PerfDataRead读取采样数据
LOS_PerfNotifyHookReg 注册采样数据缓冲区的钩子函数
LOS_PerfFlushHookReg 注册缓冲区刷cache的钩子
2. 用户态新增perf命令
【Usage】:
./perf [start] /[start id] Start perf.
./perf [stop] Stop perf.
./perf [read nBytes] Read nBytes raw data from perf buffer and print out.
./perf [list] List events to be used in -e.
./perf [stat] or [record] <option> <command>
-e, event selector. use './perf list' to list available events.
-p, event period.
-o, perf data output filename.
-t, taskId filter(whiltelist), if not set perf will sample all tasks.
-s, type of data to sample defined in PerfSampleType los_perf.h.
-P, processId filter(whiltelist), if not set perf will sample all processes.
-d, whether to prescaler (once every 64 counts), which only take effect on cpu cycle hardware event.
# (2021-09-30)
### Bug Fixes
* A核代码告警清零 ([698756d](https://gitee.com/openharmony/kernel_liteos_a/commits/698756d1e6dfb11b9f874c02ce6a1496646f2c27)), closes [#I4378T](https://gitee.com/openharmony/kernel_liteos_a/issues/I4378T)
* A核告警消除 ([d16bfd0](https://gitee.com/openharmony/kernel_liteos_a/commits/d16bfd005a6dae78df2df3ad55cf21e0716dfae9)), closes [#I46KF6](https://gitee.com/openharmony/kernel_liteos_a/issues/I46KF6)
* 3518平台, 异常测试进程无法正常退出 ([23937a2](https://gitee.com/openharmony/kernel_liteos_a/commits/23937a239f50d1487e89f3184e4f4b933d6842c6)), closes [#I3V8R5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V8R5)
* add (void) to GetFileMappingList method ([56b8eca](https://gitee.com/openharmony/kernel_liteos_a/commits/56b8ecaf171671c0fe97f1dd1f191bebb7812a51)), closes [#I3XPXY](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XPXY)
* add capability and amend smoke testcase ([c9d69e2](https://gitee.com/openharmony/kernel_liteos_a/commits/c9d69e2d1bde57c67068cc36f6a79327d5db5daf))
* add fchdir api ([e828cbd](https://gitee.com/openharmony/kernel_liteos_a/commits/e828cbdeac7d60bfd6ed98c75a9958ee8ec7b672))
* add fchmod api ([2f214bf](https://gitee.com/openharmony/kernel_liteos_a/commits/2f214bf4de6c31875c77e84b1763e96bc5ceb669))
* add fststfs api and unitest ([4c57aa2](https://gitee.com/openharmony/kernel_liteos_a/commits/4c57aa26ad3644ce2429effc8e8fe7fd3c52ebc2))
* add product_path parameter for driver build ([88fe4eb](https://gitee.com/openharmony/kernel_liteos_a/commits/88fe4eb3e1eafa6d1e32c7b96579a07f5a8c6e35)), closes [#I3PQ10](https://gitee.com/openharmony/drivers_adapter/issues/I3PQ10)
* add syscall for ppoll & add 2 testcases ([defedb6](https://gitee.com/openharmony/kernel_liteos_a/commits/defedb6fdf0806da4a39e22408544cdfb405f2ff))
* avoid compile warning ignored ([eca711b](https://gitee.com/openharmony/kernel_liteos_a/commits/eca711bb64a7c806ae34c8483cac73fe22b0104f)), closes [#I3VOAO](https://gitee.com/openharmony/kernel_liteos_a/issues/I3VOAO)
* A核codex修改 ([ec977a1](https://gitee.com/openharmony/kernel_liteos_a/commits/ec977a1c7e9ba4ea6621ceb1d0d10e586148208d)), closes [#I40B1S](https://gitee.com/openharmony/kernel_liteos_a/issues/I40B1S)
* BBOX使用预留物理内存缓存故障日志 ([2ad176e](https://gitee.com/openharmony/kernel_liteos_a/commits/2ad176e587d5ed7106831a25d386a88e26192e2b)), closes [#I41YIZ](https://gitee.com/openharmony/kernel_liteos_a/issues/I41YIZ)
* bootargs解析与rootfs挂载解耦并支持自定义bootargs参数 ([80473f0](https://gitee.com/openharmony/kernel_liteos_a/commits/80473f0975fe6fd4c4eae3a8a473674ad2dd1293)), closes [#I41CL8](https://gitee.com/openharmony/kernel_liteos_a/issues/I41CL8)
* **build:** clang10.0.1支持lto去掉冗余判断 ([73223ae](https://gitee.com/openharmony/kernel_liteos_a/commits/73223ae7e652b7cd9f1e1848c32b2b2573d07b2a))
* **build:** fix rootfsdir.sh target directory not exist ([21bf2b8](https://gitee.com/openharmony/kernel_liteos_a/commits/21bf2b889931787fb18ca7ea238291fd57e76d51)), closes [#I3NHQ0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NHQ0)
* **build:** 去除冗余单板相关的宏配置 ([471de36](https://gitee.com/openharmony/kernel_liteos_a/commits/471de3663ea8b63f7448162edc0293b8723dcefc))
* clang10 lld could not recognized Oz ([87a0006](https://gitee.com/openharmony/kernel_liteos_a/commits/87a0006d5e1976fdf5efe4be383921610eb04ec6))
* clang相关编译选项隔离 ([77dcef4](https://gitee.com/openharmony/kernel_liteos_a/commits/77dcef4bc0c92d0141f7a3be0addd4d5cb533b0b)), closes [#I444AV](https://gitee.com/openharmony/kernel_liteos_a/issues/I444AV)
* codex ([101a55d](https://gitee.com/openharmony/kernel_liteos_a/commits/101a55d1199530d621f809976f0024aa8295cce8))
* codex clean ([b5370af](https://gitee.com/openharmony/kernel_liteos_a/commits/b5370af822c8e81ed2248ac8aa3bb479a0db9dae)), closes [#I3UOFN](https://gitee.com/openharmony/kernel_liteos_a/issues/I3UOFN)
* compile error when fatfs disabled ([fd3f407](https://gitee.com/openharmony/kernel_liteos_a/commits/fd3f4072b5c3dff710013ccdaddf114b0e13f435))
* console compile bug fix ([f8441a0](https://gitee.com/openharmony/kernel_liteos_a/commits/f8441a0cdea301449416b0c0477dc48a05b6ab4e))
* correct spelling ([c66fe03](https://gitee.com/openharmony/kernel_liteos_a/commits/c66fe0313f76ba41992b4864c93cf82934378ad3))
* Correctly handle the return value of LOS_EventRead in QuickstartListen. ([0e0ab81](https://gitee.com/openharmony/kernel_liteos_a/commits/0e0ab81ff9474cffd5e60a8ee741840eac5d737b)), closes [#I3PSLZ](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PSLZ)
* Ctrl-C move out of LOS_MAGIC_KEY_ENABLE ([40f239a](https://gitee.com/openharmony/kernel_liteos_a/commits/40f239a7d4673dc740c853b1011b5072e48385b7))
* Delete useless 'exc interaction' macros and function declarations. ([d2f2679](https://gitee.com/openharmony/kernel_liteos_a/commits/d2f26790716c9f76589c4a7d6fa5518f9ccd743c)), closes [#I3SDKY](https://gitee.com/openharmony/kernel_liteos_a/issues/I3SDKY)
* dereference NULL point bug fix ([deaa564](https://gitee.com/openharmony/kernel_liteos_a/commits/deaa564a66b83c9fe19a37b8a061ec9064ece354))
* do not build toybox temporarily ([044f2c7](https://gitee.com/openharmony/kernel_liteos_a/commits/044f2c7c17c68e10aeccc3af0c222cfc722d194c))
* do not override existing libs ([8118408](https://gitee.com/openharmony/kernel_liteos_a/commits/8118408123e75f7f5a4ab9101e388be6bba0dcda))
* **doc:** 修复README_zh-HK.md的链接错误 ([f1b4c87](https://gitee.com/openharmony/kernel_liteos_a/commits/f1b4c87bc44650348504bc00b3f6f94491c341a0))
* fatfs memory leak ([fbfd71d](https://gitee.com/openharmony/kernel_liteos_a/commits/fbfd71dfe3b5555ef09e542d96a630dfba636daa))
* fix function name OsSchedSetIdleTaskSchedParam ([8f8c038](https://gitee.com/openharmony/kernel_liteos_a/commits/8f8c038b217d5ba2518413bfc1ba857587d47442))
* Fix kernel page fault exception handling causing system exception. ([a89fb57](https://gitee.com/openharmony/kernel_liteos_a/commits/a89fb57f5795236b93fd19ee2d7a059cae1b2b1b)), closes [#I3RAN4](https://gitee.com/openharmony/kernel_liteos_a/issues/I3RAN4)
* fix length typo ([12d98b1](https://gitee.com/openharmony/kernel_liteos_a/commits/12d98b144b70e726d3fd31ddc9d17ed855d0ec1b))
* fix mq function by enable mq_notify api ([4427142](https://gitee.com/openharmony/kernel_liteos_a/commits/4427142d734df8f95f4599093392904abacc5c93))
* Fix quickstart codingstyle ([2e011b6](https://gitee.com/openharmony/kernel_liteos_a/commits/2e011b672f6b96ea7e0db066a07e3f9fb6ba5df3)), closes [#I3OPOM](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OPOM)
* fix stored typo ([d25560f](https://gitee.com/openharmony/kernel_liteos_a/commits/d25560f8ac3216670d198cbbb25891c394e0b3c2))
* fix syscall faccessat,fstatfs,fstatat & add 6 testcases ([aa1cd24](https://gitee.com/openharmony/kernel_liteos_a/commits/aa1cd245a5711e5b53c328b688da5ddc2e783d5f))
* fix the inappropriate errno in FatFs ([af61187](https://gitee.com/openharmony/kernel_liteos_a/commits/af61187587411dca38ff62e720451f08f19c1c82)), closes [#I3O8IF](https://gitee.com/openharmony/kernel_liteos_a/issues/I3O8IF)
* fix typo in quickstart ([3b2ff4b](https://gitee.com/openharmony/kernel_liteos_a/commits/3b2ff4b71fc5ae1dc74180c33fd66f69da0059d1)), closes [#I3M1S8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3M1S8)
* Fix wrong judgment in los_trace.c to avoid null pointer access. ([4d863e9](https://gitee.com/openharmony/kernel_liteos_a/commits/4d863e985b6372f7895db57b602b662dba5cadd0)), closes [#I3RT9F](https://gitee.com/openharmony/kernel_liteos_a/issues/I3RT9F)
* Identical condition 'ret<0', second condition is always false. :bug: ([1348809](https://gitee.com/openharmony/kernel_liteos_a/commits/1348809807548dd481286a55a6677a9169fcd705))
* init进程收到子进程退出信号后调用fork重新拉起进程会导致系统卡死 ([35a2f3a](https://gitee.com/openharmony/kernel_liteos_a/commits/35a2f3af33a5dba1e0ba36587efced8fead97223)), closes [#I41HOY](https://gitee.com/openharmony/kernel_liteos_a/issues/I41HOY)
* kernel crashed after rmdir the umounted folder ([ac0d083](https://gitee.com/openharmony/kernel_liteos_a/commits/ac0d083b1c89c4ad3fdaab0347d11f174d0185cb))
* kernel crashed when delete a umounted folder ([f305d1f](https://gitee.com/openharmony/kernel_liteos_a/commits/f305d1f702a770010125a0f4f0152ffefeeec5c4))
* kernel crashed when delete a umounted folder ([c6e9212](https://gitee.com/openharmony/kernel_liteos_a/commits/c6e921241b1cf26bcbfeea44e20f6b596512e259))
* **kernel_test:** 内核mem/shm冒烟用例重复运行失败 ([0676578](https://gitee.com/openharmony/kernel_liteos_a/commits/0676578aae09c101d79e7a276823e849df293e29)), closes [#I3TH4W](https://gitee.com/openharmony/kernel_liteos_a/issues/I3TH4W)
* L1 toybox 命令功能实现 ([2ff44c4](https://gitee.com/openharmony/kernel_liteos_a/commits/2ff44c4938d2e66ce60e9497c505eb6e97efc8c2)), closes [#I41N2A](https://gitee.com/openharmony/third_party_toybox/issues/I41N2A)
* liteipc max data size too small ([4dc421e](https://gitee.com/openharmony/kernel_liteos_a/commits/4dc421e3decdaae60219d533c4a93dbc9334e35f))
* LiteOS_A BBOX Codex整改 ([6a5a032](https://gitee.com/openharmony/kernel_liteos_a/commits/6a5a0326d2b18ffacce5d38fb351530973c2f245)), closes [#I43RQU](https://gitee.com/openharmony/kernel_liteos_a/issues/I43RQU)
* Liteos-a创建的文件夹在Ubuntu中不可见 ([a9fc1e0](https://gitee.com/openharmony/kernel_liteos_a/commits/a9fc1e0e5d3e5eb8a34c568a8d147320a9afebe1)), closes [#I3XMY6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XMY6)
* lookup new vnode may cause parent vnode freeing ([902a11d](https://gitee.com/openharmony/kernel_liteos_a/commits/902a11de9a4b08e799820fb87942cb2171b9e095)), closes [#I3MYP4](https://gitee.com/openharmony/kernel_liteos_a/issues/I3MYP4)
* **mini:** fix compile error in mini liteos_a ([e13cb3b](https://gitee.com/openharmony/kernel_liteos_a/commits/e13cb3bcc4e74d4c49c31d290d686f99a4e81e3f))
* minimal compile ([ac8c2c6](https://gitee.com/openharmony/kernel_liteos_a/commits/ac8c2c6d5b9ede0e46b48212f0b3447605a613c4))
* misspell ([08980ea](https://gitee.com/openharmony/kernel_liteos_a/commits/08980eac3c249ec6a6717d8a04fb0be7716053a1))
* mkdir -p is more robust ([e38f9a9](https://gitee.com/openharmony/kernel_liteos_a/commits/e38f9a98c9d373db8381af707c5996d1fefef64e))
* mksh compile bug fix ([d8263b1](https://gitee.com/openharmony/kernel_liteos_a/commits/d8263b1e91d76706d52df321ef642c1c8297e8e4)), closes [#I3ZMR7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3ZMR7)
* modify event API description ([937734b](https://gitee.com/openharmony/kernel_liteos_a/commits/937734b1e9f5fc52e0ac727549bd2e4b4c864e3c))
* move nuttx head file back ([4c8a86e](https://gitee.com/openharmony/kernel_liteos_a/commits/4c8a86ece7cafa8f74441bacc74c7788c0a1b780)), closes [#I4443Q](https://gitee.com/openharmony/kernel_liteos_a/issues/I4443Q)
* nanosleep 接口的rmtp参数被错误清零 ([9458de9](https://gitee.com/openharmony/kernel_liteos_a/commits/9458de9ac664cd75540c8b638b9a6caf82812fc8)), closes [#I41U0R](https://gitee.com/openharmony/kernel_liteos_a/issues/I41U0R)
* no exception information output, when the system is abnormal ([5bf4d1c](https://gitee.com/openharmony/kernel_liteos_a/commits/5bf4d1c7128e6718611bbec23cb4373bcb3bfe55))
* no exception information output, when the system is abnormal ([28aa777](https://gitee.com/openharmony/kernel_liteos_a/commits/28aa777191e7b41e4f1f346ab79f8688edc59c6d))
* no exception information output, when the system is abnormal after holding ([0ed8adf](https://gitee.com/openharmony/kernel_liteos_a/commits/0ed8adfe3ae59672e284331d40ef3b9e0bc8e094))
* Optimiz macro of quickstart cmd ([cb140a4](https://gitee.com/openharmony/kernel_liteos_a/commits/cb140a4442c02dd0b1925cc58deecbf4da36dcea)), closes [#I3OSYT](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OSYT)
* Optimize /dev/quickstart permissions. ([4e24b57](https://gitee.com/openharmony/kernel_liteos_a/commits/4e24b572897c33e1b2723122c0e13d3931096bae)), closes [#I3OYUQ](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OYUQ)
* Optimize quickstart node implementation ([4abd2e0](https://gitee.com/openharmony/kernel_liteos_a/commits/4abd2e0247b14718bb21756fb446142140d30a88)), closes [#I3R8O8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3R8O8)
* OsGerCurrSchedTimeCycle 函数存在拼写错误 ([53ced1a](https://gitee.com/openharmony/kernel_liteos_a/commits/53ced1a85edc3d06230225ced3916772f432243f)), closes [#I446CX](https://gitee.com/openharmony/kernel_liteos_a/issues/I446CX)
* OsGetArgsAddr声明所在头文件不正确 ([14bd753](https://gitee.com/openharmony/kernel_liteos_a/commits/14bd753aa8beb49af887c8d0aedaefa446409760)), closes [#I41MWM](https://gitee.com/openharmony/kernel_liteos_a/issues/I41MWM)
* parent point of vnode found by VfsHashGet should be updated ([f32caa5](https://gitee.com/openharmony/kernel_liteos_a/commits/f32caa52c67eca20d58676be4e0439acbb4c5ac3)), closes [#I3NNFA](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NNFA)
* PathCacheFree try to free name field in struct PathCache ([9f47faf](https://gitee.com/openharmony/kernel_liteos_a/commits/9f47faff732609cf2249f104b94ed55f3ef133bb)), closes [#I3NTH9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NTH9)
* PathCacheMemoryDump miscalculate the RAM usage of PathCache ([87da7c7](https://gitee.com/openharmony/kernel_liteos_a/commits/87da7c794c9bc8e311ae5242820fbf8aefd8d558)), closes [#I3OBXY](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OBXY)
* Provide a separate configuration macro for boot environment in RAM. ([e28e06b](https://gitee.com/openharmony/kernel_liteos_a/commits/e28e06b08f5b28091153e584cb9d93014a9f2b10))
* Provide a separate configuration macro for boot environment in RAM. ([bc67393](https://gitee.com/openharmony/kernel_liteos_a/commits/bc67393a67f714e0a8165b6103e53699c676341c))
* Provide a separate configuration macro for boot environment in RAM. ([f13b90e](https://gitee.com/openharmony/kernel_liteos_a/commits/f13b90e4308ba3d60683799b9ce62fb3705ac277)), closes [#I3OADR](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OADR)
* race condition in liteipc ([7e2aef2](https://gitee.com/openharmony/kernel_liteos_a/commits/7e2aef2480b15f71ee0e089cef4443f578e03dbb)), closes [#I3PW5Y](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PW5Y)
* rebuild mksh depends on rebuild.sh script ([bef4ab9](https://gitee.com/openharmony/kernel_liteos_a/commits/bef4ab9835dec865898c74337dfb7154718b94aa))
* remove redundant headfile ([73a7777](https://gitee.com/openharmony/kernel_liteos_a/commits/73a777777e1b834192f6bb2c0e8bd03c69765c11)), closes [#I3RTNR](https://gitee.com/openharmony/kernel_liteos_a/issues/I3RTNR)
* Remove redundant invalid codes ([fe05df4](https://gitee.com/openharmony/kernel_liteos_a/commits/fe05df40ae710632adb1bd54fb04ad4a8e0c1429)), closes [#I3R70T](https://gitee.com/openharmony/kernel_liteos_a/issues/I3R70T)
* Show conflicting files for git apply or patch -p command ([35f7957](https://gitee.com/openharmony/kernel_liteos_a/commits/35f79579758644cbcac6005f894be21f34f42b99)), closes [#I3NNUS](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NNUS)
* SIOCGIFCONF ioctl malloc size error in kernel ([bfd27e7](https://gitee.com/openharmony/kernel_liteos_a/commits/bfd27e78b259eedbd4c30548e80c9b4d789d26e1)), closes [#I3XEZ3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XEZ3)
* smp启动代码解耦及内存映射关系解耦 ([3bb3173](https://gitee.com/openharmony/kernel_liteos_a/commits/3bb3173604dc4dea09301f61da402974185dc112)), closes [#I41P8Y](https://gitee.com/openharmony/kernel_liteos_a/issues/I41P8Y)
* some branch in format does not release the vnode mutex properly ([9b2b700](https://gitee.com/openharmony/kernel_liteos_a/commits/9b2b700fa0e3a8edadb38f09c917a3e3f013347f)), closes [#I3OFAY](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OFAY)
* Sortlink, the response time to insert the node should be inserted into the back of the existing node. ([1323874](https://gitee.com/openharmony/kernel_liteos_a/commits/1323874389030c55fb053fead12ca1c6654d8851)), closes [#I3PSJ8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PSJ8)
* statfs can't get f_bfree and f_bavail of a FAT12/FAT16 partition ([9503c4a](https://gitee.com/openharmony/kernel_liteos_a/commits/9503c4a9fc30aaa8ea2031d4fb794436f3c98055)), closes [#I3Q0VS](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Q0VS)
* SysOpenat返回值应该为进程fd而非系统全局fd。 ([3457c0b](https://gitee.com/openharmony/kernel_liteos_a/commits/3457c0b11debb2cf5d4abe325c2510a750654512)), closes [#I3TNAK](https://gitee.com/openharmony/kernel_liteos_a/issues/I3TNAK)
* the total used vnode number not increased after unlink a file under ([4f514a1](https://gitee.com/openharmony/kernel_liteos_a/commits/4f514a16af5a3f3b9c4ea182de774297afb17f66)), closes [#I3TS1Y](https://gitee.com/openharmony/kernel_liteos_a/issues/I3TS1Y)
* tick 动态化计算优化,消除中断执行时间对系统总体时间的影响,保证软件定时器的响应精度。 ([8df3e8c](https://gitee.com/openharmony/kernel_liteos_a/commits/8df3e8c96515a1907455a9bbc61426f43c803c62)), closes [#I43UQJ](https://gitee.com/openharmony/kernel_liteos_a/issues/I43UQJ)
* toybox update ([c3245b3](https://gitee.com/openharmony/kernel_liteos_a/commits/c3245b3ce317eb58c8dad58fdfc7f094b9b9794b))
* toybox命令升级 ([76f45b3](https://gitee.com/openharmony/kernel_liteos_a/commits/76f45b3fb2783d1cab45a6ba08787c29dfa2c948)), closes [#I41N2A](https://gitee.com/openharmony/third_party_toybox/issues/I41N2A)
* update LOS_DL_LIST_IS_END comment ([900269b](https://gitee.com/openharmony/kernel_liteos_a/commits/900269bd4645252d898f6d3b73de01d8548c960c))
* userfs分区的起始地址与大小改为通过bootargs配置 ([2e2b142](https://gitee.com/openharmony/kernel_liteos_a/commits/2e2b14205f4b81c7483ab42d62f144487097e9a4)), closes [#I3XNEY](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XNEY)
* VnodeInUseIter and VnodeFreeAll used to be recursive ([5f6656c](https://gitee.com/openharmony/kernel_liteos_a/commits/5f6656cb36a2ffb0b290aeb53981aba7501e80b2)), closes [#I3NN3U](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NN3U)
* 以g_sysSchedStartTime是否为0判断时间轴是否生效存在极限场景导致调度时间不生效 ([67ac8c4](https://gitee.com/openharmony/kernel_liteos_a/commits/67ac8c4c586adc371ece56700fd42371ca7fc885)), closes [#I45HP5](https://gitee.com/openharmony/kernel_liteos_m/issues/I45HP5)
* 修复FATFS中不同内部接口不支持FAT12/FAT16 FAT表结束标志 ([33f5c70](https://gitee.com/openharmony/kernel_liteos_a/commits/33f5c70e6c8781758d2bfde0f60ca3d6ec7d543f)), closes [#I409R6](https://gitee.com/openharmony/kernel_liteos_a/issues/I409R6)
* 修复kill进程时因liteipc阻塞的进程概率无法退出问题 ([7de43bb](https://gitee.com/openharmony/kernel_liteos_a/commits/7de43bb004a12f926550f0b36ca3c2fa610feb27)), closes [#I3XX7K](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XX7K)
* 修复MagicKey数组越界访问 ([071cd62](https://gitee.com/openharmony/kernel_liteos_a/commits/071cd6268aeaaef702387dacaf4ef1ffbb7618fc)), closes [#I3U4N9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3U4N9)
* 修复mprotect修改地址区间的权限后相应的区间名丢失问题 ([e425187](https://gitee.com/openharmony/kernel_liteos_a/commits/e425187d176a5e09bc5253faefc9cfc8454da0a3)), closes [#I43R40](https://gitee.com/openharmony/kernel_liteos_a/issues/I43R40)
* 修复mq_close关闭后仍然占用文件描述符的问题 ([590c7b4](https://gitee.com/openharmony/kernel_liteos_a/commits/590c7b4e22662781d05ad035a785e985d573ec33)), closes [#I3ZQDA](https://gitee.com/openharmony/kernel_liteos_a/issues/I3ZQDA)
* 修复mqueue问题 ([26ee8b8](https://gitee.com/openharmony/kernel_liteos_a/commits/26ee8b836e346e641de4ecd72284f5d377bca6f8)), closes [#I43P4T](https://gitee.com/openharmony/kernel_liteos_a/issues/I43P4T)
* 修复sigwait等待到的信号值与获取的siginfo中的值不一致 ([ed7defb](https://gitee.com/openharmony/kernel_liteos_a/commits/ed7defbd439c345a07159d40eb04433afd530004)), closes [#I3M12H](https://gitee.com/openharmony/kernel_liteos_a/issues/I3M12H)
* 修复了LOSCFG_FS_FAT_VIRTUAL_PARTITION宏开关错误作用域引起的功能错误 ([acda419](https://gitee.com/openharmony/kernel_liteos_a/commits/acda419a2d773ea890052a16ee66b4872f941fbb)), closes [#I3W1IW](https://gitee.com/openharmony/kernel_liteos_a/issues/I3W1IW)
* 修复了内核的VFAT测试用例 ([a8384b5](https://gitee.com/openharmony/kernel_liteos_a/commits/a8384b5db2274d50a350910d7cfd3fc36b4f4103)), closes [#I3XF3R](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XF3R)
* 修复内核access chmod chown接口 ([56a95b9](https://gitee.com/openharmony/kernel_liteos_a/commits/56a95b9ec903f815f9199ac65ca318e00a83b2ed)), closes [#I3Z5L6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z5L6)
* 修复内核c库的makefile中被优化函数替换的高频函数依然参与了编译的问题 ([6f6dc4f](https://gitee.com/openharmony/kernel_liteos_a/commits/6f6dc4f24c8ab05a6d42da46a9fa41d74a477bd7)), closes [#I3XGM8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XGM8)
* 修复内核堆完整性检查逻辑中访问非法指针导致系统异常问题。 ([30f5ab8](https://gitee.com/openharmony/kernel_liteos_a/commits/30f5ab89b72d45f596b15af82a8e8e01add7977d)), closes [#I3VJZT](https://gitee.com/openharmony/kernel_liteos_a/issues/I3VJZT)
* 修复启动框架debug模式下-Werror=maybe-uninitialized告警以及符号链接不进镜像的隐患 ([4c02415](https://gitee.com/openharmony/kernel_liteos_a/commits/4c024159a9600745863e49ee955308470a5b657b)), closes [#I3T5HR](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T5HR)
* 修复开机概率挂死 ([2e82c36](https://gitee.com/openharmony/kernel_liteos_a/commits/2e82c361f73b2119613c3571c48faae8ec41d4eb)), closes [#I3SWY2](https://gitee.com/openharmony/kernel_liteos_a/issues/I3SWY2)
* 修复文档链接失效问题 ([42a3a6c](https://gitee.com/openharmony/kernel_liteos_a/commits/42a3a6c51bfca4ade8ce94084ea2f8eb1c86a137)), closes [#I45297](https://gitee.com/openharmony/kernel_liteos_a/issues/I45297)
* 修改/proc/mounts显示格式 ([6860246](https://gitee.com/openharmony/kernel_liteos_a/commits/6860246cfaac6f540665e79bbc4c3d54c419b092)), closes [#I3XGCS](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XGCS)
* 修改clock_gettime接口适配posix标准测试用例011输入clk_id错误时返回值ESRCH为EINVAL. ([f8cf6e6](https://gitee.com/openharmony/kernel_liteos_a/commits/f8cf6e6439ee017fe8e0d4ecfc9949c28fa6775f)), closes [#I3OUHI](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OUHI)
* 修改DoNanoSleep 以纳秒为单位 ([6917e08](https://gitee.com/openharmony/kernel_liteos_a/commits/6917e08431689ccbd5a30e9a39b67016ffb64d0a)), closes [#I3Z9DP](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z9DP)
* 修改某些平台保存bbox日志失败的问题 ([8f6a1dd](https://gitee.com/openharmony/kernel_liteos_a/commits/8f6a1dd33c59164070e8d2fb5abbd3e76ef8ac8e)), closes [#I41UTP](https://gitee.com/openharmony/kernel_liteos_a/issues/I41UTP)
* 修改默认窗口宽度到400 ([09c491c](https://gitee.com/openharmony/kernel_liteos_a/commits/09c491ca1fd6d3110eafb0d07e45b25bdc3bd5d0)), closes [#I40LQX](https://gitee.com/openharmony/kernel_liteos_a/issues/I40LQX)
* 关闭jffs和fat后rootfs配置也被相应关闭导致nand介质的rootfs不可用。 ([0ea476b](https://gitee.com/openharmony/kernel_liteos_a/commits/0ea476b9741fabd3c255c2770688f587920cf509)), closes [#I3SBYN](https://gitee.com/openharmony/kernel_liteos_a/issues/I3SBYN)
* 内核态在console初始化完成后使用printf无法正常打印 ([44ce696](https://gitee.com/openharmony/kernel_liteos_a/commits/44ce6969048c2e252f3f9d66fa485c77bdab8ae7)), closes [#I3UG00](https://gitee.com/openharmony/kernel_liteos_a/issues/I3UG00)
* 去掉冗余的strip操作 ([7819d15](https://gitee.com/openharmony/kernel_liteos_a/commits/7819d15b3619681ae37a1349a6bec2440c829ae9)), closes [#I43767](https://gitee.com/openharmony/kernel_liteos_a/issues/I43767)
* 合并进程栈两个地址连续的region ([42f374d](https://gitee.com/openharmony/kernel_liteos_a/commits/42f374dd7a353f1c8227e92fa92827c1c7b32424)), closes [#I43QYJ](https://gitee.com/openharmony/kernel_liteos_a/issues/I43QYJ)
* 在内核提示No idle TCB时增加打印当前系统任务信息以方便问题定位。 ([11a9b00](https://gitee.com/openharmony/kernel_liteos_a/commits/11a9b00d43a6dbe9fba9f6eb07d78a9d226c28f8)), closes [#I434UC](https://gitee.com/openharmony/kernel_liteos_a/issues/I434UC)
* 增加表头,内容以制表符分栏。 ([e9ad6b7](https://gitee.com/openharmony/kernel_liteos_a/commits/e9ad6b71c3b1136414672cd21b339ded7a02dfb9)), closes [#I3W2M9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3W2M9)
* 将用户态内存调测解析脚本移至tools目录下 ([85b4cb7](https://gitee.com/openharmony/kernel_liteos_a/commits/85b4cb7a67b717984d3ebf68115c7139cc61d690)), closes [#I42T9A](https://gitee.com/openharmony/kernel_liteos_a/issues/I42T9A)
* 恢复了FATFS设置卷标的功能 ([9515d53](https://gitee.com/openharmony/kernel_liteos_a/commits/9515d53dccc9a6458bfbaf8e15143928f05cb660)), closes [#I3Y5G8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Y5G8)
* 解决kill进程时无法保证进程的已持有的内核资源合理释放. ([cf89f01](https://gitee.com/openharmony/kernel_liteos_a/commits/cf89f016e93f28f8d72e6f5de08640d08a155908)), closes [#I3S0N0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3S0N0)
* 解决不同环境下计算的rootfs的size偏小导致mcopy造成的disk full错误 ([c54879b](https://gitee.com/openharmony/kernel_liteos_a/commits/c54879b54875abece53b1f64072cfacbd2e1970e)), closes [#I3IA06](https://gitee.com/openharmony/kernel_liteos_a/issues/I3IA06)
* 设置qemu默认userfs大小/修改qemu驱动目录 ([1d952a2](https://gitee.com/openharmony/kernel_liteos_a/commits/1d952a254a6e7ec2f70f7112eb27355cfd01ba4d)), closes [#I3XW96](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XW96)
### Features
* active mksh & toybox ([cacb4f0](https://gitee.com/openharmony/kernel_liteos_a/commits/cacb4f0103ecb2d1b7af54d84957f88d3e9443d2)), closes [#I3VEOG](https://gitee.com/openharmony/kernel_liteos_a/issues/I3VEOG)
* Add /dev/quickstart to support synchronous communication between processes in user mode startup. ([46b63f7](https://gitee.com/openharmony/kernel_liteos_a/commits/46b63f71537789743ed2f3f337c1809ee4900d71)), closes [#I3OHO5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OHO5)
* add /proc/fd file to dump the pid/fd/path information ([600dded](https://gitee.com/openharmony/kernel_liteos_a/commits/600dded31e80df275ed08c326c0ce3d1857d8dd8)), closes [#I3WB5U](https://gitee.com/openharmony/kernel_liteos_a/issues/I3WB5U)
* add /proc/fs_cache to display cache info ([231cb6b](https://gitee.com/openharmony/kernel_liteos_a/commits/231cb6be27380948bc48136ae2e02c28450f47a8)), closes [#I3WWBD](https://gitee.com/openharmony/kernel_liteos_a/issues/I3WWBD)
* add /proc/fs_cache to display cache info ([53c6d96](https://gitee.com/openharmony/kernel_liteos_a/commits/53c6d96c6f97cb006216769f8b73f50fba3bc325)), closes [#I3WESD](https://gitee.com/openharmony/kernel_liteos_a/issues/I3WESD)
* add and fix some syscall ([ce849f2](https://gitee.com/openharmony/kernel_liteos_a/commits/ce849f2145e1569517c5244c9ffcaebed53f3a66))
* add blackbox for liteos_a ([a195aac](https://gitee.com/openharmony/kernel_liteos_a/commits/a195aac9fb60b0163f9eebb29084287d226bd14c)), closes [#I406NP](https://gitee.com/openharmony/kernel_liteos_a/issues/I406NP)
* add blackbox for liteos_a ([425975e](https://gitee.com/openharmony/kernel_liteos_a/commits/425975e4811023e31a520979c20ea2562224d9d0))
* add clear cache cmd to /proc/fs_cache ([3d1cf68](https://gitee.com/openharmony/kernel_liteos_a/commits/3d1cf683f37a6f75e9db2ce1f11ec93159b77663)), closes [#I3XLPH](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XLPH)
* add liteos patch ability ([98ca844](https://gitee.com/openharmony/kernel_liteos_a/commits/98ca8441fe75ee1c3318a6a09376fd72f5a51350))
* add support for gn build system ([a8805a6](https://gitee.com/openharmony/kernel_liteos_a/commits/a8805a65aab9109b915364fccf36c8328f636e48))
* add uid/gid for ProcFs ([6780659](https://gitee.com/openharmony/kernel_liteos_a/commits/67806596a3c0df9a54893d8c74ebe9da98d7fb06)), closes [#I3WGVP](https://gitee.com/openharmony/kernel_liteos_a/issues/I3WGVP)
* A核proc文件系统在echo模式下新增write的功能 ([f10dd7c](https://gitee.com/openharmony/kernel_liteos_a/commits/f10dd7c135d37a5fb0d78610d5ece5807d01eb1f)), closes [#I3T6MZ](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T6MZ)
* build OHOS_Image from kernel ([abf4d8f](https://gitee.com/openharmony/kernel_liteos_a/commits/abf4d8fb252631aca9d46211762880a23be2a0b1))
* **build:** make liteos_config_file available as gn argument ([f9a9077](https://gitee.com/openharmony/kernel_liteos_a/commits/f9a907772f506ca7e2d84e96d4d17cffc7dae50f))
* **build:** 使用xts -notest选项时内核用例不参与编译构建和用例编译配置方式调整 ([9bdf716](https://gitee.com/openharmony/kernel_liteos_a/commits/9bdf716407c125c9877b6f49c2133112c18cdabc))
* don't apply module_swith on configs of config ([f3beb4b](https://gitee.com/openharmony/kernel_liteos_a/commits/f3beb4b273c9a76fbfaffe57302f27d2a74cd2ba))
* enable gn build for toybox and mksh ([c54bfa1](https://gitee.com/openharmony/kernel_liteos_a/commits/c54bfa16e3907482c252e9738192df869c63326e))
* fatfs支持符号链接功能 ([e50cf0b](https://gitee.com/openharmony/kernel_liteos_a/commits/e50cf0be6f6d118022b6d79c5177aece574ba150)), closes [#I3V8D1](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V8D1)
* **file system:** add memory-based romfs ([c4595d2](https://gitee.com/openharmony/kernel_liteos_a/commits/c4595d25042b188570d991a815009764c37f3cb3)), closes [#I3S0CP](https://gitee.com/openharmony/kernel_liteos_a/issues/I3S0CP)
* introduce mksh toybox to rootfs ([41c7689](https://gitee.com/openharmony/kernel_liteos_a/commits/41c7689dfa49c52fb15705ce15ef22a278fbf2ef))
* L0-L1 支持Trace ([dc9ec68](https://gitee.com/openharmony/kernel_liteos_a/commits/dc9ec6856fe14aa604f037f55f17a3ba2bafb098)), closes [#I46WA0](https://gitee.com/openharmony/kernel_liteos_a/issues/I46WA0)
* L1支持低功耗投票框架 ([21d8ac8](https://gitee.com/openharmony/kernel_liteos_a/commits/21d8ac8752469f6e0dc2d50d28b75421f665385a)), closes [#I3VS5N](https://gitee.com/openharmony/kernel_liteos_a/issues/I3VS5N)
* **libc:** upgrade optimized-routines to v21.02 ([1ec8d5a](https://gitee.com/openharmony/kernel_liteos_a/commits/1ec8d5a454658e95c4acb821d0878f357f4e82ad))
* **make:** optimize makefiles and remove some unused files ([0e26094](https://gitee.com/openharmony/kernel_liteos_a/commits/0e260949c962158a263d4b0ad45fe9f6843d6e30))
* Open macro for ADC moudule ([c71ec9d](https://gitee.com/openharmony/kernel_liteos_a/commits/c71ec9d7e8574078a9dc2a8463f3141cca3d625a))
* **QEMU_ARM_VIRT_CA7:** 使能FAT文件系统编译选项 ([49856dc](https://gitee.com/openharmony/kernel_liteos_a/commits/49856dc1e0de1c5e92346c83eda641dfb1bb16be))
* support .mkshrc ([51a50c9](https://gitee.com/openharmony/kernel_liteos_a/commits/51a50c95b4cd47b6931523926b728d1c0ff8988b)), closes [#I3Y5KE](https://gitee.com/openharmony/third_party_mksh/issues/I3Y5KE)
* support link/symlink/readlink ([6eddc86](https://gitee.com/openharmony/kernel_liteos_a/commits/6eddc869d349be59860bfd84ff10b7579a9b00a9)), closes [#I3Q0OD](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Q0OD)
* support toybox in qemu ([5618319](https://gitee.com/openharmony/kernel_liteos_a/commits/561831928bb1ad1871b2d60d2bba2d67488cea5f)), closes [#I3V17D](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V17D)
* timer_create支持以SIGEV_THREAD方式创建定时器 ([e5f6bf0](https://gitee.com/openharmony/kernel_liteos_a/commits/e5f6bf05567c2d193f3746caca502199e7b81e92)), closes [#I3SRFI](https://gitee.com/openharmony/kernel_liteos_a/issues/I3SRFI)
* using kconfiglib instead of kconfig ([8784694](https://gitee.com/openharmony/kernel_liteos_a/commits/878469468647a19f704e7ee2af696b0ba8ab775a))
* vfs support sdcard hotplug ([2db80ec](https://gitee.com/openharmony/kernel_liteos_a/commits/2db80ecb389176b53c77807567895470bb180a06)), closes [#I44WH1](https://gitee.com/openharmony/kernel_liteos_a/issues/I44WH1)
* **vfs:** vfs支持FD_CLOEXEC标记 ([27dca4d](https://gitee.com/openharmony/kernel_liteos_a/commits/27dca4d857ef8de6b4bb9302e0dd435be7e3284f)), closes [#I3U81W](https://gitee.com/openharmony/kernel_liteos_a/issues/I3U81W)
* 删除zpfs冗余代码 ([3393479](https://gitee.com/openharmony/kernel_liteos_a/commits/3393479c52f4a9dfe2394bb32beb4b98fca8e171))
* 基于汇编实现内核对用户态内存清零的功能 ([9db3407](https://gitee.com/openharmony/kernel_liteos_a/commits/9db3407589bb0b2d4a5772faac3130032bc0b8a9)), closes [#I3XXT0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XXT0)
* 增加mount的MS_RDONLY标志的支持 ([8729f6e](https://gitee.com/openharmony/kernel_liteos_a/commits/8729f6ee57ea57bc664d076ff112c8726fedded9)), closes [#I3Z1W6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z1W6)
* 支持killpg和waitid ([dc3cc09](https://gitee.com/openharmony/kernel_liteos_a/commits/dc3cc094a75c6da65d87522930afea06106d3933))
* 新增toybox reboot命令 ([e567a10](https://gitee.com/openharmony/kernel_liteos_a/commits/e567a10d021c3e0fe02d6911dbe8687255c67ffa)), closes [#I3YQ7S](https://gitee.com/openharmony/third_party_toybox/issues/I3YQ7S)
* 给开发者提供系统信息导出Hidumper工具。 ([cb17fa5](https://gitee.com/openharmony/kernel_liteos_a/commits/cb17fa50ed28e6e8f59b7d68ede13c759b983311))
* 自研shell命令回补 ([7bc68f4](https://gitee.com/openharmony/kernel_liteos_a/commits/7bc68f454ff5fbf415712c9b8479b8c832f68417)), closes [#I44U0H](https://gitee.com/openharmony/third_party_toybox/issues/I44U0H)
### Performance Improvements
* assign '-1' to uninitialized variable: ret ([e0a27ba](https://gitee.com/openharmony/kernel_liteos_a/commits/e0a27badde20868cf3a5b4a44305b90af00e4f3f))
### Reverts
* Revert "fix: 修改默认窗口宽度到400" ([1878849](https://gitee.com/openharmony/kernel_liteos_a/commits/187884937cd087e39a28c033c41033163d6b4766)), closes [#I42X9V](https://gitee.com/openharmony/kernel_liteos_a/issues/I42X9V)
### BREAKING CHANGES
* 1.新增一系列trace的对外API位于los_trace.h中.
LOS_TRACE_EASY简易插桩
LOS_TRACE标准插桩
LOS_TraceInit配置Trace缓冲区的地址和大小
LOS_TraceStart开启事件记录
LOS_TraceStop停止事件记录
LOS_TraceRecordDump输出Trace缓冲区数据
LOS_TraceRecordGet获取Trace缓冲区的首地址
LOS_TraceReset清除Trace缓冲区中的事件
LOS_TraceEventMaskSet设置事件掩码仅记录某些模块的事件
LOS_TraceHwiFilterHookReg注册过滤特定中断号事件的钩子函数
* **vfs:** 执行exec类函数后进程拥有的文件描述符情况发生变化修改前默认关闭所有的进程文件描述符012重新打开修改后除非文件描述符拥有FD_CLOEXEC标记否则该描述符不会被关闭。

172
Kconfig Executable file → Normal file
View File

@@ -26,43 +26,73 @@
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# For a description of the syntax of this configuration file,
# see extra/config/Kconfig-language.txt
#
mainmenu "Huawei LiteOS Configuration"
menu "Compiler"
choice
prompt "LiteOS_Compiler_Type"
prompt "Compiler type"
default COMPILER_CLANG_LLVM
help
Enable arm-himix100 or aarch64-himix100 or compiler.
Choose compiler type.
config COMPILER_HIMIX_32
bool "arm-linux-ohoseabi"
depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_QEMU_ARM_VIRT_CA7
config COMPILER_GCC
bool "GCC"
config CROSS_COMPILE
string "GCC cross-compile toolchain prefix"
depends on COMPILER_GCC
default "arm-linux-ohoseabi-" if ARCH_ARM_AARCH32
config COMPILER_CLANG_LLVM
bool "clang-llvm"
depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_QEMU_ARM_VIRT_CA7
bool "Clang"
config LLVM_TARGET
string "Clang LLVM target"
depends on COMPILER_CLANG_LLVM
default "arm-liteos-ohos" if ARCH_ARM_AARCH32
endchoice
config COMPILE_DEBUG
bool "Enable debug options"
default n
help
Answer Y to add -g option in compile command.
config COMPILE_OPTIMIZE
bool "Enable code optimization options"
default y
help
Answer Y to add optimization options for efficient code.
The final binary size will be smaller and execute faster.
But the debugging experience may be worst somehow.
config COMPILE_OPTIMIZE_SIZE
bool "Enable code size optimization options" if COMPILE_OPTIMIZE
default y
help
Answer Y to add optimization options for small code size.
The final binary size will be smaller.
But the compile time may be a bit longer.
config COMPILE_LTO
bool "Enable link time optimization (LTO)" if COMPILE_OPTIMIZE_SIZE
default y
help
Answer Y to add lto options for more smaller code size.
The final binary size will be smaller.
But the compile time may be much longer.
endmenu
menu "Platform"
######################### config options of bsp #####################
source "../../kernel/liteos_a/platform/Kconfig"
source "platform/Kconfig"
######################### config options of cpu arch ################
source "../../kernel/liteos_a/arch/Kconfig"
######################### config options of rootfs #####################
source "../../kernel/liteos_a/kernel/common/Kconfig"
######################### config options of patchfs #####################
source "../../kernel/liteos_a/kernel/common/patchfs/Kconfig"
source "arch/Kconfig"
config QUICK_START
bool "Enable QUICK_START"
@@ -73,44 +103,30 @@ config QUICK_START
endmenu
######################### config options of kernel #####################
source "../../kernel/liteos_a/kernel/Kconfig"
source "kernel/Kconfig"
######################### config options of lib ########################
source "../../kernel/liteos_a/lib/Kconfig"
source "lib/Kconfig"
######################### config options of compatibility ##############
menu "Compat"
source "../../kernel/liteos_a/compat/posix/Kconfig"
source "../../kernel/liteos_a/bsd/Kconfig"
source "compat/posix/Kconfig"
source "bsd/Kconfig"
endmenu
######################### config options of framework ##################
#source "../../frameworks/m2mcomm/Kconfig"
######################## config options of filesystem ##################
menu "FileSystem"
source "../../kernel/liteos_a/fs/vfs/Kconfig"
source "../../kernel/liteos_a/fs/fat/Kconfig"
source "../../kernel/liteos_a/fs/ramfs/Kconfig"
source "../../kernel/liteos_a/fs/nfs/Kconfig"
source "../../kernel/liteos_a/fs/proc/Kconfig"
source "../../kernel/liteos_a/fs/jffs2/Kconfig"
source "../../kernel/liteos_a/fs/zpfs/Kconfig"
config ENABLE_READ_BUFFER
bool "Enable read buffer Option"
default n
help
Answer Y to add enable read buffer Option.
source "fs/Kconfig"
endmenu
######################## config options of net ############################
source "../../kernel/liteos_a/net/Kconfig"
source "net/Kconfig"
######################## config options of debug ########################
menu "Debug"
config COMPILE_DEBUG
bool "Enable GCC -g Option"
config GDB
bool "Enable gdb functions"
default n
help
Answer Y to add -g option in gcc command. But the LiteOS size will be much larger.
Answer Y to enable gdb functions.
config PLATFORM_ADAPT
bool "Enable Os_adapt"
@@ -121,6 +137,7 @@ config PLATFORM_ADAPT
config ENABLE_OOM_LOOP_TASK
bool "Enable Oom loop task"
default n
depends on KERNEL_VM
help
Answer Y to enable oom loop kthread to check system out of memory.
@@ -146,8 +163,10 @@ config ENABLE_MAGICKEY
config THUMB
bool "Enable Thumb"
default n
depends on ARCH_ARM
help
Answer Y to build thumb version. This will make LiteOS smaller.
config PLATFORM_DVFS
bool "Enable Dvfs"
default n
@@ -156,15 +175,21 @@ config PLATFORM_DVFS
Answer Y to enable LiteOS support dynamic voltage and frequency scaling feature for
low power consumption.
config SAVE_EXCINFO
bool "Enable Saving Exception Information"
default n
help
Answer Y to enable LiteOS support saving exception information to storage medium.
config DEBUG_VERSION
bool "Enable a Debug Version"
default n
help
If you do not select this option that means you enable a release version for LiteOS.
It also means you do not want to use debug modules, like shell,telnet,tftp,
,nfs,ramfs proc and memory check.
It also means you do not want to use debug modules, like shell,telnet,tftp,nfs and
memory check, etc.
If you select this option that means you enable a debug version for LiteOS.
That means you want a opposite behaviour compared to release version.
That means you want an opposite behaviour compared to release version.
config DEBUG_KERNEL
bool "Enable Debug LiteOS Kernel Resource"
@@ -173,7 +198,7 @@ config DEBUG_KERNEL
help
If you select this option that means you enable debugging kernel resource.
It also means you want to get queue, mutex, semaphore, memory debug information.
That means you want a opposite behaviour compared to release version.
That means you want an opposite behaviour compared to release version.
config DEBUG_QUEUE
bool "Enable Queue Debugging"
@@ -196,29 +221,26 @@ config DEBUG_SEMAPHORE
help
Answer Y to enable debug semaphore.
source "../../kernel/liteos_a/shell/Kconfig"
source "shell/Kconfig"
config NET_LWIP_SACK_TFTP
bool "Enable Tftp"
default y
depends on SHELL && NET_LWIP_SACK && DEBUG_VERSION
help
Answer Y to enable LiteOS support tftp cmd and tftp tool.
source "../../kernel/liteos_a/net/telnet/Kconfig"
config EXC_INTERACTION
bool "Enable exc interaction"
default n
depends on SHELL
help
Answer Y to enable exception interaction for LiteOS, when the system enter exception, user can also interact with system by shell
command like readreg, writereg,task,hwi.
source "net/telnet/Kconfig"
config SCHED_DEBUG
bool "Enable sched debug Feature"
default n
depends on DEBUG_VERSION
help
If you wish to build LiteOS with support for sched debug.
config SCHED_EDF_DEBUG
bool "Enable sched EDF debug Feature"
default n
depends on SCHED_DEBUG
help
If you wish to build LiteOS with support for sched debug.
config USER_INIT_DEBUG
bool "Enable user init Debug"
default n
@@ -248,9 +270,9 @@ config MEM_LEAKCHECK
default n
depends on DEBUG_VERSION && MEM_DEBUG
help
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the infomations of mem node.
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the information of mem node.
config BASE_MEM_NODE_INTEGRITY_CHECK
bool "Enable integrity check or not "
bool "Enable integrity check or not"
default n
depends on DEBUG_VERSION && MEM_DEBUG
config MEM_WATERLINE
@@ -265,36 +287,22 @@ config VM_OVERLAP_CHECK
help
Answer Y to enable vm overlap check.
config NULL_ADDRESS_PROTECT
bool "Enable NULL Address protect"
default n
depends on (PLATFORM_HI3518EV200 || PLATFORM_HI3516CV300 || PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_QEMU_ARM_VIRT_CA7) && DEBUG_VERSION
help
Answer Y to set mem address 0~1M prohibit to access, read or write will trigger exception.
endmenu
######################## config options os drivers ########################
menu "Driver"
config DRIVERS
bool "Enable Driver"
default y
help
Answer Y to enable LiteOS support driver.
source "../../kernel/liteos_a/bsd/dev/usb/Kconfig"
source "../../drivers/adapter/khdf/liteos/Kconfig"
source "drivers/char/mem/Kconfig"
source "drivers/char/random/Kconfig"
source "../../drivers/liteos/tzdriver/Kconfig"
source "drivers/char/video/Kconfig"
source "../../drivers/liteos/hievent/Kconfig"
source "drivers/Kconfig"
endmenu
######################## config options os security #######################
menu "Security"
source "../../kernel/liteos_a/security/Kconfig"
source "security/Kconfig"
endmenu
menu "Test"
config ENABLE_KERNEL_TEST
bool "Enable Kernel Test"
default n
endmenu
menu "Stack Smashing Protector (SSP) Compiler Feature"

278
Makefile Executable file → Normal file
View File

@@ -27,45 +27,51 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LITEOSTOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
export OS=$(shell uname -s)
ifneq ($(OS), Linux)
LITEOSTOPDIR := $(shell dirname $(subst \,/,$(LITEOSTOPDIR))/./)
endif
LITEOSTHIRDPARTY := $(LITEOSTOPDIR)/../../third_party
LITEOSTOPDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
export LITEOSTOPDIR
export LITEOSTHIRDPARTY
RM = -rm -rf
MAKE = make
__LIBS = libs
APPS = apps
ROOTFSDIR = rootfsdir
ROOTFS = rootfs
LITEOS_TARGET = liteos
LITEOS_LIBS_TARGET = libs_target
LITEOS_MENUCONFIG_H = $(LITEOSTOPDIR)/include/generated/autoconf.h
LITEOS_PLATFORM_BASE = $(LITEOSTOPDIR)/platform
LITEOS_PLATFORM_MENUCONFIG_H = $(LITEOS_PLATFORM_BASE)/include/menuconfig.h
LITEOS_LIBS_TARGET = libs
KCONFIG_CMDS := $(notdir $(wildcard $(dir $(shell which menuconfig))*config))
export CONFIG_=LOSCFG_
MENUCONFIG_PATH = $(LITEOSTOPDIR)/tools/menuconfig
KCONFIG_FILE_PATH = $(LITEOSTOPDIR)/Kconfig
ifeq ($(OS), Linux)
MENUCONFIG_MCONF := $(MENUCONFIG_PATH)/mconf
MENUCONFIG_CONF := $(MENUCONFIG_PATH)/conf
else
MENUCONFIG_MCONF := $(MENUCONFIG_PATH)/kconfig-mconf.exe
MENUCONFIG_CONF := $(MENUCONFIG_PATH)/kconfig-conf.exe
ohos_kernel ?= liteos_a
$(foreach line,$(shell hb env | sed 's/\[OHOS INFO\]/ohos/g;s/ /_/g;s/:_/=/g' || true),$(eval $(line)))
ifneq ($(ohos_kernel),liteos_a)
$(error The selected product ($(ohos_product)) is not a liteos_a kernel type product)
endif
$(shell env CONFIG_=$(CONFIG_) $(MENUCONFIG_CONF) -s --olddefconfig $(KCONFIG_FILE_PATH))
ifeq ($(PRODUCT_PATH),)
PRODUCT_PATH:=$(ohos_product_path)
endif
-include $(LITEOSTOPDIR)/tools/build/config.mk
ifeq ($(DEVICE_PATH),)
DEVICE_PATH:=$(ohos_device_path)
endif
ifeq ($(TEE:1=y),y)
tee = _tee
endif
ifeq ($(RELEASE:1=y),y)
CONFIG ?= $(PRODUCT_PATH)/kernel_configs/release$(tee).config
else
CONFIG ?= $(PRODUCT_PATH)/kernel_configs/debug$(tee).config
endif
KCONFIG_CONFIG ?= $(CONFIG)
SYSROOT_PATH ?= $(OUT)/sysroot
# export subdir Makefile related environment variables
export SYSROOT_PATH
export PRODUCT_PATH
export DEVICE_PATH
# export kconfig related environment variables
export CONFIG_=LOSCFG_
export srctree=$(LITEOSTOPDIR)
include $(LITEOSTOPDIR)/config.mk
ifeq ($(LOSCFG_STORAGE_SPINOR), y)
FSTYPE = jffs2
@@ -76,155 +82,117 @@ endif
ifeq ($(LOSCFG_STORAGE_SPINAND), y)
FSTYPE = yaffs2
endif
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
FSTYPE = jffs2
endif
ROOTFS_DIR = $(OUT)/rootfs
ROOTFS_ZIP = $(OUT)/rootfs.zip
VERSION =
all: $(OUT) $(BUILD) $(LITEOS_TARGET) $(APPS)
lib: $(OUT) $(BUILD) $(LITEOS_LIBS_TARGET)
define HELP =
Usage: make [TARGET]... [PARAMETER=VALUE]...
Targets:
help: display this help and exit
clean: clean compiled objects
cleanall: clean all build outputs
all: make liteos kernel image and rootfs image (Default target)
$(APPS): build all apps
$(ROOTFS): make an original rootfs image
$(LITEOS_LIBS_TARGET): compile all kernel modules (libraries)
$(LITEOS_TARGET): make liteos kernel image
update_config: update product kernel config (use menuconfig)
xxconfig: invoke xxconfig command of kconfiglib (xxconfig is one of $(KCONFIG_CMDS))
Parameters:
FSTYPE: value should be one of (jffs2 vfat yaffs2)
TEE: boolean value(1 or y for true), enable tee
RELEASE: boolean value(1 or y for true), build release version
CONFIG: kernel config file to be use
args: arguments for xxconfig command
endef
export HELP
all: $(LITEOS_TARGET) $(ROOTFS)
help:
$(HIDE)echo "-------------------------------------------------------"
$(HIDE)echo "1.====make help: get help infomation of make"
$(HIDE)echo "2.====make: make a debug version based the .config"
$(HIDE)echo "3.====make debug: make a debug version based the .config"
$(HIDE)echo "4.====make release: make a release version for all platform"
$(HIDE)echo "5.====make release PLATFORM=xxx: make a release version only for platform xxx"
$(HIDE)echo "6.====make rootfsdir: make a original rootfs dir"
$(HIDE)echo "7.====make rootfs FSTYPE=***: make a original rootfs img"
$(HIDE)echo "8.====make test: make the testsuits_app and put it into the rootfs dir"
$(HIDE)echo "9.====make test_apps FSTYPE=***: make a rootfs img with the testsuits_app in it"
$(HIDE)echo "xxx should be one of (hi3516cv300 hi3516ev200 hi3556av100/cortex-a53_aarch32 hi3559av100/cortex-a53_aarch64)"
$(HIDE)echo "*** should be one of (jffs2)"
$(HIDE)echo "-------------------------------------------------------"
$(HIDE)echo "$$HELP"
debug:
$(HIDE)echo "=============== make a debug version ==============="
$(HIDE) $(MAKE) all
release:
ifneq ($(PLATFORM),)
$(HIDE)echo "=============== make a release version for platform $(PLATFORM) ==============="
$(HIDE)$(SCRIPTS_PATH)/mklibversion.sh $(PLATFORM)
else
$(HIDE)echo "================make a release version for all platform ==============="
$(HIDE)$(SCRIPTS_PATH)/mklibversion.sh
sysroot:
$(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH))
ifeq ($(origin SYSROOT_PATH),file)
$(HIDE)mkdir -p $(SYSROOT_PATH)/build && cd $(SYSROOT_PATH)/build && \
ln -snf $(LITEOSTOPDIR)/../../third_party/musl/scripts/build_lite/Makefile && \
$(MAKE) TARGETS=liteos_a_user \
ARCH=$(ARCH) \
TARGET=$(LOSCFG_LLVM_TARGET) \
ARCH_CFLAGS="$(LITEOS_CORE_COPTS) -w" \
TOPDIR="$(LITEOSTOPDIR)/../.." \
SYSROOTDIR="$(SYSROOT_PATH)" \
$(if $(LOSCFG_COMPILER_CLANG_LLVM),CLANG="$(LITEOS_COMPILER_PATH)clang",GCC="$(CC)") \
BUILD_DEBUG=$(if $(patsubst y,,$(or $(RELEASE:1=y),n)),true,false)
endif
##### make dynload #####
-include $(LITEOS_MK_PATH)/dynload.mk
$(filter-out menuconfig,$(KCONFIG_CMDS)):
$(HIDE)$@ $(args)
#-----need move when make version-----#
##### make lib #####
$(__LIBS): $(OUT) $(CXX_INCLUDE)
$(LITEOS_CONFIG_FILE): $(KCONFIG_CONFIG)
$(HIDE)env KCONFIG_CONFIG=$< genconfig --config-out $@ --header-path $(LITEOS_MENUCONFIG_H)
$(OUT): $(LITEOS_MENUCONFIG_H)
$(HIDE)mkdir -p $(OUT)/lib
$(HIDE)$(CC) -I$(LITEOSTOPDIR)/kernel/base/include -I$(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) \
-I$(LITEOS_PLATFORM_BASE)/include -E $(LITEOS_PLATFORM_BASE)/board.ld.S \
-o $(LITEOS_PLATFORM_BASE)/board.ld -P
update_config menuconfig:
$(HIDE)test -f "$(CONFIG)" && cp -v "$(CONFIG)" .config && menuconfig $(args) && savedefconfig --out "$(CONFIG)"
$(BUILD):
$(HIDE)mkdir -p $(BUILD)
$(LITEOS_LIBS_TARGET): sysroot
$(HIDE)for dir in $(LIB_SUBDIRS); do $(MAKE) -C $$dir all || exit 1; done
$(LITEOS_LIBS_TARGET): $(__LIBS)
$(HIDE)for dir in $(LIB_SUBDIRS); \
do $(MAKE) -C $$dir all || exit 1; \
done
$(HIDE)echo "=============== make lib done ==============="
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET)
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).map
#$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).objsize
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).bin
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).sym.sorted
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).asm
#$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).size
##### make menuconfig #####
menuconfig:$(MENUCONFIG_MCONF)
$< $(KCONFIG_FILE_PATH)
$(OUT)/$(LITEOS_TARGET): $(LITEOS_LIBS_TARGET)
$(LD) $(LITEOS_LDFLAGS) $(LITEOS_TABLES_LDFLAGS) -Map=$@.map -o $@ --start-group $(LITEOS_LIBDEP) --end-group
$(OUT)/$(LITEOS_TARGET).map: $(OUT)/$(LITEOS_TARGET)
$(OUT)/$(LITEOS_TARGET).objsize: $(LITEOS_LIBS_TARGET)
$(SIZE) -t --common $(OUT)/lib/*.a >$@
$(OUT)/$(LITEOS_TARGET).bin: $(OUT)/$(LITEOS_TARGET)
$(OBJCOPY) -O binary $< $@
$(OUT)/$(LITEOS_TARGET).sym.sorted: $(OUT)/$(LITEOS_TARGET)
$(OBJDUMP) -t $< |sort >$@
$(OUT)/$(LITEOS_TARGET).asm: $(OUT)/$(LITEOS_TARGET)
$(OBJDUMP) -d $< >$@
$(OUT)/$(LITEOS_TARGET).size: $(OUT)/$(LITEOS_TARGET)
$(NM) -S --size-sort $< >$@
genconfig:$(MENUCONFIG_CONF)
$(HIDE)mkdir -p include/config include/generated
$< --olddefconfig $(KCONFIG_FILE_PATH)
$< --silentoldconfig $(KCONFIG_FILE_PATH)
-mv -f $(LITEOS_MENUCONFIG_H) $(LITEOS_PLATFORM_MENUCONFIG_H)
##### menuconfig end #######
$(LITEOS_MENUCONFIG_H):
ifneq ($(LITEOS_PLATFORM_MENUCONFIG_H), $(wildcard $(LITEOS_PLATFORM_MENUCONFIG_H)))
$(HIDE)$(MAKE) genconfig
endif
$(LITEOS_TARGET): $(__LIBS)
$(HIDE)touch $(LOSCFG_ENTRY_SRC)
$(HIDE)for dir in $(LITEOS_SUBDIRS); \
do $(MAKE) -C $$dir all || exit 1; \
done
$(LD) $(LITEOS_LDFLAGS) $(LITEOS_TABLES_LDFLAGS) $(LITEOS_DYNLDFLAGS) -Map=$(OUT)/$@.map -o $(OUT)/$@ --start-group $(LITEOS_LIBDEP) --end-group
# $(SIZE) -t --common $(OUT)/lib/*.a >$(OUT)/$@.objsize
$(OBJCOPY) -O binary $(OUT)/$@ $(LITEOS_TARGET_DIR)/$@.bin
$(OBJDUMP) -t $(OUT)/$@ |sort >$(OUT)/$@.sym.sorted
$(OBJDUMP) -d $(OUT)/$@ >$(OUT)/$@.asm
# $(NM) -S --size-sort $(OUT)/$@ >$(OUT)/$@.size
$(APPS): $(LITEOS_TARGET)
$(APPS): sysroot
$(HIDE)$(MAKE) -C apps all
prepare:
$(ROOTFS): $(APPS)
$(HIDE)mkdir -p $(OUT)/musl
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
$(HIDE)cp -f $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/usr/lib/$(LLVM_TARGET)/a7_softfp_neon-vfpv4/libc.so $(OUT)/musl
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/lib/$(LLVM_TARGET)/c++/a7_softfp_neon-vfpv4/libc++.so $(OUT)/musl
$(HIDE)cp -fp $$($(CC) $(LITEOS_CFLAGS) -print-file-name=libc.so) $(OUT)/musl
$(HIDE)cp -fp $$($(GPP) $(LITEOS_CXXFLAGS) -print-file-name=libc++.so) $(OUT)/musl
else
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/target/usr/lib/libc.so $(OUT)/musl
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/arm-linux-musleabi/lib/libstdc++.so.6 $(OUT)/musl
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/arm-linux-musleabi/lib/libgcc_s.so.1 $(OUT)/musl
$(STRIP) $(OUT)/musl/*
$(HIDE)cp -fp $$($(CC) $(LITEOS_CFLAGS) -print-file-name=libc.so) $(OUT)/musl
$(HIDE)cp -fp $$($(CC) $(LITEOS_CFLAGS) -print-file-name=libgcc_s.so.1) $(OUT)/musl
$(HIDE)cp -fp $$($(GPP) $(LITEOS_CXXFLAGS) -print-file-name=libstdc++.so.6) $(OUT)/musl
endif
$(ROOTFSDIR): prepare $(APPS)
$(HIDE)$(MAKE) clean -C apps
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsdir.sh $(OUT)/bin $(OUT)/musl $(ROOTFS_DIR)
$(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/rootfsdir.sh $(OUT) $(ROOTFS_DIR)
$(HIDE)shopt -s nullglob && $(STRIP) $(ROOTFS_DIR)/bin/* $(ROOTFS_DIR)/lib/*
ifneq ($(VERSION),)
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR)
$(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR)
endif
$(ROOTFS): $(ROOTFSDIR)
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsimg.sh $(ROOTFS_DIR) $(FSTYPE)
$(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/rootfsimg.sh $(ROOTFS_DIR) $(FSTYPE)
$(HIDE)cd $(ROOTFS_DIR)/.. && zip -r $(ROOTFS_ZIP) $(ROOTFS)
ifneq ($(OUT), $(LITEOS_TARGET_DIR))
rm -rf $(LITEOS_TARGET_DIR)rootfs
$(HIDE)mv $(ROOTFS_DIR) $(LITEOS_TARGET_DIR)rootfs
endif
clean:
$(HIDE)for dir in $(LITEOS_SUBDIRS); \
do $(MAKE) -C $$dir clean|| exit 1; \
done
$(HIDE)$(MAKE) -C apps clean
$(HIDE)$(RM) $(__OBJS) $(LITEOS_TARGET) $(BUILD) $(LITEOS_MENUCONFIG_H) *.bak *~
$(HIDE)$(RM) $(LITEOS_PLATFORM_MENUCONFIG_H)
$(HIDE)$(RM) include
$(HIDE)$(MAKE) cleanrootfs
$(HIDE)echo "clean $(LITEOS_PLATFORM) finish"
$(HIDE)if [ -d $(SYSROOT_PATH)/build ]; then $(MAKE) -C $(SYSROOT_PATH)/build clean; fi
$(HIDE)for dir in $(LIB_SUBDIRS) apps; do $(MAKE) -C $$dir clean || exit 1; done
$(HIDE)$(RM) $(LITEOS_MENUCONFIG_H)
$(HIDE)echo "clean $(LOSCFG_PLATFORM) finish"
cleanall:
$(HIDE)$(RM) $(LITEOSTOPDIR)/out
$(HIDE)find $(LITEOS_PLATFORM_BASE)/ -name board.ld -exec rm -rf {} \;
$(HIDE)cd sample/sample_osdrv;make clean;cd ../..;
$(HIDE)echo "clean all"
cleanall: clean
$(HIDE)$(RM) $(LITEOSTOPDIR)/out $(LITEOS_CONFIG_FILE)
$(HIDE)echo "clean all done"
cleanrootfs:
$(HIDE)$(RM) $(OUT)/rootfs
$(HIDE)$(RM) $(OUT)/rootfs.zip
$(HIDE)$(RM) $(OUT)/rootfs.img
update_all_config:
$(HIDE)shopt -s globstar && for f in tools/build/config/**/*.config ; \
do \
echo updating $$f; \
test -f $$f && cp $$f .config && $(MENUCONFIG_CONF) -s --olddefconfig $(KCONFIG_FILE_PATH) && $(MENUCONFIG_CONF) --savedefconfig $$f $(KCONFIG_FILE_PATH); \
done
%.config:
$(HIDE)test -f tools/build/config/$@ && cp tools/build/config/$@ .config && $(MENUCONFIG_MCONF) $(KCONFIG_FILE_PATH) && $(MENUCONFIG_CONF) --savedefconfig tools/build/config/$@ $(KCONFIG_FILE_PATH)
.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config
.PHONY: all clean cleanall sysroot help update_config
.PHONY: $(LITEOS_TARGET) $(ROOTFS) $(APPS) $(KCONFIG_CMDS) $(LITEOS_LIBS_TARGET) $(KCONFIG_CONFIG)

85
OAT.xml Normal file
View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
This is the configuration file template for OpenHarmony OSS Audit Tool. Please copy it to your project root dir and modify it by referring to OpenHarmony/tools_oat/README.
-->
<configuration>
<oatconfig>
<licensefile></licensefile>
<policylist>
<policy name="projectPolicy" desc="">
<policyitem type="copyright" name="Huawei Technologies Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
<policyitem type="copyright" name="Huawei Device Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
</policy>
</policylist>
<filefilterlist>
<filefilter name="defaultFilter" desc="文件属于FreeBSD仓库软连接本仓库屏蔽告警在FreeBSD仓库进行处理">
<filteritem type="filepath" name="bsd/.*" desc="文件属于FreeBSD仓库软连接本仓库屏蔽告警在FreeBSD仓库进行处理"/>
<filteritem type="filepath" name="kernel/extended" desc="文件属于Nuttx仓库软连接本仓库屏蔽告警在Nuttx仓库进行处理"/>
<filteritem type="filepath" name="fs/include/fs" desc="文件属于Nuttx仓库软连接本仓库屏蔽告警在Nuttx仓库进行处理"/>
</filefilter>
<filefilter name="defaultFilter" desc="Files not to check">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="defaultPolicyFilter" desc="Filters for license header policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="licenseFileNamePolicyFilter" desc="Filters for LICENSE file policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="readmeFileNamePolicyFilter" desc="Filters for README file policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="readmeOpenSourcefileNamePolicyFilter" desc="Filters for README.OpenSource file policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
</filefilter>
</filefilterlist>
<licensematcherlist>
<!--licensematcher name="uvwxyz License" desc="If the scanning result is InvalidLicense, you can define matching rules here. Note that quotation marks must be escaped.">
<licensetext name="
uvwxyz license textA xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
" desc=""/>
<licensetext name="
uvwxyz license textB xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
" desc=""/>
</licensematcher-->
</licensematcherlist>
</oatconfig>
</configuration>

View File

@@ -4,15 +4,15 @@
- [Directory Structure](#section161941989596)
- [Constraints](#section119744591305)
- [Usage](#section741617511812)
- [Preparations](#section1579912573329)
- [Source Code Acquisition](#section11443189655)
- [Compilation and Building](#section2081013992812)
- [Preparations](#section1579912573329)
- [Source Code Acquisition](#section11443189655)
- [Compilation and Building](#section2081013992812)
- [Contribution](#section1371123476304)
- [Repositories Involved](#section1371113476307)
## Introduction<a name="section11660541593"></a>
The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on the Huawei LiteOS kernel. Huawei LiteOS is a lightweight operating system \(OS\) built for the Internet of Things \(IoT\) field. With the rapid development of the IoT industry, OpenHarmony LiteOS Cortex-A brings small-sized, low-power, and high-performance experience and builds a unified and open ecosystem for developers. In addition, it provides rich kernel mechanisms, more comprehensive Portable Operating System Interface \(POSIX\), and a unified driver framework, Hardware Driver Foundation \(HDF\), which offers unified access for device developers and friendly development experience for application developers. [Figure1](#fig27311582210) shows the architecture of the OpenHarmony LiteOS Cortex-A kernel.
The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on the Huawei LiteOS kernel. Huawei LiteOS is a lightweight operating system \(OS\) built for the Internet of Things \(IoT\) field. With the rapid development of the IoT industry, OpenHarmony LiteOS Cortex-A brings small-sized, low-power, and high-performance experience and builds a unified and open ecosystem for developers. In addition, it provides rich kernel mechanisms, more comprehensive Portable Operating System Interface \(POSIX\), and a unified driver framework, Hardware Driver Foundation \(HDF\), which offers unified access for device developers and friendly development experience for application developers. [Figure 1](#fig27311582210) shows the architecture of the OpenHarmony LiteOS Cortex-A kernel.
**Figure 1** Architecture of the OpenHarmony LiteOS Cortex-A kernel<a name="fig27311582210"></a>
![](figures/architecture-of-the-openharmony-liteos-cortex-a-kernel.png "architecture-of-the-openharmony-liteos-cortex-a-kernel")
@@ -27,7 +27,7 @@ The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on th
├── bsd # Code of the driver and adaptation layer module related to the FreeBSD, such as the USB module
├── compat # Kernel API compatibility
│ └── posix # POSIX APIs
├── drivers # Kernel driver
├── drivers # Kernel drivers
│ └── char # Character device
│ ├── mem # Driver for accessing physical input/output (I/O) devices
│ ├── quickstart # APIs for quick start of the system
@@ -50,7 +50,7 @@ The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on th
├── lib # Kernel library
├── net # Network module, which mainly derives from the lwIP open-source project
├── platform # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300
│ ├── hw # Logic code related to clocks and interupts
│ ├── hw # Logic code related to clocks and interrupts
│ ├── include # Header files exposed externally
│ └── uart # Logic code related to the serial port
├── platform # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300
@@ -62,35 +62,44 @@ The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on th
## Constraints<a name="section119744591305"></a>
- Programming languages: C and C++
- Applicable development boards: Hi3518E V300 and Hi3516D V300
- Hi3518E V300 uses the JFFS2 file system by default, and Hi3516D V300 uses the FAT file system by default.
- Applicable development boards: Hi3516D V300
- Hi3516D V300 uses the FAT file system by default.
## Usage<a name="section741617511812"></a>
OpenHarmony LiteOS Cortex-A supports the [Hi3518E V300](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/introduction-to-the-hi3518-development-board.md) and [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/introduction-to-the-hi3516-development-board.md). You can develop and run your applications based on both development boards.
OpenHarmony LiteOS Cortex-A supports the [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-appendix-hi3516.md). You can develop and run your applications based on this development board.
### Preparations<a name="section1579912573329"></a>
You need to set up the compilation environment on Linux.
You need to set up the compilation environment on Ubuntu.
- For Hi3518E V300, see [Setting Up the Hi3518 Development Environment](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/setting-up-the-hi3518-development-environment.md).
- For Hi3516D V300, see [Setting Up the Hi3516 Development Environment](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/setting-up-the-hi3516-development-environment.md).
- [Setting Up Ubuntu Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/Readme-EN.md)
### Source Code Acquisition<a name="section11443189655"></a>
Download and decompress a set of source code on a Linux server to acquire the [source code](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz). For more acquisition methods, see [Source Code Acquisition](https://gitee.com/openharmony/docs/blob/master/docs-en/get-code/source-code-acquisition.md).
Download and decompress a set of source code on a Ubuntu server to acquire the [source code](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md).
### Compilation and Building<a name="section2081013992812"></a>
For details about how to develop the first application, see:
For details about how to develop the first application, see: [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-pkg-3516-helloworld.md)
- [Developing the First Example Program Running on Hi3518](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/developing-the-first-example-program-running-on-hi3518.md)
For compilation, please refer to the [compilation instructions](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-pkg-3516-build.md).
- [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/developing-the-first-example-program-running-on-hi3516.md)
## Contribution<a name="section1371123476304"></a>
[How to involve](https://gitee.com/openharmony/docs/blob/HEAD/en/contribute/contribution-guide.md)
[Commit message spec](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)
[C&C++ Secure Coding Guide](https://gitee.com/openharmony/docs/blob/master/en/contribute/OpenHarmony-c-cpp-secure-coding-guide.md)
[LiteOS-A Kernel Coding Style Guide](https://gitee.com/openharmony/kernel_liteos_a/wikis/LiteOS-A%20%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83%E6%8C%87%E5%8D%97)
## Repositories Involved<a name="section1371113476307"></a>
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos)
[Kernel subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/kernel.md)
**[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a)**
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README.md)
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/master/README.md)

104
README_zh-HK.md Normal file
View File

@@ -0,0 +1,104 @@
# LiteOS-A內核<a name="ZH-CN_TOPIC_0000001096612501"></a>
- [簡介](#section11660541593)
- [目錄](#section161941989596)
- [約束](#section119744591305)
- [使用說明](#section741617511812)
- [準備](#section1579912573329)
- [獲取源碼](#section11443189655)
- [編譯構建](#section2081013992812)
- [貢獻](#section1371123476304)
- [相關倉](#section1371113476307)
## 簡介<a name="section11660541593"></a>
OpenHarmony LiteOS-A內核是基於Huawei LiteOS內核演進發展的新一代內核Huawei LiteOS是面向IoT領域構建的輕量級物聯網操作系統。在IoT產業高速發展的潮流中OpenHarmony LiteOS-A內核能夠帶給用戶小體積、低功耗、高性能的體驗以及統一開放的生態系統能力新增了豐富的內核機制、更加全面的POSIX標準接口以及統一驅動框架**HDF**OpenHarmony Driver Foundation為設備廠商提供了更統一的接入方式為OpenHarmony的應用開發者提供了更友好的開發體驗。圖1為OpenHarmony LiteOS-A內核架構圖
**圖 1** OpenHarmony LiteOS-A內核架構圖<a name="fig27311582210"></a>
![](figures/OpenHarmony-LiteOS-A内核架构图.png "OpenHarmony-LiteOS-A內核架構圖")
## 目錄<a name="section161941989596"></a>
```
/kernel/liteos_a
├── apps # 用戶態的init和shell應用程序
├── arch # 體系架構的目錄如arm等
│ └── arm # arm架構代碼
├── bsd # freebsd相關的驅動和適配層模塊代碼引入例如USB等
├── compat # 內核接口兼容性目錄
│ └── posix # posix相關接口
├── drivers # 內核驅動
│ └── char # 字符設備
│ ├── mem # 訪問物理IO設備驅動
│ ├── quickstart # 系統快速啟動接口目錄
│ ├── random # 隨機數設備驅動
│ └── video # framebuffer驅動框架
├── fs # 文件系統模塊主要來源於NuttX開源項目
│ ├── fat # fat文件系統
│ ├── jffs2 # jffs2文件系統
│ ├── include # 對外暴露頭文件存放目錄
│ ├── nfs # nfs文件系統
│ ├── proc # proc文件系統
│ ├── ramfs # ramfs文件系統
│ └── vfs # vfs層
├── kernel # 進程、內存、IPC等模塊
│ ├── base # 基礎內核,包括調度、內存等模塊
│ ├── common # 內核通用組件
│ ├── extended # 擴展內核包括動態加載、vdso、liteipc等模塊
│ ├── include # 對外暴露頭文件存放目錄
│ └── user # 加載init進程
├── lib # 內核的lib庫
├── net # 網絡模塊主要來源於lwip開源項目
├── platform # 支持不同的芯片平台代碼如Hi3516DV300等
│ ├── hw # 時鐘與中斷相關邏輯代碼
│ ├── include # 對外暴露頭文件存放目錄
│ └── uart # 串口相關邏輯代碼
├── security # 安全特性相關的代碼包括進程權限管理和虛擬id映射管理
├── syscall # 系統調用
└── tools # 構建工具及相關配置和代碼
```
## 約束<a name="section119744591305"></a>
- 開發語言C/C++
- 適用於Hi3516DV300單板
- Hi3516DV300默認使用FAT文件系統。
## 使用說明<a name="section741617511812"></a>
OpenHarmony LiteOS-A內核支持[Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-appendix-hi3516.md)單板,開發者可基於此單板開發運行自己的應用程序。
### 準備<a name="section1579912573329"></a>
開發者需要在Ubuntu上搭建編譯環境
- [編譯環境凖備](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Readme-CN.md);
### 獲取源碼<a name="section11443189655"></a>
在Ubuntu服務器上下載並解壓一套源代碼源碼獲取方式參考[源碼獲取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
### 編譯構建<a name="section2081013992812"></a>
開發者開發第一個應用程序可參考:[helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-helloworld.md)。
編譯可以參考:[編譯指導](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-build.md)
## 貢獻<a name="section1371123476304"></a>
[如何貢獻](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE.md)
[Commit message規範](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)
[OpenHarmony C&C++ 安全編程指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/OpenHarmony-c-cpp-secure-coding-guide.md)
[LiteOS-A 內核編碼規範指南](https://gitee.com/openharmony/kernel_liteos_a/wikis/LiteOS-A%20%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83%E6%8C%87%E5%8D%97)
## 相關倉<a name="section1371113476307"></a>
[內核子系統](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%86%85%E6%A0%B8%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README_zh.md)
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/master/README_zh-HK.md)

View File

@@ -4,10 +4,10 @@
- [目录](#section161941989596)
- [约束](#section119744591305)
- [使用说明](#section741617511812)
- [准备](#section1579912573329)
- [获取源码](#section11443189655)
- [编译构建](#section2081013992812)
- [准备](#section1579912573329)
- [获取源码](#section11443189655)
- [编译构建](#section2081013992812)
- [贡献](#section1371123476304)
- [相关仓](#section1371113476307)
## 简介<a name="section11660541593"></a>
@@ -33,6 +33,7 @@ OpenHarmony LiteOS-A内核是基于Huawei LiteOS内核演进发展的新一代
│ ├── quickstart # 系统快速启动接口目录
│ ├── random # 随机数设备驱动
│ └── video # framebuffer驱动框架
├── figures # 内核架构图
├── fs # 文件系统模块主要来源于NuttX开源项目
│ ├── fat # fat文件系统
│ ├── jffs2 # jffs2文件系统
@@ -53,44 +54,56 @@ OpenHarmony LiteOS-A内核是基于Huawei LiteOS内核演进发展的新一代
│ ├── hw # 时钟与中断相关逻辑代码
│ ├── include # 对外暴露头文件存放目录
│ └── uart # 串口相关逻辑代码
├── platform # 支持不同的芯片平台代码如Hi3516DV300等
├── security # 安全特性相关的代码包括进程权限管理和虚拟id映射管理
├── shell # 接收用户输入的命令,内核去执行
├── syscall # 系统调用
├── testsuilts # 测试套件
└── tools # 构建工具及相关配置和代码
```
## 约束<a name="section119744591305"></a>
- 开发语言C/C++
- 适用于Hi3518EV300、Hi3516DV300单板
- Hi3518EV300默认使用jffs2文件系统Hi3516DV300默认使用FAT文件系统。
- 适用于Hi3516DV300单板
- Hi3516DV300默认使用FAT文件系统。
## 使用说明<a name="section741617511812"></a>
OpenHarmony LiteOS-A内核支持Hi3518EV300[介绍](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3518%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BB%8B%E7%BB%8D.md)、Hi3516DV300[介绍](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3516%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BB%8B%E7%BB%8D.md)单板开发者可基于两种单板开发运行自己的应用程序。
OpenHarmony LiteOS-A内核支持[Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-appendix-hi3516.md)单板开发者可基于单板开发运行自己的应用程序。
### 准备<a name="section1579912573329"></a>
开发者需要在Linux上搭建编译环境:
开发者需要在Ubuntu上搭建编译环境:
- Hi3518EV300单板参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3518%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83.md)
- Hi3516DV300单板参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3516%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83.md)。
- [编译环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Readme-CN.md);
### 获取源码<a name="section11443189655"></a>
Linux服务器上下载并解压一套源代码获取源码[下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式参考[源码获取](https://gitee.com/openharmony/docs/blob/master/get-code/%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96.md)。
Ubuntu服务器源码获取方式参考: [源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
### 编译构建<a name="section2081013992812"></a>
开发者开发第一个应用程序可参考:
如果这是您的首次应用程序开发,可参考:[helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-helloworld.md)。
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/quick-start/%E5%BC%80%E5%8F%91Hi3518%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A4%BA%E4%BE%8B%E7%A8%8B%E5%BA%8F.md)
编译可以参考:[编译指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-build.md)
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/quick-start/%E5%BC%80%E5%8F%91Hi3516%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E7%A4%BA%E4%BE%8B.md)
测试参考:[单元测试](testsuites/unittest/tools/README.md)
## 贡献<a name="section1371123476304"></a>
[如何贡献](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE.md)
[Commit message规范](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)
[OpenHarmony C&C++ 安全编程指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/OpenHarmony-c-cpp-secure-coding-guide.md)
[LiteOS-A 内核编码规范指南](https://gitee.com/openharmony/kernel_liteos_a/wikis/LiteOS-A%20%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83%E6%8C%87%E5%8D%97)
## 相关仓<a name="section1371113476307"></a>
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos)
[内核子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%86%85%E6%A0%B8%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
**[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a)**
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README_zh.md)
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/master/README_zh.md)

62
apps/BUILD.gn Normal file
View File

@@ -0,0 +1,62 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
group("apps") {
deps = []
if (defined(LOSCFG_SHELL)) {
deps += [
"mksh",
"shell",
"toybox",
]
}
if (defined(LOSCFG_USER_INIT_DEBUG)) {
deps += [ "init" ]
}
if (defined(LOSCFG_NET_LWIP_SACK_TFTP)) {
deps += [ "tftp" ]
}
if (defined(LOSCFG_DRIVERS_TRACE)) {
deps += [ "trace" ]
}
if (defined(LOSCFG_DRIVERS_PERF)) {
deps += [ "perf" ]
}
if (defined(LOSCFG_KERNEL_LMS)) {
deps += [ "lms:sample_usr_lms" ]
}
}

25
apps/Makefile Executable file → Normal file
View File

@@ -27,23 +27,14 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include ../.config
include ./module.mk
APPSTOPDIR := $(shell pwd)
LITEOSTOPDIR ?= $(APPSTOPDIR)/..
export LITEOSTOPDIR
export APPSTOPDIR
HIDE := @
APPS := app
include $(APPSTOPDIR)/config.mk
all: $(APPS)
all clean:
$(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir $@ || exit 1; done
# Make
$(APPS):
ifneq ($(APP_SUBDIRS), )
$(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir || exit 1; done
endif
clean:
ifneq ($(APP_SUBDIRS), )
$(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir clean; done
endif
.PHONY: all $(APPS) clean
.PHONY: all clean

6
tools/fsimage/MakeVersion.sh → apps/app.mk Executable file → Normal file
View File

@@ -1,5 +1,3 @@
#!/bin/bash
#
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
@@ -29,4 +27,6 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
./mkfs.jffs2 -s 0x1000 -e 0x10000 -p 0x100000 -d rootfs/ -o rootfs_64k.jffs2
override TARGET = $(OUT)/bin/$(APP_NAME)
include $(MODULE)

65
apps/config.mk Executable file → Normal file
View File

@@ -27,34 +27,53 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# common dir config
include $(LITEOSTOPDIR)/config.mk
# output dir config
OBJOUT := $(APPSTOPDIR)/out
APPSOUT := $(OBJOUT)/apps
LIBSOUT := $(OBJOUT)/libs
IMGOUT := $(OUT)
# common flags config
BASE_OPTS := -ffunction-sections -fdata-sections -fno-omit-frame-pointer -D_GNU_SOURCE \
$(LITEOS_SSP) $(LITEOS_CORE_COPTS) $(WARNING_AS_ERROR) $(LLVM_EXTRA_OPTS) $(LITEOS_GCOV_OPTS)
BASE_OPTS := -D_FORTIFY_SOURCE=2 -D_XOPEN_SOURCE=700
CFLAGS := -std=c99 -fno-exceptions $(BASE_OPTS) $(LITEOS_COPTS_OPTMIZE)
CXXFLAGS := -std=c++11 -fexceptions -fpermissive -frtti $(BASE_OPTS) $(LITEOS_COPTS_OPTMIZE)
LDCFLAGS := -lc
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
LLVM_SYSROOT := --sysroot=$(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/
LDCXXFLGS := -lc++ -lc++abi -lc
else
BASE_OPTS += -Wl,-z,relro,-z,now
LDCXXFLGS := -lstdc++ -lsupc++ -lc
endif
COMMON_INCLUDE := -I $(LITEOSTHIRDPARTY)/bounds_checking_function/include
ASFLAGS :=
CFLAGS := $(LITEOS_COPTS) $(BASE_OPTS) -fPIE
CXXFLAGS := $(LITEOS_CXXOPTS) $(BASE_OPTS) -fPIE
LDFLAGS := $(LITEOS_CORE_COPTS) -pie -Wl,-z,relro,-z,now -O2
CFLAGS := $(filter-out -fno-pic -fno-builtin -nostdinc -nostdlib,$(CFLAGS))
CXXFLAGS := $(filter-out -fno-pic -fno-builtin -nostdinc -nostdlib -nostdinc++,$(CXXFLAGS))
# alias variable config
HIDE := @
MAKE := make
RM := -rm -rf
CP := -cp -rf
MV := -mv
RM := rm -rf
CP := cp -rf
MV := mv -f
APP := $(APPSTOPDIR)/app.mk
##build modules config##
APP_SUBDIRS :=
ifeq ($(LOSCFG_SHELL), y)
APP_SUBDIRS += shell
APP_SUBDIRS += mksh
APP_SUBDIRS += toybox
endif
ifeq ($(LOSCFG_KERNEL_LMS), y)
APP_SUBDIRS += lms
endif
ifeq ($(LOSCFG_USER_INIT_DEBUG), y)
APP_SUBDIRS += init
endif
ifeq ($(LOSCFG_NET_LWIP_SACK_TFTP), y)
APP_SUBDIRS += tftp
endif
ifeq ($(LOSCFG_DRIVERS_TRACE), y)
APP_SUBDIRS += trace
endif
ifeq ($(LOSCFG_DRIVERS_PERF), y)
APP_SUBDIRS += perf
endif

View File

@@ -1,5 +1,3 @@
#!/bin/bash
#
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
@@ -28,12 +26,14 @@
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -e
BIN_DIR=$1
LIB_DIR=$2
ROOTFS_DIR=$3
FSTYPE=$4
CUR_DIR=$(dirname $(readlink -f "$0"))
. ${CUR_DIR}/rootfsdir.sh ${BIN_DIR} ${LIB_DIR} ${ROOTFS_DIR}
. ${CUR_DIR}/rootfsimg.sh ${ROOTFS_DIR} ${FSTYPE}
import("//kernel/liteos_a/liteos.gni")
executable("init") {
sources = [ "src/init.c" ]
if (defined(LOSCFG_QUICK_START)) {
ldflags = [ "--static" ]
defines = [ "LOSCFG_QUICK_START" ]
}
}

36
apps/init/Makefile Executable file → Normal file
View File

@@ -27,43 +27,15 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
INIT_DIR := $(dir $(shell pwd))/init/
include $(APPSTOPDIR)/config.mk
ifeq ($(APPSTOPDIR), )
APPSTOPDIR := $(shell pwd)/../
LITEOSTOPDIR = $(APPSTOPDIR)/../
endif
include $(INIT_DIR)/../config.mk
APP_NAME := $(notdir $(shell pwd))
APPS_OUT := $(OUT)/bin
LOCAL_SRCS := src/init.c
LOCAL_OBJ := src/init.o
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses -Wnonnull $(LLVM_SYSROOT)
LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT)
endif
ifeq ($(LOSCFG_QUICK_START), y)
LDCFLAGS += --static
LDFLAGS += --static
CFLAGS += -DLOSCFG_QUICK_START
endif
INITNAME := init
all: $(INITNAME)
$(LOCAL_OBJ): %.o : %.c
$(HIDE) $(CC) $(CFLAGS) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@
$(INITNAME):$(LOCAL_OBJ)
$(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(INITNAME) $^ $(LDCFLAGS)
$(HIDE) mkdir -p $(APPS_OUT)
$(HIDE) $(MV) $(INITNAME) $(APPS_OUT)
$(HIDE) $(RM) $(LOCAL_OBJ)
clean:
$(HIDE) $(RM) $(LOCAL_OBJ)
$(HIDE) $(RM) $(INITNAME)
.PHONY: all $(INITNAME) clean
include $(APP)

14
apps/init/src/init.c Executable file → Normal file
View File

@@ -48,8 +48,10 @@
#endif
int main(int argc, char * const *argv)
{
(void)argv;
int ret;
const char *shellPath = "/bin/shell";
pid_t gid;
const char *shellPath = "/bin/mksh";
#ifdef LOSCFG_QUICK_START
const char *samplePath = "/dev/shm/sample_quickstart";
@@ -74,6 +76,16 @@ int main(int argc, char * const *argv)
if (ret < 0) {
printf("Failed to fork for shell\n");
} else if (ret == 0) {
gid = getpgrp();
if (gid < 0) {
printf("get group id failed, pgrpid %d, errno %d\n", gid, errno);
exit(0);
}
ret = tcsetpgrp(STDIN_FILENO, gid);
if (ret != 0) {
printf("tcsetpgrp failed, errno %d\n", errno);
exit(0);
}
(void)execve(shellPath, NULL, NULL);
exit(0);
}

View File

@@ -1,5 +1,3 @@
#!/bin/bash
#
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
@@ -29,31 +27,51 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -e
declare CROSS_COMPILER="$1"
declare HMOS_TOP_DIR="$2"
declare gcc_path=${HMOS_TOP_DIR}/../../prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc
declare windows_gcc_path=${HMOS_TOP_DIR}/../../prebuilts/gcc/win-x86/arm/arm-linux-ohoseabi-gcc
function get_compiler_path()
{
local system=$(uname -s)
local user_gcc="${CROSS_COMPILER}"gcc
local gcc_install_path=$(which "${user_gcc}")
if [ "$system" != "Linux" ] ; then
if [ -e "${windows_gcc_path}" ] ; then
gcc_install_path=$windows_gcc_path
else
gcc_install_path=$(dirname $gcc_install_path)/../
fi
else
if [ -e "${gcc_path}" ] ; then
gcc_install_path=$gcc_path
else
gcc_install_path=$(dirname $gcc_install_path)/../
fi
fi
echo "$gcc_install_path"
import("//build/lite/config/component/lite_component.gni")
lite_component("LMS-Sample") {
features = [ ":sample_usr_lms" ]
}
executable("sample_usr_lms") {
output_name = "sample_usr_lms"
sources = [ "src/sample_usr_lms.c" ]
include_dirs = []
defines = []
if (ohos_build_compiler == "gcc") {
cflags_c = [
"-O0",
"-fsanitize=kernel-address",
"-funwind-tables",
"-fasynchronous-unwind-tables",
]
} else {
cflags_c = [
"-O0",
"-fsanitize=kernel-address",
"-mllvm",
"-asan-instrumentation-with-call-threshold=0",
"-mllvm",
"-asan-stack=0",
"-mllvm",
"-asan-globals=0",
"-funwind-tables",
"-fasynchronous-unwind-tables",
]
}
ldflags = [
"-rdynamic",
"-lunwind",
"-lusrlms",
"-Wl,--wrap=realloc",
"-Wl,--wrap=calloc",
"-Wl,--wrap=malloc",
"-Wl,--wrap=free",
"-Wl,--wrap=valloc",
"-Wl,--wrap=aligned_alloc",
"-Wl,--wrap=memset",
"-Wl,--wrap=memcpy",
"-Wl,--wrap=memmove",
"-Wl,--wrap=strcpy",
"-Wl,--wrap=strcat",
]
deps = [ "$LITEOSTOPDIR/kernel/extended/lms/usr:usrlmslib" ]
}
get_compiler_path

View File

@@ -0,0 +1,250 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void BufWriteTest(void *buf, int start, int end)
{
for (int i = start; i <= end; i++) {
((char *)buf)[i] = 'a';
}
}
static void BufReadTest(void *buf, int start, int end)
{
char tmp;
for (int i = start; i <= end; i++) {
tmp = ((char *)buf)[i];
}
}
static void LmsMallocTest(void)
{
#define TEST_SIZE 16
printf("\n-------- LmsMallocTest Start --------\n");
char *buf = (char *)malloc(TEST_SIZE);
if (buf == NULL) {
return;
}
printf("[LmsMallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
BufReadTest(buf, -1, TEST_SIZE);
printf("[LmsMallocTest] write overflow error should be triggered, write range[0, TEST_SIZE]\n");
BufWriteTest(buf, 0, TEST_SIZE);
free(buf);
printf("\n-------- LmsMallocTest End --------\n");
}
static void LmsReallocTest(void)
{
#define TEST_SIZE 64
#define TEST_SIZE_MIN 32
printf("\n-------- LmsReallocTest Start --------\n");
char *buf = (char *)malloc(TEST_SIZE);
printf("[LmsReallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
BufReadTest(buf, -1, TEST_SIZE);
char *buf1 = (char *)realloc(buf, TEST_SIZE_MIN);
if (buf1 == NULL) {
free(buf);
return;
}
buf = NULL;
printf("[LmsReallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE_MIN]\n");
BufReadTest(buf1, -1, TEST_SIZE_MIN);
free(buf1);
printf("\n-------- LmsReallocTest End --------\n");
}
static void LmsCallocTest(void)
{
#define TEST_SIZE 16
printf("\n-------- LmsCallocTest Start --------\n");
char *buf = (char *)calloc(4, 4); /* 4: test size */
if (buf == NULL) {
return;
}
printf("[LmsCallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
BufReadTest(buf, -1, TEST_SIZE);
free(buf);
printf("\n-------- LmsCallocTest End --------\n");
}
static void LmsVallocTest(void)
{
#define TEST_SIZE 4096
printf("\n-------- LmsVallocTest Start --------\n");
char *buf = (char *)valloc(TEST_SIZE);
if (buf == NULL) {
return;
}
printf("[LmsVallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
BufReadTest(buf, -1, TEST_SIZE);
free(buf);
printf("\n-------- LmsVallocTest End --------\n");
}
static void LmsAlignedAllocTest(void)
{
#define TEST_ALIGN_SIZE 64
#define TEST_SIZE 128
printf("\n-------- LmsAlignedAllocTest Start --------\n");
char *buf = (char *)aligned_alloc(TEST_ALIGN_SIZE, TEST_SIZE);
if (buf == NULL) {
return;
}
printf("[LmsAlignedAllocTest] read overflow & underflow error should be triggered, read range[-1,128]\n");
BufReadTest(buf, -1, 128);
free(buf);
printf("\n-------- LmsAlignedAllocTest End --------\n");
}
static void LmsMemsetTest(void)
{
#define TEST_SIZE 32
printf("\n-------- LmsMemsetTest Start --------\n");
char *buf = (char *)malloc(TEST_SIZE);
if (buf == NULL) {
return;
}
printf("[LmsMemsetTest] memset overflow & underflow error should be triggered, memset size:%d\n", TEST_SIZE + 1);
memset(buf, 0, TEST_SIZE + 1);
free(buf);
printf("\n-------- LmsMemsetTest End --------\n");
}
static void LmsMemcpyTest(void)
{
#define TEST_SIZE 20
printf("\n-------- LmsMemcpyTest Start --------\n");
char *buf = (char *)malloc(TEST_SIZE);
if (buf == NULL) {
return;
}
char localBuf[32] = {0}; /* 32: test size */
printf("[LmsMemcpyTest] memcpy overflow error should be triggered, memcpy size:%d\n", TEST_SIZE + 1);
memcpy(buf, localBuf, TEST_SIZE + 1);
free(buf);
printf("\n-------- LmsMemcpyTest End --------\n");
}
static void LmsMemmoveTest(void)
{
#define TEST_SIZE 20
printf("\n-------- LmsMemmoveTest Start --------\n");
char *buf = (char *)malloc(TEST_SIZE);
if (buf == NULL) {
return;
}
printf("[LmsMemmoveTest] memmove overflow error should be triggered\n");
memmove(buf + 12, buf, 10); /* 12 and 10: test size */
free(buf);
printf("\n-------- LmsMemmoveTest End --------\n");
}
static void LmsStrcpyTest(void)
{
#define TEST_SIZE 16
printf("\n-------- LmsStrcpyTest Start --------\n");
char *buf = (char *)malloc(TEST_SIZE);
if (buf == NULL) {
return;
}
char *testStr = "bbbbbbbbbbbbbbbbb";
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n",
(int)strlen(testStr) + 1);
strcpy(buf, testStr);
free(buf);
printf("\n-------- LmsStrcpyTest End --------\n");
}
static void LmsStrcatTest(void)
{
#define TEST_SIZE 16
printf("\n-------- LmsStrcatTest Start --------\n");
char *buf = (char *)malloc(TEST_SIZE);
if (buf == NULL) {
return;
}
buf[0] = 'a';
buf[1] = 'b';
buf[2] = 0;
char *testStr = "cccccccccccccc";
printf("[LmsStrcatTest] strcat overflow error should be triggered, src string:%s dest string:%s"
"total buf size:%d\n",
testStr, buf, strlen(testStr) + strlen(buf) + 1);
strcat(buf, testStr);
free(buf);
printf("\n-------- LmsStrcatTest End --------\n");
}
static void LmsFreeTest(void)
{
#define TEST_SIZE 16
printf("\n-------- LmsFreeTest Start --------\n");
char *buf = (char *)malloc(TEST_SIZE);
if (buf == NULL) {
return;
}
printf("[LmsFreeTest] free size:%d\n", TEST_SIZE);
free(buf);
printf("[LmsFreeTest] Use after free error should be triggered, read range[1,1]\n");
BufReadTest(buf, 1, 1);
printf("[LmsFreeTest] double free error should be triggered\n");
free(buf);
printf("\n-------- LmsFreeTest End --------\n");
}
int main(int argc, char * const *argv)
{
(void)argc;
(void)argv;
printf("\n############### Lms Test start ###############\n");
char *tmp = (char *)malloc(5000); /* 5000: test mem size */
if (tmp == NULL) {
return -1;
}
LmsMallocTest();
LmsReallocTest();
LmsCallocTest();
LmsVallocTest();
LmsAlignedAllocTest();
LmsMemsetTest();
LmsMemcpyTest();
LmsMemmoveTest();
LmsStrcpyTest();
LmsStrcatTest();
LmsFreeTest();
free(tmp);
printf("\n############### Lms Test End ###############\n");
return 0;
}

100
apps/mksh/BUILD.gn Normal file
View File

@@ -0,0 +1,100 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/component/lite_component.gni")
import("//kernel/liteos_a/liteos.gni")
import("$THIRDPARTY_MKSH_DIR/mksh.gni")
group("mksh") {
deps = [ ":build_mksh" ]
}
copy("copy_mksh_src") {
sources = MKSH_SRC_DIR
outputs = [ "$target_out_dir/mksh_build" ]
}
build_ext_component("build_mksh") {
deps = [ ":copy_mksh_src" ]
deps += [ "$THIRDPARTY_MUSL_DIR:sysroot_lite" ]
exec_path = rebase_path("$target_out_dir/mksh_build")
cflags = [
"-flto",
"-fdata-sections",
"-ffunction-sections",
"-fstack-protector-strong",
"-D_FORTIFY_SOURCE=2",
"-DMKSH_DISABLE_TTY_WARNING",
"-DMKSH_SMALL=1",
"-DMKSH_ASSUME_UTF8=1",
"-DMKSH_SMALL_BUT_FAST=0",
"-DMKSH_S_NOVI=1",
"-DHAVE_CAN_FSTACKPROTECTORSTRONG=1",
"-DMKSH_LESS_CMDLINE_EDITING",
"-DMKSH_LESS_BUILDINS",
"-DMKSH_NO_INITCOMS",
"-DADAPT_FOR_LITEOS_A",
]
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-Oz" ]
} else {
cflags += [ "-O2" ]
}
cflags = string_join(" ", cflags)
extra_flags = string_join(" ", target_arch_cflags)
if (ohos_build_compiler == "clang") {
extra_flags += " --target=$target_triple"
extra_flags += " --sysroot=" + rebase_path(ohos_current_sysroot)
}
command = "rm -rf .git && env"
command += " CC=\"$ohos_current_cc_command\""
command += " TARGET_OS=OpenHarmony"
command += " CFLAGS=\"$cflags $extra_flags\""
command += " LDFLAGS=\"-Wl,--gc-sections -flto -O2\""
command += " sh ./Build.sh -r"
# copy mksh and .mkshrc to out dir
command += " && mkdir -p "
command += rebase_path("$root_out_dir/bin", exec_path)
command += " && install -D mksh "
command += rebase_path("$root_out_dir/unstripped/bin/mksh", exec_path)
command += " && $ohos_current_strip_command mksh -o "
command += rebase_path("$root_out_dir/bin/mksh", exec_path)
command += " && install -D .mkshrc "
command += rebase_path("$root_out_dir/etc/.mkshrc", exec_path)
outputs = [
"$root_out_dir/unstripped/bin/mksh",
"$root_out_dir/bin/mksh",
"$root_out_dir/etc/.mkshrc",
]
}

56
apps/mksh/Makefile Executable file
View File

@@ -0,0 +1,56 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include $(APPSTOPDIR)/config.mk
BUILD_DIR := $(OUT)/mksh_build
BUILD_LOG := $(BUILD_DIR)/build.log
CFLAGS += -DMKSH_DISABLE_TTY_WARNING -DMKSH_SMALL=1 -DMKSH_ASSUME_UTF8=1 -DMKSH_SMALL_BUT_FAST=0 -DMKSH_S_NOVI=1 -DHAVE_CAN_FSTACKPROTECTORSTRONG=1
CFLAGS += -DMKSH_LESS_CMDLINE_EDITING -DMKSH_LESS_BUILDINS -DMKSH_NO_INITCOMS -DADAPT_FOR_LITEOS_A
CFLAGS += -Wno-error
LDFLAGS += -Wl,--gc-sections
all:
ifneq ($(wildcard $(BUILD_DIR)/Rebuild.sh),)
$(HIDE)echo "not clean, rebuilding now"
$(HIDE)cd $(BUILD_DIR) && sh ./Rebuild.sh > $(BUILD_LOG) 2>&1
else
$(HIDE)mkdir -p $(BUILD_DIR)
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/mksh/. $(BUILD_DIR)
$(HIDE)cd $(BUILD_DIR) && CC="$(CC)" TARGET_OS=OpenHarmony CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" sh ./Build.sh -r > $(BUILD_LOG) 2>&1
endif
$(HIDE)mkdir -p $(OUT)/bin/ $(OUT)/etc/
$(HIDE)$(STRIP) $(BUILD_DIR)/mksh -o $(OUT)/bin/mksh
$(HIDE)$(CP) $(BUILD_DIR)/.mkshrc $(OUT)/etc/
clean:
$(HIDE)$(RM) $(BUILD_DIR)
.PHONY: all clean

63
apps/perf/BUILD.gn Normal file
View File

@@ -0,0 +1,63 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
executable("perf") {
sources = [
"src/main.c",
"src/option.c",
"src/perf.c",
"src/perf_list.c",
"src/perf_record.c",
"src/perf_stat.c",
]
include_dirs = [ "include" ]
defines = []
if (defined(LOSCFG_PERF_HW_PMU)) {
defines += [ "LOSCFG_PERF_HW_PMU" ]
}
if (defined(LOSCFG_PERF_TIMED_PMU)) {
defines += [ "LOSCFG_PERF_TIMED_PMU" ]
}
if (defined(LOSCFG_PERF_SW_PMU)) {
defines += [ "LOSCFG_PERF_SW_PMU" ]
}
if (defined(LOSCFG_FS_VFS)) {
defines += [ "LOSCFG_FS_VFS" ]
}
defines += [ "LOSCFG_PERF_BUFFER_SIZE=$LOSCFG_PERF_BUFFER_SIZE" ]
deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ]
}

62
apps/perf/Makefile Normal file
View File

@@ -0,0 +1,62 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include $(APPSTOPDIR)/config.mk
APP_NAME := $(notdir $(shell pwd))
SECUREC_DIR := $(LITEOSTHIRDPARTY)/bounds_checking_function
LOCAL_SRCS = $(wildcard src/*.c)
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/*.c)
LOCAL_INCLUDE := \
-I include \
-I $(SECUREC_DIR)/include
LOCAL_FLAGS += $(LOCAL_INCLUDE)
ifeq ($(LOSCFG_PERF_HW_PMU), y)
CFLAGS += -DLOSCFG_PERF_HW_PMU
endif
ifeq ($(LOSCFG_PERF_TIMED_PMU), y)
CFLAGS += -DLOSCFG_PERF_TIMED_PMU
endif
ifeq ($(LOSCFG_PERF_SW_PMU), y)
CFLAGS += -DLOSCFG_PERF_SW_PMU
endif
ifeq ($(LOSCFG_FS_VFS), y)
CFLAGS += -DLOSCFG_FS_VFS
endif
CFLAGS += -DLOSCFG_PERF_BUFFER_SIZE=$(LOSCFG_PERF_BUFFER_SIZE)
include $(APP)

View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _OPTION_H
#define _OPTION_H
#include "perf.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define CMD_MAX_PARAMS 10
typedef int (*CALL_BACK)(const char *argv);
enum OptionType {
OPTION_TYPE_UINT,
OPTION_TYPE_STRING,
OPTION_TYPE_CALLBACK,
};
typedef struct {
int type;
const char *name;
const char **str;
unsigned int *value;
CALL_BACK cb;
} PerfOption;
typedef struct {
const char *path;
char *params[CMD_MAX_PARAMS];
} SubCmd;
#define OPTION_END() {.name = ""}
#define OPTION_UINT(n, v) {.type = OPTION_TYPE_UINT, .name = (n), .value = (v)}
#define OPTION_STRING(n, s) {.type = OPTION_TYPE_STRING, .name = (n), .str = (s)}
#define OPTION_CALLBACK(n, c) {.type = OPTION_TYPE_CALLBACK, .name = (n), .cb = (c)}
int ParseOptions(int argc, char **argv, PerfOption *opt, SubCmd *cmd);
int ParseEvents(const char *argv, PerfEventConfig *eventsCfg, unsigned int *len);
int ParseIds(const char *argv, int *arr, unsigned int *len);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif /* _OPTION_H */

163
apps/perf/include/perf.h Normal file
View File

@@ -0,0 +1,163 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _PERF_H
#define _PERF_H
#include <stdlib.h>
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define PERF_MAX_EVENT 7
#define PERF_MAX_FILTER_TSKS 32
#ifdef PERF_DEBUG
#define printf_debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#define printf_debug(fmt, ...)
#endif
/*
* Perf types
*/
enum PerfEventType {
PERF_EVENT_TYPE_HW, /* boards common hw events */
PERF_EVENT_TYPE_TIMED, /* hrtimer timed events */
PERF_EVENT_TYPE_SW, /* software trace events */
PERF_EVENT_TYPE_RAW, /* boards special hw events, see enum PmuEventType in corresponding arch headfile */
PERF_EVENT_TYPE_MAX
};
/*
* Common hardware pmu events
*/
enum PmuHwId {
PERF_COUNT_HW_CPU_CYCLES = 0, /* cpu cycle event */
PERF_COUNT_HW_INSTRUCTIONS, /* instruction event */
PERF_COUNT_HW_DCACHE_REFERENCES, /* dcache access event */
PERF_COUNT_HW_DCACHE_MISSES, /* dcache miss event */
PERF_COUNT_HW_ICACHE_REFERENCES, /* icache access event */
PERF_COUNT_HW_ICACHE_MISSES, /* icache miss event */
PERF_COUNT_HW_BRANCH_INSTRUCTIONS, /* software change of pc event */
PERF_COUNT_HW_BRANCH_MISSES, /* branch miss event */
PERF_COUNT_HW_MAX,
};
/*
* Common hrtimer timed events
*/
enum PmuTimedId {
PERF_COUNT_CPU_CLOCK = 0, /* hrtimer timed event */
};
/*
* Common software pmu events
*/
enum PmuSwId {
PERF_COUNT_SW_TASK_SWITCH = 1, /* task switch event */
PERF_COUNT_SW_IRQ_RESPONSE, /* irq response event */
PERF_COUNT_SW_MEM_ALLOC, /* memory alloc event */
PERF_COUNT_SW_MUX_PEND, /* mutex pend event */
PERF_COUNT_SW_MAX,
};
/*
* perf sample data types
* Config it through PerfConfigAttr->sampleType.
*/
enum PerfSampleType {
PERF_RECORD_CPU = 1U << 0, /* record current cpuid */
PERF_RECORD_TID = 1U << 1, /* record current task id */
PERF_RECORD_TYPE = 1U << 2, /* record event type */
PERF_RECORD_PERIOD = 1U << 3, /* record event period */
PERF_RECORD_TIMESTAMP = 1U << 4, /* record timestamp */
PERF_RECORD_IP = 1U << 5, /* record instruction pointer */
PERF_RECORD_CALLCHAIN = 1U << 6, /* record backtrace */
PERF_RECORD_PID = 1U << 7, /* record current process id */
};
/*
* perf configuration sub event information
*
* This structure is used to config specific events attributes.
*/
typedef struct {
unsigned int type; /* enum PerfEventType */
struct {
unsigned int eventId; /* the specific event corresponds to the PerfEventType */
unsigned int period; /* event period, for every "period"th occurrence of the event a
sample will be recorded */
} events[PERF_MAX_EVENT]; /* perf event list */
unsigned int eventsNr; /* total perf event number */
size_t predivided; /* whether to prescaler (once every 64 counts),
which only take effect on cpu cycle hardware event */
} PerfEventConfig;
/*
* perf configuration main information
*
* This structure is used to set perf sampling attributes, including events, tasks and other information.
*/
typedef struct {
PerfEventConfig eventsCfg; /* perf event config */
unsigned int taskIds[PERF_MAX_FILTER_TSKS]; /* perf task filter list (allowlist) */
unsigned int taskIdsNr; /* task numbers of task filter allowlist,
if set 0 perf will sample all tasks */
unsigned int processIds[PERF_MAX_FILTER_TSKS]; /* perf process filter list (allowlist) */
unsigned int processIdsNr; /* process numbers of process filter allowlist,
if set 0 perf will sample all processes */
unsigned int sampleType; /* type of data to sample defined in PerfSampleType */
size_t needSample; /* whether to sample data */
} PerfConfigAttr;
void PerfUsage(void);
void PerfDumpAttr(PerfConfigAttr *attr);
int PerfConfig(int fd, PerfConfigAttr *attr);
void PerfStart(int fd, size_t sectionId);
void PerfStop(int fd);
ssize_t PerfRead(int fd, char *buf, size_t size);
void PerfPrintBuffer(const char *buf, ssize_t num);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif /* _PERF_H */

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _PERF_LIST_H
#define _PERF_LIST_H
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
typedef struct {
const char *name;
int event;
int type;
} PerfEvent;
extern const PerfEvent g_events[];
void PerfList(void);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif /* _PERF_LIST_H */

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _PERF_RECORD_H
#define _PERF_RECORD_H
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
void PerfRecord(int fd, int argc, char **argv);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif /* _PERF_RECORD_H */

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _PERF_STAT_H
#define _PERF_STAT_H
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
void PerfStat(int fd, int argc, char **argv);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif /* _PERF_STAT_H */

90
apps/perf/src/main.c Normal file
View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include "perf.h"
#include "perf_list.h"
#include "perf_stat.h"
#include "perf_record.h"
int main(int argc, char **argv)
{
#define TWO_ARGS 2
#define THREE_ARGS 3
int fd = open("/dev/perf", O_RDWR);
if (fd == -1) {
printf("Perf open failed.\n");
exit(EXIT_FAILURE);
}
if (argc == 1) {
PerfUsage();
} else if ((argc == TWO_ARGS) && strcmp(argv[1], "start") == 0) {
PerfStart(fd, 0);
} else if ((argc == THREE_ARGS) && strcmp(argv[1], "start") == 0) {
size_t id = strtoul(argv[THREE_ARGS - 1], NULL, 0);
PerfStart(fd, id);
} else if ((argc == TWO_ARGS) && strcmp(argv[1], "stop") == 0) {
PerfStop(fd);
} else if ((argc == THREE_ARGS) && strcmp(argv[1], "read") == 0) {
size_t size = strtoul(argv[THREE_ARGS - 1], NULL, 0);
if (size == 0) {
goto EXIT:
}
char *buf = (char *)malloc(size);
if (buf != NULL) {
int len = PerfRead(fd, buf, size);
PerfPrintBuffer(buf, len);
free(buf);
buf = NULL;
}
} else if ((argc == TWO_ARGS) && strcmp(argv[1], "list") == 0) {
PerfList();
} else if ((argc >= THREE_ARGS) && strcmp(argv[1], "stat") == 0) {
PerfStat(fd, argc, argv);
} else if ((argc >= THREE_ARGS) && strcmp(argv[1], "record") == 0) {
PerfRecord(fd, argc, argv);
} else {
printf("Unsupported perf command.\n");
PerfUsage();
}
EXIT:
close(fd);
return 0;
}

182
apps/perf/src/option.c Normal file
View File

@@ -0,0 +1,182 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <string.h>
#include "option.h"
#include "perf_list.h"
static int ParseOption(char **argv, int *index, PerfOption *opts)
{
int ret = 0;
const char *str = NULL;
while ((opts->name != NULL) && (*opts->name != 0)) {
if (strcmp(argv[*index], opts->name) == 0) {
switch (opts->type) {
case OPTION_TYPE_UINT:
*opts->value = strtoul(argv[++(*index)], NULL, 0);
break;
case OPTION_TYPE_STRING:
*opts->str = argv[++(*index)];
break;
case OPTION_TYPE_CALLBACK:
str = argv[++(*index)];
if ((*opts->cb)(str) != 0) {
printf("parse error\n");
ret = -1;
}
break;
default:
printf("invalid option\n");
ret = -1;
break;
}
return ret;
}
opts++;
}
return -1;
}
int ParseOptions(int argc, char **argv, PerfOption *opts, SubCmd *cmd)
{
int i;
int index = 0;
while ((index < argc) && (argv[index] != NULL) && (*argv[index] == '-')) {
if (ParseOption(argv, &index, opts) != 0) {
return -1;
}
index++;
}
if ((index < argc) && (argv[index] != NULL)) {
cmd->path = argv[index];
cmd->params[0] = argv[index];
index++;
} else {
printf("no subcmd to execute\n");
return -1;
}
for (i = 1; (index < argc) && (i < CMD_MAX_PARAMS); index++, i++) {
cmd->params[i] = argv[index];
}
printf_debug("subcmd = %s\n", cmd->path);
for (int j = 0; j < i; j++) {
printf_debug("paras[%d]:%s\n", j, cmd->params[j]);
}
return 0;
}
int ParseIds(const char *argv, int *arr, unsigned int *len)
{
int res, ret;
unsigned int index = 0;
char *sp = NULL;
char *this = NULL;
char *list = strdup(argv);
if (list == NULL) {
printf("no memory for ParseIds\n");
return -1;
}
sp = strtok_r(list, ",", &this);
while (sp) {
res = strtoul(sp, NULL, 0);
if (res < 0) {
ret = -1;
goto EXIT;
}
arr[index++] = res;
sp = strtok_r(NULL, ",", &this);
}
*len = index;
ret = 0;
EXIT:
free(list);
return ret;
}
static inline const PerfEvent *StrToEvent(const char *str)
{
const PerfEvent *evt = &g_events[0];
for (; evt->event != -1; evt++) {
if (strcmp(str, evt->name) == 0) {
return evt;
}
}
return NULL;
}
int ParseEvents(const char *argv, PerfEventConfig *eventsCfg, unsigned int *len)
{
int ret;
unsigned int index = 0;
const PerfEvent *event = NULL;
char *sp = NULL;
char *this = NULL;
char *list = strdup(argv);
if (list == NULL) {
printf("no memory for ParseEvents\n");
return -1;
}
sp = strtok_r(list, ",", &this);
while (sp) {
event = StrToEvent(sp);
if (event == NULL) {
ret = -1;
goto EXIT;
}
if (index == 0) {
eventsCfg->type = event->type;
} else if (eventsCfg->type != event->type) {
printf("events type must be same\n");
ret = -1;
goto EXIT;
}
eventsCfg->events[index].eventId = event->event;
sp = strtok_r(NULL, ",", &this);
index++;
}
*len = index;
ret = 0;
EXIT:
free(list);
return ret;
}

136
apps/perf/src/perf.c Normal file
View File

@@ -0,0 +1,136 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include "perf.h"
#define PERF_IOC_MAGIC 'T'
#define PERF_START _IO(PERF_IOC_MAGIC, 1)
#define PERF_STOP _IO(PERF_IOC_MAGIC, 2)
void PerfUsage(void)
{
printf("\nUsage: ./perf start [id]. Start perf.\n");
printf("\nUsage: ./perf stop. Stop perf.\n");
printf("\nUsage: ./perf read <nBytes>. Read nBytes raw data from perf buffer and print out.\n");
printf("\nUsage: ./perf list. List events to be used in -e.\n");
printf("\nUsage: ./perf stat/record [option] <command>. \n"
"-e, event selector. use './perf list' to list available events.\n"
"-p, event period.\n"
"-o, perf data output filename.\n"
"-t, taskId filter(allowlist), if not set perf will sample all tasks.\n"
"-s, type of data to sample defined in PerfSampleType los_perf.h.\n"
"-P, processId filter(allowlist), if not set perf will sample all processes.\n"
"-d, whether to prescaler (once every 64 counts),"
"which only take effect on cpu cycle hardware event.\n"
);
}
static void PerfSetPeriod(PerfConfigAttr *attr)
{
int i;
for (i = 1; i < attr->eventsCfg.eventsNr; i++) {
attr->eventsCfg.events[i].period = attr->eventsCfg.events[0].period;
}
}
void PerfPrintBuffer(const char *buf, ssize_t num)
{
#define BYTES_PER_LINE 4
ssize_t i;
for (i = 0; i < num; i++) {
printf(" %02x", (unsigned char)buf[i]);
if (((i + 1) % BYTES_PER_LINE) == 0) {
printf("\n");
}
}
printf("\n");
}
void PerfDumpAttr(PerfConfigAttr *attr)
{
int i;
printf_debug("attr->type: %d\n", attr->eventsCfg.type);
for (i = 0; i < attr->eventsCfg.eventsNr; i++) {
printf_debug("attr->events[%d]: %d, 0x%x\n", i, attr->eventsCfg.events[i].eventId,
attr->eventsCfg.events[i].period);
}
printf_debug("attr->predivided: %d\n", attr->eventsCfg.predivided);
printf_debug("attr->sampleType: 0x%x\n", attr->sampleType);
for (i = 0; i < attr->taskIdsNr; i++) {
printf_debug("attr->taskIds[%d]: %d\n", i, attr->taskIds[i]);
}
for (i = 0; i < attr->processIdsNr; i++) {
printf_debug("attr->processIds[%d]: %d\n", i, attr->processIds[i]);
}
printf_debug("attr->needSample: %d\n", attr->needSample);
}
void PerfStart(int fd, size_t sectionId)
{
(void)ioctl(fd, PERF_START, sectionId);
}
void PerfStop(int fd)
{
(void)ioctl(fd, PERF_STOP, NULL);
}
int PerfConfig(int fd, PerfConfigAttr *attr)
{
if (attr == NULL) {
return -1;
}
PerfSetPeriod(attr);
PerfDumpAttr(attr);
return write(fd, attr, sizeof(PerfConfigAttr));
}
ssize_t PerfRead(int fd, char *buf, size_t size)
{
ssize_t len;
if (buf == NULL) {
printf("Read buffer is null.\n");
return 0;
}
len = read(fd, buf, size);
return len;
}

129
apps/perf/src/perf_list.c Normal file
View File

@@ -0,0 +1,129 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include "perf.h"
#include "perf_list.h"
static const char *g_eventTypeStr[] = {
"[Hardware event]",
"[Timed event]",
"[Software event]",
};
const PerfEvent g_events[] = {
#ifdef LOSCFG_PERF_HW_PMU
{
.name = "cycles",
.event = PERF_COUNT_HW_CPU_CYCLES,
.type = PERF_EVENT_TYPE_HW,
},
{
.name = "instruction",
.event = PERF_COUNT_HW_INSTRUCTIONS,
.type = PERF_EVENT_TYPE_HW,
},
{
.name = "dcache",
.event = PERF_COUNT_HW_DCACHE_REFERENCES,
.type = PERF_EVENT_TYPE_HW,
},
{
.name = "dcache-miss",
.event = PERF_COUNT_HW_DCACHE_MISSES,
.type = PERF_EVENT_TYPE_HW,
},
{
.name = "icache",
.event = PERF_COUNT_HW_ICACHE_REFERENCES,
.type = PERF_EVENT_TYPE_HW,
},
{
.name = "icache-miss",
.event = PERF_COUNT_HW_ICACHE_MISSES,
.type = PERF_EVENT_TYPE_HW,
},
{
.name = "branch",
.event = PERF_COUNT_HW_BRANCH_INSTRUCTIONS,
.type = PERF_EVENT_TYPE_HW,
},
{
.name = "branch-miss",
.event = PERF_COUNT_HW_BRANCH_MISSES,
.type = PERF_EVENT_TYPE_HW,
},
#endif
#ifdef LOSCFG_PERF_TIMED_PMU
{
.name = "clock",
.event = PERF_COUNT_CPU_CLOCK,
.type = PERF_EVENT_TYPE_TIMED,
},
#endif
#ifdef LOSCFG_PERF_SW_PMU
{
.name = "task-switch",
.event = PERF_COUNT_SW_TASK_SWITCH,
.type = PERF_EVENT_TYPE_SW,
},
{
.name = "irq-in",
.event = PERF_COUNT_SW_IRQ_RESPONSE,
.type = PERF_EVENT_TYPE_SW,
},
{
.name = "mem-alloc",
.event = PERF_COUNT_SW_MEM_ALLOC,
.type = PERF_EVENT_TYPE_SW,
},
{
.name = "mux-pend",
.event = PERF_COUNT_SW_MUX_PEND,
.type = PERF_EVENT_TYPE_SW,
},
#endif
{
.name = "",
.event = -1,
.type = PERF_EVENT_TYPE_MAX,
}
};
void PerfList(void)
{
const PerfEvent *evt = &g_events[0];
printf("\n");
for (; evt->event != -1; evt++) {
printf("\t %-25s%30s\n", evt->name, g_eventTypeStr[evt->type]);
}
printf("\n");
}

203
apps/perf/src/perf_record.c Normal file
View File

@@ -0,0 +1,203 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <unistd.h>
#include <sys/wait.h>
#include <securec.h>
#ifdef LOSCFG_FS_VFS
#include <fcntl.h>
#include <errno.h>
#endif
#include "perf.h"
#include "option.h"
#include "perf_record.h"
#define PERF_FILE_MODE 0644
static PerfConfigAttr g_recordAttr;
static const char *g_savePath = "/storage/data/perf.data";
static inline int GetEvents(const char *argv)
{
return ParseEvents(argv, &g_recordAttr.eventsCfg, &g_recordAttr.eventsCfg.eventsNr);
}
static inline int GetTids(const char *argv)
{
return ParseIds(argv, (int *)g_recordAttr.taskIds, &g_recordAttr.taskIdsNr);
}
static inline int GetPids(const char *argv)
{
return ParseIds(argv, (int *)g_recordAttr.processIds, &g_recordAttr.processIdsNr);
}
static PerfOption g_recordOpts[] = {
OPTION_CALLBACK("-e", GetEvents),
OPTION_CALLBACK("-t", GetTids),
OPTION_CALLBACK("-P", GetPids),
OPTION_STRING("-o", &g_savePath),
OPTION_UINT("-p", &g_recordAttr.eventsCfg.events[0].period),
OPTION_UINT("-s", &g_recordAttr.sampleType),
OPTION_UINT("-d", &g_recordAttr.eventsCfg.predivided),
};
static int PerfRecordAttrInit(void)
{
PerfConfigAttr attr = {
.eventsCfg = {
#ifdef LOSCFG_PERF_HW_PMU
.type = PERF_EVENT_TYPE_HW,
.events = {
[0] = {PERF_COUNT_HW_CPU_CYCLES, 0xFFFF},
},
#elif defined LOSCFG_PERF_TIMED_PMU
.type = PERF_EVENT_TYPE_TIMED,
.events = {
[0] = {PERF_COUNT_CPU_CLOCK, 100},
},
#elif defined LOSCFG_PERF_SW_PMU
.type = PERF_EVENT_TYPE_SW,
.events = {
[0] = {PERF_COUNT_SW_TASK_SWITCH, 1},
},
#endif
.eventsNr = 1, /* 1 event */
.predivided = 0,
},
.taskIds = {0},
.taskIdsNr = 0,
.processIds = {0},
.processIdsNr = 0,
.needSample = 1,
.sampleType = PERF_RECORD_IP | PERF_RECORD_CALLCHAIN,
};
return memcpy_s(&g_recordAttr, sizeof(PerfConfigAttr), &attr, sizeof(PerfConfigAttr)) != EOK ? -1 : 0;
}
ssize_t PerfWriteFile(const char *filePath, const char *buf, ssize_t bufSize)
{
#ifdef LOSCFG_FS_VFS
int fd = -1;
ssize_t totalToWrite = bufSize;
ssize_t totalWrite = 0;
if (filePath == NULL || buf == NULL || bufSize == 0) {
return -1;
}
fd = open(filePath, O_CREAT | O_RDWR | O_TRUNC, PERF_FILE_MODE);
if (fd < 0) {
printf("create file [%s] failed, fd: %d, %s!\n", filePath, fd, strerror(errno));
return -1;
}
while (totalToWrite > 0) {
ssize_t writeThisTime = write(fd, buf, totalToWrite);
if (writeThisTime < 0) {
printf("failed to write file [%s], %s!\n", filePath, strerror(errno));
(void)close(fd);
return -1;
}
buf += writeThisTime;
totalToWrite -= writeThisTime;
totalWrite += writeThisTime;
}
(void)fsync(fd);
(void)close(fd);
return (totalWrite == bufSize) ? 0 : -1;
#else
(void)filePath;
PerfPrintBuffer(buf, bufSize);
return 0;
#endif
}
void PerfRecord(int fd, int argc, char **argv)
{
int ret;
int child;
char *buf;
ssize_t len;
SubCmd cmd = {0};
if (argc < 3) { /* perf record argc is at least 3 */
return;
}
ret = PerfRecordAttrInit();
if (ret != 0) {
printf("perf record attr init failed\n");
return;
}
ret = ParseOptions(argc - 2, &argv[2], g_recordOpts, &cmd); /* parse option and cmd begin at index 2 */
if (ret != 0) {
printf("parse error\n");
return;
}
ret = PerfConfig(fd, &g_recordAttr);
if (ret != 0) {
printf("perf config failed\n");
return;
}
PerfStart(fd, 0);
child = fork();
if (child < 0) {
printf("fork error\n");
PerfStop(fd);
return;
} else if (child == 0) {
(void)execve(cmd.path, cmd.params, NULL);
exit(0);
}
waitpid(child, 0, 0);
PerfStop(fd);
buf = (char *)malloc(LOSCFG_PERF_BUFFER_SIZE);
if (buf == NULL) {
printf("no memory for read perf 0x%x\n", LOSCFG_PERF_BUFFER_SIZE);
return;
}
len = PerfRead(fd, buf, LOSCFG_PERF_BUFFER_SIZE);
ret = PerfWriteFile(g_savePath, buf, len);
if (ret == 0) {
printf("save perf data success at %s\n", g_savePath);
} else {
printf("save perf data failed at %s\n", g_savePath);
}
free(buf);
}

149
apps/perf/src/perf_stat.c Normal file
View File

@@ -0,0 +1,149 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <unistd.h>
#include <securec.h>
#include <sys/wait.h>
#include "perf.h"
#include "option.h"
#include "perf_stat.h"
static PerfConfigAttr g_statAttr;
static inline int GetEvents(const char *argv)
{
return ParseEvents(argv, &g_statAttr.eventsCfg, &g_statAttr.eventsCfg.eventsNr);
}
static inline int GetTids(const char *argv)
{
return ParseIds(argv, (int *)g_statAttr.taskIds, &g_statAttr.taskIdsNr);
}
static inline int GetPids(const char *argv)
{
return ParseIds(argv, (int *)g_statAttr.processIds, &g_statAttr.processIdsNr);
}
static PerfOption g_statOpts[] = {
OPTION_CALLBACK("-e", GetEvents),
OPTION_CALLBACK("-t", GetTids),
OPTION_CALLBACK("-P", GetPids),
OPTION_UINT("-p", &g_statAttr.eventsCfg.events[0].period),
OPTION_UINT("-s", &g_statAttr.sampleType),
OPTION_UINT("-d", &g_statAttr.eventsCfg.predivided),
};
static int PerfStatAttrInit(void)
{
PerfConfigAttr attr = {
.eventsCfg = {
#ifdef LOSCFG_PERF_HW_PMU
.type = PERF_EVENT_TYPE_HW,
.events = {
[0] = {PERF_COUNT_HW_CPU_CYCLES, 0xFFFF},
[1] = {PERF_COUNT_HW_INSTRUCTIONS, 0xFFFFFF00},
[2] = {PERF_COUNT_HW_ICACHE_REFERENCES, 0xFFFF},
[3] = {PERF_COUNT_HW_DCACHE_REFERENCES, 0xFFFF},
},
.eventsNr = 4, /* 4 events */
#elif defined LOSCFG_PERF_TIMED_PMU
.type = PERF_EVENT_TYPE_TIMED,
.events = {
[0] = {PERF_COUNT_CPU_CLOCK, 100},
},
.eventsNr = 1, /* 1 event */
#elif defined LOSCFG_PERF_SW_PMU
.type = PERF_EVENT_TYPE_SW,
.events = {
[0] = {PERF_COUNT_SW_TASK_SWITCH, 1},
[1] = {PERF_COUNT_SW_IRQ_RESPONSE, 1},
[2] = {PERF_COUNT_SW_MEM_ALLOC, 1},
[3] = {PERF_COUNT_SW_MUX_PEND, 1},
},
.eventsNr = 4, /* 4 events */
#endif
.predivided = 0,
},
.taskIds = {0},
.taskIdsNr = 0,
.processIds = {0},
.processIdsNr = 0,
.needSample = 0,
.sampleType = 0,
};
return memcpy_s(&g_statAttr, sizeof(PerfConfigAttr), &attr, sizeof(PerfConfigAttr)) != EOK ? -1 : 0;
}
void PerfStat(int fd, int argc, char **argv)
{
int ret;
int child;
SubCmd cmd = {0};
if (argc < 3) { /* perf stat argc is at least 3 */
return;
}
ret = PerfStatAttrInit();
if (ret != 0) {
printf("perf stat attr init failed\n");
return;
}
ret = ParseOptions(argc - 2, &argv[2], g_statOpts, &cmd); /* parse option and cmd begin at index 2 */
if (ret != 0) {
printf("parse error\n");
return;
}
ret = PerfConfig(fd, &g_statAttr);
if (ret != 0) {
printf("perf config failed\n");
return;
}
PerfStart(fd, 0);
child = fork();
if (child < 0) {
printf("fork error\n");
goto EXIT;
} else if (child == 0) {
(void)execve(cmd.path, cmd.params, NULL);
exit(0);
}
(void)waitpid(child, 0, 0);
EXIT:
PerfStop(fd);
}

44
apps/shell/BUILD.gn Normal file
View File

@@ -0,0 +1,44 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
executable("shell") {
sources = [
"builtin/cd.c",
"src/main.c",
"src/shcmd.c",
"src/shcmdparse.c",
"src/shmsg.c",
]
deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ]
include_dirs = [ "include" ]
}

51
apps/shell/Makefile Executable file → Normal file
View File

@@ -27,52 +27,19 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SHELL_DIR := $(dir $(shell pwd))/shell/
include $(APPSTOPDIR)/config.mk
ifeq ($(APPSTOPDIR), )
APPSTOPDIR := $(shell pwd)/../
LITEOSTOPDIR = $(APPSTOPDIR)/../
endif
include $(SHELL_DIR)/../config.mk
APPS_OUT := $(OUT)/bin
APP_NAME := $(notdir $(shell pwd))
SECUREC_INCLUDE := $(LITEOSTHIRDPARTY)/bounds_checking_function/include
SECUREC_DIR := $(LITEOSTHIRDPARTY)/bounds_checking_function
LOCAL_SRCS = $(wildcard src/main.c)\
$(wildcard src/shcmd.c)\
$(wildcard src/shmsg.c)\
$(wildcard src/shcmdparse.c)\
$(wildcard builtin/cd.c)
LOCAL_SRCS += $(wildcard $(LITEOSTHIRDPARTY)/bounds_checking_function/src/*.c)
LOCAL_OBJ := $(LOCAL_SRCS:.c=.o)
LOCAL_SRCS = $(wildcard src/*.c builtin/*.c)
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/*.c)
LOCAL_INCLUDE := \
-I $(SHELL_DIR)/include/ \
-I $(SECUREC_INCLUDE)\
-I include \
-I $(SECUREC_DIR)/include
LOCAL_FLAGS += $(CFLAGS)
LOCAL_FLAGS += $(LOCAL_INCLUDE)
LDPATH := -L$(SHELL_DIR)/
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses $(LLVM_SYSROOT)
LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT)
endif
SHELLNAME := shell
all: $(SHELLNAME)
$(LOCAL_OBJ): %.o : %.c
$(HIDE) $(CC) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@
$(SHELLNAME): $(LOCAL_OBJ)
$(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(SHELLNAME) $^ $(LDCFLAGS)
$(HIDE) mkdir -p $(APPS_OUT)
$(HIDE) $(MV) $(SHELLNAME) $(APPS_OUT)
$(HIDE) $(RM) $(LOCAL_OBJ)
clean:
$(HIDE) $(RM) $(LOCAL_OBJ)
$(HIDE) $(RM) $(SHELLNAME)
.PHONY: all $(SHELLNAME) clean
include $(APP)

17
apps/shell/builtin/cd.c Executable file → Normal file
View File

@@ -29,19 +29,12 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "unistd.h"
#include "shcmd.h"
#include "sherr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
int Chdir(const char *tgtDir)
{
@@ -53,17 +46,9 @@ int Chdir(const char *tgtDir)
ret = chdir(tgtDir);
if (ret == 0) {
ret = OsShellSetWorkingDirtectory(tgtDir, strlen(tgtDir) + 1); /* 1: the length of '\0' */
if (ret != SH_NOK) {
return ret;
}
ret = OsShellSetWorkingDirectory(tgtDir, strlen(tgtDir) + 1); /* 1: the length of '\0' */
}
return ret;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

4
apps/shell/include/shcmd.h Executable file → Normal file
View File

@@ -53,7 +53,7 @@ typedef struct {
} CmdKeyLink;
#define NEED_NEW_LINE(timesPrint, lineCap) ((timesPrint) % (lineCap) == 0)
#define SCREEN_IS_FULL(timesPrint, lineCap) ((timesPrint) >= ((lineCap) * DEFAULT_SCREEN_HEIGNT))
#define SCREEN_IS_FULL(timesPrint, lineCap) ((timesPrint) >= ((lineCap) * DEFAULT_SCREEN_HEIGHT))
extern unsigned int OsCmdExec(CmdParsed *cmdParsed, char *cmdStr);
extern unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size);
@@ -62,7 +62,7 @@ extern void OsShellCmdPush(const char *string, CmdKeyLink *cmdKeyLink);
extern void OsShellHistoryShow(unsigned int value, ShellCB *shellCB);
extern unsigned int OsShellKeyInit(ShellCB *shellCB);
extern void OsShellKeyDeInit(CmdKeyLink *cmdKeyLink);
extern int OsShellSetWorkingDirtectory(const char *dir, size_t len);
extern int OsShellSetWorkingDirectory(const char *dir, size_t len);
#ifdef __cplusplus
#if __cplusplus

3
apps/shell/include/shell.h Executable file → Normal file
View File

@@ -54,7 +54,7 @@ extern "C" {
#define CMD_HISTORY_LEN 10
#define CMD_MAX_PATH 256
#define DEFAULT_SCREEN_WIDTH 80
#define DEFAULT_SCREEN_HEIGNT 24
#define DEFAULT_SCREEN_HEIGHT 24
#define SWITCH_QUOTES_STATUS(qu) do { \
if ((qu) == TRUE) { \
@@ -67,7 +67,6 @@ extern "C" {
#define QUOTES_STATUS_CLOSE(qu) ((qu) == FALSE)
#define QUOTES_STATUS_OPEN(qu) ((qu) == TRUE)
typedef size_t bool;
typedef struct {
unsigned int consoleID;

View File

@@ -350,35 +350,14 @@ static inline void SH_ListHeadInsertList(SH_List *oldList, SH_List *newList)
* <li>None.</li>
* </ul>
*
* @param type [IN] Structure name.
* @param field [IN] Name of the field of which the offset is to be measured.
* @param type [IN] Structure name.
* @param member [IN] Name of the member of which the offset is to be measured.
*
* @retval Offset of the field to the structure address.
* @par Dependency:
* <ul><li>shell_list.h: the header file that contains the API declaration.</li></ul>
* @see
*/
#define OFFSET_OF_FIELD(type, field) ((uintptr_t)&((type *)0)->field)
/**
* @ingroup shell_list
* @brief Obtain the pointer to a doubly linked list in a structure.
*
* @par Description:
* This API is used to obtain the pointer to a doubly linked list in a structure.
* @attention
* <ul>
* <li>None.</li>
* </ul>
*
* @param type [IN] Structure name.
* @param member [IN] Member name of the doubly linked list in the structure.
*
* @retval Pointer to the doubly linked list in the structure.
* @par Dependency:
* <ul><li>shell_list.h: the header file that contains the API declaration.</li></ul>
* @see
*/
#define LOS_OFF_SET_OF(type, member) ((uintptr_t)&((type *)0)->member)
/**

View File

@@ -32,9 +32,7 @@
#ifndef _SHELL_PRI_H
#define _SHELL_PRI_H
#include "sys/types.h"
#include "bits/alltypes.h"
#include "shcmd.h"
#include "shell.h"
#ifdef __cplusplus
#if __cplusplus
@@ -42,7 +40,7 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern void *ShellEntry(void *argv);
extern void ShellEntry(ShellCB *shellCB);
extern void *ShellTask(void *argv);
#ifdef __cplusplus

View File

@@ -32,9 +32,6 @@
#ifndef _SHERR_H
#define _SHERR_H
#include "sys/types.h"
#include "bits/alltypes.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {

14
apps/shell/include/shmsg.h Executable file → Normal file
View File

@@ -32,6 +32,7 @@
#ifndef _SHMSG_H
#define _SHMSG_H
#include "shell_list.h"
#include "shell.h"
#ifdef __cplusplus
@@ -43,8 +44,13 @@ extern "C" {
#define SHELL_ENTRY_STACKSIZE 0x1000
#define SHELL_TASK_STACKSIZE 0x3000
#define SHELL_EXEC_COMMAND "exec "
#define SHELL_EXEC_COMMAND_BYTES 5
#define SHELL_EXEC_COMMAND "exec"
#define SHELL_EXEC_COMMAND_BYTES 4
#define CMD_EXEC_COMMAND SHELL_EXEC_COMMAND" "
#define CMD_EXEC_COMMAND_BYTES (SHELL_EXEC_COMMAND_BYTES + 1)
#define CMD_EXIT_COMMAND "exit"
#define CMD_EXIT_COMMAND_BYTES 4
#define CMD_EXIT_CODE_BASE_DEC 10
#define CONSOLE_IOC_MAGIC 'c'
#define CONSOLE_CONTROL_REG_USERTASK _IO(CONSOLE_IOC_MAGIC, 7)
@@ -54,9 +60,9 @@ extern "C" {
#define COLOR_L_RED "\e[1;31m"
#define SHELL_PROMPT COLOR_L_RED"OHOS # "COLOR_NONE
typedef void (*OutputFunc)(const char *fmt, ...);
typedef void (* OutputFunc)(const char *fmt, ...);
extern int ShellTaskInit(ShellCB *shellCB);
extern int ShellEntryInit(ShellCB *shellCB);
extern void ChildExec(const char *cmdName, char *const paramArray[], bool foreground);
extern void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB);
extern int ShellNotify(ShellCB *shellCB);

6
apps/shell/include/show.h Executable file → Normal file
View File

@@ -42,10 +42,10 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern char *OsShellGetWorkingDirtectory();
extern unsigned int OsShellInit();
extern char *OsShellGetWorkingDirectory(void);
extern unsigned int OsShellInit(void);
extern int OsShellDeinit(ShellCB *shellCB);
extern ShellCB *OsGetShellCb();
extern ShellCB *OsGetShellCb(void);
#ifdef __cplusplus
#if __cplusplus

98
apps/shell/src/main.c Executable file → Normal file
View File

@@ -29,27 +29,27 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define _GNU_SOURCE
#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/syscall.h>
#include "show.h"
#include "shmsg.h"
#include "shcmd.h"
#include "shell_pri.h"
#include "semaphore.h"
#include "securec.h"
#include "unistd.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
ShellCB *g_shellCB = NULL;
ShellCB *OsGetShellCb()
ShellCB *OsGetShellCb(void)
{
return g_shellCB;
}
void ShellDeinit(ShellCB *shellCB)
static void ShellDeinit(ShellCB *shellCB)
{
(void)pthread_mutex_destroy(&shellCB->historyMutex);
(void)pthread_mutex_destroy(&shellCB->keyMutex);
@@ -65,44 +65,86 @@ static int OsShellCreateTask(ShellCB *shellCB)
ret = sched_getparam(getpid(), &param);
if (ret != SH_OK) {
goto OUT;
return ret;
}
param.sched_priority = SHELL_PROCESS_PRIORITY_INIT;
ret = sched_setparam(getpid(), &param);
if (ret != SH_OK) {
goto OUT;
return ret;
}
ret = ShellTaskInit(shellCB);
if (ret != SH_OK) {
goto OUT;
return ret;
}
ret = ShellEntryInit(shellCB);
if (ret != SH_OK) {
goto OUT;
shellCB->shellEntryHandle = pthread_self();
return 0;
}
static int DoShellExec(char **argv)
{
int i, j;
int len = 0;
int ret = SH_NOK;
char *cmdLine = NULL;
if (strncmp(argv[0], SHELL_EXEC_COMMAND, SHELL_EXEC_COMMAND_BYTES) == 0) {
ChildExec(argv[1], argv + 1, FALSE);
}
for (i = 0; argv[i]; i++) {
len += strlen(argv[i]);
}
len += i + 1;
cmdLine = (char *)malloc(len);
if (!cmdLine) {
return ret;
}
errno_t ret1 = memset_s(cmdLine, len, 0, len);
if (ret1 != EOK) {
free(cmdLine);
return ret1;
}
(void)pthread_join(shellCB->shellTaskHandle, NULL);
(void)pthread_join(shellCB->shellEntryHandle, NULL);
for (j = 0; j < i; j++) {
(void)strcat_s(cmdLine, len, argv[j]);
(void)strcat_s(cmdLine, len, " ");
}
OUT:
ShellDeinit(shellCB);
cmdLine[len - 2] = '\0'; /* 2, (len - 2) is the end of cmdline buf */
ret = syscall(__NR_shellexec, argv[0], cmdLine);
free(cmdLine);
return ret;
}
int main()
static void ShellSigChildHook(int sig)
{
(void)sig;
while (waitpid(-1, NULL, WNOHANG) > 0) {
continue;
}
}
int main(int argc, char **argv)
{
int ret = SH_NOK;
ShellCB *shellCB = NULL;
(void)signal(SIGCHLD, ShellSigChildHook);
if (argc > 1) {
ret = DoShellExec(argv + 1);
return ret;
}
setbuf(stdout, NULL);
shellCB = (ShellCB *)malloc(sizeof(ShellCB));
if (shellCB == NULL) {
goto ERR_OUT1;
return SH_NOK;
}
ret = memset_s(shellCB, sizeof(ShellCB), 0, sizeof(ShellCB));
if (ret != SH_OK) {
@@ -128,7 +170,14 @@ int main()
sem_init(&shellCB->shellSem, 0, 0);
g_shellCB = shellCB;
return OsShellCreateTask(shellCB);
ret = OsShellCreateTask(shellCB);
if (ret != SH_OK) {
ShellDeinit(shellCB);
g_shellCB = NULL;
return ret;
}
ShellEntry(shellCB);
ERR_OUT3:
(void)pthread_mutex_destroy(&shellCB->historyMutex);
@@ -139,8 +188,3 @@ ERR_OUT1:
return ret;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

47
apps/shell/src/shcmd.c Executable file → Normal file
View File

@@ -36,12 +36,6 @@
#include "dirent.h"
#include "securec.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define SHELL_INIT_MAGIC_FLAG 0xABABABAB
#define CTRL_C 0x03 /* 0x03: ctrl+c ASCII */
@@ -85,7 +79,7 @@ static int OsStrSeparateTabStrGet(const char **tabStr, CmdParsed *parsed, unsign
if ((strlen(shiftStr) == 0) || (tempStr[strlen(tempStr) - 1] != shiftStr[strlen(shiftStr) - 1])) {
*tabStr = "";
} else {
if (OsCmdTokenSplit(shiftStr, ' ', parsed)) {
if (OsCmdParse(shiftStr, parsed)) {
free(tempStr);
return (int)SH_ERROR;
}
@@ -96,12 +90,12 @@ static int OsStrSeparateTabStrGet(const char **tabStr, CmdParsed *parsed, unsign
return SH_OK;
}
char *OsShellGetWorkingDirtectory()
char *OsShellGetWorkingDirectory(void)
{
return OsGetShellCb()->shellWorkingDirectory;
}
int OsShellSetWorkingDirtectory(const char *dir, size_t len)
int OsShellSetWorkingDirectory(const char *dir, size_t len)
{
if (dir == NULL) {
return SH_NOK;
@@ -120,7 +114,7 @@ static int OsStrSeparate(const char *tabStr, char *strPath, char *nameLooking, u
char *strEnd = NULL;
char *cutPos = NULL;
CmdParsed parsed = {0};
char *shellWorkingDirectory = OsShellGetWorkingDirtectory();
char *shellWorkingDirectory = OsShellGetWorkingDirectory();
int ret;
ret = OsStrSeparateTabStrGet(&tabStr, &parsed, tabStrLen);
@@ -201,7 +195,7 @@ static int OsSurePrintAll(unsigned int count)
char readChar = 0;
printf("\nDisplay all %u possibilities?(y/n)", count);
while (1) {
if (read(0, &readChar, 1) != 1) {
if (read(STDIN_FILENO, &readChar, 1) != 1) {
return (int)SH_ERROR;
}
if ((readChar == 'n') || (readChar == 'N') || (readChar == CTRL_C)) {
@@ -228,7 +222,7 @@ static int OsPrintMatchList(unsigned int count, const char *strPath, const char
return (int)SH_ERROR;
}
if (count > (lineCap * DEFAULT_SCREEN_HEIGNT)) {
if (count > (lineCap * DEFAULT_SCREEN_HEIGHT)) {
ret = OsSurePrintAll(count);
if (ret != 1) {
return ret;
@@ -380,10 +374,10 @@ static int OsTabMatchFile(char *cmdKey, unsigned int *len)
}
/*
* Description: Pass in the string and clear useless space ,which inlcude:
* Description: Pass in the string and clear useless space ,which include:
* 1) The overmatch space which is not be marked by Quote's area
* Squeeze the overmatch space into one space
* 2) Clear all space before first vaild charatctor
* 2) Clear all space before first valid character
* Input: cmdKey : Pass in the buff string, which is ready to be operated
* cmdOut : Pass out the buffer string ,which has already been operated
* size : cmdKey length
@@ -412,17 +406,17 @@ unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size)
/* Backup the 'output' start address */
outputBak = output;
/* Scan each charactor in 'cmdKey',and squeeze the overmuch space and ignore invaild charactor */
/* Scan each character in 'cmdKey',and squeeze the overmuch space and ignore invalid character */
for (; *cmdKey != '\0'; cmdKey++) {
/* Detected a Double Quotes, switch the matching status */
if (*(cmdKey) == '\"') {
SWITCH_QUOTES_STATUS(quotes);
}
/* Ignore the current charactor in following situation */
/* Ignore the current character in following situation */
/* 1) Quotes matching status is FALSE (which said that the space is not been marked by double quotes) */
/* 2) Current charactor is a space */
/* 3) Next charactor is a space too, or the string is been seeked to the end already(\0) */
/* 4) Invaild charactor, such as single quotes */
/* 2) Current character is a space */
/* 3) Next character is a space too, or the string is been seeked to the end already(\0) */
/* 4) Invalid character, such as single quotes */
if ((*cmdKey == ' ') && ((*(cmdKey + 1) == ' ') || (*(cmdKey + 1) == '\0')) && QUOTES_STATUS_CLOSE(quotes)) {
continue;
}
@@ -436,7 +430,7 @@ unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size)
/* Restore the 'output' start address */
output = outputBak;
len = strlen(output);
/* Clear the space which is located at the first charactor in buffer */
/* Clear the space which is located at the first character in buffer */
if (*output == ' ') {
output++;
len--;
@@ -453,20 +447,15 @@ unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size)
free(outputBak);
return SH_OK;
}
int OsTabCompletion(char *cmdKey, unsigned int *len)
{
int count;
char *cmdMainStr = cmdKey;
if ((cmdKey == NULL) || (len == NULL)) {
return (int)SH_ERROR;
}
/* cut left space */
while (*cmdMainStr == 0x20) {
cmdMainStr++;
}
count = OsTabMatchFile(cmdKey, len);
return count;
@@ -595,7 +584,6 @@ END:
unsigned int OsCmdExec(CmdParsed *cmdParsed, char *cmdStr)
{
/* TODO: complete the usrspace command */
unsigned int ret = SH_OK;
if (cmdParsed && cmdStr) {
ret = SH_NOK;
@@ -604,8 +592,3 @@ unsigned int OsCmdExec(CmdParsed *cmdParsed, char *cmdStr)
return ret;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

10
apps/shell/src/shcmdparse.c Executable file → Normal file
View File

@@ -32,11 +32,6 @@
#include "shcmd.h"
#include "sherr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/*
* Filter out double quote or single-quoted strings at both ends
@@ -157,8 +152,3 @@ unsigned int OsCmdParse(char *cmdStr, CmdParsed *cmdParsed)
return OsCmdTokenSplit(cmdStr, ' ', cmdParsed);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

208
apps/shell/src/shmsg.c Executable file → Normal file
View File

@@ -29,6 +29,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define _GNU_SOURCE
#include "stdlib.h"
#include "stdio.h"
#include "unistd.h"
@@ -42,12 +44,10 @@
#include "shell_pri.h"
#include "shcmd.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define CHAR_CTRL_C '\x03'
#define CHAR_CTRL_DEL '\x7F'
#define VISIABLE_CHAR(ch) ((ch) > 0x1F && (ch) < 0x7F)
char *GetCmdline(ShellCB *shellCB)
{
@@ -133,7 +133,7 @@ int ShellNotify(ShellCB *shellCB)
}
enum {
STAT_NOMAL_KEY,
STAT_NORMAL_KEY,
STAT_ESC_KEY,
STAT_MULTI_KEY
};
@@ -152,23 +152,23 @@ static int ShellCmdLineCheckUDRL(const char ch, ShellCB *shellCB)
} else if (ch == 0x41) { /* up */
if (shellCB->shellKeyType == STAT_MULTI_KEY) {
OsShellHistoryShow(CMD_KEY_UP, shellCB);
shellCB->shellKeyType = STAT_NOMAL_KEY;
shellCB->shellKeyType = STAT_NORMAL_KEY;
return ret;
}
} else if (ch == 0x42) { /* down */
if (shellCB->shellKeyType == STAT_MULTI_KEY) {
shellCB->shellKeyType = STAT_NOMAL_KEY;
shellCB->shellKeyType = STAT_NORMAL_KEY;
OsShellHistoryShow(CMD_KEY_DOWN, shellCB);
return ret;
}
} else if (ch == 0x43) { /* right */
if (shellCB->shellKeyType == STAT_MULTI_KEY) {
shellCB->shellKeyType = STAT_NOMAL_KEY;
shellCB->shellKeyType = STAT_NORMAL_KEY;
return ret;
}
} else if (ch == 0x44) { /* left */
if (shellCB->shellKeyType == STAT_MULTI_KEY) {
shellCB->shellKeyType = STAT_NOMAL_KEY;
shellCB->shellKeyType = STAT_NORMAL_KEY;
return ret;
}
}
@@ -205,7 +205,21 @@ void ParseEnterKey(OutputFunc outputFunc, ShellCB *shellCB)
shellCB->shellBuf[shellCB->shellBufOffset] = '\0';
}
NOTIFY:
outputFunc("\n");
shellCB->shellBufOffset = 0;
ShellTaskNotify(shellCB);
}
void ParseCancelKey(OutputFunc outputFunc, ShellCB *shellCB)
{
if ((shellCB == NULL) || (outputFunc == NULL)) {
return;
}
if (shellCB->shellBufOffset <= (SHOW_MAX_LEN - 1)) {
shellCB->shellBuf[0] = CHAR_CTRL_C;
shellCB->shellBuf[1] = '\0';
}
shellCB->shellBufOffset = 0;
ShellTaskNotify(shellCB);
}
@@ -241,7 +255,7 @@ void ParseTabKey(OutputFunc outputFunc, ShellCB *shellCB)
void ParseNormalChar(char ch, OutputFunc outputFunc, ShellCB *shellCB)
{
if ((shellCB == NULL) || (outputFunc == NULL)) {
if ((shellCB == NULL) || (outputFunc == NULL) || !VISIABLE_CHAR(ch)) {
return;
}
@@ -251,7 +265,7 @@ void ParseNormalChar(char ch, OutputFunc outputFunc, ShellCB *shellCB)
outputFunc("%c", ch);
}
shellCB->shellKeyType = STAT_NOMAL_KEY;
shellCB->shellKeyType = STAT_NORMAL_KEY;
}
void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB)
@@ -259,7 +273,7 @@ void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB)
const char ch = c;
int ret;
if ((shellCB->shellBufOffset == 0) && (ch != '\n') && (ch != '\0')) {
if ((shellCB->shellBufOffset == 0) && (ch != '\n') && (ch != CHAR_CTRL_C) && (ch != '\0')) {
(void)memset_s(shellCB->shellBuf, SHOW_MAX_LEN, 0, SHOW_MAX_LEN);
}
@@ -268,8 +282,11 @@ void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB)
case '\n': /* enter */
ParseEnterKey(outputFunc, shellCB);
break;
case CHAR_CTRL_C: /* ctrl + c */
ParseCancelKey(outputFunc, shellCB);
break;
case '\b': /* backspace */
case 0x7F: /* delete(0x7F) */
case CHAR_CTRL_DEL: /* delete(0x7F) */
ParseDeleteKey(outputFunc, shellCB);
break;
case '\t': /* tab */
@@ -317,12 +334,12 @@ char *GetCmdName(const char *cmdline, unsigned int len)
/* If reach a double quotes, switch the quotes matching status */
if (*tmpStr == '\"') {
SWITCH_QUOTES_STATUS(quotes);
/* Ignore the double quote charactor itself */
/* Ignore the double quote character itself */
tmpStr++;
continue;
}
/* If detected a space which the quotes matching status is false */
/* which said has detected the first space for seperator, finish this scan operation */
/* which said has detected the first space for separator, finish this scan operation */
if ((*tmpStr == ' ') && (QUOTES_STATUS_CLOSE(quotes))) {
break;
}
@@ -334,29 +351,94 @@ char *GetCmdName(const char *cmdline, unsigned int len)
return cmdName;
}
static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len, const CmdParsed *cmdParsed)
void ChildExec(const char *cmdName, char *const paramArray[], bool foreground)
{
int ret;
pid_t gid;
ret = setpgrp();
if (ret == -1) {
exit(1);
}
gid = getpgrp();
if (gid < 0) {
printf("get group id failed, pgrpid %d, errno %d\n", gid, errno);
exit(1);
}
if (!foreground) {
ret = tcsetpgrp(STDIN_FILENO, gid);
if (ret != 0) {
printf("tcsetpgrp failed, errno %d\n", errno);
exit(1);
}
}
ret = execve(cmdName, paramArray, NULL);
if (ret == -1) {
perror("execve");
exit(-1);
}
}
int CheckExit(const char *cmdName, const CmdParsed *cmdParsed)
{
int ret = 0;
if (strlen(cmdName) != CMD_EXIT_COMMAND_BYTES || strncmp(cmdName, CMD_EXIT_COMMAND, CMD_EXIT_COMMAND_BYTES) != 0) {
return 0;
}
if (cmdParsed->paramCnt > 1) {
printf("exit: too many arguments\n");
return -1;
}
if (cmdParsed->paramCnt == 1) {
char *p = NULL;
ret = strtol(cmdParsed->paramArray[0], &p, CMD_EXIT_CODE_BASE_DEC);
if (*p != '\0') {
printf("exit: bad number: %s\n", cmdParsed->paramArray[0]);
return -1;
}
}
exit(ret);
}
static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len, CmdParsed *cmdParsed)
{
bool foreground = FALSE;
int ret;
pid_t forkPid;
if (strncmp(cmdline, SHELL_EXEC_COMMAND, SHELL_EXEC_COMMAND_BYTES) == 0) {
if (strncmp(cmdline, CMD_EXEC_COMMAND, CMD_EXEC_COMMAND_BYTES) == 0) {
if ((cmdParsed->paramCnt > 1) && (strcmp(cmdParsed->paramArray[cmdParsed->paramCnt - 1], "&") == 0)) {
free(cmdParsed->paramArray[cmdParsed->paramCnt - 1]);
cmdParsed->paramArray[cmdParsed->paramCnt - 1] = NULL;
cmdParsed->paramCnt--;
foreground = TRUE;
}
forkPid = fork();
if (forkPid < 0) {
printf("Faild to fork from shell\n");
printf("Failed to fork from shell\n");
return;
} else if (forkPid == 0) {
ret = setpgrp();
if (ret == -1) {
exit(1);
ChildExec(cmdParsed->paramArray[0], cmdParsed->paramArray, foreground);
} else {
if (!foreground) {
(void)waitpid(forkPid, 0, 0);
}
ret = execve((const char *)cmdParsed->paramArray[0], (char * const *)cmdParsed->paramArray, NULL);
if (ret == -1) {
perror("execve");
exit(-1);
ret = tcsetpgrp(STDIN_FILENO, getpid());
if (ret != 0) {
printf("tcsetpgrp failed, errno %d\n", errno);
}
}
} else {
if (CheckExit(cmdName, cmdParsed) < 0) {
return;
}
(void)syscall(__NR_shellexec, cmdName, cmdline);
}
}
@@ -391,7 +473,7 @@ static void ParseAndExecCmdline(CmdParsed *cmdParsed, const char *cmdline, unsig
DoCmdExec(cmdName, cmdlineOrigin, len, cmdParsed);
if (getcwd(shellWorkingDirectory, PATH_MAX) != NULL) {
(void)OsShellSetWorkingDirtectory(shellWorkingDirectory, (PATH_MAX + 1));
(void)OsShellSetWorkingDirectory(shellWorkingDirectory, (PATH_MAX + 1));
}
OUT:
@@ -411,7 +493,7 @@ unsigned int PreHandleCmdline(const char *input, char **output, unsigned int *ou
unsigned int removeLen = strlen("./"); /* "./" needs to be removed if it exists */
unsigned int ret;
char *newCmd = NULL;
char *execCmd = SHELL_EXEC_COMMAND;
char *execCmd = CMD_EXEC_COMMAND;
const char *cmdBuf = input;
unsigned int cmdBufLen = strlen(cmdBuf);
char *shiftStr = (char *)malloc(cmdBufLen + 1);
@@ -433,7 +515,7 @@ unsigned int PreHandleCmdline(const char *input, char **output, unsigned int *ou
*output = shiftStr;
*outputlen = shiftLen;
/* Check and parse "./", located at the first two charaters of the cmd */
/* Check and parse "./", located at the first two characters of the cmd */
if ((shiftLen > removeLen) && (shiftStr[0] == '.') && (shiftStr[1] == '/')) {
execLen = strlen(execCmd);
newLen = execLen + shiftLen - removeLen; /* i.e., newLen - execLen == shiftLen - removeLen */
@@ -497,24 +579,18 @@ static void ExecCmdline(const char *cmdline)
free(output);
}
void RecycleZombieChild(void)
{
while (waitpid(-1, NULL, WNOHANG) > 0) {
continue;
}
}
static void ShellCmdProcess(ShellCB *shellCB)
{
char *buf = NULL;
while (1) {
/* recycle zombine child process */
RecycleZombieChild();
buf = GetCmdline(shellCB);
char *buf = GetCmdline(shellCB);
if (buf == NULL) {
break;
}
if (buf[0] == CHAR_CTRL_C) {
printf("^C");
buf[0] = '\n';
}
printf("\n");
ExecCmdline(buf);
ShellSaveHistoryCmd(buf, shellCB);
shellCB->cmdMaskKeyLink = shellCB->cmdHistoryKeyLink;
@@ -577,28 +653,22 @@ int ShellTaskInit(ShellCB *shellCB)
static int ShellKernelReg(unsigned int shellHandle)
{
return ioctl(0, CONSOLE_CONTROL_REG_USERTASK, shellHandle);
return ioctl(STDIN_FILENO, CONSOLE_CONTROL_REG_USERTASK, shellHandle);
}
void *ShellEntry(void *argv)
void ShellEntry(ShellCB *shellCB)
{
char ch;
int ret;
int n;
pid_t tid = syscall(__NR_gettid);
ShellCB *shellCB = (ShellCB *)argv;
if (shellCB == NULL) {
return NULL;
return;
}
(void)memset_s(shellCB->shellBuf, SHOW_MAX_LEN, 0, SHOW_MAX_LEN);
ret = prctl(PR_SET_NAME, "ShellEntry");
if (ret != SH_OK) {
return NULL;
}
ret = ShellKernelReg((int)tid);
if (ret != 0) {
printf("another shell is already running!\n");
@@ -611,37 +681,5 @@ void *ShellEntry(void *argv)
ShellCmdLineParse(ch, (OutputFunc)printf, shellCB);
}
}
return NULL;
return;
}
int ShellEntryInit(ShellCB *shellCB)
{
int ret;
size_t stackSize = SHELL_ENTRY_STACKSIZE;
void *arg = NULL;
pthread_attr_t attr;
if (shellCB == NULL) {
return SH_NOK;
}
ret = pthread_attr_init(&attr);
if (ret != SH_OK) {
return SH_NOK;
}
pthread_attr_setstacksize(&attr, stackSize);
arg = (void *)shellCB;
ret = pthread_create(&shellCB->shellEntryHandle, &attr, &ShellEntry, arg);
if (ret != SH_OK) {
return SH_NOK;
}
return ret;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

21
apps/module.mk → apps/tftp/BUILD.gn Executable file → Normal file
View File

@@ -27,18 +27,15 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
APP_SUBDIRS :=
import("//kernel/liteos_a/liteos.gni")
##compile modules config##
executable("tftp") {
sources = [
"src/main.c",
"src/tftpc.c",
]
ifeq ($(LOSCFG_SHELL), y)
APP_SUBDIRS += shell
endif
deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ]
ifeq ($(LOSCFG_USER_INIT_DEBUG), y)
APP_SUBDIRS += init
endif
ifeq ($(LOSCFG_NET_LWIP_SACK_TFTP), y)
APP_SUBDIRS += tftp
endif
include_dirs = [ "include" ]
}

View File

@@ -27,51 +27,19 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ROOT_DIR := $(dir $(shell pwd))/tftp/
include $(APPSTOPDIR)/config.mk
ifeq ($(APPSTOPDIR), )
APPSTOPDIR := $(shell pwd)/../
LITEOSTOPDIR = $(APPSTOPDIR)/../
endif
include $(ROOT_DIR)/../config.mk
APPS_OUT := $(OUT)/bin
APP_NAME := $(notdir $(shell pwd))
SECUREC_DIR := $(LITEOSTHIRDPARTY)/bounds_checking_function
LOCAL_SRCS = $(wildcard src/*.c)
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/strncpy_s.c)
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/memcpy_s.c)
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/memset_s.c)
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/strncat_s.c)
LOCAL_OBJ := $(LOCAL_SRCS:.c=.o)
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/*.c)
LOCAL_INCLUDE := \
-I $(ROOT_DIR)/include/ \
-I $(SECUREC_DIR)/include/\
-I include \
-I $(SECUREC_DIR)/include
LOCAL_FLAGS += $(CFLAGS)
LOCAL_FLAGS += $(LOCAL_INCLUDE)
LDPATH := -L$(ROOT_DIR)/
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses $(LLVM_SYSROOT)
LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT)
endif
TARGETNAME := tftp
all: $(TARGETNAME)
$(LOCAL_OBJ): %.o : %.c
$(HIDE) $(CC) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@
$(TARGETNAME): $(LOCAL_OBJ)
$(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(TARGETNAME) $^ $(LDCFLAGS)
$(HIDE) mkdir -p $(APPS_OUT)
$(HIDE) $(MV) $(TARGETNAME) $(APPS_OUT)
$(HIDE) $(RM) $(LOCAL_OBJ)
clean:
$(HIDE) $(RM) $(LOCAL_OBJ)
$(HIDE) $(RM) $(TARGETNAME)
.PHONY: all $(TARGETNAME) clean
include $(APP)

View File

@@ -42,7 +42,7 @@ extern "C" {
#define TFTP_NULL_UINT32 ((u32_t)0xffffffffUL)
#define TFTP_NULL_INT32 -1
#define TFTP_NULL_INT32 (-1)
/** @cond liteos
* @defgroup TFTP_Interfaces
@@ -114,7 +114,7 @@ typedef enum tagTFTPC_OpCode {
TFTPC_OP_RRQ = 1, /* read request */
TFTPC_OP_WRQ, /* write request */
TFTPC_OP_DATA, /* data packet */
TFTPC_OP_ACK, /* acknowledgement */
TFTPC_OP_ACK, /* acknowledgment */
TFTPC_OP_ERROR, /* error code */
TFTPC_OP_OPT /* option code */
} TFTPC_OPCODE_E;

View File

@@ -50,11 +50,11 @@ static char *TftpError[] = {
"Error while sending data to the peer\n",
"Requested file is not found\n",
"This is the error sent by the server when hostname cannot be resolved\n",
"Input paramters passed to TFTP interfaces are invalid\n",
"Input parameters passed to TFTP interfaces are invalid\n",
"Error detected in TFTP packet or the error received from the TFTP server\n",
"Error during packet synhronization while sending or unexpected packet is received\n",
"File size limit crossed, Max block can be 0xFFFF, each block containing 512 bytes\n",
"File name lenght greater than 256\n",
"File name length greater than 256\n",
"Hostname IP is not valid\n",
"TFTP server returned file access error\n",
"TFTP server returned error signifying that the DISK is full to write\n",
@@ -66,11 +66,11 @@ static char *TftpError[] = {
"File create error\n",
"File write error\n",
"Max time expired while waiting for file to be recived\n",
"Error when the received packet is less than 4bytes(error lenght) or greater than 512bytes\n",
"Error when the received packet is less than 4bytes(error length) or greater than 512bytes\n",
"Returned by TFTP server for protocol user error\n",
"The destination file path length greater than 256\n",
"Returned by TFTP server for undefined transfer ID\n",
"IOCTL fucntion failed at TFTP client while setting the socket to non-block\n",
"IOCTL function failed at TFTP client while setting the socket to non-block\n",
};
#ifndef ARRAY_SIZE

View File

@@ -189,7 +189,7 @@ u32_t lwip_tftp_recv_from_server(s32_t iSockNum, u32_t *pulSize, TFTPC_PACKET_S
if (iRet == -1) {
return TFTPC_SELECT_ERROR;
} else if (iRet == 0) {
return TFTPC_TIMEOUT_ERROR; /* Select timeout occured */
return TFTPC_TIMEOUT_ERROR; /* Select timeout occurred */
}
if (!FD_ISSET(iSockNum, &stReadfds)) {
@@ -218,7 +218,7 @@ u32_t lwip_tftp_recv_from_server(s32_t iSockNum, u32_t *pulSize, TFTPC_PACKET_S
usOpcode = ntohs(pstRecvBuf->usOpcode);
/* if this packet is ERROR packet */
if (usOpcode == TFTPC_OP_ERROR) {
ulError = ntohs (pstRecvBuf->u.stTFTP_Err.usErrNum);
ulError = ntohs(pstRecvBuf->u.stTFTP_Err.usErrNum);
/*If the error is according to RFC,then convert to lwip error codes.
Constant values are used in the cases as these error codes are as per
@@ -268,7 +268,7 @@ u32_t lwip_tftp_recv_from_server(s32_t iSockNum, u32_t *pulSize, TFTPC_PACKET_S
*pulSize = (u32_t)iRet;
/* If received packet is first block of data(for get operation) or if
received packet is acknowledgement for write request (put operation)
received packet is acknowledgment for write request (put operation)
store the received port number */
if (((usOpcode == TFTPC_OP_DATA) &&
(ntohs(pstRecvBuf->u.stTFTP_Data.usBlknum) == 1)) ||
@@ -500,7 +500,7 @@ static void lwip_tftp_send_error(s32_t iSockNum, u32_t ulError, const char *szEr
}
}
/* INTEFACE to get a file using filename
/* INTERFACE to get a file using filename
ulHostAddr - IP address of Host
szSrcFileName - Source file
szDestDirPath - Destination file path
@@ -687,7 +687,7 @@ u32_t lwip_tftp_get_file_by_filename(u32_t ulHostAddr,
ulErrCode = lwip_tftp_recv_from_server(iSockNum, &ulRecvSize, pstRecvBuf,
&ulIgnorePkt, &stServerAddr, pstSendBuf);
/* If select timeout occured */
/* If select timeout occurred */
if (ulErrCode == TFTPC_TIMEOUT_ERROR) {
ulTotalTime++;
if (ulTotalTime < TFTPC_MAX_SEND_REQ_ATTEMPTS) {
@@ -727,7 +727,7 @@ u32_t lwip_tftp_get_file_by_filename(u32_t ulHostAddr,
}
/* if this packet is unkonwn or incorrect packet */
if (ntohs (pstRecvBuf->usOpcode) != TFTPC_OP_DATA) {
if (ntohs(pstRecvBuf->usOpcode) != TFTPC_OP_DATA) {
/* Send error packet to server */
lwip_tftp_send_error(iSockNum,
TFTPC_PROTOCOL_PROTO_ERROR,
@@ -982,7 +982,7 @@ u32_t lwip_tftp_put_file_by_filename(u32_t ulHostAddr, u16_t usTftpServPort, u8_
return TFTPC_MEMALLOC_ERROR;
}
/* First time intialize the buffer */
/* First time initialize the buffer */
(void)memset_s((void *)pstSendBuf, sizeof(TFTPC_PACKET_S), 0, sizeof(TFTPC_PACKET_S));
/* The destination path can only be one of the following:
@@ -1221,7 +1221,7 @@ u32_t lwip_tftp_inner_put_file(s32_t iSockNum,
return TFTPC_MEMALLOC_ERROR;
}
/* First time intialize the buffer */
/* First time initialize the buffer */
(void)memset_s((void *)pstRecvBuf, sizeof(TFTPC_PACKET_S), 0, sizeof(TFTPC_PACKET_S));
/* Initialize from address to the server address at first */
@@ -1235,7 +1235,7 @@ u32_t lwip_tftp_inner_put_file(s32_t iSockNum,
ulError = lwip_tftp_recv_from_server(iSockNum, &ulPktSize,
pstRecvBuf, &ulIgnorePkt,
pstServerAddr, pstSendBuf);
/* If select timeout occured */
/* If select timeout occurred */
if (ulError == TFTPC_TIMEOUT_ERROR) {
ulTotalTime++;
if (ulTotalTime < TFTPC_MAX_SEND_REQ_ATTEMPTS) {
@@ -1419,7 +1419,7 @@ err_handler:
}
#ifdef TFTP_TO_RAWMEM
/* INTEFACE to get a file using filename
/* INTERFACE to get a file using filename
ulHostAddr - IP address of Host
szSrcFileName - Source file
szDestMemAddr - The target memory address in the client
@@ -1437,10 +1437,8 @@ u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr,
{
s32_t iSockNum = TFTP_NULL_INT32;
u32_t ulSrcStrLen;
u32_t lDestStrLen;
u32_t ulSize;
u32_t ulRecvSize = TFTP_NULL_UINT32;
s32_t iErrCode;
u32_t ulErrCode;
u16_t usReadReq;
u16_t usTempServPort;
@@ -1526,7 +1524,7 @@ u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr,
ulErrCode = lwip_tftp_recv_from_server(iSockNum, &ulRecvSize, pstRecvBuf, &ulIgnorePkt,
&stServerAddr, pstSendBuf);
/* If select timeout occured */
/* If select timeout occurred */
if (ulErrCode == TFTPC_TIMEOUT_ERROR) {
ulTotalTime++;
if (ulTotalTime < TFTPC_MAX_SEND_REQ_ATTEMPTS) {
@@ -1557,7 +1555,7 @@ u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr,
}
/* if this packet is unkonwn or incorrect packet */
if (ntohs (pstRecvBuf->usOpcode) != TFTPC_OP_DATA) {
if (ntohs(pstRecvBuf->usOpcode) != TFTPC_OP_DATA) {
/* Send error packet to server */
lwip_tftp_send_error(iSockNum,
TFTPC_PROTOCOL_PROTO_ERROR,

84
apps/toybox/BUILD.gn Normal file
View File

@@ -0,0 +1,84 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/component/lite_component.gni")
import("//kernel/liteos_a/liteos.gni")
import("$THIRDPARTY_TOYBOX_DIR/toybox.gni")
group("toybox") {
deps = [ ":build_toybox" ]
}
copy("copy_toybox_src") {
sources = TOYBOX_SRC_DIR
outputs = [ "$target_out_dir/toybox_build" ]
}
copy("copy_toybox_config") {
deps = [ ":copy_toybox_src" ]
sources = [ "liteos_a_custom.config" ]
outputs = [ "$target_out_dir/{{source_file_part}}" ]
}
build_ext_component("build_toybox") {
deps = [
":copy_toybox_config",
":copy_toybox_src",
]
deps += [ "$THIRDPARTY_MUSL_DIR:sysroot_lite" ]
exec_path = rebase_path("$target_out_dir/toybox_build")
cflags = [
"-fstack-protector-strong",
"-D_FORTIFY_SOURCE=2",
]
cflags = string_join(" ", cflags)
extra_flags = string_join(" ", target_arch_cflags)
if (ohos_build_compiler == "clang") {
extra_flags += " --target=$target_triple"
extra_flags += " --sysroot=" + rebase_path(ohos_current_sysroot)
}
command = "rm -rf .git && cp -rfp porting/liteos_a/. . && env"
command += " CC=\"$ohos_current_cc_command\""
command += " STRIP=\"$ohos_current_strip_command\""
command += " OUTNAME=toybox"
command += " CFLAGS=\"$cflags $extra_flags\""
command += " make toybox"
command += " && install -D toybox "
command += rebase_path("$root_out_dir/bin/toybox", exec_path)
command += " && install -D generated/unstripped/toybox "
command += rebase_path("$root_out_dir/unstripped/bin/toybox", exec_path)
outputs = [
"$root_out_dir/unstripped/bin/toybox",
"$root_out_dir/bin/toybox",
]
}

53
apps/toybox/Makefile Normal file
View File

@@ -0,0 +1,53 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include $(APPSTOPDIR)/config.mk
BUILD_DIR := $(OUT)/toybox_build
BUILD_LOG := $(BUILD_DIR)/build.log
CFLAGS += -Wno-error
all:
ifneq ($(wildcard $(BUILD_DIR)),)
$(HIDE)echo "not clean, rebuilding now"
else
$(HIDE)mkdir -p $(BUILD_DIR)
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/toybox/. $(BUILD_DIR)
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/toybox/porting/liteos_a/. $(BUILD_DIR)
$(HIDE)$(CP) liteos_a_custom.config $(BUILD_DIR)/../
endif
$(HIDE)unset KCONFIG_CONFIG CROSS_COMPILE && \
env CC="$(CC)" OUTNAME="$(OUT)/bin/toybox" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" STRIP="$(STRIP)" \
make -C $(BUILD_DIR) toybox -j> $(BUILD_LOG) 2>&1
clean:
$(HIDE)$(RM) $(BUILD_DIR)
.PHONY: all clean

View File

@@ -0,0 +1,186 @@
# CONFIG_BASENAME is not set
# CONFIG_CAL is not set
# CONFIG_CAT is not set
# CONFIG_CATV is not set
# CONFIG_CKSUM is not set
# CONFIG_CRC32 is not set
# CONFIG_CMP is not set
# CONFIG_COMM is not set
# CONFIG_CP_PRESERVE is not set
# CONFIG_INSTALL is not set
# CONFIG_CPIO is not set
# CONFIG_CUT is not set
# CONFIG_DF is not set
# CONFIG_DIRNAME is not set
# CONFIG_ECHO is not set
# CONFIG_ENV is not set
# CONFIG_EXPAND is not set
# CONFIG_FALSE is not set
# CONFIG_FILE is not set
# CONFIG_FIND is not set
# CONFIG_GETCONF is not set
# CONFIG_GREP is not set
# CONFIG_EGREP is not set
# CONFIG_FGREP is not set
# CONFIG_HEAD is not set
# CONFIG_ICONV is not set
# CONFIG_ID is not set
# CONFIG_GROUPS is not set
# CONFIG_LOGNAME is not set
# CONFIG_WHOAMI is not set
# CONFIG_LINK is not set
# CONFIG_LN is not set
# CONFIG_LOGGER is not set
# CONFIG_MKFIFO is not set
# CONFIG_NICE is not set
# CONFIG_NL is not set
# CONFIG_NOHUP is not set
# CONFIG_OD is not set
# CONFIG_PASTE is not set
# CONFIG_PATCH is not set
# CONFIG_PRINTF is not set
# CONFIG_IOTOP is not set
# CONFIG_PGREP is not set
# CONFIG_PKILL is not set
# CONFIG_PWD is not set
# CONFIG_RENICE is not set
# CONFIG_SED is not set
# CONFIG_SLEEP is not set
# CONFIG_SORT is not set
# CONFIG_SORT_FLOAT is not set
# CONFIG_SPLIT is not set
# CONFIG_STRINGS is not set
# CONFIG_TAIL is not set
# CONFIG_TAR is not set
# CONFIG_TEE is not set
# CONFIG_TEST is not set
# CONFIG_TIME is not set
# CONFIG_TRUE is not set
# CONFIG_TTY is not set
# CONFIG_ULIMIT is not set
# CONFIG_ARCH is not set
# CONFIG_UNIQ is not set
# CONFIG_UNLINK is not set
# CONFIG_UUDECODE is not set
# CONFIG_UUENCODE is not set
# CONFIG_WC is not set
# CONFIG_WHO is not set
# CONFIG_XARGS is not set
# CONFIG_ACPI is not set
# CONFIG_ASCII is not set
# CONFIG_BASE64 is not set
# CONFIG_BLKID is not set
# CONFIG_FSTYPE is not set
# CONFIG_BLOCKDEV is not set
# CONFIG_BUNZIP2 is not set
# CONFIG_BZCAT is not set
# CONFIG_CHROOT is not set
# CONFIG_CHRT is not set
# CONFIG_CHVT is not set
# CONFIG_CLEAR is not set
# CONFIG_COUNT is not set
# CONFIG_DEVMEM is not set
# CONFIG_DOS2UNIX is not set
# CONFIG_UNIX2DOS is not set
# CONFIG_EJECT is not set
# CONFIG_FACTOR is not set
# CONFIG_FALLOCATE is not set
# CONFIG_FLOCK is not set
# CONFIG_FMT is not set
# CONFIG_FREERAMDISK is not set
# CONFIG_FSFREEZE is not set
# CONFIG_FSYNC is not set
# CONFIG_HELP_EXTRAS is not set
# CONFIG_HEXEDIT is not set
# CONFIG_HWCLOCK is not set
# CONFIG_I2CDETECT is not set
# CONFIG_I2CDUMP is not set
# CONFIG_I2CGET is not set
# CONFIG_I2CSET is not set
# CONFIG_INOTIFYD is not set
# CONFIG_INSMOD is not set
# CONFIG_IONICE is not set
# CONFIG_IORENICE is not set
# CONFIG_LOGIN is not set
# CONFIG_LOSETUP is not set
# CONFIG_LSATTR is not set
# CONFIG_CHATTR is not set
# CONFIG_LSMOD is not set
# CONFIG_LSPCI is not set
# CONFIG_LSPCI_TEXT is not set
# CONFIG_LSUSB is not set
# CONFIG_MAKEDEVS is not set
# CONFIG_MCOOKIE is not set
# CONFIG_MIX is not set
# CONFIG_MKPASSWD is not set
# CONFIG_MKSWAP is not set
# CONFIG_MODINFO is not set
# CONFIG_MOUNTPOINT is not set
# CONFIG_NBD_CLIENT is not set
# CONFIG_UNSHARE is not set
# CONFIG_NSENTER is not set
# CONFIG_ONEIT is not set
# CONFIG_PARTPROBE is not set
# CONFIG_PIVOT_ROOT is not set
# CONFIG_PMAP is not set
# CONFIG_PRINTENV is not set
# CONFIG_PWDX is not set
# CONFIG_READAHEAD is not set
# CONFIG_READLINK is not set
# CONFIG_REALPATH is not set
# CONFIG_RESET is not set
# CONFIG_REV is not set
# CONFIG_RMMOD is not set
# CONFIG_SETFATTR is not set
# CONFIG_SETSID is not set
# CONFIG_SHRED is not set
# CONFIG_STAT is not set
# CONFIG_SWAPOFF is not set
# CONFIG_SWAPON is not set
# CONFIG_SWITCH_ROOT is not set
# CONFIG_SYSCTL is not set
# CONFIG_TAC is not set
# CONFIG_NPROC is not set
# CONFIG_TASKSET is not set
# CONFIG_TIMEOUT is not set
# CONFIG_TRUNCATE is not set
# CONFIG_UPTIME is not set
# CONFIG_USLEEP is not set
# CONFIG_UUIDGEN is not set
# CONFIG_VCONFIG is not set
# CONFIG_VMSTAT is not set
# CONFIG_W is not set
# CONFIG_WATCH is not set
# CONFIG_WHICH is not set
# CONFIG_XXD is not set
# CONFIG_YES is not set
# CONFIG_FTPGET is not set
# CONFIG_FTPPUT is not set
# CONFIG_MICROCOM is not set
# CONFIG_NETCAT is not set
# CONFIG_NETCAT_LISTEN is not set
# CONFIG_NETSTAT is not set
# CONFIG_RFKILL is not set
# CONFIG_SNTP is not set
# CONFIG_TUNCTL is not set
# CONFIG_DMESG is not set
# CONFIG_GUNZIP is not set
# CONFIG_ZCAT is not set
# CONFIG_HOSTNAME is not set
# CONFIG_DNSDOMAINNAME is not set
# CONFIG_KILLALL is not set
# CONFIG_MD5SUM is not set
# CONFIG_SHA1SUM is not set
# CONFIG_MKNOD is not set
# CONFIG_MKTEMP is not set
# CONFIG_PASSWD is not set
# CONFIG_PIDOF is not set
# CONFIG_SEQ is not set
# CONFIG_SU is not set
# CONFIG_SYNC is not set
#
# pending (see toys/pending/README)
#
# CONFIG_GETTY is not set
# CONFIG_MDEV is not set
# CONFIG_MDEV_CONF is not set

8
tools/build/mk/dynload.mk → apps/trace/BUILD.gn Executable file → Normal file
View File

@@ -27,8 +27,8 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
DYNLOADTESTDIR := $(LITEOSTOPDIR)/test/kernel/sample/kernel_extend/dynload
export DYNLOADTESTDIR
import("//kernel/liteos_a/liteos.gni")
##### command to test dynload #####
-include $(DYNLOADTESTDIR)/test_dynload.mk
executable("trace") {
sources = [ "src/trace.c" ]
}

36
apps/trace/Makefile Normal file
View File

@@ -0,0 +1,36 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include $(APPSTOPDIR)/config.mk
APP_NAME := $(notdir $(shell pwd))
LOCAL_SRCS := src/trace.c
include $(APP)

141
apps/trace/src/trace.c Normal file
View File

@@ -0,0 +1,141 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <stdint.h>
#define TRACE_IOC_MAGIC 'T'
#define TRACE_START _IO(TRACE_IOC_MAGIC, 1)
#define TRACE_STOP _IO(TRACE_IOC_MAGIC, 2)
#define TRACE_RESET _IO(TRACE_IOC_MAGIC, 3)
#define TRACE_DUMP _IO(TRACE_IOC_MAGIC, 4)
#define TRACE_SET_MASK _IO(TRACE_IOC_MAGIC, 5)
#define TRACE_USR_MAX_PARAMS 3
typedef struct {
unsigned int eventType;
uintptr_t identity;
uintptr_t params[TRACE_USR_MAX_PARAMS];
} UsrEventInfo;
static void TraceUsage(void)
{
printf("\nUsage: ./trace [start] Start to trace events.\n");
printf("\nUsage: ./trace [stop] Stop trace.\n");
printf("\nUsage: ./trace [reset] Clear the trace record buffer.\n");
printf("\nUsage: ./trace [dump 0/1] Format printf trace data,"
"0/1 stands for whether to send data to studio for analysis.\n");
printf("\nUsage: ./trace [mask num] Set trace filter event mask.\n");
printf("\nUsage: ./trace [read nBytes] Read nBytes raw data from trace buffer.\n");
printf("\nUsage: ./trace [write type id params..] Write a user event, no more than 3 parameters.\n");
}
static void TraceRead(int fd, size_t size)
{
ssize_t i;
ssize_t len;
if (size == 0) {
return;
}
char *buffer = (char *)malloc(size);
if (buffer == NULL) {
printf("Read buffer malloc failed.\n");
return;
}
len = read(fd, buffer, size);
for (i = 0; i < len; i++) {
printf("%02x ", buffer[i] & 0xFF);
}
printf("\n");
free(buffer);
}
static void TraceWrite(int fd, int argc, char **argv)
{
int i;
UsrEventInfo info = {0};
info.eventType = strtoul(argv[2], NULL, 0); /* 2, argv number */
info.identity = strtoul(argv[3], NULL, 0); /* 3, argv number */
/* 4, argc -4 means user argv that does not contain argv[0]~argv[3] */
int paramNum = (argc - 4) > TRACE_USR_MAX_PARAMS ? TRACE_USR_MAX_PARAMS : (argc - 4);
for (i = 0; i < paramNum; i++) {
/* 4, argc -4 means user argv that does not contain argv[0]~argv[3] */
info.params[i] = strtoul(argv[4 + i], NULL, 0);
}
(void)write(fd, &info, sizeof(UsrEventInfo));
}
int main(int argc, char **argv)
{
int fd = open("/dev/trace", O_RDWR);
if (fd == -1) {
printf("Trace open failed.\n");
exit(EXIT_FAILURE);
}
if (argc == 1) {
TraceUsage();
} else if (argc == 2 && strcmp(argv[1], "start") == 0) { /* 2, argv num, no special meaning */
ioctl(fd, TRACE_START, NULL);
} else if (argc == 2 && strcmp(argv[1], "stop") == 0) { /* 2, argv num, no special meaning */
ioctl(fd, TRACE_STOP, NULL);
} else if (argc == 2 && strcmp(argv[1], "reset") == 0) { /* 2, argv num, no special meaning */
ioctl(fd, TRACE_RESET, NULL);
} else if (argc == 3 && strcmp(argv[1], "mask") == 0) { /* 3, argv num, no special meaning */
size_t mask = strtoul(argv[2], NULL, 0);
ioctl(fd, TRACE_SET_MASK, mask);
} else if (argc == 3 && strcmp(argv[1], "dump") == 0) { /* 3, argv num, no special meaning */
size_t flag = strtoul(argv[2], NULL, 0);
ioctl(fd, TRACE_DUMP, flag);
} else if (argc == 3 && strcmp(argv[1], "read") == 0) { /* 3, argv num, no special meaning */
size_t size = strtoul(argv[2], NULL, 0);
TraceRead(fd, size);
} else if (argc >= 4 && strcmp(argv[1], "write") == 0) { /* 4, argv num, no special meaning */
TraceWrite(fd, argc, argv);
} else {
printf("Unsupported trace command.\n");
TraceUsage();
}
close(fd);
return 0;
}

44
arch/BUILD.gn Normal file
View File

@@ -0,0 +1,44 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
group("arch") {
deps = []
if (defined(LOSCFG_ARCH_ARM)) {
deps += [ "arm" ]
}
}
config("public") {
configs = []
if (defined(LOSCFG_ARCH_ARM)) {
configs += [ "arm:public" ]
}
}

0
arch/Kconfig Executable file → Normal file
View File

40
arch/arm/BUILD.gn Normal file
View File

@@ -0,0 +1,40 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_a/liteos.gni")
group("arm") {
deps = [ "gic" ]
deps += [ ARCH ]
}
config("public") {
include_dirs = [ "include" ]
configs = [ "$ARCH:public" ]
}

View File

@@ -75,3 +75,29 @@ config ARCH_CORTEX_A7
config ARCH_CPU
string
default "cortex-a7" if ARCH_CORTEX_A7
#
# Supported GIC version
#
choice
prompt "GIC version"
default ARCH_GIC_V2
help
Interrupt Controller.
config ARCH_GIC_V2
bool "GIC Version 2"
help
This GIC(General Interrupt Controller) version 2 driver is compatatble with
GIC version 1 and version 2.
config ARCH_GIC_V3
bool "GIC Version 3"
depends on ARCH_ARM_V8A || ARCH_ARM_V8R
help
General Interrupt Controller version 3.
endchoice

View File

@@ -36,13 +36,16 @@ LOSCFG_ARCH_FPU_STRIP := $(subst $\",,$(LOSCFG_ARCH_FPU))
LOSCFG_ARCH_FPU = $(LOSCFG_ARCH_FPU_STRIP)
ifeq ($(LOSCFG_ARCH_ARM_AARCH32), y)
LITEOS_ARCH_ARM := arm
ARCH := arm
else ifeq ($(LOSCFG_ARCH_ARM_AARCH64), y)
LITEOS_ARCH_ARM :=
ARCH := aarch64
endif
LITEOS_BASELIB += -l$(LOSCFG_ARCH_CPU)
LIB_SUBDIRS += arch/arm/$(LITEOS_ARCH_ARM)
LITEOS_BASELIB += -lgic
LIB_SUBDIRS += arch/arm/$(ARCH)
LIB_SUBDIRS += arch/arm/gic
# CPU compile options
ifeq ($(LOSCFG_ARCH_ARM_AARCH64), y)
@@ -62,38 +65,12 @@ LITEOS_FPU_OPTS := -mfpu=$(LOSCFG_ARCH_FPU)
LITEOS_GCCLIB := $(subst cortex-,,$(LOSCFG_ARCH_CPU))_softfp_$(LOSCFG_ARCH_FPU)
endif
LITEOS_CORE_COPTS = $(LITEOS_CPU_OPTS) $(LITEOS_FLOAT_OPTS) $(LITEOS_FPU_OPTS)
LITEOS_INTERWORK += $(LITEOS_CORE_COPTS)
LITEOS_NODEBUG += $(LITEOS_CORE_COPTS)
LITEOS_CORE_COPTS = $(or $(ARCH_CFLAGS),$(LITEOS_CPU_OPTS) $(LITEOS_FLOAT_OPTS) $(LITEOS_FPU_OPTS))
LITEOS_ASOPTS += $(LITEOS_CPU_OPTS)
LITEOS_CXXOPTS_BASE += $(LITEOS_CORE_COPTS)
ARCH_INCLUDE := -I $(LITEOSTOPDIR)/arch/arm/include \
-I $(LITEOSTOPDIR)/arch/arm/$(LITEOS_ARCH_ARM)/include \
-I $(LITEOSTOPDIR)/arch/arm/$(LITEOS_ARCH_ARM)/src/include
-I $(LITEOSTOPDIR)/arch/arm/$(ARCH)/include \
-I $(LITEOSTOPDIR)/arch/arm/$(ARCH)/src/include
LITEOS_PLATFORM_INCLUDE += $(ARCH_INCLUDE)
LITEOS_CXXINCLUDE += $(ARCH_INCLUDE)
# expose FPU info to assembly code
ifeq ($(LOSCFG_ARCH_FPU_DISABLE), y)
LITEOS_CMACRO += -DLOSCFG_ARCH_FPU_DISABLE
else ifeq ($(LOSCFG_ARCH_FPU_VFP_D16), y)
LITEOS_CMACRO += -DLOSCFG_ARCH_FPU_VFP_D16
else ifeq ($(LOSCFG_ARCH_FPU_VFP_D32), y)
LITEOS_CMACRO += -DLOSCFG_ARCH_FPU_VFP_D32
endif
# extra definition for other module
LITEOS_CPU_TYPE = $(LOSCFG_ARCH_CPU)
LITEOS_ARM_ARCH := -march=$(subst $\",,$(LOSCFG_ARCH_ARM_VER))
# linux style macros
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7A) = -D__LINUX_ARM_ARCH__=7
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7R) = -D__LINUX_ARM_ARCH__=7
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7M) = -D__LINUX_ARM_ARCH__=7
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8A) = -D__LINUX_ARM_ARCH__=8
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8R) = -D__LINUX_ARM_ARCH__=8
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8M) = -D__LINUX_ARM_ARCH__=8
AS_OBJS_LIBC_FLAGS += $(LINUX_ARCH_y)

View File

@@ -27,34 +27,70 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
############### this is a makefile that you can config it ###############
-include $(LITEOSTOPDIR)/tools/build/mk/los_config.mk
import("//kernel/liteos_a/liteos.gni")
TOP_LD_PATH = $(LITEOSTOPDIR)
SCRIPTS_PATH = $(LITEOS_SCRIPTPATH)
LITEOS_MK_PATH = $(MK_PATH)
LITEOS_SUBDIRS = $(LIB_SUBDIRS)
LIB_BIGODIR = $(LITEOS_LIB_BIGODIR)
module_name = LOSCFG_ARCH_CPU
kernel_module(module_name) {
sources = [
"src/arm_generic_timer.c",
"src/clear_user.S",
"src/hw_user_get.S",
"src/hw_user_put.S",
"src/jmp.S",
"src/los_arch_mmu.c",
"src/los_asid.c",
"src/los_dispatch.S",
"src/los_exc.c",
"src/los_hw.c",
"src/los_hw_exc.S",
"src/los_hw_runstop.S",
"src/los_hw_tick.c",
"src/los_hwi.c",
"src/smp.c",
"src/strncpy_from_user.c",
"src/strnlen_user.c",
"src/user_copy.c",
]
##### liteos tables -u ldflags #####
-include $(LITEOS_MK_PATH)/liteos_tables_ldflags.mk
if (LOSCFG_ARCH_ARM_VER == "armv7-a") {
sources += [ "src/armv7a/cache.S" ]
}
if (defined(LOSCFG_KERNEL_SMP)) {
sources += [ "src/startup/reset_vector_mp.S" ]
} else {
sources += [ "src/startup/reset_vector_up.S" ]
}
LITEOS_COPTS := $(LITEOS_COPTS_DEBUG) $(LITEOS_COPTS_BASE) \
$(LITEOS_COPTS_EXTRA) $(LITEOS_CORE_COPTS)
LITEOS_CXXOPTS := $(LITEOS_CXXOPTS_BASE)
LITEOS_INCLUDE := $(LITEOS_KERNEL_INCLUDE) $(LITEOS_EXTKERNEL_INCLUDE) \
$(LITEOS_COMPAT_INCLUDE) $(LITEOS_FS_INCLUDE) \
$(LITEOS_NET_INCLUDE) $(LITEOS_LIB_INCLUDE) \
$(LITEOS_DRIVERS_INCLUDE) $(LOSCFG_TOOLS_DEBUG_INCLUDE) \
$(LITEOS_PLATFORM_INCLUDE)
LITEOS_LIBDEP := $(LITEOS_BASELIB)
LITEOS_ASFLAGS := $(LITEOS_ASOPTS) $(LITEOS_INCLUDE)
LITEOS_CFLAGS := $(LITEOS_COPTS) $(LITEOS_CMACRO) \
$(LITEOS_CMACRO_TEST) $(LITEOS_IMAGE_MACRO) \
$(LITEOS_INCLUDE)
LITEOS_CXXFLAGS := $(LITEOS_CXXOPTS) $(LITEOS_CXXMACRO) \
$(LITEOS_CMACRO) $(LITEOS_CXXINCLUDE)
LITEOS_LDFLAGS := $(LITEOS_LD_OPTS) $(LITEOS_LD_PATH) \
$(LITEOS_LD_SCRIPT)
include_dirs = [ "src/include" ]
if (defined(LOSCFG_PERF_HW_PMU)) {
sources += [ "src/pmu/armv7_pmu.c" ]
}
if (defined(LOSCFG_GDB)) {
configs += [ ":as_objs_libc_flags" ]
}
public_configs = [ ":public" ]
}
config("public") {
include_dirs = [
"include",
"src/include",
]
}
config("as_objs_libc_flags") {
defines = [ "__ASSEMBLY__" ]
# linux style macros
if (defined(LOSCFG_ARCH_ARM_V7A) || defined(LOSCFG_ARCH_ARM_V7R) ||
defined(LOSCFG_ARCH_ARM_V7M)) {
defines += [ "__LINUX_ARM_ARCH__=7" ]
} else if (defined(LOSCFG_ARCH_ARM_V8A) || defined(LOSCFG_ARCH_ARM_V8R) ||
defined(LOSCFG_ARCH_ARM_V8M)) {
defines += [ "__LINUX_ARM_ARCH__=8" ]
}
}

23
arch/arm/arm/Makefile Executable file → Normal file
View File

@@ -32,13 +32,8 @@ include $(LITEOSTOPDIR)/config.mk
MODULE_NAME := $(LOSCFG_ARCH_CPU)
LOCAL_SRCS := $(wildcard src/*.c) $(wildcard src/*.S)
LOCAL_INCLUDE := \
-I $(LITEOSTOPDIR)/kernel/base/include \
-I $(LITEOSTOPDIR)/kernel/extended/include \
-I $(LITEOSTOPDIR)/kernel/extended/dynload/include \
-I $(LITEOSTOPDIR)/arch/arm/arm/include \
ifeq ($(LITEOS_ARM_ARCH), -march=armv7-a)
ifeq ($(LOSCFG_ARCH_ARM_VER), "armv7-a")
LOCAL_SRCS += $(wildcard src/armv7a/*.S)
endif
@@ -48,7 +43,21 @@ else
LOCAL_SRCS += src/startup/reset_vector_up.S
endif
LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS)
ifeq ($(LOSCFG_PERF_HW_PMU), y)
LOCAL_SRCS += src/pmu/armv7_pmu.c
endif
LOCAL_FLAGS := $(LOCAL_INCLUDE)
AS_OBJS_LIBC_FLAGS = -D__ASSEMBLY__
# linux style macros
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7A) = -D__LINUX_ARM_ARCH__=7
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7R) = -D__LINUX_ARM_ARCH__=7
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7M) = -D__LINUX_ARM_ARCH__=7
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8A) = -D__LINUX_ARM_ARCH__=8
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8R) = -D__LINUX_ARM_ARCH__=8
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8M) = -D__LINUX_ARM_ARCH__=8
AS_OBJS_LIBC_FLAGS += $(LINUX_ARCH_y)
ifeq ($(LOSCFG_GDB), y)
LOCAL_FLAGS += $(AS_OBJS_LIBC_FLAGS)

1
arch/arm/arm/include/arch_config.h Executable file → Normal file
View File

@@ -32,7 +32,6 @@
#ifndef _ARCH_CONFIG_H
#define _ARCH_CONFIG_H
#include "menuconfig.h"
#define CPSR_INT_DISABLE 0xC0 /* Disable both FIQ and IRQ */
#define CPSR_IRQ_DISABLE 0x80 /* IRQ disabled when =1 */

4
arch/arm/arm/include/arm.h Executable file → Normal file
View File

@@ -36,10 +36,6 @@
#define CPSR_MODE_USR 0x10
#define CPSR_MODE_MASK 0x1f
#define DSB __asm__ volatile("dsb" ::: "memory")
#define ISB __asm__ volatile("isb" ::: "memory")
#define DMB __asm__ volatile("dmb" ::: "memory")
STATIC INLINE UINT32 OsArmReadSctlr(VOID)
{
UINT32 val;

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ARM_USER_CLEAR_H
#define _ARM_USER_CLEAR_H
#include "los_typedef.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
size_t _arm_clear_user(void *addr, size_t bytes);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _ARM_USER_CLEAR_H */

0
arch/arm/arm/include/arm_user_copy.h Executable file → Normal file
View File

0
arch/arm/arm/include/arm_user_get.h Executable file → Normal file
View File

0
arch/arm/arm/include/arm_user_put.h Executable file → Normal file
View File

View File

@@ -45,9 +45,8 @@ extern VOID HalClockIrqClear(VOID);
extern VOID HalClockInit(VOID);
extern UINT64 HalClockGetCycles(VOID);
extern VOID HalDelayUs(UINT32 usecs);
extern UINT64 hi_sched_clock(VOID);
extern UINT32 HalClockGetTickTimerCycles(VOID);
extern VOID HalClockTickTimerReload(UINT64 cycles);
extern UINT64 HalClockTickTimerReload(UINT64 cycles);
extern UINT32 HrtimersInit(VOID);
extern VOID HrtimerClockIrqClear(VOID);

View File

@@ -38,7 +38,10 @@
#define __LOS_ARCH_MMU_H__
#include "los_typedef.h"
#include "los_mux.h"
#include "los_vm_phys.h"
#ifndef LOSCFG_PAGE_TABLE_FINE_LOCK
#include "los_spinlock.h"
#endif
#ifdef __cplusplus
#if __cplusplus
@@ -47,7 +50,9 @@ extern "C" {
#endif /* __cplusplus */
typedef struct ArchMmu {
LosMux mtx; /**< arch mmu page table entry modification mutex lock */
#ifndef LOSCFG_PAGE_TABLE_FINE_LOCK
SPIN_LOCK_S lock; /**< arch mmu page table entry modification spin lock */
#endif
VADDR_T *virtTtb; /**< translation table base virtual addr */
PADDR_T physTtb; /**< translation table base phys addr */
UINT32 asid; /**< TLB asid */
@@ -71,5 +76,5 @@ VADDR_T *OsGFirstTableGet(VOID);
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* __LOS_VM_PAGE_H__ */
#endif /* __LOS_ARCH_MMU_H__ */

View File

@@ -246,7 +246,7 @@ STATIC INLINE INT32 LOS_AtomicIncRet(Atomic *v)
* @brief Atomic auto-decrement.
*
* @par Description:
* This API is used to implementating the atomic auto-decrement.
* This API is used to implement the atomic auto-decrement.
* @attention
* <ul>
* <li>The pointer v must not be NULL.</li>
@@ -280,7 +280,7 @@ STATIC INLINE VOID LOS_AtomicDec(Atomic *v)
* @brief Atomic auto-decrement.
*
* @par Description:
* This API is used to implementating the atomic auto-decrement and return the result of auto-decrement.
* This API is used to implement the atomic auto-decrement and return the result of auto-decrement.
* @attention
* <ul>
* <li>The pointer v must not be NULL.</li>
@@ -531,7 +531,7 @@ STATIC INLINE INT64 LOS_Atomic64IncRet(Atomic64 *v)
* @brief Atomic64 auto-decrement.
*
* @par Description:
* This API is used to implementating the atomic64 auto-decrement.
* This API is used to implement the atomic64 auto-decrement.
* @attention
* <ul>
* <li>The pointer v must not be NULL.</li>
@@ -566,7 +566,7 @@ STATIC INLINE VOID LOS_Atomic64Dec(Atomic64 *v)
* @brief Atomic64 auto-decrement.
*
* @par Description:
* This API is used to implementating the atomic64 auto-decrement and return the result of auto-decrement.
* This API is used to implement the atomic64 auto-decrement and return the result of auto-decrement.
* @attention
* <ul>
* <li>The pointer v must not be NULL.</li>

23
arch/arm/arm/include/los_hw_cpu.h Executable file → Normal file
View File

@@ -51,7 +51,10 @@ extern "C" {
#define DSB __asm__ volatile("dsb" ::: "memory")
#define DMB __asm__ volatile("dmb" ::: "memory")
#define ISB __asm__ volatile("isb" ::: "memory")
#define WFI __asm__ volatile("wfi" ::: "memory")
#define BARRIER __asm__ volatile("":::"memory")
#define WFE __asm__ volatile("wfe" ::: "memory")
#define SEV __asm__ volatile("sev" ::: "memory")
#define ARM_SYSREG_READ(REG) \
({ \
@@ -144,7 +147,7 @@ STATIC INLINE VOID ArchCurrUserTaskSet(UINTPTR val)
STATIC INLINE UINT32 ArchCurrCpuid(VOID)
{
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
return ARM_SYSREG_READ(MPIDR) & MPIDR_CPUID_MASK;
#else
return 0;
@@ -188,6 +191,24 @@ STATIC INLINE UINT32 ArchIntUnlock(VOID)
return intSave;
}
STATIC INLINE VOID ArchIrqDisable(VOID)
{
__asm__ __volatile__(
"cpsid i "
:
:
: "memory", "cc");
}
STATIC INLINE VOID ArchIrqEnable(VOID)
{
__asm__ __volatile__(
"cpsie i "
:
:
: "memory", "cc");
}
#else
STATIC INLINE UINT32 ArchIntLock(VOID)

0
arch/arm/arm/include/los_mmu_descriptor_v6.h Executable file → Normal file
View File

View File

@@ -69,6 +69,11 @@ STATIC INLINE VOID OsClearPte1(PTE_T *pte1Ptr)
OsSavePte1(pte1Ptr, 0);
}
STATIC INLINE PADDR_T OsGetPte1Paddr(PADDR_T PhysTtb, vaddr_t va)
{
return (PhysTtb + (OsGetPte1Index(va) * sizeof(PADDR_T)));
}
STATIC INLINE PTE_T *OsGetPte1Ptr(PTE_T *pte1BasePtr, vaddr_t va)
{
return (pte1BasePtr + OsGetPte1Index(va));

View File

@@ -37,7 +37,6 @@
#define __LOS_TLB_V6_H__
#include "los_typedef.h"
#include "menuconfig.h"
#include "arm.h"
#ifdef __cplusplus

View File

@@ -29,11 +29,10 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LOS_EXC_INTER_PRI_H
#define _LOS_EXC_INTER_PRI_H
#ifndef _ARCH_SMP_H
#define _ARCH_SMP_H
#include "los_config.h"
#include "los_task.h"
#ifdef __cplusplus
#if __cplusplus
@@ -41,8 +40,13 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern UINT32 OsExcInteractionTaskCheck(const TSK_INIT_PARAM_S *initParam);
extern VOID OsExcInteractionTaskKeep(VOID);
struct SmpOps {
INT32 (*SmpCpuOn)(UINT32 cpuNum, UINTPTR startEntry); /* The startEntry is physical addr. */
};
typedef VOID (*ArchCpuStartFunc)(VOID *arg);
VOID HalArchCpuOn(UINT32 cpuNum, ArchCpuStartFunc func, struct SmpOps *ops, VOID *arg);
#ifdef __cplusplus
#if __cplusplus
@@ -50,4 +54,5 @@ extern VOID OsExcInteractionTaskKeep(VOID);
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _LOS_EXC_INTER_PRI_H */
#endif /* _ARCH_SMP_H */

View File

@@ -31,7 +31,6 @@
#include "los_hw_pri.h"
#include "los_tick_pri.h"
#include "los_sched_pri.h"
#include "los_sys_pri.h"
#include "gic_common.h"
@@ -139,11 +138,6 @@ LITE_OS_SEC_TEXT_INIT VOID HalClockInit(VOID)
LITE_OS_SEC_TEXT_INIT VOID HalClockStart(VOID)
{
UINT32 ret = OsSchedSetTickTimerType(64); /* 64 bit tick timer */
if (ret != LOS_OK) {
return;
}
HalIrqUnmask(OS_TICK_INT_NUM);
/* triggle the first tick */
@@ -162,7 +156,7 @@ VOID HalDelayUs(UINT32 usecs)
}
}
UINT64 hi_sched_clock(VOID)
DEPRECATED UINT64 hi_sched_clock(VOID)
{
return LOS_CurrNanosec();
}
@@ -175,7 +169,7 @@ UINT32 HalClockGetTickTimerCycles(VOID)
return (UINT32)((cval > cycles) ? (cval - cycles) : 0);
}
VOID HalClockTickTimerReload(UINT64 cycles)
UINT64 HalClockTickTimerReload(UINT64 cycles)
{
HalIrqMask(OS_TICK_INT_NUM);
HalIrqClear(OS_TICK_INT_NUM);
@@ -185,4 +179,5 @@ VOID HalClockTickTimerReload(UINT64 cycles)
TimerCtlWrite(1);
HalIrqUnmask(OS_TICK_INT_NUM);
return cycles;
}

View File

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "asm.h"
.syntax unified
.arm
// size_t _arm_clear_user(void *addr, size_t bytes)
FUNCTION(_arm_clear_user)
push {r0-r6, lr}
cmp r1, #0
beq .Lclear_user_return
tst r0, #7
beq .Lclear_user_aligned
.Lclear_user_byte:
mov r2, #0
0: strb r2, [r0], #1
subs r1, r1, #1
beq .Lclear_user_return
tst r0, #7
bne 0b
.Lclear_user_aligned:
eor r3, r3
eor r4, r4
bics r2, r1, #15
bne .Lclear_user_16bytes
bics r2, r1, #7
bne .Lclear_user_8bytes
b .Lclear_user_remaining
.Lclear_user_16bytes:
eor r5, r5
eor r6, r6
1: stmia r0!, {r3, r4, r5, r6}
subs r2, r2, #16
bne 1b
ands r1, r1, #15
beq .Lclear_user_return
bics r2, r1, #7
beq .Lclear_user_remaining
.Lclear_user_8bytes:
2: stmia r0!, {r3, r4}
ands r1, r1, #7
beq .Lclear_user_return
.Lclear_user_remaining:
mov r2, #0
3: strb r2, [r0], #1
subs r1, r1, #1
bne 3b
.Lclear_user_return:
pop {r0-r6, lr}
mov r0, #0
bx lr
.Lclear_user_err:
pop {r0, r1}
sub r0, r2, r0
sub r0, r1, r0
pop {r2-r6, lr}
bx lr
.pushsection __exc_table, "a"
.long 0b, .Lclear_user_err
.long 1b, .Lclear_user_err
.long 2b, .Lclear_user_err
.long 3b, .Lclear_user_err
.popsection

0
arch/arm/arm/src/hw_user_get.S Executable file → Normal file
View File

0
arch/arm/arm/src/hw_user_put.S Executable file → Normal file
View File

View File

@@ -0,0 +1,108 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ARMV7_PMU_PRI_H
#define _ARMV7_PMU_PRI_H
#include "los_typedef.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* counters overflow flag status reg */
#define ARMV7_FLAG_MASK 0xffffffff /* Mask for writable bits */
#define ARMV7_OVERFLOWED_MASK ARMV7_FLAG_MASK /* Mask for pmu overflowed */
/* pmnc config reg */
#define ARMV7_PMNC_E (1U << 0) /* Enable all counters */
#define ARMV7_PMNC_P (1U << 1) /* Reset all counters */
#define ARMV7_PMNC_C (1U << 2) /* Cycle counter reset */
#define ARMV7_PMNC_D (1U << 3) /* CCNT counts every 64th cpu cycle */
#define ARMV7_PMNC_X (1U << 4) /* Export to ETM */
#define ARMV7_PMNC_DP (1U << 5) /* Disable CCNT if non-invasive debug */
#define ARMV7_PMNC_MASK 0x3f /* Mask for writable bits */
/* pmxevtyper event selection reg */
#define ARMV7_EVTYPE_MASK 0xc80000ff /* Mask for writable bits */
/* armv7 counters index */
#define ARMV7_IDX_COUNTER0 1
#define ARMV7_IDX_CYCLE_COUNTER 0
#define ARMV7_IDX_MAX_COUNTER 9
#define ARMV7_MAX_COUNTERS 32
#define ARMV7_IDX_COUNTER_LAST (ARMV7_IDX_CYCLE_COUNTER + ARMV7_MAX_COUNTERS - 1)
#define ARMV7_COUNTER_MASK (ARMV7_MAX_COUNTERS - 1)
/* armv7 event counter index mapping */
#define ARMV7_CNT2BIT(x) (1UL << (x))
#define ARMV7_IDX2CNT(x) (((x) - ARMV7_IDX_COUNTER0) & ARMV7_COUNTER_MASK)
enum PmuEventType {
ARMV7_PERF_HW_CYCLES = 0xFF, /* cycles */
ARMV7_PERF_HW_INSTRUCTIONS = 0x08, /* instructions */
ARMV7_PERF_HW_DCACHES = 0x04, /* dcache */
ARMV7_PERF_HW_DCACHE_MISSES = 0x03, /* dcache-misses */
ARMV7_PERF_HW_ICACHES = 0x14, /* icache */
ARMV7_PERF_HW_ICACHE_MISSES = 0x01, /* icache-misses */
ARMV7_PERF_HW_BRANCHES = 0x0C, /* software change of pc */
ARMV7_PERF_HW_BRANCE_MISSES = 0x10, /* branch-misses */
ARMV7_PERF_HW_PRED_BRANCH = 0x12, /* predictable branches */
ARMV7_PERF_HW_NUM_CYC_IRQ = 0x50, /* number of cycles Irqs are interrupted */
ARMV7_PERF_HW_EXC_TAKEN = 0x09, /* exception_taken */
ARMV7_PERF_HW_DATA_READ = 0x06, /* data read */
ARMV7_PERF_HW_DATA_WRITE = 0x07, /* data write */
ARMV7_PERF_HW_STREX_PASSED = 0x80, /* strex passed */
ARMV7_PERF_HW_STREX_FAILED = 0x81, /* strex failed */
ARMV7_PERF_HW_LP_IN_TCM = 0x82, /* literal pool in TCM region */
ARMV7_PERF_HW_DMB_STALL = 0x90, /* DMB stall */
ARMV7_PERF_HW_ITCM_ACCESS = 0x91, /* ITCM access */
ARMV7_PERF_HW_DTCM_ACCESS = 0x92, /* DTCM access */
ARMV7_PERF_HW_DATA_EVICTION = 0x93, /* data eviction */
ARMV7_PERF_HW_SCU = 0x94, /* SCU coherency operation */
ARMV7_PERF_HW_INSCACHE_DEP_DW = 0x95, /* instruction cache dependent stall */
ARMV7_PERF_HW_DATA_CACHE_DEP_STALL = 0x96, /* data cache dependent stall */
ARMV7_PERF_HW_NOCACHE_NO_PER_DEP_STALL = 0x97, /* non-cacheable no peripheral dependent stall */
ARMV7_PERF_HW_NOCACHE_PER_DEP_STALL = 0x98, /* non-Cacheable peripheral dependent stall */
ARMV7_PERF_HW_DATA_CACHE_HP_DEP_STALL = 0x99, /* data cache high priority dependent stall */
ARMV7_PERF_HW_AXI_FAST_PERIPHERAL = 0x9A, /* Accesses_to_AXI_fast_peripheral_port(reads_and_writes) */
};
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _ARMV7_PMU_PRI_H */

0
arch/arm/arm/src/include/asm.h Executable file → Normal file
View File

View File

@@ -40,19 +40,28 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
STATIC INLINE VOID OsSetCurrCpuSp(UINTPTR regSp)
{
__asm__ __volatile__("mov sp, %0" :: "r"(regSp));
}
#define OS_SYSTEM_NORMAL 0
#define OS_SYSTEM_EXC_CURR_CPU 1
#define OS_SYSTEM_EXC_OTHER_CPU 2
#define REGION_PATH_MAX 32
typedef struct {
#ifdef LOSCFG_KERNEL_VM
UINTPTR ip;
UINT32 len; /* f_path length */
CHAR f_path[REGION_PATH_MAX];
#else
UINTPTR ip;
#endif
} IpInfo;
extern UINT32 OsGetSystemStatus(VOID);
extern VOID BackTraceSub(UINTPTR regFP);
extern VOID OsExcInit(VOID);
extern BOOL OsSystemExcIsReset(VOID);
extern UINT32 BackTraceGet(UINTPTR regFP, IpInfo *callChain, UINT32 maxDepth);
extern BOOL OsGetUsrIpInfo(UINTPTR ip, IpInfo *info);
#ifdef __cplusplus
#if __cplusplus

59
arch/arm/arm/src/include/los_hw_pri.h Executable file → Normal file
View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -34,8 +34,7 @@
#include "los_base.h"
#include "los_hw.h"
#include "los_process_pri.h"
#include "los_signal.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
@@ -56,23 +55,44 @@ typedef struct {
UINT32 regFPSCR; /* FPSCR */
UINT32 regFPEXC; /* FPEXC */
#endif
UINT32 resved; /* It's stack 8 aligned */
UINT32 regPSR;
UINT32 R[GEN_REGS_NUM]; /* R0-R12 */
UINT32 SP; /* R13 */
UINT32 LR; /* R14 */
UINT32 PC; /* R15 */
UINT32 R4;
UINT32 R5;
UINT32 R6;
UINT32 R7;
UINT32 R8;
UINT32 R9;
UINT32 R10;
UINT32 R11;
/* It has the same structure as IrqContext */
UINT32 reserved2; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
UINT32 reserved1; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
UINT32 USP; /**< User mode sp register */
UINT32 ULR; /**< User mode lr register */
UINT32 R0;
UINT32 R1;
UINT32 R2;
UINT32 R3;
UINT32 R12;
UINT32 LR;
UINT32 PC;
UINT32 regCPSR;
} TaskContext;
typedef struct {
#if !defined(LOSCFG_ARCH_FPU_DISABLE)
UINT64 D[FP_REGS_NUM]; /* D0-D31 */
UINT32 regFPSCR; /* FPSCR */
UINT32 regFPEXC; /* FPEXC */
#endif
UINT32 resved;
TASK_IRQ_CONTEXT
} TaskIrqContext;
UINT32 reserved2; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
UINT32 reserved1; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
UINT32 USP; /**< User mode sp register */
UINT32 ULR; /**< User mode lr register */
UINT32 R0;
UINT32 R1;
UINT32 R2;
UINT32 R3;
UINT32 R12;
UINT32 LR;
UINT32 PC;
UINT32 regCPSR;
} IrqContext;
/*
* Description : task stack initialization
@@ -82,8 +102,9 @@ typedef struct {
* Return : pointer to the task context
*/
extern VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack, BOOL initFlag);
extern VOID OsUserCloneParentStack(LosTaskCB *childTaskCB, LosTaskCB *parentTaskCB);
extern VOID OsUserTaskStackInit(TaskContext *context, TSK_ENTRY_FUNC taskEntry, UINTPTR stack);
extern VOID OsUserCloneParentStack(VOID *childStack, UINTPTR sp, UINTPTR parentTopOfStask, UINT32 parentStackSize);
extern VOID OsUserTaskStackInit(TaskContext *context, UINTPTR taskEntry, UINTPTR stack);
extern VOID OsInitSignalContext(const VOID *sp, VOID *signalContext, UINTPTR sigHandler, UINT32 signo, UINT32 param);
extern void arm_clean_cache_range(UINTPTR start, UINTPTR end);
extern void arm_inv_cache_range(UINTPTR start, UINTPTR end);

View File

@@ -55,11 +55,11 @@ extern "C" {
#define HWI_IS_REGISTED(num) ((&g_hwiForm[num])->pstNext != NULL)
#endif
extern VOID OsHwiInit(VOID);
extern VOID OsIncHwiFormCnt(UINT32 index);
extern UINT32 OsGetHwiFormCnt(UINT32 index);
extern VOID OsIncHwiFormCnt(UINT16 cpuid, UINT32 index);
extern UINT32 OsGetHwiFormCnt(UINT16 cpuid, UINT32 index);
extern CHAR *OsGetHwiFormName(UINT32 index);
extern VOID OsInterrupt(UINT32 intNum);
extern VOID SyscallHandleInit(VOID);
extern VOID OsSyscallHandleInit(VOID);
#ifdef __cplusplus
#if __cplusplus

456
arch/arm/arm/src/los_arch_mmu.c Executable file → Normal file
View File

@@ -39,22 +39,26 @@
#include "los_pte_ops.h"
#include "los_tlb_v6.h"
#include "los_printf.h"
#include "los_vm_phys.h"
#include "los_vm_common.h"
#include "los_vm_map.h"
#include "los_vm_boot.h"
#include "los_mmu_descriptor_v6.h"
#include "los_process_pri.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef LOSCFG_KERNEL_MMU
typedef struct {
LosArchMmu *archMmu;
VADDR_T *vaddr;
PADDR_T *paddr;
UINT32 *flags;
} MmuMapInfo;
#define TRY_MAX_TIMES 10
__attribute__((aligned(MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS))) \
__attribute__((section(".bss.prebss.translation_table"))) UINT8 \
g_firstPageTable[MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS];
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
__attribute__((aligned(MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS))) \
__attribute__((section(".bss.prebss.translation_table"))) UINT8 \
g_tempPageTable[MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS];
@@ -64,12 +68,86 @@ extern CHAR __mmu_ttlb_begin; /* defined in .ld script */
UINT8 *g_mmuJumpPageTable = (UINT8 *)&__mmu_ttlb_begin; /* temp page table, this is only used when system power up */
#endif
STATIC SPIN_LOCK_S *OsGetPteLock(LosArchMmu *archMmu, PADDR_T paddr, UINT32 *intSave)
{
SPIN_LOCK_S *lock = NULL;
#ifdef LOSCFG_PAGE_TABLE_FINE_LOCK
LosVmPage *vmPage = NULL;
vmPage = OsVmPaddrToPage(paddr);
if (vmPage == NULL) {
return NULL;
}
lock = &vmPage->lock;
#else
lock = &archMmu->lock;
#endif
LOS_SpinLockSave(lock, intSave);
return lock;
}
STATIC SPIN_LOCK_S *OsGetPte1Lock(LosArchMmu *archMmu, PADDR_T paddr, UINT32 *intSave)
{
return OsGetPteLock(archMmu, paddr, intSave);
}
STATIC INLINE VOID OsUnlockPte1(SPIN_LOCK_S *lock, UINT32 intSave)
{
if (lock == NULL) {
return;
}
LOS_SpinUnlockRestore(lock, intSave);
}
STATIC SPIN_LOCK_S *OsGetPte1LockTmp(LosArchMmu *archMmu, PADDR_T paddr, UINT32 *intSave)
{
SPIN_LOCK_S *spinLock = NULL;
#ifdef LOSCFG_PAGE_TABLE_FINE_LOCK
spinLock = OsGetPteLock(archMmu, paddr, intSave);
#else
(VOID)archMmu;
(VOID)paddr;
(VOID)intSave;
#endif
return spinLock;
}
STATIC INLINE VOID OsUnlockPte1Tmp(SPIN_LOCK_S *lock, UINT32 intSave)
{
#ifdef LOSCFG_PAGE_TABLE_FINE_LOCK
if (lock == NULL) {
return;
}
LOS_SpinUnlockRestore(lock, intSave);
#else
(VOID)lock;
(VOID)intSave;
#endif
}
STATIC INLINE SPIN_LOCK_S *OsGetPte2Lock(LosArchMmu *archMmu, PTE_T pte1, UINT32 *intSave)
{
PADDR_T pa = MMU_DESCRIPTOR_L1_PAGE_TABLE_ADDR(pte1);
return OsGetPteLock(archMmu, pa, intSave);
}
STATIC INLINE VOID OsUnlockPte2(SPIN_LOCK_S *lock, UINT32 intSave)
{
return OsUnlockPte1(lock, intSave);
}
STATIC INLINE PTE_T *OsGetPte2BasePtr(PTE_T pte1)
{
PADDR_T pa = MMU_DESCRIPTOR_L1_PAGE_TABLE_ADDR(pte1);
return LOS_PaddrToKVaddr(pa);
}
VADDR_T *OsGFirstTableGet(VOID)
{
return (VADDR_T *)g_firstPageTable;
}
STATIC INLINE UINT32 OsUnmapL1Invalid(vaddr_t *vaddr, UINT32 *count)
{
UINT32 unmapCount;
@@ -146,7 +224,6 @@ STATIC VOID OsCvtPte2AttsToFlags(PTE_T l1Entry, PTE_T l2Entry, UINT32 *flags)
STATIC VOID OsPutL2Table(const LosArchMmu *archMmu, UINT32 l1Index, paddr_t l2Paddr)
{
LosVmPage *vmPage = NULL;
UINT32 index;
PTE_T ttEntry;
/* check if any l1 entry points to this l2 table */
@@ -156,8 +233,9 @@ STATIC VOID OsPutL2Table(const LosArchMmu *archMmu, UINT32 l1Index, paddr_t l2Pa
return;
}
}
#ifdef LOSCFG_KERNEL_VM
/* we can free this l2 table */
vmPage = LOS_VmPageGet(l2Paddr);
LosVmPage *vmPage = LOS_VmPageGet(l2Paddr);
if (vmPage == NULL) {
LOS_Panic("bad page table paddr %#x\n", l2Paddr);
return;
@@ -165,22 +243,35 @@ STATIC VOID OsPutL2Table(const LosArchMmu *archMmu, UINT32 l1Index, paddr_t l2Pa
LOS_ListDelete(&vmPage->node);
LOS_PhysPageFree(vmPage);
#else
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, LOS_PaddrToKVaddr(l2Paddr));
#endif
}
STATIC VOID OsTryUnmapL1PTE(const LosArchMmu *archMmu, vaddr_t vaddr, UINT32 scanIndex, UINT32 scanCount)
STATIC VOID OsTryUnmapL1PTE(LosArchMmu *archMmu, PTE_T *l1Entry, vaddr_t vaddr, UINT32 scanIndex, UINT32 scanCount)
{
/*
* Check if all pages related to this l1 entry are deallocated.
* We only need to check pages that we did not clear above starting
* from page_idx and wrapped around SECTION.
* from scanIndex and wrapped around SECTION.
*/
UINT32 l1Index;
PTE_T l1Entry;
PTE_T *pte2BasePtr = NULL;
SPIN_LOCK_S *pte1Lock = NULL;
SPIN_LOCK_S *pte2Lock = NULL;
UINT32 pte1IntSave;
UINT32 pte2IntSave;
PTE_T pte1Val;
PADDR_T pte1Paddr;
pte2BasePtr = OsGetPte2BasePtr(OsGetPte1(archMmu->virtTtb, vaddr));
pte1Paddr = OsGetPte1Paddr(archMmu->physTtb, vaddr);
pte2Lock = OsGetPte2Lock(archMmu, *l1Entry, &pte2IntSave);
if (pte2Lock == NULL) {
return;
}
pte2BasePtr = OsGetPte2BasePtr(*l1Entry);
if (pte2BasePtr == NULL) {
VM_ERR("pte2 base ptr is NULL");
OsUnlockPte2(pte2Lock, pte2IntSave);
return;
}
@@ -195,15 +286,27 @@ STATIC VOID OsTryUnmapL1PTE(const LosArchMmu *archMmu, vaddr_t vaddr, UINT32 sca
}
if (!scanCount) {
l1Index = OsGetPte1Index(vaddr);
l1Entry = archMmu->virtTtb[l1Index];
/*
* The pte1 of kprocess is placed in kernel image when compiled. So the pte1Lock will be null.
* There is no situation to simultaneous access the pte1 of kprocess.
*/
pte1Lock = OsGetPte1LockTmp(archMmu, pte1Paddr, &pte1IntSave);
if (!OsIsPte1PageTable(*l1Entry)) {
OsUnlockPte1Tmp(pte1Lock, pte1IntSave);
OsUnlockPte2(pte2Lock, pte2IntSave);
return;
}
pte1Val = *l1Entry;
/* we can kill l1 entry */
OsClearPte1(&archMmu->virtTtb[l1Index]);
OsClearPte1(l1Entry);
l1Index = OsGetPte1Index(vaddr);
OsArmInvalidateTlbMvaNoBarrier(l1Index << MMU_DESCRIPTOR_L1_SMALL_SHIFT);
/* try to free l2 page itself */
OsPutL2Table(archMmu, l1Index, MMU_DESCRIPTOR_L1_PAGE_TABLE_ADDR(l1Entry));
OsPutL2Table(archMmu, l1Index, MMU_DESCRIPTOR_L1_PAGE_TABLE_ADDR(pte1Val));
OsUnlockPte1Tmp(pte1Lock, pte1IntSave);
}
OsUnlockPte2(pte2Lock, pte2IntSave);
}
STATIC UINT32 OsCvtSecCacheFlagsToMMUFlags(UINT32 flags)
@@ -213,7 +316,7 @@ STATIC UINT32 OsCvtSecCacheFlagsToMMUFlags(UINT32 flags)
switch (flags & VM_MAP_REGION_FLAG_CACHE_MASK) {
case VM_MAP_REGION_FLAG_CACHED:
mmuFlags |= MMU_DESCRIPTOR_L1_TYPE_NORMAL_WRITE_BACK_ALLOCATE;
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
mmuFlags |= MMU_DESCRIPTOR_L1_SECTION_SHAREABLE;
#endif
break;
@@ -335,34 +438,54 @@ STATIC VOID OsCvtSecAttsToFlags(PTE_T l1Entry, UINT32 *flags)
}
}
STATIC UINT32 OsUnmapL2PTE(const LosArchMmu *archMmu, vaddr_t vaddr, UINT32 *count)
STATIC UINT32 OsUnmapL2PTE(LosArchMmu *archMmu, PTE_T *pte1, vaddr_t vaddr, UINT32 *count)
{
UINT32 unmapCount;
UINT32 pte2Index;
UINT32 intSave;
PTE_T *pte2BasePtr = NULL;
pte2BasePtr = OsGetPte2BasePtr(OsGetPte1((PTE_T *)archMmu->virtTtb, vaddr));
if (pte2BasePtr == NULL) {
LOS_Panic("%s %d, pte2 base ptr is NULL\n", __FUNCTION__, __LINE__);
}
SPIN_LOCK_S *lock = NULL;
pte2Index = OsGetPte2Index(vaddr);
unmapCount = MIN2(MMU_DESCRIPTOR_L2_NUMBERS_PER_L1 - pte2Index, *count);
lock = OsGetPte2Lock(archMmu, *pte1, &intSave);
if (lock == NULL) {
return unmapCount;
}
pte2BasePtr = OsGetPte2BasePtr(*pte1);
if (pte2BasePtr == NULL) {
OsUnlockPte2(lock, intSave);
return unmapCount;
}
/* unmap page run */
OsClearPte2Continuous(&pte2BasePtr[pte2Index], unmapCount);
/* invalidate tlb */
OsArmInvalidateTlbMvaRangeNoBarrier(vaddr, unmapCount);
OsUnlockPte2(lock, intSave);
*count -= unmapCount;
return unmapCount;
}
STATIC UINT32 OsUnmapSection(LosArchMmu *archMmu, vaddr_t *vaddr, UINT32 *count)
STATIC UINT32 OsUnmapSection(LosArchMmu *archMmu, PTE_T *l1Entry, vaddr_t *vaddr, UINT32 *count)
{
UINT32 intSave;
PADDR_T pte1Paddr;
SPIN_LOCK_S *lock = NULL;
pte1Paddr = OsGetPte1Paddr(archMmu->physTtb, *vaddr);
lock = OsGetPte1Lock(archMmu, pte1Paddr, &intSave);
if (!OsIsPte1Section(*l1Entry)) {
OsUnlockPte1(lock, intSave);
return 0;
}
OsClearPte1(OsGetPte1Ptr((PTE_T *)archMmu->virtTtb, *vaddr));
OsArmInvalidateTlbMvaNoBarrier(*vaddr);
OsUnlockPte1(lock, intSave);
*vaddr += MMU_DESCRIPTOR_L1_SMALL_SIZE;
*count -= MMU_DESCRIPTOR_L2_NUMBERS_PER_L1;
@@ -370,20 +493,18 @@ STATIC UINT32 OsUnmapSection(LosArchMmu *archMmu, vaddr_t *vaddr, UINT32 *count)
return MMU_DESCRIPTOR_L2_NUMBERS_PER_L1;
}
BOOL OsArchMmuInit(LosArchMmu *archMmu, VADDR_T *virtTtb)
{
#ifdef LOSCFG_KERNEL_VM
if (OsAllocAsid(&archMmu->asid) != LOS_OK) {
VM_ERR("alloc arch mmu asid failed");
return FALSE;
}
#endif
status_t retval = LOS_MuxInit(&archMmu->mtx, NULL);
if (retval != LOS_OK) {
VM_ERR("Create mutex for arch mmu failed, status: %d", retval);
return FALSE;
}
#ifndef LOSCFG_PAGE_TABLE_FINE_LOCK
LOS_SpinInit(&archMmu->lock);
#endif
LOS_ListInit(&archMmu->ptList);
archMmu->virtTtb = virtTtb;
archMmu->physTtb = (VADDR_T)(UINTPTR)virtTtb - KERNEL_ASPACE_BASE + SYS_MEM_BASE;
@@ -432,45 +553,55 @@ STATUS_T LOS_ArchMmuQuery(const LosArchMmu *archMmu, VADDR_T vaddr, PADDR_T *pad
STATUS_T LOS_ArchMmuUnmap(LosArchMmu *archMmu, VADDR_T vaddr, size_t count)
{
PTE_T l1Entry;
PTE_T *l1Entry = NULL;
INT32 unmapped = 0;
UINT32 unmapCount = 0;
INT32 tryTime = TRY_MAX_TIMES;
while (count > 0) {
l1Entry = OsGetPte1(archMmu->virtTtb, vaddr);
if (OsIsPte1Invalid(l1Entry)) {
l1Entry = OsGetPte1Ptr(archMmu->virtTtb, vaddr);
if (OsIsPte1Invalid(*l1Entry)) {
unmapCount = OsUnmapL1Invalid(&vaddr, &count);
} else if (OsIsPte1Section(l1Entry)) {
} else if (OsIsPte1Section(*l1Entry)) {
if (MMU_DESCRIPTOR_IS_L1_SIZE_ALIGNED(vaddr) && count >= MMU_DESCRIPTOR_L2_NUMBERS_PER_L1) {
unmapCount = OsUnmapSection(archMmu, &vaddr, &count);
unmapCount = OsUnmapSection(archMmu, l1Entry, &vaddr, &count);
} else {
LOS_Panic("%s %d, unimplemented\n", __FUNCTION__, __LINE__);
}
} else if (OsIsPte1PageTable(l1Entry)) {
unmapCount = OsUnmapL2PTE(archMmu, vaddr, &count);
OsTryUnmapL1PTE(archMmu, vaddr, OsGetPte2Index(vaddr) + unmapCount,
MMU_DESCRIPTOR_L2_NUMBERS_PER_L1 - unmapCount);
} else if (OsIsPte1PageTable(*l1Entry)) {
unmapCount = OsUnmapL2PTE(archMmu, l1Entry, vaddr, &count);
OsTryUnmapL1PTE(archMmu, l1Entry, vaddr, OsGetPte2Index(vaddr) + unmapCount,
MMU_DESCRIPTOR_L2_NUMBERS_PER_L1);
vaddr += unmapCount << MMU_DESCRIPTOR_L2_SMALL_SHIFT;
} else {
LOS_Panic("%s %d, unimplemented\n", __FUNCTION__, __LINE__);
}
tryTime = (unmapCount == 0) ? (tryTime - 1) : tryTime;
if (tryTime == 0) {
return LOS_ERRNO_VM_FAULT;
}
unmapped += unmapCount;
}
OsArmInvalidateTlbBarrier();
return unmapped;
}
STATIC UINT32 OsMapSection(const LosArchMmu *archMmu, UINT32 flags, VADDR_T *vaddr,
PADDR_T *paddr, UINT32 *count)
STATIC UINT32 OsMapSection(MmuMapInfo *mmuMapInfo, UINT32 *count)
{
UINT32 mmuFlags = 0;
UINT32 intSave;
PADDR_T pte1Paddr;
SPIN_LOCK_S *lock = NULL;
mmuFlags |= OsCvtSecFlagsToAttrs(flags);
OsSavePte1(OsGetPte1Ptr(archMmu->virtTtb, *vaddr),
OsTruncPte1(*paddr) | mmuFlags | MMU_DESCRIPTOR_L1_TYPE_SECTION);
mmuFlags |= OsCvtSecFlagsToAttrs(*mmuMapInfo->flags);
pte1Paddr = OsGetPte1Paddr(mmuMapInfo->archMmu->physTtb, *mmuMapInfo->vaddr);
lock = OsGetPte1Lock(mmuMapInfo->archMmu, pte1Paddr, &intSave);
OsSavePte1(OsGetPte1Ptr(mmuMapInfo->archMmu->virtTtb, *mmuMapInfo->vaddr),
OsTruncPte1(*mmuMapInfo->paddr) | mmuFlags | MMU_DESCRIPTOR_L1_TYPE_SECTION);
OsUnlockPte1(lock, intSave);
*count -= MMU_DESCRIPTOR_L2_NUMBERS_PER_L1;
*vaddr += MMU_DESCRIPTOR_L1_SMALL_SIZE;
*paddr += MMU_DESCRIPTOR_L1_SMALL_SIZE;
*mmuMapInfo->vaddr += MMU_DESCRIPTOR_L1_SMALL_SIZE;
*mmuMapInfo->paddr += MMU_DESCRIPTOR_L1_SMALL_SIZE;
return MMU_DESCRIPTOR_L2_NUMBERS_PER_L1;
}
@@ -480,7 +611,6 @@ STATIC STATUS_T OsGetL2Table(LosArchMmu *archMmu, UINT32 l1Index, paddr_t *ppa)
UINT32 index;
PTE_T ttEntry;
VADDR_T *kvaddr = NULL;
LosVmPage *vmPage = NULL;
UINT32 l2Offset = (MMU_DESCRIPTOR_L2_SMALL_SIZE / MMU_DESCRIPTOR_L1_SMALL_L2_TABLES_PER_PAGE) *
(l1Index & (MMU_DESCRIPTOR_L1_SMALL_L2_TABLES_PER_PAGE - 1));
/* lookup an existing l2 page table */
@@ -493,45 +623,36 @@ STATIC STATUS_T OsGetL2Table(LosArchMmu *archMmu, UINT32 l1Index, paddr_t *ppa)
}
}
#ifdef LOSCFG_KERNEL_VM
/* not found: allocate one (paddr) */
vmPage = LOS_PhysPageAlloc();
LosVmPage *vmPage = LOS_PhysPageAlloc();
if (vmPage == NULL) {
VM_ERR("have no memory to save l2 page");
return LOS_ERRNO_VM_NO_MEMORY;
}
LOS_ListAdd(&archMmu->ptList, &vmPage->node);
kvaddr = OsVmPageToVaddr(vmPage);
#else
kvaddr = LOS_MemAlloc(OS_SYS_MEM_ADDR, MMU_DESCRIPTOR_L2_SMALL_SIZE);
if (kvaddr == NULL) {
VM_ERR("have no memory to save l2 page");
return LOS_ERRNO_VM_NO_MEMORY;
}
#endif
(VOID)memset_s(kvaddr, MMU_DESCRIPTOR_L2_SMALL_SIZE, 0, MMU_DESCRIPTOR_L2_SMALL_SIZE);
/* get physical address */
*ppa = LOS_PaddrQuery(kvaddr) + l2Offset;
*ppa = OsKVaddrToPaddr((VADDR_T)kvaddr) + l2Offset;
return LOS_OK;
}
STATIC VOID OsMapL1PTE(LosArchMmu *archMmu, PTE_T *pte1Ptr, vaddr_t vaddr, UINT32 flags)
{
paddr_t pte2Base = 0;
if (OsGetL2Table(archMmu, OsGetPte1Index(vaddr), &pte2Base) != LOS_OK) {
LOS_Panic("%s %d, failed to allocate pagetable\n", __FUNCTION__, __LINE__);
}
*pte1Ptr = pte2Base | MMU_DESCRIPTOR_L1_TYPE_PAGE_TABLE;
if (flags & VM_MAP_REGION_FLAG_NS) {
*pte1Ptr |= MMU_DESCRIPTOR_L1_PAGETABLE_NON_SECURE;
}
*pte1Ptr &= MMU_DESCRIPTOR_L1_SMALL_DOMAIN_MASK;
*pte1Ptr |= MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT; // use client AP
OsSavePte1(OsGetPte1Ptr(archMmu->virtTtb, vaddr), *pte1Ptr);
}
STATIC UINT32 OsCvtPte2CacheFlagsToMMUFlags(UINT32 flags)
{
UINT32 mmuFlags = 0;
switch (flags & VM_MAP_REGION_FLAG_CACHE_MASK) {
case VM_MAP_REGION_FLAG_CACHED:
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
mmuFlags |= MMU_DESCRIPTOR_L2_SHAREABLE;
#endif
mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_NORMAL_WRITE_BACK_ALLOCATE;
@@ -605,32 +726,93 @@ STATIC UINT32 OsCvtPte2FlagsToAttrs(UINT32 flags)
return mmuFlags;
}
STATIC UINT32 OsMapL2PageContinous(PTE_T pte1, UINT32 flags, VADDR_T *vaddr, PADDR_T *paddr, UINT32 *count)
STATIC UINT32 OsMapL1PTE(MmuMapInfo *mmuMapInfo, PTE_T *l1Entry, UINT32 *count)
{
PADDR_T pte2Base = 0;
PADDR_T pte1Paddr;
SPIN_LOCK_S *pte1Lock = NULL;
SPIN_LOCK_S *pte2Lock = NULL;
PTE_T *pte2BasePtr = NULL;
UINT32 saveCounts, archFlags, pte1IntSave, pte2IntSave;
pte1Paddr = OsGetPte1Paddr(mmuMapInfo->archMmu->physTtb, *mmuMapInfo->vaddr);
pte1Lock = OsGetPte1Lock(mmuMapInfo->archMmu, pte1Paddr, &pte1IntSave);
if (!OsIsPte1Invalid(*l1Entry)) {
OsUnlockPte1(pte1Lock, pte1IntSave);
return 0;
}
if (OsGetL2Table(mmuMapInfo->archMmu, OsGetPte1Index(*mmuMapInfo->vaddr), &pte2Base) != LOS_OK) {
LOS_Panic("%s %d, failed to allocate pagetable\n", __FUNCTION__, __LINE__);
}
*l1Entry = pte2Base | MMU_DESCRIPTOR_L1_TYPE_PAGE_TABLE;
if (*mmuMapInfo->flags & VM_MAP_REGION_FLAG_NS) {
*l1Entry |= MMU_DESCRIPTOR_L1_PAGETABLE_NON_SECURE;
}
*l1Entry &= MMU_DESCRIPTOR_L1_SMALL_DOMAIN_MASK;
*l1Entry |= MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT; // use client AP
OsSavePte1(OsGetPte1Ptr(mmuMapInfo->archMmu->virtTtb, *mmuMapInfo->vaddr), *l1Entry);
OsUnlockPte1(pte1Lock, pte1IntSave);
pte2Lock = OsGetPte2Lock(mmuMapInfo->archMmu, *l1Entry, &pte2IntSave);
if (pte2Lock == NULL) {
LOS_Panic("pte2 should not be null!\n");
}
pte2BasePtr = (PTE_T *)LOS_PaddrToKVaddr(pte2Base);
/* compute the arch flags for L2 4K pages */
archFlags = OsCvtPte2FlagsToAttrs(*mmuMapInfo->flags);
saveCounts = OsSavePte2Continuous(pte2BasePtr, OsGetPte2Index(*mmuMapInfo->vaddr), *mmuMapInfo->paddr | archFlags,
*count);
OsUnlockPte2(pte2Lock, pte2IntSave);
*mmuMapInfo->paddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
*mmuMapInfo->vaddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
*count -= saveCounts;
return saveCounts;
}
STATIC UINT32 OsMapL2PageContinous(MmuMapInfo *mmuMapInfo, PTE_T *pte1, UINT32 *count)
{
PTE_T *pte2BasePtr = NULL;
UINT32 archFlags;
UINT32 saveCounts;
UINT32 intSave;
SPIN_LOCK_S *lock = NULL;
pte2BasePtr = OsGetPte2BasePtr(pte1);
lock = OsGetPte2Lock(mmuMapInfo->archMmu, *pte1, &intSave);
if (lock == NULL) {
return 0;
}
pte2BasePtr = OsGetPte2BasePtr(*pte1);
if (pte2BasePtr == NULL) {
LOS_Panic("%s %d, pte1 %#x error\n", __FUNCTION__, __LINE__, pte1);
OsUnlockPte2(lock, intSave);
return 0;
}
/* compute the arch flags for L2 4K pages */
archFlags = OsCvtPte2FlagsToAttrs(flags);
saveCounts = OsSavePte2Continuous(pte2BasePtr, OsGetPte2Index(*vaddr), *paddr | archFlags, *count);
*paddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
*vaddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
archFlags = OsCvtPte2FlagsToAttrs(*mmuMapInfo->flags);
saveCounts = OsSavePte2Continuous(pte2BasePtr, OsGetPte2Index(*mmuMapInfo->vaddr), *mmuMapInfo->paddr | archFlags,
*count);
OsUnlockPte2(lock, intSave);
*mmuMapInfo->paddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
*mmuMapInfo->vaddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
*count -= saveCounts;
return saveCounts;
}
status_t LOS_ArchMmuMap(LosArchMmu *archMmu, VADDR_T vaddr, PADDR_T paddr, size_t count, UINT32 flags)
{
PTE_T l1Entry;
PTE_T *l1Entry = NULL;
UINT32 saveCounts = 0;
INT32 mapped = 0;
INT32 tryTime = TRY_MAX_TIMES;
INT32 checkRst;
MmuMapInfo mmuMapInfo = {
.archMmu = archMmu,
.vaddr = &vaddr,
.paddr = &paddr,
.flags = &flags,
};
checkRst = OsMapParamCheck(flags, vaddr, paddr);
if (checkRst < 0) {
@@ -639,24 +821,27 @@ status_t LOS_ArchMmuMap(LosArchMmu *archMmu, VADDR_T vaddr, PADDR_T paddr, size_
/* see what kind of mapping we can use */
while (count > 0) {
if (MMU_DESCRIPTOR_IS_L1_SIZE_ALIGNED(vaddr) &&
MMU_DESCRIPTOR_IS_L1_SIZE_ALIGNED(paddr) &&
if (MMU_DESCRIPTOR_IS_L1_SIZE_ALIGNED(*mmuMapInfo.vaddr) &&
MMU_DESCRIPTOR_IS_L1_SIZE_ALIGNED(*mmuMapInfo.paddr) &&
count >= MMU_DESCRIPTOR_L2_NUMBERS_PER_L1) {
/* compute the arch flags for L1 sections cache, r ,w ,x, domain and type */
saveCounts = OsMapSection(archMmu, flags, &vaddr, &paddr, &count);
saveCounts = OsMapSection(&mmuMapInfo, &count);
} else {
/* have to use a L2 mapping, we only allocate 4KB for L1, support 0 ~ 1GB */
l1Entry = OsGetPte1(archMmu->virtTtb, vaddr);
if (OsIsPte1Invalid(l1Entry)) {
OsMapL1PTE(archMmu, &l1Entry, vaddr, flags);
saveCounts = OsMapL2PageContinous(l1Entry, flags, &vaddr, &paddr, &count);
} else if (OsIsPte1PageTable(l1Entry)) {
saveCounts = OsMapL2PageContinous(l1Entry, flags, &vaddr, &paddr, &count);
l1Entry = OsGetPte1Ptr(archMmu->virtTtb, *mmuMapInfo.vaddr);
if (OsIsPte1Invalid(*l1Entry)) {
saveCounts = OsMapL1PTE(&mmuMapInfo, l1Entry, &count);
} else if (OsIsPte1PageTable(*l1Entry)) {
saveCounts = OsMapL2PageContinous(&mmuMapInfo, l1Entry, &count);
} else {
LOS_Panic("%s %d, unimplemented tt_entry %x\n", __FUNCTION__, __LINE__, l1Entry);
}
}
mapped += saveCounts;
tryTime = (saveCounts == 0) ? (tryTime - 1) : tryTime;
if (tryTime == 0) {
return LOS_ERRNO_VM_TIMED_OUT;
}
}
return mapped;
@@ -703,7 +888,7 @@ STATUS_T LOS_ArchMmuMove(LosArchMmu *archMmu, VADDR_T oldVaddr, VADDR_T newVaddr
PADDR_T paddr = 0;
if ((archMmu == NULL) || (oldVaddr == 0) || (newVaddr == 0) || (count == 0)) {
VM_ERR("invalid args: archMmu %p, oldVaddr %p, newVddr %p, count %d",
VM_ERR("invalid args: archMmu %p, oldVaddr %p, newVaddr %p, count %d",
archMmu, oldVaddr, newVaddr, count);
return LOS_NOK;
}
@@ -751,30 +936,35 @@ VOID LOS_ArchMmuContextSwitch(LosArchMmu *archMmu)
ttbcr |= MMU_DESCRIPTOR_TTBCR_PD0;
}
#ifdef LOSCFG_KERNEL_VM
/* from armv7a arm B3.10.4, we should do synchronization changes of ASID and TTBR. */
OsArmWriteContextidr(LOS_GetKVmSpace()->archMmu.asid);
ISB;
#endif
OsArmWriteTtbr0(ttbr);
ISB;
OsArmWriteTtbcr(ttbcr);
ISB;
#ifdef LOSCFG_KERNEL_VM
if (archMmu) {
OsArmWriteContextidr(archMmu->asid);
ISB;
}
#endif
}
STATUS_T LOS_ArchMmuDestroy(LosArchMmu *archMmu)
{
#ifdef LOSCFG_KERNEL_VM
LosVmPage *page = NULL;
/* free all of the pages allocated in archMmu->ptList */
while ((page = LOS_ListRemoveHeadType(&archMmu->ptList, LosVmPage, node)) != NULL) {
LOS_PhysPageFree(page);
}
OsArmWriteTlbiasid(archMmu->asid);
OsArmWriteTlbiasidis(archMmu->asid);
OsFreeAsid(archMmu->asid);
(VOID)LOS_MuxDestroy(&archMmu->mtx);
#endif
return LOS_OK;
}
@@ -806,38 +996,34 @@ STATIC VOID OsSwitchTmpTTB(VOID)
ISB;
}
VADDR_T *OsGFirstTableGet()
{
return (VADDR_T *)g_firstPageTable;
}
STATIC VOID OsSetKSectionAttr(VOID)
STATIC VOID OsSetKSectionAttr(UINTPTR virtAddr, BOOL uncached)
{
UINT32 offset = virtAddr - KERNEL_VMM_BASE;
/* every section should be page aligned */
UINTPTR textStart = (UINTPTR)&__text_start;
UINTPTR textEnd = (UINTPTR)&__text_end;
UINTPTR rodataStart = (UINTPTR)&__rodata_start;
UINTPTR rodataEnd = (UINTPTR)&__rodata_end;
UINTPTR ramDataStart = (UINTPTR)&__ram_data_start;
UINTPTR bssEnd = (UINTPTR)&__bss_end;
UINTPTR textStart = (UINTPTR)&__text_start + offset;
UINTPTR textEnd = (UINTPTR)&__text_end + offset;
UINTPTR rodataStart = (UINTPTR)&__rodata_start + offset;
UINTPTR rodataEnd = (UINTPTR)&__rodata_end + offset;
UINTPTR ramDataStart = (UINTPTR)&__ram_data_start + offset;
UINTPTR bssEnd = (UINTPTR)&__bss_end + offset;
UINT32 bssEndBoundary = ROUNDUP(bssEnd, MB);
LosArchMmuInitMapping mmuKernelMappings[] = {
{
.phys = SYS_MEM_BASE + textStart - KERNEL_VMM_BASE,
.phys = SYS_MEM_BASE + textStart - virtAddr,
.virt = textStart,
.size = ROUNDUP(textEnd - textStart, MMU_DESCRIPTOR_L2_SMALL_SIZE),
.flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_EXECUTE,
.name = "kernel_text"
},
{
.phys = SYS_MEM_BASE + rodataStart - KERNEL_VMM_BASE,
.phys = SYS_MEM_BASE + rodataStart - virtAddr,
.virt = rodataStart,
.size = ROUNDUP(rodataEnd - rodataStart, MMU_DESCRIPTOR_L2_SMALL_SIZE),
.flags = VM_MAP_REGION_FLAG_PERM_READ,
.name = "kernel_rodata"
},
{
.phys = SYS_MEM_BASE + ramDataStart - KERNEL_VMM_BASE,
.phys = SYS_MEM_BASE + ramDataStart - virtAddr,
.virt = ramDataStart,
.size = ROUNDUP(bssEndBoundary - ramDataStart, MMU_DESCRIPTOR_L2_SMALL_SIZE),
.flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE,
@@ -847,26 +1033,29 @@ STATIC VOID OsSetKSectionAttr(VOID)
LosVmSpace *kSpace = LOS_GetKVmSpace();
status_t status;
UINT32 length;
paddr_t oldTtPhyBase;
int i;
INT32 i;
LosArchMmuInitMapping *kernelMap = NULL;
UINT32 kmallocLength;
UINT32 flags;
/* use second-level mapping of default READ and WRITE */
kSpace->archMmu.virtTtb = (PTE_T *)g_firstPageTable;
kSpace->archMmu.physTtb = LOS_PaddrQuery(kSpace->archMmu.virtTtb);
status = LOS_ArchMmuUnmap(&kSpace->archMmu, KERNEL_VMM_BASE,
(bssEndBoundary - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT);
if (status != ((bssEndBoundary - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
status = LOS_ArchMmuUnmap(&kSpace->archMmu, virtAddr,
(bssEndBoundary - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT);
if (status != ((bssEndBoundary - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
VM_ERR("unmap failed, status: %d", status);
return;
}
status = LOS_ArchMmuMap(&kSpace->archMmu, KERNEL_VMM_BASE, SYS_MEM_BASE,
(textStart - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE |
VM_MAP_REGION_FLAG_PERM_EXECUTE);
if (status != ((textStart - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE | VM_MAP_REGION_FLAG_PERM_EXECUTE;
if (uncached) {
flags |= VM_MAP_REGION_FLAG_UNCACHED;
}
status = LOS_ArchMmuMap(&kSpace->archMmu, virtAddr, SYS_MEM_BASE,
(textStart - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
flags);
if (status != ((textStart - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
VM_ERR("mmap failed, status: %d", status);
return;
}
@@ -874,6 +1063,9 @@ STATIC VOID OsSetKSectionAttr(VOID)
length = sizeof(mmuKernelMappings) / sizeof(LosArchMmuInitMapping);
for (i = 0; i < length; i++) {
kernelMap = &mmuKernelMappings[i];
if (uncached) {
kernelMap->flags |= VM_MAP_REGION_FLAG_UNCACHED;
}
status = LOS_ArchMmuMap(&kSpace->archMmu, kernelMap->virt, kernelMap->phys,
kernelMap->size >> MMU_DESCRIPTOR_L2_SMALL_SHIFT, kernelMap->flags);
if (status != (kernelMap->size >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
@@ -883,16 +1075,29 @@ STATIC VOID OsSetKSectionAttr(VOID)
LOS_VmSpaceReserve(kSpace, kernelMap->size, kernelMap->virt);
}
kmallocLength = KERNEL_VMM_BASE + SYS_MEM_SIZE_DEFAULT - bssEndBoundary;
kmallocLength = virtAddr + SYS_MEM_SIZE_DEFAULT - bssEndBoundary;
flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE;
if (uncached) {
flags |= VM_MAP_REGION_FLAG_UNCACHED;
}
status = LOS_ArchMmuMap(&kSpace->archMmu, bssEndBoundary,
SYS_MEM_BASE + bssEndBoundary - KERNEL_VMM_BASE,
kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE);
SYS_MEM_BASE + bssEndBoundary - virtAddr,
kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
flags);
if (status != (kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
VM_ERR("mmap failed, status: %d", status);
return;
}
LOS_VmSpaceReserve(kSpace, kmallocLength, bssEndBoundary);
}
STATIC VOID OsKSectionNewAttrEnable(VOID)
{
LosVmSpace *kSpace = LOS_GetKVmSpace();
paddr_t oldTtPhyBase;
kSpace->archMmu.virtTtb = (PTE_T *)g_firstPageTable;
kSpace->archMmu.physTtb = LOS_PaddrQuery(kSpace->archMmu.virtTtb);
/* we need free tmp ttbase */
oldTtPhyBase = OsArmReadTtbr0();
@@ -926,14 +1131,9 @@ VOID OsInitMappingStartUp(VOID)
OsSwitchTmpTTB();
OsSetKSectionAttr();
OsArchMmuInitPerCPU();
OsSetKSectionAttr(KERNEL_VMM_BASE, FALSE);
OsSetKSectionAttr(UNCACHED_VMM_BASE, TRUE);
OsKSectionNewAttrEnable();
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif

View File

@@ -39,11 +39,8 @@
#include "los_spinlock.h"
#include "los_mmu_descriptor_v6.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef LOSCFG_KERNEL_VM
STATIC SPIN_LOCK_INIT(g_cpuAsidLock);
STATIC UINTPTR g_asidPool[BITMAP_NUM_WORDS(1UL << MMU_ARM_ASID_BITS)];
@@ -72,9 +69,5 @@ VOID OsFreeAsid(UINT32 asid)
LOS_BitmapClrNBits(g_asidPool, asid, 1);
LOS_SpinUnlockRestore(&g_cpuAsidLock, flags);
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

153
arch/arm/arm/src/los_dispatch.S Executable file → Normal file
View File

@@ -32,6 +32,7 @@
#include "asm.h"
#include "arch_config.h"
.extern OsSaveSignalContext
.extern OsSchedToUserReleaseLock
.global OsTaskSchedule
.global OsTaskContextLoad
@@ -85,17 +86,16 @@
*/
OsTaskSchedule:
MRS R2, CPSR
STMFD SP!, {LR}
STMFD SP!, {LR}
/* jump sp */
SUB SP, SP, #4
/* push r0-r12*/
STMFD SP!, {R0-R12}
STMFD SP!, {R2}
STMFD SP!, {LR}
STMFD SP!, {LR}
STMFD SP!, {R12}
/* 8 bytes stack align */
SUB SP, SP, #4
/* jump R0 - R3 USP, ULR reserved */
SUB SP, SP, #(8 * 4)
/* push R4 - R11*/
STMFD SP!, {R4-R11}
/* save fpu registers */
PUSH_FPU_REGS R2
@@ -113,131 +113,96 @@ OsTaskContextLoad:
/* restore fpu registers */
POP_FPU_REGS R2
/* 8 bytes stack align */
ADD SP, SP, #4
LDMFD SP!, {R0}
MOV R4, R0
AND R0, R0, #CPSR_MASK_MODE
LDMFD SP!, {R4-R11}
LDR R3, [SP, #(11 * 4)]
AND R0, R3, #CPSR_MASK_MODE
CMP R0, #CPSR_USER_MODE
BNE OsKernelTaskLoad
MVN R2, #CPSR_INT_DISABLE
AND R3, R3, R2
STR R3, [SP, #(11 * 4)]
#ifdef LOSCFG_KERNEL_SMP
/* 8 bytes stack align */
SUB SP, SP, #4
BL OsSchedToUserReleaseLock
ADD SP, SP, #4
#endif
MVN R3, #CPSR_INT_DISABLE
AND R4, R4, R3
MSR SPSR_cxsf, R4
/* restore r0-r12, lr */
LDMFD SP!, {R0-R12}
/* jump sp, reserved */
ADD SP, SP, #(2 * 4)
LDMFD SP, {R13, R14}^
ADD SP, SP, #(2 * 4)
LDMFD SP!, {PC}^
LDMFD SP!, {R0-R3, R12, LR}
RFEIA SP!
OsKernelTaskLoad:
MSR SPSR_cxsf, R4
/* restore r0-r12, lr */
LDMFD SP!, {R0-R12}
ADD SP, SP, #4
LDMFD SP!, {LR, PC}^
ADD SP, SP, #(4 * 4)
LDMFD SP!, {R0-R3, R12, LR}
RFEIA SP!
OsIrqHandler:
SUB LR, LR, #4
/* push r0-r3 to irq stack */
STMFD SP, {R0-R3}
SUB R0, SP, #(4 * 4)
MRS R1, SPSR
MOV R2, LR
/* Save pc and cpsr to svc sp, ARMv6 and above support */
SRSFD #0x13!
/* disable irq, switch to svc mode */
CPSID i, #0x13
/* push spsr and pc in svc stack */
STMFD SP!, {R1, R2}
STMFD SP, {LR}
#ifdef LOSCFG_KERNEL_PERF
PUSH {R0-R3, R12, LR}
MOV R0, LR
MOV R1, FP
BL OsPerfSetIrqRegs
POP {R0-R3, R12, LR}
#endif
AND R3, R1, #CPSR_MASK_MODE
CMP R3, #CPSR_USER_MODE
BNE OsIrqFromKernel
/* push user sp, lr in svc stack */
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
OsIrqFromKernel:
/* from svc not need save sp and lr */
SUB SP, SP, #(2 * 4)
/* pop r0-r3 form irq stack*/
LDMFD R0, {R0-R3}
/* push caller saved regs as trashed regs in svc stack */
STMFD SP!, {R0-R3, R12}
/* 8 bytes stack align */
SUB SP, SP, #4
SUB SP, SP, #(4 * 4)
STR R4, [SP, #0]
/*
* save fpu regs in case in case those been
* altered in interrupt handlers.
*/
PUSH_FPU_REGS R0
#ifdef LOSCFG_IRQ_USE_STANDALONE_STACK
PUSH {R4}
MOV R4, SP
EXC_SP_SET __svc_stack_top, OS_EXC_SVC_STACK_SIZE, R1, R2
#endif
BLX HalIrqHandler
#ifdef LOSCFG_IRQ_USE_STANDALONE_STACK
MOV SP, R4
POP {R4}
#endif
/* process pending signals */
BL OsTaskProcSignal
BL OsSchedIrqEndCheckNeedSched
MOV R0,SP
MOV R1,R7
BL OsSaveSignalContextIrq
BLX OsTaskProcSignal
BLX OsSchedIrqEndCheckNeedSched
/* restore fpu regs */
POP_FPU_REGS R0
POP_FPU_REGS R0
LDR R4, [SP, #0]
ADD SP, SP, #4
OsIrqContextRestore:
LDR R0, [SP, #(4 * 7)]
MSR SPSR_cxsf, R0
AND R0, R0, #CPSR_MASK_MODE
CMP R0, #CPSR_USER_MODE
LDMFD SP!, {R0-R3, R12}
BNE OsIrqContextRestoreToKernel
#ifdef LOSCFG_KERNEL_VM
/* Obtain the CPSR to determine the mode the system is in when the interrupt is triggered */
LDR R3, [SP, #(11 * 4)]
AND R1, R3, #CPSR_MASK_MODE
CMP R1, #CPSR_USER_MODE
BNE 1f
MOV R0, SP
STR R7, [SP, #0]
/* sp - sizeof(IrqContext) */
SUB SP, SP, #(12 * 4)
MOV R1, SP
BLX OsSaveSignalContext
MOV SP, R0
1:
#endif
ADD SP, SP, #(2 * 4)
/* load user sp and lr, and jump cpsr */
LDMFD SP, {R13, R14}^
ADD SP, SP, #(3 * 4)
/* return to user mode */
LDMFD SP!, {PC}^
OsIrqContextRestoreToKernel:
/* svc mode not load sp */
ADD SP, SP, #4
LDMFD SP!, {LR}
/* jump cpsr and return to svc mode */
ADD SP, SP, #4
LDMFD SP!, {PC}^
ADD SP, SP, #(2 * 4)
LDMFD SP!, {R0-R3, R12, LR}
RFEIA SP!
FUNCTION(ArchSpinLock)
mov r1, #1

500
arch/arm/arm/src/los_exc.c Executable file → Normal file
View File

@@ -33,15 +33,12 @@
#include "los_memory_pri.h"
#include "los_printf_pri.h"
#include "los_task_pri.h"
#include "los_percpu_pri.h"
#include "los_hw_pri.h"
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
#include "los_excinfo_pri.h"
#endif
#ifdef LOSCFG_EXC_INTERACTION
#include "los_exc_interaction_pri.h"
#endif
#include "los_sys_stack_pri.h"
#include "los_stackinfo_pri.h"
#ifdef LOSCFG_COREDUMP
#include "los_coredump.h"
#endif
@@ -55,20 +52,21 @@
#include "los_vm_phys.h"
#include "los_vm_fault.h"
#include "los_vm_common.h"
#ifdef LOSCFG_KERNEL_DYNLOAD
#include "los_load_elf.h"
#endif
#include "arm.h"
#include "los_bitmap.h"
#include "los_process_pri.h"
#include "los_exc_pri.h"
#include "los_sched_pri.h"
#ifdef LOSCFG_FS_VFS
#include "console.h"
#endif
#ifdef LOSCFG_BLACKBOX
#include "los_blackbox.h"
#endif
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define INVALID_CPUID 0xFFFF
#define OS_EXC_VMM_NO_REGION 0x0U
@@ -76,12 +74,12 @@ extern "C" {
STATIC UINTPTR g_minAddr;
STATIC UINTPTR g_maxAddr;
STATIC UINT32 g_currHandleExcCpuID = INVALID_CPUID;
STATIC UINT32 g_currHandleExcCpuid = INVALID_CPUID;
VOID OsExcHook(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr);
UINT32 g_curNestCount[LOSCFG_KERNEL_CORE_NUM] = { 0 };
BOOL g_excFromUserMode[LOSCFG_KERNEL_CORE_NUM];
STATIC EXC_PROC_FUNC g_excHook = (EXC_PROC_FUNC)OsExcHook;
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
STATIC SPIN_LOCK_INIT(g_excSerializerSpin);
STATIC UINT32 g_currHandleExcPID = OS_INVALID_VALUE;
STATIC UINT32 g_nextExcWaitCpu = INVALID_CPUID;
@@ -90,6 +88,7 @@ STATIC UINT32 g_nextExcWaitCpu = INVALID_CPUID;
#define OS_MAX_BACKTRACE 15U
#define DUMPSIZE 128U
#define DUMPREGS 12U
#define COM_REGS 4U
#define INSTR_SET_MASK 0x01000020U
#define THUMB_INSTR_LEN 2U
#define ARM_INSTR_LEN 4U
@@ -107,22 +106,18 @@ STATIC UINT32 g_nextExcWaitCpu = INVALID_CPUID;
(IS_ALIGNED((ptr), sizeof(CHAR *))))
STATIC const StackInfo g_excStack[] = {
{ &__undef_stack, OS_EXC_UNDEF_STACK_SIZE, "udf_stack" },
{ &__abt_stack, OS_EXC_ABT_STACK_SIZE, "abt_stack" },
{ &__fiq_stack, OS_EXC_FIQ_STACK_SIZE, "fiq_stack" },
{ &__svc_stack, OS_EXC_SVC_STACK_SIZE, "svc_stack" },
{ &__irq_stack, OS_EXC_IRQ_STACK_SIZE, "irq_stack" },
{ &__exc_stack, OS_EXC_STACK_SIZE, "exc_stack" }
};
UINT32 OsGetSystemStatus(VOID)
{
UINT32 flag;
UINT32 cpuID = g_currHandleExcCpuID;
UINT32 cpuid = g_currHandleExcCpuid;
if (cpuID == INVALID_CPUID) {
if (cpuid == INVALID_CPUID) {
flag = OS_SYSTEM_NORMAL;
} else if (cpuID == ArchCurrCpuid()) {
} else if (cpuid == ArchCurrCpuid()) {
flag = OS_SYSTEM_EXC_CURR_CPU;
} else {
flag = OS_SYSTEM_EXC_OTHER_CPU;
@@ -185,20 +180,32 @@ STATIC INT32 OsDecodeDataFSR(UINT32 regDFSR)
return ret;
}
#ifdef LOSCFG_KERNEL_VM
UINT32 OsArmSharedPageFault(UINT32 excType, ExcContext *frame, UINT32 far, UINT32 fsr)
{
PRINT_INFO("page fault entry!!!\n");
BOOL instruction_fault = FALSE;
BOOL instructionFault = FALSE;
UINT32 pfFlags = 0;
UINT32 fsrFlag;
BOOL write = FALSE;
UINT32 ret;
PRINT_INFO("page fault entry!!!\n");
if (OsGetSystemStatus() == OS_SYSTEM_EXC_CURR_CPU) {
return LOS_ERRNO_VM_NOT_FOUND;
}
#if defined(LOSCFG_KERNEL_SMP) && defined(LOSCFG_DEBUG_VERSION)
BOOL irqEnable = !(LOS_SpinHeld(&g_taskSpin) && OsSchedIsLock());
if (irqEnable) {
ArchIrqEnable();
} else {
PrintExcInfo("[ERR][%s] may be held scheduler lock when entering [%s] on cpu [%u]\n",
OsCurrTaskGet()->taskName, __FUNCTION__, ArchCurrCpuid());
}
#else
ArchIrqEnable();
#endif
if (excType == OS_EXCEPT_PREFETCH_ABORT) {
instruction_fault = TRUE;
instructionFault = TRUE;
} else {
write = !!BIT_GET(fsr, WNR_BIT);
}
@@ -216,18 +223,32 @@ UINT32 OsArmSharedPageFault(UINT32 excType, ExcContext *frame, UINT32 far, UINT3
BOOL user = (frame->regCPSR & CPSR_MODE_MASK) == CPSR_MODE_USR;
pfFlags |= write ? VM_MAP_PF_FLAG_WRITE : 0;
pfFlags |= user ? VM_MAP_PF_FLAG_USER : 0;
pfFlags |= instruction_fault ? VM_MAP_PF_FLAG_INSTRUCTION : 0;
pfFlags |= instructionFault ? VM_MAP_PF_FLAG_INSTRUCTION : 0;
pfFlags |= VM_MAP_PF_FLAG_NOT_PRESENT;
return OsVmPageFaultHandler(far, pfFlags, frame);
OsSigIntLock();
ret = OsVmPageFaultHandler(far, pfFlags, frame);
OsSigIntUnlock();
break;
}
default:
return LOS_ERRNO_VM_NOT_FOUND;
OsArmWriteTlbimvaais(ROUNDDOWN(far, PAGE_SIZE));
ret = LOS_OK;
break;
}
#if defined(LOSCFG_KERNEL_SMP) && defined(LOSCFG_DEBUG_VERSION)
if (irqEnable) {
ArchIrqDisable();
}
#else
ArchIrqDisable();
#endif
return ret;
}
#endif
STATIC VOID OsExcType(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr)
{
/* undefinited exception handling or software interrupt */
/* undefined exception handling or software interrupt */
if ((excType == OS_EXCEPT_UNDEF_INSTR) || (excType == OS_EXCEPT_SWI)) {
if ((excBufAddr->regCPSR & INSTR_SET_MASK) == 0) { /* work status: ARM */
excBufAddr->PC = excBufAddr->PC - ARM_INSTR_LEN;
@@ -256,10 +277,11 @@ STATIC const CHAR *g_excTypeString[] = {
"irq"
};
#ifdef LOSCFG_KERNEL_VM
STATIC VADDR_T OsGetTextRegionBase(LosVmMapRegion *region, LosProcessCB *runProcess)
{
struct file *curFilep = NULL;
struct file *lastFilep = NULL;
struct Vnode *curVnode = NULL;
struct Vnode *lastVnode = NULL;
LosVmMapRegion *curRegion = NULL;
LosVmMapRegion *lastRegion = NULL;
@@ -278,46 +300,57 @@ STATIC VADDR_T OsGetTextRegionBase(LosVmMapRegion *region, LosProcessCB *runProc
if ((lastRegion == NULL) || !LOS_IsRegionFileValid(lastRegion)) {
goto DONE;
}
curFilep = curRegion->unTypeData.rf.file;
lastFilep = lastRegion->unTypeData.rf.file;
} while (!strcmp(curFilep->f_path, lastFilep->f_path));
curVnode = curRegion->unTypeData.rf.vnode;
lastVnode = lastRegion->unTypeData.rf.vnode;
} while (curVnode == lastVnode);
DONE:
#ifdef LOSCFG_KERNEL_DYNLOAD
if (curRegion->range.base == EXEC_MMAP_BASE) {
return 0;
}
#endif
return curRegion->range.base;
}
#endif
STATIC VOID OsExcSysInfo(UINT32 excType, const ExcContext *excBufAddr)
{
LosTaskCB *runTask = OsCurrTaskGet();
LosProcessCB *runProcess = OsCurrProcessGet();
LosVmMapRegion *region = NULL;
PrintExcInfo("excType: %s\n"
"processName = %s\n"
"processID = %u\n"
#ifdef LOSCFG_KERNEL_VM
"process aspace = 0x%08x -> 0x%08x\n"
#endif
"taskName = %s\n"
"taskID = %u\n",
g_excTypeString[excType],
runProcess->processName,
runProcess->processID,
#ifdef LOSCFG_KERNEL_VM
runProcess->vmSpace->base,
runProcess->vmSpace->base + runProcess->vmSpace->size,
#endif
runTask->taskName,
runTask->taskID);
#ifdef LOSCFG_KERNEL_VM
if (OsProcessIsUserMode(runProcess)) {
PrintExcInfo("task user stack = 0x%08x -> 0x%08x\n",
runTask->userMapBase, runTask->userMapBase + runTask->userMapSize);
} else {
} else
#endif
{
PrintExcInfo("task kernel stack = 0x%08x -> 0x%08x\n",
runTask->topOfStack, runTask->topOfStack + runTask->stackSize);
}
PrintExcInfo("pc = 0x%x ", excBufAddr->PC);
#ifdef LOSCFG_KERNEL_VM
LosVmMapRegion *region = NULL;
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
if (LOS_IsUserAddress((vaddr_t)excBufAddr->PC)) {
region = LOS_RegionFind(runProcess->vmSpace, (VADDR_T)excBufAddr->PC);
@@ -334,7 +367,9 @@ STATIC VOID OsExcSysInfo(UINT32 excType, const ExcContext *excBufAddr)
(VADDR_T)excBufAddr->ULR - OsGetTextRegionBase(region, runProcess));
}
PrintExcInfo("\nusp = 0x%x", excBufAddr->USP);
} else {
} else
#endif
{
PrintExcInfo("\nklr = 0x%x\n"
"ksp = 0x%x\n",
excBufAddr->LR,
@@ -386,6 +421,7 @@ EXC_PROC_FUNC OsExcRegHookGet(VOID)
return g_excHook;
}
#ifdef LOSCFG_KERNEL_VM
STATIC VOID OsDumpExcVaddrRegion(LosVmSpace *space, LosVmMapRegion *region)
{
INT32 i, numPages, pageCount;
@@ -447,7 +483,7 @@ STATIC VOID OsDumpProcessUsedMemRegion(LosProcessCB *runProcess, LosVmSpace *run
RB_SCAN_SAFE_END(&space->regionRbTree, pstRbNodeTemp, pstRbNodeNext)
}
STATIC VOID OsDumpProcessUsedMemNode(UINT16 vmmFalgs)
STATIC VOID OsDumpProcessUsedMemNode(UINT16 vmmFlags)
{
LosProcessCB *runProcess = NULL;
LosVmSpace *runspace = NULL;
@@ -468,9 +504,10 @@ STATIC VOID OsDumpProcessUsedMemNode(UINT16 vmmFalgs)
return;
}
OsDumpProcessUsedMemRegion(runProcess, runspace, vmmFalgs);
OsDumpProcessUsedMemRegion(runProcess, runspace, vmmFlags);
return;
}
#endif
VOID OsDumpContextMem(const ExcContext *excBufAddr)
{
@@ -480,73 +517,97 @@ VOID OsDumpContextMem(const ExcContext *excBufAddr)
return;
}
for (excReg = &(excBufAddr->R0); count <= DUMPREGS; excReg++, count++) {
for (excReg = &(excBufAddr->R0); count < COM_REGS; excReg++, count++) {
if (IS_VALID_ADDR(*excReg)) {
PrintExcInfo("\ndump mem around R%u:%p", count, (*excReg));
OsDumpMemByte(DUMPSIZE, ((*excReg) - (DUMPSIZE >> 1)));
}
}
for (excReg = &(excBufAddr->R4); count < DUMPREGS; excReg++, count++) {
if (IS_VALID_ADDR(*excReg)) {
PrintExcInfo("\ndump mem around R%u:%p", count, (*excReg));
OsDumpMemByte(DUMPSIZE, ((*excReg) - (DUMPSIZE >> 1)));
}
}
if (IS_VALID_ADDR(excBufAddr->R12)) {
PrintExcInfo("\ndump mem around R12:%p", excBufAddr->R12);
OsDumpMemByte(DUMPSIZE, (excBufAddr->R12 - (DUMPSIZE >> 1)));
}
if (IS_VALID_ADDR(excBufAddr->SP)) {
PrintExcInfo("\ndump mem around SP:%p", excBufAddr->SP);
OsDumpMemByte(DUMPSIZE, (excBufAddr->SP - (DUMPSIZE >> 1)));
}
}
STATIC VOID OsExcRestore(UINTPTR taskStackPointer)
STATIC VOID OsExcRestore(VOID)
{
UINT32 currCpuID = ArchCurrCpuid();
UINT32 currCpuid = ArchCurrCpuid();
g_excFromUserMode[currCpuID] = FALSE;
g_intCount[currCpuID] = 0;
g_curNestCount[currCpuID] = 0;
#if (LOSCFG_KERNEL_SMP == YES)
OsPercpuGet()->excFlag = CPU_RUNNING;
g_excFromUserMode[currCpuid] = FALSE;
g_intCount[currCpuid] = 0;
g_curNestCount[currCpuid] = 0;
#ifdef LOSCFG_KERNEL_SMP
OsCpuStatusSet(CPU_RUNNING);
#endif
OsPercpuGet()->taskLockCnt = 0;
OsSetCurrCpuSp(taskStackPointer);
OsSchedLockSet(0);
}
STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
{
UINT32 intSave;
UINT32 currCpu = ArchCurrCpuid();
LosTaskCB *runTask = OsCurrTaskGet();
LosProcessCB *runProcess = OsCurrProcessGet();
if (g_excFromUserMode[ArchCurrCpuid()] == FALSE) {
return;
}
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
LOS_SpinLock(&g_excSerializerSpin);
if (g_nextExcWaitCpu != INVALID_CPUID) {
g_currHandleExcCpuID = g_nextExcWaitCpu;
g_currHandleExcCpuid = g_nextExcWaitCpu;
g_nextExcWaitCpu = INVALID_CPUID;
} else {
g_currHandleExcCpuID = INVALID_CPUID;
g_currHandleExcCpuid = INVALID_CPUID;
}
g_currHandleExcPID = OS_INVALID_VALUE;
LOS_SpinUnlock(&g_excSerializerSpin);
#else
g_currHandleExcCpuID = INVALID_CPUID;
g_currHandleExcCpuid = INVALID_CPUID;
#endif
runProcess->processStatus &= ~OS_PROCESS_FLAG_EXIT;
OsExcRestore(excBufAddr->SP);
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
#ifdef LOSCFG_FS_VFS
OsWakeConsoleSendTask();
#endif
#endif
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_BLACKBOX
BBoxNotifyError("USER_CRASH", MODULE_SYSTEM, "Crash in user", 0);
#endif
SCHEDULER_LOCK(intSave);
#ifdef LOSCFG_SAVE_EXCINFO
OsProcessExitCodeCoreDumpSet(runProcess);
#endif
OsProcessExitCodeSignalSet(runProcess, SIGUSR2);
/* kill user exc process */
LOS_Exit(OS_PRO_EXIT_OK);
/* An exception was raised by a task during the exit process of
* the current process.
*/
if (runProcess->processStatus & OS_PROCESS_FLAG_EXIT) {
SCHEDULER_UNLOCK(intSave);
/* Exception handling All operations should be kept prior to that operation */
OsExcRestore();
OsRunningTaskToExit(runTask, OS_PRO_EXIT_OK);
} else {
SCHEDULER_UNLOCK(intSave);
/* Exception handling All operations should be kept prior to that operation */
OsExcRestore();
/* kill user exc process */
LOS_Exit(OS_PRO_EXIT_OK);
}
/* User mode exception handling failed , which normally does not exist */
g_curNestCount[currCpu]++;
@@ -557,18 +618,17 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
/* this function is used to validate fp or validate the checking range start and end. */
STATIC INLINE BOOL IsValidFP(UINTPTR regFP, UINTPTR start, UINTPTR end, vaddr_t *vaddr)
{
LosProcessCB *runProcess = NULL;
LosVmSpace *runspace = NULL;
VADDR_T kvaddr = regFP;
PADDR_T paddr;
if (!((regFP > start) && (regFP < end) && IS_ALIGNED(regFP, sizeof(CHAR *)))) {
return FALSE;
}
#ifdef LOSCFG_KERNEL_VM
PADDR_T paddr;
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
runProcess = OsCurrProcessGet();
runspace = runProcess->vmSpace;
LosProcessCB *runProcess = OsCurrProcessGet();
LosVmSpace *runspace = runProcess->vmSpace;
if (runspace == NULL) {
return FALSE;
}
@@ -579,6 +639,7 @@ STATIC INLINE BOOL IsValidFP(UINTPTR regFP, UINTPTR start, UINTPTR end, vaddr_t
kvaddr = (PADDR_T)(UINTPTR)LOS_PaddrToKVaddr(paddr);
}
#endif
if (vaddr != NULL) {
*vaddr = kvaddr;
}
@@ -594,6 +655,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
const StackInfo *stack = NULL;
vaddr_t kvaddr;
#ifdef LOSCFG_KERNEL_VM
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
taskCB = OsCurrTaskGet();
stackStart = taskCB->userMapBase;
@@ -604,6 +666,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
}
return found;
}
#endif
/* Search in the task stacks */
for (index = 0; index < g_taskMaxNum; index++) {
@@ -641,18 +704,66 @@ FOUND:
return found;
}
VOID BackTraceSub(UINTPTR regFP)
BOOL OsGetUsrIpInfo(UINTPTR ip, IpInfo *info)
{
if (info == NULL) {
return FALSE;
}
#ifdef LOSCFG_KERNEL_VM
BOOL ret = FALSE;
const CHAR *name = NULL;
LosVmMapRegion *region = NULL;
LosProcessCB *runProcess = OsCurrProcessGet();
if (LOS_IsUserAddress((VADDR_T)ip) == FALSE) {
info->ip = ip;
name = "kernel";
ret = FALSE;
goto END;
}
region = LOS_RegionFind(runProcess->vmSpace, (VADDR_T)ip);
if (region == NULL) {
info->ip = ip;
name = "invalid";
ret = FALSE;
goto END;
}
info->ip = ip - OsGetTextRegionBase(region, runProcess);
name = OsGetRegionNameOrFilePath(region);
ret = TRUE;
if (strcmp(name, "/lib/libc.so") != 0) {
PRINT_ERR("ip = 0x%x, %s\n", info->ip, name);
}
END:
info->len = strlen(name);
if (strncpy_s(info->f_path, REGION_PATH_MAX, name, REGION_PATH_MAX - 1) != EOK) {
info->f_path[0] = '\0';
info->len = 0;
PRINT_ERR("copy f_path failed, %s\n", name);
}
return ret;
#else
info->ip = ip;
return FALSE;
#endif
}
UINT32 BackTraceGet(UINTPTR regFP, IpInfo *callChain, UINT32 maxDepth)
{
UINTPTR tmpFP, backLR;
UINTPTR stackStart, stackEnd;
UINTPTR backFP = regFP;
UINT32 count = 0;
LosVmMapRegion *region = NULL;
BOOL ret;
VADDR_T kvaddr;
if (FindSuitableStack(regFP, &stackStart, &stackEnd, &kvaddr) == FALSE) {
PrintExcInfo("traceback error fp = 0x%x\n", regFP);
return;
if (callChain == NULL) {
PrintExcInfo("traceback error fp = 0x%x\n", regFP);
}
return 0;
}
/*
@@ -664,32 +775,59 @@ VOID BackTraceSub(UINTPTR regFP)
tmpFP = *(UINTPTR *)(UINTPTR)kvaddr;
if (IsValidFP(tmpFP, stackStart, stackEnd, NULL) == TRUE) {
backFP = tmpFP;
PrintExcInfo("traceback fp fixed, trace using fp = 0x%x\n", backFP);
if (callChain == NULL) {
PrintExcInfo("traceback fp fixed, trace using fp = 0x%x\n", backFP);
}
}
while (IsValidFP(backFP, stackStart, stackEnd, &kvaddr) == TRUE) {
tmpFP = backFP;
#ifdef LOSCFG_COMPILER_CLANG_LLVM
backFP = *(UINTPTR *)(UINTPTR)kvaddr;
if (IsValidFP(tmpFP + POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
if (callChain == NULL) {
PrintExcInfo("traceback backLR check failed, backLP: 0x%x\n", tmpFP + POINTER_SIZE);
}
return 0;
}
backLR = *(UINTPTR *)(UINTPTR)kvaddr;
#else
backLR = *(UINTPTR *)(UINTPTR)kvaddr;
if (IsValidFP(tmpFP - POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
PrintExcInfo("traceback backFP check failed, backFP: 0x%x\n", tmpFP - POINTER_SIZE);
return;
if (callChain == NULL) {
PrintExcInfo("traceback backFP check failed, backFP: 0x%x\n", tmpFP - POINTER_SIZE);
}
return 0;
}
backFP = *(UINTPTR *)(UINTPTR)kvaddr;
if (LOS_IsUserAddress((VADDR_T)backLR) == TRUE) {
region = LOS_RegionFind(OsCurrProcessGet()->vmSpace, (VADDR_T)backLR);
}
if (region != NULL) {
PrintExcInfo("traceback %u -- lr = 0x%x fp = 0x%x lr in %s --> 0x%x\n", count, backLR, backFP,
OsGetRegionNameOrFilePath(region), backLR - region->range.base);
region = NULL;
#endif
IpInfo info = {0};
ret = OsGetUsrIpInfo((VADDR_T)backLR, &info);
if (callChain == NULL) {
PrintExcInfo("traceback %u -- lr = 0x%x fp = 0x%x ", count, backLR, backFP);
if (ret) {
#ifdef LOSCFG_KERNEL_VM
PrintExcInfo("lr in %s --> 0x%x\n", info.f_path, info.ip);
#else
PrintExcInfo("\n");
#endif
} else {
PrintExcInfo("\n");
}
} else {
PrintExcInfo("traceback %u -- lr = 0x%x fp = 0x%x\n", count, backLR, backFP);
(VOID)memcpy_s(&callChain[count], sizeof(IpInfo), &info, sizeof(IpInfo));
}
count++;
if ((count == OS_MAX_BACKTRACE) || (backFP == tmpFP)) {
if ((count == maxDepth) || (backFP == tmpFP)) {
break;
}
}
return count;
}
VOID BackTraceSub(UINTPTR regFP)
{
(VOID)BackTraceGet(regFP, NULL, OS_MAX_BACKTRACE);
}
VOID BackTrace(UINT32 regFP)
@@ -717,8 +855,9 @@ VOID OsExcHook(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr)
#ifndef LOSCFG_DEBUG_VERSION
if (g_excFromUserMode[ArchCurrCpuid()] != TRUE) {
#endif
#ifdef LOSCFG_KERNEL_VM
OsDumpProcessUsedMemNode(OS_EXC_VMM_NO_REGION);
#endif
OsExcStackInfo();
#ifndef LOSCFG_DEBUG_VERSION
}
@@ -778,7 +917,7 @@ VOID OsTaskBackTrace(UINT32 taskID)
}
PRINTK("TaskName = %s\n", taskCB->taskName);
PRINTK("TaskID = 0x%x\n", taskCB->taskID);
BackTrace(((TaskContext *)(taskCB->stackPointer))->R[11]); /* R11 : FP */
BackTrace(((TaskContext *)(taskCB->stackPointer))->R11); /* R11 : FP */
}
VOID OsBackTrace(VOID)
@@ -848,40 +987,18 @@ VOID OsDataAbortExcHandleEntry(ExcContext *excBufAddr)
#endif /* __LINUX_ARM_ARCH__ */
#endif /* LOSCFG_GDB */
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
#define EXC_WAIT_INTER 50U
#define EXC_WAIT_TIME 2000U
STATIC VOID OsAllCpuStatusOutput(VOID)
{
UINT32 i;
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
switch (g_percpu[i].excFlag) {
case CPU_RUNNING:
PrintExcInfo("cpu%u is running.\n", i);
break;
case CPU_HALT:
PrintExcInfo("cpu%u is halted.\n", i);
break;
case CPU_EXC:
PrintExcInfo("cpu%u is in exc.\n", i);
break;
default:
break;
}
}
PrintExcInfo("The current handling the exception is cpu%u !\n", ArchCurrCpuid());
}
STATIC VOID WaitAllCpuStop(UINT32 cpuID)
STATIC VOID WaitAllCpuStop(UINT32 cpuid)
{
UINT32 i;
UINT32 time = 0;
while (time < EXC_WAIT_TIME) {
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
if ((i != cpuID) && (g_percpu[i].excFlag != CPU_HALT)) {
if ((i != cpuid) && !OsCpuStatusIsHalt(i)) {
LOS_Mdelay(EXC_WAIT_INTER);
time += EXC_WAIT_INTER;
break;
@@ -895,90 +1012,89 @@ STATIC VOID WaitAllCpuStop(UINT32 cpuID)
return;
}
STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuID)
STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuid)
{
OsProcessSuspendAllTask();
while (1) {
LOS_SpinLock(&g_excSerializerSpin);
if ((g_currHandleExcCpuID == INVALID_CPUID) || (g_currHandleExcCpuID == currCpuID)) {
g_currHandleExcCpuID = currCpuID;
if ((g_currHandleExcCpuid == INVALID_CPUID) || (g_currHandleExcCpuid == currCpuid)) {
g_currHandleExcCpuid = currCpuid;
g_currHandleExcPID = OsCurrProcessGet()->processID;
LOS_SpinUnlock(&g_excSerializerSpin);
break;
}
if (g_nextExcWaitCpu == INVALID_CPUID) {
g_nextExcWaitCpu = currCpuID;
g_nextExcWaitCpu = currCpuid;
}
LOS_SpinUnlock(&g_excSerializerSpin);
LOS_Mdelay(EXC_WAIT_INTER);
}
}
STATIC VOID OsCheckAllCpuStatus(UINTPTR taskStackPointer)
STATIC VOID OsCheckAllCpuStatus(VOID)
{
UINT32 currCpuID = ArchCurrCpuid();
UINT32 currCpuid = ArchCurrCpuid();
UINT32 ret, target;
OsPercpuGet()->excFlag = CPU_EXC;
OsCpuStatusSet(CPU_EXC);
LOCKDEP_CLEAR_LOCKS();
LOS_SpinLock(&g_excSerializerSpin);
if (g_currHandleExcCpuID == INVALID_CPUID) {
g_currHandleExcCpuID = currCpuID;
/* Only the current CPU anomaly */
if (g_currHandleExcCpuid == INVALID_CPUID) {
g_currHandleExcCpuid = currCpuid;
g_currHandleExcPID = OsCurrProcessGet()->processID;
LOS_SpinUnlock(&g_excSerializerSpin);
if (g_excFromUserMode[currCpuID] == FALSE) {
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuID));
#ifndef LOSCFG_SAVE_EXCINFO
if (g_excFromUserMode[currCpuid] == FALSE) {
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuid));
HalIrqSendIpi(target, LOS_MP_IPI_HALT);
}
} else if (g_excFromUserMode[currCpuID] == TRUE) {
#endif
} else if (g_excFromUserMode[currCpuid] == TRUE) {
/* Both cores raise exceptions, and the current core is a user-mode exception.
* Both cores are abnormal and come from the same process
*/
if (OsCurrProcessGet()->processID == g_currHandleExcPID) {
LOS_SpinUnlock(&g_excSerializerSpin);
OsExcRestore(taskStackPointer);
while (1) {
ret = LOS_TaskSuspend(OsCurrTaskGet()->taskID);
PrintExcInfo("%s supend task :%u failed: 0x%x\n", __FUNCTION__, OsCurrTaskGet()->taskID, ret);
}
OsExcRestore();
ret = LOS_TaskDelete(OsCurrTaskGet()->taskID);
LOS_Panic("%s supend task :%u failed: 0x%x\n", __FUNCTION__, OsCurrTaskGet()->taskID, ret);
}
LOS_SpinUnlock(&g_excSerializerSpin);
OsWaitOtherCoresHandleExcEnd(currCpuID);
OsWaitOtherCoresHandleExcEnd(currCpuid);
} else {
if (g_excFromUserMode[g_currHandleExcCpuID] == TRUE) {
g_currHandleExcCpuID = currCpuID;
if ((g_currHandleExcCpuid < LOSCFG_KERNEL_CORE_NUM) && (g_excFromUserMode[g_currHandleExcCpuid] == TRUE)) {
g_currHandleExcCpuid = currCpuid;
LOS_SpinUnlock(&g_excSerializerSpin);
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuID));
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuid));
HalIrqSendIpi(target, LOS_MP_IPI_HALT);
} else {
LOS_SpinUnlock(&g_excSerializerSpin);
while (1) {}
}
}
#ifndef LOSCFG_SAVE_EXCINFO
/* use halt ipi to stop other active cores */
if (g_excFromUserMode[ArchCurrCpuid()] == FALSE) {
WaitAllCpuStop(currCpuID);
WaitAllCpuStop(currCpuid);
}
#endif
}
#endif
STATIC VOID OsCheckCpuStatus(UINTPTR taskStackPointer)
STATIC VOID OsCheckCpuStatus(VOID)
{
#if (LOSCFG_KERNEL_SMP == YES)
OsCheckAllCpuStatus(taskStackPointer);
#ifdef LOSCFG_KERNEL_SMP
OsCheckAllCpuStatus();
#else
(VOID)taskStackPointer;
g_currHandleExcCpuID = ArchCurrCpuid();
g_currHandleExcCpuid = ArchCurrCpuid();
#endif
}
LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr)
{
#if (LOSCFG_KERNEL_SMP == YES)
UINT16 runCount;
#endif
if ((excBufAddr->regCPSR & CPSR_MASK_MODE) == CPSR_USER_MODE) {
g_minAddr = USER_ASPACE_BASE;
g_maxAddr = USER_ASPACE_BASE + USER_ASPACE_SIZE;
@@ -989,25 +1105,9 @@ LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr)
g_excFromUserMode[ArchCurrCpuid()] = FALSE;
}
OsCheckCpuStatus(excBufAddr->SP);
OsCheckCpuStatus();
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
while (1) {
OsProcessSuspendAllTask();
#if (LOSCFG_KERNEL_SMP == YES)
LOS_SpinLock(&g_taskSpin);
runCount = OS_PROCESS_GET_RUNTASK_COUNT(OsCurrProcessGet()->processStatus);
LOS_SpinUnlock(&g_taskSpin);
if (runCount == 1) {
break;
}
#else
break;
#endif
}
}
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
#ifdef LOSCFG_FS_VFS
/* Wait for the end of the Console task to avoid multicore printing code */
OsWaitConsoleSendTaskPend(OsCurrTaskGet()->taskID);
@@ -1017,26 +1117,45 @@ LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr)
LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far)
{
#ifdef LOSCFG_DEBUG_VERSION
LosVmSpace *space = NULL;
VADDR_T vaddr;
#ifdef LOSCFG_BLACKBOX
#ifdef LOSCFG_SAVE_EXCINFO
SetExcInfoIndex(0);
#endif
#endif
#ifdef LOSCFG_KERNEL_VM
/* You are not allowed to add any other print information before this exception information */
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
#ifdef LOSCFG_DEBUG_VERSION
vaddr = ROUNDDOWN(far, PAGE_SIZE);
space = LOS_SpaceGet(vaddr);
VADDR_T vaddr = ROUNDDOWN(far, PAGE_SIZE);
LosVmSpace *space = LOS_SpaceGet(vaddr);
if (space != NULL) {
LOS_DumpMemRegion(vaddr);
}
#endif
PrintExcInfo("##################excFrom: User!####################\n");
} else {
} else
#endif
{
PrintExcInfo("##################excFrom: kernel!###################\n");
}
}
#ifdef LOSCFG_SAVE_EXCINFO
STATIC VOID OsSysStateSave(UINT32 *intCount, UINT32 *lockCount)
{
*intCount = g_intCount[ArchCurrCpuid()];
*lockCount = OsSchedLockCountGet();
g_intCount[ArchCurrCpuid()] = 0;
OsSchedLockSet(0);
}
STATIC VOID OsSysStateRestore(UINT32 intCount, UINT32 lockCount)
{
g_intCount[ArchCurrCpuid()] = intCount;
OsSchedLockSet(lockCount);
}
#endif
/*
* Description : EXC handler entry
* Input : excType --- exc type
@@ -1044,8 +1163,13 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far)
*/
LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr)
{
#ifdef LOSCFG_SAVE_EXCINFO
UINT32 intCount;
UINT32 lockCount;
#endif
/* Task scheduling is not allowed during exception handling */
OsPercpuGet()->taskLockCnt++;
OsSchedLock();
g_curNestCount[ArchCurrCpuid()]++;
@@ -1053,22 +1177,24 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
OsPrintExcHead(far);
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
OsAllCpuStatusOutput();
#endif
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
log_read_write_fn func = GetExcInfoRW();
#endif
if (g_excHook != NULL) {
if (g_curNestCount[ArchCurrCpuid()] == 1) {
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
if (func != NULL) {
#ifndef LOSCFG_BLACKBOX
SetExcInfoIndex(0);
g_intCount[ArchCurrCpuid()] = 0;
#endif
OsSysStateSave(&intCount, &lockCount);
OsRecordExcInfoTime();
g_intCount[ArchCurrCpuid()] = 1;
OsSysStateRestore(intCount, lockCount);
}
#endif
g_excHook(excType, excBufAddr, far, fsr);
@@ -1076,18 +1202,15 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
OsCallStackInfo();
}
#ifdef LOSCFG_SHELL_EXCINFO
#ifdef LOSCFG_SAVE_EXCINFO
if (func != NULL) {
PrintExcInfo("Be sure flash space bigger than GetExcInfoIndex():0x%x\n", GetExcInfoIndex());
g_intCount[ArchCurrCpuid()] = 0;
OsSysStateSave(&intCount, &lockCount);
func(GetRecordAddr(), GetRecordSpace(), 0, GetExcInfoBuf());
g_intCount[ArchCurrCpuid()] = 1;
OsSysStateRestore(intCount, lockCount);
}
#endif
}
#ifdef LOSCFG_EXC_INTERACTION
OsExcInteractionTaskKeep();
#endif
#ifdef LOSCFG_SHELL_CMD_DEBUG
SystemRebootFunc rebootHook = OsGetRebootHook();
@@ -1097,6 +1220,9 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
}
#endif
#ifdef LOSCFG_BLACKBOX
BBoxNotifyError(EVENT_PANIC, MODULE_SYSTEM, "Crash in kernel", 1);
#endif
while (1) {}
}
@@ -1104,13 +1230,14 @@ __attribute__((noinline)) VOID LOS_Panic(const CHAR *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
UartVprintf(fmt, ap);
OsVprintf(fmt, ap, EXC_OUTPUT);
va_end(ap);
__asm__ __volatile__("swi 0");
while (1) {}
}
/* stack protector */
UINT32 __stack_chk_guard = 0xd00a0dff;
USED UINT32 __stack_chk_guard = 0xd00a0dff;
VOID __stack_chk_fail(VOID)
{
@@ -1142,7 +1269,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou
framePtr = Get_Fp();
while ((framePtr > stackStart) && (framePtr < stackEnd) && IS_ALIGNED(framePtr, sizeof(CHAR *))) {
tmpFramePtr = framePtr;
#ifdef LOSCFG_COMPILER_CLANG_LLVM
linkReg = *(UINTPTR *)(tmpFramePtr + sizeof(UINTPTR));
#else
linkReg = *(UINTPTR *)framePtr;
#endif
if (index >= jumpCount) {
LR[count++] = linkReg;
if (count == recordCount) {
@@ -1150,7 +1281,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou
}
}
index++;
#ifdef LOSCFG_COMPILER_CLANG_LLVM
framePtr = *(UINTPTR *)framePtr;
#else
framePtr = *(UINTPTR *)(tmpFramePtr - sizeof(UINTPTR));
#endif
}
/* if linkReg is not enough,clean up the last of the effective LR as the end. */
@@ -1159,8 +1294,3 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou
}
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

92
arch/arm/arm/src/los_hw.c Executable file → Normal file
View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -32,12 +32,6 @@
#include "los_hw_pri.h"
#include "los_task_pri.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* support cpu vendors */
CpuVendor g_cpuTable[] = {
/* armv7-a */
@@ -77,13 +71,10 @@ VOID OsTaskEntrySetupLoopFrame(UINT32 arg0)
LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack, BOOL initFlag)
{
UINT32 index = 1;
TaskContext *taskContext = NULL;
if (initFlag == TRUE) {
OsStackInit(topStack, stackSize);
}
taskContext = (TaskContext *)(((UINTPTR)topStack + stackSize) - sizeof(TaskContext));
TaskContext *taskContext = (TaskContext *)(((UINTPTR)topStack + stackSize) - sizeof(TaskContext));
/* initialize the task context */
#ifdef LOSCFG_GDB
@@ -92,22 +83,17 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOI
taskContext->PC = (UINTPTR)OsTaskEntry;
#endif
taskContext->LR = (UINTPTR)OsTaskExit; /* LR should be kept, to distinguish it's THUMB or ARM instruction */
taskContext->resved = 0x0;
taskContext->R[0] = taskID; /* R0 */
taskContext->R[index++] = 0x01010101; /* R1, 0x01010101 : reg initialed magic word */
for (; index < GEN_REGS_NUM; index++) {
taskContext->R[index] = taskContext->R[index - 1] + taskContext->R[1]; /* R2 - R12 */
}
taskContext->R0 = taskID; /* R0 */
#ifdef LOSCFG_INTERWORK_THUMB
taskContext->regPSR = PSR_MODE_SVC_THUMB; /* CPSR (Enable IRQ and FIQ interrupts, THUMNB-mode) */
#ifdef LOSCFG_THUMB
taskContext->regCPSR = PSR_MODE_SVC_THUMB; /* CPSR (Enable IRQ and FIQ interrupts, THUMNB-mode) */
#else
taskContext->regPSR = PSR_MODE_SVC_ARM; /* CPSR (Enable IRQ and FIQ interrupts, ARM-mode) */
taskContext->regCPSR = PSR_MODE_SVC_ARM; /* CPSR (Enable IRQ and FIQ interrupts, ARM-mode) */
#endif
#if !defined(LOSCFG_ARCH_FPU_DISABLE)
/* 0xAAA0000000000000LL : float reg initialed magic word */
for (index = 0; index < FP_REGS_NUM; index++) {
for (UINT32 index = 0; index < FP_REGS_NUM; index++) {
taskContext->D[index] = 0xAAA0000000000000LL + index; /* D0 - D31 */
}
taskContext->regFPSCR = 0;
@@ -117,58 +103,61 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOI
return (VOID *)taskContext;
}
LITE_OS_SEC_TEXT VOID OsUserCloneParentStack(LosTaskCB *childTaskCB, LosTaskCB *parentTaskCB)
VOID OsUserCloneParentStack(VOID *childStack, UINTPTR sp, UINTPTR parentTopOfStack, UINT32 parentStackSize)
{
TaskContext *context = (TaskContext *)childTaskCB->stackPointer;
VOID *cloneStack = (VOID *)(((UINTPTR)parentTaskCB->topOfStack + parentTaskCB->stackSize) - sizeof(TaskContext));
LosTaskCB *task = OsCurrTaskGet();
sig_cb *sigcb = &task->sig;
VOID *cloneStack = NULL;
LOS_ASSERT(parentTaskCB->taskStatus & OS_TASK_STATUS_RUNNING);
if (sigcb->sigContext != NULL) {
cloneStack = (VOID *)((UINTPTR)sigcb->sigContext - sizeof(TaskContext));
} else {
cloneStack = (VOID *)(((UINTPTR)parentTopOfStack + parentStackSize) - sizeof(TaskContext));
}
(VOID)memcpy_s(childTaskCB->stackPointer, sizeof(TaskContext), cloneStack, sizeof(TaskContext));
context->R[0] = 0;
(VOID)memcpy_s(childStack, sizeof(TaskContext), cloneStack, sizeof(TaskContext));
((TaskContext *)childStack)->R0 = 0;
if (sp != 0) {
((TaskContext *)childStack)->USP = TRUNCATE(sp, LOSCFG_STACK_POINT_ALIGN_SIZE);
((TaskContext *)childStack)->ULR = 0;
}
}
LITE_OS_SEC_TEXT_INIT VOID OsUserTaskStackInit(TaskContext *context, TSK_ENTRY_FUNC taskEntry, UINTPTR stack)
LITE_OS_SEC_TEXT_INIT VOID OsUserTaskStackInit(TaskContext *context, UINTPTR taskEntry, UINTPTR stack)
{
LOS_ASSERT(context != NULL);
#ifdef LOSCFG_INTERWORK_THUMB
context->regPSR = PSR_MODE_USR_THUMB;
#ifdef LOSCFG_THUMB
context->regCPSR = PSR_MODE_USR_THUMB;
#else
context->regPSR = PSR_MODE_USR_ARM;
context->regCPSR = PSR_MODE_USR_ARM;
#endif
context->R[0] = stack;
context->SP = TRUNCATE(stack, LOSCFG_STACK_POINT_ALIGN_SIZE);
context->LR = 0;
context->R0 = stack;
context->USP = TRUNCATE(stack, LOSCFG_STACK_POINT_ALIGN_SIZE);
context->ULR = 0;
context->PC = (UINTPTR)taskEntry;
}
VOID Sev(VOID)
VOID OsInitSignalContext(const VOID *sp, VOID *signalContext, UINTPTR sigHandler, UINT32 signo, UINT32 param)
{
__asm__ __volatile__ ("sev" : : : "memory");
IrqContext *newSp = (IrqContext *)signalContext;
(VOID)memcpy_s(signalContext, sizeof(IrqContext), sp, sizeof(IrqContext));
newSp->PC = sigHandler;
newSp->R0 = signo;
newSp->R1 = param;
}
VOID Wfe(VOID)
{
__asm__ __volatile__ ("wfe" : : : "memory");
}
VOID Wfi(VOID)
{
__asm__ __volatile__ ("wfi" : : : "memory");
}
VOID Dmb(VOID)
DEPRECATED VOID Dmb(VOID)
{
__asm__ __volatile__ ("dmb" : : : "memory");
}
VOID Dsb(VOID)
DEPRECATED VOID Dsb(VOID)
{
__asm__ __volatile__("dsb" : : : "memory");
}
VOID Isb(VOID)
DEPRECATED VOID Isb(VOID)
{
__asm__ __volatile__("isb" : : : "memory");
}
@@ -192,8 +181,3 @@ VOID DCacheInvRange(UINT32 start, UINT32 end)
arm_inv_cache_range(start, end);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

295
arch/arm/arm/src/los_hw_exc.S Executable file → Normal file
View File

@@ -47,9 +47,10 @@
.extern OsDataAbortExcHandleEntry
#endif
#endif
.extern OsSaveSignalContext
.extern OsRestorSignalContext
.extern OsArmSharedPageFault
.extern OsArmA32SyscallHandle
.extern LOS_Exit
.global _osExceptFiqHdl
.global _osExceptAddrAbortHdl
@@ -63,7 +64,6 @@
.global __stack_chk_guard_setup
#endif
.fpu vfpv4
.macro PUSH_FPU_REGS reg1
@@ -173,67 +173,77 @@ _osExceptUndefInstrHdl:
#ifdef LOSCFG_GDB
GDB_HANDLE OsUndefIncExcHandleEntry
#else
@ LR offset to return from this exception: 0.
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^ @ push user sp and lr
SUB SP, SP, #(2 * 4)
MOV R2, #0
MOV R3, #0
STMFD SP!, {R2-R3} @ far and fsr fields, are 0 under this anomaly
STMFD SP!, {R4-R11}
MOV R0, #OS_EXCEPT_UNDEF_INSTR @ Set exception ID to OS_EXCEPT_UNDEF_INSTR.
B _osExceptDispatch @ Branch to global exception handler.
#endif
@ Description: Software interrupt exception handler
_osExceptSwiHdl:
SUB SP, SP, #(4 * 16)
STMIA SP, {R0-R12}
MRS R3, SPSR
MOV R4, LR
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
SUB SP, SP, #(4 * 4) @ push user sp and lr and jump reserved field
STR R7, [SP, #0] @ Save system call number to reserved2 filed
AND R1, R3, #CPSR_MASK_MODE @ Interrupted mode
CMP R1, #CPSR_USER_MODE @ User mode
BNE OsKernelSVCHandler @ Branch if not user mode
#ifdef LOSCFG_KERNEL_SYSCALL
LDR R3, [SP, #(11 * 4)]
AND R1, R3, #CPSR_MASK_MODE @ Interrupted mode
CMP R1, #CPSR_USER_MODE @ User mode
BNE _osKernelSVCHandler @ Branch if not user mode
@ we enter from user mode, we need get the values of USER mode r13(sp) and r14(lr).
@ stmia with ^ will return the user mode registers (provided that r15 is not in the register list).
CMP R7, #119 @ __NR_sigreturn
BNE _osIsSyscall
MOV R0, SP
STMFD SP!, {R3} @ Save the CPSR
ADD R3, SP, #(4 * 17) @ Offset to pc/cpsr storage
STMFD R3!, {R4} @ Save the CPSR and r15(pc)
STMFD R3, {R13, R14}^ @ Save user mode r13(sp) and r14(lr)
SUB SP, SP, #4
BLX OsRestorSignalContext
MOV SP, R0
B _osSyscallReturn
_osIsSyscall:
STMFD SP!, {R4-R11}
PUSH_FPU_REGS R1
MOV FP, #0 @ Init frame pointer
MOV R0, SP
MOV FP, #0 @ Init frame pointer
CPSIE I
BLX OsArmA32SyscallHandle
CPSID I
POP_FPU_REGS R1
ADD SP, SP,#4
LDMFD SP!, {R3} @ Fetch the return SPSR
MSR SPSR_cxsf, R3 @ Set the return mode SPSR
LDMFD SP!, {R4-R11}
@ we are leaving to user mode, we need to restore the values of USER mode r13(sp) and r14(lr).
@ ldmia with ^ will return the user mode registers (provided that r15 is not in the register list)
MOV R0, SP
SUB SP, SP, #(12 * 4) @ sp - sizeof(IrqContext), reserved for signal
MOV R1, SP
BLX OsSaveSignalContext
MOV SP, R0
LDMFD SP!, {R0-R12}
_osSyscallReturn:
LDR R7, [SP, #0]
ADD SP, SP, #(2 * 4) @ jump reserved filed
LDMFD SP, {R13, R14}^ @ Restore user mode R13/R14
ADD SP, SP, #(2 * 4)
LDMFD SP!, {PC}^ @ Return to user
OsKernelSVCHandler:
ADD R0, SP, #(4 * 16)
MOV R5, R0
STMFD R0!, {R4} @ Store PC
STMFD R0!, {R4}
STMFD R0!, {R5}
STMFD SP!, {R3} @ Push task`s CPSR (i.e. exception SPSR).
SUB SP, SP, #(4 * 2) @ user sp and lr
LDMFD SP!, {R0-R3, R12, LR}
RFEIA SP! @ Return to user
_osKernelSVCHandler:
#endif
MOV R0, #0
STR R0, [SP, #0]
STR R0, [SP, #4]
STMFD SP!, {R4-R11}
MOV R0, #OS_EXCEPT_SWI @ Set exception ID to OS_EXCEPT_SWI.
B _osExceptionSwi @ Branch to global exception handler.
B _osExceptDispatch @ Branch to global exception handler.
@ Description: Prefectch abort exception handler
_osExceptPrefetchAbortHdl:
@@ -243,18 +253,37 @@ _osExceptPrefetchAbortHdl:
#endif
#else
SUB LR, LR, #4 @ LR offset to return from this exception: -4.
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
MOV R5, LR
MRS R1, SPSR
MOV R0, #OS_EXCEPT_PREFETCH_ABORT @ Set exception ID to OS_EXCEPT_PREFETCH_ABORT.
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
SUB SP, SP, #(2 * 4)
AND R4, R1, #CPSR_MASK_MODE @ Interrupted mode
CMP R4, #CPSR_USER_MODE @ User mode
BEQ _osExcPageFault @ Branch if user mode
MRC P15, 0, R2, C6, C0, 2
MRC P15, 0, R3, C5, C0, 1
STMFD SP!, {R2-R3} @ Save far and fsr
STMFD SP!, {R4-R11}
#ifdef LOSCFG_KERNEL_VM
LDR R0, [SP, #(19 * 4)]
AND R0, R0, #CPSR_MASK_MODE @ Interrupted mode
CMP R0, #CPSR_USER_MODE @ User mode
BNE _osKernelExceptPrefetchAbortHdl
MOV R1, SP
PUSH_FPU_REGS R0
MOV R0, #OS_EXCEPT_PREFETCH_ABORT
BLX OsArmSharedPageFault
CMP R0, #0
POP_FPU_REGS R0
BEQ _osExcPageFaultReturn
#endif
_osKernelExceptPrefetchAbortHdl:
MOV LR, R5
MOV R0, #OS_EXCEPT_PREFETCH_ABORT
B _osExceptDispatch @ Branch to global exception handler.
#endif
@@ -266,117 +295,104 @@ _osExceptDataAbortHdl:
#endif
#else
SUB LR, LR, #8 @ LR offset to return from this exception: -8.
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
MOV R5, LR
MRS R1, SPSR
MOV R0, #OS_EXCEPT_DATA_ABORT @ Set exception ID to OS_EXCEPT_DATA_ABORT.
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
SUB SP, SP, #(2 * 4)
B _osExcPageFault
MRC P15, 0, R2, C6, C0, 0
MRC P15, 0, R3, C5, C0, 0
STMFD SP!, {R2-R3} @ Save far and fsr
STMFD SP!, {R4-R11}
#ifdef LOSCFG_KERNEL_VM
MOV R1, SP
PUSH_FPU_REGS R0
MOV R0, #OS_EXCEPT_DATA_ABORT @ Set exception ID to OS_EXCEPT_DATA_ABORT.
BLX OsArmSharedPageFault
CMP R0, #0
POP_FPU_REGS R0
BEQ _osExcPageFaultReturn
#endif
MOV R0, #OS_EXCEPT_DATA_ABORT
B _osExceptDispatch
#endif
#ifdef LOSCFG_KERNEL_VM
_osExcPageFaultReturn:
LDMFD SP!, {R4-R11}
MOV R0, SP
STR R7, [SP, #0]
SUB SP, SP, #(12 * 4) @ sp - sizeof(IrqContext), reserved for signal
MOV R1, SP
BLX OsSaveSignalContext
MOV SP, R0
ADD SP, SP, #(2 * 4)
LDMFD SP, {R13, R14}^
ADD SP, SP, #(2 * 4) @ Jump reserved fileds
LDMFD SP!, {R0-R3, R12, LR}
RFEIA SP!
#endif
@ Description: Address abort exception handler
_osExceptAddrAbortHdl:
SUB LR, LR, #8 @ LR offset to return from this exception: -8.
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
SUB SP, SP, #(2 * 4)
MOV R2, #0
MOV R3, #0
STMFD SP!, {R2-R3} @ far and fsr fields, are 0 under this anomaly
STMFD SP!, {R4-R11}
MOV R0, #OS_EXCEPT_ADDR_ABORT @ Set exception ID to OS_EXCEPT_ADDR_ABORT.
B _osExceptDispatch @ Branch to global exception handler.
@ Description: Fast interrupt request exception handler
_osExceptFiqHdl:
SUB LR, LR, #4 @ LR offset to return from this exception: -4.
STMFD SP, {R0-R7} @ Push working registers.
MOV R0, #OS_EXCEPT_FIQ @ Set exception ID to OS_EXCEPT_FIQ.
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
STMFD SP!, {R0-R3, R12, LR}
STMFD SP, {R13, R14}^
SUB SP, SP, #(2 * 4)
B _osExceptDispatch @ Branch to global exception handler.
_osExcPageFault:
SUB R3, SP, #(8 * 4) @ Save the start address of working registers.
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to SVC mode, and disable all interrupts
MOV R2, SP
STMFD SP!, {R5} @ Push original PC
STMFD SP!, {LR} @ Push original svc LR
STMFD SP!, {R2} @ Push original svc SP
STMFD SP!, {R8-R12} @ Push original R12-R8,
LDMFD R3!, {R4-R11} @ Move original R7-R0 from exception stack to original stack.
MOV R2, #0
MOV R3, #0
STMFD SP!, {R2-R3} @ far and fsr fields, are 0 under this anomaly
STMFD SP!, {R4-R11}
STMFD SP!, {R1}
SUB SP, SP, #8
STMIA SP, {R13, R14}^ @ Save user mode r13(sp) and r14(lr)
MOV R4, SP
BIC SP, SP, #7
PUSH_FPU_REGS R1
CMP R0, #OS_EXCEPT_DATA_ABORT
BNE 1f
MRC P15, 0, R2, C6, C0, 0
MRC P15, 0, R3, C5, C0, 0
B 2f
1: MRC P15, 0, R2, C6, C0, 2
MRC P15, 0, R3, C5, C0, 1
2: MOV R1, R4
MOV R5, R0
MOV R8, R2
MOV R9, R3
CPSIE I
BLX OsArmSharedPageFault
CPSID I
POP_FPU_REGS R1
MOV SP, R4
CMP R0, #0
BEQ _OsExcReturn
MOV R0, R5 @ exc type
B _osExceptionSwi
@ Description: Exception handler
@ Parameter : R0 Exception Type
@ Regs Hold : R3 Exception`s CPSR
_osExceptDispatch:
MRS R2, SPSR @ Save CPSR before exception.
MOV R1, LR @ Save PC before exception.
SUB R3, SP, #(8 * 4) @ Save the start address of working registers.
LDR R8, [SP, #(8 * 4)] @ Get far
LDR R9, [SP, #(9 * 4)] @ Get fsr
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to SVC mode, and disable all interrupts
MOV R5, SP
EXC_SP_SET __exc_stack_top, OS_EXC_STACK_SIZE, R6, R7
ADD R2, SP, #(20 * 4) @ sp + sizeof(ExcContext), position of SVC stack before exception
STR R2, [SP, #(8 * 4)] @ Save svc sp
STMFD SP!, {R1} @ Push Exception PC
STMFD SP!, {LR} @ Push SVC LR
STMFD SP!, {R5} @ Push SVC SP
STMFD SP!, {R8-R12} @ Push original R12-R8,
LDMFD R3!, {R4-R11} @ Move original R7-R0 from exception stack to original stack.
STMFD SP!, {R4-R11}
STMFD SP!, {R2} @ Push task`s CPSR (i.e. exception SPSR).
MOV R1, SP
CMP R0, #OS_EXCEPT_DATA_ABORT
BNE 1f
MRC P15, 0, R8, C6, C0, 0
MRC P15, 0, R9, C5, C0, 0
B 3f
1: CMP R0, #OS_EXCEPT_PREFETCH_ABORT
BNE 2f
MRC P15, 0, R8, C6, C0, 2
MRC P15, 0, R9, C5, C0, 1
B 3f
2: MOV R8, #0
MOV R9, #0
3: AND R2, R2, #CPSR_MASK_MODE
#ifdef LOSCFG_KERNEL_VM
LDR R2, [SP, #(19 * 4)] @ Get CPSR
AND R2, R2, #CPSR_MASK_MODE @ Interrupted mode
CMP R2, #CPSR_USER_MODE @ User mode
BNE 4f
STMFD SP, {R13, R14}^ @ save user mode sp and lr
4:
SUB SP, SP, #(4 * 2)
BEQ _osExceptionGetSP
#endif
_osExceptionSwi:
MOV R1, SP @ The second argument to the exception
EXC_SP_SET __exc_stack_top, OS_EXC_STACK_SIZE, R6, R7
MRC P15, 0, R4, C0, C0, 5
AND R4, R4, #MPIDR_CPUID_MASK @ Get Current cpu id
@@ -405,19 +421,4 @@ _osExceptionGetSP:
LDR R5, =OsExcHandleEntry @ OsExcHandleEntry(UINT32 excType, ExcContext * excBufAddr)
BX R5
_OsExcReturn:
LDR R0, [SP, #(2 * 4)]
AND R0, R0, #CPSR_MASK_MODE
CMP R0, #CPSR_USER_MODE @ User mode
BNE _OsExcReturnToKernel
LDMFD SP, {R13, R14}^ @ load user mode sp and lr
_OsExcReturnToKernel:
ADD SP, SP, #(2 * 4)
LDMFD SP!, {R1}
MSR SPSR_cxsf, R1 @ Set the return mode SPSR
LDMFD SP!, {R0-R12}
ADD SP, SP, #4
LDMFD SP!, {LR, PC}^
.end

View File

@@ -32,11 +32,6 @@
#include "los_sys_pri.h"
#include "los_hwi.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
LITE_OS_SEC_TEXT_INIT UINT32 OsTickInit(UINT32 systemClock, UINT32 tickPerSecond)
{
@@ -65,10 +60,8 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_GetCpuCycle(UINT32 *highCnt, UINT32 *lowCnt)
LITE_OS_SEC_TEXT_MINOR UINT64 LOS_CurrNanosec(VOID)
{
DOUBLE nanos;
nanos = (DOUBLE)HalClockGetCycles() * OS_SYS_NS_PER_SECOND / g_sysClock;
return (UINT64)nanos;
UINT64 cycle = HalClockGetCycles();
return (cycle / g_sysClock) * OS_SYS_NS_PER_SECOND + (cycle % g_sysClock) * OS_SYS_NS_PER_SECOND / g_sysClock;
}
LITE_OS_SEC_TEXT_MINOR VOID LOS_Udelay(UINT32 usecs)
@@ -81,8 +74,3 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_Mdelay(UINT32 msecs)
HalDelayUs(msecs * 1000); /* 1000 : 1ms = 1000us */
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -36,12 +36,7 @@
#include "los_cpup_pri.h"
#endif
#include "los_sched_pri.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#include "los_hook.h"
/* spinlock for hwi module, only available on SMP mode */
LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_hwiSpin);
@@ -51,16 +46,11 @@ LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_hwiSpin);
size_t g_intCount[LOSCFG_KERNEL_CORE_NUM] = {0};
HwiHandleForm g_hwiForm[OS_HWI_MAX_NUM];
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
STATIC UINT32 g_hwiFormCnt[LOSCFG_KERNEL_CORE_NUM][OS_HWI_MAX_NUM] = {0};
VOID OsIncHwiFormCnt(UINT32 index)
UINT32 OsGetHwiFormCnt(UINT16 cpuid, UINT32 index)
{
g_hwiFormCnt[index]++;
}
UINT32 OsGetHwiFormCnt(UINT32 index)
{
return g_hwiFormCnt[index];
return g_hwiFormCnt[cpuid][index];
}
CHAR *OsGetHwiFormName(UINT32 index)
@@ -79,17 +69,18 @@ VOID OsInterrupt(UINT32 intNum)
{
HwiHandleForm *hwiForm = NULL;
UINT32 *intCnt = NULL;
UINT16 cpuid = ArchCurrCpuid();
/* Must keep the operation at the beginning of the interface */
intCnt = &g_intCount[ArchCurrCpuid()];
intCnt = &g_intCount[cpuid];
*intCnt = *intCnt + 1;
OsSchedIrqStartTime();
#ifdef LOSCFG_CPUP_INCLUDE_IRQ
OsCpupIrqStart();
OsCpupIrqStart(cpuid);
#endif
OsSchedIrqStartTime();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, intNum);
hwiForm = (&g_hwiForm[intNum]);
#ifndef LOSCFG_NO_SHARED_IRQ
while (hwiForm->pstNext != NULL) {
@@ -110,13 +101,14 @@ VOID OsInterrupt(UINT32 intNum)
#ifndef LOSCFG_NO_SHARED_IRQ
}
#endif
++g_hwiFormCnt[intNum];
++g_hwiFormCnt[cpuid][intNum];
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, intNum);
OsSchedIrqUsedTimeUpdate();
#ifdef LOSCFG_CPUP_INCLUDE_IRQ
OsCpupIrqEnd(intNum);
OsCpupIrqEnd(cpuid, intNum);
#endif
OsSchedIrqUpdateUsedTime();
/* Must keep the operation at the end of the interface */
*intCnt = *intCnt - 1;
}
@@ -352,8 +344,3 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irq
return ret;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -0,0 +1,373 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "armv7_pmu_pri.h"
#include "perf_pmu_pri.h"
#include "los_hw_cpu.h"
#include "asm/platform.h"
OS_PMU_INTS(LOSCFG_KERNEL_CORE_NUM, g_pmuIrqNr);
STATIC HwPmu g_armv7Pmu;
STATIC INLINE UINT32 Armv7PmncRead(VOID)
{
UINT32 value = 0;
__asm__ volatile("mrc p15, 0, %0, c9, c12, 0" : "=r"(value));
return value;
}
STATIC INLINE VOID Armv7PmncWrite(UINT32 value)
{
value &= ARMV7_PMNC_MASK;
__asm__ volatile("mcr p15, 0, %0, c9, c12, 0" : : "r"(value));
ISB;
}
STATIC INLINE UINT32 Armv7PmuOverflowed(UINT32 pmnc)
{
return pmnc & ARMV7_OVERFLOWED_MASK;
}
STATIC INLINE UINT32 Armv7PmuCntOverflowed(UINT32 pmnc, UINT32 index)
{
return pmnc & ARMV7_CNT2BIT(ARMV7_IDX2CNT(index));
}
STATIC INLINE UINT32 Armv7CntValid(UINT32 index)
{
return index <= ARMV7_IDX_COUNTER_LAST;
}
STATIC INLINE VOID Armv7PmuSelCnt(UINT32 index)
{
UINT32 counter = ARMV7_IDX2CNT(index);
__asm__ volatile("mcr p15, 0, %0, c9, c12, 5" : : "r" (counter));
ISB;
}
STATIC INLINE VOID Armv7PmuSetCntPeriod(UINT32 index, UINT32 period)
{
if (!Armv7CntValid(index)) {
PRINT_ERR("CPU writing wrong counter %u\n", index);
} else if (index == ARMV7_IDX_CYCLE_COUNTER) {
__asm__ volatile("mcr p15, 0, %0, c9, c13, 0" : : "r" (period));
} else {
Armv7PmuSelCnt(index);
__asm__ volatile("mcr p15, 0, %0, c9, c13, 2" : : "r" (period));
}
}
STATIC INLINE VOID Armv7BindEvt2Cnt(UINT32 index, UINT32 value)
{
PRINT_DEBUG("bind event: %u to counter: %u\n", value, index);
Armv7PmuSelCnt(index);
value &= ARMV7_EVTYPE_MASK;
__asm__ volatile("mcr p15, 0, %0, c9, c13, 1" : : "r" (value));
}
STATIC INLINE VOID Armv7EnableCnt(UINT32 index)
{
UINT32 counter = ARMV7_IDX2CNT(index);
PRINT_DEBUG("index : %u, counter: %u\n", index, counter);
__asm__ volatile("mcr p15, 0, %0, c9, c12, 1" : : "r" (ARMV7_CNT2BIT(counter)));
}
STATIC INLINE VOID Armv7DisableCnt(UINT32 index)
{
UINT32 counter = ARMV7_IDX2CNT(index);
PRINT_DEBUG("index : %u, counter: %u\n", index, counter);
__asm__ volatile("mcr p15, 0, %0, c9, c12, 2" : : "r" (ARMV7_CNT2BIT(counter)));
}
STATIC INLINE VOID Armv7EnableCntInterrupt(UINT32 index)
{
UINT32 counter = ARMV7_IDX2CNT(index);
__asm__ volatile("mcr p15, 0, %0, c9, c14, 1" : : "r" (ARMV7_CNT2BIT(counter)));
ISB;
}
STATIC INLINE VOID Armv7DisableCntInterrupt(UINT32 index)
{
UINT32 counter = ARMV7_IDX2CNT(index);
__asm__ volatile("mcr p15, 0, %0, c9, c14, 2" : : "r" (ARMV7_CNT2BIT(counter)));
/* Clear the overflow flag in case an interrupt is pending. */
__asm__ volatile("mcr p15, 0, %0, c9, c12, 3" : : "r" (ARMV7_CNT2BIT(counter)));
ISB;
}
STATIC INLINE UINT32 Armv7PmuGetOverflowStatus(VOID)
{
UINT32 value;
__asm__ volatile("mrc p15, 0, %0, c9, c12, 3" : "=r" (value));
value &= ARMV7_FLAG_MASK;
__asm__ volatile("mcr p15, 0, %0, c9, c12, 3" : : "r" (value));
return value;
}
STATIC VOID Armv7EnableEvent(Event *event)
{
UINT32 cnt = event->counter;
if (!Armv7CntValid(cnt)) {
PRINT_ERR("CPU enabling wrong PMNC counter IRQ enable %u\n", cnt);
return;
}
if (event->period == 0) {
PRINT_INFO("event period value not valid, counter: %u\n", cnt);
return;
}
/*
* Enable counter and interrupt, and set the counter to count
* the event that we're interested in.
*/
UINT32 intSave = LOS_IntLock();
Armv7DisableCnt(cnt);
/*
* Set event (if destined for PMNx counters)
* We only need to set the event for the cycle counter if we
* have the ability to perform event filtering.
*/
if (cnt != ARMV7_IDX_CYCLE_COUNTER) {
Armv7BindEvt2Cnt(cnt, event->eventId);
}
/* Enable interrupt for this counter */
Armv7EnableCntInterrupt(cnt);
Armv7EnableCnt(cnt);
LOS_IntRestore(intSave);
PRINT_DEBUG("enabled event: %u cnt: %u\n", event->eventId, cnt);
}
STATIC VOID Armv7DisableEvent(Event *event)
{
UINT32 cnt = event->counter;
if (!Armv7CntValid(cnt)) {
PRINT_ERR("CPU enabling wrong PMNC counter IRQ enable %u\n", cnt);
return;
}
UINT32 intSave = LOS_IntLock();
Armv7DisableCnt(cnt);
Armv7DisableCntInterrupt(cnt);
LOS_IntRestore(intSave);
}
STATIC VOID Armv7StartAllCnt(VOID)
{
PRINT_DEBUG("starting pmu...\n");
/* Enable all counters */
UINT32 reg = Armv7PmncRead() | ARMV7_PMNC_E;
if (g_armv7Pmu.cntDivided) {
reg |= ARMV7_PMNC_D;
} else {
reg &= ~ARMV7_PMNC_D;
}
Armv7PmncWrite(reg);
HalIrqUnmask(g_pmuIrqNr[ArchCurrCpuid()]);
}
STATIC VOID Armv7StopAllCnt(VOID)
{
PRINT_DEBUG("stopping pmu...\n");
/* Disable all counters */
Armv7PmncWrite(Armv7PmncRead() & ~ARMV7_PMNC_E);
HalIrqMask(g_pmuIrqNr[ArchCurrCpuid()]);
}
STATIC VOID Armv7ResetAllCnt(VOID)
{
UINT32 index;
/* The counter and interrupt enable registers are unknown at reset. */
for (index = ARMV7_IDX_CYCLE_COUNTER; index < ARMV7_IDX_MAX_COUNTER; index++) {
Armv7DisableCnt(index);
Armv7DisableCntInterrupt(index);
}
/* Initialize & Reset PMNC: C and P bits and D bits */
UINT32 reg = ARMV7_PMNC_P | ARMV7_PMNC_C | (g_armv7Pmu.cntDivided ? ARMV7_PMNC_D : 0);
Armv7PmncWrite(reg);
}
STATIC VOID Armv7SetEventPeriod(Event *event)
{
if (event->period != 0) {
PRINT_INFO("counter: %u, period: 0x%x\n", event->counter, event->period);
Armv7PmuSetCntPeriod(event->counter, PERIOD_CALC(event->period));
}
}
STATIC UINTPTR Armv7ReadEventCnt(Event *event)
{
UINT32 value = 0;
UINT32 index = event->counter;
if (!Armv7CntValid(index)) {
PRINT_ERR("CPU reading wrong counter %u\n", index);
} else if (index == ARMV7_IDX_CYCLE_COUNTER) {
__asm__ volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (value));
} else {
Armv7PmuSelCnt(index);
__asm__ volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (value));
}
if (value < PERIOD_CALC(event->period)) {
if (Armv7PmuCntOverflowed(Armv7PmuGetOverflowStatus(), event->counter)) {
value += event->period;
}
} else {
value -= PERIOD_CALC(event->period);
}
return value;
}
STATIC const UINT32 g_armv7Map[] = {
[PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERF_HW_CYCLES,
[PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERF_HW_INSTRUCTIONS,
[PERF_COUNT_HW_DCACHE_REFERENCES] = ARMV7_PERF_HW_DCACHES,
[PERF_COUNT_HW_DCACHE_MISSES] = ARMV7_PERF_HW_DCACHE_MISSES,
[PERF_COUNT_HW_ICACHE_REFERENCES] = ARMV7_PERF_HW_ICACHES,
[PERF_COUNT_HW_ICACHE_MISSES] = ARMV7_PERF_HW_ICACHE_MISSES,
[PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERF_HW_BRANCHES,
[PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERF_HW_BRANCE_MISSES,
};
UINT32 Armv7PmuMapEvent(UINT32 eventType, BOOL reverse)
{
if (!reverse) { /* Common event to armv7 real event */
if (eventType < ARRAY_SIZE(g_armv7Map)) {
return g_armv7Map[eventType];
}
return eventType;
} else { /* Armv7 real event to common event */
UINT32 i;
for (i = 0; i < ARRAY_SIZE(g_armv7Map); i++) {
if (g_armv7Map[i] == eventType) {
return i;
}
}
return PERF_HW_INVALID_EVENT_TYPE;
}
}
STATIC VOID Armv7PmuIrqHandler(VOID)
{
UINT32 index;
PerfRegs regs;
PerfEvent *events = &(g_armv7Pmu.pmu.events);
UINT32 eventNum = events->nr;
/* Get and reset the IRQ flags */
UINT32 pmnc = Armv7PmuGetOverflowStatus();
if (!Armv7PmuOverflowed(pmnc)) {
return;
}
(VOID)memset_s(&regs, sizeof(PerfRegs), 0, sizeof(PerfRegs));
OsPerfFetchIrqRegs(&regs);
Armv7StopAllCnt();
for (index = 0; index < eventNum; index++) {
Event *event = &(events->per[index]);
/*
* We have a single interrupt for all counters. Check that
* each counter has overflowed before we process it.
*/
if (!Armv7PmuCntOverflowed(pmnc, event->counter) || (event->period == 0)) {
continue;
}
Armv7PmuSetCntPeriod(event->counter, PERIOD_CALC(event->period));
OsPerfUpdateEventCount(event, event->period);
OsPerfHandleOverFlow(event, &regs);
}
Armv7StartAllCnt();
}
UINT32 OsGetPmuMaxCounter(VOID)
{
return ARMV7_IDX_MAX_COUNTER;
}
UINT32 OsGetPmuCycleCounter(VOID)
{
return ARMV7_IDX_CYCLE_COUNTER;
}
UINT32 OsGetPmuCounter0(VOID)
{
return ARMV7_IDX_COUNTER0;
}
STATIC HwPmu g_armv7Pmu = {
.canDivided = TRUE,
.enable = Armv7EnableEvent,
.disable = Armv7DisableEvent,
.start = Armv7StartAllCnt,
.stop = Armv7StopAllCnt,
.clear = Armv7ResetAllCnt,
.setPeriod = Armv7SetEventPeriod,
.readCnt = Armv7ReadEventCnt,
.mapEvent = Armv7PmuMapEvent,
};
UINT32 OsHwPmuInit(VOID)
{
UINT32 ret;
UINT32 index;
for (index = 0; index < LOSCFG_KERNEL_CORE_NUM; index++) {
ret = LOS_HwiCreate(g_pmuIrqNr[index], 0, 0, Armv7PmuIrqHandler, 0);
if (ret != LOS_OK) {
PRINT_ERR("pmu %u irq handler register failed\n", g_pmuIrqNr[index]);
return ret;
}
#ifdef LOSCFG_KERNEL_SMP
HalIrqSetAffinity(g_pmuIrqNr[index], CPUID_TO_AFFI_MASK(index));
#endif
}
ret = OsPerfHwInit(&g_armv7Pmu);
return ret;
}

View File

@@ -29,48 +29,76 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ZPFS_VFS_ZPFS_H
#define ZPFS_VFS_ZPFS_H
#include <fs/fs.h>
#include "compiler.h"
#include "smp.h"
#include "arch_config.h"
#include "los_base.h"
#include "los_typedef.h"
#include "menuconfig.h"
#include "los_hw.h"
#include "los_atomic.h"
#include "los_arch_mmu.h"
#include "gic_common.h"
#include "los_task_pri.h"
#ifdef LOSCFG_FS_ZPFS
#ifdef LOSCFG_KERNEL_SMP
#define ZPFS_NAME "zpfs"
#define ZPFS_LEVELS 3
extern VOID reset_vector(VOID);
typedef struct ZpfsDir {
char *relPath;
int index;
int openEntry;
} ZpfsDir;
struct OsCpuInit {
ArchCpuStartFunc cpuStart;
VOID *arg;
Atomic initFlag;
};
typedef struct ZpfsEntry {
struct inode *mountedInode;
char *mountedPath;
char *mountedRelpath;
} ZpfsEntry;
STATIC struct OsCpuInit g_cpuInit[CORE_NUM - 1] = {0};
typedef struct ZpfsConfig {
char *patchTarget;
struct inode *patchTargetInode;
struct inode *patchInode;
VOID HalArchCpuOn(UINT32 cpuNum, ArchCpuStartFunc func, struct SmpOps *ops, VOID *arg)
{
struct OsCpuInit *cpuInit = &g_cpuInit[cpuNum - 1];
UINTPTR startEntry = (UINTPTR)&reset_vector - KERNEL_VMM_BASE + SYS_MEM_BASE;
INT32 ret;
int entryCount;
ZpfsEntry orgEntry[ZPFS_LEVELS];
} ZpfsConfig;
cpuInit->cpuStart = func;
cpuInit->arg = arg;
cpuInit->initFlag = 0;
ZpfsConfig *GetZpfsConfig(const struct inode *inode);
int ZpfsPrepare(const char *source, const char *target, struct inode **inodePtr, bool force);
void ZpfsFreeConfig(ZpfsConfig *zpfsCfg);
void ZpfsCleanUp(const void *node, const char *target);
bool IsZpfsFileSystem(struct inode *inode);
DCacheFlushRange((UINTPTR)cpuInit, (UINTPTR)cpuInit + sizeof(struct OsCpuInit));
#endif /* LOSCFG_FS_ZPFS */
LOS_ASSERT(ops != NULL);
ret = ops->SmpCpuOn(cpuNum, startEntry);
if (ret < 0) {
PRINT_ERR("cpu start failed, cpu num: %u, ret: %d\n", cpuNum, ret);
return;
}
while (!LOS_AtomicRead(&cpuInit->initFlag)) {
WFE;
}
}
VOID HalSecondaryCpuStart(VOID)
{
UINT32 cpuid = ArchCurrCpuid();
struct OsCpuInit *cpuInit = &g_cpuInit[cpuid - 1];
OsCurrTaskSet(OsGetMainTask());
LOS_AtomicSet(&cpuInit->initFlag, 1);
SEV;
#ifdef LOSCFG_KERNEL_MMU
OsArchMmuInitPerCPU();
#endif
/* store each core's hwid */
CPU_MAP_SET(cpuid, OsHwIDGet());
HalIrqInitPercpu();
cpuInit->cpuStart(cpuInit->arg);
while (1) {
WFI;
}
}
#endif
#endif /* ZPFS_VFS_ZPFS_H */

Some files were not shown because too many files have changed in this diff Show More