Compare commits

..

532 Commits

Author SHA1 Message Date
openharmony_ci
b7030357cd !469 -- 为hispark_taurus打开ADC模块编译宏
Merge pull request !469 from 王亚枫/OpenHarmony-2.3-Beta
2021-07-27 14:26:11 +00:00
yafeng_wang
6b4aa6a4c9 feat: Open macro for ADC moudule
Signed-off-by: yafeng_wang <wangyafeng15@huawei.com>
2021-07-27 21:39:27 +08:00
openharmony_ci
650d2b91cd !442 feat: support .mkshrc
Merge pull request !442 from MGY917/mkshrc
2021-07-20 22:55:52 +00: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
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
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
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
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
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
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
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
3260 changed files with 352581 additions and 11251 deletions

View File

@@ -1,6 +1,6 @@
### 相关的Issue
### 原因(目的、解决的问题等)

36
.gitignore vendored
View File

@@ -1,23 +1,25 @@
/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
/platform/board.ld
/out

12
BUILD.gn Executable file → Normal file
View File

@@ -67,16 +67,16 @@ lite_subsystem("kernel") {
}
} else {
deps = [ ":make" ]
deps += [ "//kernel/liteos_a/testsuites/unittest:unittest" ]
}
}
build_ext_component("make") {
exec_path = rebase_path(".", root_build_dir)
tee_enable = "false"
if (board_name == "hi3516dv300" && enable_tee_ree) {
tee_enable = "tee"
}
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"
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}\""
}

105
Kconfig Executable file → Normal file
View File

@@ -42,11 +42,9 @@ choice
config COMPILER_HIMIX_32
bool "arm-linux-ohoseabi"
depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_QEMU_ARM_VIRT_CA7
config COMPILER_CLANG_LLVM
bool "clang-llvm"
depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_QEMU_ARM_VIRT_CA7
endchoice
endmenu
@@ -54,15 +52,19 @@ 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"
source "arch/Kconfig"
######################### config options of rootfs #####################
source "../../kernel/liteos_a/kernel/common/Kconfig"
source "kernel/common/Kconfig"
######################### config options of patchfs #####################
source "../../kernel/liteos_a/kernel/common/patchfs/Kconfig"
source "kernel/common/patchfs/Kconfig"
######################### config options of blackbox #####################
source "kernel/common/blackbox/Kconfig"
######################### config options of hidumper #####################
source "kernel/common/hidumper/Kconfig"
config QUICK_START
bool "Enable QUICK_START"
@@ -73,36 +75,50 @@ 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"
source "fs/vfs/Kconfig"
source "fs/fat/Kconfig"
source "fs/ramfs/Kconfig"
source "fs/romfs/Kconfig"
source "fs/nfs/Kconfig"
source "fs/proc/Kconfig"
source "fs/jffs2/Kconfig"
config ENABLE_READ_BUFFER
bool "Enable read buffer Option"
default n
depends on FS_VFS
help
Answer Y to add enable read buffer Option.
config MAX_VNODE_SIZE
int "Vnode max number"
range 0 512
default 512
depends on FS_VFS
help
vnode number, range from 0 to 512.
config MAX_PATH_CACHE_SIZE
int "PathCache max number"
range 0 1024
default 512
depends on FS_VFS
help
pathCache number, range from 0 to 1024.
endmenu
######################## config options of net ############################
source "../../kernel/liteos_a/net/Kconfig"
source "net/Kconfig"
######################## config options of debug ########################
menu "Debug"
@@ -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.
@@ -148,6 +165,7 @@ config THUMB
default n
help
Answer Y to build thumb version. This will make LiteOS smaller.
config PLATFORM_DVFS
bool "Enable Dvfs"
default n
@@ -156,6 +174,12 @@ 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
@@ -196,22 +220,14 @@ 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
@@ -250,7 +266,7 @@ config MEM_LEAKCHECK
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.
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,13 +281,6 @@ 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 ########################
@@ -282,19 +291,31 @@ config DRIVERS
help
Answer Y to enable LiteOS support driver.
source "../../kernel/liteos_a/bsd/dev/usb/Kconfig"
source "bsd/dev/usb/Kconfig"
source "../../drivers/adapter/khdf/liteos/Kconfig"
# Device driver Kconfig import
osource "$(DEVICE_PATH)/Kconfig"
osource "$(DEVICE_PATH)/config/Kconfig"
source "drivers/char/mem/Kconfig"
source "drivers/char/quickstart/Kconfig"
source "drivers/char/random/Kconfig"
source "../../drivers/liteos/tzdriver/Kconfig"
source "drivers/char/video/Kconfig"
source "../../drivers/liteos/tzdriver/Kconfig"
source "../../drivers/liteos/hievent/Kconfig"
endmenu
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"

87
Makefile Executable file → Normal file
View File

@@ -47,23 +47,17 @@ 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
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
ifeq ($(PRODUCT_PATH),)
export PRODUCT_PATH=$(LITEOSTOPDIR)/../../device/hisilicon/drivers
endif
$(shell env CONFIG_=$(CONFIG_) $(MENUCONFIG_CONF) -s --olddefconfig $(KCONFIG_FILE_PATH))
ifeq ($(shell which menuconfig),)
$(shell pip install --user kconfiglib >/dev/null)
endif
$(shell env CONFIG_=$(CONFIG_) PRODUCT_PATH=$(PRODUCT_PATH) olddefconfig >/dev/null)
-include $(LITEOSTOPDIR)/tools/build/config.mk
@@ -83,6 +77,9 @@ ROOTFS_DIR = $(OUT)/rootfs
ROOTFS_ZIP = $(OUT)/rootfs.zip
VERSION =
SYSROOT_PATH ?= $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot
export SYSROOT_PATH
all: $(OUT) $(BUILD) $(LITEOS_TARGET) $(APPS)
lib: $(OUT) $(BUILD) $(LITEOS_LIBS_TARGET)
@@ -114,6 +111,15 @@ else
$(HIDE)$(SCRIPTS_PATH)/mklibversion.sh
endif
##### make sysroot #####
sysroot:
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
ifeq ($(wildcard $(SYSROOT_PATH)/usr/include/$(LLVM_TARGET)/),)
$(HIDE)$(MAKE) -C $(SYSROOT_PATH)/build TARGETS=liteos_a_user
endif
$(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH))
endif
##### make dynload #####
-include $(LITEOS_MK_PATH)/dynload.mk
@@ -124,34 +130,27 @@ $(__LIBS): $(OUT) $(CXX_INCLUDE)
$(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 \
-I$(LITEOS_PLATFORM_BASE)/include -imacros $< -E $(LITEOS_PLATFORM_BASE)/board.ld.S \
-o $(LITEOS_PLATFORM_BASE)/board.ld -P
$(BUILD):
$(HIDE)mkdir -p $(BUILD)
$(LITEOS_LIBS_TARGET): $(__LIBS)
$(LITEOS_LIBS_TARGET): $(__LIBS) sysroot
$(HIDE)for dir in $(LIB_SUBDIRS); \
do $(MAKE) -C $$dir all || exit 1; \
done
$(HIDE)echo "=============== make lib done ==============="
##### make menuconfig #####
menuconfig:$(MENUCONFIG_MCONF)
$< $(KCONFIG_FILE_PATH)
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:
$(HIDE)menuconfig
##### menuconfig end #######
$(LITEOS_MENUCONFIG_H):
ifneq ($(LITEOS_PLATFORM_MENUCONFIG_H), $(wildcard $(LITEOS_PLATFORM_MENUCONFIG_H)))
$(HIDE)$(MAKE) genconfig
endif
$(LITEOS_TARGET): $(__LIBS)
$(LITEOS_MENUCONFIG_H): .config
$(HIDE)genconfig
$(LITEOS_TARGET): $(__LIBS) sysroot
$(HIDE)touch $(LOSCFG_ENTRY_SRC)
$(HIDE)for dir in $(LITEOS_SUBDIRS); \
@@ -165,14 +164,14 @@ $(LITEOS_TARGET): $(__LIBS)
$(OBJDUMP) -d $(OUT)/$@ >$(OUT)/$@.asm
# $(NM) -S --size-sort $(OUT)/$@ >$(OUT)/$@.size
$(APPS): $(LITEOS_TARGET)
$(APPS): $(LITEOS_TARGET) sysroot
$(HIDE)$(MAKE) -C apps all
prepare:
$(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 -f $$($(CC) --target=$(LLVM_TARGET) --sysroot=$(SYSROOT_PATH) $(LITEOS_CFLAGS) -print-file-name=libc.so) $(OUT)/musl
$(HIDE)cp -f $$($(GPP) --target=$(LLVM_TARGET) --sysroot=$(SYSROOT_PATH) $(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
@@ -182,18 +181,14 @@ endif
$(ROOTFSDIR): prepare $(APPS)
$(HIDE)$(MAKE) clean -C apps
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsdir.sh $(OUT)/bin $(OUT)/musl $(ROOTFS_DIR)
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsdir.sh $(OUT) $(ROOTFS_DIR) $(LITEOS_TARGET_DIR)
ifneq ($(VERSION),)
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR)
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR) $(LITEOS_TARGET_DIR)
endif
$(ROOTFS): $(ROOTFSDIR)
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/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); \
@@ -201,16 +196,13 @@ clean:
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)$(RM) include/config include/generated
$(HIDE)$(MAKE) cleanrootfs
$(HIDE)echo "clean $(LITEOS_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_PLATFORM_BASE)/board.ld
$(HIDE)echo "clean all done"
cleanrootfs:
$(HIDE)$(RM) $(OUT)/rootfs
@@ -221,10 +213,11 @@ 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); \
test -f $$f && cp $$f .config && olddefconfig && savedefconfig --out $$f; \
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)
update_config:
$(HIDE)test -f "$(CONFIG)" && cp "$(CONFIG)" .config && menuconfig && savedefconfig --out "$(CONFIG)"
.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config
.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config update_config
.PHONY: prepare sysroot cleanrootfs $(ROOTFS) $(ROOTFSDIR) $(APPS) menuconfig $(LITEOS_LIBS_TARGET) $(__LIBS) $(OUT)

98
README_zh-HK.md Normal file
View File

@@ -0,0 +1,98 @@
# LiteOS-A內核<a name="ZH-CN_TOPIC_0000001096612501"></a>
- [簡介](#section11660541593)
- [目錄](#section161941989596)
- [約束](#section119744591305)
- [使用說明](#section741617511812)
- [準備](#section1579912573329)
- [獲取源碼](#section11443189655)
- [編譯構建](#section2081013992812)
- [相關倉](#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 # 串口相關邏輯代碼
├── platform # 支持不同的芯片平台代碼如Hi3516DV300等
├── security # 安全特性相關的代碼包括進程權限管理和虛擬id映射管理
├── syscall # 系統調用
└── tools # 構建工具及相關配置和代碼
```
## 約束<a name="section119744591305"></a>
- 開發語言C/C++
- 適用於Hi3518EV300、Hi3516DV300單板
- Hi3518EV300默認使用jffs2文件系統Hi3516DV300默認使用FAT文件系統。
## 使用說明<a name="section741617511812"></a>
OpenHarmony LiteOS-A內核支持Hi3518EV300[介紹](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/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/zh-cn/device-dev/quick-start/Hi3516%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BB%8B%E7%BB%8D.md))單板,開發者可基於兩種單板開發運行自己的應用程序。
### 準備<a name="section1579912573329"></a>
開發者需要在Linux上搭建編譯環境
- Hi3518EV300單板參考[環境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Hi3516%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BB%8B%E7%BB%8D.md)
- Hi3516DV300單板參考[環境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Hi3516%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83.md)。
### 獲取源碼<a name="section11443189655"></a>
在Linux服務器上下載並解壓一套源代碼獲取源碼[下載鏈結](https://repo.huaweicloud.com/harmonyos/os/1.0.1/code-1.0.1.tar.gz))。更多源碼獲取方式,參考[源碼獲取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96.md)。
### 編譯構建<a name="section2081013992812"></a>
開發者開發第一個應用程序可參考:
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/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)
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/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)。
## 相關倉<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**

View File

@@ -73,8 +73,8 @@ OpenHarmony LiteOS-A内核支持Hi3518EV300[介绍](https://gitee.com/openhar
开发者需要在Linux上搭建编译环境
- Hi3518EV300单板参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83.md)
- Hi3516DV300单板参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Hi3516%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83.md)。
- Hi3518EV300单板参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Hi3518%E5%BC%80%E5%8F%91%E6%9D%BF.md)
- Hi3516DV300单板参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Hi3516%E5%BC%80%E5%8F%91%E6%9D%BF.md)。
### 获取源码<a name="section11443189655"></a>
@@ -84,9 +84,9 @@ OpenHarmony LiteOS-A内核支持Hi3518EV300[介绍](https://gitee.com/openhar
开发者开发第一个应用程序可参考:
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/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)
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/%E8%BF%90%E8%A1%8CHello-OHOS-4.md)
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/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)。
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/%E8%BF%90%E8%A1%8CHello-OHOS.md)。
## 相关仓<a name="section1371113476307"></a>

61
TODOList.md Normal file
View File

@@ -0,0 +1,61 @@
- liteos_m易用性
- [ ] liteos_m开发者手册
- [ ] 低功耗框架及实现(含投票机制)
- [ ] dump增强配套解析工具
- [ ] 全内存dump配套解析工具
- [ ] 实现完整L0 OHOS的qemu仿真
- [ ] Shell + AT
- liteos_m能力增强
- [ ] liteos_m支持elf动态加载
- [ ] 基于MPU/PMP的多任务简化隔离
- [ ] 基于MPU/PMP的多BIN隔离及灌段隔离
- [ ] 扩展支持中断嵌套
- [ ] 支持arm9架构
- [ ] 支持xtensa架构
- 文件系统增强
- [ ] 提供一种好用且开源的NandFlash文件系统
- [ ] 面向fat32、jffs2持续性能优化做到极致
- [ ] fat32支持fast seek现有fast seek限制文件扩展需要改造
- [ ] 支持软链接
- [ ] 头文件引用关系整理
- [ ] 接口层去nuttx
- [ ] 文件系统去大锁
- liteos_a支持三方芯片易移植性
- [ ] 启动框架重构
- [ ] musl库归一化
- [ ] 去C库预编译
- [ ] 宏配置依赖关系整理
- [ ] 典型商用配置场景整理并导入门禁1V1映射去缺页去隔离单进程等等
- [ ] 编译框架整合到gn
- [ ] 实现基于python的kconfig可视化配置
- liteos_a易用性
- [ ] 实现L1 LiteOS-A及上层鸿蒙组件的qemu仿真
- [ ] liteos_a开发者手册
- [ ] mksh移植
- [ ] toybox命令集
- [ ] trace、backtrace、dump解析工具等
- procfs适配
- [ ] ifconfig、fd、free等
- liteos_a能力增强
- [ ] 单链表整改SMP多核性能
- [ ] 快启
- [ ] 典型高频函数C库性能优化
- [ ] rwlock
- liteos_a三方库移植
- [ ] libuv、dlna、benchmark、iperf、perf、tcpdump 等等
- C库能力补全
- [ ] epoll实现
- 测试验证
- [ ] syzkaller、difuze等
- 探索性课题
- [ ] 基于rust重写liteos_m基础内核
- [ ] 用户态驱动(对比业界并增强)
- [ ] 用户态文件系统

5
apps/Makefile Executable file → Normal file
View File

@@ -27,7 +27,10 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include ../.config
LITEOSTOPDIR = $(shell pwd)/../
include $(LITEOSTOPDIR)/.config
include ./config.mk
include ./module.mk
HIDE := @

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

@@ -37,14 +37,14 @@ LIBSOUT := $(OBJOUT)/libs
IMGOUT := $(OUT)
# common flags config
BASE_OPTS := -ffunction-sections -fdata-sections -fno-omit-frame-pointer -D_GNU_SOURCE \
BASE_OPTS := -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-common -fno-strict-aliasing -D_GNU_SOURCE \
$(LITEOS_SSP) $(LITEOS_CORE_COPTS) $(WARNING_AS_ERROR) $(LLVM_EXTRA_OPTS) $(LITEOS_GCOV_OPTS)
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/
LLVM_SYSROOT := --sysroot=$(SYSROOT_PATH) $(ARCH_CFLAGS)
LDCXXFLGS := -lc++ -lc++abi -lc
else
BASE_OPTS += -Wl,-z,relro,-z,now
@@ -55,6 +55,6 @@ COMMON_INCLUDE := -I $(LITEOSTHIRDPARTY)/bounds_checking_function/include
# alias variable config
HIDE := @
MAKE := make
RM := -rm -rf
CP := -cp -rf
MV := -mv
RM := rm -rf
CP := cp -rf
MV := mv -f

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

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

@@ -49,7 +49,8 @@
int main(int argc, char * const *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 +75,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);
}

71
apps/mksh/Makefile Executable file
View File

@@ -0,0 +1,71 @@
# 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.
MKSH := mksh
MKSH_DIR := $(shell pwd)/
LITEOSTOPDIR = $(MKSH_DIR)/../../
include $(MKSH_DIR)/../config.mk
APPS_OUT := $(OUT)/bin
ETC_OUT := $(OUT)/etc
BUILD_DIR := $(MKSH_DIR)/build
BUILD_LOG := $(MKSH_DIR)/build.log
TARGET_OS := OpenHarmony
LOCAL_CFLAGS := -flto -fdata-sections -ffunction-sections -Oz -fstack-protector-strong -D_FORTIFY_SOURCE=2
LOCAL_CFLAGS += --target=$(LLVM_TARGET) $(LLVM_SYSROOT)
LOCAL_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
LOCAL_CFLAGS += -DMKSH_LESS_CMDLINE_EDITING -DMKSH_LESS_BUILDINS -DMKSH_NO_INITCOMS -DADAPT_FOR_LITEOS_A
LOCAL_LDFLAGS := -Wl,--gc-sections -flto -O2 --target=$(LLVM_TARGET) $(LLVM_SYSROOT)
all:$(MKSH)
$(MKSH):
ifneq ($(wildcard $(BUILD_DIR)/Rebuild.sh),)
$(HIDE)echo "not clean, rebuilding now"
$(HIDE)chmod +x $(BUILD_DIR)/Rebuild.sh
$(HIDE)cd $(BUILD_DIR) && ./Rebuild.sh > $(BUILD_LOG) 2>&1
else
$(HIDE)mkdir -p $(BUILD_DIR)
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/$(MKSH)/. $(BUILD_DIR)
$(HIDE)chmod +x $(BUILD_DIR)/Build.sh
$(HIDE)cd $(BUILD_DIR) && CC=$(CC) TARGET_OS=$(TARGET_OS) CFLAGS="$(LOCAL_CFLAGS)" LDFLAGS="$(LOCAL_LDFLAGS)" ./Build.sh -r > $(BUILD_LOG) 2>&1
endif
$(HIDE)$(CP) -rf $(BUILD_DIR)/$(MKSH) .
$(HIDE)$(STRIP) $(MKSH)
$(HIDE)mkdir -p $(APPS_OUT)
$(HIDE)$(CP) $(MKSH) $(APPS_OUT)
$(HIDE)mkdir -p $(ETC_OUT)
$(HIDE)$(CP) -rf $(BUILD_DIR)/.mkshrc $(ETC_OUT)/
clean:
$(HIDE)$(RM) $(MKSH) $(BUILD_DIR) $(BUILD_LOG)
.PHONY: all $(MKSH) clean

4
apps/module.mk Executable file → Normal file
View File

@@ -29,10 +29,12 @@
APP_SUBDIRS :=
##compile modules config##
##build modules config##
ifeq ($(LOSCFG_SHELL), y)
APP_SUBDIRS += shell
APP_SUBDIRS += mksh
APP_SUBDIRS += toybox
endif
ifeq ($(LOSCFG_USER_INIT_DEBUG), y)

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

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

@@ -37,11 +37,6 @@
#include "shcmd.h"
#include "sherr.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
int Chdir(const char *tgtDir)
{
@@ -53,17 +48,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 = OsShellSetWorkingDirtectory(tgtDir, strlen(tgtDir) + 1); /* 1: the length of '\0' */
}
return ret;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

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

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

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)
/**

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

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

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

@@ -36,11 +36,6 @@
#include "securec.h"
#include "unistd.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
ShellCB *g_shellCB = NULL;
@@ -139,8 +134,3 @@ ERR_OUT1:
return ret;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

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

@@ -36,11 +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 +80,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;
}
@@ -201,7 +196,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)) {
@@ -453,20 +448,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;
@@ -604,8 +594,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

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

@@ -42,11 +42,6 @@
#include "shell_pri.h"
#include "shcmd.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
char *GetCmdline(ShellCB *shellCB)
@@ -338,6 +333,7 @@ static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len
{
int ret;
pid_t forkPid;
pid_t gid;
if (strncmp(cmdline, SHELL_EXEC_COMMAND, SHELL_EXEC_COMMAND_BYTES) == 0) {
forkPid = fork();
@@ -350,6 +346,16 @@ static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len
exit(1);
}
gid = getpgrp();
if (gid < 0) {
printf("get group id failed, pgrpid %d, errno %d\n", gid, errno);
}
ret = tcsetpgrp(STDIN_FILENO, gid);
if (ret != 0) {
printf("tcsetpgrp failed, errno %d\n", errno);
}
ret = execve((const char *)cmdParsed->paramArray[0], (char * const *)cmdParsed->paramArray, NULL);
if (ret == -1) {
perror("execve");
@@ -577,7 +583,7 @@ 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)
@@ -640,8 +646,3 @@ int ShellEntryInit(ShellCB *shellCB)
return ret;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

60
apps/toybox/Makefile Normal file
View File

@@ -0,0 +1,60 @@
# 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.
TOYBOX:= toybox
TOYBOX_DIR := $(shell pwd)
LITEOSTOPDIR = $(TOYBOX_DIR)/../../
include $(TOYBOX_DIR)/../config.mk
APPS_OUT := $(OUT)/bin
BUILD_DIR := $(TOYBOX_DIR)/build
BUILD_LOG := $(TOYBOX_DIR)/build.log
OUTNAME := $(TOYBOX)
$(TOYBOX):
ifneq ($(wildcard $(BUILD_DIR)),)
$(HIDE)echo "not clean, rebuilding now";
else
$(HIDE)mkdir $(BUILD_DIR)
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/$(TOYBOX)/. $(BUILD_DIR)
$(HIDE)$(CP) -p $(LITEOSTHIRDPARTY)/$(TOYBOX)/porting/liteos_a/. $(BUILD_DIR)
endif
$(HIDE)CFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-strong --target=$(LLVM_TARGET) $(LLVM_SYSROOT)" CC="$(CC)" OUTNAME=$(OUTNAME) \
LDFLAGS="--target=$(LLVM_TARGET) $(LLVM_SYSROOT)" \
make -C $(BUILD_DIR) toybox -j> $(BUILD_LOG) 2>&1
$(HIDE)$(CP) $(BUILD_DIR)/$(TOYBOX) .
$(HIDE)$(STRIP) $(TOYBOX)
$(HIDE)mkdir -p $(APPS_OUT)
$(HIDE)$(CP) $(TOYBOX) $(APPS_OUT)
clean:
$(HIDE)$(RM) $(TOYBOX) $(BUILD_DIR) $(BUILD_LOG)
.PHONY: all $(TOYBOX) clean

View File

@@ -0,0 +1,181 @@
CONFIG_GETTY=y
CONFIG_MDEV=y
CONFIG_MDEV_CONF=y
# CONFIG_CAL 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_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_REBOOT 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

0
arch/Kconfig Executable file → Normal file
View File

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

@@ -42,7 +42,10 @@ LITEOS_ARCH_ARM :=
endif
LITEOS_BASELIB += -l$(LOSCFG_ARCH_CPU)
LITEOS_BASELIB += -lgic
LIB_SUBDIRS += arch/arm/$(LITEOS_ARCH_ARM)
LIB_SUBDIRS += arch/arm/gic
# CPU compile options
ifeq ($(LOSCFG_ARCH_ARM_AARCH64), y)
@@ -62,7 +65,7 @@ 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_CORE_COPTS = $(or $(ARCH_CFLAGS),$(LITEOS_CPU_OPTS) $(LITEOS_FLOAT_OPTS) $(LITEOS_FPU_OPTS))
LITEOS_INTERWORK += $(LITEOS_CORE_COPTS)
LITEOS_NODEBUG += $(LITEOS_CORE_COPTS)
LITEOS_ASOPTS += $(LITEOS_CPU_OPTS)

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

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

@@ -1,6 +1,5 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* 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:
@@ -29,8 +28,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __LOS_QUICK_START_H__
#define __LOS_QUICK_START_H__
#ifndef _ARM_USER_CLEAR_H
#define _ARM_USER_CLEAR_H
#include "los_typedef.h"
@@ -40,7 +39,7 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern int DevQuickStartRegister(void);
size_t _arm_clear_user(void *addr, size_t bytes);
#ifdef __cplusplus
#if __cplusplus
@@ -48,4 +47,4 @@ extern int DevQuickStartRegister(void);
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif
#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,7 +45,6 @@ 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);

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

@@ -51,6 +51,7 @@ 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 ARM_SYSREG_READ(REG) \
@@ -144,7 +145,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 +189,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

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

View File

@@ -162,7 +162,7 @@ VOID HalDelayUs(UINT32 usecs)
}
}
UINT64 hi_sched_clock(VOID)
DEPRECATED UINT64 hi_sched_clock(VOID)
{
return LOS_CurrNanosec();
}

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

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

View File

@@ -40,11 +40,6 @@ 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

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

@@ -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 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

@@ -59,7 +59,7 @@ extern VOID OsIncHwiFormCnt(UINT32 index);
extern UINT32 OsGetHwiFormCnt(UINT32 index);
extern CHAR *OsGetHwiFormName(UINT32 index);
extern VOID OsInterrupt(UINT32 intNum);
extern VOID SyscallHandleInit(VOID);
extern VOID OsSyscallHandleInit(VOID);
#ifdef __cplusplus
#if __cplusplus

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

@@ -45,16 +45,13 @@
#include "los_vm_boot.h"
#include "los_mmu_descriptor_v6.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef LOSCFG_KERNEL_MMU
__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];
@@ -70,6 +67,11 @@ STATIC INLINE PTE_T *OsGetPte2BasePtr(PTE_T 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 +148,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 +157,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,6 +167,9 @@ 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)
@@ -213,7 +218,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;
@@ -370,13 +375,14 @@ 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) {
@@ -480,7 +486,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,14 +498,22 @@ 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 */
@@ -531,7 +544,7 @@ STATIC UINT32 OsCvtPte2CacheFlagsToMMUFlags(UINT32 flags)
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;
@@ -751,21 +764,26 @@ 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) {
@@ -774,6 +792,7 @@ STATUS_T LOS_ArchMmuDestroy(LosArchMmu *archMmu)
OsArmWriteTlbiasid(archMmu->asid);
OsFreeAsid(archMmu->asid);
#endif
(VOID)LOS_MuxDestroy(&archMmu->mtx);
return LOS_OK;
}
@@ -806,38 +825,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 +862,29 @@ STATIC VOID OsSetKSectionAttr(VOID)
LosVmSpace *kSpace = LOS_GetKVmSpace();
status_t status;
UINT32 length;
paddr_t oldTtPhyBase;
int 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 +892,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 +904,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 +960,10 @@ VOID OsInitMappingStartUp(VOID)
OsSwitchTmpTTB();
OsSetKSectionAttr();
OsArchMmuInitPerCPU();
OsSetKSectionAttr(KERNEL_VMM_BASE, FALSE);
OsSetKSectionAttr(UNCACHED_VMM_BASE, TRUE);
OsKSectionNewAttrEnable();
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

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 */

147
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,88 @@ 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}
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

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

@@ -34,14 +34,10 @@
#include "los_printf_pri.h"
#include "los_task_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,7 +51,9 @@
#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"
@@ -63,12 +61,10 @@
#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
@@ -81,7 +77,7 @@ 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;
@@ -107,11 +103,7 @@ 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" }
};
@@ -185,20 +177,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) && (OsPercpuGet()->taskLockCnt != 0));
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,14 +220,27 @@ 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;
ret = LOS_ERRNO_VM_NOT_FOUND;
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)
{
@@ -256,6 +273,7 @@ STATIC const CHAR *g_excTypeString[] = {
"irq"
};
#ifdef LOSCFG_KERNEL_VM
STATIC VADDR_T OsGetTextRegionBase(LosVmMapRegion *region, LosProcessCB *runProcess)
{
struct file *curFilep = NULL;
@@ -283,41 +301,52 @@ STATIC VADDR_T OsGetTextRegionBase(LosVmMapRegion *region, LosProcessCB *runProc
} while (!strcmp(curFilep->f_path, lastFilep->f_path));
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 +363,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 +417,7 @@ EXC_PROC_FUNC OsExcRegHookGet(VOID)
return g_excHook;
}
#ifdef LOSCFG_KERNEL_VM
STATIC VOID OsDumpExcVaddrRegion(LosVmSpace *space, LosVmMapRegion *region)
{
INT32 i, numPages, pageCount;
@@ -471,6 +503,7 @@ STATIC VOID OsDumpProcessUsedMemNode(UINT16 vmmFalgs)
OsDumpProcessUsedMemRegion(runProcess, runspace, vmmFalgs);
return;
}
#endif
VOID OsDumpContextMem(const ExcContext *excBufAddr)
{
@@ -493,31 +526,31 @@ VOID OsDumpContextMem(const ExcContext *excBufAddr)
}
}
STATIC VOID OsExcRestore(UINTPTR taskStackPointer)
STATIC VOID OsExcRestore(VOID)
{
UINT32 currCpuID = ArchCurrCpuid();
g_excFromUserMode[currCpuID] = FALSE;
g_intCount[currCpuID] = 0;
g_curNestCount[currCpuID] = 0;
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
OsPercpuGet()->excFlag = CPU_RUNNING;
#endif
OsPercpuGet()->taskLockCnt = 0;
OsSetCurrCpuSp(taskStackPointer);
}
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;
@@ -532,21 +565,37 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
#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 that is not the current main thread during the exit process of
* the current process.
*/
if ((runProcess->processStatus & OS_PROCESS_FLAG_EXIT) && (runProcess->threadGroupID != runTask->taskID)) {
SCHEDULER_UNLOCK(intSave);
/* Exception handling All operations should be kept prior to that operation */
OsExcRestore();
OsTaskToExit(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 +606,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 +627,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;
}
@@ -647,8 +696,10 @@ VOID BackTraceSub(UINTPTR regFP)
UINTPTR stackStart, stackEnd;
UINTPTR backFP = regFP;
UINT32 count = 0;
LosVmMapRegion *region = NULL;
VADDR_T kvaddr;
#ifdef LOSCFG_KERNEL_VM
LosProcessCB *runProcess = OsCurrProcessGet();
#endif
if (FindSuitableStack(regFP, &stackStart, &stackEnd, &kvaddr) == FALSE) {
PrintExcInfo("traceback error fp = 0x%x\n", regFP);
@@ -684,14 +735,19 @@ VOID BackTraceSub(UINTPTR regFP)
}
backFP = *(UINTPTR *)(UINTPTR)kvaddr;
#endif
#ifdef LOSCFG_KERNEL_VM
LosVmMapRegion *region = NULL;
if (LOS_IsUserAddress((VADDR_T)backLR) == TRUE) {
region = LOS_RegionFind(OsCurrProcessGet()->vmSpace, (VADDR_T)backLR);
region = LOS_RegionFind(runProcess->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);
OsGetRegionNameOrFilePath(region),
backLR - OsGetTextRegionBase(region, runProcess));
region = NULL;
} else {
} else
#endif
{
PrintExcInfo("traceback %u -- lr = 0x%x fp = 0x%x\n", count, backLR, backFP);
}
count++;
@@ -726,8 +782,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
}
@@ -787,7 +844,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)
@@ -857,7 +914,7 @@ 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
@@ -906,7 +963,6 @@ STATIC VOID WaitAllCpuStop(UINT32 cpuID)
STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuID)
{
OsProcessSuspendAllTask();
while (1) {
LOS_SpinLock(&g_excSerializerSpin);
if ((g_currHandleExcCpuID == INVALID_CPUID) || (g_currHandleExcCpuID == currCpuID)) {
@@ -924,7 +980,7 @@ STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuID)
}
}
STATIC VOID OsCheckAllCpuStatus(UINTPTR taskStackPointer)
STATIC VOID OsCheckAllCpuStatus(VOID)
{
UINT32 currCpuID = ArchCurrCpuid();
UINT32 ret, target;
@@ -933,6 +989,7 @@ STATIC VOID OsCheckAllCpuStatus(UINTPTR taskStackPointer)
LOCKDEP_CLEAR_LOCKS();
LOS_SpinLock(&g_excSerializerSpin);
/* Only the current nuclear anomaly */
if (g_currHandleExcCpuID == INVALID_CPUID) {
g_currHandleExcCpuID = currCpuID;
g_currHandleExcPID = OsCurrProcessGet()->processID;
@@ -942,19 +999,20 @@ STATIC VOID OsCheckAllCpuStatus(UINTPTR taskStackPointer)
HalIrqSendIpi(target, LOS_MP_IPI_HALT);
}
} 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);
} else {
if (g_excFromUserMode[g_currHandleExcCpuID] == TRUE) {
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));
@@ -972,22 +1030,17 @@ STATIC VOID OsCheckAllCpuStatus(UINTPTR taskStackPointer)
}
#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();
#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;
@@ -998,25 +1051,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);
@@ -1026,26 +1063,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 = OsPercpuGet()->taskLockCnt;
g_intCount[ArchCurrCpuid()] = 0;
OsPercpuGet()->taskLockCnt = 0;
}
STATIC VOID OsSysStateRestore(UINT32 intCount, UINT32 lockCount)
{
g_intCount[ArchCurrCpuid()] = intCount;
OsPercpuGet()->taskLockCnt = lockCount;
}
#endif
/*
* Description : EXC handler entry
* Input : excType --- exc type
@@ -1053,6 +1109,11 @@ 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++;
@@ -1062,22 +1123,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);
@@ -1085,18 +1148,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();
@@ -1106,6 +1166,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) {}
}
@@ -1116,10 +1179,11 @@ __attribute__((noinline)) VOID LOS_Panic(const CHAR *fmt, ...)
UartVprintf(fmt, ap);
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)
{
@@ -1151,7 +1215,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) {
@@ -1159,7 +1227,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. */
@@ -1168,8 +1240,3 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou
}
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

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

@@ -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) */
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,49 @@ 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)
LITE_OS_SEC_TEXT VOID OsUserCloneParentStack(VOID *childStack, UINTPTR parentTopOfStack, UINT32 parentStackSize)
{
TaskContext *context = (TaskContext *)childTaskCB->stackPointer;
VOID *cloneStack = (VOID *)(((UINTPTR)parentTaskCB->topOfStack + parentTaskCB->stackSize) - sizeof(TaskContext));
VOID *cloneStack = (VOID *)(((UINTPTR)parentTopOfStack + parentStackSize) - sizeof(TaskContext));
LOS_ASSERT(parentTaskCB->taskStatus & OS_TASK_STATUS_RUNNING);
(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;
}
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;
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 +169,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

@@ -37,11 +37,6 @@
#endif
#include "los_sched_pri.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* spinlock for hwi module, only available on SMP mode */
LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_hwiSpin);
@@ -352,8 +347,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 */

86
arch/arm/arm/src/startup/reset_vector_mp.S Executable file → Normal file
View File

@@ -37,17 +37,9 @@
.global __exc_stack_top
.global __irq_stack_top
.global __fiq_stack_top
.global __svc_stack_top
.global __abt_stack_top
.global __undef_stack_top
.global __exc_stack
.global __irq_stack
.global __fiq_stack
.global __svc_stack
.global __abt_stack
.global __undef_stack
.extern __bss_start
.extern __bss_end
@@ -65,7 +57,9 @@
.equ MPIDR_CPUID_MASK, 0xffU
.fpu vfpv4
.fpu neon-vfpv4
.syntax unified
.arch armv7-a
.arm
/* param0 is stack bottom, param1 is stack size, r12 hold cpu id */
@@ -113,9 +107,9 @@ __exception_handlers:
.global reset_vector
.type reset_vector,function
#ifdef LOSCFG_QUICK_START
#ifdef LOSCFG_BOOTENV_RAM
__quickstart_args_start:
.fill 512,1,0
.fill LOSCFG_BOOTENV_RAMSIZE,1,0
__quickstart_args_end:
.global OsGetArgsAddr
@@ -182,12 +176,13 @@ reloc_img_to_bottom_loop:
sub r11, r11, r12 /* r11: eventual address offset */
reloc_img_to_bottom_done:
#ifdef LOSCFG_KERNEL_MMU
ldr r4, =g_firstPageTable /* r4: physical address of translation table and clear it */
add r4, r4, r11
mov r0, r4
mov r1, #0
mov r2, #MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS
bl memset
bl memset_optimized /* optimized memset since r0 is 64-byte aligned */
PAGE_TABLE_SET SYS_MEM_BASE, KERNEL_VMM_BASE, KERNEL_VMM_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS
PAGE_TABLE_SET SYS_MEM_BASE, UNCACHED_VMM_BASE, UNCACHED_VMM_SIZE, MMU_INITIAL_MAP_NORMAL_NOCACHE
@@ -210,41 +205,20 @@ reloc_img_to_bottom_done:
str r12, [r4, r7, lsr #(20 - 2)] /* jumpTable[paIndex] = pt entry */
rsb r7, r11, r6, lsl #20 /* r7: va */
str r12, [r4, r7, lsr #(20 - 2)] /* jumpTable[vaIndex] = pt entry */
#endif
bl _bootaddr_setup
#ifdef LOSCFG_KERNEL_MMU
bl mmu_setup /* set up the mmu */
#endif
/* clear out the interrupt and exception stack and set magic num to check the overflow */
ldr r0, =__undef_stack
ldr r0, =__svc_stack
ldr r1, =__exc_stack_top
bl stack_init
STACK_MAGIC_SET __undef_stack, #OS_EXC_UNDEF_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __abt_stack, #OS_EXC_ABT_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __irq_stack, #OS_EXC_IRQ_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __fiq_stack, #OS_EXC_FIQ_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __svc_stack, #OS_EXC_SVC_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __exc_stack, #OS_EXC_STACK_SIZE, OS_STACK_MAGIC_WORD
warm_reset:
/* initialize interrupt/exception environments */
mov r0, #(CPSR_IRQ_DISABLE |CPSR_FIQ_DISABLE|CPSR_IRQ_MODE)
msr cpsr, r0
EXC_SP_SET __irq_stack_top, #OS_EXC_IRQ_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_UNDEF_MODE)
msr cpsr, r0
EXC_SP_SET __undef_stack_top, #OS_EXC_UNDEF_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_ABT_MODE)
msr cpsr, r0
EXC_SP_SET __abt_stack_top, #OS_EXC_ABT_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_FIQ_MODE)
msr cpsr, r0
EXC_SP_SET __fiq_stack_top, #OS_EXC_FIQ_STACK_SIZE
/* initialize CPSR (machine state register) */
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SVC_MODE)
msr cpsr, r0
@@ -292,7 +266,7 @@ clear_bss:
_start_hang:
b _start_hang
#ifdef LOSCFG_KERNEL_MMU
mmu_setup:
mov r12, #0
mcr p15, 0, r12, c8, c7, 0 /* Set c8 to control the TLB and set the mapping to invalid */
@@ -328,7 +302,7 @@ mmu_setup:
isb
sub lr, r11 /* adjust lr with delta of physical address and virtual address */
bx lr
#endif
.code 32
.global reset_platform
@@ -344,6 +318,7 @@ reset_platform:
mov pc, r0 // Jump to reset vector
#endif
cpu_start:
#ifdef LOSCFG_KERNEL_MMU
ldr r4, =g_firstPageTable /* r4 = physical address of translation table and clear it */
add r4, r4, r11
orr r8, r4, #MMU_TTBRx_FLAGS
@@ -354,6 +329,7 @@ cpu_start:
add r4, r4, r11 /* r4 = tt_trampoline paddr */
bl mmu_setup
#endif
bl secondary_cpu_start
b .
@@ -392,6 +368,7 @@ sp_set:
* r10: flags
* r9 and r12 will be used as variable
*/
#ifdef LOSCFG_KERNEL_MMU
page_table_build:
mov r9, r6
bfc r9, #20, #12 /* r9: pa % MB */
@@ -410,7 +387,7 @@ page_table_build_loop:
subs r8, #1 /* sizes-- */
bne page_table_build_loop
bx lr
#endif
/*
* init stack to initial value
* r0 is stack mem start, r1 is stack mem end
@@ -463,6 +440,19 @@ _bootaddr_setup:
bx lr
#ifdef LOSCFG_KERNEL_MMU
memset_optimized:
mov r3, r0
vdup.8 q0, r1
vmov q1, q0
vmov q2, q0
vmov q3, q0
memset_optimized_loop:
subs r2, #64
vstmia r3!, {d0 - d7}
bge memset_optimized_loop
bx lr
#endif
init_done:
.long 0xDEADB00B
@@ -479,22 +469,6 @@ init_flag:
.section ".int_stack", "wa", %nobits
.align 3
__undef_stack:
.space OS_EXC_UNDEF_STACK_SIZE * CORE_NUM
__undef_stack_top:
__abt_stack:
.space OS_EXC_ABT_STACK_SIZE * CORE_NUM
__abt_stack_top:
__irq_stack:
.space OS_EXC_IRQ_STACK_SIZE * CORE_NUM
__irq_stack_top:
__fiq_stack:
.space OS_EXC_FIQ_STACK_SIZE * CORE_NUM
__fiq_stack_top:
__svc_stack:
.space OS_EXC_SVC_STACK_SIZE * CORE_NUM
__svc_stack_top:

76
arch/arm/arm/src/startup/reset_vector_up.S Executable file → Normal file
View File

@@ -38,17 +38,9 @@
.global __exc_stack_top
.global __irq_stack_top
.global __fiq_stack_top
.global __svc_stack_top
.global __abt_stack_top
.global __undef_stack_top
.global __exc_stack
.global __irq_stack
.global __fiq_stack
.global __svc_stack
.global __abt_stack
.global __undef_stack
.extern __bss_start
.extern __bss_end
@@ -65,7 +57,9 @@
.equ MPIDR_CPUID_MASK, 0xffU
.fpu vfpv4
.fpu neon-vfpv4
.syntax unified
.arch armv7-a
.arm
/* param0 is stack bottom, param1 is stack size, r11 hold cpu id */
@@ -159,13 +153,13 @@ reloc_img_to_bottom_loop:
sub r11, r11, r12 /* r11: eventual address offset */
reloc_img_to_bottom_done:
#ifdef LOSCFG_KERNEL_MMU
ldr r4, =g_firstPageTable /* r4: physical address of translation table and clear it */
add r4, r4, r11
mov r0, r4
mov r1, #0
mov r2, #MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS
bl memset
bl memset_optimized /* optimized memset since r0 is 64-byte aligned */
PAGE_TABLE_SET SYS_MEM_BASE, KERNEL_VMM_BASE, KERNEL_VMM_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS
PAGE_TABLE_SET SYS_MEM_BASE, UNCACHED_VMM_BASE, UNCACHED_VMM_SIZE, MMU_INITIAL_MAP_NORMAL_NOCACHE
@@ -190,7 +184,7 @@ reloc_img_to_bottom_done:
str r12, [r4, r7, lsr #(20 - 2)] /* jumpTable[vaIndex] = pt entry */
bl mmu_setup /* set up the mmu */
#endif
/* get cpuid and keep it in r11 */
mrc p15, 0, r11, c0, c0, 5
and r11, r11, #MPIDR_CPUID_MASK
@@ -199,36 +193,15 @@ reloc_img_to_bottom_done:
excstatck_loop:
/* clear out the interrupt and exception stack and set magic num to check the overflow */
ldr r0, =__undef_stack
ldr r0, =__svc_stack
ldr r1, =__exc_stack_top
bl stack_init
STACK_MAGIC_SET __undef_stack, #OS_EXC_UNDEF_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __abt_stack, #OS_EXC_ABT_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __irq_stack, #OS_EXC_IRQ_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __fiq_stack, #OS_EXC_FIQ_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __svc_stack, #OS_EXC_SVC_STACK_SIZE, OS_STACK_MAGIC_WORD
STACK_MAGIC_SET __exc_stack, #OS_EXC_STACK_SIZE, OS_STACK_MAGIC_WORD
excstatck_loop_done:
warm_reset:
/* initialize interrupt/exception environments */
mov r0, #(CPSR_IRQ_DISABLE |CPSR_FIQ_DISABLE|CPSR_IRQ_MODE)
msr cpsr, r0
EXC_SP_SET __irq_stack_top, #OS_EXC_IRQ_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_UNDEF_MODE)
msr cpsr, r0
EXC_SP_SET __undef_stack_top, #OS_EXC_UNDEF_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_ABT_MODE)
msr cpsr, r0
EXC_SP_SET __abt_stack_top, #OS_EXC_ABT_STACK_SIZE
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_FIQ_MODE)
msr cpsr, r0
EXC_SP_SET __fiq_stack_top, #OS_EXC_FIQ_STACK_SIZE
/* initialize CPSR (machine state register) */
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SVC_MODE)
msr cpsr, r0
@@ -285,6 +258,7 @@ clear_bss:
_start_hang:
b _start_hang
#ifdef LOSCFG_KERNEL_MMU
mmu_setup:
mov r12, #0
mcr p15, 0, r12, c8, c7, 0 /* Set c8 to control the TLB and set the mapping to invalid */
@@ -321,7 +295,7 @@ mmu_setup:
sub lr, r11 /* adjust lr with delta of physical address and virtual address */
bx lr
#endif
.code 32
.global reset_platform
@@ -360,6 +334,7 @@ sp_set:
* r10: flags
* r9 and r12 will be used as variable
*/
#ifdef LOSCFG_KERNEL_MMU
page_table_build:
mov r9, r6
bfc r9, #20, #12 /* r9: pa % MB */
@@ -378,7 +353,7 @@ page_table_build_loop:
subs r8, #1 /* sizes-- */
bne page_table_build_loop
bx lr
#endif
/*
* init stack to initial value
* r0 is stack mem start, r1 is stack mem end
@@ -431,6 +406,19 @@ _bootaddr_setup:
bx lr
#ifdef LOSCFG_KERNEL_MMU
memset_optimized:
mov r3, r0
vdup.8 q0, r1
vmov q1, q0
vmov q2, q0
vmov q3, q0
memset_optimized_loop:
subs r2, #64
vstmia r3!, {d0 - d7}
bge memset_optimized_loop
bx lr
#endif
init_done:
.long 0xDEADB00B
@@ -447,22 +435,6 @@ init_flag:
.section ".int_stack", "wa", %nobits
.align 3
__undef_stack:
.space OS_EXC_UNDEF_STACK_SIZE * CORE_NUM
__undef_stack_top:
__abt_stack:
.space OS_EXC_ABT_STACK_SIZE * CORE_NUM
__abt_stack_top:
__irq_stack:
.space OS_EXC_IRQ_STACK_SIZE * CORE_NUM
__irq_stack_top:
__fiq_stack:
.space OS_EXC_FIQ_STACK_SIZE * CORE_NUM
__fiq_stack_top:
__svc_stack:
.space OS_EXC_SVC_STACK_SIZE * CORE_NUM
__svc_stack_top:

10
arch/arm/arm/src/strncpy_from_user.c Executable file → Normal file
View File

@@ -33,11 +33,6 @@
#include "los_user_get.h"
#include "los_vm_map.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
INT32 LOS_StrncpyFromUser(CHAR *dst, const CHAR *src, INT32 count)
{
@@ -67,8 +62,3 @@ INT32 LOS_StrncpyFromUser(CHAR *dst, const CHAR *src, INT32 count)
return offset;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

10
arch/arm/arm/src/strnlen_user.c Executable file → Normal file
View File

@@ -33,11 +33,6 @@
#include "los_user_get.h"
#include "los_vm_map.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
INT32 LOS_StrnlenUser(const CHAR *src, INT32 count)
{
@@ -66,8 +61,3 @@ INT32 LOS_StrnlenUser(const CHAR *src, INT32 count)
return count + 1;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

21
arch/arm/arm/src/user_copy.c Executable file → Normal file
View File

@@ -31,15 +31,11 @@
#include "user_copy.h"
#include "arm_user_copy.h"
#include "arm_user_clear.h"
#include "securec.h"
#include "los_memory.h"
#include "los_vm_map.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
size_t arch_copy_from_user(void *dst, const void *src, size_t len)
{
@@ -101,22 +97,11 @@ INT32 LOS_UserMemClear(unsigned char *buf, UINT32 len)
if (!LOS_IsUserAddressRange((vaddr_t)(UINTPTR)buf, len)) {
(VOID)memset_s(buf, len, 0, len);
} else {
unsigned char *tmp = (unsigned char *)LOS_MemAlloc(OS_SYS_MEM_ADDR, len);
if (tmp == NULL) {
return -ENOMEM;
if (_arm_clear_user(buf, len)) {
return -EFAULT;
}
(VOID)memset_s(tmp, len, 0, len);
if (_arm_user_copy(buf, tmp, len) != 0) {
ret = -EFAULT;
}
LOS_MemFree(OS_SYS_MEM_ADDR, tmp);
}
return ret;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

48
arch/arm/gic/Makefile Normal file
View File

@@ -0,0 +1,48 @@
# 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 $(LITEOSTOPDIR)/config.mk
MODULE_NAME := $(notdir $(shell pwd))
# LOCAL_SRCS := $(wildcard *.c)
ifeq ($(LOSCFG_ARCH_GIC_V2), y)
LOCAL_SRCS := gic_v2.c
else ifeq ($(LOSCFG_ARCH_GIC_V3), y)
LOCAL_SRCS := gic_v3.c
endif
LOCAL_INCLUDE := \
-I $(LITEOSTOPDIR)/kernel/base/include \
-I $(LITEOSTOPDIR)/arch/arm/include \
-I $(LITEOSTOPDIR)/arch/arm/arm/src/include \
LOCAL_FLAGS := $(LOCAL_INCLUDE)
include $(MODULE)

View File

@@ -30,16 +30,17 @@
*/
#include "gic_common.h"
#include "los_hwi.h"
#include "los_hwi_pri.h"
#include "los_mp.h"
STATIC_ASSERT(OS_USER_HWI_MAX <= 1020, "hwi max is too large!");
#ifdef LOSCFG_PLATFORM_BSP_GIC_V2
#ifdef LOSCFG_ARCH_GIC_V2
STATIC UINT32 g_curIrqNum = 0;
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
/*
* filter description
* 0b00: forward to the cpu interfaces specified in cpu_mask
@@ -143,7 +144,7 @@ VOID HalIrqInit(VOID)
/* enable gic distributor control */
GIC_REG_32(GICD_CTLR) = 1;
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
/* register inter-processor interrupt */
(VOID)LOS_HwiCreate(LOS_MP_IPI_WAKEUP, 0xa0, 0, OsMpWakeHandler, 0);
(VOID)LOS_HwiCreate(LOS_MP_IPI_SCHEDULE, 0xa0, 0, OsMpScheduleHandler, 0);

View File

@@ -32,10 +32,11 @@
#include "gic_common.h"
#include "gic_v3.h"
#include "los_typedef.h"
#include "los_hwi.h"
#include "los_hwi_pri.h"
#include "los_mp.h"
#ifdef LOSCFG_PLATFORM_BSP_GIC_V3
#ifdef LOSCFG_ARCH_GIC_V3
STATIC UINT32 g_curIrqNum = 0;
@@ -47,7 +48,7 @@ STATIC INLINE UINT64 MpidrToAffinity(UINT64 mpidr)
(MPIDR_AFF_LEVEL(mpidr, 0)));
}
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
STATIC UINT32 NextCpu(UINT32 cpu, UINT32 cpuMask)
{
@@ -398,7 +399,7 @@ VOID HalIrqInit(VOID)
HalIrqInitPercpu();
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
/* register inter-processor interrupt */
LOS_HwiCreate(LOS_MP_IPI_WAKEUP, 0xa0, 0, OsMpWakeHandler, 0);
LOS_HwiCreate(LOS_MP_IPI_SCHEDULE, 0xa0, 0, OsMpScheduleHandler, 0);

View File

@@ -47,7 +47,7 @@ enum {
#define GIC_REV_MASK 0xF0
#define GIC_REV_OFFSET 0x4
#ifdef LOSCFG_PLATFORM_BSP_GIC_V2
#ifdef LOSCFG_ARCH_GIC_V2
#define GICC_CTLR (GICC_OFFSET + 0x00) /* CPU Interface Control Register */
#define GICC_PMR (GICC_OFFSET + 0x04) /* Interrupt Priority Mask Register */
#define GICC_BPR (GICC_OFFSET + 0x08) /* Binary Point Register */
@@ -76,7 +76,7 @@ enum {
#define GICD_PIDR2V2 (GICD_OFFSET + 0xfe8)
#define GICD_PIDR2V3 (GICD_OFFSET + 0xffe8)
#ifdef LOSCFG_PLATFORM_BSP_GIC_V3
#ifdef LOSCFG_ARCH_GIC_V3
#define GICD_IGRPMODR(n) (GICD_OFFSET + 0x0d00 + (n) * 4) /* Interrupt Group Mode Reisters */
#define GICD_IROUTER(n) (GICD_OFFSET + 0x6000 + (n) * 8) /* Interrupt Rounter Reisters */
#endif

View File

@@ -49,7 +49,7 @@ extern VOID HalIrqClear(UINT32 vector);
extern CHAR *HalIrqVersion(VOID);
extern UINT32 HalCurIrqGet(VOID);
extern UINT32 HalIrqSetPrio(UINT32 vector, UINT8 priority);
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
extern VOID HalIrqSendIpi(UINT32 target, UINT32 ipi);
extern VOID HalIrqSetAffinity(UINT32 vector, UINT32 cpuMask);
#endif

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

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

@@ -63,26 +63,29 @@ typedef struct {
UINT64 SPSR;
} ExcContext;
#else
/* It has the same structure as TaskContext */
typedef struct {
UINT32 USP; /**< User mode stack pointer */
UINT32 ULR; /**< User mode program returning address */
UINT32 regCPSR; /**< Current program status register (CPSR) */
UINT32 R4;
UINT32 R5;
UINT32 R6;
UINT32 R7;
UINT32 R8;
UINT32 R9;
UINT32 R10;
UINT32 R11;
UINT32 SP; /**< svc sp */
UINT32 reserved; /**< Reserved, multiplexing register */
UINT32 USP;
UINT32 ULR;
UINT32 R0; /**< Register R0 */
UINT32 R1; /**< Register R1 */
UINT32 R2; /**< Register R2 */
UINT32 R3; /**< Register R3 */
UINT32 R4; /**< Register R4 */
UINT32 R5; /**< Register R5 */
UINT32 R6; /**< Register R6 */
UINT32 R7; /**< Register R7 */
UINT32 R8; /**< Register R8 */
UINT32 R9; /**< Register R9 */
UINT32 R10; /**< Register R10 */
UINT32 R11; /**< Register R11 */
UINT32 R12; /**< Register R12 */
UINT32 SP; /**< Stack pointer */
UINT32 LR; /**< Program returning address. */
UINT32 PC; /**< PC pointer of the exceptional function */
UINT32 regCPSR;
} ExcContext;
#endif
@@ -183,7 +186,7 @@ extern UINT32 LOS_ExcRegHook(EXC_PROC_FUNC excHook);
* los_exc.h: the header file that contains the API declaration.
* @see None.
*/
VOID LOS_Panic(const CHAR *fmt, ...);
NORETURN VOID LOS_Panic(const CHAR *fmt, ...);
/**
* @ingroup los_exc

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

@@ -77,134 +77,6 @@ extern UINT64 g_cpuMap[];
#define CPU_MAP_GET(cpuid) g_cpuMap[(cpuid)]
#define CPU_MAP_SET(cpuid, hwid) g_cpuMap[(cpuid)] = (hwid)
/**
* @ingroup los_hw
* @brief Set Event.
*
* @par Description:
* <ul>
* <li>This API is used to send an event to all cores within a muti-processor system.</li>
* </ul>
* @attention
* <ul>
* <li>This API is not implemented.</li>
* </ul>
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see wfe.
*/
extern VOID Sev(VOID);
/**
* @ingroup los_hw
* @brief Wait for event.
*
* @par Description:
* <ul>
* <li>This API is used to suspend execution until events occurs if the event register is not set.</li>
* </ul>
* @attention
* <ul>
* <li>This API is not implemented.</li>
* </ul>
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see sev.
*/
extern VOID Wfe(VOID);
/**
* @ingroup los_hw
* @brief Wait for interrupt.
*
* @par Description:
* <ul>
* <li>This API is used to suspend execution until interrupt or a debug request occurs.</li>
* </ul>
* @attention None.
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see None.
*/
extern VOID Wfi(VOID);
/**
* @ingroup los_hw
* @brief Data Memory Barrier.
*
* @par Description:
* <ul>
* <li>This API is used as a memory barrier</li>
* </ul>
* @attention None.
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see None.
*/
extern VOID Dmb(VOID);
/**
* @ingroup los_hw
* @brief Data Synchronization Barrier.
*
* @par Description:
* <ul>
* <li>This API is used as a special kind of memory barrier</li>
* </ul>
* @attention None.
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see None.
*/
extern VOID Dsb(VOID);
/**
* @ingroup los_hw
* @brief Instruction Synchronization Barrier.
*
* @par Description:
* <ul>
* <li>This API is used to flush the pipeline in the processor,
* so that all instructions following the ISB are fetched from cache or memory,
* after the instruction has been completed.</li>
* </ul>
* @attention None.
*
* @param None.
*
* @retval #None.
*
* @par Dependency:
* los_hw.h: the header file that contains the API declaration.
* @see None.
*/
extern VOID Isb(VOID);
/**
* @ingroup los_hw
* @brief Invalidate instruction cache.

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

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

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

View File

@@ -44,19 +44,11 @@ extern "C" {
extern UINTPTR __stack_startup;
extern UINTPTR __stack_startup_top;
#else
extern UINTPTR __fiq_stack_top;
extern UINTPTR __svc_stack_top;
extern UINTPTR __abt_stack_top;
extern UINTPTR __undef_stack_top;
extern UINTPTR __exc_stack_top;
extern UINTPTR __fiq_stack;
extern UINTPTR __svc_stack;
extern UINTPTR __abt_stack;
extern UINTPTR __undef_stack;
extern UINTPTR __exc_stack;
#endif
extern UINTPTR __irq_stack_top;
extern UINTPTR __irq_stack;
#ifdef __cplusplus
#if __cplusplus

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

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

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

0
bsd/Kconfig Executable file → Normal file
View File

0
bsd/compat/linuxkpi/Makefile Executable file → Normal file
View File

2
bsd/dev/usb/Kconfig Executable file → Normal file
View File

@@ -15,7 +15,7 @@ config DRIVERS_USB_HOST_DRIVER
choice
depends on DRIVERS_USB_HOST_DRIVER
prompt "USB HCD"
default y
default DRIVERS_USB_HOST_EHCI
help
Enable EHCI for USB 2.0.
Enable XHCI for USB 3.0

0
bsd/dev/usb/Makefile Executable file → Normal file
View File

View File

@@ -1 +0,0 @@
../../../../../../third_party/NuttX/include/nuttx/usb/storage.h

View File

@@ -30,44 +30,65 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -e
echo "sh param:$1,$2,$3,$4,$5,$6,$7"
destination=".config"
config_file=""
tee=""
outdir="../..$3/test_info/gen/kernel/test"
if [ "$5" = "tee" ]; then
tee="_tee"
fi
productName="$(basename $7)"
source="tools/build/config/${productName}_release.config"
if [ "$2" = "clang" ]; then
if [ "$4" = "debug" ]; then
config_file="${productName}_$2$tee.config"
source="tools/build/config/debug/$config_file"
else
config_file="${productName}_$2_release$tee.config"
source="tools/build/config/$config_file"
fi
elif [ "$2" = "gcc" ]; then
if [ "$4" = "debug" ]; then
config_file="${productName}_debug_shell$tee.config"
source="tools/build/config/$config_file"
else
config_file="${productName}_release$tee.config"
source="tools/build/config/$config_file"
fi
fi
if [ -d "./out" ]; then
rm -rf ./out
fi
if [ -f "$destination" ]; then
rm -rf $destination
fi
if [ ! -f "$source" ]; then
source="$7/config/sys/$config_file"
fi
cp $source $destination
board_name=${1}
ohos_build_compiler=${2}
root_build_dir=${3}
ohos_build_type=${4}
tee_enable=${5}
device_company=${6}
product_path=${7}
outdir=${8}
ohos_version=${9}
sysroot_path=${10}
arch_cflags=${11}
device_path=${12}
mkdir -p $outdir
cp kernel_test.sources $outdir
echo "${board_name}" "${device_company}"
echo "sh param:" "$@"
function main() {
destination=".config"
tee=""
if [ "${tee_enable}" = "true" ]; then
tee="_tee"
fi
config_file="${product_path}/config/${ohos_build_type}${tee}.config"
if [ -f "${config_file}" ]; then
cp "${config_file}" "${destination}"
return
fi
product_name=$(basename "${product_path}")
config_file="${product_name}_release.config"
if [ "${ohos_build_compiler}" = "clang" ]; then
if [ "${ohos_build_type}" = "debug" ]; then
config_file="debug/${product_name}_${ohos_build_compiler}${tee}.config"
else
config_file="${product_name}_${ohos_build_compiler}_release${tee}.config"
fi
elif [ "${ohos_build_compiler}" = "gcc" ]; then
if [ "${ohos_build_type}" = "debug" ]; then
config_file="${product_name}_debug_shell${tee}.config"
else
config_file="${product_name}_release${tee}.config"
fi
fi
cp "tools/build/config/${config_file}" "${destination}"
}
if [ "x" != "x${sysroot_path}" ]; then
export SYSROOT_PATH=${sysroot_path}
fi
if [ "x" != "x${arch_cflags}" ]; then
export ARCH_CFLAGS="${arch_cflags}"
fi
export OUTDIR="${outdir}"
export PRODUCT_PATH="${product_path}"
export DEVICE_PATH="${device_path}"
main && \
make clean && \
make -j rootfs VERSION="${ohos_version}"

0
compat/posix/Kconfig Executable file → Normal file
View File

0
compat/posix/include/mqueue.h Executable file → Normal file
View File

9
compat/posix/include/time_posix.h Executable file → Normal file
View File

@@ -42,6 +42,13 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
struct ksigevent {
union sigval sigev_value;
int sigev_signo;
int sigev_notify;
int sigev_tid;
};
/* internal functions */
STATIC INLINE BOOL ValidTimeSpec(const struct timespec *tp)
{
@@ -78,6 +85,8 @@ STATIC INLINE VOID OsTick2TimeSpec(struct timespec *tp, UINT32 tick)
tp->tv_nsec = (long)(ns % OS_SYS_NS_PER_SECOND);
}
int OsTimerCreate(clockid_t, struct ksigevent *__restrict, timer_t *__restrict);
#ifdef __cplusplus
#if __cplusplus
}

View File

@@ -34,11 +34,6 @@
#include "los_sem.h"
#include "los_task.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
int map_errno(UINT32 err)
{
@@ -96,7 +91,7 @@ int map_errno(UINT32 err)
errno = ENOMEM;
break;
case LOS_ERRNO_SEM_PENDED:
case LOS_ERRNO_EVENT_SHOULD_NOT_DESTORY:
case LOS_ERRNO_EVENT_SHOULD_NOT_DESTROY:
errno = EBUSY;
break;
case LOS_ERRNO_SEM_PEND_IN_LOCK:
@@ -115,8 +110,3 @@ int map_errno(UINT32 err)
return errno;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

10
compat/posix/src/misc.c Executable file → Normal file
View File

@@ -37,11 +37,6 @@
#include "mqueue.h"
#include "semaphore.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/*
* Supply some suitable values for constants that may not be present
@@ -145,8 +140,3 @@ pid_t getpid(void)
return ((LosTaskCB *)(OsCurrTaskGet()))->taskID;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

24
compat/posix/src/mqueue.c Executable file → Normal file
View File

@@ -30,6 +30,7 @@
*/
#include "mqueue.h"
#ifdef LOSCFG_FS_VFS
#include "fcntl.h"
#include "pthread.h"
#include "map_error.h"
@@ -37,14 +38,9 @@
#include "los_memory.h"
#include "los_vm_map.h"
#include "los_process_pri.h"
#include "fs_file.h"
#include "fs/file.h"
#include "user_copy.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define FNONBLOCK O_NONBLOCK
@@ -744,11 +740,8 @@ int mq_timedsend(mqd_t personal, const char *msg, size_t msgLen, unsigned int ms
(VOID)pthread_mutex_lock(&g_mqueueMutex);
privateMqPersonal = MqGetPrivDataBuff(personal);
if (privateMqPersonal == NULL) {
goto ERROUT_UNLOCK;
}
OS_MQ_GOTO_ERROUT_UNLOCK_IF(privateMqPersonal->mq_status != MQ_USE_MAGIC, EBADF);
OS_MQ_GOTO_ERROUT_UNLOCK_IF(privateMqPersonal == NULL || privateMqPersonal->mq_status != MQ_USE_MAGIC, EBADF);
mqueueCB = privateMqPersonal->mq_posixdes;
OS_MQ_GOTO_ERROUT_UNLOCK_IF(msgLen > (size_t)(mqueueCB->mqcb->queueSize - sizeof(UINT32)), EMSGSIZE);
@@ -791,10 +784,7 @@ ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *
(VOID)pthread_mutex_lock(&g_mqueueMutex);
privateMqPersonal = MqGetPrivDataBuff(personal);
if (privateMqPersonal == NULL) {
goto ERROUT_UNLOCK;
}
if (privateMqPersonal->mq_status != MQ_USE_MAGIC) {
if (privateMqPersonal == NULL || privateMqPersonal->mq_status != MQ_USE_MAGIC) {
errno = EBADF;
goto ERROUT_UNLOCK;
}
@@ -842,8 +832,4 @@ ssize_t mq_receive(mqd_t personal, char *msg_ptr, size_t msg_len, unsigned int *
return mq_timedreceive(personal, msg_ptr, msg_len, msg_prio, NULL);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif

View File

@@ -32,11 +32,6 @@
#include "los_typedef.h"
#include "los_memory.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
int posix_memalign(void **memAddr, size_t alignment, size_t size)
{
@@ -52,8 +47,3 @@ int posix_memalign(void **memAddr, size_t alignment, size_t size)
return ENOERR;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

14
compat/posix/src/pthread.c Executable file → Normal file
View File

@@ -38,11 +38,6 @@
#include "los_process_pri.h"
#include "los_sched_pri.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/*
* Array of pthread control structures. A pthread_t object is
@@ -209,7 +204,7 @@ STATIC UINT32 InitPthreadData(pthread_t threadID, pthread_attr_t *userAttr,
PRINT_ERR("%s: %d, err: %d\n", __FUNCTION__, __LINE__, err);
return LOS_NOK;
}
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
if (userAttr->cpuset.__bits[0] > 0) {
taskCB->cpuAffiMask = (UINT16)userAttr->cpuset.__bits[0];
}
@@ -440,7 +435,7 @@ int pthread_detach(pthread_t thread)
/* Set state to detached and kick any joinees to make them return. */
SCHEDULER_LOCK(intSave);
if (!(detached->task->taskStatus & OS_TASK_STATUS_EXIT)) {
ret = OsTaskSetDeatchUnsafe(detached->task);
ret = OsTaskSetDetachUnsafe(detached->task);
if (ret == ESRCH) {
ret = LOS_OK;
} else if (ret == LOS_OK) {
@@ -809,8 +804,3 @@ int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize, cpu_set_t* cpuse
}
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -32,11 +32,6 @@
#include "pthread.h"
#include "pprivate.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
int pthread_attr_init(pthread_attr_t *attr)
{
@@ -54,7 +49,7 @@ int pthread_attr_init(pthread_attr_t *attr)
attr->stacksize_set = 1;
attr->stacksize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
attr->cpuset.__bits[0] = 0;
#endif
@@ -244,7 +239,7 @@ int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stackSize)
*/
int pthread_attr_setaffinity_np(pthread_attr_t* attr, size_t cpusetsize, const cpu_set_t* cpuset)
{
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
if (attr == NULL) {
return EINVAL;
}
@@ -269,7 +264,7 @@ int pthread_attr_setaffinity_np(pthread_attr_t* attr, size_t cpusetsize, const c
*/
int pthread_attr_getaffinity_np(const pthread_attr_t* attr, size_t cpusetsize, cpu_set_t* cpuset)
{
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
if ((attr == NULL) || (cpuset == NULL) || (cpusetsize != sizeof(cpu_set_t))) {
return EINVAL;
}
@@ -280,8 +275,3 @@ int pthread_attr_getaffinity_np(const pthread_attr_t* attr, size_t cpusetsize, c
return ENOERR;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

10
compat/posix/src/pthread_cond.c Executable file → Normal file
View File

@@ -36,11 +36,6 @@
#include "los_atomic.h"
#include "los_event_pri.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define BROADCAST_EVENT 1
#define COND_COUNTER_STEP 0x0004U
@@ -351,8 +346,3 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
return ret;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

10
compat/posix/src/pthread_mutex.c Executable file → Normal file
View File

@@ -31,11 +31,6 @@
#include "pthread.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
int pthread_mutexattr_init(pthread_mutexattr_t *attr)
{
@@ -139,8 +134,3 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex)
return LOS_MuxUnlock(mutex);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

View File

@@ -35,11 +35,6 @@
#include "unistd.h"
#include "los_task_pri.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
int sched_get_priority_min(int policy)
{
@@ -66,7 +61,7 @@ int sched_get_priority_max(int policy)
*/
int sched_setaffinity(pid_t pid, size_t set_size, const cpu_set_t* set)
{
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
UINT32 taskID = (UINT32)pid;
UINT32 ret;
@@ -98,7 +93,7 @@ int sched_setaffinity(pid_t pid, size_t set_size, const cpu_set_t* set)
*/
int sched_getaffinity(pid_t pid, size_t set_size, cpu_set_t* set)
{
#if (LOSCFG_KERNEL_SMP == YES)
#ifdef LOSCFG_KERNEL_SMP
UINT32 taskID = (UINT32)pid;
UINT16 cpuAffiMask;
@@ -143,8 +138,3 @@ int __sched_cpucount(size_t set_size, const cpu_set_t* set)
return count;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

10
compat/posix/src/semaphore.c Executable file → Normal file
View File

@@ -34,11 +34,6 @@
#include "map_error.h"
#include "time_posix.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* Initialize semaphore to value, shared is not supported in Huawei LiteOS. */
int sem_init(sem_t *sem, int shared, unsigned int value)
@@ -197,8 +192,3 @@ int sem_unlink(const char *name)
return -1;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

214
compat/posix/src/time.c Executable file → Normal file
View File

@@ -50,11 +50,8 @@
#include "los_swtmr_pri.h"
#include "los_sys_pri.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define CPUCLOCK_PERTHREAD_MASK 4
#define CPUCLOCK_ID_OFFSET 3
/*
* Do a time package defined return. This requires the error code
@@ -280,7 +277,7 @@ STATIC VOID OsGetHwTime(struct timespec64 *hwTime)
{
UINT64 nowNsec;
nowNsec = hi_sched_clock();
nowNsec = LOS_CurrNanosec();
hwTime->tv_sec = nowNsec / OS_SYS_NS_PER_SECOND;
hwTime->tv_nsec = nowNsec - hwTime->tv_sec * OS_SYS_NS_PER_SECOND;
}
@@ -431,7 +428,6 @@ int clock_settime(clockid_t clockID, const struct timespec *tp)
case CLOCK_BOOTTIME:
case CLOCK_REALTIME_ALARM:
case CLOCK_BOOTTIME_ALARM:
case CLOCK_SGI_CYCLE:
case CLOCK_TAI:
case CLOCK_THREAD_CPUTIME_ID:
TIME_RETURN(ENOTSUP);
@@ -455,13 +451,119 @@ int clock_settime(clockid_t clockID, const struct timespec *tp)
return settimeofday(&tv, NULL);
}
#ifdef LOSCFG_KERNEL_CPUP
static int PthreadGetCputime(clockid_t clockID, struct timespec *ats)
{
uint64_t runtime;
UINT32 intSave;
UINT32 tid = ((UINT32) ~((UINT32)(clockID) >> CPUCLOCK_ID_OFFSET));
if (OS_TID_CHECK_INVALID(tid)) {
return -EINVAL;
}
LosTaskCB *task = OsGetTaskCB(tid);
if (OsCurrTaskGet()->processID != task->processID) {
return -EINVAL;
}
SCHEDULER_LOCK(intSave);
runtime = task->taskCpup.allTime;
SCHEDULER_UNLOCK(intSave);
ats->tv_sec = runtime / OS_SYS_NS_PER_SECOND;
ats->tv_nsec = runtime % OS_SYS_NS_PER_SECOND;
return 0;
}
static int ProcessGetCputime(clockid_t clockID, struct timespec *ats)
{
UINT64 runtime;
UINT32 intSave;
const pid_t pid = ((pid_t) ~((UINT32)(clockID) >> CPUCLOCK_ID_OFFSET));
LosProcessCB *spcb = NULL;
if (OsProcessIDUserCheckInvalid(pid) || pid < 0) {
return -EINVAL;
}
spcb = OS_PCB_FROM_PID(pid);
if (OsProcessIsUnused(spcb)) {
return -EINVAL;
}
SCHEDULER_LOCK(intSave);
runtime = spcb->processCpup.allTime;
SCHEDULER_UNLOCK(intSave);
ats->tv_sec = runtime / OS_SYS_NS_PER_SECOND;
ats->tv_nsec = runtime % OS_SYS_NS_PER_SECOND;
return 0;
}
static int GetCputime(clockid_t clockID, struct timespec *tp)
{
int ret;
if (clockID >= 0) {
return -EINVAL;
}
if ((UINT32)clockID & CPUCLOCK_PERTHREAD_MASK) {
ret = PthreadGetCputime(clockID, tp);
} else {
ret = ProcessGetCputime(clockID, tp);
}
return ret;
}
static int CheckClock(const clockid_t clockID)
{
int error = 0;
const pid_t pid = ((pid_t) ~((UINT32)(clockID) >> CPUCLOCK_ID_OFFSET));
if (!((UINT32)clockID & CPUCLOCK_PERTHREAD_MASK)) {
LosProcessCB *spcb = NULL;
if (OsProcessIDUserCheckInvalid(pid) || pid < 0) {
return -EINVAL;
}
spcb = OS_PCB_FROM_PID(pid);
if (OsProcessIsUnused(spcb)) {
error = -EINVAL;
}
} else {
error = -EINVAL;
}
return error;
}
static int CpuClockGetres(const clockid_t clockID, struct timespec *tp)
{
if (clockID > 0) {
return -EINVAL;
}
int error = CheckClock(clockID);
if (!error) {
error = ProcessGetCputime(clockID, tp);
}
return error;
}
#endif
int clock_gettime(clockid_t clockID, struct timespec *tp)
{
UINT32 intSave;
struct timespec64 tmp = {0};
struct timespec64 hwTime = {0};
if ((clockID > MAX_CLOCKS) || (clockID < CLOCK_REALTIME)) {
if (clockID > MAX_CLOCKS) {
goto ERROUT;
}
@@ -498,16 +600,22 @@ int clock_gettime(clockid_t clockID, struct timespec *tp)
case CLOCK_BOOTTIME:
case CLOCK_REALTIME_ALARM:
case CLOCK_BOOTTIME_ALARM:
case CLOCK_SGI_CYCLE:
case CLOCK_TAI:
TIME_RETURN(ENOTSUP);
default:
goto ERROUT;
{
#ifdef LOSCFG_KERNEL_CPUP
int ret = GetCputime(clockID, tp);
TIME_RETURN(-ret);
#else
TIME_RETURN(EINVAL);
#endif
}
}
return 0;
ERROUT:
ERROUT:
TIME_RETURN(EINVAL);
}
@@ -537,11 +645,17 @@ int clock_getres(clockid_t clockID, struct timespec *tp)
case CLOCK_BOOTTIME:
case CLOCK_REALTIME_ALARM:
case CLOCK_BOOTTIME_ALARM:
case CLOCK_SGI_CYCLE:
case CLOCK_TAI:
TIME_RETURN(ENOTSUP);
default:
#ifdef LOSCFG_KERNEL_CPUP
{
int ret = CpuClockGetres(clockID, tp);
TIME_RETURN(-ret);
}
#else
TIME_RETURN(EINVAL);
#endif
}
TIME_RETURN(0);
@@ -564,7 +678,6 @@ int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct
case CLOCK_BOOTTIME:
case CLOCK_REALTIME_ALARM:
case CLOCK_BOOTTIME_ALARM:
case CLOCK_SGI_CYCLE:
case CLOCK_TAI:
if (flags == 0 || flags == TIMER_ABSTIME) {
TIME_RETURN(ENOTSUP);
@@ -580,45 +693,60 @@ int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct
typedef struct {
int sigev_signo;
UINT32 pid;
pid_t pid;
unsigned int tid;
union sigval sigev_value;
} swtmr_proc_arg;
static VOID SwtmrProc(UINTPTR tmrArg)
{
unsigned int intSave;
int sig;
INT32 sig, ret;
UINT32 intSave;
pid_t pid;
siginfo_t info;
swtmr_proc_arg *arg = (swtmr_proc_arg *)tmrArg;
if (arg == NULL) {
return;
}
LosTaskCB *stcb = NULL;
sig = arg->sigev_signo + 1;
swtmr_proc_arg *arg = (swtmr_proc_arg *)tmrArg;
OS_GOTO_EXIT_IF(arg == NULL, EINVAL);
sig = arg->sigev_signo;
pid = arg->pid;
/* Make sure that the para is valid */
if (!GOOD_SIGNO(sig) || pid <= 0) {
return;
}
if (OS_PID_CHECK_INVALID(pid)) {
return;
}
OS_GOTO_EXIT_IF(!GOOD_SIGNO(sig), EINVAL);
/* Create the siginfo structure */
info.si_signo = sig;
info.si_code = SI_TIMER;
info.si_value.sival_ptr = arg->sigev_value.sival_ptr;
/* Send the signal */
SCHEDULER_LOCK(intSave);
OsDispatch(pid, &info, OS_USER_KILL_PERMISSION);
SCHEDULER_UNLOCK(intSave);
/* Send signals to threads or processes */
if (arg->tid > 0) {
/* Make sure that the para is valid */
OS_GOTO_EXIT_IF(OS_TID_CHECK_INVALID(arg->tid), EINVAL);
stcb = OsGetTaskCB(arg->tid);
ret = OsUserProcessOperatePermissionsCheck(stcb, stcb->processID);
OS_GOTO_EXIT_IF(ret != LOS_OK, -ret);
/* Dispatch the signal to thread, bypassing normal task group thread
* dispatch rules. */
SCHEDULER_LOCK(intSave);
ret = OsTcbDispatch(stcb, &info);
SCHEDULER_UNLOCK(intSave);
OS_GOTO_EXIT_IF(ret != LOS_OK, -ret);
} else {
/* Make sure that the para is valid */
OS_GOTO_EXIT_IF(pid <= 0 || OS_PID_CHECK_INVALID(pid), EINVAL);
/* Dispatch the signal to process */
SCHEDULER_LOCK(intSave);
OsDispatch(pid, &info, OS_USER_KILL_PERMISSION);
SCHEDULER_UNLOCK(intSave);
}
return;
EXIT:
PRINT_ERR("Dsipatch signals failed!, ret: %d\r\n", ret);
return;
}
int timer_create(clockid_t clockID, struct sigevent *evp, timer_t *timerID)
int OsTimerCreate(clockid_t clockID, struct ksigevent *evp, timer_t *timerID)
{
UINT32 ret;
UINT16 swtmrID;
@@ -648,7 +776,9 @@ int timer_create(clockid_t clockID, struct sigevent *evp, timer_t *timerID)
errno = ENOMEM;
return -1;
}
arg->sigev_signo = signo - 1;
arg->tid = evp ? evp->sigev_tid : 0;
arg->sigev_signo = signo;
arg->pid = LOS_GetCurrProcessID();
arg->sigev_value.sival_ptr = evp ? evp->sigev_value.sival_ptr : NULL;
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, SwtmrProc, &swtmrID, (UINTPTR)arg);
@@ -869,8 +999,8 @@ clock_t clock(VOID)
clock_t clockMsec;
UINT64 nowNsec;
nowNsec = hi_sched_clock();
clockMsec = (clock_t)(nowNsec / OS_SYS_NS_PER_MS);
nowNsec = LOS_CurrNanosec();
clockMsec = (clock_t)(nowNsec / (OS_SYS_NS_PER_SECOND / CLOCKS_PER_SEC));
return clockMsec;
}
@@ -901,15 +1031,16 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue
return -1;
}
/* To avoid creating an invalid timer after the timer has already been create */
if (processCB->timerID == (timer_t)(UINTPTR)MAX_INVALID_TIMER_VID) {
ret = timer_create(CLOCK_REALTIME, NULL, &timerID);
ret = OsTimerCreate(CLOCK_REALTIME, NULL, &timerID);
if (ret != LOS_OK) {
return ret;
}
}
/* The initialization of this global timer must be in spinlock
* timer_create cannot be located in spinlock.
* OsTimerCreate cannot be located in spinlock.
*/
SCHEDULER_LOCK(intSave);
if (processCB->timerID == (timer_t)(UINTPTR)MAX_INVALID_TIMER_VID) {
@@ -966,7 +1097,7 @@ int getitimer(int which, struct itimerval *value)
}
#ifdef LOSCFG_KERNEL_VDSO
VOID OsGetVdsoTime(VdsoDataPage *vdsoDataPage)
VOID OsVdsoTimeGet(VdsoDataPage *vdsoDataPage)
{
UINT32 intSave;
struct timespec64 tmp = {0};
@@ -990,8 +1121,3 @@ VOID OsGetVdsoTime(VdsoDataPage *vdsoDataPage)
}
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

0
config.mk Executable file → Normal file
View File

View File

@@ -31,7 +31,7 @@ include $(LITEOSTOPDIR)/config.mk
MODULE_NAME := $(notdir $(shell pwd))
LOCAL_SRCS := $(wildcard *.c)
LOCAL_SRCS := $(wildcard src/*.c)
LOCAL_INCLUDE := \

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