Compare commits
1238 Commits
OpenHarmon
...
weekly_202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3119d83a6a | ||
|
|
8482c9d7be | ||
|
|
248e9f7089 | ||
|
|
f2a35262bd | ||
|
|
794cdae65f | ||
|
|
7975f5c8ef | ||
|
|
fc4c694235 | ||
|
|
ead4da80ba | ||
|
|
8d980ded54 | ||
|
|
07e3feb456 | ||
|
|
b5ce4d34df | ||
|
|
99c81c4ffa | ||
|
|
4d1fd22b1c | ||
|
|
efa336ab26 | ||
|
|
0b05a46691 | ||
|
|
177f32283f | ||
|
|
6888193e3f | ||
|
|
6c352a7b10 | ||
|
|
73a9587f02 | ||
|
|
cbd03bd7e0 | ||
|
|
8d55bb1d8c | ||
|
|
e7daa28200 | ||
|
|
987a722d2d | ||
|
|
ccdfa72431 | ||
|
|
557a71c1c3 | ||
|
|
569aecb6ea | ||
|
|
8c0b7d0f38 | ||
|
|
c488817b32 | ||
|
|
43d47a27e3 | ||
|
|
a83f916298 | ||
|
|
8dbfd3846e | ||
|
|
f34762c105 | ||
|
|
043e84dfcb | ||
|
|
453c376198 | ||
|
|
204d7a4abb | ||
|
|
f2861a84bf | ||
|
|
96b2d557ac | ||
|
|
ffa11535ca | ||
|
|
b581207045 | ||
|
|
5105249ecf | ||
|
|
a61e2cf16e | ||
|
|
39e25c5220 | ||
|
|
5541965365 | ||
|
|
edd2223083 | ||
|
|
22392965b5 | ||
|
|
d906bb91ea | ||
|
|
51f6a20723 | ||
|
|
325ea29df3 | ||
|
|
c2f9f6705f | ||
|
|
71e51d8813 | ||
|
|
e0b4fcb23d | ||
|
|
7d62d3d62b | ||
|
|
69f3bf3a2a | ||
|
|
2590e34346 | ||
|
|
660b314f90 | ||
|
|
44ec199465 | ||
|
|
7437408f65 | ||
|
|
1134332a58 | ||
|
|
8099f6578d | ||
|
|
ba23a26f95 | ||
|
|
2dc24da826 | ||
|
|
6302c5f767 | ||
|
|
f0d5959576 | ||
|
|
65790b67d5 | ||
|
|
9eff5cff1d | ||
|
|
99ea8d4ed2 | ||
|
|
1568c317bb | ||
|
|
5e70129199 | ||
|
|
089376994a | ||
|
|
12adfd5832 | ||
|
|
c46c5a640d | ||
|
|
c812b0c27b | ||
|
|
51528ec39c | ||
|
|
059c1c22b1 | ||
|
|
beb03bfc81 | ||
|
|
bbbd96784e | ||
|
|
1c0de289ec | ||
|
|
a3d757c8e1 | ||
|
|
6fede4eb92 | ||
|
|
7be302633f | ||
|
|
0164461b33 | ||
|
|
9bb4be5e13 | ||
|
|
4acf1e9f8d | ||
|
|
870221452d | ||
|
|
30c3fb086e | ||
|
|
9b1e0a186b | ||
|
|
00dbf1e5d5 | ||
|
|
16fdbdf650 | ||
|
|
bee3d97163 | ||
|
|
9fb176b827 | ||
|
|
398f4a6ada | ||
|
|
19553f73e1 | ||
|
|
de24efadfa | ||
|
|
0057fb0dd5 | ||
|
|
bcf7e8ee02 | ||
|
|
0b9cac2cd3 | ||
|
|
9958f647f5 | ||
|
|
fa6b2d352c | ||
|
|
7f57e11ef9 | ||
|
|
1097d41a40 | ||
|
|
90d6ff9a6f | ||
|
|
eebe85fe31 | ||
|
|
b126f1cb5f | ||
|
|
639160f517 | ||
|
|
7fef6ac8d9 | ||
|
|
2f44d18618 | ||
|
|
fbc81cd821 | ||
|
|
a6e17fea9b | ||
|
|
18f7ab1380 | ||
|
|
d205cfa65a | ||
|
|
11b35fe795 | ||
|
|
b086195e97 | ||
|
|
b90531e366 | ||
|
|
a1a6286500 | ||
|
|
e1027b5902 | ||
|
|
b9a445ca44 | ||
|
|
338044cd9c | ||
|
|
18a2fc8e8d | ||
|
|
fa0e803ac9 | ||
|
|
4f641cc145 | ||
|
|
9063a45d5a | ||
|
|
4b4e1264f5 | ||
|
|
3f5307e7bb | ||
|
|
eddcb840d3 | ||
|
|
a0e205eb0a | ||
|
|
707028dfe1 | ||
|
|
49d72afc8e | ||
|
|
c11ff67869 | ||
|
|
b6a49e7c89 | ||
|
|
e847c8b468 | ||
|
|
faeeaf294c | ||
|
|
b2caf46b4e | ||
|
|
ccbc55df60 | ||
|
|
7f4294af00 | ||
|
|
4a63bacc47 | ||
|
|
ee6f3f0d79 | ||
|
|
e05300cdf0 | ||
|
|
b8951e2cd9 | ||
|
|
e3ce27536c | ||
|
|
a6c5309a5f | ||
|
|
65d5526c70 | ||
|
|
33c4e194b8 | ||
|
|
1b11caa45c | ||
|
|
6ba17fc862 | ||
|
|
f61ecd7669 | ||
|
|
ec3c8be6ee | ||
|
|
3cd28f32ca | ||
|
|
4b6a6e806f | ||
|
|
216c124854 | ||
|
|
e26d969ca8 | ||
|
|
45f66359cd | ||
|
|
5b87a530f5 | ||
|
|
5280a45434 | ||
|
|
f7a8630584 | ||
|
|
cb67dd5498 | ||
|
|
6d8cef40c8 | ||
|
|
41b80ad20a | ||
|
|
47fac7158e | ||
|
|
6c0e1b1f04 | ||
|
|
b06520ac7c | ||
|
|
e4cad073a9 | ||
|
|
b151fa6b65 | ||
|
|
40329e182c | ||
|
|
0f38ecb863 | ||
|
|
3f43438017 | ||
|
|
bc70db58a7 | ||
|
|
ac9399d2b7 | ||
|
|
89850d0715 | ||
|
|
86be540829 | ||
|
|
0f75bf01a6 | ||
|
|
395c0be775 | ||
|
|
a40f8383ee | ||
|
|
87a7df48b8 | ||
|
|
2df39a7e51 | ||
|
|
9f8127cc54 | ||
|
|
2f1ed39bc1 | ||
|
|
0770e5f972 | ||
|
|
0fb16312dc | ||
|
|
9a030d6930 | ||
|
|
29dde5d752 | ||
|
|
b797f50596 | ||
|
|
913d22bf83 | ||
|
|
3824d1e9e4 | ||
|
|
7941b93d1c | ||
|
|
d376efbe46 | ||
|
|
64ddb1ff07 | ||
|
|
f02d40d25d | ||
|
|
672bc729a6 | ||
|
|
31403e0e45 | ||
|
|
456d255a81 | ||
|
|
8c44c82723 | ||
|
|
4c024f757e | ||
|
|
59329ce7c6 | ||
|
|
be68dc8bca | ||
|
|
74f8d3aa07 | ||
|
|
dc479fb7bd | ||
|
|
91bdcbd3c2 | ||
|
|
422f22f5d2 | ||
|
|
6c0865dd46 | ||
|
|
0257a0a14f | ||
|
|
046d8defdf | ||
|
|
7938d2e569 | ||
|
|
3d00a7d23a | ||
|
|
e3cd485db5 | ||
|
|
0e3936c4f8 | ||
|
|
95248d4482 | ||
|
|
1ecda9c033 | ||
|
|
9018eab20f | ||
|
|
e6bdfbb7a5 | ||
|
|
a28fcee1c5 | ||
|
|
f47da44b39 | ||
|
|
b37a7b7929 | ||
|
|
8e356c99c7 | ||
|
|
a1ae2ecc13 | ||
|
|
b7d624208b | ||
|
|
87b8e6b0ad | ||
|
|
321018cee0 | ||
|
|
b0c046f8ac | ||
|
|
f2861ddfb4 | ||
|
|
48f5481c65 | ||
|
|
c18b51182b | ||
|
|
d6dc0642c5 | ||
|
|
748e0d8ffb | ||
|
|
1cdd7307f3 | ||
|
|
b65897d517 | ||
|
|
6c4e4b16ab | ||
|
|
a0ad1a4333 | ||
|
|
9995d8e0e4 | ||
|
|
0ca4a128d2 | ||
|
|
de29140edf | ||
|
|
997e61ed53 | ||
|
|
6c2b163c7d | ||
|
|
f504cc9145 | ||
|
|
979a8a8f27 | ||
|
|
b6f9dbbdba | ||
|
|
e567467b8a | ||
|
|
a776c04a3d | ||
|
|
f7932bd006 | ||
|
|
b0d31cb43f | ||
|
|
53addea304 | ||
|
|
954e7eb0cf | ||
|
|
0e48a0dd12 | ||
|
|
52c12f7c9d | ||
|
|
1e875d921b | ||
|
|
1db7aa7ada | ||
|
|
6a0c169780 | ||
|
|
bdb9864436 | ||
|
|
bc69ca104c | ||
|
|
0d325c56a1 | ||
|
|
5bed688ca6 | ||
|
|
63e71feca0 | ||
|
|
2ada41c826 | ||
|
|
9b397173fe | ||
|
|
2fa85a2c72 | ||
|
|
63a0fcaefb | ||
|
|
144214869f | ||
|
|
e1512566e3 | ||
|
|
6e886d4233 | ||
|
|
67e31f7b45 | ||
|
|
26c09d26fc | ||
|
|
1a8e22dcf1 | ||
|
|
8e614bb161 | ||
|
|
f88608e5a4 | ||
|
|
30d5badbce | ||
|
|
c8c07261ca | ||
|
|
2cd03c55b7 | ||
|
|
b3489d49d7 | ||
|
|
d955790a44 | ||
|
|
540b2017c5 | ||
|
|
212d1bd1e8 | ||
|
|
ba8438257a | ||
|
|
64e49aba7c | ||
|
|
3e7cfaa520 | ||
|
|
e748fdbe57 | ||
|
|
48f645db84 | ||
|
|
d73aff846b | ||
|
|
ce4323ff16 | ||
|
|
f6a7003c16 | ||
|
|
c12bef84b2 | ||
|
|
7a7c67cbdd | ||
|
|
d2a2f96adf | ||
|
|
5db6c62313 | ||
|
|
011a55ff21 | ||
|
|
68f9f49c2a | ||
|
|
fe4082ca9e | ||
|
|
ac08912230 | ||
|
|
a32a7c4fad | ||
|
|
bba832ea08 | ||
|
|
09fd11bc38 | ||
|
|
9ba725c3d4 | ||
|
|
2bddff54c8 | ||
|
|
bc32a1ec0f | ||
|
|
5d5df3a5d7 | ||
|
|
07cab40473 | ||
|
|
5ce70a50c3 | ||
|
|
0f878febb7 | ||
|
|
f63ce99399 | ||
|
|
e317f9b5b5 | ||
|
|
cc6e11281e | ||
|
|
9525ca2826 | ||
|
|
a412bfb275 | ||
|
|
3b8083815c | ||
|
|
a2fed9a56c | ||
|
|
2251b8a2d1 | ||
|
|
5077b1793f | ||
|
|
e99aba9d0f | ||
|
|
eedde91826 | ||
|
|
cdc0877f16 | ||
|
|
0f8ff8f545 | ||
|
|
f06e090a10 | ||
|
|
38163de8f3 | ||
|
|
fcb21ffc8a | ||
|
|
2e3bbf1e61 | ||
|
|
466996b2e1 | ||
|
|
52379242c1 | ||
|
|
e0a6e1f9f0 | ||
|
|
e54eb9e34d | ||
|
|
ef1d9f848d | ||
|
|
ebfac57d54 | ||
|
|
3074449c79 | ||
|
|
78a297fd4e | ||
|
|
5004ef4d87 | ||
|
|
79839a4325 | ||
|
|
b2274a009e | ||
|
|
a55f68f957 | ||
|
|
0f0e85b7a6 | ||
|
|
308750199f | ||
|
|
2f6cd46372 | ||
|
|
ea45982e1f | ||
|
|
f2f5c5fdc3 | ||
|
|
91c1737d1b | ||
|
|
557f4ccb66 | ||
|
|
1ed28b4c80 | ||
|
|
6827bd2a22 | ||
|
|
614cdccf91 | ||
|
|
23c4f2b81b | ||
|
|
d6f48477a4 | ||
|
|
7676cdb886 | ||
|
|
bd0c0835fc | ||
|
|
24ba16a01e | ||
|
|
f6ac03d3e3 | ||
|
|
f601c16b9e | ||
|
|
c121d0eea3 | ||
|
|
cf8446c941 | ||
|
|
e328c528b1 | ||
|
|
2be59680f2 | ||
|
|
805a67ae2f | ||
|
|
37bc11fa88 | ||
|
|
0507b9e8ea | ||
|
|
acd631c731 | ||
|
|
c1c2be2a87 | ||
|
|
bda00e6747 | ||
|
|
cb423f8454 | ||
|
|
d3b618887a | ||
|
|
e8f5a286aa | ||
|
|
b551270ef5 | ||
|
|
4ecc473843 | ||
|
|
8096d9f575 | ||
|
|
6d249618ae | ||
|
|
40338918d9 | ||
|
|
fd4b97e3f8 | ||
|
|
13e1e70358 | ||
|
|
c360a97bab | ||
|
|
665c152c27 | ||
|
|
3f71be7535 | ||
|
|
298ccea3fe | ||
|
|
56a92f9207 | ||
|
|
d21b05c0f6 | ||
|
|
29df5dc1f2 | ||
|
|
e4a06623ce | ||
|
|
e1b36bfe41 | ||
|
|
3dd952b0b7 | ||
|
|
06ea03715f | ||
|
|
48ca854bf0 | ||
|
|
c7da23695c | ||
|
|
2c33cfce86 | ||
|
|
9bf580b1f6 | ||
|
|
3be31d1cfb | ||
|
|
ee72b21aff | ||
|
|
6e0a3f10bb | ||
|
|
e1b85a4570 | ||
|
|
9726ba11a7 | ||
|
|
0fa1310a32 | ||
|
|
f7d010dfa4 | ||
|
|
bf030b6bb5 | ||
|
|
63fd8bc39b | ||
|
|
7d7cff4c51 | ||
|
|
9ab3e351d3 | ||
|
|
492264b8e6 | ||
|
|
d59aad1f3a | ||
|
|
9b07aece2d | ||
|
|
de8bd2866a | ||
|
|
1150f86d46 | ||
|
|
9fdb80f85f | ||
|
|
93e74c5f0b | ||
|
|
d23f2fc73f | ||
|
|
c0721f4f0b | ||
|
|
a375bf5668 | ||
|
|
52d1d8d8d0 | ||
|
|
c79bcd028e | ||
|
|
ecd9ca7781 | ||
|
|
38a6b804e9 | ||
|
|
92f33ab9c4 | ||
|
|
b3d96d166c | ||
|
|
0326cbf12e | ||
|
|
c3facd1b95 | ||
|
|
8713997548 | ||
|
|
a627cdba0c | ||
|
|
214f44e935 | ||
|
|
ba977dd5ab | ||
|
|
1ecacc15b1 | ||
|
|
33d0c1bd0b | ||
|
|
e095e87682 | ||
|
|
597ced7948 | ||
|
|
f67c4dae51 | ||
|
|
5e87d8c183 | ||
|
|
de8257bc82 | ||
|
|
19b39b1bff | ||
|
|
5e07663374 | ||
|
|
f9a907772f | ||
|
|
007f385396 | ||
|
|
463bc0546f | ||
|
|
0c93a9b4f8 | ||
|
|
d30a009ba5 | ||
|
|
4bee53a610 | ||
|
|
81b474813b | ||
|
|
dc9ec6856f | ||
|
|
658fafe83b | ||
|
|
f3562e490c | ||
|
|
9888185fcb | ||
|
|
055295b6d1 | ||
|
|
c26ca519f7 | ||
|
|
df35eb513d | ||
|
|
7cb2ad67bf | ||
|
|
98ca8441fe | ||
|
|
3393479c52 | ||
|
|
aa5b2c7641 | ||
|
|
7661aedcc9 | ||
|
|
c97178f2f6 | ||
|
|
8839fdd399 | ||
|
|
a3b480b18e | ||
|
|
defedb6fdf | ||
|
|
7019fdfcbb | ||
|
|
5a80d4e1a3 | ||
|
|
1ec8d5a454 | ||
|
|
7c577d8963 | ||
|
|
6e2a4be155 | ||
|
|
682ae82158 | ||
|
|
e828cbdeac | ||
|
|
45a128a4f0 | ||
|
|
83bff88f7f | ||
|
|
181322a3c1 | ||
|
|
5369b6aa23 | ||
|
|
0e260949c9 | ||
|
|
8b267dc690 | ||
|
|
d16bfd005a | ||
|
|
40297a6dbc | ||
|
|
752aa49018 | ||
|
|
5569b1d1ec | ||
|
|
9549f5ebd0 | ||
|
|
aa1cd245a5 | ||
|
|
36cfc68a54 | ||
|
|
4dc059f207 | ||
|
|
f4409babd4 | ||
|
|
e1b9a6b185 | ||
|
|
b5528e1d17 | ||
|
|
2db80ecb38 | ||
|
|
ec366df863 | ||
|
|
e1472b494f | ||
|
|
67ac8c4c58 | ||
|
|
555e0681be | ||
|
|
fb5df47b6c | ||
|
|
339e937a6a | ||
|
|
5910c9ab8d | ||
|
|
9fa8d27c6c | ||
|
|
7bc68f454f | ||
|
|
dc3cc094a7 | ||
|
|
1aa9f98858 | ||
|
|
42a3a6c51b | ||
|
|
bbdb977b5e | ||
|
|
87c2d4f7e4 | ||
|
|
0f4d5a4b0c | ||
|
|
dd91c5c772 | ||
|
|
da43449939 | ||
|
|
d6e0d3ee7d | ||
|
|
27dca4d857 | ||
|
|
70a8901c72 | ||
|
|
2f214bf4de | ||
|
|
76507c05a8 | ||
|
|
9b24cc4915 | ||
|
|
e64ee0f4e6 | ||
|
|
e13cb3bcc4 | ||
|
|
51da89a3fb | ||
|
|
42f374dd7a | ||
|
|
689c2e90cf | ||
|
|
cdf96fef0c | ||
|
|
26ee8b836e | ||
|
|
6917e08431 | ||
|
|
4c57aa26ad | ||
|
|
007c75eb18 | ||
|
|
8118408123 | ||
|
|
8df3e8c965 | ||
|
|
5edd78e756 | ||
|
|
ba16cd34d4 | ||
|
|
77dcef4bc0 | ||
|
|
024a8f2771 | ||
|
|
3bfa995a9d | ||
|
|
6549fd8be6 | ||
|
|
9ec208a273 | ||
|
|
53ced1a85e | ||
|
|
2b9c55fd90 | ||
|
|
7a98cad11a | ||
|
|
827e060606 | ||
|
|
78e8d86611 | ||
|
|
30b7d34eb4 | ||
|
|
a23b491f8c | ||
|
|
72734a335c | ||
|
|
626b6600c0 | ||
|
|
e8037dc56a | ||
|
|
4c8a86ece7 | ||
|
|
3cc09763f2 | ||
|
|
3bb3173604 | ||
|
|
d2fe0e788b | ||
|
|
6a5a0326d2 | ||
|
|
c3245b3ce3 | ||
|
|
e425187d17 | ||
|
|
a6c02e29c1 | ||
|
|
d169cad6b4 | ||
|
|
4875707b37 | ||
|
|
9b4fd13c3c | ||
|
|
343b92661d | ||
|
|
79982895ec | ||
|
|
7f7eb8374f | ||
|
|
1c8f3b98c9 | ||
|
|
8de96bba65 | ||
|
|
c66681a1f9 | ||
|
|
8696e1c6cb | ||
|
|
4dc421e3de | ||
|
|
ce66a234fc | ||
|
|
f85c27de59 | ||
|
|
9c291a4361 | ||
|
|
1722aaa80d | ||
|
|
88358ab302 | ||
|
|
1e5d01360b | ||
|
|
a7a25bb0a3 | ||
|
|
1394b3be26 | ||
|
|
590c7b4e22 | ||
|
|
698756d1e6 | ||
|
|
7819d15b36 | ||
|
|
11a9b00d43 | ||
|
|
2ad176e587 | ||
|
|
c54bfa16e3 | ||
|
|
187884937c | ||
|
|
2d8e59ccf3 | ||
|
|
85b4cb7a67 | ||
|
|
66764e48fb | ||
|
|
def22d3fd1 | ||
|
|
08878bd99f | ||
|
|
468c47b6b1 | ||
|
|
f3beb4b273 | ||
|
|
c71ec9d7e8 | ||
|
|
787fae2eec | ||
|
|
875c46290b | ||
|
|
09d5bcc22d | ||
|
|
abf4d8fb25 | ||
|
|
0dc79479ff | ||
|
|
0dfa58ca5a | ||
|
|
4427142d73 | ||
|
|
a531bcf389 | ||
|
|
9458de9ac6 | ||
|
|
76f45b3fb2 | ||
|
|
aaa9018acf | ||
|
|
3b5268f02a | ||
|
|
fa056ce246 | ||
|
|
0ad91713f6 | ||
|
|
9e9c7b28d4 | ||
|
|
8f6a1dd33c | ||
|
|
77270dd783 | ||
|
|
8755dc9d35 | ||
|
|
a8805a65aa | ||
|
|
4adc15e630 | ||
|
|
d9774e016e | ||
|
|
c610578d73 | ||
|
|
3b9e3f8471 | ||
|
|
58d4366e1d | ||
|
|
650d2b91cd | ||
|
|
35a2f3af33 | ||
|
|
2ff44c4938 | ||
|
|
7b7d64cc87 | ||
|
|
70c18b4a75 | ||
|
|
14bd753aa8 | ||
|
|
8729f6ee57 | ||
|
|
51a50c95b4 | ||
|
|
9d3e872454 | ||
|
|
80473f0975 | ||
|
|
7a6e4c8155 | ||
|
|
c40e1464b9 | ||
|
|
700c3415c4 | ||
|
|
0973004870 | ||
|
|
c9d69e2d1b | ||
|
|
d79fd50693 | ||
|
|
9547133e64 | ||
|
|
2d31aed27b | ||
|
|
d9ed4b4bf6 | ||
|
|
60bf2fc517 | ||
|
|
cb17fa50ed | ||
|
|
09c491ca1f | ||
|
|
a531da901d | ||
|
|
a195aac9fb | ||
|
|
1157c4a289 | ||
|
|
0056b4ade5 | ||
|
|
78a50aff99 | ||
|
|
7240fe3bd4 | ||
|
|
e7c4b1963a | ||
|
|
fd6f91bc9f | ||
|
|
33f5c70e6c | ||
|
|
ec977a1c7e | ||
|
|
92d7672b19 | ||
|
|
390159f58a | ||
|
|
d8be8aad65 | ||
|
|
6d948a42bb | ||
|
|
72d9aa1bcb | ||
|
|
8390738de5 | ||
|
|
40f239a7d4 | ||
|
|
cacb4f0103 | ||
|
|
ee54cd8b7e | ||
|
|
f523d7a98c | ||
|
|
d7387508e3 | ||
|
|
e4ff04586f | ||
|
|
8784694686 | ||
|
|
b29d9d88ab | ||
|
|
d8263b1e91 | ||
|
|
9304a683ad | ||
|
|
78906f4a6c | ||
|
|
ee7eb89354 | ||
|
|
55e5e29005 | ||
|
|
ac8c2c6d5b | ||
|
|
feae60c8fe | ||
|
|
425975e481 | ||
|
|
cc731d1e69 | ||
|
|
56a95b9ec9 | ||
|
|
3e7622ca78 | ||
|
|
b1b4ddcc7d | ||
|
|
e567a10d02 | ||
|
|
23fd4e55a3 | ||
|
|
e57dc7762b | ||
|
|
003810284c | ||
|
|
379d602ab6 | ||
|
|
bf7b2c0a3e | ||
|
|
4e4f2d6d7e | ||
|
|
d7672d47f2 | ||
|
|
abbeca1cb2 | ||
|
|
50c8abc521 | ||
|
|
0469e5b849 | ||
|
|
dfea902a08 | ||
|
|
339c467e71 | ||
|
|
455e42e5b9 | ||
|
|
6f6dc4f24c | ||
|
|
9e45086d19 | ||
|
|
9515d53dcc | ||
|
|
e0a27badde | ||
|
|
49856dc1e0 | ||
|
|
43bdf2f1d3 | ||
|
|
eb1900d4db | ||
|
|
7de43bb004 | ||
|
|
1d952a254a | ||
|
|
9db3407589 | ||
|
|
bb6abd8c6b | ||
|
|
3cddcb9f66 | ||
|
|
bfd27e78b2 | ||
|
|
a8384b5db2 | ||
|
|
5db839acef | ||
|
|
f4626985fd | ||
|
|
68da7aefc5 | ||
|
|
f1b4c87bc4 | ||
|
|
1348809807 | ||
|
|
eb72f78cf1 | ||
|
|
12577eade5 | ||
|
|
de6db86df3 | ||
|
|
56b8ecaf17 | ||
|
|
1e345f18b3 | ||
|
|
f793dc1097 | ||
|
|
112cdebe41 | ||
|
|
a28dcc38c9 | ||
|
|
3d1cf683f3 | ||
|
|
a9fc1e0e5d | ||
|
|
2e2b14205f | ||
|
|
b8e18ffdf1 | ||
|
|
21d8ac8752 | ||
|
|
008fa8660d | ||
|
|
6860246cfa | ||
|
|
8a3d188240 | ||
|
|
8f0d25225e | ||
|
|
8fe0cc7770 | ||
|
|
ee4cf83121 | ||
|
|
702d8d9dde | ||
|
|
290a3c6f92 | ||
|
|
600dded31e | ||
|
|
67806596a3 | ||
|
|
88fe4eb3e1 | ||
|
|
ca40c79761 | ||
|
|
231cb6be27 | ||
|
|
7f484dfa09 | ||
|
|
1fa6ba3389 | ||
|
|
b7f2df0350 | ||
|
|
8bb4538de1 | ||
|
|
99d7072332 | ||
|
|
30f5ab89b7 | ||
|
|
fd3f4072b5 | ||
|
|
143efc0fab | ||
|
|
2f3d7efc24 | ||
|
|
e76c0046f7 | ||
|
|
b3120b5498 | ||
|
|
53c6d96c6f | ||
|
|
3f84ed5075 | ||
|
|
e9ad6b71c3 | ||
|
|
e5a3ee6f33 | ||
|
|
fbfd71dfe3 | ||
|
|
36e5124c0a | ||
|
|
73a777777e | ||
|
|
e4b6ba56b9 | ||
|
|
5f970888ef | ||
|
|
6e95771303 | ||
|
|
f8cf6e6439 | ||
|
|
ed0041ac65 | ||
|
|
acda419a2d | ||
|
|
dca42b9ef6 | ||
|
|
fa6993381a | ||
|
|
37d80146db | ||
|
|
7e2aef2480 | ||
|
|
9169637084 | ||
|
|
acb24924be | ||
|
|
bfb74b2027 | ||
|
|
f0b419099d | ||
|
|
81f3d59717 | ||
|
|
eca711bb64 | ||
|
|
900269bd46 | ||
|
|
e50cf0be6f | ||
|
|
a760c268f4 | ||
|
|
5c78236428 | ||
|
|
7ffc996b0a | ||
|
|
23937a239f | ||
|
|
b91fabb76c | ||
|
|
e36b0fd4d5 | ||
|
|
4e269d7071 | ||
|
|
6eddc869d3 | ||
|
|
561831928b | ||
|
|
6dee4ae603 | ||
|
|
413e02304d | ||
|
|
8c5b358bb1 | ||
|
|
3bf8cbc728 | ||
|
|
36462bcd7e | ||
|
|
1f8e5424f3 | ||
|
|
ebb1305ba4 | ||
|
|
565b2e85cd | ||
|
|
44ce696904 | ||
|
|
3fa315ab0b | ||
|
|
e5ba92b4b9 | ||
|
|
6352d6e1da | ||
|
|
1a3f3f54e7 | ||
|
|
7d10057103 | ||
|
|
a94c6b09bd | ||
|
|
647f3defcd | ||
|
|
101a55d119 | ||
|
|
09756fe55b | ||
|
|
3457c0b11d | ||
|
|
0676578aae | ||
|
|
b5370af822 | ||
|
|
744b2021b2 | ||
|
|
c39c10c978 | ||
|
|
efbab200aa | ||
|
|
a580754751 | ||
|
|
e5bfe19b28 | ||
|
|
4f514a16af | ||
|
|
c4595d2504 | ||
|
|
eb7d977b3e | ||
|
|
f10dd7c135 | ||
|
|
e5f6bf0556 | ||
|
|
c54879b548 | ||
|
|
e93c52c091 | ||
|
|
042f06e2b1 | ||
|
|
0db43f24f5 | ||
|
|
2067b2f648 | ||
|
|
e59693e7fa | ||
|
|
4d07d2e954 | ||
|
|
db38464778 | ||
|
|
071cd6268a | ||
|
|
2e82c361f7 | ||
|
|
a00cce8128 | ||
|
|
25f1051d7a | ||
|
|
4c024159a9 | ||
|
|
9bdf716407 | ||
|
|
cf89f016e9 | ||
|
|
3f16f1684a | ||
|
|
bfc788e27b | ||
|
|
0ea476b974 | ||
|
|
f5c5a69162 | ||
|
|
a3cef3f176 | ||
|
|
d2f2679071 | ||
|
|
2a3e6b6d12 | ||
|
|
7388c746a8 | ||
|
|
5e3b50497a | ||
|
|
471de3663e | ||
|
|
73223ae7e6 | ||
|
|
d25560f8ac | ||
|
|
9b364500ad | ||
|
|
04ecd87a23 | ||
|
|
419f467df1 | ||
|
|
61f2c55476 | ||
|
|
21fca7c546 | ||
|
|
8cde768588 | ||
|
|
8a48f4926a | ||
|
|
2b643b04c1 | ||
|
|
6f99abfc7b | ||
|
|
9b4129c949 | ||
|
|
a5de5e0cff | ||
|
|
e1d427f8c8 | ||
|
|
001fdd9511 | ||
|
|
87a0006d5e | ||
|
|
a68295d2a9 | ||
|
|
8c8a0b398d | ||
|
|
4d863e985b | ||
|
|
d632356413 | ||
|
|
12d98b144b | ||
|
|
2534c86d6f | ||
|
|
e8427a45c5 | ||
|
|
e7c0c5173a | ||
|
|
8f8c038b21 | ||
|
|
471e47c1c2 | ||
|
|
fe05df40ae | ||
|
|
fbe98af997 | ||
|
|
854a0c53c3 | ||
|
|
29fc5b3e3d | ||
|
|
8b7d1a70a4 | ||
|
|
616ca955d5 | ||
|
|
fa273ca817 | ||
|
|
935aada8bb | ||
|
|
e70c0b7f0f | ||
|
|
8da10b9439 | ||
|
|
a89fb57f57 | ||
|
|
8d419bb029 | ||
|
|
967607e1c8 | ||
|
|
a53ad12907 | ||
|
|
4abd2e0247 | ||
|
|
d724a975b5 | ||
|
|
e38f9a98c9 | ||
|
|
bef4ab9835 | ||
|
|
842399a4af | ||
|
|
937734b1e9 | ||
|
|
044f2c7c17 | ||
|
|
0cf9748ce0 | ||
|
|
e840188a65 | ||
|
|
bcf7a0701a | ||
|
|
122517716e | ||
|
|
fdbd0820c2 | ||
|
|
f76fa4a344 | ||
|
|
ca5555e6a5 | ||
|
|
b27264b9f3 | ||
|
|
3aa14c9ae7 | ||
|
|
1e308db64e | ||
|
|
5ce46e2499 | ||
|
|
f99e7b3388 | ||
|
|
c66fe0313f | ||
|
|
9503c4a9fc | ||
|
|
6012acb509 | ||
|
|
f8441a0cde | ||
|
|
f375e50f2d | ||
|
|
f6c4f6f5da | ||
|
|
27ab6247a6 | ||
|
|
be4d8e74cc | ||
|
|
e03370f6ef | ||
|
|
41c7689dfa | ||
|
|
41f207516e | ||
|
|
d846035f3e | ||
|
|
6cf17edfac | ||
|
|
78f1de69f4 | ||
|
|
aa8d38ce38 | ||
|
|
0e0ab81ff9 | ||
|
|
1323874389 | ||
|
|
58e5632714 | ||
|
|
92a2aa6f77 | ||
|
|
db16ef1430 | ||
|
|
e52144539b | ||
|
|
4e24b57289 | ||
|
|
04bcb11c3c | ||
|
|
6fe4a3f946 | ||
|
|
206f818666 | ||
|
|
022768ab58 | ||
|
|
e64e1e7260 | ||
|
|
2fb1f0e77c | ||
|
|
de3b0d7fb4 | ||
|
|
c14d95f8b5 | ||
|
|
4b0e47fd03 | ||
|
|
89e9820189 | ||
|
|
c1b2b3c73e | ||
|
|
68f62d9de8 | ||
|
|
3d77526160 | ||
|
|
749420308e | ||
|
|
8592e04c78 | ||
|
|
cb140a4442 | ||
|
|
1d0a3f022b | ||
|
|
6467ebb2dd | ||
|
|
67f9f7506c | ||
|
|
673918d0fc | ||
|
|
2e011b672f | ||
|
|
b78b185e07 | ||
|
|
46b63f7153 | ||
|
|
77fca10032 | ||
|
|
d5eaed63c0 | ||
|
|
5f6656cb36 | ||
|
|
87da7c794c | ||
|
|
aa34ffe7c7 | ||
|
|
28df6989f9 | ||
|
|
e5cb9cb56e | ||
|
|
9b2b700fa0 | ||
|
|
34f35524aa | ||
|
|
7e698f4b22 | ||
|
|
db6ac1f57a | ||
|
|
e28e06b08f | ||
|
|
5bf4d1c712 | ||
|
|
bc67393a67 | ||
|
|
6d63f75e7f | ||
|
|
f13b90e430 | ||
|
|
af61187587 | ||
|
|
20754539e4 | ||
|
|
28aa777191 | ||
|
|
0ed8adfe3a | ||
|
|
778c5e17c3 | ||
|
|
806ce4eb26 | ||
|
|
deaa564a66 | ||
|
|
be40fa1381 | ||
|
|
fbdb808d11 | ||
|
|
677c5624e6 | ||
|
|
9e7af58b2d | ||
|
|
9f47faff73 | ||
|
|
06576f4c07 | ||
|
|
9ab63a41b3 | ||
|
|
e93ff481bb | ||
|
|
6085048a95 | ||
|
|
35f7957975 | ||
|
|
f32caa52c6 | ||
|
|
dc90400456 | ||
|
|
3e5dec4dc9 | ||
|
|
ba778ec212 | ||
|
|
0c1ff2ef76 | ||
|
|
e8178d5917 | ||
|
|
3027cfe543 | ||
|
|
21bf2b8899 | ||
|
|
89ed41a016 | ||
|
|
f305d1f702 | ||
|
|
ac0d083b1c | ||
|
|
18a98d1cb4 | ||
|
|
84f1519486 | ||
|
|
b9c544d898 | ||
|
|
da6ca200fb | ||
|
|
55f84a2ead | ||
|
|
5f6f683fab | ||
|
|
6ee33eb893 | ||
|
|
7dd3b59fb0 | ||
|
|
41c86df7ca | ||
|
|
d7798fd0ab | ||
|
|
5605063950 | ||
|
|
0566bccffa | ||
|
|
ef4341acea | ||
|
|
9bcead9a8f | ||
|
|
c6e921241b | ||
|
|
9fcb67f731 | ||
|
|
902a11de9a | ||
|
|
08980eac3c | ||
|
|
7ba0bfa800 | ||
|
|
ef37bf9037 | ||
|
|
2131237057 | ||
|
|
8f2e4bb8c9 | ||
|
|
81cdf0c6c3 | ||
|
|
7e73c929a2 | ||
|
|
2da9dfe67f | ||
|
|
1ea9610ffd | ||
|
|
0857e6f2ec | ||
|
|
e14558a834 | ||
|
|
3b2ff4b71f | ||
|
|
901b21e4d9 | ||
|
|
75a85e4483 | ||
|
|
23ee3689da | ||
|
|
23037dfd38 | ||
|
|
74af06d5cb | ||
|
|
9920e359f8 | ||
|
|
296274b60f | ||
|
|
9c13a59ac0 | ||
|
|
0e56ee6509 | ||
|
|
b684b0c85d | ||
|
|
78e1fdb971 | ||
|
|
ea794ac751 | ||
|
|
c6b898ea30 | ||
|
|
098da53afe | ||
|
|
af2b0ac75b | ||
|
|
580ed3ea62 | ||
|
|
77e8075f2f | ||
|
|
62e708c70f | ||
|
|
b9b9d6dbaf | ||
|
|
a7c5abf64c | ||
|
|
7e0e46828b | ||
|
|
b56c8392fd | ||
|
|
7332c00077 | ||
|
|
beca52b61b | ||
|
|
b19527c5a4 | ||
|
|
d2197c801f | ||
|
|
08543cea6c | ||
|
|
2026102cdf | ||
|
|
8ba225700b | ||
|
|
f0fc5db72d | ||
|
|
fdae508932 | ||
|
|
b9a4f8b3f1 | ||
|
|
432907dbf6 | ||
|
|
ca41a70d7d | ||
|
|
9dd5d56f9c | ||
|
|
ee8ae574ec | ||
|
|
78a6bd9416 | ||
|
|
67b7f730d1 | ||
|
|
c5233a5b9f | ||
|
|
cd9c1d9789 | ||
|
|
3e317714fd | ||
|
|
ce849f2145 | ||
|
|
14362a6eda | ||
|
|
3d3f0710f9 | ||
|
|
ed7c8e4798 | ||
|
|
13451e9d10 | ||
|
|
6ba93994cb | ||
|
|
58f07f94a0 | ||
|
|
cf5baa29f2 | ||
|
|
a8d057b8b4 | ||
|
|
f995312f55 | ||
|
|
91b3d9f744 | ||
|
|
a27be4a334 | ||
|
|
31b387fdf1 | ||
|
|
c2e7879dbc | ||
|
|
03a64228ed | ||
|
|
a550fcc410 | ||
|
|
62c039b287 | ||
|
|
9fc6241057 | ||
|
|
18d5e25373 | ||
|
|
7c3c92f87a | ||
|
|
c13366fd92 | ||
|
|
a2e59ba316 | ||
|
|
d634ce46f7 | ||
|
|
acc1b904bf | ||
|
|
1ce743344a | ||
|
|
a041342a69 | ||
|
|
e04f712511 | ||
|
|
3fe7ec0200 | ||
|
|
3194fcca08 | ||
|
|
d8f89448ba | ||
|
|
90b9c37b66 | ||
|
|
be5e5fdf42 | ||
|
|
b1655de5ab | ||
|
|
2eaf88ecbb | ||
|
|
25ab07f136 | ||
|
|
704f60f687 | ||
|
|
c959d43684 | ||
|
|
36032f117a | ||
|
|
1c901dce3a | ||
|
|
349c1e46de | ||
|
|
7256d67a1c | ||
|
|
c70335c80d | ||
|
|
014b40b2a2 | ||
|
|
f82be437b9 | ||
|
|
d3e78a2cac | ||
|
|
f2e1e18fb4 | ||
|
|
e3ca50e8ad | ||
|
|
b9683cf2c8 | ||
|
|
5ee7973b9c | ||
|
|
7387d410bf | ||
|
|
7d8b70e677 | ||
|
|
ea9791f8e1 | ||
|
|
2e47684d15 | ||
|
|
ee740f627f | ||
|
|
1763f37811 | ||
|
|
c5643b6216 | ||
|
|
23c2c270b8 | ||
|
|
b9d22b21e8 | ||
|
|
f2ba6f956e | ||
|
|
c9f2b730f1 | ||
|
|
b1be50cdb9 | ||
|
|
b75c5f3cca | ||
|
|
195172e655 | ||
|
|
157dfa4532 | ||
|
|
51e587ca44 | ||
|
|
7d8d337b52 | ||
|
|
da15b665b1 | ||
|
|
8472f4d774 | ||
|
|
61531ce9e0 | ||
|
|
0f841d0eca | ||
|
|
1884fa0523 | ||
|
|
a50adf047a | ||
|
|
63edd9afd1 | ||
|
|
9601ecc131 | ||
|
|
04820a2840 | ||
|
|
6ee066ad14 | ||
|
|
996047a7e2 | ||
|
|
6af9d2ff16 | ||
|
|
8d0e58f98c | ||
|
|
e272340b72 | ||
|
|
8ac55beb4e | ||
|
|
4c012ea536 | ||
|
|
f890dc8473 | ||
|
|
d970750808 | ||
|
|
eb474b86bb | ||
|
|
0593715e39 | ||
|
|
cc8570587f | ||
|
|
307c3d6fad | ||
|
|
e95772c326 | ||
|
|
3c849fa44f | ||
|
|
72082cfc71 | ||
|
|
885f349192 | ||
|
|
2d1ad5e9f4 | ||
|
|
36eb117140 | ||
|
|
c29806a316 | ||
|
|
856a44ac95 | ||
|
|
2bc01d3ce4 | ||
|
|
2a2d7baecd | ||
|
|
73a7b66116 | ||
|
|
5b03c42d9a | ||
|
|
3fe1a89b49 | ||
|
|
e351799d39 | ||
|
|
66c91a0013 | ||
|
|
9404c9971d | ||
|
|
b527fded62 | ||
|
|
5c1c24137f | ||
|
|
6e8603557e | ||
|
|
c2548abc2f | ||
|
|
cfec7a63a5 | ||
|
|
71144b4a1e | ||
|
|
82d6fe991c | ||
|
|
b4a1cf6d54 | ||
|
|
591c36dc17 | ||
|
|
adc5669b28 | ||
|
|
0faabbe7b3 | ||
|
|
5f4f8e0c99 | ||
|
|
91e4e73dab | ||
|
|
98b1ae1ae6 | ||
|
|
538b159ca7 | ||
|
|
0a40c5434b | ||
|
|
e901790b32 | ||
|
|
d07637e648 | ||
|
|
fab70c738d | ||
|
|
3cac7c61bb | ||
|
|
7797f017a2 | ||
|
|
58da2cb0c2 | ||
|
|
0403820b22 | ||
|
|
f0990f3b92 | ||
|
|
51263d8796 | ||
|
|
07c89a8473 | ||
|
|
994ad00de7 | ||
|
|
5dabe5e1ee | ||
|
|
0d56a61aa8 | ||
|
|
3dd32b9901 | ||
|
|
05e11d4034 | ||
|
|
bafa57fdbc | ||
|
|
3b883d3828 | ||
|
|
5ed6f6598e | ||
|
|
b5571e02e4 | ||
|
|
f6959724aa | ||
|
|
a541338656 | ||
|
|
b64e399c10 | ||
|
|
0c635d79e6 | ||
|
|
58830073a6 | ||
|
|
e10c9af86f | ||
|
|
c69eee403e | ||
|
|
cefcb35aee | ||
|
|
a706de2fad | ||
|
|
4ea33fa9f9 | ||
|
|
f5f823ba99 | ||
|
|
9bc3a1cf3f | ||
|
|
bd9b180b27 | ||
|
|
8271a069f2 | ||
|
|
86194762a1 | ||
|
|
cdb5d0e48a | ||
|
|
c2b31e9628 | ||
|
|
3247d4f651 | ||
|
|
5400ef180a | ||
|
|
e0406e3df7 | ||
|
|
01cd099ea9 | ||
|
|
cef02d9340 | ||
|
|
89fb5eb32f | ||
|
|
e559c86d77 | ||
|
|
850a566916 | ||
|
|
669221b620 | ||
|
|
aff8a3e3c1 | ||
|
|
22f0e9ac30 | ||
|
|
064427fcaf | ||
|
|
4188734ee4 | ||
|
|
450f63d7b0 | ||
|
|
59db6662c2 | ||
|
|
647f91af7b | ||
|
|
0b2ac37c07 | ||
|
|
a2d3befc5a | ||
|
|
4ff3c4bf79 | ||
|
|
c383ba65ae | ||
|
|
02788cedc0 | ||
|
|
f2097a1f86 | ||
|
|
67a9c7b8b5 | ||
|
|
69f5e85ebb | ||
|
|
18d64639b4 | ||
|
|
94542ad4b6 | ||
|
|
899b034e3d | ||
|
|
513fcf40d5 | ||
|
|
3883ccb0a0 | ||
|
|
37eba37901 | ||
|
|
58260bf5fe | ||
|
|
3425568551 | ||
|
|
63bd69267a | ||
|
|
ba0efaa706 | ||
|
|
52c1d3f4af | ||
|
|
0af36ec5bb | ||
|
|
3c255345cc | ||
|
|
990f3abe5b | ||
|
|
8122da7113 | ||
|
|
f9b7df63f9 | ||
|
|
12b81567df | ||
|
|
e6dae81670 | ||
|
|
f62115dfef | ||
|
|
14ed17ca76 | ||
|
|
abfa4988e5 | ||
|
|
a73348da8d | ||
|
|
e5ef0f25ba | ||
|
|
c884ada07d | ||
|
|
aa407d3721 | ||
|
|
4f55f678c1 | ||
|
|
4929816604 | ||
|
|
7d76e5f791 | ||
|
|
c9b9d19b6f | ||
|
|
9c10570033 | ||
|
|
9b25a48dd4 | ||
|
|
aef38baf44 | ||
|
|
d8acc6e91f | ||
|
|
8f52bdea24 | ||
|
|
ff52e24fba | ||
|
|
3738cc8ae6 | ||
|
|
fa2b20a033 |
6
.gitee/ISSUE_TEMPLATE.zh-CN.md
Executable file → Normal file
6
.gitee/ISSUE_TEMPLATE.zh-CN.md
Executable file → Normal file
@@ -7,7 +7,5 @@
|
||||
|
||||
|
||||
### 报错信息
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
14
.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
Executable file → Normal file
14
.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
Executable file → Normal file
@@ -10,6 +10,18 @@
|
||||
### 测试用例(新增、改动、可能影响的功能)
|
||||
|
||||
|
||||
|
||||
### 是否涉及对外变更(典型的如:对外API规格变更、新增对外接口等等)
|
||||
|
||||
必须选择一项(在MarkDown模式下用[x]替换[ ]即可勾选对应选项):
|
||||
- [ ] 是,涉及对外变更: 需要在commit message中按【[模板要求](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)】描述变更点
|
||||
- [ ] 否,不涉及对外变更
|
||||
|
||||
### 是否需要同步至release(如:3.0LTS ... )分支?
|
||||
|
||||
必须选择一项(在MarkDown模式下用[x]替换[ ]即可勾选对应选项):
|
||||
- [ ] 是,需要同步的分支:
|
||||
- [ ] 否
|
||||
|
||||
理由:
|
||||
|
||||
|
||||
|
||||
37
.gitignore
vendored
Executable file → Normal file
37
.gitignore
vendored
Executable file → Normal file
@@ -1,25 +1,24 @@
|
||||
/out
|
||||
/fs/proc
|
||||
/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
|
||||
lib/libc/musl
|
||||
|
||||
# VIM files
|
||||
cscope*
|
||||
tags
|
||||
|
||||
# Menuconfig temp files
|
||||
/config.h
|
||||
/.config
|
||||
/.config.old
|
||||
|
||||
# Build temp files
|
||||
/out
|
||||
|
||||
482
BUILD.gn
Executable file → Normal file
482
BUILD.gn
Executable file → Normal file
@@ -1,68 +1,414 @@
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//build/lite/config/subsystem/lite_subsystem.gni")
|
||||
|
||||
declare_args() {
|
||||
enable_ohos_kernel_liteos_a_ext_build = true
|
||||
LOSCFG_TEST_APPS = false
|
||||
}
|
||||
|
||||
lite_subsystem("kernel") {
|
||||
subsystem_components = []
|
||||
|
||||
if (enable_ohos_kernel_liteos_a_ext_build == false) {
|
||||
subsystem_components += [
|
||||
"//kernel/liteos_a/kernel",
|
||||
"//kernel/liteos_a/net",
|
||||
"//kernel/liteos_a/lib",
|
||||
"//kernel/liteos_a/compat",
|
||||
"//kernel/liteos_a/fs",
|
||||
"//kernel/liteos_a/arch:platform_cpu",
|
||||
]
|
||||
if (LOSCFG_SHELL) {
|
||||
subsystem_components += [ "//kernel/liteos_a/shell" ]
|
||||
}
|
||||
} else {
|
||||
deps = [":make"]
|
||||
}
|
||||
}
|
||||
|
||||
action("make") {
|
||||
script = "//build/lite/build_ext_components.py"
|
||||
outputs = [ "$target_gen_dir/liteos_a_build_log.txt" ]
|
||||
exec_path = rebase_path(rebase_path(".", root_build_dir))
|
||||
outdir = rebase_path(get_path_info(".", "out_dir"))
|
||||
command = "make clean OUTDIR=$outdir && make rootfs VERSION=\"${ohos_version}\" -j 16 OUTDIR=$outdir"
|
||||
args = [
|
||||
"--path=$exec_path",
|
||||
"--prebuilts=sh build.sh ${board_name} ${ohos_build_compiler} ${ohos_build_type}",
|
||||
"--command=${command}"
|
||||
]
|
||||
}
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
|
||||
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
|
||||
|
||||
declare_args() {
|
||||
tee_enable = false
|
||||
liteos_name = "OHOS_Image"
|
||||
liteos_skip_make = false
|
||||
liteos_is_mini = false
|
||||
}
|
||||
|
||||
tee = ""
|
||||
if (tee_enable) {
|
||||
tee = "_tee"
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
liteos_config_file = "${ohos_build_type}${tee}.config"
|
||||
}
|
||||
|
||||
liteos_config_file =
|
||||
rebase_path(liteos_config_file, "", "$product_path/kernel_configs")
|
||||
print("liteos_config_file:", liteos_config_file)
|
||||
|
||||
exec_script("//build/lite/run_shell_cmd.py",
|
||||
[ "env" + " CONFIG_=LOSCFG_" + " KCONFIG_CONFIG_HEADER='y=true'" +
|
||||
" KCONFIG_CONFIG=$liteos_config_file" +
|
||||
" DEVICE_PATH=$device_path" + " srctree=" + rebase_path(".") +
|
||||
" genconfig" + " --header-path $LITEOS_MENUCONFIG_H" +
|
||||
" --file-list kconfig_files.txt" +
|
||||
" --env-list kconfig_env.txt" + " --config-out config.gni" ],
|
||||
"",
|
||||
[ liteos_config_file ])
|
||||
|
||||
import("liteos.gni")
|
||||
|
||||
assert(ARCH != "", "ARCH not set!")
|
||||
assert(ARCH == arch, "ARCH not match! details: $ARCH != $arch")
|
||||
assert(tee_enable == defined(LOSCFG_TEE_ENABLE), "TEE switch not match!")
|
||||
assert(ohos_build_compiler == "clang" == defined(LOSCFG_COMPILER_CLANG_LLVM),
|
||||
"compiler not match!")
|
||||
|
||||
generate_notice_file("kernel_notice_file") {
|
||||
module_name = "kernel"
|
||||
module_source_dir_list = [
|
||||
"$LITEOSTHIRDPARTY/FreeBSD",
|
||||
"$LITEOSTHIRDPARTY/musl",
|
||||
"$LITEOSTHIRDPARTY/zlib",
|
||||
"$LITEOSTHIRDPARTY/FatFs",
|
||||
"$LITEOSTHIRDPARTY/lwip",
|
||||
"$LITEOSTHIRDPARTY/NuttX",
|
||||
"$LITEOSTHIRDPARTY/mtd-utils",
|
||||
]
|
||||
}
|
||||
|
||||
liteos_arch_cflags = []
|
||||
if (defined(LOSCFG_ARCH_ARM)) {
|
||||
mcpu = LOSCFG_ARCH_CPU
|
||||
if (defined(LOSCFG_ARCH_ARM_AARCH64) && defined(LOSCFG_ARCH_FPU_DISABLE)) {
|
||||
mcpu += "+nofp"
|
||||
}
|
||||
liteos_arch_cflags += [ "-mcpu=$mcpu" ]
|
||||
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
|
||||
liteos_arch_cflags += [
|
||||
"-mfloat-abi=softfp",
|
||||
"-mfpu=$LOSCFG_ARCH_FPU",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cc = "$ohos_current_cc_command " + string_join(" ", liteos_arch_cflags)
|
||||
if (ohos_build_compiler == "clang") {
|
||||
cc += " --target=$target_triple"
|
||||
}
|
||||
|
||||
config("arch_config") {
|
||||
cflags = liteos_arch_cflags
|
||||
asmflags = cflags
|
||||
ldflags = cflags
|
||||
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
|
||||
if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += [ "-mthumb-interwork" ]
|
||||
}
|
||||
}
|
||||
if (defined(LOSCFG_THUMB)) {
|
||||
cflags += [ "-mthumb" ]
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += [ "-mimplicit-it=thumb" ]
|
||||
} else {
|
||||
cflags += [ "-Wa,-mimplicit-it=thumb" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
config("stdinc_config") {
|
||||
std_include = exec_script("//build/lite/run_shell_cmd.py",
|
||||
[ "$cc -print-file-name=include" ],
|
||||
"trim string")
|
||||
cflags = [
|
||||
"-isystem",
|
||||
std_include,
|
||||
]
|
||||
if (!defined(LOSCFG_LIBC_NEWLIB)) {
|
||||
cflags += [ "-nostdinc" ]
|
||||
}
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("ssp_config") {
|
||||
cflags = []
|
||||
if (defined(LOSCFG_CC_STACKPROTECTOR_ALL)) {
|
||||
cflags += [ "-fstack-protector-all" ]
|
||||
} else if (defined(LOSCFG_CC_STACKPROTECTOR_STRONG)) {
|
||||
cflags += [ "-fstack-protector-strong" ]
|
||||
} else if (defined(LOSCFG_CC_STACKPROTECTOR)) {
|
||||
cflags += [
|
||||
"-fstack-protector",
|
||||
"--param",
|
||||
"ssp-buffer-size=4",
|
||||
]
|
||||
} else {
|
||||
cflags += [ "-fno-stack-protector" ]
|
||||
}
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("optimize_config") {
|
||||
cflags = []
|
||||
if (defined(LOSCFG_COMPILE_DEBUG)) {
|
||||
cflags += [
|
||||
"-g",
|
||||
"-gdwarf-2",
|
||||
]
|
||||
optimization_cflag = "-O0"
|
||||
}
|
||||
if (defined(LOSCFG_COMPILE_OPTIMIZE)) {
|
||||
optimization_cflag = "-O2"
|
||||
}
|
||||
if (defined(LOSCFG_COMPILE_OPTIMIZE_SIZE)) {
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
optimization_cflag = "-Oz"
|
||||
} else {
|
||||
optimization_cflag = "-Os"
|
||||
}
|
||||
}
|
||||
if (defined(LOSCFG_COMPILE_LTO)) {
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += [ "-flto=thin" ]
|
||||
} else {
|
||||
#cflags += [ "-flto" ]
|
||||
}
|
||||
}
|
||||
cflags += [ optimization_cflag ]
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("kconfig_config") {
|
||||
cflags = [
|
||||
"-imacros",
|
||||
"$LITEOS_MENUCONFIG_H",
|
||||
]
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("warn_config") {
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wpointer-arith",
|
||||
"-Wstrict-prototypes",
|
||||
"-Winvalid-pch",
|
||||
]
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += [ "-Wno-address-of-packed-member" ]
|
||||
}
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("dialect_config") {
|
||||
cflags_c = [ "-std=c99" ]
|
||||
cflags_cc = [ "-std=c++11" ]
|
||||
}
|
||||
|
||||
config("misc_config") {
|
||||
defines = [ "__LITEOS__" ]
|
||||
defines += [ "__LITEOS_A__" ]
|
||||
if (!defined(LOSCFG_DEBUG_VERSION)) {
|
||||
defines += [ "NDEBUG" ]
|
||||
}
|
||||
|
||||
cflags = [
|
||||
"-fno-pic",
|
||||
"-fno-builtin",
|
||||
"-fms-extensions",
|
||||
"-fno-strict-aliasing",
|
||||
"-fno-common",
|
||||
"-fsigned-char",
|
||||
"-ffunction-sections",
|
||||
"-fdata-sections",
|
||||
"-fno-exceptions",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-fno-short-enums",
|
||||
"-mno-unaligned-access",
|
||||
]
|
||||
|
||||
if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += [ "-fno-aggressive-loop-optimizations" ]
|
||||
}
|
||||
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("los_config") {
|
||||
configs = [
|
||||
":arch_config",
|
||||
":kconfig_config",
|
||||
":stdinc_config",
|
||||
":dialect_config",
|
||||
":optimize_config",
|
||||
":ssp_config",
|
||||
":warn_config",
|
||||
":misc_config",
|
||||
]
|
||||
}
|
||||
|
||||
cmd = "if [ -f $device_path/BUILD.gn ]; then echo true; else echo false; fi"
|
||||
HAVE_DEVICE_SDK = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
|
||||
|
||||
config("public") {
|
||||
configs = [
|
||||
"arch:public",
|
||||
"kernel:public",
|
||||
"compat:public",
|
||||
"bsd:public",
|
||||
"fs:public",
|
||||
"drivers:public",
|
||||
"security:public",
|
||||
"net:public",
|
||||
"shell:public",
|
||||
"lib:public",
|
||||
]
|
||||
|
||||
configs += [
|
||||
"$HDFTOPDIR:public",
|
||||
"//drivers/liteos:public",
|
||||
]
|
||||
|
||||
if (HAVE_DEVICE_SDK) {
|
||||
configs += [ "$device_path:public" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("modules") {
|
||||
deps = [
|
||||
"arch",
|
||||
"bsd",
|
||||
"compat",
|
||||
"drivers",
|
||||
"fs",
|
||||
"kernel",
|
||||
"lib",
|
||||
"net",
|
||||
"security",
|
||||
"shell",
|
||||
"syscall",
|
||||
"testsuites/kernel:kernel_test",
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//drivers/liteos",
|
||||
HDFTOPDIR,
|
||||
]
|
||||
|
||||
if (HAVE_DEVICE_SDK) {
|
||||
deps += [ device_path ]
|
||||
}
|
||||
}
|
||||
|
||||
group("apps") {
|
||||
deps = [ "apps" ]
|
||||
}
|
||||
|
||||
group("tests") {
|
||||
deps = [ "testsuites" ]
|
||||
}
|
||||
|
||||
group("kernel") {
|
||||
deps = [ ":build_kernel_image" ]
|
||||
}
|
||||
|
||||
group("liteos_a") {
|
||||
deps = [ ":kernel" ]
|
||||
if (!liteos_is_mini) {
|
||||
deps += [
|
||||
":apps",
|
||||
":tests",
|
||||
"//third_party/musl/scripts/build_lite:strip",
|
||||
]
|
||||
if (liteos_skip_make == false) {
|
||||
deps += [ ":make" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
executable("liteos") {
|
||||
configs = [] # clear default configs
|
||||
configs += [ ":arch_config" ]
|
||||
configs += [ ":public" ]
|
||||
|
||||
ldflags = [
|
||||
"-static",
|
||||
"-nostdlib",
|
||||
"-Wl,--gc-sections",
|
||||
"-Wl,-Map=$liteos_name.map",
|
||||
"-Wl,--no-eh-frame-hdr",
|
||||
]
|
||||
|
||||
if (defined(LOSCFG_LIBC_NEWLIB)) {
|
||||
ldflags += [
|
||||
"-Wl,--wrap=_free_r",
|
||||
"-Wl,--wrap,_malloc_usable_size_r",
|
||||
"-Wl,--wrap,_malloc_r",
|
||||
"-Wl,--wrap,_memalign_r",
|
||||
"-Wl,--wrap,_realloc_r",
|
||||
"-Wl,--wrap,_fseeko_r",
|
||||
]
|
||||
ldflags -= [ "-nostdlib" ]
|
||||
}
|
||||
libgcc = exec_script("//build/lite/run_shell_cmd.py",
|
||||
[ "$cc -print-libgcc-file-name" ],
|
||||
"trim string")
|
||||
libs = [ libgcc ]
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
ldflags +=
|
||||
[ "-Wl,-T" + rebase_path("tools/build/liteos_llvm.ld", root_build_dir) ]
|
||||
inputs = [ "tools/build/liteos_llvm.ld" ]
|
||||
} else {
|
||||
ldflags +=
|
||||
[ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ]
|
||||
ldflags += [ "-nostartfiles" ]
|
||||
inputs = [ "tools/build/liteos.ld" ]
|
||||
}
|
||||
|
||||
inputs += [ "$root_out_dir/board.ld" ]
|
||||
|
||||
output_dir = target_out_dir
|
||||
|
||||
deps = [
|
||||
":modules",
|
||||
"platform:copy_board.ld",
|
||||
]
|
||||
}
|
||||
|
||||
copy("copy_liteos") {
|
||||
deps = [ ":liteos" ]
|
||||
sources = [ "$target_out_dir/unstripped/bin/liteos" ]
|
||||
outputs = [ "$root_out_dir/$liteos_name" ]
|
||||
}
|
||||
|
||||
build_ext_component("build_kernel_image") {
|
||||
deps = [ ":copy_liteos" ]
|
||||
exec_path = rebase_path(root_out_dir)
|
||||
|
||||
objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix"
|
||||
objdump = "${compile_prefix}objdump$toolchain_cmd_suffix"
|
||||
|
||||
command = "$objcopy -O binary $liteos_name $liteos_name.bin"
|
||||
command +=
|
||||
" && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'"
|
||||
command += " && sh -c '$objdump -d $liteos_name >$liteos_name.asm'"
|
||||
}
|
||||
|
||||
build_ext_component("make") {
|
||||
exec_path = rebase_path(".", root_build_dir)
|
||||
outdir = rebase_path("$target_out_dir/${target_name}_out")
|
||||
sysroot_path = rebase_path(ohos_current_sysroot)
|
||||
arch_cflags = string_join(" ", target_arch_cflags)
|
||||
command = "./build.sh \"$board_name\" \"$ohos_build_compiler\" \"$root_build_dir\" \"$ohos_build_type\" \"$tee_enable\""
|
||||
command += " \"$device_company\" \"$product_path\" \"$outdir\" \"$ohos_version\" \"$sysroot_path\" \"$arch_cflags\""
|
||||
command += " \"$device_path\" \"$compile_prefix\" \"$liteos_config_file\""
|
||||
if (liteos_skip_make) {
|
||||
print("build_ext_component \"$target_name\" skipped:", command)
|
||||
command = "true"
|
||||
}
|
||||
}
|
||||
|
||||
338
CHANGELOG.md
Normal file
338
CHANGELOG.md
Normal file
@@ -0,0 +1,338 @@
|
||||
# (2022-03-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
||||
* **arm-virt:** HW_RANDOM_ENABLE配置支持arm virt平台 ([68f9f49](https://gitee.com/openharmony/kernel_liteos_a/commits/68f9f49c2a62d3271db14ccb896c9f9fc78a60e4))
|
||||
* A核代码静态告警定期清理 ([9ba725c](https://gitee.com/openharmony/kernel_liteos_a/commits/9ba725c3d486dd28fe9b2489b0f95a65354d7d86)), closes [#I4I0O8](https://gitee.com/openharmony/kernel_liteos_a/issues/I4I0O8)
|
||||
* change default permission of procfs to 0550 ([a776c04](https://gitee.com/openharmony/kernel_liteos_a/commits/a776c04a3da414f73ef7136a543c029cc6dd75be)), closes [#I4NY49](https://gitee.com/openharmony/kernel_liteos_a/issues/I4NY49)
|
||||
* change the execFile field in TCB to execVnode ([e4a0662](https://gitee.com/openharmony/kernel_liteos_a/commits/e4a06623ceb49b5bead60d45c0534db88b9c666f)), closes [#I4CLL9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CLL9)
|
||||
* close file when process interpretor failed ([a375bf5](https://gitee.com/openharmony/kernel_liteos_a/commits/a375bf5668a5e86e082d0e124b538e423023a259)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* codex 清理 ([9ab3e35](https://gitee.com/openharmony/kernel_liteos_a/commits/9ab3e351d38cdae2ec083048a50a253bc2a3b604)), closes [#I4BL3](https://gitee.com/openharmony/kernel_liteos_a/issues/I4BL3)
|
||||
* dyload open close failed ([5e87d8c](https://gitee.com/openharmony/kernel_liteos_a/commits/5e87d8c183471166294e2caa041ab4da8570c6a1)), closes [#I452Z7](https://gitee.com/openharmony/kernel_liteos_a/issues/I452Z7)
|
||||
* fix ppoll ([a55f68f](https://gitee.com/openharmony/kernel_liteos_a/commits/a55f68f957e9f8ad74bd9e0c1b3d27775e0f8c75))
|
||||
* fix some function declarations ([63fd8bc](https://gitee.com/openharmony/kernel_liteos_a/commits/63fd8bc39b21fffb6990f74e879eefecafad6c88))
|
||||
* implicit declaration of function 'syscall' in apps/shell ([bd0c083](https://gitee.com/openharmony/kernel_liteos_a/commits/bd0c0835fc58ed5f941dbbc9adfac74253eeb874))
|
||||
* LOS_Panic和魔法键功能中的使用PRINTK打印,依赖任务调度,特殊情况下存在打印不出来的问题 ([53addea](https://gitee.com/openharmony/kernel_liteos_a/commits/53addea304de09e0df457b690403ac652bbcea72)), closes [#I4NOC7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4NOC7)
|
||||
* los_stat_pri.h中缺少依赖的头文件 ([2cd03c5](https://gitee.com/openharmony/kernel_liteos_a/commits/2cd03c55b7a614c648adc965ebfe494d491fe20f)), closes [#I4KEZ1](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KEZ1)
|
||||
* los_trace.h接口注释错误修正 ([6d24961](https://gitee.com/openharmony/kernel_liteos_a/commits/6d249618aecc216388f9b1a2b48fe0ac6dd19ff2)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* MMU竞态问题修复 ([748e0d8](https://gitee.com/openharmony/kernel_liteos_a/commits/748e0d8ffb6ee9c8757ed056f575e3abc6c10702)), closes [#I2](https://gitee.com/openharmony/kernel_liteos_a/issues/I2)
|
||||
* **mtd:** 去除mtd对hisilicon驱动的依赖 ([f7d010d](https://gitee.com/openharmony/kernel_liteos_a/commits/f7d010dfa4cb825096267528e131a9e2735d7505)), closes [#I49](https://gitee.com/openharmony/kernel_liteos_a/issues/I49)
|
||||
* OsFutexWaitParamCheck函数中absTime为0时,直接返回,不需要打印 ([3f71be7](https://gitee.com/openharmony/kernel_liteos_a/commits/3f71be75355f11037d9de80cc4d7da0f01905003)), closes [#I4D67](https://gitee.com/openharmony/kernel_liteos_a/issues/I4D67)
|
||||
* OsLockDepCheckIn异常处理中存在g_lockdepAvailable锁嵌套调用, ([bf030b6](https://gitee.com/openharmony/kernel_liteos_a/commits/bf030b6bb5843151a5b8b8736246a1376a5fb9d0)), closes [#I457](https://gitee.com/openharmony/kernel_liteos_a/issues/I457)
|
||||
* pr模板补充说明 ([e3cd485](https://gitee.com/openharmony/kernel_liteos_a/commits/e3cd485db528490a16a8932d734faab263b44bc9))
|
||||
* same file mode for procfs files ([c79bcd0](https://gitee.com/openharmony/kernel_liteos_a/commits/c79bcd028e1be34b45cba000077230fa2ef95e68)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* shell支持exit退出,完善帮助信息,特殊处理不可见字符 ([cc6e112](https://gitee.com/openharmony/kernel_liteos_a/commits/cc6e11281e63b6bdc9be8e5d3c39f1258eb2ceaa))
|
||||
* smp初始化中副核冗余的启动框架调用 ([5ce70a5](https://gitee.com/openharmony/kernel_liteos_a/commits/5ce70a50c3733b6ec8cc4b444837e366ec837f69)), closes [#I4F8A5](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F8A5)
|
||||
* solve SIGCHLD ignored in sigsuspend() ([5a80d4e](https://gitee.com/openharmony/kernel_liteos_a/commits/5a80d4e1a34c94204a0bb01443bf25a4fdb12750)), closes [#I47](https://gitee.com/openharmony/kernel_liteos_a/issues/I47)
|
||||
* syscall review bugfix ([214f44e](https://gitee.com/openharmony/kernel_liteos_a/commits/214f44e935277c29d347c50b553a31ea7df36448)), closes [#149](https://gitee.com/openharmony/kernel_liteos_a/issues/149)
|
||||
* **test:** misc09用例因依赖hosts文件而失败 ([f2f5c5f](https://gitee.com/openharmony/kernel_liteos_a/commits/f2f5c5fdc3202610de173e7046adab4df5e59142)), closes [re#I48IZ0](https://gitee.com/re/issues/I48IZ0)
|
||||
* **test:** 修复sys部分用例因依赖passwd、group文件而失败 ([614cdcc](https://gitee.com/openharmony/kernel_liteos_a/commits/614cdccf91bd2d220c4c76418b53400ce714c6cb)), closes [re#I48](https://gitee.com/re/issues/I48)
|
||||
* 中断中调用PRINTK概率卡死,导致系统不能正常响应中断 ([9726ba1](https://gitee.com/openharmony/kernel_liteos_a/commits/9726ba11a79f3d2d1e616e12ef0bb44e4fc5cd20)), closes [#I4C9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4C9)
|
||||
* 临终遗言重定向内容缺失task相关信息,对应的shell命令中申请的内存需要cacheline对齐 ([48ca854](https://gitee.com/openharmony/kernel_liteos_a/commits/48ca854bf07f8dcda9657f950601043a485a1b33)), closes [#I482S5](https://gitee.com/openharmony/kernel_liteos_a/issues/I482S5)
|
||||
* 优化liteipc任务状态,删除功能重复字段 ([5004ef4](https://gitee.com/openharmony/kernel_liteos_a/commits/5004ef4d87b54fb6d7f748ca8212ae155bcefac5)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 优化trace buffer初始化,删除swtmr 桩中的无效参数 ([b551270](https://gitee.com/openharmony/kernel_liteos_a/commits/b551270ef50cb206360e2eee3dd20ace5cecccb7)), closes [#I4DQ1](https://gitee.com/openharmony/kernel_liteos_a/issues/I4DQ1)
|
||||
* 修复 virpart.c 不适配的格式化打印问题 ([de29140](https://gitee.com/openharmony/kernel_liteos_a/commits/de29140edf2567f4847876cb1ed5e0b6857420f3)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 修复A核文档失效的问题 ([456d255](https://gitee.com/openharmony/kernel_liteos_a/commits/456d255a81c2031be8ebecc2bf897af80c3d3c7a)), closes [#I4U7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4U7)
|
||||
* 修复A核测试用例失败的问题 ([59329ce](https://gitee.com/openharmony/kernel_liteos_a/commits/59329ce7c6b6a00084df427748e6283287a773c0)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 修复A核测试用例失败的问题 ([be68dc8](https://gitee.com/openharmony/kernel_liteos_a/commits/be68dc8bcaf8d965039ae1d792775f00a08adfac)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 修复dispatch单词拼写错误。 ([9b07aec](https://gitee.com/openharmony/kernel_liteos_a/commits/9b07aece2dfa3494cf35e8b388410341508d6224)), closes [#I4BLE8](https://gitee.com/openharmony/kernel_liteos_a/issues/I4BLE8)
|
||||
* 修复futime提示错误22的BUG ([f2861dd](https://gitee.com/openharmony/kernel_liteos_a/commits/f2861ddfb424af7b99c278273601ce0fab1f37e6))
|
||||
* 修复jffs2适配层错误释放锁的BUG ([011a55f](https://gitee.com/openharmony/kernel_liteos_a/commits/011a55ff21d95f969abac60bcff96f4c4d7a326d)), closes [#I4FH9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FH9)
|
||||
* 修复los_vm_scan.c中内部函数OsInactiveListIsLow冗余代码 ([bc32a1e](https://gitee.com/openharmony/kernel_liteos_a/commits/bc32a1ec0fa5d19c6d2672bcf4a01de5e1be3afb)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 修复LOSCFG_FS_FAT_CACHE宏关闭后编译失败的BUG ([63e71fe](https://gitee.com/openharmony/kernel_liteos_a/commits/63e71feca05a8d46a49822c713258738740f0712)), closes [#I3T3N0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T3N0)
|
||||
* 修复OsVmPhysFreeListAdd和OsVmPhysFreeListAddUnsafe函数内容重复 ([6827bd2](https://gitee.com/openharmony/kernel_liteos_a/commits/6827bd2a22b78aa05e20d6460412fc7b2d738929)), closes [#I4FL95](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FL95)
|
||||
* 修复PR520缺陷 ([4033891](https://gitee.com/openharmony/kernel_liteos_a/commits/40338918d9132399ee0494d331930a05b7a13c67)), closes [re#I4DEG5](https://gitee.com/re/issues/I4DEG5)
|
||||
* 修复shcmd.h需要用宏包起来的问题 ([6c4e4b1](https://gitee.com/openharmony/kernel_liteos_a/commits/6c4e4b16abe9c68fea43d40b2d39b4f0ed4bfc9c)), closes [#I4N50](https://gitee.com/openharmony/kernel_liteos_a/issues/I4N50)
|
||||
* 修复xts权限用例压测异常问题 ([b0d31cb](https://gitee.com/openharmony/kernel_liteos_a/commits/b0d31cb43f5a8d1c3da574b2b957e3b0e98b3067)), closes [#I3ZJ1](https://gitee.com/openharmony/kernel_liteos_a/issues/I3ZJ1)
|
||||
* 修复硬随机不可用时,地址随机化不可用问题 ([665c152](https://gitee.com/openharmony/kernel_liteos_a/commits/665c152c27bb86395ddd0395279255f6cdaf7255)), closes [#I4D4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4D4)
|
||||
* 修复进程用例导致门禁概率失败 ([1ed28b4](https://gitee.com/openharmony/kernel_liteos_a/commits/1ed28b4c80cfd222be08b0c2e71e6287e52bb276)), closes [#I4FO0](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FO0)
|
||||
* 修复进程线程不稳定用例 ([f6ac03d](https://gitee.com/openharmony/kernel_liteos_a/commits/f6ac03d3e3c56236adc5734d4c059f1fbcc9e0c1)), closes [#I4F1](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F1)
|
||||
* 修复重复执行内存用例导致系统卡死问题 ([6c2b163](https://gitee.com/openharmony/kernel_liteos_a/commits/6c2b163c7d7c696ef89b17a0275f3cddb3d7cefb)), closes [#I4F7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F7)
|
||||
* 修改MMU模块的注释错误 ([1a8e22d](https://gitee.com/openharmony/kernel_liteos_a/commits/1a8e22dcf15944153e013d004fd7bbf24557a8c7)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 共享内存问题修复 ([9fdb80f](https://gitee.com/openharmony/kernel_liteos_a/commits/9fdb80f85f92d0167a0456455a94fc6f679797ce)), closes [#I47X2](https://gitee.com/openharmony/kernel_liteos_a/issues/I47X2)
|
||||
* 内核ERR打印,无进程和线程信息,不方便问题定位。 ([cb423f8](https://gitee.com/openharmony/kernel_liteos_a/commits/cb423f845462b8cc474c3cba261dadf3943a08ef)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 内核ERR级别及以上的打印输出当前进程和线程名 ([540b201](https://gitee.com/openharmony/kernel_liteos_a/commits/540b2017c5460e300365d2039a08abd5945cec6b))
|
||||
* 内源检视测试用例问题修复 ([a6ac759](https://gitee.com/openharmony/kernel_liteos_a/commits/a6ac7597f85043ba6de3a1b395ca676d85c65ea7))
|
||||
* 删除冗余的头文件 ([8e614bb](https://gitee.com/openharmony/kernel_liteos_a/commits/8e614bb1616b75bc89eee7ad7da49b7a9c285b47)), closes [#I4KN63](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KN63)
|
||||
* 增加pselect SYSCALL函数及测试用例 ([f601c16](https://gitee.com/openharmony/kernel_liteos_a/commits/f601c16b9e67d531dda51fc18389a53db4360b7b)), closes [#I45](https://gitee.com/openharmony/kernel_liteos_a/issues/I45)
|
||||
* 增加内核epoll系统调用 ([2251b8a](https://gitee.com/openharmony/kernel_liteos_a/commits/2251b8a2d1f649422dd67f8551b085a7e0c63ec7)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 实现了musl库net模块中的一些函数接口和相应的测试用例 ([3d00a7d](https://gitee.com/openharmony/kernel_liteos_a/commits/3d00a7d23a96f29c138cfc1672825b90b9e0c05e)), closes [#I4JQI1](https://gitee.com/openharmony/kernel_liteos_a/issues/I4JQI1)
|
||||
* 添加进程线程冒烟用例 ([2be5968](https://gitee.com/openharmony/kernel_liteos_a/commits/2be59680f2fb0801b43522cd38cc387c8ff38766)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 用户态进程主线程退出时,其他子线程刚好进入异常处理流程会导致系统卡死 ([d955790](https://gitee.com/openharmony/kernel_liteos_a/commits/d955790a44a679421798ec1ac2900b4d75dd75a4)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 编码规范修改 ([d161a0b](https://gitee.com/openharmony/kernel_liteos_a/commits/d161a0b03de046c05fff45a2b625631b4e45a347))
|
||||
* 编码规范问题修复 ([f60bc94](https://gitee.com/openharmony/kernel_liteos_a/commits/f60bc94cf231bc615ff6603ca0393b8fe33a8c47))
|
||||
* 编译框架在做编译入口的统一 ([bdb9864](https://gitee.com/openharmony/kernel_liteos_a/commits/bdb9864436a6f128a4c3891bbd63e3c60352689f)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 解决dmesg -s参数double lock问题 ([e151256](https://gitee.com/openharmony/kernel_liteos_a/commits/e1512566e322eb1fbc8f5d5997f9bfcd022feac7)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 进程退出前自己回收vmspace中的所有region ([298ccea](https://gitee.com/openharmony/kernel_liteos_a/commits/298ccea3fedaccc651b38973f0455fa1ce12e516)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 通过g_uart_fputc_en关闭打印后,shell进程不能正常启动 ([d21b05c](https://gitee.com/openharmony/kernel_liteos_a/commits/d21b05c0f69877130366ad37b852a0f30c11809d)), closes [#I4CTY2](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CTY2)
|
||||
* 针对pr是否同步至release分支,增加原因说明规则 ([b37a7b7](https://gitee.com/openharmony/kernel_liteos_a/commits/b37a7b79292d93dae6c4914952b5f3bb509e8721))
|
||||
* 非当前进程销毁时,销毁liteipc时错误的销毁了当前进程的liteipc资源 ([0f0e85b](https://gitee.com/openharmony/kernel_liteos_a/commits/0f0e85b7a6bf76d540925fbf661c483c8dba1cba)), closes [#I4FSA7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FSA7)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* los_cir_buf.c中接口整合 ([0d325c5](https://gitee.com/openharmony/kernel_liteos_a/commits/0d325c56a1053043db05d53a6c8083f4d35f116b)), closes [#I4MC13](https://gitee.com/openharmony/kernel_liteos_a/issues/I4MC13)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
|
||||
* add option SIOCGIFBRDADDR for ioctl ([4ecc473](https://gitee.com/openharmony/kernel_liteos_a/commits/4ecc473843207d259613d26b8ee176d75e7f00fd)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* add sync() to vfs ([f67c4da](https://gitee.com/openharmony/kernel_liteos_a/commits/f67c4dae5141914df2e069dce0196b14780649d8)), closes [#I480](https://gitee.com/openharmony/kernel_liteos_a/issues/I480)
|
||||
* **build:** support gcc toolchain ([6e886d4](https://gitee.com/openharmony/kernel_liteos_a/commits/6e886d4233dec3b82a27642f174b920e5f98f6aa))
|
||||
* L0-L1 支持Perf ([6e0a3f1](https://gitee.com/openharmony/kernel_liteos_a/commits/6e0a3f10bbbfe29d110c050da927684b6d77b961)), closes [#I47I9](https://gitee.com/openharmony/kernel_liteos_a/issues/I47I9)
|
||||
* L0~L1 支持Lms ([e748fdb](https://gitee.com/openharmony/kernel_liteos_a/commits/e748fdbe578a1ddd8eb10b2e207042676231ba26)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* liteipc 静态内存优化 ([5237924](https://gitee.com/openharmony/kernel_liteos_a/commits/52379242c109e0cf442784dbe811ff9d42d5f33a)), closes [#I4G4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4G4)
|
||||
* page cache backed by vnode instead of filep ([38a6b80](https://gitee.com/openharmony/kernel_liteos_a/commits/38a6b804e9291d2fdbd189825ebd7d56165ec51c)), closes [#I44](https://gitee.com/openharmony/kernel_liteos_a/issues/I44)
|
||||
* 提供低功耗默认处理框架 ([212d1bd](https://gitee.com/openharmony/kernel_liteos_a/commits/212d1bd1e806530fe7e7a16ea986cb2c6fb084ed)), closes [#I4KBG9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KBG9)
|
||||
* 支持AT_RANDOM以增强用户态栈保护能力 ([06ea037](https://gitee.com/openharmony/kernel_liteos_a/commits/06ea03715f0cfb8728fadd0d9c19a403dc8f6028)), closes [#I4CB8](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CB8)
|
||||
* 支持L1 低功耗框架 ([64e49ab](https://gitee.com/openharmony/kernel_liteos_a/commits/64e49aba7c9c7d2280c5b3f29f04b17b63209855)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 支持LOS_TaskJoin 和 LOS_TaskDetach ([37bc11f](https://gitee.com/openharmony/kernel_liteos_a/commits/37bc11fa8837a3019a0a56702f401ec1845f6547)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 新增解析异常和backtrace信息脚本 ([7019fdf](https://gitee.com/openharmony/kernel_liteos_a/commits/7019fdfcbb33c660e8aa9fd399d5fccbd7e23b49)), closes [#I47](https://gitee.com/openharmony/kernel_liteos_a/issues/I47)
|
||||
* 调度tick响应时间计算优化 ([f47da44](https://gitee.com/openharmony/kernel_liteos_a/commits/f47da44b39be7fa3e9b5031d7b79b9bef1fd4fbc))
|
||||
* 调度去进程化,优化进程线程依赖关系 ([dc479fb](https://gitee.com/openharmony/kernel_liteos_a/commits/dc479fb7bd9cb8441e4e47d44b42110ea07d76a2))
|
||||
* 调度相关模块间依赖优化 ([0e3936c](https://gitee.com/openharmony/kernel_liteos_a/commits/0e3936c4f8b8bcfc48d283a6d53413e0fc0619b3)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 进程cpup占用率结构优化为动态分配 ([f06e090](https://gitee.com/openharmony/kernel_liteos_a/commits/f06e090a1085a654fd726fbc3c3a1c2bc703d663)), closes [#I4](https://gitee.com/openharmony/kernel_liteos_a/issues/I4)
|
||||
* 进程rlimit修改为动态分配,减少静态内存占用 ([cf8446c](https://gitee.com/openharmony/kernel_liteos_a/commits/cf8446c94112ed6993a2e6e71e793d83a72689d5)), closes [#I4EZY5](https://gitee.com/openharmony/kernel_liteos_a/issues/I4EZY5)
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* 1. 删除 LOS_CirBufLock(),LOS_CirBufUnlock()内核对外接口
|
||||
2. LOS_CirBufWrite(),LOS_CirBufRead()由原先内部不进行上/解锁操作,变为默认已包含上/解锁操作。
|
||||
* 新增支持API:
|
||||
|
||||
LOS_LmsCheckPoolAdd使能检测指定内存池
|
||||
LOS_LmsCheckPoolDel不检测指定内存池
|
||||
LOS_LmsAddrProtect为指定内存段上锁,不允许访问
|
||||
LOS_LmsAddrDisableProtect去能指定内存段的访问保护
|
||||
* 1.新增一系列perf的对外API,位于los_perf.h中.
|
||||
LOS_PerfInit配置采样数据缓冲区
|
||||
LOS_PerfStart开启Perf采样
|
||||
LOS_PerfStop停止Perf采样
|
||||
LOS_PerfConfig配置Perf采样事件
|
||||
LOS_PerfDataRead读取采样数据
|
||||
LOS_PerfNotifyHookReg 注册采样数据缓冲区的钩子函数
|
||||
LOS_PerfFlushHookReg 注册缓冲区刷cache的钩子
|
||||
|
||||
2. 用户态新增perf命令
|
||||
【Usage】:
|
||||
./perf [start] /[start id] Start perf.
|
||||
./perf [stop] Stop perf.
|
||||
./perf [read nBytes] Read nBytes raw data from perf buffer and print out.
|
||||
./perf [list] List events to be used in -e.
|
||||
./perf [stat] or [record] <option> <command>
|
||||
-e, event selector. use './perf list' to list available events.
|
||||
-p, event period.
|
||||
-o, perf data output filename.
|
||||
-t, taskId filter(whiltelist), if not set perf will sample all tasks.
|
||||
-s, type of data to sample defined in PerfSampleType los_perf.h.
|
||||
-P, processId filter(whiltelist), if not set perf will sample all processes.
|
||||
-d, whether to prescaler (once every 64 counts), which only take effect on cpu cycle hardware event.
|
||||
|
||||
|
||||
# (2021-09-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* A核代码告警清零 ([698756d](https://gitee.com/openharmony/kernel_liteos_a/commits/698756d1e6dfb11b9f874c02ce6a1496646f2c27)), closes [#I4378](https://gitee.com/openharmony/kernel_liteos_a/issues/I4378)
|
||||
* A核告警消除 ([d16bfd0](https://gitee.com/openharmony/kernel_liteos_a/commits/d16bfd005a6dae78df2df3ad55cf21e0716dfae9)), closes [#I46KF6](https://gitee.com/openharmony/kernel_liteos_a/issues/I46KF6)
|
||||
* 3518平台, 异常测试进程无法正常退出 ([23937a2](https://gitee.com/openharmony/kernel_liteos_a/commits/23937a239f50d1487e89f3184e4f4b933d6842c6)), closes [#I3V8R5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V8R5)
|
||||
* add (void) to GetFileMappingList method ([56b8eca](https://gitee.com/openharmony/kernel_liteos_a/commits/56b8ecaf171671c0fe97f1dd1f191bebb7812a51)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* add capability and amend smoke testcase ([c9d69e2](https://gitee.com/openharmony/kernel_liteos_a/commits/c9d69e2d1bde57c67068cc36f6a79327d5db5daf))
|
||||
* add fchdir api ([e828cbd](https://gitee.com/openharmony/kernel_liteos_a/commits/e828cbdeac7d60bfd6ed98c75a9958ee8ec7b672))
|
||||
* add fchmod api ([2f214bf](https://gitee.com/openharmony/kernel_liteos_a/commits/2f214bf4de6c31875c77e84b1763e96bc5ceb669))
|
||||
* add fststfs api and unitest ([4c57aa2](https://gitee.com/openharmony/kernel_liteos_a/commits/4c57aa26ad3644ce2429effc8e8fe7fd3c52ebc2))
|
||||
* add product_path parameter for driver build ([88fe4eb](https://gitee.com/openharmony/kernel_liteos_a/commits/88fe4eb3e1eafa6d1e32c7b96579a07f5a8c6e35)), closes [#I3PQ10](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PQ10)
|
||||
* add syscall for ppoll & add 2 testcases ([defedb6](https://gitee.com/openharmony/kernel_liteos_a/commits/defedb6fdf0806da4a39e22408544cdfb405f2ff))
|
||||
* avoid compile warning ignored ([eca711b](https://gitee.com/openharmony/kernel_liteos_a/commits/eca711bb64a7c806ae34c8483cac73fe22b0104f)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* A核codex修改 ([ec977a1](https://gitee.com/openharmony/kernel_liteos_a/commits/ec977a1c7e9ba4ea6621ceb1d0d10e586148208d)), closes [#I40B1](https://gitee.com/openharmony/kernel_liteos_a/issues/I40B1)
|
||||
* BBOX使用预留物理内存缓存故障日志 ([2ad176e](https://gitee.com/openharmony/kernel_liteos_a/commits/2ad176e587d5ed7106831a25d386a88e26192e2b)), closes [#I41](https://gitee.com/openharmony/kernel_liteos_a/issues/I41)
|
||||
* bootargs解析与rootfs挂载解耦,并支持自定义bootargs参数 ([80473f0](https://gitee.com/openharmony/kernel_liteos_a/commits/80473f0975fe6fd4c4eae3a8a473674ad2dd1293)), closes [#I41CL8](https://gitee.com/openharmony/kernel_liteos_a/issues/I41CL8)
|
||||
* **build:** clang10.0.1支持lto,去掉冗余判断 ([73223ae](https://gitee.com/openharmony/kernel_liteos_a/commits/73223ae7e652b7cd9f1e1848c32b2b2573d07b2a))
|
||||
* **build:** fix rootfsdir.sh target directory not exist ([21bf2b8](https://gitee.com/openharmony/kernel_liteos_a/commits/21bf2b889931787fb18ca7ea238291fd57e76d51)), closes [#I3NHQ0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NHQ0)
|
||||
* **build:** 去除冗余单板相关的宏配置 ([471de36](https://gitee.com/openharmony/kernel_liteos_a/commits/471de3663ea8b63f7448162edc0293b8723dcefc))
|
||||
* clang10 lld could not recognized Oz ([87a0006](https://gitee.com/openharmony/kernel_liteos_a/commits/87a0006d5e1976fdf5efe4be383921610eb04ec6))
|
||||
* clang相关编译选项隔离 ([77dcef4](https://gitee.com/openharmony/kernel_liteos_a/commits/77dcef4bc0c92d0141f7a3be0addd4d5cb533b0b)), closes [#I444](https://gitee.com/openharmony/kernel_liteos_a/issues/I444)
|
||||
* codex ([101a55d](https://gitee.com/openharmony/kernel_liteos_a/commits/101a55d1199530d621f809976f0024aa8295cce8))
|
||||
* codex clean ([b5370af](https://gitee.com/openharmony/kernel_liteos_a/commits/b5370af822c8e81ed2248ac8aa3bb479a0db9dae)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* compile error when fatfs disabled ([fd3f407](https://gitee.com/openharmony/kernel_liteos_a/commits/fd3f4072b5c3dff710013ccdaddf114b0e13f435))
|
||||
* console compile bug fix ([f8441a0](https://gitee.com/openharmony/kernel_liteos_a/commits/f8441a0cdea301449416b0c0477dc48a05b6ab4e))
|
||||
* correct spelling ([c66fe03](https://gitee.com/openharmony/kernel_liteos_a/commits/c66fe0313f76ba41992b4864c93cf82934378ad3))
|
||||
* Correctly handle the return value of LOS_EventRead in QuickstartListen. ([0e0ab81](https://gitee.com/openharmony/kernel_liteos_a/commits/0e0ab81ff9474cffd5e60a8ee741840eac5d737b)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* Ctrl-C move out of LOS_MAGIC_KEY_ENABLE ([40f239a](https://gitee.com/openharmony/kernel_liteos_a/commits/40f239a7d4673dc740c853b1011b5072e48385b7))
|
||||
* Delete useless 'exc interaction' macros and function declarations. ([d2f2679](https://gitee.com/openharmony/kernel_liteos_a/commits/d2f26790716c9f76589c4a7d6fa5518f9ccd743c)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* dereference NULL point bug fix ([deaa564](https://gitee.com/openharmony/kernel_liteos_a/commits/deaa564a66b83c9fe19a37b8a061ec9064ece354))
|
||||
* do not build toybox temporarily ([044f2c7](https://gitee.com/openharmony/kernel_liteos_a/commits/044f2c7c17c68e10aeccc3af0c222cfc722d194c))
|
||||
* do not override existing libs ([8118408](https://gitee.com/openharmony/kernel_liteos_a/commits/8118408123e75f7f5a4ab9101e388be6bba0dcda))
|
||||
* **doc:** 修复README_zh-HK.md的链接错误 ([f1b4c87](https://gitee.com/openharmony/kernel_liteos_a/commits/f1b4c87bc44650348504bc00b3f6f94491c341a0))
|
||||
* fatfs memory leak ([fbfd71d](https://gitee.com/openharmony/kernel_liteos_a/commits/fbfd71dfe3b5555ef09e542d96a630dfba636daa))
|
||||
* fix function name OsSchedSetIdleTaskSchedParam ([8f8c038](https://gitee.com/openharmony/kernel_liteos_a/commits/8f8c038b217d5ba2518413bfc1ba857587d47442))
|
||||
* Fix kernel page fault exception handling causing system exception. ([a89fb57](https://gitee.com/openharmony/kernel_liteos_a/commits/a89fb57f5795236b93fd19ee2d7a059cae1b2b1b)), closes [#I3RAN4](https://gitee.com/openharmony/kernel_liteos_a/issues/I3RAN4)
|
||||
* fix length typo ([12d98b1](https://gitee.com/openharmony/kernel_liteos_a/commits/12d98b144b70e726d3fd31ddc9d17ed855d0ec1b))
|
||||
* fix mq function by enable mq_notify api ([4427142](https://gitee.com/openharmony/kernel_liteos_a/commits/4427142d734df8f95f4599093392904abacc5c93))
|
||||
* Fix quickstart codingstyle ([2e011b6](https://gitee.com/openharmony/kernel_liteos_a/commits/2e011b672f6b96ea7e0db066a07e3f9fb6ba5df3)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* fix stored typo ([d25560f](https://gitee.com/openharmony/kernel_liteos_a/commits/d25560f8ac3216670d198cbbb25891c394e0b3c2))
|
||||
* fix syscall faccessat,fstatfs,fstatat & add 6 testcases ([aa1cd24](https://gitee.com/openharmony/kernel_liteos_a/commits/aa1cd245a5711e5b53c328b688da5ddc2e783d5f))
|
||||
* fix the inappropriate errno in FatFs ([af61187](https://gitee.com/openharmony/kernel_liteos_a/commits/af61187587411dca38ff62e720451f08f19c1c82)), closes [#I3O8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3O8)
|
||||
* fix typo in quickstart ([3b2ff4b](https://gitee.com/openharmony/kernel_liteos_a/commits/3b2ff4b71fc5ae1dc74180c33fd66f69da0059d1)), closes [#I3M1S8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3M1S8)
|
||||
* Fix wrong judgment in los_trace.c to avoid null pointer access. ([4d863e9](https://gitee.com/openharmony/kernel_liteos_a/commits/4d863e985b6372f7895db57b602b662dba5cadd0)), closes [#I3RT9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3RT9)
|
||||
* Identical condition 'ret<0', second condition is always false. :bug: ([1348809](https://gitee.com/openharmony/kernel_liteos_a/commits/1348809807548dd481286a55a6677a9169fcd705))
|
||||
* init进程收到子进程退出信号后,调用fork重新拉起进程,会导致系统卡死 ([35a2f3a](https://gitee.com/openharmony/kernel_liteos_a/commits/35a2f3af33a5dba1e0ba36587efced8fead97223)), closes [#I41](https://gitee.com/openharmony/kernel_liteos_a/issues/I41)
|
||||
* kernel crashed after rmdir the umounted folder ([ac0d083](https://gitee.com/openharmony/kernel_liteos_a/commits/ac0d083b1c89c4ad3fdaab0347d11f174d0185cb))
|
||||
* kernel crashed when delete a umounted folder ([f305d1f](https://gitee.com/openharmony/kernel_liteos_a/commits/f305d1f702a770010125a0f4f0152ffefeeec5c4))
|
||||
* kernel crashed when delete a umounted folder ([c6e9212](https://gitee.com/openharmony/kernel_liteos_a/commits/c6e921241b1cf26bcbfeea44e20f6b596512e259))
|
||||
* **kernel_test:** 内核mem/shm冒烟用例重复运行失败 ([0676578](https://gitee.com/openharmony/kernel_liteos_a/commits/0676578aae09c101d79e7a276823e849df293e29)), closes [#I3TH4](https://gitee.com/openharmony/kernel_liteos_a/issues/I3TH4)
|
||||
* L1 toybox 命令功能实现 ([2ff44c4](https://gitee.com/openharmony/kernel_liteos_a/commits/2ff44c4938d2e66ce60e9497c505eb6e97efc8c2)), closes [#I41N2](https://gitee.com/openharmony/kernel_liteos_a/issues/I41N2)
|
||||
* liteipc max data size too small ([4dc421e](https://gitee.com/openharmony/kernel_liteos_a/commits/4dc421e3decdaae60219d533c4a93dbc9334e35f))
|
||||
* LiteOS_A BBOX Codex整改 ([6a5a032](https://gitee.com/openharmony/kernel_liteos_a/commits/6a5a0326d2b18ffacce5d38fb351530973c2f245)), closes [#I43](https://gitee.com/openharmony/kernel_liteos_a/issues/I43)
|
||||
* Liteos-a创建的文件夹在Ubuntu中不可见 ([a9fc1e0](https://gitee.com/openharmony/kernel_liteos_a/commits/a9fc1e0e5d3e5eb8a34c568a8d147320a9afebe1)), closes [#I3XMY6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XMY6)
|
||||
* lookup new vnode may cause parent vnode freeing ([902a11d](https://gitee.com/openharmony/kernel_liteos_a/commits/902a11de9a4b08e799820fb87942cb2171b9e095)), closes [#I3MYP4](https://gitee.com/openharmony/kernel_liteos_a/issues/I3MYP4)
|
||||
* **mini:** fix compile error in mini liteos_a ([e13cb3b](https://gitee.com/openharmony/kernel_liteos_a/commits/e13cb3bcc4e74d4c49c31d290d686f99a4e81e3f))
|
||||
* minimal compile ([ac8c2c6](https://gitee.com/openharmony/kernel_liteos_a/commits/ac8c2c6d5b9ede0e46b48212f0b3447605a613c4))
|
||||
* misspell ([08980ea](https://gitee.com/openharmony/kernel_liteos_a/commits/08980eac3c249ec6a6717d8a04fb0be7716053a1))
|
||||
* mkdir -p is more robust ([e38f9a9](https://gitee.com/openharmony/kernel_liteos_a/commits/e38f9a98c9d373db8381af707c5996d1fefef64e))
|
||||
* mksh compile bug fix ([d8263b1](https://gitee.com/openharmony/kernel_liteos_a/commits/d8263b1e91d76706d52df321ef642c1c8297e8e4)), closes [#I3ZMR7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3ZMR7)
|
||||
* modify event API description ([937734b](https://gitee.com/openharmony/kernel_liteos_a/commits/937734b1e9f5fc52e0ac727549bd2e4b4c864e3c))
|
||||
* move nuttx head file back ([4c8a86e](https://gitee.com/openharmony/kernel_liteos_a/commits/4c8a86ece7cafa8f74441bacc74c7788c0a1b780)), closes [#I4443](https://gitee.com/openharmony/kernel_liteos_a/issues/I4443)
|
||||
* nanosleep 接口的rmtp参数被错误清零 ([9458de9](https://gitee.com/openharmony/kernel_liteos_a/commits/9458de9ac664cd75540c8b638b9a6caf82812fc8)), closes [#I41U0](https://gitee.com/openharmony/kernel_liteos_a/issues/I41U0)
|
||||
* no exception information output, when the system is abnormal ([5bf4d1c](https://gitee.com/openharmony/kernel_liteos_a/commits/5bf4d1c7128e6718611bbec23cb4373bcb3bfe55))
|
||||
* no exception information output, when the system is abnormal ([28aa777](https://gitee.com/openharmony/kernel_liteos_a/commits/28aa777191e7b41e4f1f346ab79f8688edc59c6d))
|
||||
* no exception information output, when the system is abnormal after holding ([0ed8adf](https://gitee.com/openharmony/kernel_liteos_a/commits/0ed8adfe3ae59672e284331d40ef3b9e0bc8e094))
|
||||
* Optimiz macro of quickstart cmd ([cb140a4](https://gitee.com/openharmony/kernel_liteos_a/commits/cb140a4442c02dd0b1925cc58deecbf4da36dcea)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* Optimize /dev/quickstart permissions. ([4e24b57](https://gitee.com/openharmony/kernel_liteos_a/commits/4e24b572897c33e1b2723122c0e13d3931096bae)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* Optimize quickstart node implementation ([4abd2e0](https://gitee.com/openharmony/kernel_liteos_a/commits/4abd2e0247b14718bb21756fb446142140d30a88)), closes [#I3R8O8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3R8O8)
|
||||
* OsGerCurrSchedTimeCycle 函数存在拼写错误 ([53ced1a](https://gitee.com/openharmony/kernel_liteos_a/commits/53ced1a85edc3d06230225ced3916772f432243f)), closes [#I446](https://gitee.com/openharmony/kernel_liteos_a/issues/I446)
|
||||
* OsGetArgsAddr声明所在头文件不正确 ([14bd753](https://gitee.com/openharmony/kernel_liteos_a/commits/14bd753aa8beb49af887c8d0aedaefa446409760)), closes [#I41](https://gitee.com/openharmony/kernel_liteos_a/issues/I41)
|
||||
* parent point of vnode found by VfsHashGet should be updated ([f32caa5](https://gitee.com/openharmony/kernel_liteos_a/commits/f32caa52c67eca20d58676be4e0439acbb4c5ac3)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* PathCacheFree try to free name field in struct PathCache ([9f47faf](https://gitee.com/openharmony/kernel_liteos_a/commits/9f47faff732609cf2249f104b94ed55f3ef133bb)), closes [#I3NTH9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NTH9)
|
||||
* PathCacheMemoryDump miscalculate the RAM usage of PathCache ([87da7c7](https://gitee.com/openharmony/kernel_liteos_a/commits/87da7c794c9bc8e311ae5242820fbf8aefd8d558)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* Provide a separate configuration macro for boot environment in RAM. ([e28e06b](https://gitee.com/openharmony/kernel_liteos_a/commits/e28e06b08f5b28091153e584cb9d93014a9f2b10))
|
||||
* Provide a separate configuration macro for boot environment in RAM. ([bc67393](https://gitee.com/openharmony/kernel_liteos_a/commits/bc67393a67f714e0a8165b6103e53699c676341c))
|
||||
* Provide a separate configuration macro for boot environment in RAM. ([f13b90e](https://gitee.com/openharmony/kernel_liteos_a/commits/f13b90e4308ba3d60683799b9ce62fb3705ac277)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* race condition in liteipc ([7e2aef2](https://gitee.com/openharmony/kernel_liteos_a/commits/7e2aef2480b15f71ee0e089cef4443f578e03dbb)), closes [#I3PW5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PW5)
|
||||
* rebuild mksh depends on rebuild.sh script ([bef4ab9](https://gitee.com/openharmony/kernel_liteos_a/commits/bef4ab9835dec865898c74337dfb7154718b94aa))
|
||||
* remove redundant headfile ([73a7777](https://gitee.com/openharmony/kernel_liteos_a/commits/73a777777e1b834192f6bb2c0e8bd03c69765c11)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* Remove redundant invalid codes ([fe05df4](https://gitee.com/openharmony/kernel_liteos_a/commits/fe05df40ae710632adb1bd54fb04ad4a8e0c1429)), closes [#I3R70](https://gitee.com/openharmony/kernel_liteos_a/issues/I3R70)
|
||||
* Show conflicting files for git apply or patch -p command ([35f7957](https://gitee.com/openharmony/kernel_liteos_a/commits/35f79579758644cbcac6005f894be21f34f42b99)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* SIOCGIFCONF ioctl malloc size error in kernel ([bfd27e7](https://gitee.com/openharmony/kernel_liteos_a/commits/bfd27e78b259eedbd4c30548e80c9b4d789d26e1)), closes [#I3XEZ3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XEZ3)
|
||||
* smp启动代码解耦及内存映射关系解耦 ([3bb3173](https://gitee.com/openharmony/kernel_liteos_a/commits/3bb3173604dc4dea09301f61da402974185dc112)), closes [#I41P8](https://gitee.com/openharmony/kernel_liteos_a/issues/I41P8)
|
||||
* some branch in format does not release the vnode mutex properly ([9b2b700](https://gitee.com/openharmony/kernel_liteos_a/commits/9b2b700fa0e3a8edadb38f09c917a3e3f013347f)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* Sortlink, the response time to insert the node should be inserted into the back of the existing node. ([1323874](https://gitee.com/openharmony/kernel_liteos_a/commits/1323874389030c55fb053fead12ca1c6654d8851)), closes [#I3PSJ8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PSJ8)
|
||||
* statfs can't get f_bfree and f_bavail of a FAT12/FAT16 partition ([9503c4a](https://gitee.com/openharmony/kernel_liteos_a/commits/9503c4a9fc30aaa8ea2031d4fb794436f3c98055)), closes [#I3Q0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Q0)
|
||||
* SysOpenat返回值应该为进程fd,而非系统全局fd。 ([3457c0b](https://gitee.com/openharmony/kernel_liteos_a/commits/3457c0b11debb2cf5d4abe325c2510a750654512)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* the total used vnode number not increased after unlink a file under ([4f514a1](https://gitee.com/openharmony/kernel_liteos_a/commits/4f514a16af5a3f3b9c4ea182de774297afb17f66)), closes [#I3TS1](https://gitee.com/openharmony/kernel_liteos_a/issues/I3TS1)
|
||||
* tick 动态化计算优化,消除中断执行时间对系统总体时间的影响,保证软件定时器的响应精度。 ([8df3e8c](https://gitee.com/openharmony/kernel_liteos_a/commits/8df3e8c96515a1907455a9bbc61426f43c803c62)), closes [#I43](https://gitee.com/openharmony/kernel_liteos_a/issues/I43)
|
||||
* toybox update ([c3245b3](https://gitee.com/openharmony/kernel_liteos_a/commits/c3245b3ce317eb58c8dad58fdfc7f094b9b9794b))
|
||||
* toybox命令升级 ([76f45b3](https://gitee.com/openharmony/kernel_liteos_a/commits/76f45b3fb2783d1cab45a6ba08787c29dfa2c948)), closes [#I41N2](https://gitee.com/openharmony/kernel_liteos_a/issues/I41N2)
|
||||
* update LOS_DL_LIST_IS_END comment ([900269b](https://gitee.com/openharmony/kernel_liteos_a/commits/900269bd4645252d898f6d3b73de01d8548c960c))
|
||||
* userfs分区的起始地址与大小改为通过bootargs配置 ([2e2b142](https://gitee.com/openharmony/kernel_liteos_a/commits/2e2b14205f4b81c7483ab42d62f144487097e9a4)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* VnodeInUseIter and VnodeFreeAll used to be recursive ([5f6656c](https://gitee.com/openharmony/kernel_liteos_a/commits/5f6656cb36a2ffb0b290aeb53981aba7501e80b2)), closes [#I3NN3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NN3)
|
||||
* 以g_sysSchedStartTime是否为0判断时间轴是否生效存在极限场景导致调度时间不生效 ([67ac8c4](https://gitee.com/openharmony/kernel_liteos_a/commits/67ac8c4c586adc371ece56700fd42371ca7fc885)), closes [#I45HP5](https://gitee.com/openharmony/kernel_liteos_a/issues/I45HP5)
|
||||
* 修复FATFS中不同内部接口不支持FAT12/FAT16 FAT表结束标志 ([33f5c70](https://gitee.com/openharmony/kernel_liteos_a/commits/33f5c70e6c8781758d2bfde0f60ca3d6ec7d543f)), closes [#I409R6](https://gitee.com/openharmony/kernel_liteos_a/issues/I409R6)
|
||||
* 修复kill进程时,因liteipc阻塞的进程概率无法退出问题 ([7de43bb](https://gitee.com/openharmony/kernel_liteos_a/commits/7de43bb004a12f926550f0b36ca3c2fa610feb27)), closes [#I3XX7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XX7)
|
||||
* 修复MagicKey数组越界访问 ([071cd62](https://gitee.com/openharmony/kernel_liteos_a/commits/071cd6268aeaaef702387dacaf4ef1ffbb7618fc)), closes [#I3U4N9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3U4N9)
|
||||
* 修复mprotect修改地址区间的权限后,相应的区间名丢失问题 ([e425187](https://gitee.com/openharmony/kernel_liteos_a/commits/e425187d176a5e09bc5253faefc9cfc8454da0a3)), closes [#I43R40](https://gitee.com/openharmony/kernel_liteos_a/issues/I43R40)
|
||||
* 修复mq_close关闭后仍然占用文件描述符的问题 ([590c7b4](https://gitee.com/openharmony/kernel_liteos_a/commits/590c7b4e22662781d05ad035a785e985d573ec33)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* 修复mqueue问题 ([26ee8b8](https://gitee.com/openharmony/kernel_liteos_a/commits/26ee8b836e346e641de4ecd72284f5d377bca6f8)), closes [#I43P4](https://gitee.com/openharmony/kernel_liteos_a/issues/I43P4)
|
||||
* 修复sigwait等待到的信号值与获取的siginfo中的值不一致 ([ed7defb](https://gitee.com/openharmony/kernel_liteos_a/commits/ed7defbd439c345a07159d40eb04433afd530004)), closes [#I3M12](https://gitee.com/openharmony/kernel_liteos_a/issues/I3M12)
|
||||
* 修复了LOSCFG_FS_FAT_VIRTUAL_PARTITION宏开关错误作用域引起的功能错误 ([acda419](https://gitee.com/openharmony/kernel_liteos_a/commits/acda419a2d773ea890052a16ee66b4872f941fbb)), closes [#I3W1](https://gitee.com/openharmony/kernel_liteos_a/issues/I3W1)
|
||||
* 修复了内核的VFAT测试用例 ([a8384b5](https://gitee.com/openharmony/kernel_liteos_a/commits/a8384b5db2274d50a350910d7cfd3fc36b4f4103)), closes [#I3XF3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XF3)
|
||||
* 修复内核access chmod chown接口 ([56a95b9](https://gitee.com/openharmony/kernel_liteos_a/commits/56a95b9ec903f815f9199ac65ca318e00a83b2ed)), closes [#I3Z5L6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z5L6)
|
||||
* 修复内核c库的makefile中被优化函数替换的高频函数依然参与了编译的问题 ([6f6dc4f](https://gitee.com/openharmony/kernel_liteos_a/commits/6f6dc4f24c8ab05a6d42da46a9fa41d74a477bd7)), closes [#I3XGM8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XGM8)
|
||||
* 修复内核堆完整性检查逻辑中访问非法指针导致系统异常问题。 ([30f5ab8](https://gitee.com/openharmony/kernel_liteos_a/commits/30f5ab89b72d45f596b15af82a8e8e01add7977d)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* 修复启动框架debug模式下-Werror=maybe-uninitialized告警以及符号链接不进镜像的隐患 ([4c02415](https://gitee.com/openharmony/kernel_liteos_a/commits/4c024159a9600745863e49ee955308470a5b657b)), closes [#I3T5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T5)
|
||||
* 修复开机概率挂死 ([2e82c36](https://gitee.com/openharmony/kernel_liteos_a/commits/2e82c361f73b2119613c3571c48faae8ec41d4eb)), closes [#I3SWY2](https://gitee.com/openharmony/kernel_liteos_a/issues/I3SWY2)
|
||||
* 修复文档链接失效问题 ([42a3a6c](https://gitee.com/openharmony/kernel_liteos_a/commits/42a3a6c51bfca4ade8ce94084ea2f8eb1c86a137)), closes [#I45297](https://gitee.com/openharmony/kernel_liteos_a/issues/I45297)
|
||||
* 修改/proc/mounts显示格式 ([6860246](https://gitee.com/openharmony/kernel_liteos_a/commits/6860246cfaac6f540665e79bbc4c3d54c419b092)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* 修改clock_gettime接口适配posix标准测试用例011输入clk_id错误时返回值ESRCH为EINVAL. ([f8cf6e6](https://gitee.com/openharmony/kernel_liteos_a/commits/f8cf6e6439ee017fe8e0d4ecfc9949c28fa6775f)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* 修改DoNanoSleep 以纳秒为单位 ([6917e08](https://gitee.com/openharmony/kernel_liteos_a/commits/6917e08431689ccbd5a30e9a39b67016ffb64d0a)), closes [#I3Z9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z9)
|
||||
* 修改某些平台保存bbox日志失败的问题 ([8f6a1dd](https://gitee.com/openharmony/kernel_liteos_a/commits/8f6a1dd33c59164070e8d2fb5abbd3e76ef8ac8e)), closes [#I41](https://gitee.com/openharmony/kernel_liteos_a/issues/I41)
|
||||
* 修改默认窗口宽度到400 ([09c491c](https://gitee.com/openharmony/kernel_liteos_a/commits/09c491ca1fd6d3110eafb0d07e45b25bdc3bd5d0)), closes [#I40](https://gitee.com/openharmony/kernel_liteos_a/issues/I40)
|
||||
* 关闭jffs和fat后,rootfs配置也被相应关闭,导致nand介质的rootfs不可用。 ([0ea476b](https://gitee.com/openharmony/kernel_liteos_a/commits/0ea476b9741fabd3c255c2770688f587920cf509)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* 内核态在console初始化完成后,使用printf无法正常打印 ([44ce696](https://gitee.com/openharmony/kernel_liteos_a/commits/44ce6969048c2e252f3f9d66fa485c77bdab8ae7)), closes [#I3UG00](https://gitee.com/openharmony/kernel_liteos_a/issues/I3UG00)
|
||||
* 去掉冗余的strip操作 ([7819d15](https://gitee.com/openharmony/kernel_liteos_a/commits/7819d15b3619681ae37a1349a6bec2440c829ae9)), closes [#I43767](https://gitee.com/openharmony/kernel_liteos_a/issues/I43767)
|
||||
* 合并进程栈两个地址连续的region ([42f374d](https://gitee.com/openharmony/kernel_liteos_a/commits/42f374dd7a353f1c8227e92fa92827c1c7b32424)), closes [#I43](https://gitee.com/openharmony/kernel_liteos_a/issues/I43)
|
||||
* 在内核提示No idle TCB时,增加打印当前系统任务信息,以方便问题定位。 ([11a9b00](https://gitee.com/openharmony/kernel_liteos_a/commits/11a9b00d43a6dbe9fba9f6eb07d78a9d226c28f8)), closes [#I434](https://gitee.com/openharmony/kernel_liteos_a/issues/I434)
|
||||
* 增加表头,内容以制表符分栏。 ([e9ad6b7](https://gitee.com/openharmony/kernel_liteos_a/commits/e9ad6b71c3b1136414672cd21b339ded7a02dfb9)), closes [#I3W2M9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3W2M9)
|
||||
* 将用户态内存调测解析脚本移至tools目录下 ([85b4cb7](https://gitee.com/openharmony/kernel_liteos_a/commits/85b4cb7a67b717984d3ebf68115c7139cc61d690)), closes [#I42T9](https://gitee.com/openharmony/kernel_liteos_a/issues/I42T9)
|
||||
* 恢复了FATFS设置卷标的功能 ([9515d53](https://gitee.com/openharmony/kernel_liteos_a/commits/9515d53dccc9a6458bfbaf8e15143928f05cb660)), closes [#I3Y5G8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Y5G8)
|
||||
* 解决kill进程时无法保证进程的已持有的内核资源合理释放. ([cf89f01](https://gitee.com/openharmony/kernel_liteos_a/commits/cf89f016e93f28f8d72e6f5de08640d08a155908)), closes [#I3S0N0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3S0N0)
|
||||
* 解决不同环境下计算的rootfs的size偏小,导致mcopy造成的disk full错误 ([c54879b](https://gitee.com/openharmony/kernel_liteos_a/commits/c54879b54875abece53b1f64072cfacbd2e1970e)), closes [#I3IA06](https://gitee.com/openharmony/kernel_liteos_a/issues/I3IA06)
|
||||
* 设置qemu默认userfs大小/修改qemu驱动目录 ([1d952a2](https://gitee.com/openharmony/kernel_liteos_a/commits/1d952a254a6e7ec2f70f7112eb27355cfd01ba4d)), closes [#I3XW96](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XW96) [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* active mksh & toybox ([cacb4f0](https://gitee.com/openharmony/kernel_liteos_a/commits/cacb4f0103ecb2d1b7af54d84957f88d3e9443d2)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* Add /dev/quickstart to support synchronous communication between processes in user mode startup. ([46b63f7](https://gitee.com/openharmony/kernel_liteos_a/commits/46b63f71537789743ed2f3f337c1809ee4900d71)), closes [#I3OHO5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OHO5)
|
||||
* add /proc/fd file to dump the pid/fd/path information ([600dded](https://gitee.com/openharmony/kernel_liteos_a/commits/600dded31e80df275ed08c326c0ce3d1857d8dd8)), closes [#I3WB5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3WB5)
|
||||
* add /proc/fs_cache to display cache info ([231cb6b](https://gitee.com/openharmony/kernel_liteos_a/commits/231cb6be27380948bc48136ae2e02c28450f47a8)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* add /proc/fs_cache to display cache info ([53c6d96](https://gitee.com/openharmony/kernel_liteos_a/commits/53c6d96c6f97cb006216769f8b73f50fba3bc325)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* add and fix some syscall ([ce849f2](https://gitee.com/openharmony/kernel_liteos_a/commits/ce849f2145e1569517c5244c9ffcaebed53f3a66))
|
||||
* add blackbox for liteos_a ([a195aac](https://gitee.com/openharmony/kernel_liteos_a/commits/a195aac9fb60b0163f9eebb29084287d226bd14c)), closes [#I406](https://gitee.com/openharmony/kernel_liteos_a/issues/I406)
|
||||
* add blackbox for liteos_a ([425975e](https://gitee.com/openharmony/kernel_liteos_a/commits/425975e4811023e31a520979c20ea2562224d9d0)), closes [#I3NN7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NN7)
|
||||
* add clear cache cmd to /proc/fs_cache ([3d1cf68](https://gitee.com/openharmony/kernel_liteos_a/commits/3d1cf683f37a6f75e9db2ce1f11ec93159b77663)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* add liteos patch ability ([98ca844](https://gitee.com/openharmony/kernel_liteos_a/commits/98ca8441fe75ee1c3318a6a09376fd72f5a51350))
|
||||
* add support for gn build system ([a8805a6](https://gitee.com/openharmony/kernel_liteos_a/commits/a8805a65aab9109b915364fccf36c8328f636e48))
|
||||
* add uid/gid for ProcFs ([6780659](https://gitee.com/openharmony/kernel_liteos_a/commits/67806596a3c0df9a54893d8c74ebe9da98d7fb06)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* A核proc文件系统在echo模式下新增write的功能 ([f10dd7c](https://gitee.com/openharmony/kernel_liteos_a/commits/f10dd7c135d37a5fb0d78610d5ece5807d01eb1f)), closes [#I3T6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T6)
|
||||
* build OHOS_Image from kernel ([abf4d8f](https://gitee.com/openharmony/kernel_liteos_a/commits/abf4d8fb252631aca9d46211762880a23be2a0b1))
|
||||
* **build:** make liteos_config_file available as gn argument ([f9a9077](https://gitee.com/openharmony/kernel_liteos_a/commits/f9a907772f506ca7e2d84e96d4d17cffc7dae50f))
|
||||
* **build:** 使用xts -notest选项时,内核用例不参与编译构建和用例编译配置方式调整 ([9bdf716](https://gitee.com/openharmony/kernel_liteos_a/commits/9bdf716407c125c9877b6f49c2133112c18cdabc))
|
||||
* don't apply module_swith on configs of config ([f3beb4b](https://gitee.com/openharmony/kernel_liteos_a/commits/f3beb4b273c9a76fbfaffe57302f27d2a74cd2ba))
|
||||
* enable gn build for toybox and mksh ([c54bfa1](https://gitee.com/openharmony/kernel_liteos_a/commits/c54bfa16e3907482c252e9738192df869c63326e))
|
||||
* fatfs支持符号链接功能 ([e50cf0b](https://gitee.com/openharmony/kernel_liteos_a/commits/e50cf0be6f6d118022b6d79c5177aece574ba150)), closes [#I3V8D1](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V8D1)
|
||||
* **file system:** add memory-based romfs ([c4595d2](https://gitee.com/openharmony/kernel_liteos_a/commits/c4595d25042b188570d991a815009764c37f3cb3)), closes [#I3S0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3S0)
|
||||
* introduce mksh toybox to rootfs ([41c7689](https://gitee.com/openharmony/kernel_liteos_a/commits/41c7689dfa49c52fb15705ce15ef22a278fbf2ef))
|
||||
* L0-L1 支持Trace ([dc9ec68](https://gitee.com/openharmony/kernel_liteos_a/commits/dc9ec6856fe14aa604f037f55f17a3ba2bafb098)), closes [#I46WA0](https://gitee.com/openharmony/kernel_liteos_a/issues/I46WA0)
|
||||
* L1支持低功耗投票框架 ([21d8ac8](https://gitee.com/openharmony/kernel_liteos_a/commits/21d8ac8752469f6e0dc2d50d28b75421f665385a)), closes [#I3VS5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3VS5)
|
||||
* **libc:** upgrade optimized-routines to v21.02 ([1ec8d5a](https://gitee.com/openharmony/kernel_liteos_a/commits/1ec8d5a454658e95c4acb821d0878f357f4e82ad))
|
||||
* **make:** optimize makefiles and remove some unused files ([0e26094](https://gitee.com/openharmony/kernel_liteos_a/commits/0e260949c962158a263d4b0ad45fe9f6843d6e30))
|
||||
* Open macro for ADC moudule ([c71ec9d](https://gitee.com/openharmony/kernel_liteos_a/commits/c71ec9d7e8574078a9dc2a8463f3141cca3d625a))
|
||||
* **QEMU_ARM_VIRT_CA7:** 使能FAT文件系统编译选项 ([49856dc](https://gitee.com/openharmony/kernel_liteos_a/commits/49856dc1e0de1c5e92346c83eda641dfb1bb16be))
|
||||
* support .mkshrc ([51a50c9](https://gitee.com/openharmony/kernel_liteos_a/commits/51a50c95b4cd47b6931523926b728d1c0ff8988b)), closes [#I3Y5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Y5)
|
||||
* support link/symlink/readlink ([6eddc86](https://gitee.com/openharmony/kernel_liteos_a/commits/6eddc869d349be59860bfd84ff10b7579a9b00a9)), closes [#I3Q0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Q0)
|
||||
* support toybox in qemu ([5618319](https://gitee.com/openharmony/kernel_liteos_a/commits/561831928bb1ad1871b2d60d2bba2d67488cea5f)), closes [#I3V17](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V17)
|
||||
* timer_create支持以SIGEV_THREAD方式创建定时器 ([e5f6bf0](https://gitee.com/openharmony/kernel_liteos_a/commits/e5f6bf05567c2d193f3746caca502199e7b81e92)), closes [#I3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3)
|
||||
* using kconfiglib instead of kconfig ([8784694](https://gitee.com/openharmony/kernel_liteos_a/commits/878469468647a19f704e7ee2af696b0ba8ab775a))
|
||||
* vfs support sdcard hotplug ([2db80ec](https://gitee.com/openharmony/kernel_liteos_a/commits/2db80ecb389176b53c77807567895470bb180a06)), closes [#I44WH1](https://gitee.com/openharmony/kernel_liteos_a/issues/I44WH1)
|
||||
* **vfs:** vfs支持FD_CLOEXEC标记 ([27dca4d](https://gitee.com/openharmony/kernel_liteos_a/commits/27dca4d857ef8de6b4bb9302e0dd435be7e3284f)), closes [#I3U81](https://gitee.com/openharmony/kernel_liteos_a/issues/I3U81)
|
||||
* 删除zpfs冗余代码 ([3393479](https://gitee.com/openharmony/kernel_liteos_a/commits/3393479c52f4a9dfe2394bb32beb4b98fca8e171))
|
||||
* 基于汇编实现内核对用户态内存清零的功能 ([9db3407](https://gitee.com/openharmony/kernel_liteos_a/commits/9db3407589bb0b2d4a5772faac3130032bc0b8a9)), closes [#I3XXT0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XXT0)
|
||||
* 增加mount的MS_RDONLY标志的支持 ([8729f6e](https://gitee.com/openharmony/kernel_liteos_a/commits/8729f6ee57ea57bc664d076ff112c8726fedded9)), closes [#I3Z1W6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z1W6)
|
||||
* 支持killpg和waitid ([dc3cc09](https://gitee.com/openharmony/kernel_liteos_a/commits/dc3cc094a75c6da65d87522930afea06106d3933))
|
||||
* 新增toybox reboot命令 ([e567a10](https://gitee.com/openharmony/kernel_liteos_a/commits/e567a10d021c3e0fe02d6911dbe8687255c67ffa)), closes [#I3YQ7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3YQ7)
|
||||
* 给开发者提供系统信息导出Hidumper工具。 ([cb17fa5](https://gitee.com/openharmony/kernel_liteos_a/commits/cb17fa50ed28e6e8f59b7d68ede13c759b983311)), closes [#I3NN7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NN7)
|
||||
* 自研shell命令回补 ([7bc68f4](https://gitee.com/openharmony/kernel_liteos_a/commits/7bc68f454ff5fbf415712c9b8479b8c832f68417)), closes [#I44U0](https://gitee.com/openharmony/kernel_liteos_a/issues/I44U0)
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* assign '-1' to uninitialized variable: ret ([e0a27ba](https://gitee.com/openharmony/kernel_liteos_a/commits/e0a27badde20868cf3a5b4a44305b90af00e4f3f))
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* Revert "fix: 修改默认窗口宽度到400" ([1878849](https://gitee.com/openharmony/kernel_liteos_a/commits/187884937cd087e39a28c033c41033163d6b4766)), closes [#I42X9](https://gitee.com/openharmony/kernel_liteos_a/issues/I42X9)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* 1.新增一系列trace的对外API,位于los_trace.h中.
|
||||
LOS_TRACE_EASY简易插桩
|
||||
LOS_TRACE标准插桩
|
||||
LOS_TraceInit配置Trace缓冲区的地址和大小
|
||||
LOS_TraceStart开启事件记录
|
||||
LOS_TraceStop停止事件记录
|
||||
LOS_TraceRecordDump输出Trace缓冲区数据
|
||||
LOS_TraceRecordGet获取Trace缓冲区的首地址
|
||||
LOS_TraceReset清除Trace缓冲区中的事件
|
||||
LOS_TraceEventMaskSet设置事件掩码,仅记录某些模块的事件
|
||||
LOS_TraceHwiFilterHookReg注册过滤特定中断号事件的钩子函数
|
||||
* **vfs:** 执行exec类函数后,进程拥有的文件描述符情况发生变化:修改前,默认关闭所有的进程文件描述符,0,1,2重新打开;修改后,除非文件描述符拥有FD_CLOEXEC标记,否则该描述符不会被关闭。
|
||||
|
||||
|
||||
|
||||
241
Kconfig
Executable file → Normal file
241
Kconfig
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
# 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:
|
||||
@@ -26,76 +26,107 @@
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see extra/config/Kconfig-language.txt
|
||||
#
|
||||
|
||||
mainmenu "Huawei LiteOS Configuration"
|
||||
|
||||
menu "Compiler"
|
||||
choice
|
||||
prompt "LiteOS_Compiler_Type"
|
||||
prompt "Compiler type"
|
||||
default COMPILER_CLANG_LLVM
|
||||
help
|
||||
Enable arm-himix100 or aarch64-himix100 or compiler.
|
||||
Choose compiler type.
|
||||
|
||||
config COMPILER_HIMIX_32
|
||||
bool "arm-linux-ohoseabi"
|
||||
depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300
|
||||
config COMPILER_GCC
|
||||
bool "GCC"
|
||||
|
||||
config CROSS_COMPILE
|
||||
string "GCC cross-compile toolchain prefix"
|
||||
depends on COMPILER_GCC
|
||||
default "arm-linux-ohoseabi-" if ARCH_ARM_AARCH32
|
||||
|
||||
config COMPILER_CLANG_LLVM
|
||||
bool "clang-llvm"
|
||||
depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300
|
||||
bool "Clang"
|
||||
|
||||
config LLVM_TARGET
|
||||
string "Clang LLVM target"
|
||||
depends on COMPILER_CLANG_LLVM
|
||||
default "arm-liteos-ohos" if ARCH_ARM_AARCH32
|
||||
|
||||
endchoice
|
||||
|
||||
config COMPILE_DEBUG
|
||||
bool "Enable debug options"
|
||||
default n
|
||||
help
|
||||
Answer Y to add -g option in compile command.
|
||||
|
||||
config COMPILE_OPTIMIZE
|
||||
bool "Enable code optimization options"
|
||||
default y
|
||||
help
|
||||
Answer Y to add optimization options for efficient code.
|
||||
The final binary size will be smaller and execute faster.
|
||||
But the debugging experience may be worst somehow.
|
||||
|
||||
config COMPILE_OPTIMIZE_SIZE
|
||||
bool "Enable code size optimization options" if COMPILE_OPTIMIZE
|
||||
default y
|
||||
help
|
||||
Answer Y to add optimization options for small code size.
|
||||
The final binary size will be smaller.
|
||||
But the compile time may be a bit longer.
|
||||
|
||||
config COMPILE_LTO
|
||||
bool "Enable link time optimization (LTO)" if COMPILE_OPTIMIZE_SIZE
|
||||
default y
|
||||
help
|
||||
Answer Y to add lto options for more smaller code size.
|
||||
The final binary size will be smaller.
|
||||
But the compile time may be much longer.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Platform"
|
||||
|
||||
######################### config options of bsp #####################
|
||||
source "../../kernel/liteos_a/platform/Kconfig"
|
||||
source "platform/Kconfig"
|
||||
|
||||
######################### config options of cpu arch ################
|
||||
source "../../kernel/liteos_a/arch/Kconfig"
|
||||
source "arch/Kconfig"
|
||||
|
||||
######################### config options of rootfs #####################
|
||||
source "../../kernel/liteos_a/kernel/common/Kconfig"
|
||||
config QUICK_START
|
||||
bool "Enable QUICK_START"
|
||||
default n
|
||||
depends on DRIVERS && FS_VFS
|
||||
help
|
||||
Answer Y to enable LiteOS support 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 "fs/Kconfig"
|
||||
endmenu
|
||||
|
||||
######################## config options of net ############################
|
||||
source "../../kernel/liteos_a/net/Kconfig"
|
||||
source "net/Kconfig"
|
||||
|
||||
######################## config options of debug ########################
|
||||
menu "Debug"
|
||||
config COMPILE_DEBUG
|
||||
bool "Enable GCC -g Option"
|
||||
config GDB
|
||||
bool "Enable gdb functions"
|
||||
default n
|
||||
help
|
||||
Answer Y to add -g option in gcc command. But the LiteOS size will be much larger.
|
||||
Answer Y to enable gdb functions.
|
||||
|
||||
config PLATFORM_ADAPT
|
||||
bool "Enable Os_adapt"
|
||||
@@ -106,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.
|
||||
|
||||
@@ -131,8 +163,10 @@ config ENABLE_MAGICKEY
|
||||
config THUMB
|
||||
bool "Enable Thumb"
|
||||
default n
|
||||
depends on ARCH_ARM
|
||||
help
|
||||
Answer Y to build thumb version. This will make LiteOS smaller.
|
||||
|
||||
config PLATFORM_DVFS
|
||||
bool "Enable Dvfs"
|
||||
default n
|
||||
@@ -141,15 +175,21 @@ config PLATFORM_DVFS
|
||||
Answer Y to enable LiteOS support dynamic voltage and frequency scaling feature for
|
||||
low power consumption.
|
||||
|
||||
config SAVE_EXCINFO
|
||||
bool "Enable Saving Exception Information"
|
||||
default n
|
||||
help
|
||||
Answer Y to enable LiteOS support saving exception information to storage medium.
|
||||
|
||||
config DEBUG_VERSION
|
||||
bool "Enable a Debug Version"
|
||||
default n
|
||||
help
|
||||
If you do not select this option that means you enable a release version for LiteOS.
|
||||
It also means you do not want to use debug modules, like shell,telnet,tftp,
|
||||
,nfs,ramfs proc and memory check.
|
||||
It also means you do not want to use debug modules, like shell,telnet,tftp,nfs and
|
||||
memory check, etc.
|
||||
If you select this option that means you enable a debug version for LiteOS.
|
||||
That means you want a opposite behaviour compared to release version.
|
||||
That means you want an opposite behaviour compared to release version.
|
||||
|
||||
config DEBUG_KERNEL
|
||||
bool "Enable Debug LiteOS Kernel Resource"
|
||||
@@ -158,7 +198,7 @@ config DEBUG_KERNEL
|
||||
help
|
||||
If you select this option that means you enable debugging kernel resource.
|
||||
It also means you want to get queue, mutex, semaphore, memory debug information.
|
||||
That means you want a opposite behaviour compared to release version.
|
||||
That means you want an opposite behaviour compared to release version.
|
||||
|
||||
config DEBUG_QUEUE
|
||||
bool "Enable Queue Debugging"
|
||||
@@ -181,21 +221,20 @@ 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"
|
||||
source "net/telnet/Kconfig"
|
||||
config SCHED_DEBUG
|
||||
bool "Enable sched debug Feature"
|
||||
default n
|
||||
depends on SHELL
|
||||
depends on DEBUG_VERSION
|
||||
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.
|
||||
If you wish to build LiteOS with support for sched debug.
|
||||
|
||||
config USER_INIT_DEBUG
|
||||
bool "Enable user init Debug"
|
||||
@@ -221,48 +260,20 @@ config MEM_DEBUG
|
||||
help
|
||||
Answer Y to enable LiteOS support mem debug.
|
||||
|
||||
config MEM_MUL_MODULE
|
||||
bool "Enable Memory module statistics"
|
||||
default n
|
||||
depends on MEM_DEBUG
|
||||
help
|
||||
Answer Y to enable LiteOS support memory statistics depend on different module
|
||||
config MEM_MUL_POOL
|
||||
bool "Enable Memory multi-pool control"
|
||||
default y
|
||||
depends on DEBUG_VERSION && MEM_DEBUG
|
||||
help
|
||||
Answer Y to enable LiteOS support memory multi-pool control
|
||||
config MEM_HEAD_BACKUP
|
||||
bool "Enable Node Head Backup"
|
||||
default 0
|
||||
depends on DEBUG_VERSION && MEM_DEBUG
|
||||
help
|
||||
Answer Y to enable node head backup
|
||||
config MEM_RECORDINFO
|
||||
bool "Enable Mem Record"
|
||||
default n
|
||||
depends on DEBUG_VERSION && MEM_DEBUG
|
||||
help
|
||||
Answer Y to enable mem record
|
||||
config MEM_LEAKCHECK
|
||||
bool "Enable Function call stack of Mem operation recorded"
|
||||
default n
|
||||
depends on DEBUG_VERSION && MEM_DEBUG
|
||||
help
|
||||
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the infomations of mem node.
|
||||
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the information of mem node.
|
||||
config BASE_MEM_NODE_INTEGRITY_CHECK
|
||||
bool "Enable integrity check or not "
|
||||
bool "Enable integrity check or not"
|
||||
default n
|
||||
depends on DEBUG_VERSION && MEM_DEBUG
|
||||
config BASE_MEM_NODE_SIZE_CHECK
|
||||
bool "Enable size check or not"
|
||||
config MEM_WATERLINE
|
||||
bool "Enable memory pool waterline or not"
|
||||
default n
|
||||
depends on DEBUG_VERSION && MEM_DEBUG
|
||||
config SLAB_INFO_STATISTIC
|
||||
bool "Enable SLAB Statistic"
|
||||
default n
|
||||
depends on DEBUG_VERSION && KERNEL_MEM_SLAB && MEM_DEBUG
|
||||
|
||||
config VM_OVERLAP_CHECK
|
||||
bool "Enable VM overlap check or not"
|
||||
@@ -271,78 +282,22 @@ config VM_OVERLAP_CHECK
|
||||
help
|
||||
Answer Y to enable vm overlap check.
|
||||
|
||||
config NULL_ADDRESS_PROTECT
|
||||
bool "Enable NULL Address protect"
|
||||
default n
|
||||
depends on (PLATFORM_HI3518EV200 || PLATFORM_HI3516CV300 || PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300) && DEBUG_VERSION
|
||||
help
|
||||
Answer Y to set mem address 0~1M prohibit to access, read or write will trigger exception.
|
||||
|
||||
choice
|
||||
prompt "Enable Uart"
|
||||
default DRIVERS_HDF_PLATFORM_UART
|
||||
help
|
||||
Enable simple uart (without vfs) only for litekernel.
|
||||
Enable general uart (with vfs) for full code.
|
||||
source "../../vendor/hisi/hi35xx/platform/uart/Kconfig"
|
||||
config PLATFORM_UART_WITHOUT_VFS
|
||||
bool "Simple Uart"
|
||||
config PLATFORM_NO_UART
|
||||
bool "NO Uart"
|
||||
|
||||
endchoice
|
||||
endmenu
|
||||
|
||||
######################## config options os drivers ########################
|
||||
menu "Driver"
|
||||
config DRIVERS
|
||||
bool "Enable Driver"
|
||||
default y
|
||||
help
|
||||
Answer Y to enable LiteOS support driver.
|
||||
|
||||
source "../../vendor/hisi/hi35xx/platform/hiedmac/Kconfig"
|
||||
source "../../kernel/liteos_a/bsd/dev/usb/Kconfig"
|
||||
source "../../drivers/hdf/lite/Kconfig"
|
||||
|
||||
config DRIVERS_NETDEV
|
||||
bool "Enable Net Device"
|
||||
default y
|
||||
depends on DRIVERS && NET_LWIP_SACK
|
||||
help
|
||||
Answer Y to enable LiteOS support net device.
|
||||
|
||||
choice
|
||||
depends on DRIVERS_NETDEV
|
||||
prompt "MAC"
|
||||
default n
|
||||
help
|
||||
Enable higmac for hi3516a hi3519 hi3559a_cortex-a53_aarch64.
|
||||
Enable hieth-sf for hi3516cv300 hi3516ev200 and hi3518ev200.
|
||||
source "../../vendor/hisi/hi35xx/platform/hieth-sf/Kconfig"
|
||||
endchoice
|
||||
|
||||
source "../../drivers/liteos/mem/Kconfig"
|
||||
source "../../vendor/hisi/hi35xx/platform/mmc/Kconfig"
|
||||
|
||||
|
||||
config DRIVERS_MTD
|
||||
bool "Enable MTD"
|
||||
default y
|
||||
depends on DRIVERS && FS_VFS
|
||||
help
|
||||
Answer Y to enable LiteOS support jffs2 multipartion.
|
||||
|
||||
source "../../vendor/hisi/hi35xx/platform/mtd/spi_nor/Kconfig"
|
||||
source "../../drivers/liteos/random/Kconfig"
|
||||
source "../../drivers/liteos/tzdriver/Kconfig"
|
||||
source "../../drivers/liteos/video/Kconfig"
|
||||
source "../../drivers/liteos/hievent/Kconfig"
|
||||
|
||||
source "drivers/Kconfig"
|
||||
endmenu
|
||||
|
||||
######################## config options os security #######################
|
||||
menu "Security"
|
||||
source "../../kernel/liteos_a/security/Kconfig"
|
||||
source "security/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Test"
|
||||
config ENABLE_KERNEL_TEST
|
||||
bool "Enable Kernel Test"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "Stack Smashing Protector (SSP) Compiler Feature"
|
||||
|
||||
28
LICENSE
Normal file
28
LICENSE
Normal file
@@ -0,0 +1,28 @@
|
||||
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.
|
||||
270
Makefile
Executable file → Normal file
270
Makefile
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
# 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:
|
||||
@@ -27,176 +27,172 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
LITEOSTOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
|
||||
export OS=$(shell uname -s)
|
||||
ifneq ($(OS), Linux)
|
||||
LITEOSTOPDIR := $(shell dirname $(subst \,/,$(LITEOSTOPDIR))/./)
|
||||
LITEOSTOPDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||
export LITEOSTOPDIR
|
||||
|
||||
APPS = apps
|
||||
ROOTFS = rootfs
|
||||
LITEOS_TARGET = liteos
|
||||
LITEOS_LIBS_TARGET = libs
|
||||
KCONFIG_CMDS := $(notdir $(wildcard $(dir $(shell which menuconfig))*config))
|
||||
|
||||
ohos_kernel ?= liteos_a
|
||||
$(foreach line,$(shell hb env | sed 's/\[OHOS INFO\]/ohos/g;s/ /_/g;s/:_/=/g' || true),$(eval $(line)))
|
||||
ifneq ($(ohos_kernel),liteos_a)
|
||||
$(error The selected product ($(ohos_product)) is not a liteos_a kernel type product)
|
||||
endif
|
||||
|
||||
LITEOSTHIRDPARTY := $(LITEOSTOPDIR)/../../third_party
|
||||
ifeq ($(PRODUCT_PATH),)
|
||||
PRODUCT_PATH:=$(ohos_product_path)
|
||||
endif
|
||||
|
||||
export LITEOSTOPDIR
|
||||
export LITEOSTHIRDPARTY
|
||||
ifeq ($(DEVICE_PATH),)
|
||||
DEVICE_PATH:=$(ohos_device_path)
|
||||
endif
|
||||
|
||||
-include $(LITEOSTOPDIR)/tools/build/config.mk
|
||||
ifeq ($(TEE:1=y),y)
|
||||
tee = _tee
|
||||
endif
|
||||
ifeq ($(RELEASE:1=y),y)
|
||||
CONFIG ?= $(PRODUCT_PATH)/kernel_configs/release$(tee).config
|
||||
else
|
||||
CONFIG ?= $(PRODUCT_PATH)/kernel_configs/debug$(tee).config
|
||||
endif
|
||||
|
||||
RM = -rm -rf
|
||||
MAKE = make
|
||||
__LIBS = libs
|
||||
APPS = apps
|
||||
ROOTFSDIR = rootfsdir
|
||||
ROOTFS = rootfs
|
||||
KCONFIG_CONFIG ?= $(CONFIG)
|
||||
SYSROOT_PATH ?= $(OUT)/sysroot
|
||||
|
||||
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 subdir Makefile related environment variables
|
||||
export SYSROOT_PATH
|
||||
export PRODUCT_PATH
|
||||
export DEVICE_PATH
|
||||
|
||||
ifeq ($(LOSCFG_PLATFORM_HI3518EV300), y)
|
||||
# export kconfig related environment variables
|
||||
export CONFIG_=LOSCFG_
|
||||
export srctree=$(LITEOSTOPDIR)
|
||||
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
ifeq ($(LOSCFG_STORAGE_SPINOR), y)
|
||||
FSTYPE = jffs2
|
||||
endif
|
||||
ifeq ($(LOSCFG_PLATFORM_HI3516DV300), y)
|
||||
ifeq ($(LOSCFG_STORAGE_EMMC), y)
|
||||
FSTYPE = vfat
|
||||
endif
|
||||
ifeq ($(LOSCFG_STORAGE_SPINAND), y)
|
||||
FSTYPE = yaffs2
|
||||
endif
|
||||
ROOTFS_DIR = $(OUT)/rootfs
|
||||
ROOTFS_ZIP = $(OUT)/rootfs.zip
|
||||
VERSION =
|
||||
|
||||
all: $(OUT) $(BUILD) $(LITEOS_TARGET) $(APPS)
|
||||
lib: $(OUT) $(BUILD) $(LITEOS_LIBS_TARGET)
|
||||
define HELP =
|
||||
Usage: make [TARGET]... [PARAMETER=VALUE]...
|
||||
|
||||
Targets:
|
||||
help: display this help and exit
|
||||
clean: clean compiled objects
|
||||
cleanall: clean all build outputs
|
||||
all: make liteos kernel image and rootfs image (Default target)
|
||||
$(APPS): build all apps
|
||||
$(ROOTFS): make an original rootfs image
|
||||
$(LITEOS_LIBS_TARGET): compile all kernel modules (libraries)
|
||||
$(LITEOS_TARGET): make liteos kernel image
|
||||
update_config: update product kernel config (use menuconfig)
|
||||
xxconfig: invoke xxconfig command of kconfiglib (xxconfig is one of $(KCONFIG_CMDS))
|
||||
|
||||
Parameters:
|
||||
FSTYPE: value should be one of (jffs2 vfat yaffs2)
|
||||
TEE: boolean value(1 or y for true), enable tee
|
||||
RELEASE: boolean value(1 or y for true), build release version
|
||||
CONFIG: kernel config file to be use
|
||||
args: arguments for xxconfig command
|
||||
endef
|
||||
export HELP
|
||||
|
||||
all: $(LITEOS_TARGET) $(ROOTFS)
|
||||
|
||||
help:
|
||||
$(HIDE)echo "-------------------------------------------------------"
|
||||
$(HIDE)echo "1.====make help: get help infomation of make"
|
||||
$(HIDE)echo "2.====make: make a debug version based the .config"
|
||||
$(HIDE)echo "3.====make debug: make a debug version based the .config"
|
||||
$(HIDE)echo "4.====make release: make a release version for all platform"
|
||||
$(HIDE)echo "5.====make release PLATFORM=xxx: make a release version only for platform xxx"
|
||||
$(HIDE)echo "6.====make rootfsdir: make a original rootfs dir"
|
||||
$(HIDE)echo "7.====make rootfs FSTYPE=***: make a original rootfs img"
|
||||
$(HIDE)echo "8.====make test: make the testsuits_app and put it into the rootfs dir"
|
||||
$(HIDE)echo "9.====make test_apps FSTYPE=***: make a rootfs img with the testsuits_app in it"
|
||||
$(HIDE)echo "xxx should be one of (hi3516cv300 hi3516ev200 hi3556av100/cortex-a53_aarch32 hi3559av100/cortex-a53_aarch64)"
|
||||
$(HIDE)echo "*** should be one of (jffs2)"
|
||||
$(HIDE)echo "-------------------------------------------------------"
|
||||
$(HIDE)echo "$$HELP"
|
||||
|
||||
debug:
|
||||
$(HIDE)echo "=============== make a debug version ==============="
|
||||
$(HIDE) $(MAKE) all
|
||||
|
||||
release:
|
||||
ifneq ($(PLATFORM),)
|
||||
$(HIDE)echo "=============== make a release version for platform $(PLATFORM) ==============="
|
||||
$(HIDE)$(SCRIPTS_PATH)/mklibversion.sh $(PLATFORM)
|
||||
else
|
||||
$(HIDE)echo "================make a release version for all platform ==============="
|
||||
$(HIDE)$(SCRIPTS_PATH)/mklibversion.sh
|
||||
sysroot:
|
||||
$(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH))
|
||||
ifeq ($(origin SYSROOT_PATH),file)
|
||||
$(HIDE)mkdir -p $(SYSROOT_PATH)/build && cd $(SYSROOT_PATH)/build && \
|
||||
ln -snf $(LITEOSTOPDIR)/../../third_party/musl/scripts/build_lite/Makefile && \
|
||||
$(MAKE) TARGETS=liteos_a_user \
|
||||
ARCH=$(ARCH) \
|
||||
TARGET=$(LOSCFG_LLVM_TARGET) \
|
||||
ARCH_CFLAGS="$(LITEOS_CORE_COPTS) -w" \
|
||||
TOPDIR="$(LITEOSTOPDIR)/../.." \
|
||||
SYSROOTDIR="$(SYSROOT_PATH)" \
|
||||
$(if $(LOSCFG_COMPILER_CLANG_LLVM),CLANG="$(LITEOS_COMPILER_PATH)clang",GCC="$(CC)") \
|
||||
BUILD_DEBUG=$(if $(patsubst y,,$(or $(RELEASE:1=y),n)),true,false)
|
||||
endif
|
||||
|
||||
##### make dynload #####
|
||||
-include $(LITEOS_MK_PATH)/dynload.mk
|
||||
$(filter-out menuconfig,$(KCONFIG_CMDS)):
|
||||
$(HIDE)$@ $(args)
|
||||
|
||||
#-----need move when make version-----#
|
||||
##### make lib #####
|
||||
$(__LIBS): $(OUT) $(CXX_INCLUDE)
|
||||
$(LITEOS_CONFIG_FILE): $(KCONFIG_CONFIG)
|
||||
$(HIDE)env KCONFIG_CONFIG=$< genconfig --config-out $@ --header-path $(LITEOS_MENUCONFIG_H)
|
||||
|
||||
$(OUT): $(LITEOS_MENUCONFIG_H)
|
||||
$(HIDE)mkdir -p $(OUT)/lib
|
||||
$(HIDE)$(CC) -I$(LITEOS_PLATFORM_BASE)/include -I$(LITEOSTOPDIR)/../../vendor/hisi/hi35xx/$(LITEOS_PLATFORM)/config/board \
|
||||
-E $(LITEOS_PLATFORM_BASE)/board.ld.S \
|
||||
-o $(LITEOS_PLATFORM_BASE)/board.ld -P
|
||||
update_config menuconfig:
|
||||
$(HIDE)test -f "$(CONFIG)" && cp -v "$(CONFIG)" .config && menuconfig $(args) && savedefconfig --out "$(CONFIG)"
|
||||
|
||||
$(BUILD):
|
||||
$(HIDE)mkdir -p $(BUILD)
|
||||
$(LITEOS_LIBS_TARGET): sysroot
|
||||
$(HIDE)for dir in $(LIB_SUBDIRS); do $(MAKE) -C $$dir all || exit 1; done
|
||||
|
||||
$(LITEOS_LIBS_TARGET): $(__LIBS)
|
||||
$(HIDE)for dir in $(LIB_SUBDIRS); \
|
||||
do $(MAKE) -C $$dir all || exit 1; \
|
||||
done
|
||||
$(HIDE)echo "=============== make lib done ==============="
|
||||
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET)
|
||||
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).map
|
||||
#$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).objsize
|
||||
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).bin
|
||||
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).sym.sorted
|
||||
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).asm
|
||||
#$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).size
|
||||
|
||||
##### make menuconfig #####
|
||||
export CONFIG_=LOSCFG_
|
||||
MENUCONFIG_PATH = $(LITEOSTOPDIR)/tools/menuconfig
|
||||
KCONFIG_FILE_PATH = $(LITEOSTOPDIR)/Kconfig
|
||||
$(OUT)/$(LITEOS_TARGET): $(LITEOS_LIBS_TARGET)
|
||||
$(LD) $(LITEOS_LDFLAGS) $(LITEOS_TABLES_LDFLAGS) -Map=$@.map -o $@ --start-group $(LITEOS_LIBDEP) --end-group
|
||||
$(OUT)/$(LITEOS_TARGET).map: $(OUT)/$(LITEOS_TARGET)
|
||||
$(OUT)/$(LITEOS_TARGET).objsize: $(LITEOS_LIBS_TARGET)
|
||||
$(SIZE) -t --common $(OUT)/lib/*.a >$@
|
||||
$(OUT)/$(LITEOS_TARGET).bin: $(OUT)/$(LITEOS_TARGET)
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
$(OUT)/$(LITEOS_TARGET).sym.sorted: $(OUT)/$(LITEOS_TARGET)
|
||||
$(OBJDUMP) -t $< |sort >$@
|
||||
$(OUT)/$(LITEOS_TARGET).asm: $(OUT)/$(LITEOS_TARGET)
|
||||
$(OBJDUMP) -d $< >$@
|
||||
$(OUT)/$(LITEOS_TARGET).size: $(OUT)/$(LITEOS_TARGET)
|
||||
$(NM) -S --size-sort $< >$@
|
||||
|
||||
menuconfig:$(MENUCONFIG_PATH)/mconf
|
||||
$< $(KCONFIG_FILE_PATH)
|
||||
|
||||
genconfig:$(MENUCONFIG_PATH)/conf
|
||||
$(HIDE)mkdir -p include/config include/generated
|
||||
$< --silentoldconfig $(KCONFIG_FILE_PATH)
|
||||
-mv -f $(LITEOS_MENUCONFIG_H) $(LITEOS_PLATFORM_MENUCONFIG_H)
|
||||
##### menuconfig end #######
|
||||
|
||||
$(LITEOS_MENUCONFIG_H):
|
||||
ifneq ($(LITEOS_PLATFORM_MENUCONFIG_H), $(wildcard $(LITEOS_PLATFORM_MENUCONFIG_H)))
|
||||
$(HIDE)$(MAKE) genconfig
|
||||
endif
|
||||
$(LITEOS_TARGET): $(__LIBS)
|
||||
$(HIDE)touch $(LOSCFG_ENTRY_SRC)
|
||||
|
||||
$(HIDE)for dir in $(LITEOS_SUBDIRS); \
|
||||
do $(MAKE) -C $$dir all || exit 1; \
|
||||
done
|
||||
|
||||
$(LD) $(LITEOS_LDFLAGS) $(LITEOS_TABLES_LDFLAGS) $(LITEOS_DYNLDFLAGS) -Map=$(OUT)/$@.map -o $(OUT)/$@ --start-group $(LITEOS_LIBDEP) --end-group
|
||||
# $(SIZE) -t --common $(OUT)/lib/*.a >$(OUT)/$@.objsize
|
||||
$(OBJCOPY) -O binary $(OUT)/$@ $(LITEOS_TARGET_DIR)/$@.bin
|
||||
$(OBJDUMP) -t $(OUT)/$@ |sort >$(OUT)/$@.sym.sorted
|
||||
$(OBJDUMP) -d $(OUT)/$@ >$(OUT)/$@.asm
|
||||
# $(NM) -S --size-sort $(OUT)/$@ >$(OUT)/$@.size
|
||||
|
||||
$(APPS): $(LITEOS_TARGET)
|
||||
$(APPS): sysroot
|
||||
$(HIDE)$(MAKE) -C apps all
|
||||
|
||||
prepare:
|
||||
$(ROOTFS): $(APPS)
|
||||
$(HIDE)mkdir -p $(OUT)/musl
|
||||
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
|
||||
$(HIDE)cp -f $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/usr/lib/$(LLVM_TARGET)/a7_softfp_neon-vfpv4/libc.so $(OUT)/musl
|
||||
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/lib/$(LLVM_TARGET)/c++/a7_softfp_neon-vfpv4/libc++.so $(OUT)/musl
|
||||
$(HIDE)cp -fp $$($(CC) $(LITEOS_CFLAGS) -print-file-name=libc.so) $(OUT)/musl
|
||||
$(HIDE)cp -fp $$($(GPP) $(LITEOS_CXXFLAGS) -print-file-name=libc++.so) $(OUT)/musl
|
||||
else
|
||||
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/target/usr/lib/libc.so $(OUT)/musl
|
||||
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/arm-linux-musleabi/lib/libstdc++.so.6 $(OUT)/musl
|
||||
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/arm-linux-musleabi/lib/libgcc_s.so.1 $(OUT)/musl
|
||||
$(STRIP) $(OUT)/musl/*
|
||||
$(HIDE)cp -fp $$($(CC) $(LITEOS_CFLAGS) -print-file-name=libc.so) $(OUT)/musl
|
||||
$(HIDE)cp -fp $$($(CC) $(LITEOS_CFLAGS) -print-file-name=libgcc_s.so.1) $(OUT)/musl
|
||||
$(HIDE)cp -fp $$($(GPP) $(LITEOS_CXXFLAGS) -print-file-name=libstdc++.so.6) $(OUT)/musl
|
||||
endif
|
||||
|
||||
$(ROOTFSDIR): prepare $(APPS)
|
||||
$(HIDE)$(MAKE) clean -C apps
|
||||
$(HIDE)$(shell $(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsdir.sh $(OUT)/bin $(OUT)/musl $(ROOTFS_DIR))
|
||||
$(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/rootfsdir.sh $(OUT) $(ROOTFS_DIR)
|
||||
$(HIDE)shopt -s nullglob && $(STRIP) $(ROOTFS_DIR)/bin/* $(ROOTFS_DIR)/lib/*
|
||||
ifneq ($(VERSION),)
|
||||
$(HIDE)$(shell $(LITEOSTOPDIR)/tools/scripts/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR))
|
||||
$(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR)
|
||||
endif
|
||||
|
||||
$(ROOTFS): $(ROOTFSDIR)
|
||||
$(HIDE)$(shell $(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsimg.sh $(ROOTFS_DIR) $(FSTYPE))
|
||||
$(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/rootfsimg.sh $(ROOTFS_DIR) $(FSTYPE)
|
||||
$(HIDE)cd $(ROOTFS_DIR)/.. && zip -r $(ROOTFS_ZIP) $(ROOTFS)
|
||||
ifneq ($(OUT), $(LITEOS_TARGET_DIR))
|
||||
$(HIDE)mv $(ROOTFS_DIR) $(LITEOS_TARGET_DIR)rootfs
|
||||
endif
|
||||
|
||||
clean:
|
||||
$(HIDE)for dir in $(LITEOS_SUBDIRS); \
|
||||
do $(MAKE) -C $$dir clean|| exit 1; \
|
||||
done
|
||||
$(HIDE)$(MAKE) -C apps clean
|
||||
$(HIDE)$(RM) $(__OBJS) $(LITEOS_TARGET) $(OUT) $(BUILD) $(LITEOS_MENUCONFIG_H) *.bak *~
|
||||
$(HIDE)$(RM) $(LITEOS_PLATFORM_MENUCONFIG_H)
|
||||
$(HIDE)$(RM) include
|
||||
$(HIDE)$(MAKE) cleanrootfs
|
||||
$(HIDE)echo "clean $(LITEOS_PLATFORM) finish"
|
||||
$(HIDE)if [ -d $(SYSROOT_PATH)/build ]; then $(MAKE) -C $(SYSROOT_PATH)/build clean; fi
|
||||
$(HIDE)for dir in $(LIB_SUBDIRS) apps; do $(MAKE) -C $$dir clean || exit 1; done
|
||||
$(HIDE)$(RM) $(LITEOS_MENUCONFIG_H)
|
||||
$(HIDE)echo "clean $(LOSCFG_PLATFORM) finish"
|
||||
|
||||
cleanall:
|
||||
$(HIDE)$(RM) $(LITEOSTOPDIR)/out
|
||||
$(HIDE)find $(LITEOS_PLATFORM_BASE)/ -name board.ld -exec rm -rf {} \;
|
||||
$(HIDE)cd sample/sample_osdrv;make clean;cd ../..;
|
||||
$(HIDE)echo "clean all"
|
||||
cleanall: clean
|
||||
$(HIDE)$(RM) $(LITEOSTOPDIR)/out $(LITEOS_CONFIG_FILE)
|
||||
$(HIDE)echo "clean all done"
|
||||
|
||||
cleanrootfs:
|
||||
$(HIDE)$(RM) $(OUT)/rootfs
|
||||
$(HIDE)$(RM) $(OUT)/rootfs.zip
|
||||
$(HIDE)$(RM) $(OUT)/rootfs.img
|
||||
|
||||
.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help
|
||||
.PHONY: all clean cleanall sysroot help update_config
|
||||
.PHONY: $(LITEOS_TARGET) $(ROOTFS) $(APPS) $(KCONFIG_CMDS) $(LITEOS_LIBS_TARGET) $(KCONFIG_CONFIG)
|
||||
|
||||
85
OAT.xml
Normal file
85
OAT.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!--
|
||||
This is the configuration file template for OpenHarmony OSS Audit Tool. Please copy it to your project root dir and modify it by referring to OpenHarmony/tools_oat/README.
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<oatconfig>
|
||||
<licensefile></licensefile>
|
||||
<policylist>
|
||||
<policy name="projectPolicy" desc="">
|
||||
<policyitem type="copyright" name="Huawei Technologies Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
|
||||
<policyitem type="copyright" name="Huawei Device Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
|
||||
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
|
||||
</policy>
|
||||
</policylist>
|
||||
<filefilterlist>
|
||||
<filefilter name="defaultFilter" desc="文件属于FreeBSD仓库软连接,本仓库屏蔽告警,在FreeBSD仓库进行处理">
|
||||
<filteritem type="filepath" name="bsd/.*" desc="文件属于FreeBSD仓库软连接,本仓库屏蔽告警,在FreeBSD仓库进行处理"/>
|
||||
<filteritem type="filepath" name="kernel/extended" desc="文件属于Nuttx仓库软连接,本仓库屏蔽告警,在Nuttx仓库进行处理"/>
|
||||
<filteritem type="filepath" name="fs/include/fs" desc="文件属于Nuttx仓库软连接,本仓库屏蔽告警,在Nuttx仓库进行处理"/>
|
||||
</filefilter>
|
||||
<filefilter name="defaultFilter" desc="Files not to check">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="defaultPolicyFilter" desc="Filters for license header policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="licenseFileNamePolicyFilter" desc="Filters for LICENSE file policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="readmeFileNamePolicyFilter" desc="Filters for README file policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="readmeOpenSourcefileNamePolicyFilter" desc="Filters for README.OpenSource file policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
|
||||
</filefilterlist>
|
||||
<licensematcherlist>
|
||||
<!--licensematcher name="uvwxyz License" desc="If the scanning result is InvalidLicense, you can define matching rules here. Note that quotation marks must be escaped.">
|
||||
<licensetext name="
|
||||
uvwxyz license textA xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
" desc=""/>
|
||||
<licensetext name="
|
||||
uvwxyz license textB xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
" desc=""/>
|
||||
</licensematcher-->
|
||||
</licensematcherlist>
|
||||
</oatconfig>
|
||||
</configuration>
|
||||
105
README.md
Normal file
105
README.md
Normal file
@@ -0,0 +1,105 @@
|
||||
# LiteOS Cortex-A<a name="EN-US_TOPIC_0000001096612501"></a>
|
||||
|
||||
- [Introduction](#section11660541593)
|
||||
- [Directory Structure](#section161941989596)
|
||||
- [Constraints](#section119744591305)
|
||||
- [Usage](#section741617511812)
|
||||
- [Preparations](#section1579912573329)
|
||||
- [Source Code Acquisition](#section11443189655)
|
||||
- [Compilation and Building](#section2081013992812)
|
||||
- [Contribution](#section1371123476304)
|
||||
- [Repositories Involved](#section1371113476307)
|
||||
|
||||
## Introduction<a name="section11660541593"></a>
|
||||
|
||||
The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on the Huawei LiteOS kernel. Huawei LiteOS is a lightweight operating system \(OS\) built for the Internet of Things \(IoT\) field. With the rapid development of the IoT industry, OpenHarmony LiteOS Cortex-A brings small-sized, low-power, and high-performance experience and builds a unified and open ecosystem for developers. In addition, it provides rich kernel mechanisms, more comprehensive Portable Operating System Interface \(POSIX\), and a unified driver framework, Hardware Driver Foundation \(HDF\), which offers unified access for device developers and friendly development experience for application developers. [Figure 1](#fig27311582210) shows the architecture of the OpenHarmony LiteOS Cortex-A kernel.
|
||||
|
||||
**Figure 1** Architecture of the OpenHarmony LiteOS Cortex-A kernel<a name="fig27311582210"></a>
|
||||

|
||||
|
||||
## Directory Structure<a name="section161941989596"></a>
|
||||
|
||||
```
|
||||
/kernel/liteos_a
|
||||
├── apps # User-space init and shell application programs
|
||||
├── arch # System architecture, such as ARM
|
||||
│ └── arm # Code for ARM architecture
|
||||
├── bsd # Code of the driver and adaptation layer module related to the FreeBSD, such as the USB module
|
||||
├── compat # Kernel API compatibility
|
||||
│ └── posix # POSIX APIs
|
||||
├── drivers # Kernel drivers
|
||||
│ └── char # Character device
|
||||
│ ├── mem # Driver for accessing physical input/output (I/O) devices
|
||||
│ ├── quickstart # APIs for quick start of the system
|
||||
│ ├── random # Driver for random number generators
|
||||
│ └── video # Framework of the framebuffer driver
|
||||
├── fs # File system module, which mainly derives from the NuttX open-source project
|
||||
│ ├── fat # FAT file system
|
||||
│ ├── jffs2 # JFFS2 file system
|
||||
│ ├── include # Header files exposed externally
|
||||
│ ├── nfs # NFS file system
|
||||
│ ├── proc # proc file system
|
||||
│ ├── ramfs # RAMFS file system
|
||||
│ └── vfs # VFS layer
|
||||
├── kernel # Kernel modules including the process, memory, and IPC modules
|
||||
│ ├── base # Basic kernel modules including the scheduling and memory modules
|
||||
│ ├── common # Common components used by the kernel
|
||||
│ ├── extended # Extended kernel modules including the dynamic loading, vDSO, and LiteIPC modules
|
||||
│ ├── include # Header files exposed externally
|
||||
│ └── user # Init process loading
|
||||
├── lib # Kernel library
|
||||
├── net # Network module, which mainly derives from the lwIP open-source project
|
||||
├── platform # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300
|
||||
│ ├── hw # Logic code related to clocks and interrupts
|
||||
│ ├── include # Header files exposed externally
|
||||
│ └── uart # Logic code related to the serial port
|
||||
├── platform # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300
|
||||
├── security # Code related to security features, including process permission management and virtual ID mapping management
|
||||
├── syscall # System calling
|
||||
└── tools # Building tools as well as related configuration and code
|
||||
```
|
||||
|
||||
## Constraints<a name="section119744591305"></a>
|
||||
|
||||
- Programming languages: C and C++
|
||||
- Applicable development boards: Hi3516D V300
|
||||
- Hi3516D V300 uses the FAT file system by default.
|
||||
|
||||
## Usage<a name="section741617511812"></a>
|
||||
|
||||
OpenHarmony LiteOS Cortex-A supports the [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-appendix-hi3516.md). You can develop and run your applications based on this development board.
|
||||
|
||||
### Preparations<a name="section1579912573329"></a>
|
||||
|
||||
You need to set up the compilation environment on Ubuntu.
|
||||
|
||||
- [Setting Up Ubuntu Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/Readme-EN.md)
|
||||
|
||||
### Source Code Acquisition<a name="section11443189655"></a>
|
||||
|
||||
Download and decompress a set of source code on a Ubuntu server to acquire the [source code](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md).
|
||||
|
||||
### Compilation and Building<a name="section2081013992812"></a>
|
||||
|
||||
For details about how to develop the first application, see: [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-pkg-3516-helloworld.md)
|
||||
|
||||
For compilation, please refer to the [compilation instructions](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-pkg-3516-build.md).
|
||||
|
||||
## Contribution<a name="section1371123476304"></a>
|
||||
|
||||
[How to involve](https://gitee.com/openharmony/docs/blob/HEAD/en/contribute/contribution.md)
|
||||
|
||||
[Commit message spec](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)
|
||||
|
||||
[C&C++ Secure Coding Guide](https://gitee.com/openharmony/docs/blob/master/en/contribute/OpenHarmony-c-cpp-secure-coding-guide.md)
|
||||
|
||||
[LiteOS-A Kernel Coding Style Guide](https://gitee.com/openharmony/kernel_liteos_a/wikis/LiteOS-A%20%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83%E6%8C%87%E5%8D%97)
|
||||
|
||||
## Repositories Involved<a name="section1371113476307"></a>
|
||||
|
||||
[Kernel subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/kernel.md)
|
||||
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README.md)
|
||||
|
||||
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/master/README.md)
|
||||
|
||||
104
README_zh-HK.md
Normal file
104
README_zh-HK.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# LiteOS-A內核<a name="ZH-CN_TOPIC_0000001096612501"></a>
|
||||
|
||||
- [簡介](#section11660541593)
|
||||
- [目錄](#section161941989596)
|
||||
- [約束](#section119744591305)
|
||||
- [使用說明](#section741617511812)
|
||||
- [準備](#section1579912573329)
|
||||
- [獲取源碼](#section11443189655)
|
||||
- [編譯構建](#section2081013992812)
|
||||
- [貢獻](#section1371123476304)
|
||||
- [相關倉](#section1371113476307)
|
||||
|
||||
## 簡介<a name="section11660541593"></a>
|
||||
|
||||
OpenHarmony LiteOS-A內核是基於Huawei LiteOS內核演進發展的新一代內核,Huawei LiteOS是面向IoT領域構建的輕量級物聯網操作系統。在IoT產業高速發展的潮流中,OpenHarmony LiteOS-A內核能夠帶給用戶小體積、低功耗、高性能的體驗以及統一開放的生態系統能力,新增了豐富的內核機制、更加全面的POSIX標準接口以及統一驅動框架**HDF**(OpenHarmony Driver Foundation)等,為設備廠商提供了更統一的接入方式,為OpenHarmony的應用開發者提供了更友好的開發體驗。圖1為OpenHarmony LiteOS-A內核架構圖:
|
||||
|
||||
**圖 1** OpenHarmony LiteOS-A內核架構圖<a name="fig27311582210"></a>
|
||||
|
||||

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

|
||||
|
||||
## 目录<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驱动框架
|
||||
├── figures # 内核架构图
|
||||
├── fs # 文件系统模块,主要来源于NuttX开源项目
|
||||
│ ├── fat # fat文件系统
|
||||
│ ├── jffs2 # jffs2文件系统
|
||||
│ ├── include # 对外暴露头文件存放目录
|
||||
│ ├── nfs # nfs文件系统
|
||||
│ ├── proc # proc文件系统
|
||||
│ ├── ramfs # ramfs文件系统
|
||||
│ └── vfs # vfs层
|
||||
├── kernel # 进程、内存、IPC等模块
|
||||
│ ├── base # 基础内核,包括调度、内存等模块
|
||||
│ ├── common # 内核通用组件
|
||||
│ ├── extended # 扩展内核,包括动态加载、vdso、liteipc等模块
|
||||
│ ├── include # 对外暴露头文件存放目录
|
||||
│ └── user # 加载init进程
|
||||
├── lib # 内核的lib库
|
||||
├── net # 网络模块,主要来源于lwip开源项目
|
||||
├── platform # 支持不同的芯片平台代码,如Hi3516DV300等
|
||||
│ ├── hw # 时钟与中断相关逻辑代码
|
||||
│ ├── include # 对外暴露头文件存放目录
|
||||
│ └── uart # 串口相关逻辑代码
|
||||
├── security # 安全特性相关的代码,包括进程权限管理和虚拟id映射管理
|
||||
├── shell # 接收用户输入的命令,内核去执行
|
||||
├── syscall # 系统调用
|
||||
├── testsuilts # 测试套件
|
||||
└── tools # 构建工具及相关配置和代码
|
||||
```
|
||||
|
||||
## 约束<a name="section119744591305"></a>
|
||||
|
||||
- 开发语言:C/C++;
|
||||
- 适用于Hi3516DV300单板;
|
||||
- Hi3516DV300默认使用FAT文件系统。
|
||||
|
||||
## 使用说明<a name="section741617511812"></a>
|
||||
|
||||
OpenHarmony LiteOS-A内核支持[Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-appendix-hi3516.md)单板。开发者可基于此单板开发运行自己的应用程序。
|
||||
|
||||
### 准备<a name="section1579912573329"></a>
|
||||
|
||||
开发者需要在Ubuntu上搭建编译环境:
|
||||
|
||||
- [编译环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Readme-CN.md);
|
||||
|
||||
### 获取源码<a name="section11443189655"></a>
|
||||
|
||||
在Ubuntu服务器源码获取方式参考: [源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
|
||||
|
||||
### 编译构建<a name="section2081013992812"></a>
|
||||
|
||||
如果这是您的首次应用程序开发,可参考:[helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-helloworld.md)。
|
||||
|
||||
编译可以参考:[编译指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-build.md)
|
||||
|
||||
## 贡献<a name="section1371123476304"></a>
|
||||
|
||||
[如何贡献](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE.md)
|
||||
|
||||
[Commit message规范](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)
|
||||
|
||||
[OpenHarmony C&C++ 安全编程指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/OpenHarmony-c-cpp-secure-coding-guide.md)
|
||||
|
||||
[LiteOS-A 内核编码规范指南](https://gitee.com/openharmony/kernel_liteos_a/wikis/LiteOS-A%20%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83%E6%8C%87%E5%8D%97)
|
||||
|
||||
## 相关仓<a name="section1371113476307"></a>
|
||||
|
||||
[内核子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%86%85%E6%A0%B8%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
|
||||
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README_zh.md)
|
||||
|
||||
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/master/README_zh.md)
|
||||
|
||||
62
apps/BUILD.gn
Normal file
62
apps/BUILD.gn
Normal file
@@ -0,0 +1,62 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
group("apps") {
|
||||
deps = []
|
||||
|
||||
if (defined(LOSCFG_SHELL)) {
|
||||
deps += [
|
||||
"mksh",
|
||||
"shell",
|
||||
"toybox",
|
||||
]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_USER_INIT_DEBUG)) {
|
||||
deps += [ "init" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_NET_LWIP_SACK_TFTP)) {
|
||||
deps += [ "tftp" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_DRIVERS_TRACE)) {
|
||||
deps += [ "trace" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_DRIVERS_PERF)) {
|
||||
deps += [ "perf" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_KERNEL_LMS)) {
|
||||
deps += [ "lms:sample_usr_lms" ]
|
||||
}
|
||||
}
|
||||
29
apps/Makefile
Executable file → Normal file
29
apps/Makefile
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
# 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:
|
||||
@@ -27,23 +27,14 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include ../.config
|
||||
include ./module.mk
|
||||
APPSTOPDIR := $(shell pwd)
|
||||
LITEOSTOPDIR ?= $(APPSTOPDIR)/..
|
||||
export LITEOSTOPDIR
|
||||
export APPSTOPDIR
|
||||
|
||||
HIDE := @
|
||||
APPS := app
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
all: $(APPS)
|
||||
all clean:
|
||||
$(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir $@ || exit 1; done
|
||||
|
||||
# Make
|
||||
$(APPS):
|
||||
ifneq ($(APP_SUBDIRS), )
|
||||
$(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir ; done
|
||||
endif
|
||||
|
||||
clean:
|
||||
ifneq ($(APP_SUBDIRS), )
|
||||
$(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir clean; done
|
||||
endif
|
||||
|
||||
.PHONY: all $(APPS) clean
|
||||
.PHONY: all clean
|
||||
|
||||
10
tools/fsimage/MakeVersion.sh → apps/app.mk
Executable file → Normal file
10
tools/fsimage/MakeVersion.sh → apps/app.mk
Executable file → Normal file
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
# 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:
|
||||
@@ -29,4 +27,6 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
./mkfs.jffs2 -s 0x1000 -e 0x10000 -p 0x100000 -d rootfs/ -o rootfs_64k.jffs2
|
||||
override TARGET = $(OUT)/bin/$(APP_NAME)
|
||||
|
||||
include $(MODULE)
|
||||
65
apps/config.mk
Executable file → Normal file
65
apps/config.mk
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
# 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:
|
||||
@@ -27,34 +27,49 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# common dir config
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
# output dir config
|
||||
OBJOUT := $(APPSTOPDIR)/out
|
||||
APPSOUT := $(OBJOUT)/apps
|
||||
LIBSOUT := $(OBJOUT)/libs
|
||||
IMGOUT := $(OUT)
|
||||
|
||||
# common flags config
|
||||
BASE_OPTS := -ffunction-sections -fdata-sections -fno-omit-frame-pointer -D_GNU_SOURCE \
|
||||
$(LITEOS_SSP) $(LITEOS_CORE_COPTS) $(WARNING_AS_ERROR) $(LLVM_EXTRA_OPTS) $(LITEOS_GCOV_OPTS)
|
||||
BASE_OPTS := -D_FORTIFY_SOURCE=2 -D_XOPEN_SOURCE=700
|
||||
|
||||
CFLAGS := -std=c99 -fno-exceptions $(BASE_OPTS) $(LITEOS_COPTS_OPTMIZE)
|
||||
CXXFLAGS := -std=c++11 -fexceptions -fpermissive -frtti $(BASE_OPTS) $(LITEOS_COPTS_OPTMIZE)
|
||||
LDCFLAGS := -lc
|
||||
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
|
||||
LLVM_SYSROOT := --sysroot=$(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/
|
||||
LDCXXFLGS := -lc++ -lc++abi -lc
|
||||
else
|
||||
BASE_OPTS += -Wl,-z,relro,-z,now
|
||||
LDCXXFLGS := -lstdc++ -lsupc++ -lc
|
||||
endif
|
||||
COMMON_INCLUDE := -I $(LITEOSTHIRDPARTY)/bounds_checking_function/include
|
||||
ASFLAGS :=
|
||||
CFLAGS := $(LITEOS_COPTS) $(BASE_OPTS) -fPIE
|
||||
CXXFLAGS := $(LITEOS_CXXOPTS) $(BASE_OPTS) -fPIE
|
||||
LDFLAGS := $(LITEOS_CORE_COPTS) -pie -Wl,-z,relro,-z,now -O2
|
||||
|
||||
CFLAGS := $(filter-out -fno-pic -fno-builtin -nostdinc -nostdlib,$(CFLAGS))
|
||||
CXXFLAGS := $(filter-out -fno-pic -fno-builtin -nostdinc -nostdlib -nostdinc++,$(CXXFLAGS))
|
||||
|
||||
# alias variable config
|
||||
HIDE := @
|
||||
MAKE := make
|
||||
RM := -rm -rf
|
||||
CP := -cp -rf
|
||||
MV := -mv
|
||||
RM := rm -rf
|
||||
CP := cp -rf
|
||||
MV := mv -f
|
||||
|
||||
APP := $(APPSTOPDIR)/app.mk
|
||||
|
||||
##build modules config##
|
||||
APP_SUBDIRS :=
|
||||
|
||||
ifeq ($(LOSCFG_SHELL), y)
|
||||
APP_SUBDIRS += shell
|
||||
APP_SUBDIRS += mksh
|
||||
APP_SUBDIRS += toybox
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_USER_INIT_DEBUG), y)
|
||||
APP_SUBDIRS += init
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_NET_LWIP_SACK_TFTP), y)
|
||||
APP_SUBDIRS += tftp
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_DRIVERS_TRACE), y)
|
||||
APP_SUBDIRS += trace
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_DRIVERS_PERF), y)
|
||||
APP_SUBDIRS += perf
|
||||
endif
|
||||
|
||||
39
apps/init/BUILD.gn
Normal file
39
apps/init/BUILD.gn
Normal file
@@ -0,0 +1,39 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
executable("init") {
|
||||
sources = [ "src/init.c" ]
|
||||
|
||||
if (defined(LOSCFG_QUICK_START)) {
|
||||
ldflags = [ "--static" ]
|
||||
defines = [ "LOSCFG_QUICK_START" ]
|
||||
}
|
||||
}
|
||||
38
apps/init/Makefile
Executable file → Normal file
38
apps/init/Makefile
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
# 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:
|
||||
@@ -27,37 +27,15 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
INIT_DIR := $(dir $(shell pwd))/init/
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
ifeq ($(APPSTOPDIR), )
|
||||
APPSTOPDIR := $(shell pwd)/../
|
||||
LITEOSTOPDIR = $(APPSTOPDIR)/../
|
||||
endif
|
||||
include $(INIT_DIR)/../config.mk
|
||||
APP_NAME := $(notdir $(shell pwd))
|
||||
|
||||
APPS_OUT := $(OUT)/bin
|
||||
LOCAL_SRCS := src/init.c
|
||||
LOCAL_OBJ := src/init.o
|
||||
|
||||
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
|
||||
LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses -Wnonnull $(LLVM_SYSROOT)
|
||||
LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT)
|
||||
ifeq ($(LOSCFG_QUICK_START), y)
|
||||
LDFLAGS += --static
|
||||
CFLAGS += -DLOSCFG_QUICK_START
|
||||
endif
|
||||
INITNAME := init
|
||||
|
||||
all: $(INITNAME)
|
||||
|
||||
$(LOCAL_OBJ): %.o : %.c
|
||||
$(HIDE) $(CC) $(CFLAGS) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@
|
||||
|
||||
$(INITNAME):$(LOCAL_OBJ)
|
||||
$(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(INITNAME) $^ $(LDCFLAGS)
|
||||
$(HIDE) mkdir -p $(APPS_OUT)
|
||||
$(HIDE) $(MV) $(INITNAME) $(APPS_OUT)
|
||||
$(HIDE) $(RM) $(LOCAL_OBJ)
|
||||
|
||||
clean:
|
||||
$(HIDE) $(RM) $(LOCAL_OBJ)
|
||||
$(HIDE) $(RM) $(INITNAME)
|
||||
|
||||
.PHONY: all $(INITNAME) clean
|
||||
include $(APP)
|
||||
|
||||
48
apps/init/src/init.c
Executable file → Normal file
48
apps/init/src/init.c
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -35,15 +35,57 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#ifdef LOSCFG_QUICK_START
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#define QUICKSTART_IOC_MAGIC 'T'
|
||||
#define QUICKSTART_INITSTEP2 _IO(QUICKSTART_IOC_MAGIC, 0)
|
||||
#define WAIT_FOR_SAMPLE 300000 // wait 300ms for sample
|
||||
#endif
|
||||
int main(int argc, char * const *argv)
|
||||
{
|
||||
(void)argv;
|
||||
int ret;
|
||||
const char *shellPath = "/bin/shell";
|
||||
pid_t gid;
|
||||
const char *shellPath = "/bin/mksh";
|
||||
|
||||
#ifdef LOSCFG_QUICK_START
|
||||
const char *samplePath = "/dev/shm/sample_quickstart";
|
||||
|
||||
ret = fork();
|
||||
if (ret < 0) {
|
||||
printf("Failed to fork for sample_quickstart\n");
|
||||
} else if (ret == 0) {
|
||||
(void)execve(samplePath, NULL, NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
usleep(WAIT_FOR_SAMPLE);
|
||||
|
||||
int fd = open("/dev/quickstart", O_RDONLY);
|
||||
if (fd != -1) {
|
||||
ioctl(fd, QUICKSTART_INITSTEP2);
|
||||
close(fd);
|
||||
}
|
||||
#endif
|
||||
ret = fork();
|
||||
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);
|
||||
}
|
||||
|
||||
75
tools/build/mk/get_llvm_compiler_path.sh → apps/lms/BUILD.gn
Executable file → Normal file
75
tools/build/mk/get_llvm_compiler_path.sh → apps/lms/BUILD.gn
Executable file → Normal file
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
# 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:
|
||||
@@ -29,26 +27,51 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set -e
|
||||
function get_compiler_path()
|
||||
{
|
||||
local system=$(uname -s)
|
||||
local user_clang=clang
|
||||
local clang_install_path=$(which "${user_clang}")
|
||||
if [ "$system" == "Linux" ] ; then
|
||||
if [ -n "${clang_install_path}" ] ; then
|
||||
clang_install_path=$(dirname ${clang_install_path})/../
|
||||
echo "${clang_install_path}"
|
||||
else
|
||||
echo "WARNING:Set llvm/bin path in PATH."
|
||||
fi
|
||||
else
|
||||
if [ -n "${clang_install_path}" ] ; then
|
||||
clang_install_path=$(dirname ${clang_install_path})/../
|
||||
echo "${clang_install_path}"
|
||||
else
|
||||
echo "WARNING:Set llvm/bin path in PATH."
|
||||
fi
|
||||
fi
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
lite_component("LMS-Sample") {
|
||||
features = [ ":sample_usr_lms" ]
|
||||
}
|
||||
executable("sample_usr_lms") {
|
||||
output_name = "sample_usr_lms"
|
||||
sources = [ "src/sample_usr_lms.c" ]
|
||||
include_dirs = []
|
||||
defines = []
|
||||
if (ohos_build_compiler == "gcc") {
|
||||
cflags_c = [
|
||||
"-O0",
|
||||
"-fsanitize=kernel-address",
|
||||
"-funwind-tables",
|
||||
"-fasynchronous-unwind-tables",
|
||||
]
|
||||
} else {
|
||||
cflags_c = [
|
||||
"-O0",
|
||||
"-fsanitize=kernel-address",
|
||||
"-mllvm",
|
||||
"-asan-instrumentation-with-call-threshold=0",
|
||||
"-mllvm",
|
||||
"-asan-stack=0",
|
||||
"-mllvm",
|
||||
"-asan-globals=0",
|
||||
"-funwind-tables",
|
||||
"-fasynchronous-unwind-tables",
|
||||
]
|
||||
}
|
||||
ldflags = [
|
||||
"-rdynamic",
|
||||
"-lunwind",
|
||||
"-lusrlms",
|
||||
"-Wl,--wrap=realloc",
|
||||
"-Wl,--wrap=calloc",
|
||||
"-Wl,--wrap=malloc",
|
||||
"-Wl,--wrap=free",
|
||||
"-Wl,--wrap=valloc",
|
||||
"-Wl,--wrap=aligned_alloc",
|
||||
"-Wl,--wrap=memset",
|
||||
"-Wl,--wrap=memcpy",
|
||||
"-Wl,--wrap=memmove",
|
||||
"-Wl,--wrap=strcpy",
|
||||
"-Wl,--wrap=strcat",
|
||||
]
|
||||
deps = [ "//kernel/liteos_a/kernel/extended/lms/usr:usrlmslib" ]
|
||||
}
|
||||
get_compiler_path
|
||||
249
apps/lms/src/sample_usr_lms.c
Normal file
249
apps/lms/src/sample_usr_lms.c
Normal file
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static void BufWriteTest(void *buf, int start, int end)
|
||||
{
|
||||
for (int i = start; i <= end; i++) {
|
||||
((char *)buf)[i] = 'a';
|
||||
}
|
||||
}
|
||||
|
||||
static void BufReadTest(void *buf, int start, int end)
|
||||
{
|
||||
char tmp;
|
||||
for (int i = start; i <= end; i++) {
|
||||
tmp = ((char *)buf)[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void LmsMallocTest(void)
|
||||
{
|
||||
#define TEST_SIZE 16
|
||||
printf("\n-------- LmsMallocTest Start --------\n");
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsMallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
|
||||
BufReadTest(buf, -1, TEST_SIZE);
|
||||
printf("[LmsMallocTest] write overflow error should be triggered, write range[0, TEST_SIZE]\n");
|
||||
BufWriteTest(buf, 0, TEST_SIZE);
|
||||
|
||||
free(buf);
|
||||
printf("\n-------- LmsMallocTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsReallocTest(void)
|
||||
{
|
||||
#define TEST_SIZE 64
|
||||
#define TEST_SIZE_MIN 32
|
||||
printf("\n-------- LmsReallocTest Start --------\n");
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
printf("[LmsReallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
|
||||
BufReadTest(buf, -1, TEST_SIZE);
|
||||
char *buf1 = (char *)realloc(buf, TEST_SIZE_MIN);
|
||||
if (buf1 == NULL) {
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
buf = NULL;
|
||||
printf("[LmsReallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE_MIN]\n");
|
||||
BufReadTest(buf1, -1, TEST_SIZE_MIN);
|
||||
free(buf1);
|
||||
printf("\n-------- LmsReallocTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsCallocTest(void)
|
||||
{
|
||||
#define TEST_SIZE 16
|
||||
printf("\n-------- LmsCallocTest Start --------\n");
|
||||
char *buf = (char *)calloc(4, 4); /* 4: test size */
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsCallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
|
||||
BufReadTest(buf, -1, TEST_SIZE);
|
||||
free(buf);
|
||||
printf("\n-------- LmsCallocTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsVallocTest(void)
|
||||
{
|
||||
#define TEST_SIZE 4096
|
||||
printf("\n-------- LmsVallocTest Start --------\n");
|
||||
char *buf = (char *)valloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsVallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
|
||||
BufReadTest(buf, -1, TEST_SIZE);
|
||||
free(buf);
|
||||
printf("\n-------- LmsVallocTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsAlignedAllocTest(void)
|
||||
{
|
||||
#define TEST_ALIGN_SIZE 64
|
||||
#define TEST_SIZE 128
|
||||
printf("\n-------- LmsAlignedAllocTest Start --------\n");
|
||||
char *buf = (char *)aligned_alloc(TEST_ALIGN_SIZE, TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsAlignedAllocTest] read overflow & underflow error should be triggered, read range[-1,128]\n");
|
||||
BufReadTest(buf, -1, 128);
|
||||
free(buf);
|
||||
printf("\n-------- LmsAlignedAllocTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsMemsetTest(void)
|
||||
{
|
||||
#define TEST_SIZE 32
|
||||
printf("\n-------- LmsMemsetTest Start --------\n");
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsMemsetTest] memset overflow & underflow error should be triggered, memset size:%d\n", TEST_SIZE + 1);
|
||||
memset(buf, 0, TEST_SIZE + 1);
|
||||
free(buf);
|
||||
printf("\n-------- LmsMemsetTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsMemcpyTest(void)
|
||||
{
|
||||
#define TEST_SIZE 20
|
||||
printf("\n-------- LmsMemcpyTest Start --------\n");
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
char localBuf[32] = {0}; /* 32: test size */
|
||||
printf("[LmsMemcpyTest] memcpy overflow error should be triggered, memcpy size:%d\n", TEST_SIZE + 1);
|
||||
memcpy(buf, localBuf, TEST_SIZE + 1);
|
||||
free(buf);
|
||||
printf("\n-------- LmsMemcpyTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsMemmoveTest(void)
|
||||
{
|
||||
#define TEST_SIZE 20
|
||||
printf("\n-------- LmsMemmoveTest Start --------\n");
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsMemmoveTest] memmove overflow error should be triggered\n");
|
||||
memmove(buf + 12, buf, 10); /* 12 and 10: test size */
|
||||
free(buf);
|
||||
printf("\n-------- LmsMemmoveTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsStrcpyTest(void)
|
||||
{
|
||||
#define TEST_SIZE 16
|
||||
printf("\n-------- LmsStrcpyTest Start --------\n");
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
char *testStr = "bbbbbbbbbbbbbbbbb";
|
||||
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n",
|
||||
(int)strlen(testStr) + 1);
|
||||
strcpy(buf, testStr);
|
||||
free(buf);
|
||||
printf("\n-------- LmsStrcpyTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsStrcatTest(void)
|
||||
{
|
||||
#define TEST_SIZE 16
|
||||
printf("\n-------- LmsStrcatTest Start --------\n");
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
buf[0] = 'a';
|
||||
buf[1] = 'b';
|
||||
buf[2] = 0;
|
||||
char *testStr = "cccccccccccccc";
|
||||
printf("[LmsStrcatTest] strcat overflow error should be triggered, src string:%s dest string:%s"
|
||||
"total buf size:%d\n",
|
||||
testStr, buf, strlen(testStr) + strlen(buf) + 1);
|
||||
strcat(buf, testStr);
|
||||
free(buf);
|
||||
printf("\n-------- LmsStrcatTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsFreeTest(void)
|
||||
{
|
||||
#define TEST_SIZE 16
|
||||
printf("\n-------- LmsFreeTest Start --------\n");
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsFreeTest] free size:%d\n", TEST_SIZE);
|
||||
free(buf);
|
||||
printf("[LmsFreeTest] Use after free error should be triggered, read range[1,1]\n");
|
||||
BufReadTest(buf, 1, 1);
|
||||
printf("[LmsFreeTest] double free error should be triggered\n");
|
||||
free(buf);
|
||||
printf("\n-------- LmsFreeTest End --------\n");
|
||||
}
|
||||
|
||||
int main(int argc, char * const *argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
printf("\n############### Lms Test start ###############\n");
|
||||
char *tmp = (char *)malloc(5000); /* 5000: test mem size */
|
||||
if (tmp == NULL) {
|
||||
return;
|
||||
}
|
||||
LmsMallocTest();
|
||||
LmsReallocTest();
|
||||
LmsCallocTest();
|
||||
LmsVallocTest();
|
||||
LmsAlignedAllocTest();
|
||||
LmsMemsetTest();
|
||||
LmsMemcpyTest();
|
||||
LmsMemmoveTest();
|
||||
LmsStrcpyTest();
|
||||
LmsStrcatTest();
|
||||
LmsFreeTest();
|
||||
free(tmp);
|
||||
printf("\n############### Lms Test End ###############\n");
|
||||
}
|
||||
100
apps/mksh/BUILD.gn
Normal file
100
apps/mksh/BUILD.gn
Normal file
@@ -0,0 +1,100 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/mksh/mksh.gni")
|
||||
|
||||
group("mksh") {
|
||||
deps = [ ":build_mksh" ]
|
||||
}
|
||||
|
||||
copy("copy_mksh_src") {
|
||||
sources = MKSH_SRC_DIR
|
||||
outputs = [ "$target_out_dir/mksh_build" ]
|
||||
}
|
||||
|
||||
build_ext_component("build_mksh") {
|
||||
deps = [ ":copy_mksh_src" ]
|
||||
deps += [ "//third_party/musl:sysroot_lite" ]
|
||||
exec_path = rebase_path("$target_out_dir/mksh_build")
|
||||
|
||||
cflags = [
|
||||
"-flto",
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections",
|
||||
"-fstack-protector-strong",
|
||||
"-D_FORTIFY_SOURCE=2",
|
||||
"-DMKSH_DISABLE_TTY_WARNING",
|
||||
"-DMKSH_SMALL=1",
|
||||
"-DMKSH_ASSUME_UTF8=1",
|
||||
"-DMKSH_SMALL_BUT_FAST=0",
|
||||
"-DMKSH_S_NOVI=1",
|
||||
"-DHAVE_CAN_FSTACKPROTECTORSTRONG=1",
|
||||
"-DMKSH_LESS_CMDLINE_EDITING",
|
||||
"-DMKSH_LESS_BUILDINS",
|
||||
"-DMKSH_NO_INITCOMS",
|
||||
"-DADAPT_FOR_LITEOS_A",
|
||||
]
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += [ "-Oz" ]
|
||||
} else {
|
||||
cflags += [ "-O2" ]
|
||||
}
|
||||
cflags = string_join(" ", cflags)
|
||||
|
||||
extra_flags = string_join(" ", target_arch_cflags)
|
||||
if (ohos_build_compiler == "clang") {
|
||||
extra_flags += " --target=$target_triple"
|
||||
extra_flags += " --sysroot=" + rebase_path(ohos_current_sysroot)
|
||||
}
|
||||
|
||||
command = "rm -rf .git && env"
|
||||
command += " CC=\"$ohos_current_cc_command\""
|
||||
command += " TARGET_OS=OpenHarmony"
|
||||
command += " CFLAGS=\"$cflags $extra_flags\""
|
||||
command += " LDFLAGS=\"-Wl,--gc-sections -flto -O2\""
|
||||
command += " sh ./Build.sh -r"
|
||||
|
||||
# copy mksh and .mkshrc to out dir
|
||||
command += " && mkdir -p "
|
||||
command += rebase_path("$root_out_dir/bin", exec_path)
|
||||
command += " && install -D mksh "
|
||||
command += rebase_path("$root_out_dir/unstripped/bin/mksh", exec_path)
|
||||
command += " && $ohos_current_strip_command mksh -o "
|
||||
command += rebase_path("$root_out_dir/bin/mksh", exec_path)
|
||||
command += " && install -D .mkshrc "
|
||||
command += rebase_path("$root_out_dir/etc/.mkshrc", exec_path)
|
||||
|
||||
outputs = [
|
||||
"$root_out_dir/unstripped/bin/mksh",
|
||||
"$root_out_dir/bin/mksh",
|
||||
"$root_out_dir/etc/.mkshrc",
|
||||
]
|
||||
}
|
||||
56
apps/mksh/Makefile
Executable file
56
apps/mksh/Makefile
Executable file
@@ -0,0 +1,56 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
BUILD_DIR := $(OUT)/mksh_build
|
||||
BUILD_LOG := $(BUILD_DIR)/build.log
|
||||
|
||||
CFLAGS += -DMKSH_DISABLE_TTY_WARNING -DMKSH_SMALL=1 -DMKSH_ASSUME_UTF8=1 -DMKSH_SMALL_BUT_FAST=0 -DMKSH_S_NOVI=1 -DHAVE_CAN_FSTACKPROTECTORSTRONG=1
|
||||
CFLAGS += -DMKSH_LESS_CMDLINE_EDITING -DMKSH_LESS_BUILDINS -DMKSH_NO_INITCOMS -DADAPT_FOR_LITEOS_A
|
||||
CFLAGS += -Wno-error
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
all:
|
||||
ifneq ($(wildcard $(BUILD_DIR)/Rebuild.sh),)
|
||||
$(HIDE)echo "not clean, rebuilding now"
|
||||
$(HIDE)cd $(BUILD_DIR) && sh ./Rebuild.sh > $(BUILD_LOG) 2>&1
|
||||
else
|
||||
$(HIDE)mkdir -p $(BUILD_DIR)
|
||||
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/mksh/. $(BUILD_DIR)
|
||||
$(HIDE)cd $(BUILD_DIR) && CC="$(CC)" TARGET_OS=OpenHarmony CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" sh ./Build.sh -r > $(BUILD_LOG) 2>&1
|
||||
endif
|
||||
$(HIDE)mkdir -p $(OUT)/bin/ $(OUT)/etc/
|
||||
$(HIDE)$(STRIP) $(BUILD_DIR)/mksh -o $(OUT)/bin/mksh
|
||||
$(HIDE)$(CP) $(BUILD_DIR)/.mkshrc $(OUT)/etc/
|
||||
|
||||
clean:
|
||||
$(HIDE)$(RM) $(BUILD_DIR)
|
||||
|
||||
.PHONY: all clean
|
||||
63
apps/perf/BUILD.gn
Normal file
63
apps/perf/BUILD.gn
Normal file
@@ -0,0 +1,63 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
executable("perf") {
|
||||
sources = [
|
||||
"src/main.c",
|
||||
"src/option.c",
|
||||
"src/perf.c",
|
||||
"src/perf_list.c",
|
||||
"src/perf_record.c",
|
||||
"src/perf_stat.c",
|
||||
]
|
||||
include_dirs = [ "include" ]
|
||||
defines = []
|
||||
|
||||
if (defined(LOSCFG_PERF_HW_PMU)) {
|
||||
defines += [ "LOSCFG_PERF_HW_PMU" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_PERF_TIMED_PMU)) {
|
||||
defines += [ "LOSCFG_PERF_TIMED_PMU" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_PERF_SW_PMU)) {
|
||||
defines += [ "LOSCFG_PERF_SW_PMU" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_FS_VFS)) {
|
||||
defines += [ "LOSCFG_FS_VFS" ]
|
||||
}
|
||||
|
||||
defines += [ "LOSCFG_PERF_BUFFER_SIZE=$LOSCFG_PERF_BUFFER_SIZE" ]
|
||||
|
||||
deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ]
|
||||
}
|
||||
62
apps/perf/Makefile
Normal file
62
apps/perf/Makefile
Normal file
@@ -0,0 +1,62 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
APP_NAME := $(notdir $(shell pwd))
|
||||
|
||||
SECUREC_DIR := $(LITEOSTHIRDPARTY)/bounds_checking_function
|
||||
|
||||
LOCAL_SRCS = $(wildcard src/*.c)
|
||||
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/*.c)
|
||||
|
||||
LOCAL_INCLUDE := \
|
||||
-I include \
|
||||
-I $(SECUREC_DIR)/include
|
||||
|
||||
LOCAL_FLAGS += $(LOCAL_INCLUDE)
|
||||
|
||||
ifeq ($(LOSCFG_PERF_HW_PMU), y)
|
||||
CFLAGS += -DLOSCFG_PERF_HW_PMU
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_PERF_TIMED_PMU), y)
|
||||
CFLAGS += -DLOSCFG_PERF_TIMED_PMU
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_PERF_SW_PMU), y)
|
||||
CFLAGS += -DLOSCFG_PERF_SW_PMU
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_FS_VFS), y)
|
||||
CFLAGS += -DLOSCFG_FS_VFS
|
||||
endif
|
||||
|
||||
CFLAGS += -DLOSCFG_PERF_BUFFER_SIZE=$(LOSCFG_PERF_BUFFER_SIZE)
|
||||
include $(APP)
|
||||
61
kernel/base/include/los_multipledlinkhead_pri.h → apps/perf/include/option.h
Executable file → Normal file
61
kernel/base/include/los_multipledlinkhead_pri.h → apps/perf/include/option.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -29,42 +29,53 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LOS_MULTIPLE_DLINK_HEAD_PRI_H
|
||||
#define _LOS_MULTIPLE_DLINK_HEAD_PRI_H
|
||||
|
||||
#include "los_base.h"
|
||||
#include "los_list.h"
|
||||
#ifndef _OPTION_H
|
||||
#define _OPTION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
#include "perf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define OS_MAX_MULTI_DLNK_LOG2 30
|
||||
#define OS_MIN_MULTI_DLNK_LOG2 4
|
||||
#define OS_MULTI_DLNK_NUM ((OS_MAX_MULTI_DLNK_LOG2 - OS_MIN_MULTI_DLNK_LOG2) + 1)
|
||||
#define OS_DLNK_HEAD_SIZE OS_MULTI_DLNK_HEAD_SIZE
|
||||
#define OS_MULTI_DLNK_HEAD_SIZE sizeof(LosMultipleDlinkHead)
|
||||
#define CMD_MAX_PARAMS 10
|
||||
typedef int (*CALL_BACK)(const char *argv);
|
||||
|
||||
enum OptionType {
|
||||
OPTION_TYPE_UINT,
|
||||
OPTION_TYPE_STRING,
|
||||
OPTION_TYPE_CALLBACK,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
LOS_DL_LIST listHead[OS_MULTI_DLNK_NUM];
|
||||
} LosMultipleDlinkHead;
|
||||
int type;
|
||||
const char *name;
|
||||
const char **str;
|
||||
unsigned int *value;
|
||||
CALL_BACK cb;
|
||||
} PerfOption;
|
||||
|
||||
STATIC INLINE LOS_DL_LIST *OsDLnkNextMultiHead(VOID *headAddr, LOS_DL_LIST *listNodeHead)
|
||||
{
|
||||
LosMultipleDlinkHead *head = (LosMultipleDlinkHead *)headAddr;
|
||||
typedef struct {
|
||||
const char *path;
|
||||
char *params[CMD_MAX_PARAMS];
|
||||
} SubCmd;
|
||||
|
||||
return (&head->listHead[OS_MULTI_DLNK_NUM - 1] == listNodeHead) ? NULL : (listNodeHead + 1);
|
||||
}
|
||||
#define OPTION_END() {.name = ""}
|
||||
#define OPTION_UINT(n, v) {.type = OPTION_TYPE_UINT, .name = (n), .value = (v)}
|
||||
#define OPTION_STRING(n, s) {.type = OPTION_TYPE_STRING, .name = (n), .str = (s)}
|
||||
#define OPTION_CALLBACK(n, c) {.type = OPTION_TYPE_CALLBACK, .name = (n), .cb = (c)}
|
||||
|
||||
extern VOID OsDLnkInitMultiHead(VOID *headAddr);
|
||||
extern LOS_DL_LIST *OsDLnkMultiHead(VOID *headAddr, UINT32 size);
|
||||
int ParseOptions(int argc, char **argv, PerfOption *opt, SubCmd *cmd);
|
||||
int ParseEvents(const char *argv, PerfEventConfig *eventsCfg, unsigned int *len);
|
||||
int ParseIds(const char *argv, int *arr, unsigned int *len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _LOS_MULTIPLE_DLINK_HEAD_PRI_H */
|
||||
#endif /* _OPTION_H */
|
||||
163
apps/perf/include/perf.h
Normal file
163
apps/perf/include/perf.h
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _PERF_H
|
||||
#define _PERF_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define PERF_MAX_EVENT 7
|
||||
#define PERF_MAX_FILTER_TSKS 32
|
||||
|
||||
#ifdef PERF_DEBUG
|
||||
#define printf_debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define printf_debug(fmt, ...)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Perf types
|
||||
*/
|
||||
enum PerfEventType {
|
||||
PERF_EVENT_TYPE_HW, /* boards common hw events */
|
||||
PERF_EVENT_TYPE_TIMED, /* hrtimer timed events */
|
||||
PERF_EVENT_TYPE_SW, /* software trace events */
|
||||
PERF_EVENT_TYPE_RAW, /* boards special hw events, see enum PmuEventType in corresponding arch headfile */
|
||||
|
||||
PERF_EVENT_TYPE_MAX
|
||||
};
|
||||
|
||||
/*
|
||||
* Common hardware pmu events
|
||||
*/
|
||||
enum PmuHwId {
|
||||
PERF_COUNT_HW_CPU_CYCLES = 0, /* cpu cycle event */
|
||||
PERF_COUNT_HW_INSTRUCTIONS, /* instruction event */
|
||||
PERF_COUNT_HW_DCACHE_REFERENCES, /* dcache access event */
|
||||
PERF_COUNT_HW_DCACHE_MISSES, /* dcache miss event */
|
||||
PERF_COUNT_HW_ICACHE_REFERENCES, /* icache access event */
|
||||
PERF_COUNT_HW_ICACHE_MISSES, /* icache miss event */
|
||||
PERF_COUNT_HW_BRANCH_INSTRUCTIONS, /* software change of pc event */
|
||||
PERF_COUNT_HW_BRANCH_MISSES, /* branch miss event */
|
||||
|
||||
PERF_COUNT_HW_MAX,
|
||||
};
|
||||
|
||||
/*
|
||||
* Common hrtimer timed events
|
||||
*/
|
||||
enum PmuTimedId {
|
||||
PERF_COUNT_CPU_CLOCK = 0, /* hrtimer timed event */
|
||||
};
|
||||
|
||||
/*
|
||||
* Common software pmu events
|
||||
*/
|
||||
enum PmuSwId {
|
||||
PERF_COUNT_SW_TASK_SWITCH = 1, /* task switch event */
|
||||
PERF_COUNT_SW_IRQ_RESPONSE, /* irq response event */
|
||||
PERF_COUNT_SW_MEM_ALLOC, /* memory alloc event */
|
||||
PERF_COUNT_SW_MUX_PEND, /* mutex pend event */
|
||||
|
||||
PERF_COUNT_SW_MAX,
|
||||
};
|
||||
|
||||
/*
|
||||
* perf sample data types
|
||||
* Config it through PerfConfigAttr->sampleType.
|
||||
*/
|
||||
enum PerfSampleType {
|
||||
PERF_RECORD_CPU = 1U << 0, /* record current cpuid */
|
||||
PERF_RECORD_TID = 1U << 1, /* record current task id */
|
||||
PERF_RECORD_TYPE = 1U << 2, /* record event type */
|
||||
PERF_RECORD_PERIOD = 1U << 3, /* record event period */
|
||||
PERF_RECORD_TIMESTAMP = 1U << 4, /* record timestamp */
|
||||
PERF_RECORD_IP = 1U << 5, /* record instruction pointer */
|
||||
PERF_RECORD_CALLCHAIN = 1U << 6, /* record backtrace */
|
||||
PERF_RECORD_PID = 1U << 7, /* record current process id */
|
||||
};
|
||||
|
||||
/*
|
||||
* perf configuration sub event information
|
||||
*
|
||||
* This structure is used to config specific events attributes.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int type; /* enum PerfEventType */
|
||||
struct {
|
||||
unsigned int eventId; /* the specific event corresponds to the PerfEventType */
|
||||
unsigned int period; /* event period, for every "period"th occurrence of the event a
|
||||
sample will be recorded */
|
||||
} events[PERF_MAX_EVENT]; /* perf event list */
|
||||
unsigned int eventsNr; /* total perf event number */
|
||||
size_t predivided; /* whether to prescaler (once every 64 counts),
|
||||
which only take effect on cpu cycle hardware event */
|
||||
} PerfEventConfig;
|
||||
|
||||
/*
|
||||
* perf configuration main information
|
||||
*
|
||||
* This structure is used to set perf sampling attributes, including events, tasks and other information.
|
||||
*/
|
||||
typedef struct {
|
||||
PerfEventConfig eventsCfg; /* perf event config */
|
||||
unsigned int taskIds[PERF_MAX_FILTER_TSKS]; /* perf task filter list (allowlist) */
|
||||
unsigned int taskIdsNr; /* task numbers of task filter allowlist,
|
||||
if set 0 perf will sample all tasks */
|
||||
unsigned int processIds[PERF_MAX_FILTER_TSKS]; /* perf process filter list (allowlist) */
|
||||
unsigned int processIdsNr; /* process numbers of process filter allowlist,
|
||||
if set 0 perf will sample all processes */
|
||||
unsigned int sampleType; /* type of data to sample defined in PerfSampleType */
|
||||
size_t needSample; /* whether to sample data */
|
||||
} PerfConfigAttr;
|
||||
|
||||
void PerfUsage(void);
|
||||
void PerfDumpAttr(PerfConfigAttr *attr);
|
||||
int PerfConfig(int fd, PerfConfigAttr *attr);
|
||||
void PerfStart(int fd, size_t sectionId);
|
||||
void PerfStop(int fd);
|
||||
ssize_t PerfRead(int fd, char *buf, size_t size);
|
||||
void PerfPrintBuffer(const char *buf, ssize_t num);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _PERF_H */
|
||||
57
apps/perf/include/perf_list.h
Normal file
57
apps/perf/include/perf_list.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _PERF_LIST_H
|
||||
#define _PERF_LIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int event;
|
||||
int type;
|
||||
} PerfEvent;
|
||||
|
||||
extern const PerfEvent g_events[];
|
||||
void PerfList(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _PERF_LIST_H */
|
||||
49
apps/perf/include/perf_record.h
Normal file
49
apps/perf/include/perf_record.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _PERF_RECORD_H
|
||||
#define _PERF_RECORD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void PerfRecord(int fd, int argc, char **argv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _PERF_RECORD_H */
|
||||
49
apps/perf/include/perf_stat.h
Normal file
49
apps/perf/include/perf_stat.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _PERF_STAT_H
|
||||
#define _PERF_STAT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void PerfStat(int fd, int argc, char **argv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _PERF_STAT_H */
|
||||
90
apps/perf/src/main.c
Normal file
90
apps/perf/src/main.c
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "perf.h"
|
||||
#include "perf_list.h"
|
||||
#include "perf_stat.h"
|
||||
#include "perf_record.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#define TWO_ARGS 2
|
||||
#define THREE_ARGS 3
|
||||
int fd = open("/dev/perf", O_RDWR);
|
||||
if (fd == -1) {
|
||||
printf("Perf open failed.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (argc == 1) {
|
||||
PerfUsage();
|
||||
} else if ((argc == TWO_ARGS) && strcmp(argv[1], "start") == 0) {
|
||||
PerfStart(fd, 0);
|
||||
} else if ((argc == THREE_ARGS) && strcmp(argv[1], "start") == 0) {
|
||||
size_t id = strtoul(argv[THREE_ARGS - 1], NULL, 0);
|
||||
PerfStart(fd, id);
|
||||
} else if ((argc == TWO_ARGS) && strcmp(argv[1], "stop") == 0) {
|
||||
PerfStop(fd);
|
||||
} else if ((argc == THREE_ARGS) && strcmp(argv[1], "read") == 0) {
|
||||
size_t size = strtoul(argv[THREE_ARGS - 1], NULL, 0);
|
||||
if (size == 0) {
|
||||
goto EXIT:
|
||||
}
|
||||
|
||||
char *buf = (char *)malloc(size);
|
||||
if (buf != NULL) {
|
||||
int len = PerfRead(fd, buf, size);
|
||||
PerfPrintBuffer(buf, len);
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
}
|
||||
} else if ((argc == TWO_ARGS) && strcmp(argv[1], "list") == 0) {
|
||||
PerfList();
|
||||
} else if ((argc >= THREE_ARGS) && strcmp(argv[1], "stat") == 0) {
|
||||
PerfStat(fd, argc, argv);
|
||||
} else if ((argc >= THREE_ARGS) && strcmp(argv[1], "record") == 0) {
|
||||
PerfRecord(fd, argc, argv);
|
||||
} else {
|
||||
printf("Unsupported perf command.\n");
|
||||
PerfUsage();
|
||||
}
|
||||
|
||||
EXIT:
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
182
apps/perf/src/option.c
Normal file
182
apps/perf/src/option.c
Normal file
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "option.h"
|
||||
#include "perf_list.h"
|
||||
|
||||
static int ParseOption(char **argv, int *index, PerfOption *opts)
|
||||
{
|
||||
int ret = 0;
|
||||
const char *str = NULL;
|
||||
|
||||
while ((opts->name != NULL) && (*opts->name != 0)) {
|
||||
if (strcmp(argv[*index], opts->name) == 0) {
|
||||
switch (opts->type) {
|
||||
case OPTION_TYPE_UINT:
|
||||
*opts->value = strtoul(argv[++(*index)], NULL, 0);
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
*opts->str = argv[++(*index)];
|
||||
break;
|
||||
case OPTION_TYPE_CALLBACK:
|
||||
str = argv[++(*index)];
|
||||
if ((*opts->cb)(str) != 0) {
|
||||
printf("parse error\n");
|
||||
ret = -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("invalid option\n");
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
opts++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ParseOptions(int argc, char **argv, PerfOption *opts, SubCmd *cmd)
|
||||
{
|
||||
int i;
|
||||
int index = 0;
|
||||
|
||||
while ((index < argc) && (argv[index] != NULL) && (*argv[index] == '-')) {
|
||||
if (ParseOption(argv, &index, opts) != 0) {
|
||||
return -1;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
if ((index < argc) && (argv[index] != NULL)) {
|
||||
cmd->path = argv[index];
|
||||
cmd->params[0] = argv[index];
|
||||
index++;
|
||||
} else {
|
||||
printf("no subcmd to execute\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 1; (index < argc) && (i < CMD_MAX_PARAMS); index++, i++) {
|
||||
cmd->params[i] = argv[index];
|
||||
}
|
||||
printf_debug("subcmd = %s\n", cmd->path);
|
||||
for (int j = 0; j < i; j++) {
|
||||
printf_debug("paras[%d]:%s\n", j, cmd->params[j]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ParseIds(const char *argv, int *arr, unsigned int *len)
|
||||
{
|
||||
int res, ret;
|
||||
unsigned int index = 0;
|
||||
char *sp = NULL;
|
||||
char *this = NULL;
|
||||
char *list = strdup(argv);
|
||||
|
||||
if (list == NULL) {
|
||||
printf("no memory for ParseIds\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
sp = strtok_r(list, ",", &this);
|
||||
while (sp) {
|
||||
res = strtoul(sp, NULL, 0);
|
||||
if (res < 0) {
|
||||
ret = -1;
|
||||
goto EXIT;
|
||||
}
|
||||
arr[index++] = res;
|
||||
sp = strtok_r(NULL, ",", &this);
|
||||
}
|
||||
*len = index;
|
||||
ret = 0;
|
||||
EXIT:
|
||||
free(list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline const PerfEvent *StrToEvent(const char *str)
|
||||
{
|
||||
const PerfEvent *evt = &g_events[0];
|
||||
|
||||
for (; evt->event != -1; evt++) {
|
||||
if (strcmp(str, evt->name) == 0) {
|
||||
return evt;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ParseEvents(const char *argv, PerfEventConfig *eventsCfg, unsigned int *len)
|
||||
{
|
||||
int ret;
|
||||
unsigned int index = 0;
|
||||
const PerfEvent *event = NULL;
|
||||
char *sp = NULL;
|
||||
char *this = NULL;
|
||||
char *list = strdup(argv);
|
||||
|
||||
if (list == NULL) {
|
||||
printf("no memory for ParseEvents\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
sp = strtok_r(list, ",", &this);
|
||||
while (sp) {
|
||||
event = StrToEvent(sp);
|
||||
if (event == NULL) {
|
||||
ret = -1;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if (index == 0) {
|
||||
eventsCfg->type = event->type;
|
||||
} else if (eventsCfg->type != event->type) {
|
||||
printf("events type must be same\n");
|
||||
ret = -1;
|
||||
goto EXIT;
|
||||
}
|
||||
eventsCfg->events[index].eventId = event->event;
|
||||
sp = strtok_r(NULL, ",", &this);
|
||||
index++;
|
||||
}
|
||||
*len = index;
|
||||
ret = 0;
|
||||
EXIT:
|
||||
free(list);
|
||||
return ret;
|
||||
}
|
||||
136
apps/perf/src/perf.c
Normal file
136
apps/perf/src/perf.c
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include "perf.h"
|
||||
|
||||
#define PERF_IOC_MAGIC 'T'
|
||||
#define PERF_START _IO(PERF_IOC_MAGIC, 1)
|
||||
#define PERF_STOP _IO(PERF_IOC_MAGIC, 2)
|
||||
|
||||
void PerfUsage(void)
|
||||
{
|
||||
printf("\nUsage: ./perf start [id]. Start perf.\n");
|
||||
printf("\nUsage: ./perf stop. Stop perf.\n");
|
||||
printf("\nUsage: ./perf read <nBytes>. Read nBytes raw data from perf buffer and print out.\n");
|
||||
printf("\nUsage: ./perf list. List events to be used in -e.\n");
|
||||
printf("\nUsage: ./perf stat/record [option] <command>. \n"
|
||||
"-e, event selector. use './perf list' to list available events.\n"
|
||||
"-p, event period.\n"
|
||||
"-o, perf data output filename.\n"
|
||||
"-t, taskId filter(allowlist), if not set perf will sample all tasks.\n"
|
||||
"-s, type of data to sample defined in PerfSampleType los_perf.h.\n"
|
||||
"-P, processId filter(allowlist), if not set perf will sample all processes.\n"
|
||||
"-d, whether to prescaler (once every 64 counts),"
|
||||
"which only take effect on cpu cycle hardware event.\n"
|
||||
);
|
||||
}
|
||||
|
||||
static void PerfSetPeriod(PerfConfigAttr *attr)
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < attr->eventsCfg.eventsNr; i++) {
|
||||
attr->eventsCfg.events[i].period = attr->eventsCfg.events[0].period;
|
||||
}
|
||||
}
|
||||
|
||||
void PerfPrintBuffer(const char *buf, ssize_t num)
|
||||
{
|
||||
#define BYTES_PER_LINE 4
|
||||
ssize_t i;
|
||||
for (i = 0; i < num; i++) {
|
||||
printf(" %02x", (unsigned char)buf[i]);
|
||||
if (((i + 1) % BYTES_PER_LINE) == 0) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void PerfDumpAttr(PerfConfigAttr *attr)
|
||||
{
|
||||
int i;
|
||||
printf_debug("attr->type: %d\n", attr->eventsCfg.type);
|
||||
for (i = 0; i < attr->eventsCfg.eventsNr; i++) {
|
||||
printf_debug("attr->events[%d]: %d, 0x%x\n", i, attr->eventsCfg.events[i].eventId,
|
||||
attr->eventsCfg.events[i].period);
|
||||
}
|
||||
printf_debug("attr->predivided: %d\n", attr->eventsCfg.predivided);
|
||||
printf_debug("attr->sampleType: 0x%x\n", attr->sampleType);
|
||||
|
||||
for (i = 0; i < attr->taskIdsNr; i++) {
|
||||
printf_debug("attr->taskIds[%d]: %d\n", i, attr->taskIds[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < attr->processIdsNr; i++) {
|
||||
printf_debug("attr->processIds[%d]: %d\n", i, attr->processIds[i]);
|
||||
}
|
||||
|
||||
printf_debug("attr->needSample: %d\n", attr->needSample);
|
||||
}
|
||||
|
||||
|
||||
void PerfStart(int fd, size_t sectionId)
|
||||
{
|
||||
(void)ioctl(fd, PERF_START, sectionId);
|
||||
}
|
||||
|
||||
void PerfStop(int fd)
|
||||
{
|
||||
(void)ioctl(fd, PERF_STOP, NULL);
|
||||
}
|
||||
|
||||
int PerfConfig(int fd, PerfConfigAttr *attr)
|
||||
{
|
||||
if (attr == NULL) {
|
||||
return -1;
|
||||
}
|
||||
PerfSetPeriod(attr);
|
||||
PerfDumpAttr(attr);
|
||||
return write(fd, attr, sizeof(PerfConfigAttr));
|
||||
}
|
||||
|
||||
ssize_t PerfRead(int fd, char *buf, size_t size)
|
||||
{
|
||||
ssize_t len;
|
||||
if (buf == NULL) {
|
||||
printf("Read buffer is null.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
len = read(fd, buf, size);
|
||||
return len;
|
||||
}
|
||||
129
apps/perf/src/perf_list.c
Normal file
129
apps/perf/src/perf_list.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "perf.h"
|
||||
#include "perf_list.h"
|
||||
|
||||
static const char *g_eventTypeStr[] = {
|
||||
"[Hardware event]",
|
||||
"[Timed event]",
|
||||
"[Software event]",
|
||||
};
|
||||
|
||||
const PerfEvent g_events[] = {
|
||||
#ifdef LOSCFG_PERF_HW_PMU
|
||||
{
|
||||
.name = "cycles",
|
||||
.event = PERF_COUNT_HW_CPU_CYCLES,
|
||||
.type = PERF_EVENT_TYPE_HW,
|
||||
},
|
||||
{
|
||||
.name = "instruction",
|
||||
.event = PERF_COUNT_HW_INSTRUCTIONS,
|
||||
.type = PERF_EVENT_TYPE_HW,
|
||||
},
|
||||
{
|
||||
.name = "dcache",
|
||||
.event = PERF_COUNT_HW_DCACHE_REFERENCES,
|
||||
.type = PERF_EVENT_TYPE_HW,
|
||||
},
|
||||
{
|
||||
.name = "dcache-miss",
|
||||
.event = PERF_COUNT_HW_DCACHE_MISSES,
|
||||
.type = PERF_EVENT_TYPE_HW,
|
||||
},
|
||||
{
|
||||
.name = "icache",
|
||||
.event = PERF_COUNT_HW_ICACHE_REFERENCES,
|
||||
.type = PERF_EVENT_TYPE_HW,
|
||||
},
|
||||
{
|
||||
.name = "icache-miss",
|
||||
.event = PERF_COUNT_HW_ICACHE_MISSES,
|
||||
.type = PERF_EVENT_TYPE_HW,
|
||||
},
|
||||
{
|
||||
.name = "branch",
|
||||
.event = PERF_COUNT_HW_BRANCH_INSTRUCTIONS,
|
||||
.type = PERF_EVENT_TYPE_HW,
|
||||
},
|
||||
{
|
||||
.name = "branch-miss",
|
||||
.event = PERF_COUNT_HW_BRANCH_MISSES,
|
||||
.type = PERF_EVENT_TYPE_HW,
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_PERF_TIMED_PMU
|
||||
{
|
||||
.name = "clock",
|
||||
.event = PERF_COUNT_CPU_CLOCK,
|
||||
.type = PERF_EVENT_TYPE_TIMED,
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_PERF_SW_PMU
|
||||
{
|
||||
.name = "task-switch",
|
||||
.event = PERF_COUNT_SW_TASK_SWITCH,
|
||||
.type = PERF_EVENT_TYPE_SW,
|
||||
},
|
||||
{
|
||||
.name = "irq-in",
|
||||
.event = PERF_COUNT_SW_IRQ_RESPONSE,
|
||||
.type = PERF_EVENT_TYPE_SW,
|
||||
},
|
||||
{
|
||||
.name = "mem-alloc",
|
||||
.event = PERF_COUNT_SW_MEM_ALLOC,
|
||||
.type = PERF_EVENT_TYPE_SW,
|
||||
},
|
||||
{
|
||||
.name = "mux-pend",
|
||||
.event = PERF_COUNT_SW_MUX_PEND,
|
||||
.type = PERF_EVENT_TYPE_SW,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.name = "",
|
||||
.event = -1,
|
||||
.type = PERF_EVENT_TYPE_MAX,
|
||||
}
|
||||
};
|
||||
|
||||
void PerfList(void)
|
||||
{
|
||||
const PerfEvent *evt = &g_events[0];
|
||||
printf("\n");
|
||||
for (; evt->event != -1; evt++) {
|
||||
printf("\t %-25s%30s\n", evt->name, g_eventTypeStr[evt->type]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
203
apps/perf/src/perf_record.c
Normal file
203
apps/perf/src/perf_record.c
Normal file
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <securec.h>
|
||||
|
||||
#ifdef LOSCFG_FS_VFS
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "perf.h"
|
||||
#include "option.h"
|
||||
#include "perf_record.h"
|
||||
|
||||
#define PERF_FILE_MODE 0644
|
||||
static PerfConfigAttr g_recordAttr;
|
||||
static const char *g_savePath = "/storage/data/perf.data";
|
||||
|
||||
static inline int GetEvents(const char *argv)
|
||||
{
|
||||
return ParseEvents(argv, &g_recordAttr.eventsCfg, &g_recordAttr.eventsCfg.eventsNr);
|
||||
}
|
||||
|
||||
static inline int GetTids(const char *argv)
|
||||
{
|
||||
return ParseIds(argv, (int *)g_recordAttr.taskIds, &g_recordAttr.taskIdsNr);
|
||||
}
|
||||
|
||||
static inline int GetPids(const char *argv)
|
||||
{
|
||||
return ParseIds(argv, (int *)g_recordAttr.processIds, &g_recordAttr.processIdsNr);
|
||||
}
|
||||
|
||||
static PerfOption g_recordOpts[] = {
|
||||
OPTION_CALLBACK("-e", GetEvents),
|
||||
OPTION_CALLBACK("-t", GetTids),
|
||||
OPTION_CALLBACK("-P", GetPids),
|
||||
OPTION_STRING("-o", &g_savePath),
|
||||
OPTION_UINT("-p", &g_recordAttr.eventsCfg.events[0].period),
|
||||
OPTION_UINT("-s", &g_recordAttr.sampleType),
|
||||
OPTION_UINT("-d", &g_recordAttr.eventsCfg.predivided),
|
||||
};
|
||||
|
||||
static int PerfRecordAttrInit(void)
|
||||
{
|
||||
PerfConfigAttr attr = {
|
||||
.eventsCfg = {
|
||||
#ifdef LOSCFG_PERF_HW_PMU
|
||||
.type = PERF_EVENT_TYPE_HW,
|
||||
.events = {
|
||||
[0] = {PERF_COUNT_HW_CPU_CYCLES, 0xFFFF},
|
||||
},
|
||||
#elif defined LOSCFG_PERF_TIMED_PMU
|
||||
.type = PERF_EVENT_TYPE_TIMED,
|
||||
.events = {
|
||||
[0] = {PERF_COUNT_CPU_CLOCK, 100},
|
||||
},
|
||||
#elif defined LOSCFG_PERF_SW_PMU
|
||||
.type = PERF_EVENT_TYPE_SW,
|
||||
.events = {
|
||||
[0] = {PERF_COUNT_SW_TASK_SWITCH, 1},
|
||||
},
|
||||
#endif
|
||||
.eventsNr = 1, /* 1 event */
|
||||
.predivided = 0,
|
||||
},
|
||||
.taskIds = {0},
|
||||
.taskIdsNr = 0,
|
||||
.processIds = {0},
|
||||
.processIdsNr = 0,
|
||||
.needSample = 1,
|
||||
.sampleType = PERF_RECORD_IP | PERF_RECORD_CALLCHAIN,
|
||||
};
|
||||
|
||||
return memcpy_s(&g_recordAttr, sizeof(PerfConfigAttr), &attr, sizeof(PerfConfigAttr)) != EOK ? -1 : 0;
|
||||
}
|
||||
|
||||
ssize_t PerfWriteFile(const char *filePath, const char *buf, ssize_t bufSize)
|
||||
{
|
||||
#ifdef LOSCFG_FS_VFS
|
||||
int fd = -1;
|
||||
ssize_t totalToWrite = bufSize;
|
||||
ssize_t totalWrite = 0;
|
||||
|
||||
if (filePath == NULL || buf == NULL || bufSize == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
fd = open(filePath, O_CREAT | O_RDWR | O_TRUNC, PERF_FILE_MODE);
|
||||
if (fd < 0) {
|
||||
printf("create file [%s] failed, fd: %d, %s!\n", filePath, fd, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
while (totalToWrite > 0) {
|
||||
ssize_t writeThisTime = write(fd, buf, totalToWrite);
|
||||
if (writeThisTime < 0) {
|
||||
printf("failed to write file [%s], %s!\n", filePath, strerror(errno));
|
||||
(void)close(fd);
|
||||
return -1;
|
||||
}
|
||||
buf += writeThisTime;
|
||||
totalToWrite -= writeThisTime;
|
||||
totalWrite += writeThisTime;
|
||||
}
|
||||
(void)fsync(fd);
|
||||
(void)close(fd);
|
||||
|
||||
return (totalWrite == bufSize) ? 0 : -1;
|
||||
#else
|
||||
(void)filePath;
|
||||
PerfPrintBuffer(buf, bufSize);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void PerfRecord(int fd, int argc, char **argv)
|
||||
{
|
||||
int ret;
|
||||
int child;
|
||||
char *buf;
|
||||
ssize_t len;
|
||||
SubCmd cmd = {0};
|
||||
|
||||
if (argc < 3) { /* perf record argc is at least 3 */
|
||||
return;
|
||||
}
|
||||
|
||||
ret = PerfRecordAttrInit();
|
||||
if (ret != 0) {
|
||||
printf("perf record attr init failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = ParseOptions(argc - 2, &argv[2], g_recordOpts, &cmd); /* parse option and cmd begin at index 2 */
|
||||
if (ret != 0) {
|
||||
printf("parse error\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = PerfConfig(fd, &g_recordAttr);
|
||||
if (ret != 0) {
|
||||
printf("perf config failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
PerfStart(fd, 0);
|
||||
child = fork();
|
||||
if (child < 0) {
|
||||
printf("fork error\n");
|
||||
PerfStop(fd);
|
||||
return;
|
||||
} else if (child == 0) {
|
||||
(void)execve(cmd.path, cmd.params, NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
waitpid(child, 0, 0);
|
||||
PerfStop(fd);
|
||||
|
||||
buf = (char *)malloc(LOSCFG_PERF_BUFFER_SIZE);
|
||||
if (buf == NULL) {
|
||||
printf("no memory for read perf 0x%x\n", LOSCFG_PERF_BUFFER_SIZE);
|
||||
return;
|
||||
}
|
||||
len = PerfRead(fd, buf, LOSCFG_PERF_BUFFER_SIZE);
|
||||
ret = PerfWriteFile(g_savePath, buf, len);
|
||||
if (ret == 0) {
|
||||
printf("save perf data success at %s\n", g_savePath);
|
||||
} else {
|
||||
printf("save perf data failed at %s\n", g_savePath);
|
||||
}
|
||||
free(buf);
|
||||
}
|
||||
149
apps/perf/src/perf_stat.c
Normal file
149
apps/perf/src/perf_stat.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <securec.h>
|
||||
#include <sys/wait.h>
|
||||
#include "perf.h"
|
||||
#include "option.h"
|
||||
#include "perf_stat.h"
|
||||
|
||||
static PerfConfigAttr g_statAttr;
|
||||
|
||||
static inline int GetEvents(const char *argv)
|
||||
{
|
||||
return ParseEvents(argv, &g_statAttr.eventsCfg, &g_statAttr.eventsCfg.eventsNr);
|
||||
}
|
||||
|
||||
static inline int GetTids(const char *argv)
|
||||
{
|
||||
return ParseIds(argv, (int *)g_statAttr.taskIds, &g_statAttr.taskIdsNr);
|
||||
}
|
||||
|
||||
static inline int GetPids(const char *argv)
|
||||
{
|
||||
return ParseIds(argv, (int *)g_statAttr.processIds, &g_statAttr.processIdsNr);
|
||||
}
|
||||
|
||||
static PerfOption g_statOpts[] = {
|
||||
OPTION_CALLBACK("-e", GetEvents),
|
||||
OPTION_CALLBACK("-t", GetTids),
|
||||
OPTION_CALLBACK("-P", GetPids),
|
||||
OPTION_UINT("-p", &g_statAttr.eventsCfg.events[0].period),
|
||||
OPTION_UINT("-s", &g_statAttr.sampleType),
|
||||
OPTION_UINT("-d", &g_statAttr.eventsCfg.predivided),
|
||||
};
|
||||
|
||||
static int PerfStatAttrInit(void)
|
||||
{
|
||||
PerfConfigAttr attr = {
|
||||
.eventsCfg = {
|
||||
#ifdef LOSCFG_PERF_HW_PMU
|
||||
.type = PERF_EVENT_TYPE_HW,
|
||||
.events = {
|
||||
[0] = {PERF_COUNT_HW_CPU_CYCLES, 0xFFFF},
|
||||
[1] = {PERF_COUNT_HW_INSTRUCTIONS, 0xFFFFFF00},
|
||||
[2] = {PERF_COUNT_HW_ICACHE_REFERENCES, 0xFFFF},
|
||||
[3] = {PERF_COUNT_HW_DCACHE_REFERENCES, 0xFFFF},
|
||||
},
|
||||
.eventsNr = 4, /* 4 events */
|
||||
#elif defined LOSCFG_PERF_TIMED_PMU
|
||||
.type = PERF_EVENT_TYPE_TIMED,
|
||||
.events = {
|
||||
[0] = {PERF_COUNT_CPU_CLOCK, 100},
|
||||
},
|
||||
.eventsNr = 1, /* 1 event */
|
||||
#elif defined LOSCFG_PERF_SW_PMU
|
||||
.type = PERF_EVENT_TYPE_SW,
|
||||
.events = {
|
||||
[0] = {PERF_COUNT_SW_TASK_SWITCH, 1},
|
||||
[1] = {PERF_COUNT_SW_IRQ_RESPONSE, 1},
|
||||
[2] = {PERF_COUNT_SW_MEM_ALLOC, 1},
|
||||
[3] = {PERF_COUNT_SW_MUX_PEND, 1},
|
||||
},
|
||||
.eventsNr = 4, /* 4 events */
|
||||
#endif
|
||||
.predivided = 0,
|
||||
},
|
||||
.taskIds = {0},
|
||||
.taskIdsNr = 0,
|
||||
.processIds = {0},
|
||||
.processIdsNr = 0,
|
||||
.needSample = 0,
|
||||
.sampleType = 0,
|
||||
};
|
||||
|
||||
return memcpy_s(&g_statAttr, sizeof(PerfConfigAttr), &attr, sizeof(PerfConfigAttr)) != EOK ? -1 : 0;
|
||||
}
|
||||
|
||||
void PerfStat(int fd, int argc, char **argv)
|
||||
{
|
||||
int ret;
|
||||
int child;
|
||||
SubCmd cmd = {0};
|
||||
|
||||
if (argc < 3) { /* perf stat argc is at least 3 */
|
||||
return;
|
||||
}
|
||||
|
||||
ret = PerfStatAttrInit();
|
||||
if (ret != 0) {
|
||||
printf("perf stat attr init failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = ParseOptions(argc - 2, &argv[2], g_statOpts, &cmd); /* parse option and cmd begin at index 2 */
|
||||
if (ret != 0) {
|
||||
printf("parse error\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = PerfConfig(fd, &g_statAttr);
|
||||
if (ret != 0) {
|
||||
printf("perf config failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
PerfStart(fd, 0);
|
||||
child = fork();
|
||||
if (child < 0) {
|
||||
printf("fork error\n");
|
||||
goto EXIT;
|
||||
} else if (child == 0) {
|
||||
(void)execve(cmd.path, cmd.params, NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
(void)waitpid(child, 0, 0);
|
||||
EXIT:
|
||||
PerfStop(fd);
|
||||
}
|
||||
|
||||
44
apps/shell/BUILD.gn
Normal file
44
apps/shell/BUILD.gn
Normal file
@@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
executable("shell") {
|
||||
sources = [
|
||||
"builtin/cd.c",
|
||||
"src/main.c",
|
||||
"src/shcmd.c",
|
||||
"src/shcmdparse.c",
|
||||
"src/shmsg.c",
|
||||
]
|
||||
|
||||
deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ]
|
||||
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
55
apps/shell/Makefile
Executable file → Normal file
55
apps/shell/Makefile
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
# 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:
|
||||
@@ -27,52 +27,19 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SHELL_DIR := $(dir $(shell pwd))/shell/
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
ifeq ($(APPSTOPDIR), )
|
||||
APPSTOPDIR := $(shell pwd)/../
|
||||
LITEOSTOPDIR = $(APPSTOPDIR)/../
|
||||
endif
|
||||
include $(SHELL_DIR)/../config.mk
|
||||
APPS_OUT := $(OUT)/bin
|
||||
APP_NAME := $(notdir $(shell pwd))
|
||||
|
||||
SECUREC_INCLUDE := $(LITEOSTHIRDPARTY)/bounds_checking_function/include
|
||||
SECUREC_DIR := $(LITEOSTHIRDPARTY)/bounds_checking_function
|
||||
|
||||
LOCAL_SRCS = $(wildcard src/main.c)\
|
||||
$(wildcard src/shcmd.c)\
|
||||
$(wildcard src/shmsg.c)\
|
||||
$(wildcard src/shcmdparse.c)\
|
||||
$(wildcard builtin/cd.c)
|
||||
LOCAL_SRCS += $(wildcard $(LITEOSTHIRDPARTY)/bounds_checking_function/src/*.c)
|
||||
LOCAL_OBJ := $(LOCAL_SRCS:.c=.o)
|
||||
LOCAL_SRCS = $(wildcard src/*.c builtin/*.c)
|
||||
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/*.c)
|
||||
|
||||
LOCAL_INCLUDE := \
|
||||
-I $(SHELL_DIR)/include/ \
|
||||
-I $(SECUREC_INCLUDE)\
|
||||
-I include \
|
||||
-I $(SECUREC_DIR)/include
|
||||
|
||||
LOCAL_FLAGS += $(CFLAGS)
|
||||
LOCAL_FLAGS += $(LOCAL_INCLUDE)
|
||||
|
||||
LDPATH := -L$(SHELL_DIR)/
|
||||
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
|
||||
LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses $(LLVM_SYSROOT)
|
||||
LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT)
|
||||
endif
|
||||
|
||||
SHELLNAME := shell
|
||||
|
||||
all: $(SHELLNAME)
|
||||
|
||||
$(LOCAL_OBJ): %.o : %.c
|
||||
$(HIDE) $(CC) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@
|
||||
|
||||
$(SHELLNAME): $(LOCAL_OBJ)
|
||||
$(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(SHELLNAME) $^ $(LDCFLAGS)
|
||||
$(HIDE) mkdir -p $(APPS_OUT)
|
||||
$(HIDE) $(MV) $(SHELLNAME) $(APPS_OUT)
|
||||
$(HIDE) $(RM) $(LOCAL_OBJ)
|
||||
|
||||
clean:
|
||||
$(HIDE) $(RM) $(LOCAL_OBJ)
|
||||
$(HIDE) $(RM) $(SHELLNAME)
|
||||
|
||||
.PHONY: all $(SHELLNAME) clean
|
||||
include $(APP)
|
||||
|
||||
21
apps/shell/builtin/cd.c
Executable file → Normal file
21
apps/shell/builtin/cd.c
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -29,19 +29,12 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include "unistd.h"
|
||||
#include "shcmd.h"
|
||||
#include "sherr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int Chdir(const char *tgtDir)
|
||||
{
|
||||
@@ -53,17 +46,9 @@ int Chdir(const char *tgtDir)
|
||||
|
||||
ret = chdir(tgtDir);
|
||||
if (ret == 0) {
|
||||
ret = OsShellSetWorkingDirtectory(tgtDir, strlen(tgtDir) + 1); /* 1: the length of '\0' */
|
||||
if (ret != SH_NOK) {
|
||||
return ret;
|
||||
}
|
||||
ret = OsShellSetWorkingDirectory(tgtDir, strlen(tgtDir) + 1); /* 1: the length of '\0' */
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
8
apps/shell/include/shcmd.h
Executable file → Normal file
8
apps/shell/include/shcmd.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -53,7 +53,7 @@ typedef struct {
|
||||
} CmdKeyLink;
|
||||
|
||||
#define NEED_NEW_LINE(timesPrint, lineCap) ((timesPrint) % (lineCap) == 0)
|
||||
#define SCREEN_IS_FULL(timesPrint, lineCap) ((timesPrint) >= ((lineCap) * DEFAULT_SCREEN_HEIGNT))
|
||||
#define SCREEN_IS_FULL(timesPrint, lineCap) ((timesPrint) >= ((lineCap) * DEFAULT_SCREEN_HEIGHT))
|
||||
|
||||
extern unsigned int OsCmdExec(CmdParsed *cmdParsed, char *cmdStr);
|
||||
extern unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size);
|
||||
@@ -62,7 +62,7 @@ extern void OsShellCmdPush(const char *string, CmdKeyLink *cmdKeyLink);
|
||||
extern void OsShellHistoryShow(unsigned int value, ShellCB *shellCB);
|
||||
extern unsigned int OsShellKeyInit(ShellCB *shellCB);
|
||||
extern void OsShellKeyDeInit(CmdKeyLink *cmdKeyLink);
|
||||
extern int OsShellSetWorkingDirtectory(const char *dir, size_t len);
|
||||
extern int OsShellSetWorkingDirectory(const char *dir, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
4
apps/shell/include/shcmdparse.h
Executable file → Normal file
4
apps/shell/include/shcmdparse.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
|
||||
7
apps/shell/include/shell.h
Executable file → Normal file
7
apps/shell/include/shell.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -54,7 +54,7 @@ extern "C" {
|
||||
#define CMD_HISTORY_LEN 10
|
||||
#define CMD_MAX_PATH 256
|
||||
#define DEFAULT_SCREEN_WIDTH 80
|
||||
#define DEFAULT_SCREEN_HEIGNT 24
|
||||
#define DEFAULT_SCREEN_HEIGHT 24
|
||||
|
||||
#define SWITCH_QUOTES_STATUS(qu) do { \
|
||||
if ((qu) == TRUE) { \
|
||||
@@ -67,7 +67,6 @@ extern "C" {
|
||||
#define QUOTES_STATUS_CLOSE(qu) ((qu) == FALSE)
|
||||
#define QUOTES_STATUS_OPEN(qu) ((qu) == TRUE)
|
||||
|
||||
typedef size_t bool;
|
||||
|
||||
typedef struct {
|
||||
unsigned int consoleID;
|
||||
|
||||
29
apps/shell/include/shell_list.h
Executable file → Normal file
29
apps/shell/include/shell_list.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -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)
|
||||
|
||||
/**
|
||||
|
||||
10
apps/shell/include/shell_pri.h
Executable file → Normal file
10
apps/shell/include/shell_pri.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -32,9 +32,7 @@
|
||||
#ifndef _SHELL_PRI_H
|
||||
#define _SHELL_PRI_H
|
||||
|
||||
#include "sys/types.h"
|
||||
#include "bits/alltypes.h"
|
||||
#include "shcmd.h"
|
||||
#include "shell.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -42,7 +40,7 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern void *ShellEntry(void *argv);
|
||||
extern void ShellEntry(ShellCB *shellCB);
|
||||
extern void *ShellTask(void *argv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
7
apps/shell/include/sherr.h
Executable file → Normal file
7
apps/shell/include/sherr.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -32,9 +32,6 @@
|
||||
#ifndef _SHERR_H
|
||||
#define _SHERR_H
|
||||
|
||||
#include "sys/types.h"
|
||||
#include "bits/alltypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
|
||||
18
apps/shell/include/shmsg.h
Executable file → Normal file
18
apps/shell/include/shmsg.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -32,6 +32,7 @@
|
||||
#ifndef _SHMSG_H
|
||||
#define _SHMSG_H
|
||||
|
||||
#include "shell_list.h"
|
||||
#include "shell.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -43,8 +44,13 @@ extern "C" {
|
||||
#define SHELL_ENTRY_STACKSIZE 0x1000
|
||||
#define SHELL_TASK_STACKSIZE 0x3000
|
||||
|
||||
#define SHELL_EXEC_COMMAND "exec "
|
||||
#define SHELL_EXEC_COMMAND_BYTES 5
|
||||
#define SHELL_EXEC_COMMAND "exec"
|
||||
#define SHELL_EXEC_COMMAND_BYTES 4
|
||||
#define CMD_EXEC_COMMAND SHELL_EXEC_COMMAND" "
|
||||
#define CMD_EXEC_COMMAND_BYTES (SHELL_EXEC_COMMAND_BYTES + 1)
|
||||
#define CMD_EXIT_COMMAND "exit"
|
||||
#define CMD_EXIT_COMMAND_BYTES 4
|
||||
#define CMD_EXIT_CODE_BASE_DEC 10
|
||||
|
||||
#define CONSOLE_IOC_MAGIC 'c'
|
||||
#define CONSOLE_CONTROL_REG_USERTASK _IO(CONSOLE_IOC_MAGIC, 7)
|
||||
@@ -54,9 +60,9 @@ extern "C" {
|
||||
#define COLOR_L_RED "\e[1;31m"
|
||||
#define SHELL_PROMPT COLOR_L_RED"OHOS # "COLOR_NONE
|
||||
|
||||
typedef void (*OutputFunc)(const char *fmt, ...);
|
||||
typedef void (* OutputFunc)(const char *fmt, ...);
|
||||
extern int ShellTaskInit(ShellCB *shellCB);
|
||||
extern int ShellEntryInit(ShellCB *shellCB);
|
||||
extern void ChildExec(const char *cmdName, char *const paramArray[], bool foreground);
|
||||
extern void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB);
|
||||
extern int ShellNotify(ShellCB *shellCB);
|
||||
|
||||
|
||||
10
apps/shell/include/show.h
Executable file → Normal file
10
apps/shell/include/show.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -42,10 +42,10 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern char *OsShellGetWorkingDirtectory();
|
||||
extern unsigned int OsShellInit();
|
||||
extern char *OsShellGetWorkingDirectory(void);
|
||||
extern unsigned int OsShellInit(void);
|
||||
extern int OsShellDeinit(ShellCB *shellCB);
|
||||
extern ShellCB *OsGetShellCb();
|
||||
extern ShellCB *OsGetShellCb(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
102
apps/shell/src/main.c
Executable file → Normal file
102
apps/shell/src/main.c
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -29,18 +29,18 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#include "show.h"
|
||||
#include "shmsg.h"
|
||||
#include "shcmd.h"
|
||||
#include "shell_pri.h"
|
||||
#include "semaphore.h"
|
||||
#include "securec.h"
|
||||
#include "unistd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
ShellCB *g_shellCB = NULL;
|
||||
|
||||
@@ -49,7 +49,7 @@ ShellCB *OsGetShellCb()
|
||||
return g_shellCB;
|
||||
}
|
||||
|
||||
void ShellDeinit(ShellCB *shellCB)
|
||||
static void ShellDeinit(ShellCB *shellCB)
|
||||
{
|
||||
(void)pthread_mutex_destroy(&shellCB->historyMutex);
|
||||
(void)pthread_mutex_destroy(&shellCB->keyMutex);
|
||||
@@ -65,42 +65,86 @@ static int OsShellCreateTask(ShellCB *shellCB)
|
||||
|
||||
ret = sched_getparam(getpid(), ¶m);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
param.sched_priority = SHELL_PROCESS_PRIORITY_INIT;
|
||||
|
||||
ret = sched_setparam(getpid(), ¶m);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ShellTaskInit(shellCB);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ShellEntryInit(shellCB);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
shellCB->shellEntryHandle = pthread_self();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int DoShellExec(char **argv)
|
||||
{
|
||||
int i, j;
|
||||
int len = 0;
|
||||
int ret = SH_NOK;
|
||||
char *cmdLine = NULL;
|
||||
|
||||
if (strncmp(argv[0], SHELL_EXEC_COMMAND, SHELL_EXEC_COMMAND_BYTES) == 0) {
|
||||
ChildExec(argv[1], argv + 1, FALSE);
|
||||
}
|
||||
for (i = 0; argv[i]; i++) {
|
||||
len += strlen(argv[i]);
|
||||
}
|
||||
len += i + 1;
|
||||
cmdLine = (char *)malloc(len);
|
||||
if (!cmdLine) {
|
||||
return ret;
|
||||
}
|
||||
errno_t ret1 = memset_s(cmdLine, len, 0, len);
|
||||
if (ret1 != EOK) {
|
||||
free(cmdLine);
|
||||
return ret1;
|
||||
}
|
||||
|
||||
(void)pthread_join(shellCB->shellTaskHandle, NULL);
|
||||
(void)pthread_join(shellCB->shellEntryHandle, NULL);
|
||||
for (j = 0; j < i; j++) {
|
||||
(void)strcat_s(cmdLine, len, argv[j]);
|
||||
(void)strcat_s(cmdLine, len, " ");
|
||||
}
|
||||
|
||||
OUT:
|
||||
ShellDeinit(shellCB);
|
||||
cmdLine[len - 2] = '\0'; /* 2, (len - 2) is the end of cmdline buf */
|
||||
ret = syscall(__NR_shellexec, argv[0], cmdLine);
|
||||
free(cmdLine);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main()
|
||||
static void ShellSigChildHook(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
|
||||
while (waitpid(-1, NULL, WNOHANG) > 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ret = SH_NOK;
|
||||
ShellCB *shellCB = NULL;
|
||||
|
||||
(void)signal(SIGCHLD, ShellSigChildHook);
|
||||
|
||||
if (argc > 1) {
|
||||
ret = DoShellExec(argv + 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
shellCB = (ShellCB *)malloc(sizeof(ShellCB));
|
||||
if (shellCB == NULL) {
|
||||
goto ERR_OUT1;
|
||||
return SH_NOK;
|
||||
}
|
||||
ret = memset_s(shellCB, sizeof(ShellCB), 0, sizeof(ShellCB));
|
||||
if (ret != SH_OK) {
|
||||
@@ -126,7 +170,14 @@ int main()
|
||||
sem_init(&shellCB->shellSem, 0, 0);
|
||||
|
||||
g_shellCB = shellCB;
|
||||
return OsShellCreateTask(shellCB);
|
||||
ret = OsShellCreateTask(shellCB);
|
||||
if (ret != SH_OK) {
|
||||
ShellDeinit(shellCB);
|
||||
g_shellCB = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ShellEntry(shellCB);
|
||||
|
||||
ERR_OUT3:
|
||||
(void)pthread_mutex_destroy(&shellCB->historyMutex);
|
||||
@@ -137,8 +188,3 @@ ERR_OUT1:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
53
apps/shell/src/shcmd.c
Executable file → Normal file
53
apps/shell/src/shcmd.c
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -36,12 +36,6 @@
|
||||
#include "dirent.h"
|
||||
#include "securec.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define SHELL_INIT_MAGIC_FLAG 0xABABABAB
|
||||
#define CTRL_C 0x03 /* 0x03: ctrl+c ASCII */
|
||||
|
||||
@@ -85,7 +79,7 @@ static int OsStrSeparateTabStrGet(const char **tabStr, CmdParsed *parsed, unsign
|
||||
if ((strlen(shiftStr) == 0) || (tempStr[strlen(tempStr) - 1] != shiftStr[strlen(shiftStr) - 1])) {
|
||||
*tabStr = "";
|
||||
} else {
|
||||
if (OsCmdTokenSplit(shiftStr, ' ', parsed)) {
|
||||
if (OsCmdParse(shiftStr, parsed)) {
|
||||
free(tempStr);
|
||||
return (int)SH_ERROR;
|
||||
}
|
||||
@@ -96,12 +90,12 @@ static int OsStrSeparateTabStrGet(const char **tabStr, CmdParsed *parsed, unsign
|
||||
return SH_OK;
|
||||
}
|
||||
|
||||
char *OsShellGetWorkingDirtectory()
|
||||
char *OsShellGetWorkingDirectory(void)
|
||||
{
|
||||
return OsGetShellCb()->shellWorkingDirectory;
|
||||
}
|
||||
|
||||
int OsShellSetWorkingDirtectory(const char *dir, size_t len)
|
||||
int OsShellSetWorkingDirectory(const char *dir, size_t len)
|
||||
{
|
||||
if (dir == NULL) {
|
||||
return SH_NOK;
|
||||
@@ -120,7 +114,7 @@ static int OsStrSeparate(const char *tabStr, char *strPath, char *nameLooking, u
|
||||
char *strEnd = NULL;
|
||||
char *cutPos = NULL;
|
||||
CmdParsed parsed = {0};
|
||||
char *shellWorkingDirectory = OsShellGetWorkingDirtectory();
|
||||
char *shellWorkingDirectory = OsShellGetWorkingDirectory();
|
||||
int ret;
|
||||
|
||||
ret = OsStrSeparateTabStrGet(&tabStr, &parsed, tabStrLen);
|
||||
@@ -201,7 +195,7 @@ static int OsSurePrintAll(unsigned int count)
|
||||
char readChar = 0;
|
||||
printf("\nDisplay all %u possibilities?(y/n)", count);
|
||||
while (1) {
|
||||
if (read(0, &readChar, 1) != 1) {
|
||||
if (read(STDIN_FILENO, &readChar, 1) != 1) {
|
||||
return (int)SH_ERROR;
|
||||
}
|
||||
if ((readChar == 'n') || (readChar == 'N') || (readChar == CTRL_C)) {
|
||||
@@ -228,7 +222,7 @@ static int OsPrintMatchList(unsigned int count, const char *strPath, const char
|
||||
return (int)SH_ERROR;
|
||||
}
|
||||
|
||||
if (count > (lineCap * DEFAULT_SCREEN_HEIGNT)) {
|
||||
if (count > (lineCap * DEFAULT_SCREEN_HEIGHT)) {
|
||||
ret = OsSurePrintAll(count);
|
||||
if (ret != 1) {
|
||||
return ret;
|
||||
@@ -380,10 +374,10 @@ static int OsTabMatchFile(char *cmdKey, unsigned int *len)
|
||||
}
|
||||
|
||||
/*
|
||||
* Description: Pass in the string and clear useless space ,which inlcude:
|
||||
* Description: Pass in the string and clear useless space ,which include:
|
||||
* 1) The overmatch space which is not be marked by Quote's area
|
||||
* Squeeze the overmatch space into one space
|
||||
* 2) Clear all space before first vaild charatctor
|
||||
* 2) Clear all space before first valid character
|
||||
* Input: cmdKey : Pass in the buff string, which is ready to be operated
|
||||
* cmdOut : Pass out the buffer string ,which has already been operated
|
||||
* size : cmdKey length
|
||||
@@ -406,23 +400,23 @@ unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size)
|
||||
}
|
||||
output = (char *)malloc(len + 1);
|
||||
if (output == NULL) {
|
||||
printf("malloc failure in %s[%d]", __FUNCTION__, __LINE__);
|
||||
printf("malloc failure in %s[%d]\n", __FUNCTION__, __LINE__);
|
||||
return (unsigned int)SH_ERROR;
|
||||
}
|
||||
|
||||
/* Backup the 'output' start address */
|
||||
outputBak = output;
|
||||
/* Scan each charactor in 'cmdKey',and squeeze the overmuch space and ignore invaild charactor */
|
||||
/* Scan each character in 'cmdKey',and squeeze the overmuch space and ignore invalid character */
|
||||
for (; *cmdKey != '\0'; cmdKey++) {
|
||||
/* Detected a Double Quotes, switch the matching status */
|
||||
if (*(cmdKey) == '\"') {
|
||||
SWITCH_QUOTES_STATUS(quotes);
|
||||
}
|
||||
/* Ignore the current charactor in following situation */
|
||||
/* Ignore the current character in following situation */
|
||||
/* 1) Quotes matching status is FALSE (which said that the space is not been marked by double quotes) */
|
||||
/* 2) Current charactor is a space */
|
||||
/* 3) Next charactor is a space too, or the string is been seeked to the end already(\0) */
|
||||
/* 4) Invaild charactor, such as single quotes */
|
||||
/* 2) Current character is a space */
|
||||
/* 3) Next character is a space too, or the string is been seeked to the end already(\0) */
|
||||
/* 4) Invalid character, such as single quotes */
|
||||
if ((*cmdKey == ' ') && ((*(cmdKey + 1) == ' ') || (*(cmdKey + 1) == '\0')) && QUOTES_STATUS_CLOSE(quotes)) {
|
||||
continue;
|
||||
}
|
||||
@@ -436,7 +430,7 @@ unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size)
|
||||
/* Restore the 'output' start address */
|
||||
output = outputBak;
|
||||
len = strlen(output);
|
||||
/* Clear the space which is located at the first charactor in buffer */
|
||||
/* Clear the space which is located at the first character in buffer */
|
||||
if (*output == ' ') {
|
||||
output++;
|
||||
len--;
|
||||
@@ -453,20 +447,15 @@ unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size)
|
||||
free(outputBak);
|
||||
return SH_OK;
|
||||
}
|
||||
|
||||
int OsTabCompletion(char *cmdKey, unsigned int *len)
|
||||
{
|
||||
int count;
|
||||
char *cmdMainStr = cmdKey;
|
||||
|
||||
if ((cmdKey == NULL) || (len == NULL)) {
|
||||
return (int)SH_ERROR;
|
||||
}
|
||||
|
||||
/* cut left space */
|
||||
while (*cmdMainStr == 0x20) {
|
||||
cmdMainStr++;
|
||||
}
|
||||
|
||||
count = OsTabMatchFile(cmdKey, len);
|
||||
|
||||
return count;
|
||||
@@ -595,7 +584,6 @@ END:
|
||||
|
||||
unsigned int OsCmdExec(CmdParsed *cmdParsed, char *cmdStr)
|
||||
{
|
||||
/* TODO: complete the usrspace command */
|
||||
unsigned int ret = SH_OK;
|
||||
if (cmdParsed && cmdStr) {
|
||||
ret = SH_NOK;
|
||||
@@ -604,8 +592,3 @@ unsigned int OsCmdExec(CmdParsed *cmdParsed, char *cmdStr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
14
apps/shell/src/shcmdparse.c
Executable file → Normal file
14
apps/shell/src/shcmdparse.c
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -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
|
||||
|
||||
231
apps/shell/src/shmsg.c
Executable file → Normal file
231
apps/shell/src/shmsg.c
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -29,6 +29,8 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "stdio.h"
|
||||
#include "unistd.h"
|
||||
@@ -42,12 +44,10 @@
|
||||
#include "shell_pri.h"
|
||||
#include "shcmd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#define CHAR_CTRL_C '\x03'
|
||||
#define CHAR_CTRL_DEL '\x7F'
|
||||
|
||||
#define VISIABLE_CHAR(ch) ((ch) > 0x1F && (ch) < 0x7F)
|
||||
|
||||
char *GetCmdline(ShellCB *shellCB)
|
||||
{
|
||||
@@ -61,9 +61,19 @@ char *GetCmdline(ShellCB *shellCB)
|
||||
}
|
||||
|
||||
cmdNode = SH_LIST_ENTRY(cmdkey->list.pstNext, CmdKeyLink, list);
|
||||
if (cmdNode == NULL) {
|
||||
(void)pthread_mutex_unlock(&shellCB->keyMutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SH_ListDelete(&(cmdNode->list));
|
||||
(void)pthread_mutex_unlock(&shellCB->keyMutex);
|
||||
|
||||
if (strlen(cmdNode->cmdString) == 0) {
|
||||
free(cmdNode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return cmdNode->cmdString;
|
||||
}
|
||||
|
||||
@@ -73,7 +83,8 @@ static void ShellSaveHistoryCmd(char *string, ShellCB *shellCB)
|
||||
CmdKeyLink *cmdkey = SH_LIST_ENTRY(string, CmdKeyLink, cmdString);
|
||||
CmdKeyLink *cmdNxt = NULL;
|
||||
|
||||
if ((string == NULL) || (*string == '\n') || (strlen(string) == 0)) {
|
||||
if (*string == '\n') {
|
||||
free(cmdkey);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -87,7 +98,7 @@ static void ShellSaveHistoryCmd(char *string, ShellCB *shellCB)
|
||||
}
|
||||
}
|
||||
|
||||
if (cmdHistory->count == CMD_HISTORY_LEN) {
|
||||
if (cmdHistory->count >= CMD_HISTORY_LEN) {
|
||||
cmdNxt = SH_LIST_ENTRY(cmdHistory->list.pstNext, CmdKeyLink, list);
|
||||
SH_ListDelete(&(cmdNxt->list));
|
||||
SH_ListTailInsert(&(cmdHistory->list), &(cmdkey->list));
|
||||
@@ -122,7 +133,7 @@ int ShellNotify(ShellCB *shellCB)
|
||||
}
|
||||
|
||||
enum {
|
||||
STAT_NOMAL_KEY,
|
||||
STAT_NORMAL_KEY,
|
||||
STAT_ESC_KEY,
|
||||
STAT_MULTI_KEY
|
||||
};
|
||||
@@ -141,23 +152,23 @@ static int ShellCmdLineCheckUDRL(const char ch, ShellCB *shellCB)
|
||||
} else if (ch == 0x41) { /* up */
|
||||
if (shellCB->shellKeyType == STAT_MULTI_KEY) {
|
||||
OsShellHistoryShow(CMD_KEY_UP, shellCB);
|
||||
shellCB->shellKeyType = STAT_NOMAL_KEY;
|
||||
shellCB->shellKeyType = STAT_NORMAL_KEY;
|
||||
return ret;
|
||||
}
|
||||
} else if (ch == 0x42) { /* down */
|
||||
if (shellCB->shellKeyType == STAT_MULTI_KEY) {
|
||||
shellCB->shellKeyType = STAT_NOMAL_KEY;
|
||||
shellCB->shellKeyType = STAT_NORMAL_KEY;
|
||||
OsShellHistoryShow(CMD_KEY_DOWN, shellCB);
|
||||
return ret;
|
||||
}
|
||||
} else if (ch == 0x43) { /* right */
|
||||
if (shellCB->shellKeyType == STAT_MULTI_KEY) {
|
||||
shellCB->shellKeyType = STAT_NOMAL_KEY;
|
||||
shellCB->shellKeyType = STAT_NORMAL_KEY;
|
||||
return ret;
|
||||
}
|
||||
} else if (ch == 0x44) { /* left */
|
||||
if (shellCB->shellKeyType == STAT_MULTI_KEY) {
|
||||
shellCB->shellKeyType = STAT_NOMAL_KEY;
|
||||
shellCB->shellKeyType = STAT_NORMAL_KEY;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -194,7 +205,21 @@ void ParseEnterKey(OutputFunc outputFunc, ShellCB *shellCB)
|
||||
shellCB->shellBuf[shellCB->shellBufOffset] = '\0';
|
||||
}
|
||||
NOTIFY:
|
||||
outputFunc("\n");
|
||||
shellCB->shellBufOffset = 0;
|
||||
ShellTaskNotify(shellCB);
|
||||
}
|
||||
|
||||
void ParseCancelKey(OutputFunc outputFunc, ShellCB *shellCB)
|
||||
{
|
||||
if ((shellCB == NULL) || (outputFunc == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (shellCB->shellBufOffset <= (SHOW_MAX_LEN - 1)) {
|
||||
shellCB->shellBuf[0] = CHAR_CTRL_C;
|
||||
shellCB->shellBuf[1] = '\0';
|
||||
}
|
||||
|
||||
shellCB->shellBufOffset = 0;
|
||||
ShellTaskNotify(shellCB);
|
||||
}
|
||||
@@ -230,7 +255,7 @@ void ParseTabKey(OutputFunc outputFunc, ShellCB *shellCB)
|
||||
|
||||
void ParseNormalChar(char ch, OutputFunc outputFunc, ShellCB *shellCB)
|
||||
{
|
||||
if ((shellCB == NULL) || (outputFunc == NULL)) {
|
||||
if ((shellCB == NULL) || (outputFunc == NULL) || !VISIABLE_CHAR(ch)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -240,7 +265,7 @@ void ParseNormalChar(char ch, OutputFunc outputFunc, ShellCB *shellCB)
|
||||
outputFunc("%c", ch);
|
||||
}
|
||||
|
||||
shellCB->shellKeyType = STAT_NOMAL_KEY;
|
||||
shellCB->shellKeyType = STAT_NORMAL_KEY;
|
||||
}
|
||||
|
||||
void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB)
|
||||
@@ -248,7 +273,7 @@ void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB)
|
||||
const char ch = c;
|
||||
int ret;
|
||||
|
||||
if ((shellCB->shellBufOffset == 0) && (ch != '\n') && (ch != '\0')) {
|
||||
if ((shellCB->shellBufOffset == 0) && (ch != '\n') && (ch != CHAR_CTRL_C) && (ch != '\0')) {
|
||||
(void)memset_s(shellCB->shellBuf, SHOW_MAX_LEN, 0, SHOW_MAX_LEN);
|
||||
}
|
||||
|
||||
@@ -257,8 +282,11 @@ void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB)
|
||||
case '\n': /* enter */
|
||||
ParseEnterKey(outputFunc, shellCB);
|
||||
break;
|
||||
case CHAR_CTRL_C: /* ctrl + c */
|
||||
ParseCancelKey(outputFunc, shellCB);
|
||||
break;
|
||||
case '\b': /* backspace */
|
||||
case 0x7F: /* delete(0x7F) */
|
||||
case CHAR_CTRL_DEL: /* delete(0x7F) */
|
||||
ParseDeleteKey(outputFunc, shellCB);
|
||||
break;
|
||||
case '\t': /* tab */
|
||||
@@ -306,12 +334,12 @@ char *GetCmdName(const char *cmdline, unsigned int len)
|
||||
/* If reach a double quotes, switch the quotes matching status */
|
||||
if (*tmpStr == '\"') {
|
||||
SWITCH_QUOTES_STATUS(quotes);
|
||||
/* Ignore the double quote charactor itself */
|
||||
/* Ignore the double quote character itself */
|
||||
tmpStr++;
|
||||
continue;
|
||||
}
|
||||
/* If detected a space which the quotes matching status is false */
|
||||
/* which said has detected the first space for seperator, finish this scan operation */
|
||||
/* which said has detected the first space for separator, finish this scan operation */
|
||||
if ((*tmpStr == ' ') && (QUOTES_STATUS_CLOSE(quotes))) {
|
||||
break;
|
||||
}
|
||||
@@ -323,29 +351,94 @@ char *GetCmdName(const char *cmdline, unsigned int len)
|
||||
return cmdName;
|
||||
}
|
||||
|
||||
static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len, const CmdParsed *cmdParsed)
|
||||
void ChildExec(const char *cmdName, char *const paramArray[], bool foreground)
|
||||
{
|
||||
int ret;
|
||||
pid_t gid;
|
||||
|
||||
ret = setpgrp();
|
||||
if (ret == -1) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
gid = getpgrp();
|
||||
if (gid < 0) {
|
||||
printf("get group id failed, pgrpid %d, errno %d\n", gid, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!foreground) {
|
||||
ret = tcsetpgrp(STDIN_FILENO, gid);
|
||||
if (ret != 0) {
|
||||
printf("tcsetpgrp failed, errno %d\n", errno);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
ret = execve(cmdName, paramArray, NULL);
|
||||
if (ret == -1) {
|
||||
perror("execve");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
int CheckExit(const char *cmdName, const CmdParsed *cmdParsed)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (strlen(cmdName) != CMD_EXIT_COMMAND_BYTES || strncmp(cmdName, CMD_EXIT_COMMAND, CMD_EXIT_COMMAND_BYTES) != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cmdParsed->paramCnt > 1) {
|
||||
printf("exit: too many arguments\n");
|
||||
return -1;
|
||||
}
|
||||
if (cmdParsed->paramCnt == 1) {
|
||||
char *p = NULL;
|
||||
ret = strtol(cmdParsed->paramArray[0], &p, CMD_EXIT_CODE_BASE_DEC);
|
||||
if (*p != '\0') {
|
||||
printf("exit: bad number: %s\n", cmdParsed->paramArray[0]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len, CmdParsed *cmdParsed)
|
||||
{
|
||||
bool foreground = FALSE;
|
||||
int ret;
|
||||
pid_t forkPid;
|
||||
|
||||
if (strncmp(cmdline, SHELL_EXEC_COMMAND, SHELL_EXEC_COMMAND_BYTES) == 0) {
|
||||
if (strncmp(cmdline, CMD_EXEC_COMMAND, CMD_EXEC_COMMAND_BYTES) == 0) {
|
||||
if ((cmdParsed->paramCnt > 1) && (strcmp(cmdParsed->paramArray[cmdParsed->paramCnt - 1], "&") == 0)) {
|
||||
free(cmdParsed->paramArray[cmdParsed->paramCnt - 1]);
|
||||
cmdParsed->paramArray[cmdParsed->paramCnt - 1] = NULL;
|
||||
cmdParsed->paramCnt--;
|
||||
foreground = TRUE;
|
||||
}
|
||||
|
||||
forkPid = fork();
|
||||
if (forkPid < 0) {
|
||||
printf("Faild to fork from shell\n");
|
||||
printf("Failed to fork from shell\n");
|
||||
return;
|
||||
} else if (forkPid == 0) {
|
||||
ret = setpgrp();
|
||||
if (ret == -1) {
|
||||
exit(1);
|
||||
ChildExec(cmdParsed->paramArray[0], cmdParsed->paramArray, foreground);
|
||||
} else {
|
||||
if (!foreground) {
|
||||
(void)waitpid(forkPid, 0, 0);
|
||||
}
|
||||
|
||||
ret = execve((const char *)cmdParsed->paramArray[0], (char * const *)cmdParsed->paramArray, NULL);
|
||||
if (ret == -1) {
|
||||
perror("execve");
|
||||
exit(-1);
|
||||
ret = tcsetpgrp(STDIN_FILENO, getpid());
|
||||
if (ret != 0) {
|
||||
printf("tcsetpgrp failed, errno %d\n", errno);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (CheckExit(cmdName, cmdParsed) < 0) {
|
||||
return;
|
||||
}
|
||||
(void)syscall(__NR_shellexec, cmdName, cmdline);
|
||||
}
|
||||
}
|
||||
@@ -380,7 +473,7 @@ static void ParseAndExecCmdline(CmdParsed *cmdParsed, const char *cmdline, unsig
|
||||
DoCmdExec(cmdName, cmdlineOrigin, len, cmdParsed);
|
||||
|
||||
if (getcwd(shellWorkingDirectory, PATH_MAX) != NULL) {
|
||||
(void)OsShellSetWorkingDirtectory(shellWorkingDirectory, (PATH_MAX + 1));
|
||||
(void)OsShellSetWorkingDirectory(shellWorkingDirectory, (PATH_MAX + 1));
|
||||
}
|
||||
|
||||
OUT:
|
||||
@@ -400,7 +493,7 @@ unsigned int PreHandleCmdline(const char *input, char **output, unsigned int *ou
|
||||
unsigned int removeLen = strlen("./"); /* "./" needs to be removed if it exists */
|
||||
unsigned int ret;
|
||||
char *newCmd = NULL;
|
||||
char *execCmd = SHELL_EXEC_COMMAND;
|
||||
char *execCmd = CMD_EXEC_COMMAND;
|
||||
const char *cmdBuf = input;
|
||||
unsigned int cmdBufLen = strlen(cmdBuf);
|
||||
char *shiftStr = (char *)malloc(cmdBufLen + 1);
|
||||
@@ -422,7 +515,7 @@ unsigned int PreHandleCmdline(const char *input, char **output, unsigned int *ou
|
||||
*output = shiftStr;
|
||||
*outputlen = shiftLen;
|
||||
|
||||
/* Check and parse "./", located at the first two charaters of the cmd */
|
||||
/* Check and parse "./", located at the first two characters of the cmd */
|
||||
if ((shiftLen > removeLen) && (shiftStr[0] == '.') && (shiftStr[1] == '/')) {
|
||||
execLen = strlen(execCmd);
|
||||
newLen = execLen + shiftLen - removeLen; /* i.e., newLen - execLen == shiftLen - removeLen */
|
||||
@@ -486,24 +579,18 @@ static void ExecCmdline(const char *cmdline)
|
||||
free(output);
|
||||
}
|
||||
|
||||
void RecycleZombieChild(void)
|
||||
{
|
||||
while (waitpid(-1, NULL, WNOHANG) > 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
static void ShellCmdProcess(ShellCB *shellCB)
|
||||
{
|
||||
char *buf = NULL;
|
||||
while (1) {
|
||||
/* recycle zombine child process */
|
||||
RecycleZombieChild();
|
||||
buf = GetCmdline(shellCB);
|
||||
char *buf = GetCmdline(shellCB);
|
||||
if (buf == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (buf[0] == CHAR_CTRL_C) {
|
||||
printf("^C");
|
||||
buf[0] = '\n';
|
||||
}
|
||||
printf("\n");
|
||||
ExecCmdline(buf);
|
||||
ShellSaveHistoryCmd(buf, shellCB);
|
||||
shellCB->cmdMaskKeyLink = shellCB->cmdHistoryKeyLink;
|
||||
@@ -566,28 +653,22 @@ int ShellTaskInit(ShellCB *shellCB)
|
||||
|
||||
static int ShellKernelReg(unsigned int shellHandle)
|
||||
{
|
||||
return ioctl(0, CONSOLE_CONTROL_REG_USERTASK, shellHandle);
|
||||
return ioctl(STDIN_FILENO, CONSOLE_CONTROL_REG_USERTASK, shellHandle);
|
||||
}
|
||||
|
||||
void *ShellEntry(void *argv)
|
||||
void ShellEntry(ShellCB *shellCB)
|
||||
{
|
||||
char ch;
|
||||
int ret;
|
||||
int n;
|
||||
pid_t tid = syscall(__NR_gettid);
|
||||
ShellCB *shellCB = (ShellCB *)argv;
|
||||
|
||||
if (shellCB == NULL) {
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
(void)memset_s(shellCB->shellBuf, SHOW_MAX_LEN, 0, SHOW_MAX_LEN);
|
||||
|
||||
ret = prctl(PR_SET_NAME, "ShellEntry");
|
||||
if (ret != SH_OK) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = ShellKernelReg((int)tid);
|
||||
if (ret != 0) {
|
||||
printf("another shell is already running!\n");
|
||||
@@ -595,46 +676,10 @@ void *ShellEntry(void *argv)
|
||||
}
|
||||
|
||||
while (1) {
|
||||
/* is console ready for shell ? */
|
||||
if (ret != SH_OK)
|
||||
break;
|
||||
|
||||
n = read(0, &ch, 1);
|
||||
if (n == 1) {
|
||||
ShellCmdLineParse(ch, (OutputFunc)printf, shellCB);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
int ShellEntryInit(ShellCB *shellCB)
|
||||
{
|
||||
int ret;
|
||||
size_t stackSize = SHELL_ENTRY_STACKSIZE;
|
||||
void *arg = NULL;
|
||||
pthread_attr_t attr;
|
||||
|
||||
if (shellCB == NULL) {
|
||||
return SH_NOK;
|
||||
}
|
||||
|
||||
ret = pthread_attr_init(&attr);
|
||||
if (ret != SH_OK) {
|
||||
return SH_NOK;
|
||||
}
|
||||
|
||||
pthread_attr_setstacksize(&attr, stackSize);
|
||||
arg = (void *)shellCB;
|
||||
ret = pthread_create(&shellCB->shellEntryHandle, &attr, &ShellEntry, arg);
|
||||
if (ret != SH_OK) {
|
||||
return SH_NOK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
41
apps/tftp/BUILD.gn
Normal file
41
apps/tftp/BUILD.gn
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
executable("tftp") {
|
||||
sources = [
|
||||
"src/main.c",
|
||||
"src/tftpc.c",
|
||||
]
|
||||
|
||||
deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ]
|
||||
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
45
apps/tftp/Makefile
Normal file
45
apps/tftp/Makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
APP_NAME := $(notdir $(shell pwd))
|
||||
|
||||
SECUREC_DIR := $(LITEOSTHIRDPARTY)/bounds_checking_function
|
||||
|
||||
LOCAL_SRCS = $(wildcard src/*.c)
|
||||
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/*.c)
|
||||
|
||||
LOCAL_INCLUDE := \
|
||||
-I include \
|
||||
-I $(SECUREC_DIR)/include
|
||||
|
||||
LOCAL_FLAGS += $(LOCAL_INCLUDE)
|
||||
|
||||
include $(APP)
|
||||
309
apps/tftp/include/tftpc.h
Normal file
309
apps/tftp/include/tftpc.h
Normal file
@@ -0,0 +1,309 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef TFTPC_H
|
||||
#define TFTPC_H
|
||||
|
||||
#include "types_adapt.h"
|
||||
|
||||
#if LWIP_TFTP /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
#if defined (__cplusplus) && __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TFTP_NULL_UINT32 ((u32_t)0xffffffffUL)
|
||||
|
||||
#define TFTP_NULL_INT32 (-1)
|
||||
|
||||
/** @cond liteos
|
||||
* @defgroup TFTP_Interfaces
|
||||
* @ingroup Enums
|
||||
* * This section contains the TFTP enums.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* This Enum is used to specify the transfer mode of the file to be handled by TFTP client.
|
||||
*/
|
||||
typedef enum tagTFTPC_TransferMode {
|
||||
TRANSFER_MODE_ASCII = 0, /**< Indicates that the mode of transfer is ASCII. */
|
||||
TRANSFER_MODE_BINARY, /**< Indicates that the mode of transfer is Binary */
|
||||
TRANSFER_MODE_BUTT /**< Indicates invalid transfer mode.*/
|
||||
} TFTPC_TRANSFER_MODE_E;
|
||||
|
||||
/**
|
||||
* This Enum is used to specify the transfer mode to be handled by TFTP client
|
||||
* This Enum indicates the TFTP client transfer mode of the file
|
||||
|
||||
*/
|
||||
typedef enum tagTFTPC_ErrCode {
|
||||
TFTPC_SOCKET_FAILURE = 1, /**< Error while creating UDP socket. */
|
||||
TFTPC_BIND_FAILURE = 2, /**< Error while binding to the UDP socket. */
|
||||
TFTPC_SELECT_ERROR = 3, /**< Error returned by select() system call. */
|
||||
TFTPC_RECVFROM_ERROR = 4, /**< Error while receiving data from the peer. */
|
||||
TFTPC_SENDTO_ERROR = 5, /**< Error while sending data to the peer. */
|
||||
TFTPC_FILE_NOT_FOUND = 6, /**< Requested file is not found. */
|
||||
|
||||
/**< This is the error sent by the server when host name cannot be resolved. */
|
||||
TFTPC_CANNOT_RESOLVE_HOSTNAME = 7,
|
||||
TFTPC_INVALID_PARAVALUE = 8, /**< Input parameters passed to TFTP interfaces are invalid. */
|
||||
|
||||
/**< Error detected in TFTP packet or the error received from the TFTP server. */
|
||||
TFTPC_PROTO_ERROR = 9,
|
||||
/**< Error during packet synchronization while sending or unexpected packet is received. */
|
||||
TFTPC_SYNC_FAILURE = 10,
|
||||
/**< File size limit crossed, Max block can be 0xFFFF, each block containing 512 bytes. */
|
||||
TFTPC_FILE_TOO_BIG = 11,
|
||||
TFTPC_SRC_FILENAME_LENGTH_ERROR = 12, /**< File name length greater than 256. */
|
||||
TFTPC_IP_NOT_WITHIN_RANGE = 13, /**< Host name IP is not valid. */
|
||||
TFTPC_ACCESS_ERROR = 14, /**< TFTP server returned file access error. */
|
||||
|
||||
/**< TFTP server returned error signifying that the DISK is full to write. */
|
||||
TFTPC_DISK_FULL = 15,
|
||||
TFTPC_FILE_EXISTS = 16, /**< TFTP server returned error signifying that the file exists. */
|
||||
|
||||
/**< tftp_put_file_by_filename returned error signifying that the source file name do not exist. */
|
||||
TFTPC_FILE_NOT_EXIST = 17,
|
||||
TFTPC_MEMALLOC_ERROR = 18, /**< Memory allocation failed in TFTP client. */
|
||||
TFTPC_FILEOPEN_ERROR = 19, /**< File open failed. */
|
||||
TFTPC_FILEREAD_ERROR = 20, /**< File read error. */
|
||||
TFTPC_FILECREATE_ERROR = 21, /**< File create error. */
|
||||
TFTPC_FILEWRITE_ERROR = 22, /**< File write error. */
|
||||
TFTPC_TIMEOUT_ERROR = 23, /**< Max time expired while waiting for file to be received. */
|
||||
|
||||
/**< Error when the received packet is less than 4 bytes (error length) or greater than 512 bytes. */
|
||||
TFTPC_PKT_SIZE_ERROR = 24,
|
||||
TFTPC_ERROR_NOT_DEFINED = 25, /**< Returned by TFTP server for protocol user error. */
|
||||
TFTPC_DEST_PATH_LENGTH_ERROR = 26, /**< If the destination file path length is greater than 256. */
|
||||
TFTPC_UNKNOWN_TRANSFER_ID = 27, /**< Returned by TFTP server for undefined transfer ID. */
|
||||
|
||||
/**< IOCTL function failed at TFTP client while setting the socket to non-block. */
|
||||
TFTPC_IOCTLSOCKET_FAILURE = 28,
|
||||
TFTPC_MEMCPY_FAILURE = 29 /**< TFTP memcpy failure. */
|
||||
} TFTPC_ERR_CODE_E;
|
||||
|
||||
typedef enum tagTFTPC_OpCode {
|
||||
TFTPC_OP_RRQ = 1, /* read request */
|
||||
TFTPC_OP_WRQ, /* write request */
|
||||
TFTPC_OP_DATA, /* data packet */
|
||||
TFTPC_OP_ACK, /* acknowledgment */
|
||||
TFTPC_OP_ERROR, /* error code */
|
||||
TFTPC_OP_OPT /* option code */
|
||||
} TFTPC_OPCODE_E;
|
||||
|
||||
typedef enum tagTFTPC_PROTOCOL_ErrCode {
|
||||
TFTPC_PROTOCOL_USER_DEFINED = 0,
|
||||
TFTPC_PROTOCOL_FILE_NOT_FOUND,
|
||||
TFTPC_PROTOCOL_ACCESS_ERROR,
|
||||
TFTPC_PROTOCOL_DISK_FULL,
|
||||
TFTPC_PROTOCOL_PROTO_ERROR,
|
||||
TFTPC_PROTOCOL_UNKNOWN_TRANSFER_ID,
|
||||
TFTPC_PROTOCOL_FILE_EXISTS,
|
||||
TFTPC_PROTOCOL_CANNOT_RESOLVE_HOSTNAME
|
||||
} TFTPC_PROT_ERRCODE_E;
|
||||
|
||||
|
||||
#ifndef TFTPC_MAX_SEND_REQ_ATTEMPTS
|
||||
#define TFTPC_MAX_SEND_REQ_ATTEMPTS 5 /* tftp max attempts */
|
||||
#endif
|
||||
|
||||
#ifndef TFTPC_TIMEOUT_PERIOD
|
||||
#define TFTPC_TIMEOUT_PERIOD 5 /* tftp timeout period,unit :s */
|
||||
#endif
|
||||
|
||||
#define TFTPC_SERVER_PORT 69 /* tftp server well known port no. */
|
||||
|
||||
/* MAX file size in TFTP is 32 MB.
|
||||
Reason for keeping 75 here , is ((75*512=38400bytes)/1024) = 37MB. So the recv/Send Loop can
|
||||
receive the complete MAX message from the network
|
||||
*/
|
||||
#define TFTPC_MAX_WAIT_IN_LOOP 75
|
||||
|
||||
#define TFTP_BLKSIZE 512 /* data block size (IEN-133) */
|
||||
#define TFTP_HDRSIZE 4 /* TFTP header size */
|
||||
#define TFTP_PKTSIZE (TFTP_BLKSIZE + TFTP_HDRSIZE) /* Packet size */
|
||||
#define TFTP_MAX_MODE_SIZE 9 /* max size of mode string */
|
||||
#define TFTP_MAXERRSTRSIZE 100 /* max size of error message string */
|
||||
#define TFTP_MAX_PATH_LENGTH 256 /* Max path or filename length */
|
||||
#define TFTP_MAX_BLK_NUM (0xFFFFL) /* MAximum block number */
|
||||
|
||||
/* IP address not including reserved IPs(0 and 127) and multicast addresses(Class D) */
|
||||
#define TFTPC_IP_ADDR_MIN 0x01000000
|
||||
#define TFTPC_IP_ADDR_EX_RESV 0x7effffff
|
||||
#define TFTPC_IP_ADDR_CLASS_B 0x80000000
|
||||
#define TFTPC_IP_ADDR_EX_CLASS_DE 0xdfffffff
|
||||
|
||||
#define TFTPC_FOUR 4 /* minimum packet size */
|
||||
|
||||
/****************************************************************************/
|
||||
/* Structure definitions */
|
||||
/****************************************************************************/
|
||||
/* Tftp data packet */
|
||||
typedef struct tagTFTPC_DATA {
|
||||
u16_t usBlknum; /* block number */
|
||||
u8_t ucDataBuf[TFTP_BLKSIZE]; /* Actual data */
|
||||
} TFTPC_DATA_S;
|
||||
|
||||
|
||||
/* TFTP error packet */
|
||||
typedef struct tagTFTPC_ERROR {
|
||||
u16_t usErrNum; /* error number */
|
||||
u8_t ucErrMesg[TFTP_MAXERRSTRSIZE]; /* error message */
|
||||
} TFTPC_ERROR_S;
|
||||
|
||||
|
||||
/* TFTP packet format */
|
||||
typedef struct tagTFTPC_PACKET {
|
||||
u16_t usOpcode; /* Opcode value */
|
||||
union {
|
||||
/* it contains mode and filename */
|
||||
s8_t ucName_Mode[TFTP_MAX_PATH_LENGTH + TFTP_MAX_MODE_SIZE];
|
||||
u16_t usBlknum; /* Block Number */
|
||||
TFTPC_DATA_S stTFTP_Data; /* Data Packet */
|
||||
TFTPC_ERROR_S stTFTP_Err; /* Error Packet */
|
||||
} u;
|
||||
} TFTPC_PACKET_S;
|
||||
|
||||
|
||||
/** @defgroup TFTP_Interfaces
|
||||
* This section contains the TFTP Interfaces
|
||||
*/
|
||||
/*
|
||||
Func Name: lwip_tftp_get_file_by_filename
|
||||
*/
|
||||
/**
|
||||
* @ingroup TFTP_Interfaces
|
||||
* @brief
|
||||
* This API gets the source file from the server. It then stores the received file in the destination path
|
||||
* on the client system.
|
||||
*
|
||||
* @param[in] ulHostAddr IP address of Host. This is the TFTP server IP. [NA]
|
||||
* @param[in] usTftpServPort TFTP server port. If the value is passed as 0 then the default TFTP
|
||||
* PORT 69 is used. [NA]
|
||||
* @param[in] ucTftpTransMode File transfer mode, either TRANSFER_MODE_BINARY or TRANSFER_MODE_ASCII. [NA]
|
||||
* @param[in] szSrcFileName Source file in the tftp server. [NA]
|
||||
* @param[in] szDestDirPath Destination file path in the in the client. [NA]
|
||||
* @param[out] [N/A]
|
||||
*
|
||||
* @return
|
||||
* ERR_OK: On success \n
|
||||
* TFTPC_ERR_CODE_E: On failure
|
||||
*
|
||||
* @note
|
||||
* \n
|
||||
* The behavior of this API is such that if the destination file already exists, it will be overwritten.
|
||||
*/
|
||||
u32_t lwip_tftp_get_file_by_filename(u32_t ulHostAddr,
|
||||
u16_t usTftpServPort,
|
||||
u8_t ucTftpTransMode,
|
||||
s8_t *szSrcFileName,
|
||||
s8_t *szDestDirPath);
|
||||
|
||||
|
||||
/* @defgroup TFTP_Interfaces
|
||||
* This section contains the TFTP Interfaces
|
||||
*/
|
||||
/*
|
||||
Func Name: lwip_tftp_put_file_by_filename
|
||||
*/
|
||||
/**
|
||||
* @ingroup TFTP_Interfaces
|
||||
|
||||
* @brief
|
||||
* This API reads the contents of the source file on the client system and sends it to the server and
|
||||
* server then receives the data and stores it in the specified destination path.
|
||||
*
|
||||
* @param[in] ulHostAddr Indicates the IP address of Host. This is the TFTP server IP.
|
||||
* @param[in] usTftpServPort Indicates the TFTP server port. If the value is passed as 0 then the default TFTP
|
||||
* PORT 69 is used.
|
||||
* @param[in] ucTftpTransMode Indicates the file transfer mode, either TRANSFER_MODE_BINARY or TRANSFER_MODE_ASCII.
|
||||
* @param[in] szSrcFileName Indicates the source file in the client.
|
||||
* @param[in] szDestDirPath Indicates the destination file path on the tftp server.
|
||||
*
|
||||
* @return
|
||||
* ERR_OK: On success \n
|
||||
* TFTPC_ERR_CODE_E: On failure
|
||||
*
|
||||
*/
|
||||
u32_t lwip_tftp_put_file_by_filename(u32_t ulHostAddr,
|
||||
u16_t usTftpServPort,
|
||||
u8_t cTftpTransMode,
|
||||
s8_t *szSrcFileName,
|
||||
s8_t *szDestDirPath);
|
||||
|
||||
#ifdef TFTP_TO_RAWMEM
|
||||
/* @defgroup TFTP_Interfaces
|
||||
* This section contains the TFTP Interfaces
|
||||
*/
|
||||
/*
|
||||
Func Name: lwip_tftp_get_file_by_filename_to_rawmem
|
||||
*/
|
||||
/**
|
||||
* @ingroup TFTP_Interfaces
|
||||
|
||||
* @brief
|
||||
* This API gets the source file from the server. It then stores the received file in the target memory
|
||||
* on the client system.
|
||||
*
|
||||
* @param[in] ulHostAddr Indicates the IP address of the Host. This is the TFTP server IP.
|
||||
* @param[in] usTftpServPort Indicates the TFTP server port. If the value is passed as 0 then the default TFTP
|
||||
* PORT 69 is used.
|
||||
* @param[in] ucTftpTransMode Indicates the File transfer mode, either TRANSFER_MODE_BINARY or TRANSFER_MODE_ASCII.
|
||||
* @param[in] szSrcFileName Indicates the Source file in the TFTP server.
|
||||
* @param[in] szDestMemAddr Indicates the target memory address in the client.
|
||||
* @param[in/out] ulFileLength Indicates the target memory address can cache the size of the content,
|
||||
and The real size of the Source file.
|
||||
*
|
||||
* @return
|
||||
* ERR_OK: On success \n
|
||||
* TFTPC_ERR_CODE_E: On failure
|
||||
* @note
|
||||
|
||||
* 1.You must define TFTP_TO_RAWMEM when using this API. \n
|
||||
* 2.The behavior of this API is such that if the destination file already exists, it will be overwritten.
|
||||
* @endcond
|
||||
*/
|
||||
|
||||
u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr,
|
||||
u16_t usTftpServPort,
|
||||
u8_t ucTftpTransMode,
|
||||
s8_t *szSrcFileName,
|
||||
s8_t *szDestMemAddr,
|
||||
u32_t *ulFileLength);
|
||||
#endif
|
||||
|
||||
#if defined (__cplusplus) && __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_TFTP */
|
||||
|
||||
#endif /* TFTPC_H */
|
||||
88
apps/tftp/include/types_adapt.h
Normal file
88
apps/tftp/include/types_adapt.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef TYPES_ADAPT_H
|
||||
#define TYPES_ADAPT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#define LWIP_TFTP 1
|
||||
#define LOSCFG_NET_LWIP_SACK_TFTP 1
|
||||
#define LOSCFG_SHELL_CMD_DEBUG 1
|
||||
|
||||
#define u8_t uint8_t
|
||||
#define s8_t int8_t
|
||||
#define u16_t uint16_t
|
||||
#define s16_t int16_t
|
||||
#define u32_t uint32_t
|
||||
#define s32_t int32_t
|
||||
|
||||
#define X8_F "02" PRIx8
|
||||
#define U16_F PRIu16
|
||||
#define S16_F PRId16
|
||||
#define X16_F PRIx16
|
||||
#define U32_F PRIu32
|
||||
#define S32_F PRId32
|
||||
#define X32_F PRIx32
|
||||
#define SZT_F PRIuPTR
|
||||
|
||||
#define PRINTK(fmt, ...) printf(fmt, ##__VA_ARGS__)
|
||||
#define LWIP_ASSERT(msg, expr) assert(expr)
|
||||
#define LWIP_DEBUGF(module, msg) PRINTK msg
|
||||
|
||||
#define LOS_OK 0
|
||||
#define LOS_NOK 1
|
||||
#define ERR_OK 0
|
||||
#define EOK 0
|
||||
|
||||
#define mem_malloc malloc
|
||||
#define mem_free free
|
||||
#define lwip_socket socket
|
||||
#define lwip_ioctl ioctl
|
||||
#define lwip_close close
|
||||
#define lwip_bind bind
|
||||
#define lwip_sendto sendto
|
||||
#define lwip_recvfrom recvfrom
|
||||
|
||||
#define IPADDR_NONE INADDR_NONE
|
||||
#define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
|
||||
|
||||
#define SHELLCMD_ENTRY(l, cmdType, cmdKey, paraNum, cmdHook) \
|
||||
int main(int argc, const char **argv) \
|
||||
{ \
|
||||
return (int)cmdHook(argc, argv); \
|
||||
}
|
||||
|
||||
typedef u32_t (*CmdCallBackFunc)(u32_t argc, const char **argv);
|
||||
|
||||
#endif /* TYPES_ADAPT_H */
|
||||
160
apps/tftp/src/main.c
Normal file
160
apps/tftp/src/main.c
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "tftpc.h"
|
||||
|
||||
#ifdef LOSCFG_NET_LWIP_SACK_TFTP
|
||||
static int tcpip_init_finish = 1;
|
||||
static char *TftpError[] = {
|
||||
"TFTP transfer finish\n",
|
||||
"Error while creating UDP socket\n",
|
||||
"Error while binding to the UDP socket\n",
|
||||
"Error returned by select() system call\n",
|
||||
"Error while receiving data from the peer\n",
|
||||
"Error while sending data to the peer\n",
|
||||
"Requested file is not found\n",
|
||||
"This is the error sent by the server when hostname cannot be resolved\n",
|
||||
"Input parameters passed to TFTP interfaces are invalid\n",
|
||||
"Error detected in TFTP packet or the error received from the TFTP server\n",
|
||||
"Error during packet synhronization while sending or unexpected packet is received\n",
|
||||
"File size limit crossed, Max block can be 0xFFFF, each block containing 512 bytes\n",
|
||||
"File name length greater than 256\n",
|
||||
"Hostname IP is not valid\n",
|
||||
"TFTP server returned file access error\n",
|
||||
"TFTP server returned error signifying that the DISK is full to write\n",
|
||||
"TFTP server returned error signifying that the file exist\n",
|
||||
"The source file name do not exisits\n",
|
||||
"Memory allocaion failed in TFTP client\n",
|
||||
"File open failed\n",
|
||||
"File read error\n",
|
||||
"File create error\n",
|
||||
"File write error\n",
|
||||
"Max time expired while waiting for file to be recived\n",
|
||||
"Error when the received packet is less than 4bytes(error length) or greater than 512bytes\n",
|
||||
"Returned by TFTP server for protocol user error\n",
|
||||
"The destination file path length greater than 256\n",
|
||||
"Returned by TFTP server for undefined transfer ID\n",
|
||||
"IOCTL function failed at TFTP client while setting the socket to non-block\n",
|
||||
};
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
|
||||
#endif
|
||||
|
||||
u32_t osShellTftp(int argc, const char **argv)
|
||||
{
|
||||
u32_t ulRemoteAddr = IPADDR_NONE;
|
||||
const u16_t usTftpServPort = 69;
|
||||
u8_t ucTftpGet = 0;
|
||||
s8_t *szLocalFileName = NULL;
|
||||
s8_t *szRemoteFileName = NULL;
|
||||
u32_t ret;
|
||||
|
||||
int i = 1;
|
||||
if (argc < 1 || argv == NULL) {
|
||||
goto usage;
|
||||
}
|
||||
|
||||
if (!tcpip_init_finish) {
|
||||
PRINTK("%s: tcpip_init have not been called\n", __FUNCTION__);
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
while (i < argc) {
|
||||
if (strcmp(argv[i], "-p") == 0) {
|
||||
ucTftpGet = 0;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i], "-g") == 0) {
|
||||
ucTftpGet = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i], "-l") == 0 && ((i + 1) < argc)) {
|
||||
szLocalFileName = (s8_t *)argv[i + 1];
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i], "-r") == 0 && ((i + 1) < argc)) {
|
||||
szRemoteFileName = (s8_t *)argv[i + 1];
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((i + 1) == argc) {
|
||||
ulRemoteAddr = inet_addr(argv[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
goto usage;
|
||||
}
|
||||
|
||||
if (ulRemoteAddr == IPADDR_NONE || szLocalFileName == NULL || szRemoteFileName == NULL) {
|
||||
goto usage;
|
||||
}
|
||||
|
||||
if (ucTftpGet) {
|
||||
ret = lwip_tftp_get_file_by_filename(ntohl(ulRemoteAddr), usTftpServPort,
|
||||
TRANSFER_MODE_BINARY, szRemoteFileName, szLocalFileName);
|
||||
} else {
|
||||
ret = lwip_tftp_put_file_by_filename(ntohl(ulRemoteAddr), usTftpServPort,
|
||||
TRANSFER_MODE_BINARY, szLocalFileName, szRemoteFileName);
|
||||
}
|
||||
|
||||
LWIP_ASSERT("TFTP UNKNOW ERROR!", ret < ARRAY_SIZE(TftpError));
|
||||
PRINTK("%s", TftpError[ret]);
|
||||
if (ret) {
|
||||
return LOS_NOK;
|
||||
} else {
|
||||
return LOS_OK;
|
||||
}
|
||||
usage:
|
||||
PRINTK("usage:\nTransfer a file from/to tftp server\n");
|
||||
PRINTK("tftp <-g/-p> -l FullPathLocalFile -r RemoteFile Host\n");
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_SHELL_CMD_DEBUG
|
||||
SHELLCMD_ENTRY(tftp_shellcmd, CMD_TYPE_EX, "tftp", XARGS, (CmdCallBackFunc)(uintptr_t)osShellTftp);
|
||||
#endif /* LOSCFG_SHELL_CMD_DEBUG */
|
||||
#endif /* LOSCFG_NET_LWIP_SACK_TFTP */
|
||||
1718
apps/tftp/src/tftpc.c
Normal file
1718
apps/tftp/src/tftpc.c
Normal file
File diff suppressed because it is too large
Load Diff
84
apps/toybox/BUILD.gn
Normal file
84
apps/toybox/BUILD.gn
Normal file
@@ -0,0 +1,84 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/toybox/toybox.gni")
|
||||
|
||||
group("toybox") {
|
||||
deps = [ ":build_toybox" ]
|
||||
}
|
||||
|
||||
copy("copy_toybox_src") {
|
||||
sources = TOYBOX_SRC_DIR
|
||||
outputs = [ "$target_out_dir/toybox_build" ]
|
||||
}
|
||||
|
||||
copy("copy_toybox_config") {
|
||||
deps = [ ":copy_toybox_src" ]
|
||||
sources = [ "liteos_a_custom.config" ]
|
||||
outputs = [ "$target_out_dir/{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
build_ext_component("build_toybox") {
|
||||
deps = [
|
||||
":copy_toybox_config",
|
||||
":copy_toybox_src",
|
||||
]
|
||||
deps += [ "//third_party/musl:sysroot_lite" ]
|
||||
exec_path = rebase_path("$target_out_dir/toybox_build")
|
||||
|
||||
cflags = [
|
||||
"-fstack-protector-strong",
|
||||
"-D_FORTIFY_SOURCE=2",
|
||||
]
|
||||
cflags = string_join(" ", cflags)
|
||||
|
||||
extra_flags = string_join(" ", target_arch_cflags)
|
||||
if (ohos_build_compiler == "clang") {
|
||||
extra_flags += " --target=$target_triple"
|
||||
extra_flags += " --sysroot=" + rebase_path(ohos_current_sysroot)
|
||||
}
|
||||
|
||||
command = "rm -rf .git && cp -rfp porting/liteos_a/. . && env"
|
||||
command += " CC=\"$ohos_current_cc_command\""
|
||||
command += " STRIP=\"$ohos_current_strip_command\""
|
||||
command += " OUTNAME=toybox"
|
||||
command += " CFLAGS=\"$cflags $extra_flags\""
|
||||
command += " make toybox"
|
||||
command += " && install -D toybox "
|
||||
command += rebase_path("$root_out_dir/bin/toybox", exec_path)
|
||||
command += " && install -D generated/unstripped/toybox "
|
||||
command += rebase_path("$root_out_dir/unstripped/bin/toybox", exec_path)
|
||||
|
||||
outputs = [
|
||||
"$root_out_dir/unstripped/bin/toybox",
|
||||
"$root_out_dir/bin/toybox",
|
||||
]
|
||||
}
|
||||
53
apps/toybox/Makefile
Normal file
53
apps/toybox/Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
BUILD_DIR := $(OUT)/toybox_build
|
||||
BUILD_LOG := $(BUILD_DIR)/build.log
|
||||
|
||||
CFLAGS += -Wno-error
|
||||
|
||||
all:
|
||||
ifneq ($(wildcard $(BUILD_DIR)),)
|
||||
$(HIDE)echo "not clean, rebuilding now"
|
||||
else
|
||||
$(HIDE)mkdir -p $(BUILD_DIR)
|
||||
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/toybox/. $(BUILD_DIR)
|
||||
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/toybox/porting/liteos_a/. $(BUILD_DIR)
|
||||
$(HIDE)$(CP) liteos_a_custom.config $(BUILD_DIR)/../
|
||||
endif
|
||||
$(HIDE)unset KCONFIG_CONFIG CROSS_COMPILE && \
|
||||
env CC="$(CC)" OUTNAME="$(OUT)/bin/toybox" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" STRIP="$(STRIP)" \
|
||||
make -C $(BUILD_DIR) toybox -j> $(BUILD_LOG) 2>&1
|
||||
|
||||
clean:
|
||||
$(HIDE)$(RM) $(BUILD_DIR)
|
||||
|
||||
.PHONY: all clean
|
||||
186
apps/toybox/liteos_a_custom.config
Normal file
186
apps/toybox/liteos_a_custom.config
Normal file
@@ -0,0 +1,186 @@
|
||||
# CONFIG_BASENAME is not set
|
||||
# CONFIG_CAL is not set
|
||||
# CONFIG_CAT is not set
|
||||
# CONFIG_CATV is not set
|
||||
# CONFIG_CKSUM is not set
|
||||
# CONFIG_CRC32 is not set
|
||||
# CONFIG_CMP is not set
|
||||
# CONFIG_COMM is not set
|
||||
# CONFIG_CP_PRESERVE is not set
|
||||
# CONFIG_INSTALL is not set
|
||||
# CONFIG_CPIO is not set
|
||||
# CONFIG_CUT is not set
|
||||
# CONFIG_DF is not set
|
||||
# CONFIG_DIRNAME is not set
|
||||
# CONFIG_ECHO is not set
|
||||
# CONFIG_ENV is not set
|
||||
# CONFIG_EXPAND is not set
|
||||
# CONFIG_FALSE is not set
|
||||
# CONFIG_FILE is not set
|
||||
# CONFIG_FIND is not set
|
||||
# CONFIG_GETCONF is not set
|
||||
# CONFIG_GREP is not set
|
||||
# CONFIG_EGREP is not set
|
||||
# CONFIG_FGREP is not set
|
||||
# CONFIG_HEAD is not set
|
||||
# CONFIG_ICONV is not set
|
||||
# CONFIG_ID is not set
|
||||
# CONFIG_GROUPS is not set
|
||||
# CONFIG_LOGNAME is not set
|
||||
# CONFIG_WHOAMI is not set
|
||||
# CONFIG_LINK is not set
|
||||
# CONFIG_LN is not set
|
||||
# CONFIG_LOGGER is not set
|
||||
# CONFIG_MKFIFO is not set
|
||||
# CONFIG_NICE is not set
|
||||
# CONFIG_NL is not set
|
||||
# CONFIG_NOHUP is not set
|
||||
# CONFIG_OD is not set
|
||||
# CONFIG_PASTE is not set
|
||||
# CONFIG_PATCH is not set
|
||||
# CONFIG_PRINTF is not set
|
||||
# CONFIG_IOTOP is not set
|
||||
# CONFIG_PGREP is not set
|
||||
# CONFIG_PKILL is not set
|
||||
# CONFIG_PWD is not set
|
||||
# CONFIG_RENICE is not set
|
||||
# CONFIG_SED is not set
|
||||
# CONFIG_SLEEP is not set
|
||||
# CONFIG_SORT is not set
|
||||
# CONFIG_SORT_FLOAT is not set
|
||||
# CONFIG_SPLIT is not set
|
||||
# CONFIG_STRINGS is not set
|
||||
# CONFIG_TAIL is not set
|
||||
# CONFIG_TAR is not set
|
||||
# CONFIG_TEE is not set
|
||||
# CONFIG_TEST is not set
|
||||
# CONFIG_TIME is not set
|
||||
# CONFIG_TRUE is not set
|
||||
# CONFIG_TTY is not set
|
||||
# CONFIG_ULIMIT is not set
|
||||
# CONFIG_ARCH is not set
|
||||
# CONFIG_UNIQ is not set
|
||||
# CONFIG_UNLINK is not set
|
||||
# CONFIG_UUDECODE is not set
|
||||
# CONFIG_UUENCODE is not set
|
||||
# CONFIG_WC is not set
|
||||
# CONFIG_WHO is not set
|
||||
# CONFIG_XARGS is not set
|
||||
# CONFIG_ACPI is not set
|
||||
# CONFIG_ASCII is not set
|
||||
# CONFIG_BASE64 is not set
|
||||
# CONFIG_BLKID is not set
|
||||
# CONFIG_FSTYPE is not set
|
||||
# CONFIG_BLOCKDEV is not set
|
||||
# CONFIG_BUNZIP2 is not set
|
||||
# CONFIG_BZCAT is not set
|
||||
# CONFIG_CHROOT is not set
|
||||
# CONFIG_CHRT is not set
|
||||
# CONFIG_CHVT is not set
|
||||
# CONFIG_CLEAR is not set
|
||||
# CONFIG_COUNT is not set
|
||||
# CONFIG_DEVMEM is not set
|
||||
# CONFIG_DOS2UNIX is not set
|
||||
# CONFIG_UNIX2DOS is not set
|
||||
# CONFIG_EJECT is not set
|
||||
# CONFIG_FACTOR is not set
|
||||
# CONFIG_FALLOCATE is not set
|
||||
# CONFIG_FLOCK is not set
|
||||
# CONFIG_FMT is not set
|
||||
# CONFIG_FREERAMDISK is not set
|
||||
# CONFIG_FSFREEZE is not set
|
||||
# CONFIG_FSYNC is not set
|
||||
# CONFIG_HELP_EXTRAS is not set
|
||||
# CONFIG_HEXEDIT is not set
|
||||
# CONFIG_HWCLOCK is not set
|
||||
# CONFIG_I2CDETECT is not set
|
||||
# CONFIG_I2CDUMP is not set
|
||||
# CONFIG_I2CGET is not set
|
||||
# CONFIG_I2CSET is not set
|
||||
# CONFIG_INOTIFYD is not set
|
||||
# CONFIG_INSMOD is not set
|
||||
# CONFIG_IONICE is not set
|
||||
# CONFIG_IORENICE is not set
|
||||
# CONFIG_LOGIN is not set
|
||||
# CONFIG_LOSETUP is not set
|
||||
# CONFIG_LSATTR is not set
|
||||
# CONFIG_CHATTR is not set
|
||||
# CONFIG_LSMOD is not set
|
||||
# CONFIG_LSPCI is not set
|
||||
# CONFIG_LSPCI_TEXT is not set
|
||||
# CONFIG_LSUSB is not set
|
||||
# CONFIG_MAKEDEVS is not set
|
||||
# CONFIG_MCOOKIE is not set
|
||||
# CONFIG_MIX is not set
|
||||
# CONFIG_MKPASSWD is not set
|
||||
# CONFIG_MKSWAP is not set
|
||||
# CONFIG_MODINFO is not set
|
||||
# CONFIG_MOUNTPOINT is not set
|
||||
# CONFIG_NBD_CLIENT is not set
|
||||
# CONFIG_UNSHARE is not set
|
||||
# CONFIG_NSENTER is not set
|
||||
# CONFIG_ONEIT is not set
|
||||
# CONFIG_PARTPROBE is not set
|
||||
# CONFIG_PIVOT_ROOT is not set
|
||||
# CONFIG_PMAP is not set
|
||||
# CONFIG_PRINTENV is not set
|
||||
# CONFIG_PWDX is not set
|
||||
# CONFIG_READAHEAD is not set
|
||||
# CONFIG_READLINK is not set
|
||||
# CONFIG_REALPATH is not set
|
||||
# CONFIG_RESET is not set
|
||||
# CONFIG_REV is not set
|
||||
# CONFIG_RMMOD is not set
|
||||
# CONFIG_SETFATTR is not set
|
||||
# CONFIG_SETSID is not set
|
||||
# CONFIG_SHRED is not set
|
||||
# CONFIG_STAT is not set
|
||||
# CONFIG_SWAPOFF is not set
|
||||
# CONFIG_SWAPON is not set
|
||||
# CONFIG_SWITCH_ROOT is not set
|
||||
# CONFIG_SYSCTL is not set
|
||||
# CONFIG_TAC is not set
|
||||
# CONFIG_NPROC is not set
|
||||
# CONFIG_TASKSET is not set
|
||||
# CONFIG_TIMEOUT is not set
|
||||
# CONFIG_TRUNCATE is not set
|
||||
# CONFIG_UPTIME is not set
|
||||
# CONFIG_USLEEP is not set
|
||||
# CONFIG_UUIDGEN is not set
|
||||
# CONFIG_VCONFIG is not set
|
||||
# CONFIG_VMSTAT is not set
|
||||
# CONFIG_W is not set
|
||||
# CONFIG_WATCH is not set
|
||||
# CONFIG_WHICH is not set
|
||||
# CONFIG_XXD is not set
|
||||
# CONFIG_YES is not set
|
||||
# CONFIG_FTPGET is not set
|
||||
# CONFIG_FTPPUT is not set
|
||||
# CONFIG_MICROCOM is not set
|
||||
# CONFIG_NETCAT is not set
|
||||
# CONFIG_NETCAT_LISTEN is not set
|
||||
# CONFIG_NETSTAT is not set
|
||||
# CONFIG_RFKILL is not set
|
||||
# CONFIG_SNTP is not set
|
||||
# CONFIG_TUNCTL is not set
|
||||
# CONFIG_DMESG is not set
|
||||
# CONFIG_GUNZIP is not set
|
||||
# CONFIG_ZCAT is not set
|
||||
# CONFIG_HOSTNAME is not set
|
||||
# CONFIG_DNSDOMAINNAME is not set
|
||||
# CONFIG_KILLALL is not set
|
||||
# CONFIG_MD5SUM is not set
|
||||
# CONFIG_SHA1SUM is not set
|
||||
# CONFIG_MKNOD is not set
|
||||
# CONFIG_MKTEMP is not set
|
||||
# CONFIG_PASSWD is not set
|
||||
# CONFIG_PIDOF is not set
|
||||
# CONFIG_SEQ is not set
|
||||
# CONFIG_SU is not set
|
||||
# CONFIG_SYNC is not set
|
||||
#
|
||||
# pending (see toys/pending/README)
|
||||
#
|
||||
# CONFIG_GETTY is not set
|
||||
# CONFIG_MDEV is not set
|
||||
# CONFIG_MDEV_CONF is not set
|
||||
12
tools/build/mk/dynload.mk → apps/trace/BUILD.gn
Executable file → Normal file
12
tools/build/mk/dynload.mk → apps/trace/BUILD.gn
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
# 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:
|
||||
@@ -27,8 +27,8 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
DYNLOADTESTDIR := $(LITEOSTOPDIR)/test/kernel/sample/kernel_extend/dynload
|
||||
export DYNLOADTESTDIR
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
##### command to test dynload #####
|
||||
-include $(DYNLOADTESTDIR)/test_dynload.mk
|
||||
executable("trace") {
|
||||
sources = [ "src/trace.c" ]
|
||||
}
|
||||
76
apps/module.mk → apps/trace/Makefile
Executable file → Normal file
76
apps/module.mk → apps/trace/Makefile
Executable file → Normal file
@@ -1,40 +1,36 @@
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, 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.
|
||||
|
||||
APP_SUBDIRS :=
|
||||
|
||||
##compile modules config##
|
||||
|
||||
ifeq ($(LOSCFG_SHELL), y)
|
||||
APP_SUBDIRS += shell
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_USER_INIT_DEBUG), y)
|
||||
APP_SUBDIRS += init
|
||||
endif
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
APP_NAME := $(notdir $(shell pwd))
|
||||
|
||||
LOCAL_SRCS := src/trace.c
|
||||
|
||||
include $(APP)
|
||||
141
apps/trace/src/trace.c
Normal file
141
apps/trace/src/trace.c
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define TRACE_IOC_MAGIC 'T'
|
||||
#define TRACE_START _IO(TRACE_IOC_MAGIC, 1)
|
||||
#define TRACE_STOP _IO(TRACE_IOC_MAGIC, 2)
|
||||
#define TRACE_RESET _IO(TRACE_IOC_MAGIC, 3)
|
||||
#define TRACE_DUMP _IO(TRACE_IOC_MAGIC, 4)
|
||||
#define TRACE_SET_MASK _IO(TRACE_IOC_MAGIC, 5)
|
||||
|
||||
#define TRACE_USR_MAX_PARAMS 3
|
||||
typedef struct {
|
||||
unsigned int eventType;
|
||||
uintptr_t identity;
|
||||
uintptr_t params[TRACE_USR_MAX_PARAMS];
|
||||
} UsrEventInfo;
|
||||
|
||||
static void TraceUsage(void)
|
||||
{
|
||||
printf("\nUsage: ./trace [start] Start to trace events.\n");
|
||||
printf("\nUsage: ./trace [stop] Stop trace.\n");
|
||||
printf("\nUsage: ./trace [reset] Clear the trace record buffer.\n");
|
||||
printf("\nUsage: ./trace [dump 0/1] Format printf trace data,"
|
||||
"0/1 stands for whether to send data to studio for analysis.\n");
|
||||
printf("\nUsage: ./trace [mask num] Set trace filter event mask.\n");
|
||||
printf("\nUsage: ./trace [read nBytes] Read nBytes raw data from trace buffer.\n");
|
||||
printf("\nUsage: ./trace [write type id params..] Write a user event, no more than 3 parameters.\n");
|
||||
}
|
||||
|
||||
static void TraceRead(int fd, size_t size)
|
||||
{
|
||||
ssize_t i;
|
||||
ssize_t len;
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
char *buffer = (char *)malloc(size);
|
||||
if (buffer == NULL) {
|
||||
printf("Read buffer malloc failed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
len = read(fd, buffer, size);
|
||||
for (i = 0; i < len; i++) {
|
||||
printf("%02x ", buffer[i] & 0xFF);
|
||||
}
|
||||
printf("\n");
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
static void TraceWrite(int fd, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
UsrEventInfo info = {0};
|
||||
info.eventType = strtoul(argv[2], NULL, 0); /* 2, argv number */
|
||||
info.identity = strtoul(argv[3], NULL, 0); /* 3, argv number */
|
||||
/* 4, argc -4 means user argv that does not contain argv[0]~argv[3] */
|
||||
int paramNum = (argc - 4) > TRACE_USR_MAX_PARAMS ? TRACE_USR_MAX_PARAMS : (argc - 4);
|
||||
|
||||
for (i = 0; i < paramNum; i++) {
|
||||
/* 4, argc -4 means user argv that does not contain argv[0]~argv[3] */
|
||||
info.params[i] = strtoul(argv[4 + i], NULL, 0);
|
||||
}
|
||||
(void)write(fd, &info, sizeof(UsrEventInfo));
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int fd = open("/dev/trace", O_RDWR);
|
||||
if (fd == -1) {
|
||||
printf("Trace open failed.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (argc == 1) {
|
||||
TraceUsage();
|
||||
} else if (argc == 2 && strcmp(argv[1], "start") == 0) { /* 2, argv num, no special meaning */
|
||||
ioctl(fd, TRACE_START, NULL);
|
||||
} else if (argc == 2 && strcmp(argv[1], "stop") == 0) { /* 2, argv num, no special meaning */
|
||||
ioctl(fd, TRACE_STOP, NULL);
|
||||
} else if (argc == 2 && strcmp(argv[1], "reset") == 0) { /* 2, argv num, no special meaning */
|
||||
ioctl(fd, TRACE_RESET, NULL);
|
||||
} else if (argc == 3 && strcmp(argv[1], "mask") == 0) { /* 3, argv num, no special meaning */
|
||||
size_t mask = strtoul(argv[2], NULL, 0);
|
||||
ioctl(fd, TRACE_SET_MASK, mask);
|
||||
} else if (argc == 3 && strcmp(argv[1], "dump") == 0) { /* 3, argv num, no special meaning */
|
||||
size_t flag = strtoul(argv[2], NULL, 0);
|
||||
ioctl(fd, TRACE_DUMP, flag);
|
||||
} else if (argc == 3 && strcmp(argv[1], "read") == 0) { /* 3, argv num, no special meaning */
|
||||
size_t size = strtoul(argv[2], NULL, 0);
|
||||
TraceRead(fd, size);
|
||||
} else if (argc >= 4 && strcmp(argv[1], "write") == 0) { /* 4, argv num, no special meaning */
|
||||
TraceWrite(fd, argc, argv);
|
||||
} else {
|
||||
printf("Unsupported trace command.\n");
|
||||
TraceUsage();
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
44
arch/BUILD.gn
Normal file
44
arch/BUILD.gn
Normal file
@@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
group("arch") {
|
||||
deps = []
|
||||
if (defined(LOSCFG_ARCH_ARM)) {
|
||||
deps += [ "arm" ]
|
||||
}
|
||||
}
|
||||
|
||||
config("public") {
|
||||
configs = []
|
||||
if (defined(LOSCFG_ARCH_ARM)) {
|
||||
configs += [ "arm:public" ]
|
||||
}
|
||||
}
|
||||
0
arch/Kconfig
Executable file → Normal file
0
arch/Kconfig
Executable file → Normal file
40
arch/arm/BUILD.gn
Normal file
40
arch/arm/BUILD.gn
Normal file
@@ -0,0 +1,40 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
group("arm") {
|
||||
deps = [ "gic" ]
|
||||
deps += [ ARCH ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [ "include" ]
|
||||
configs = [ "$ARCH:public" ]
|
||||
}
|
||||
26
arch/arm/Kconfig
Executable file → Normal file
26
arch/arm/Kconfig
Executable file → Normal 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
|
||||
|
||||
|
||||
|
||||
45
arch/arm/arm.mk
Executable file → Normal file
45
arch/arm/arm.mk
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
# 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:
|
||||
@@ -36,13 +36,16 @@ LOSCFG_ARCH_FPU_STRIP := $(subst $\",,$(LOSCFG_ARCH_FPU))
|
||||
LOSCFG_ARCH_FPU = $(LOSCFG_ARCH_FPU_STRIP)
|
||||
|
||||
ifeq ($(LOSCFG_ARCH_ARM_AARCH32), y)
|
||||
LITEOS_ARCH_ARM := arm
|
||||
ARCH := arm
|
||||
else ifeq ($(LOSCFG_ARCH_ARM_AARCH64), y)
|
||||
LITEOS_ARCH_ARM :=
|
||||
ARCH := aarch64
|
||||
endif
|
||||
|
||||
LITEOS_BASELIB += -l$(LOSCFG_ARCH_CPU)
|
||||
LIB_SUBDIRS += arch/arm/$(LITEOS_ARCH_ARM)
|
||||
LITEOS_BASELIB += -lgic
|
||||
|
||||
LIB_SUBDIRS += arch/arm/$(ARCH)
|
||||
LIB_SUBDIRS += arch/arm/gic
|
||||
|
||||
# CPU compile options
|
||||
ifeq ($(LOSCFG_ARCH_ARM_AARCH64), y)
|
||||
@@ -62,38 +65,12 @@ LITEOS_FPU_OPTS := -mfpu=$(LOSCFG_ARCH_FPU)
|
||||
LITEOS_GCCLIB := $(subst cortex-,,$(LOSCFG_ARCH_CPU))_softfp_$(LOSCFG_ARCH_FPU)
|
||||
endif
|
||||
|
||||
LITEOS_CORE_COPTS = $(LITEOS_CPU_OPTS) $(LITEOS_FLOAT_OPTS) $(LITEOS_FPU_OPTS)
|
||||
LITEOS_INTERWORK += $(LITEOS_CORE_COPTS)
|
||||
LITEOS_NODEBUG += $(LITEOS_CORE_COPTS)
|
||||
LITEOS_CORE_COPTS = $(or $(ARCH_CFLAGS),$(LITEOS_CPU_OPTS) $(LITEOS_FLOAT_OPTS) $(LITEOS_FPU_OPTS))
|
||||
LITEOS_ASOPTS += $(LITEOS_CPU_OPTS)
|
||||
LITEOS_CXXOPTS_BASE += $(LITEOS_CORE_COPTS)
|
||||
|
||||
ARCH_INCLUDE := -I $(LITEOSTOPDIR)/arch/arm/include \
|
||||
-I $(LITEOSTOPDIR)/arch/arm/$(LITEOS_ARCH_ARM)/include \
|
||||
-I $(LITEOSTOPDIR)/arch/arm/$(LITEOS_ARCH_ARM)/src/include
|
||||
-I $(LITEOSTOPDIR)/arch/arm/$(ARCH)/include \
|
||||
-I $(LITEOSTOPDIR)/arch/arm/$(ARCH)/src/include
|
||||
|
||||
LITEOS_PLATFORM_INCLUDE += $(ARCH_INCLUDE)
|
||||
LITEOS_CXXINCLUDE += $(ARCH_INCLUDE)
|
||||
|
||||
# expose FPU info to assembly code
|
||||
ifeq ($(LOSCFG_ARCH_FPU_DISABLE), y)
|
||||
LITEOS_CMACRO += -DLOSCFG_ARCH_FPU_DISABLE
|
||||
else ifeq ($(LOSCFG_ARCH_FPU_VFP_D16), y)
|
||||
LITEOS_CMACRO += -DLOSCFG_ARCH_FPU_VFP_D16
|
||||
else ifeq ($(LOSCFG_ARCH_FPU_VFP_D32), y)
|
||||
LITEOS_CMACRO += -DLOSCFG_ARCH_FPU_VFP_D32
|
||||
endif
|
||||
|
||||
# extra definition for other module
|
||||
LITEOS_CPU_TYPE = $(LOSCFG_ARCH_CPU)
|
||||
LITEOS_ARM_ARCH := -march=$(subst $\",,$(LOSCFG_ARCH_ARM_VER))
|
||||
|
||||
# linux style macros
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7A) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7R) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7M) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8A) = -D__LINUX_ARM_ARCH__=8
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8R) = -D__LINUX_ARM_ARCH__=8
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8M) = -D__LINUX_ARM_ARCH__=8
|
||||
|
||||
AS_OBJS_LIBC_FLAGS += $(LINUX_ARCH_y)
|
||||
|
||||
96
arch/arm/arm/BUILD.gn
Normal file
96
arch/arm/arm/BUILD.gn
Normal file
@@ -0,0 +1,96 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
module_name = LOSCFG_ARCH_CPU
|
||||
kernel_module(module_name) {
|
||||
sources = [
|
||||
"src/arm_generic_timer.c",
|
||||
"src/clear_user.S",
|
||||
"src/hw_user_get.S",
|
||||
"src/hw_user_put.S",
|
||||
"src/jmp.S",
|
||||
"src/los_arch_mmu.c",
|
||||
"src/los_asid.c",
|
||||
"src/los_dispatch.S",
|
||||
"src/los_exc.c",
|
||||
"src/los_hw.c",
|
||||
"src/los_hw_exc.S",
|
||||
"src/los_hw_runstop.S",
|
||||
"src/los_hw_tick.c",
|
||||
"src/los_hwi.c",
|
||||
"src/smp.c",
|
||||
"src/strncpy_from_user.c",
|
||||
"src/strnlen_user.c",
|
||||
"src/user_copy.c",
|
||||
]
|
||||
|
||||
if (LOSCFG_ARCH_ARM_VER == "armv7-a") {
|
||||
sources += [ "src/armv7a/cache.S" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_KERNEL_SMP)) {
|
||||
sources += [ "src/startup/reset_vector_mp.S" ]
|
||||
} else {
|
||||
sources += [ "src/startup/reset_vector_up.S" ]
|
||||
}
|
||||
|
||||
include_dirs = [ "src/include" ]
|
||||
|
||||
if (defined(LOSCFG_PERF_HW_PMU)) {
|
||||
sources += [ "src/pmu/armv7_pmu.c" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_GDB)) {
|
||||
configs += [ ":as_objs_libc_flags" ]
|
||||
}
|
||||
|
||||
public_configs = [ ":public" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"src/include",
|
||||
]
|
||||
}
|
||||
|
||||
config("as_objs_libc_flags") {
|
||||
defines = [ "__ASSEMBLY__" ]
|
||||
|
||||
# linux style macros
|
||||
if (defined(LOSCFG_ARCH_ARM_V7A) || defined(LOSCFG_ARCH_ARM_V7R) ||
|
||||
defined(LOSCFG_ARCH_ARM_V7M)) {
|
||||
defines += [ "__LINUX_ARM_ARCH__=7" ]
|
||||
} else if (defined(LOSCFG_ARCH_ARM_V8A) || defined(LOSCFG_ARCH_ARM_V8R) ||
|
||||
defined(LOSCFG_ARCH_ARM_V8M)) {
|
||||
defines += [ "__LINUX_ARM_ARCH__=8" ]
|
||||
}
|
||||
}
|
||||
26
arch/arm/arm/Makefile
Executable file → Normal file
26
arch/arm/arm/Makefile
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
# 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:
|
||||
@@ -32,12 +32,8 @@ include $(LITEOSTOPDIR)/config.mk
|
||||
MODULE_NAME := $(LOSCFG_ARCH_CPU)
|
||||
|
||||
LOCAL_SRCS := $(wildcard src/*.c) $(wildcard src/*.S)
|
||||
LOCAL_INCLUDE := \
|
||||
-I $(LITEOSTOPDIR)/kernel/base/include \
|
||||
-I $(LITEOSTOPDIR)/kernel/extended/include \
|
||||
-I $(LITEOSTOPDIR)/arch/arm/arm/include \
|
||||
|
||||
ifeq ($(LITEOS_ARM_ARCH), -march=armv7-a)
|
||||
ifeq ($(LOSCFG_ARCH_ARM_VER), "armv7-a")
|
||||
LOCAL_SRCS += $(wildcard src/armv7a/*.S)
|
||||
endif
|
||||
|
||||
@@ -47,7 +43,21 @@ else
|
||||
LOCAL_SRCS += src/startup/reset_vector_up.S
|
||||
endif
|
||||
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS)
|
||||
ifeq ($(LOSCFG_PERF_HW_PMU), y)
|
||||
LOCAL_SRCS += src/pmu/armv7_pmu.c
|
||||
endif
|
||||
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE)
|
||||
|
||||
AS_OBJS_LIBC_FLAGS = -D__ASSEMBLY__
|
||||
# linux style macros
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7A) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7R) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7M) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8A) = -D__LINUX_ARM_ARCH__=8
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8R) = -D__LINUX_ARM_ARCH__=8
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8M) = -D__LINUX_ARM_ARCH__=8
|
||||
AS_OBJS_LIBC_FLAGS += $(LINUX_ARCH_y)
|
||||
|
||||
ifeq ($(LOSCFG_GDB), y)
|
||||
LOCAL_FLAGS += $(AS_OBJS_LIBC_FLAGS)
|
||||
|
||||
5
arch/arm/arm/include/arch_config.h
Executable file → Normal file
5
arch/arm/arm/include/arch_config.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -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 */
|
||||
|
||||
8
arch/arm/arm/include/arm.h
Executable file → Normal file
8
arch/arm/arm/include/arm.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -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;
|
||||
|
||||
12
kernel/common/los_timer_pri.h → arch/arm/arm/include/arm_user_clear.h
Executable file → Normal file
12
kernel/common/los_timer_pri.h → arch/arm/arm/include/arm_user_clear.h
Executable file → Normal file
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, 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_TIMER_PRI_H
|
||||
#define _LOS_TIMER_PRI_H
|
||||
#ifndef _ARM_USER_CLEAR_H
|
||||
#define _ARM_USER_CLEAR_H
|
||||
|
||||
#include "los_typedef.h"
|
||||
|
||||
@@ -40,11 +39,12 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern VOID OsAdjTime(VOID);
|
||||
size_t _arm_clear_user(void *addr, size_t bytes);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif /* _LOS_TIMER_PRI_H */
|
||||
|
||||
#endif /* _ARM_USER_CLEAR_H */
|
||||
4
arch/arm/arm/include/arm_user_copy.h
Executable file → Normal file
4
arch/arm/arm/include/arm_user_copy.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
|
||||
4
arch/arm/arm/include/arm_user_get.h
Executable file → Normal file
4
arch/arm/arm/include/arm_user_get.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
|
||||
4
arch/arm/arm/include/arm_user_put.h
Executable file → Normal file
4
arch/arm/arm/include/arm_user_put.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
|
||||
7
platform/include/hal_timer.h → arch/arm/arm/include/hal_timer.h
Executable file → Normal file
7
platform/include/hal_timer.h → arch/arm/arm/include/hal_timer.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -45,9 +45,8 @@ extern VOID HalClockIrqClear(VOID);
|
||||
extern VOID HalClockInit(VOID);
|
||||
extern UINT64 HalClockGetCycles(VOID);
|
||||
extern VOID HalDelayUs(UINT32 usecs);
|
||||
extern UINT64 hi_sched_clock(VOID);
|
||||
extern UINT32 HalClockGetTickTimerCycles(VOID);
|
||||
extern VOID HalClockTickTimerReload(UINT32 cycles);
|
||||
extern UINT64 HalClockTickTimerReload(UINT64 cycles);
|
||||
|
||||
extern UINT32 HrtimersInit(VOID);
|
||||
extern VOID HrtimerClockIrqClear(VOID);
|
||||
15
arch/arm/arm/include/los_arch_mmu.h
Executable file → Normal file
15
arch/arm/arm/include/los_arch_mmu.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -38,7 +38,10 @@
|
||||
#define __LOS_ARCH_MMU_H__
|
||||
|
||||
#include "los_typedef.h"
|
||||
#include "los_mux.h"
|
||||
#include "los_vm_phys.h"
|
||||
#ifndef LOSCFG_PAGE_TABLE_FINE_LOCK
|
||||
#include "los_spinlock.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -47,7 +50,9 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct ArchMmu {
|
||||
LosMux mtx; /**< arch mmu page table entry modification mutex lock */
|
||||
#ifndef LOSCFG_PAGE_TABLE_FINE_LOCK
|
||||
SPIN_LOCK_S lock; /**< arch mmu page table entry modification spin lock */
|
||||
#endif
|
||||
VADDR_T *virtTtb; /**< translation table base virtual addr */
|
||||
PADDR_T physTtb; /**< translation table base phys addr */
|
||||
UINT32 asid; /**< TLB asid */
|
||||
@@ -71,5 +76,5 @@ VADDR_T *OsGFirstTableGet(VOID);
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __LOS_VM_PAGE_H__ */
|
||||
#endif /* __LOS_ARCH_MMU_H__ */
|
||||
|
||||
|
||||
4
arch/arm/arm/include/los_asid.h
Executable file → Normal file
4
arch/arm/arm/include/los_asid.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
|
||||
12
arch/arm/arm/include/los_atomic.h
Executable file → Normal file
12
arch/arm/arm/include/los_atomic.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -246,7 +246,7 @@ STATIC INLINE INT32 LOS_AtomicIncRet(Atomic *v)
|
||||
* @brief Atomic auto-decrement.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implementating the atomic auto-decrement.
|
||||
* This API is used to implement the atomic auto-decrement.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The pointer v must not be NULL.</li>
|
||||
@@ -280,7 +280,7 @@ STATIC INLINE VOID LOS_AtomicDec(Atomic *v)
|
||||
* @brief Atomic auto-decrement.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implementating the atomic auto-decrement and return the result of auto-decrement.
|
||||
* This API is used to implement the atomic auto-decrement and return the result of auto-decrement.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The pointer v must not be NULL.</li>
|
||||
@@ -531,7 +531,7 @@ STATIC INLINE INT64 LOS_Atomic64IncRet(Atomic64 *v)
|
||||
* @brief Atomic64 auto-decrement.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implementating the atomic64 auto-decrement.
|
||||
* This API is used to implement the atomic64 auto-decrement.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The pointer v must not be NULL.</li>
|
||||
@@ -566,7 +566,7 @@ STATIC INLINE VOID LOS_Atomic64Dec(Atomic64 *v)
|
||||
* @brief Atomic64 auto-decrement.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implementating the atomic64 auto-decrement and return the result of auto-decrement.
|
||||
* This API is used to implement the atomic64 auto-decrement and return the result of auto-decrement.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The pointer v must not be NULL.</li>
|
||||
|
||||
27
arch/arm/arm/include/los_hw_cpu.h
Executable file → Normal file
27
arch/arm/arm/include/los_hw_cpu.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -51,7 +51,10 @@ extern "C" {
|
||||
#define DSB __asm__ volatile("dsb" ::: "memory")
|
||||
#define DMB __asm__ volatile("dmb" ::: "memory")
|
||||
#define ISB __asm__ volatile("isb" ::: "memory")
|
||||
#define WFI __asm__ volatile("wfi" ::: "memory")
|
||||
#define BARRIER __asm__ volatile("":::"memory")
|
||||
#define WFE __asm__ volatile("wfe" ::: "memory")
|
||||
#define SEV __asm__ volatile("sev" ::: "memory")
|
||||
|
||||
#define ARM_SYSREG_READ(REG) \
|
||||
({ \
|
||||
@@ -144,7 +147,7 @@ STATIC INLINE VOID ArchCurrUserTaskSet(UINTPTR val)
|
||||
|
||||
STATIC INLINE UINT32 ArchCurrCpuid(VOID)
|
||||
{
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
return ARM_SYSREG_READ(MPIDR) & MPIDR_CPUID_MASK;
|
||||
#else
|
||||
return 0;
|
||||
@@ -188,6 +191,24 @@ STATIC INLINE UINT32 ArchIntUnlock(VOID)
|
||||
return intSave;
|
||||
}
|
||||
|
||||
STATIC INLINE VOID ArchIrqDisable(VOID)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cpsid i "
|
||||
:
|
||||
:
|
||||
: "memory", "cc");
|
||||
}
|
||||
|
||||
STATIC INLINE VOID ArchIrqEnable(VOID)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cpsie i "
|
||||
:
|
||||
:
|
||||
: "memory", "cc");
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
STATIC INLINE UINT32 ArchIntLock(VOID)
|
||||
|
||||
16
arch/arm/arm/include/los_mmu_descriptor_v6.h
Executable file → Normal file
16
arch/arm/arm/include/los_mmu_descriptor_v6.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -104,6 +104,8 @@ extern "C" {
|
||||
((x) << MMU_DESCRIPTOR_L1_TEX_SHIFT) /* type extension */
|
||||
#define MMU_DESCRIPTOR_L1_TYPE_STRONGLY_ORDERED \
|
||||
(MMU_DESCRIPTOR_L1_TEX(MMU_DESCRIPTOR_TEX_0) | MMU_DESCRIPTOR_NON_CACHEABLE)
|
||||
#define MMU_DESCRIPTOR_L1_TYPE_NORMAL_NOCACHE \
|
||||
(MMU_DESCRIPTOR_L1_TEX(MMU_DESCRIPTOR_TEX_1) | MMU_DESCRIPTOR_NON_CACHEABLE)
|
||||
#define MMU_DESCRIPTOR_L1_TYPE_DEVICE_SHARED \
|
||||
(MMU_DESCRIPTOR_L1_TEX(MMU_DESCRIPTOR_TEX_0) | MMU_DESCRIPTOR_WRITE_BACK_ALLOCATE)
|
||||
#define MMU_DESCRIPTOR_L1_TYPE_DEVICE_NON_SHARED \
|
||||
@@ -141,6 +143,8 @@ extern "C" {
|
||||
((x) << MMU_DESCRIPTOR_L2_TEX_SHIFT) /* type extension */
|
||||
#define MMU_DESCRIPTOR_L2_TYPE_STRONGLY_ORDERED \
|
||||
(MMU_DESCRIPTOR_L2_TEX(MMU_DESCRIPTOR_TEX_0) | MMU_DESCRIPTOR_NON_CACHEABLE)
|
||||
#define MMU_DESCRIPTOR_L2_TYPE_NORMAL_NOCACHE \
|
||||
(MMU_DESCRIPTOR_L2_TEX(MMU_DESCRIPTOR_TEX_1) | MMU_DESCRIPTOR_NON_CACHEABLE)
|
||||
#define MMU_DESCRIPTOR_L2_TYPE_DEVICE_SHARED \
|
||||
(MMU_DESCRIPTOR_L2_TEX(MMU_DESCRIPTOR_TEX_0) | MMU_DESCRIPTOR_WRITE_BACK_ALLOCATE)
|
||||
#define MMU_DESCRIPTOR_L2_TYPE_DEVICE_NON_SHARED \
|
||||
@@ -158,7 +162,7 @@ extern "C" {
|
||||
#define MMU_DESCRIPTOR_L2_AP01_0 (MMU_DESCRIPTOR_L2_AP01(0))
|
||||
#define MMU_DESCRIPTOR_L2_AP01_1 (MMU_DESCRIPTOR_L2_AP01(1))
|
||||
#define MMU_DESCRIPTOR_L2_AP01_3 (MMU_DESCRIPTOR_L2_AP01(3))
|
||||
#define MMU_DESCRIPTOR_L2_AP_P_NA_U_NA (MMUDESCRIPTOR_L2_AP2_0 | MMU_DESCRIPTOR_L2_AP01_0)
|
||||
#define MMU_DESCRIPTOR_L2_AP_P_NA_U_NA (MMU_DESCRIPTOR_L2_AP2_0 | MMU_DESCRIPTOR_L2_AP01_0)
|
||||
#define MMU_DESCRIPTOR_L2_AP_P_RW_U_RW (MMU_DESCRIPTOR_L2_AP2_0 | MMU_DESCRIPTOR_L2_AP01_3)
|
||||
#define MMU_DESCRIPTOR_L2_AP_P_RW_U_NA (MMU_DESCRIPTOR_L2_AP2_0 | MMU_DESCRIPTOR_L2_AP01_1)
|
||||
#define MMU_DESCRIPTOR_L2_AP_P_RO_U_RO (MMU_DESCRIPTOR_L2_AP2_1 | MMU_DESCRIPTOR_L2_AP01_3)
|
||||
@@ -208,6 +212,12 @@ extern "C" {
|
||||
MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT | \
|
||||
MMU_DESCRIPTOR_L1_AP_P_RW_U_NA)
|
||||
|
||||
#define MMU_INITIAL_MAP_NORMAL_NOCACHE \
|
||||
(MMU_DESCRIPTOR_L1_TYPE_SECTION | \
|
||||
MMU_DESCRIPTOR_L1_TYPE_NORMAL_NOCACHE | \
|
||||
MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT | \
|
||||
MMU_DESCRIPTOR_L1_AP_P_RW_U_NA)
|
||||
|
||||
#define MMU_INITIAL_MAP_DEVICE \
|
||||
(MMU_DESCRIPTOR_L1_TYPE_SECTION | \
|
||||
MMU_DESCRIPTOR_L1_TYPE_DEVICE_SHARED | \
|
||||
|
||||
9
arch/arm/arm/include/los_pte_ops.h
Executable file → Normal file
9
arch/arm/arm/include/los_pte_ops.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -69,6 +69,11 @@ STATIC INLINE VOID OsClearPte1(PTE_T *pte1Ptr)
|
||||
OsSavePte1(pte1Ptr, 0);
|
||||
}
|
||||
|
||||
STATIC INLINE PADDR_T OsGetPte1Paddr(PADDR_T PhysTtb, vaddr_t va)
|
||||
{
|
||||
return (PhysTtb + (OsGetPte1Index(va) * sizeof(PADDR_T)));
|
||||
}
|
||||
|
||||
STATIC INLINE PTE_T *OsGetPte1Ptr(PTE_T *pte1BasePtr, vaddr_t va)
|
||||
{
|
||||
return (pte1BasePtr + OsGetPte1Index(va));
|
||||
|
||||
5
arch/arm/arm/include/los_tlb_v6.h
Executable file → Normal file
5
arch/arm/arm/include/los_tlb_v6.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -37,7 +37,6 @@
|
||||
#define __LOS_TLB_V6_H__
|
||||
|
||||
#include "los_typedef.h"
|
||||
#include "menuconfig.h"
|
||||
#include "arm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
29
kernel/base/include/los_stat_pri.h → arch/arm/arm/include/smp.h
Executable file → Normal file
29
kernel/base/include/los_stat_pri.h → arch/arm/arm/include/smp.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -29,8 +29,10 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __LOS_STAT_PRI_H
|
||||
#define __LOS_STAT_PRI_H
|
||||
#ifndef _ARCH_SMP_H
|
||||
#define _ARCH_SMP_H
|
||||
|
||||
#include "los_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -38,17 +40,13 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct {
|
||||
UINT64 runtime;
|
||||
UINT32 contexSwitch;
|
||||
} SchedPercpu;
|
||||
struct SmpOps {
|
||||
INT32 (*SmpCpuOn)(UINT32 cpuNum, UINTPTR startEntry); /* The startEntry is physical addr. */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
UINT64 startRuntime;
|
||||
UINT64 allRuntime;
|
||||
UINT32 allContextSwitch;
|
||||
SchedPercpu schedPercpu[LOSCFG_KERNEL_SMP_CORE_NUM];
|
||||
} SchedStat;
|
||||
typedef VOID (*ArchCpuStartFunc)(VOID *arg);
|
||||
|
||||
VOID HalArchCpuOn(UINT32 cpuNum, ArchCpuStartFunc func, struct SmpOps *ops, VOID *arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -56,4 +54,5 @@ typedef struct {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __LOS_STAT_PRI_H */
|
||||
#endif /* _ARCH_SMP_H */
|
||||
|
||||
30
platform/hw/arm/timer/arm_generic/arm_generic_timer.c → arch/arm/arm/src/arm_generic_timer.c
Executable file → Normal file
30
platform/hw/arm/timer/arm_generic/arm_generic_timer.c → arch/arm/arm/src/arm_generic_timer.c
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -87,8 +87,6 @@
|
||||
|
||||
#endif
|
||||
|
||||
#define OS_CYCLE_PER_TICK (g_sysClock / LOSCFG_BASE_CORE_TICK_PER_SECOND)
|
||||
|
||||
UINT32 HalClockFreqRead(VOID)
|
||||
{
|
||||
return READ_TIMER_REG32(TIMER_REG_CNTFRQ);
|
||||
@@ -127,27 +125,12 @@ UINT64 HalClockGetCycles(VOID)
|
||||
return cntpct;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID OsTickEntry(VOID)
|
||||
{
|
||||
TimerCtlWrite(0);
|
||||
|
||||
OsTickHandler();
|
||||
|
||||
/*
|
||||
* use last cval to generate the next tick's timing is
|
||||
* absolute and accurate. DO NOT use tval to drive the
|
||||
* generic time in which case tick will be slower.
|
||||
*/
|
||||
TimerCvalWrite(TimerCvalRead() + OS_CYCLE_PER_TICK);
|
||||
TimerCtlWrite(1);
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalClockInit(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
g_sysClock = HalClockFreqRead();
|
||||
ret = LOS_HwiCreate(OS_TICK_INT_NUM, MIN_INTERRUPT_PRIORITY, 0, OsTickEntry, 0);
|
||||
ret = LOS_HwiCreate(OS_TICK_INT_NUM, MIN_INTERRUPT_PRIORITY, 0, OsTickHandler, 0);
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("%s, %d create tick irq failed, ret:0x%x\n", __FUNCTION__, __LINE__, ret);
|
||||
}
|
||||
@@ -165,7 +148,7 @@ LITE_OS_SEC_TEXT_INIT VOID HalClockStart(VOID)
|
||||
|
||||
VOID HalDelayUs(UINT32 usecs)
|
||||
{
|
||||
UINT64 cycles = (UINT64)usecs * HalClockFreqRead() / OS_SYS_US_PER_SECOND;
|
||||
UINT64 cycles = (UINT64)usecs * g_sysClock / OS_SYS_US_PER_SECOND;
|
||||
UINT64 deadline = HalClockGetCycles() + cycles;
|
||||
|
||||
while (HalClockGetCycles() < deadline) {
|
||||
@@ -173,7 +156,7 @@ VOID HalDelayUs(UINT32 usecs)
|
||||
}
|
||||
}
|
||||
|
||||
UINT64 hi_sched_clock(VOID)
|
||||
DEPRECATED UINT64 hi_sched_clock(VOID)
|
||||
{
|
||||
return LOS_CurrNanosec();
|
||||
}
|
||||
@@ -186,7 +169,7 @@ UINT32 HalClockGetTickTimerCycles(VOID)
|
||||
return (UINT32)((cval > cycles) ? (cval - cycles) : 0);
|
||||
}
|
||||
|
||||
VOID HalClockTickTimerReload(UINT32 cycles)
|
||||
UINT64 HalClockTickTimerReload(UINT64 cycles)
|
||||
{
|
||||
HalIrqMask(OS_TICK_INT_NUM);
|
||||
HalIrqClear(OS_TICK_INT_NUM);
|
||||
@@ -196,4 +179,5 @@ VOID HalClockTickTimerReload(UINT32 cycles)
|
||||
TimerCtlWrite(1);
|
||||
|
||||
HalIrqUnmask(OS_TICK_INT_NUM);
|
||||
return cycles;
|
||||
}
|
||||
4
arch/arm/arm/src/armv7a/cache.S
Executable file → Normal file
4
arch/arm/arm/src/armv7a/cache.S
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
|
||||
100
arch/arm/arm/src/clear_user.S
Normal file
100
arch/arm/arm/src/clear_user.S
Normal 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
|
||||
4
arch/arm/arm/src/hw_user_get.S
Executable file → Normal file
4
arch/arm/arm/src/hw_user_get.S
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
|
||||
4
arch/arm/arm/src/hw_user_put.S
Executable file → Normal file
4
arch/arm/arm/src/hw_user_put.S
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
|
||||
108
arch/arm/arm/src/include/armv7_pmu_pri.h
Normal file
108
arch/arm/arm/src/include/armv7_pmu_pri.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ARMV7_PMU_PRI_H
|
||||
#define _ARMV7_PMU_PRI_H
|
||||
|
||||
#include "los_typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* counters overflow flag status reg */
|
||||
#define ARMV7_FLAG_MASK 0xffffffff /* Mask for writable bits */
|
||||
#define ARMV7_OVERFLOWED_MASK ARMV7_FLAG_MASK /* Mask for pmu overflowed */
|
||||
|
||||
/* pmnc config reg */
|
||||
#define ARMV7_PMNC_E (1U << 0) /* Enable all counters */
|
||||
#define ARMV7_PMNC_P (1U << 1) /* Reset all counters */
|
||||
#define ARMV7_PMNC_C (1U << 2) /* Cycle counter reset */
|
||||
#define ARMV7_PMNC_D (1U << 3) /* CCNT counts every 64th cpu cycle */
|
||||
#define ARMV7_PMNC_X (1U << 4) /* Export to ETM */
|
||||
#define ARMV7_PMNC_DP (1U << 5) /* Disable CCNT if non-invasive debug */
|
||||
#define ARMV7_PMNC_MASK 0x3f /* Mask for writable bits */
|
||||
|
||||
/* pmxevtyper event selection reg */
|
||||
#define ARMV7_EVTYPE_MASK 0xc80000ff /* Mask for writable bits */
|
||||
|
||||
/* armv7 counters index */
|
||||
#define ARMV7_IDX_COUNTER0 1
|
||||
#define ARMV7_IDX_CYCLE_COUNTER 0
|
||||
#define ARMV7_IDX_MAX_COUNTER 9
|
||||
|
||||
#define ARMV7_MAX_COUNTERS 32
|
||||
#define ARMV7_IDX_COUNTER_LAST (ARMV7_IDX_CYCLE_COUNTER + ARMV7_MAX_COUNTERS - 1)
|
||||
#define ARMV7_COUNTER_MASK (ARMV7_MAX_COUNTERS - 1)
|
||||
|
||||
/* armv7 event counter index mapping */
|
||||
#define ARMV7_CNT2BIT(x) (1UL << (x))
|
||||
#define ARMV7_IDX2CNT(x) (((x) - ARMV7_IDX_COUNTER0) & ARMV7_COUNTER_MASK)
|
||||
|
||||
enum PmuEventType {
|
||||
ARMV7_PERF_HW_CYCLES = 0xFF, /* cycles */
|
||||
ARMV7_PERF_HW_INSTRUCTIONS = 0x08, /* instructions */
|
||||
ARMV7_PERF_HW_DCACHES = 0x04, /* dcache */
|
||||
ARMV7_PERF_HW_DCACHE_MISSES = 0x03, /* dcache-misses */
|
||||
ARMV7_PERF_HW_ICACHES = 0x14, /* icache */
|
||||
ARMV7_PERF_HW_ICACHE_MISSES = 0x01, /* icache-misses */
|
||||
ARMV7_PERF_HW_BRANCHES = 0x0C, /* software change of pc */
|
||||
ARMV7_PERF_HW_BRANCE_MISSES = 0x10, /* branch-misses */
|
||||
ARMV7_PERF_HW_PRED_BRANCH = 0x12, /* predictable branches */
|
||||
ARMV7_PERF_HW_NUM_CYC_IRQ = 0x50, /* number of cycles Irqs are interrupted */
|
||||
ARMV7_PERF_HW_EXC_TAKEN = 0x09, /* exception_taken */
|
||||
ARMV7_PERF_HW_DATA_READ = 0x06, /* data read */
|
||||
ARMV7_PERF_HW_DATA_WRITE = 0x07, /* data write */
|
||||
ARMV7_PERF_HW_STREX_PASSED = 0x80, /* strex passed */
|
||||
ARMV7_PERF_HW_STREX_FAILED = 0x81, /* strex failed */
|
||||
ARMV7_PERF_HW_LP_IN_TCM = 0x82, /* literal pool in TCM region */
|
||||
ARMV7_PERF_HW_DMB_STALL = 0x90, /* DMB stall */
|
||||
ARMV7_PERF_HW_ITCM_ACCESS = 0x91, /* ITCM access */
|
||||
ARMV7_PERF_HW_DTCM_ACCESS = 0x92, /* DTCM access */
|
||||
ARMV7_PERF_HW_DATA_EVICTION = 0x93, /* data eviction */
|
||||
ARMV7_PERF_HW_SCU = 0x94, /* SCU coherency operation */
|
||||
ARMV7_PERF_HW_INSCACHE_DEP_DW = 0x95, /* instruction cache dependent stall */
|
||||
ARMV7_PERF_HW_DATA_CACHE_DEP_STALL = 0x96, /* data cache dependent stall */
|
||||
ARMV7_PERF_HW_NOCACHE_NO_PER_DEP_STALL = 0x97, /* non-cacheable no peripheral dependent stall */
|
||||
ARMV7_PERF_HW_NOCACHE_PER_DEP_STALL = 0x98, /* non-Cacheable peripheral dependent stall */
|
||||
ARMV7_PERF_HW_DATA_CACHE_HP_DEP_STALL = 0x99, /* data cache high priority dependent stall */
|
||||
ARMV7_PERF_HW_AXI_FAST_PERIPHERAL = 0x9A, /* Accesses_to_AXI_fast_peripheral_port(reads_and_writes) */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _ARMV7_PMU_PRI_H */
|
||||
4
arch/arm/arm/src/include/asm.h
Executable file → Normal file
4
arch/arm/arm/src/include/asm.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
|
||||
26
arch/arm/arm/src/include/los_exc_pri.h
Executable file → Normal file
26
arch/arm/arm/src/include/los_exc_pri.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -40,19 +40,29 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
STATIC INLINE VOID OsSetCurrCpuSp(UINTPTR regSp)
|
||||
{
|
||||
__asm__ __volatile__("mov sp, %0" :: "r"(regSp));
|
||||
}
|
||||
|
||||
#define OS_SYSTEM_NORMAL 0
|
||||
#define OS_SYSTEM_EXC_CURR_CPU 1
|
||||
#define OS_SYSTEM_EXC_OTHER_CPU 2
|
||||
|
||||
#define REGION_PATH_MAX 32
|
||||
|
||||
typedef struct {
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
UINTPTR ip;
|
||||
UINT32 len; /* f_path length */
|
||||
CHAR f_path[REGION_PATH_MAX];
|
||||
#else
|
||||
UINTPTR ip;
|
||||
#endif
|
||||
} IpInfo;
|
||||
|
||||
extern UINT32 OsGetSystemStatus(VOID);
|
||||
extern VOID BackTraceSub(UINTPTR regFP);
|
||||
extern VOID OsExcInit(VOID);
|
||||
extern VOID OsKillUserProcess(UINTPTR sp);
|
||||
extern BOOL OsSystemExcIsReset(VOID);
|
||||
extern UINT32 BackTraceGet(UINTPTR regFP, IpInfo *callChain, UINT32 maxDepth);
|
||||
extern BOOL OsGetUsrIpInfo(UINTPTR ip, IpInfo *info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
61
arch/arm/arm/src/include/los_hw_pri.h
Executable file → Normal file
61
arch/arm/arm/src/include/los_hw_pri.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -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);
|
||||
|
||||
|
||||
10
arch/arm/arm/src/include/los_hwi_pri.h
Executable file → Normal file
10
arch/arm/arm/src/include/los_hwi_pri.h
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -55,11 +55,11 @@ extern "C" {
|
||||
#define HWI_IS_REGISTED(num) ((&g_hwiForm[num])->pstNext != NULL)
|
||||
#endif
|
||||
extern VOID OsHwiInit(VOID);
|
||||
extern VOID OsIncHwiFormCnt(UINT32 index);
|
||||
extern UINT32 OsGetHwiFormCnt(UINT32 index);
|
||||
extern VOID OsIncHwiFormCnt(UINT16 cpuid, UINT32 index);
|
||||
extern UINT32 OsGetHwiFormCnt(UINT16 cpuid, UINT32 index);
|
||||
extern CHAR *OsGetHwiFormName(UINT32 index);
|
||||
extern VOID OsInterrupt(UINT32 intNum);
|
||||
extern VOID SyscallHandleInit(VOID);
|
||||
extern VOID OsSyscallHandleInit(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
4
arch/arm/arm/src/jmp.S
Executable file → Normal file
4
arch/arm/arm/src/jmp.S
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
|
||||
571
arch/arm/arm/src/los_arch_mmu.c
Executable file → Normal file
571
arch/arm/arm/src/los_arch_mmu.c
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -39,22 +39,26 @@
|
||||
#include "los_pte_ops.h"
|
||||
#include "los_tlb_v6.h"
|
||||
#include "los_printf.h"
|
||||
#include "los_vm_phys.h"
|
||||
#include "los_vm_common.h"
|
||||
#include "los_vm_map.h"
|
||||
#include "los_vm_boot.h"
|
||||
#include "los_mmu_descriptor_v6.h"
|
||||
#include "los_process_pri.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
typedef struct {
|
||||
LosArchMmu *archMmu;
|
||||
VADDR_T *vaddr;
|
||||
PADDR_T *paddr;
|
||||
UINT32 *flags;
|
||||
} MmuMapInfo;
|
||||
|
||||
#define TRY_MAX_TIMES 10
|
||||
|
||||
__attribute__((aligned(MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS))) \
|
||||
__attribute__((section(".bss.prebss.translation_table"))) UINT8 \
|
||||
g_firstPageTable[MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS];
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
__attribute__((aligned(MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS))) \
|
||||
__attribute__((section(".bss.prebss.translation_table"))) UINT8 \
|
||||
g_tempPageTable[MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS];
|
||||
@@ -64,12 +68,86 @@ extern CHAR __mmu_ttlb_begin; /* defined in .ld script */
|
||||
UINT8 *g_mmuJumpPageTable = (UINT8 *)&__mmu_ttlb_begin; /* temp page table, this is only used when system power up */
|
||||
#endif
|
||||
|
||||
STATIC SPIN_LOCK_S *OsGetPteLock(LosArchMmu *archMmu, PADDR_T paddr, UINT32 *intSave)
|
||||
{
|
||||
SPIN_LOCK_S *lock = NULL;
|
||||
#ifdef LOSCFG_PAGE_TABLE_FINE_LOCK
|
||||
LosVmPage *vmPage = NULL;
|
||||
|
||||
vmPage = OsVmPaddrToPage(paddr);
|
||||
if (vmPage == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
lock = &vmPage->lock;
|
||||
#else
|
||||
lock = &archMmu->lock;
|
||||
#endif
|
||||
|
||||
LOS_SpinLockSave(lock, intSave);
|
||||
return lock;
|
||||
}
|
||||
|
||||
STATIC SPIN_LOCK_S *OsGetPte1Lock(LosArchMmu *archMmu, PADDR_T paddr, UINT32 *intSave)
|
||||
{
|
||||
return OsGetPteLock(archMmu, paddr, intSave);
|
||||
}
|
||||
|
||||
STATIC INLINE VOID OsUnlockPte1(SPIN_LOCK_S *lock, UINT32 intSave)
|
||||
{
|
||||
if (lock == NULL) {
|
||||
return;
|
||||
}
|
||||
LOS_SpinUnlockRestore(lock, intSave);
|
||||
}
|
||||
|
||||
STATIC SPIN_LOCK_S *OsGetPte1LockTmp(LosArchMmu *archMmu, PADDR_T paddr, UINT32 *intSave)
|
||||
{
|
||||
SPIN_LOCK_S *spinLock = NULL;
|
||||
#ifdef LOSCFG_PAGE_TABLE_FINE_LOCK
|
||||
spinLock = OsGetPteLock(archMmu, paddr, intSave);
|
||||
#else
|
||||
(VOID)archMmu;
|
||||
(VOID)paddr;
|
||||
(VOID)intSave;
|
||||
#endif
|
||||
return spinLock;
|
||||
}
|
||||
|
||||
STATIC INLINE VOID OsUnlockPte1Tmp(SPIN_LOCK_S *lock, UINT32 intSave)
|
||||
{
|
||||
#ifdef LOSCFG_PAGE_TABLE_FINE_LOCK
|
||||
if (lock == NULL) {
|
||||
return;
|
||||
}
|
||||
LOS_SpinUnlockRestore(lock, intSave);
|
||||
#else
|
||||
(VOID)lock;
|
||||
(VOID)intSave;
|
||||
#endif
|
||||
}
|
||||
|
||||
STATIC INLINE SPIN_LOCK_S *OsGetPte2Lock(LosArchMmu *archMmu, PTE_T pte1, UINT32 *intSave)
|
||||
{
|
||||
PADDR_T pa = MMU_DESCRIPTOR_L1_PAGE_TABLE_ADDR(pte1);
|
||||
return OsGetPteLock(archMmu, pa, intSave);
|
||||
}
|
||||
|
||||
STATIC INLINE VOID OsUnlockPte2(SPIN_LOCK_S *lock, UINT32 intSave)
|
||||
{
|
||||
return OsUnlockPte1(lock, intSave);
|
||||
}
|
||||
|
||||
STATIC INLINE PTE_T *OsGetPte2BasePtr(PTE_T pte1)
|
||||
{
|
||||
PADDR_T pa = MMU_DESCRIPTOR_L1_PAGE_TABLE_ADDR(pte1);
|
||||
return LOS_PaddrToKVaddr(pa);
|
||||
}
|
||||
|
||||
VADDR_T *OsGFirstTableGet(VOID)
|
||||
{
|
||||
return (VADDR_T *)g_firstPageTable;
|
||||
}
|
||||
|
||||
STATIC INLINE UINT32 OsUnmapL1Invalid(vaddr_t *vaddr, UINT32 *count)
|
||||
{
|
||||
UINT32 unmapCount;
|
||||
@@ -91,11 +169,6 @@ STATIC INT32 OsMapParamCheck(UINT32 flags, VADDR_T vaddr, PADDR_T paddr)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(flags & VM_MAP_REGION_FLAG_PERM_READ)) {
|
||||
VM_ERR("miss read flag");
|
||||
return LOS_ERRNO_VM_INVALID_ARGS;
|
||||
}
|
||||
|
||||
/* paddr and vaddr must be aligned */
|
||||
if (!MMU_DESCRIPTOR_IS_L2_SIZE_ALIGNED(vaddr) || !MMU_DESCRIPTOR_IS_L2_SIZE_ALIGNED(paddr)) {
|
||||
return LOS_ERRNO_VM_INVALID_ARGS;
|
||||
@@ -114,6 +187,9 @@ STATIC VOID OsCvtPte2AttsToFlags(PTE_T l1Entry, PTE_T l2Entry, UINT32 *flags)
|
||||
|
||||
switch (l2Entry & MMU_DESCRIPTOR_L2_TEX_TYPE_MASK) {
|
||||
case MMU_DESCRIPTOR_L2_TYPE_STRONGLY_ORDERED:
|
||||
*flags |= VM_MAP_REGION_FLAG_STRONGLY_ORDERED;
|
||||
break;
|
||||
case MMU_DESCRIPTOR_L2_TYPE_NORMAL_NOCACHE:
|
||||
*flags |= VM_MAP_REGION_FLAG_UNCACHED;
|
||||
break;
|
||||
case MMU_DESCRIPTOR_L2_TYPE_DEVICE_SHARED:
|
||||
@@ -148,7 +224,6 @@ STATIC VOID OsCvtPte2AttsToFlags(PTE_T l1Entry, PTE_T l2Entry, UINT32 *flags)
|
||||
|
||||
STATIC VOID OsPutL2Table(const LosArchMmu *archMmu, UINT32 l1Index, paddr_t l2Paddr)
|
||||
{
|
||||
LosVmPage *vmPage = NULL;
|
||||
UINT32 index;
|
||||
PTE_T ttEntry;
|
||||
/* check if any l1 entry points to this l2 table */
|
||||
@@ -158,8 +233,9 @@ STATIC VOID OsPutL2Table(const LosArchMmu *archMmu, UINT32 l1Index, paddr_t l2Pa
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
/* we can free this l2 table */
|
||||
vmPage = LOS_VmPageGet(l2Paddr);
|
||||
LosVmPage *vmPage = LOS_VmPageGet(l2Paddr);
|
||||
if (vmPage == NULL) {
|
||||
LOS_Panic("bad page table paddr %#x\n", l2Paddr);
|
||||
return;
|
||||
@@ -167,22 +243,35 @@ STATIC VOID OsPutL2Table(const LosArchMmu *archMmu, UINT32 l1Index, paddr_t l2Pa
|
||||
|
||||
LOS_ListDelete(&vmPage->node);
|
||||
LOS_PhysPageFree(vmPage);
|
||||
#else
|
||||
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, LOS_PaddrToKVaddr(l2Paddr));
|
||||
#endif
|
||||
}
|
||||
|
||||
STATIC VOID OsTryUnmapL1PTE(const LosArchMmu *archMmu, vaddr_t vaddr, UINT32 scanIndex, UINT32 scanCount)
|
||||
STATIC VOID OsTryUnmapL1PTE(LosArchMmu *archMmu, PTE_T *l1Entry, vaddr_t vaddr, UINT32 scanIndex, UINT32 scanCount)
|
||||
{
|
||||
/*
|
||||
* Check if all pages related to this l1 entry are deallocated.
|
||||
* We only need to check pages that we did not clear above starting
|
||||
* from page_idx and wrapped around SECTION.
|
||||
* from scanIndex and wrapped around SECTION.
|
||||
*/
|
||||
UINT32 l1Index;
|
||||
PTE_T l1Entry;
|
||||
PTE_T *pte2BasePtr = NULL;
|
||||
SPIN_LOCK_S *pte1Lock = NULL;
|
||||
SPIN_LOCK_S *pte2Lock = NULL;
|
||||
UINT32 pte1IntSave;
|
||||
UINT32 pte2IntSave;
|
||||
PTE_T pte1Val;
|
||||
PADDR_T pte1Paddr;
|
||||
|
||||
pte2BasePtr = OsGetPte2BasePtr(OsGetPte1(archMmu->virtTtb, vaddr));
|
||||
pte1Paddr = OsGetPte1Paddr(archMmu->physTtb, vaddr);
|
||||
pte2Lock = OsGetPte2Lock(archMmu, *l1Entry, &pte2IntSave);
|
||||
if (pte2Lock == NULL) {
|
||||
return;
|
||||
}
|
||||
pte2BasePtr = OsGetPte2BasePtr(*l1Entry);
|
||||
if (pte2BasePtr == NULL) {
|
||||
VM_ERR("pte2 base ptr is NULL");
|
||||
OsUnlockPte2(pte2Lock, pte2IntSave);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -197,55 +286,97 @@ STATIC VOID OsTryUnmapL1PTE(const LosArchMmu *archMmu, vaddr_t vaddr, UINT32 sca
|
||||
}
|
||||
|
||||
if (!scanCount) {
|
||||
l1Index = OsGetPte1Index(vaddr);
|
||||
l1Entry = archMmu->virtTtb[l1Index];
|
||||
/*
|
||||
* The pte1 of kprocess is placed in kernel image when compiled. So the pte1Lock will be null.
|
||||
* There is no situation to simultaneous access the pte1 of kprocess.
|
||||
*/
|
||||
pte1Lock = OsGetPte1LockTmp(archMmu, pte1Paddr, &pte1IntSave);
|
||||
if (!OsIsPte1PageTable(*l1Entry)) {
|
||||
OsUnlockPte1Tmp(pte1Lock, pte1IntSave);
|
||||
OsUnlockPte2(pte2Lock, pte2IntSave);
|
||||
return;
|
||||
}
|
||||
pte1Val = *l1Entry;
|
||||
/* we can kill l1 entry */
|
||||
OsClearPte1(&archMmu->virtTtb[l1Index]);
|
||||
OsClearPte1(l1Entry);
|
||||
l1Index = OsGetPte1Index(vaddr);
|
||||
OsArmInvalidateTlbMvaNoBarrier(l1Index << MMU_DESCRIPTOR_L1_SMALL_SHIFT);
|
||||
|
||||
/* try to free l2 page itself */
|
||||
OsPutL2Table(archMmu, l1Index, MMU_DESCRIPTOR_L1_PAGE_TABLE_ADDR(l1Entry));
|
||||
OsPutL2Table(archMmu, l1Index, MMU_DESCRIPTOR_L1_PAGE_TABLE_ADDR(pte1Val));
|
||||
OsUnlockPte1Tmp(pte1Lock, pte1IntSave);
|
||||
}
|
||||
OsUnlockPte2(pte2Lock, pte2IntSave);
|
||||
}
|
||||
|
||||
/* convert user level mmu flags to L1 descriptors flags */
|
||||
STATIC UINT32 OsCvtSecFlagsToAttrs(UINT32 flags)
|
||||
STATIC UINT32 OsCvtSecCacheFlagsToMMUFlags(UINT32 flags)
|
||||
{
|
||||
UINT32 mmuFlags = MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT;
|
||||
UINT32 mmuFlags = 0;
|
||||
|
||||
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;
|
||||
case VM_MAP_REGION_FLAG_WRITE_COMBINING:
|
||||
case VM_MAP_REGION_FLAG_UNCACHED:
|
||||
case VM_MAP_REGION_FLAG_STRONGLY_ORDERED:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_TYPE_STRONGLY_ORDERED;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_UNCACHED:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_TYPE_NORMAL_NOCACHE;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_UNCACHED_DEVICE:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_TYPE_DEVICE_SHARED;
|
||||
break;
|
||||
default:
|
||||
return LOS_ERRNO_VM_INVALID_ARGS;
|
||||
}
|
||||
return mmuFlags;
|
||||
}
|
||||
|
||||
switch (flags & (VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_WRITE)) {
|
||||
STATIC UINT32 OsCvtSecAccessFlagsToMMUFlags(UINT32 flags)
|
||||
{
|
||||
UINT32 mmuFlags = 0;
|
||||
|
||||
switch (flags & (VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE)) {
|
||||
case 0:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_NA_U_NA;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_PERM_READ:
|
||||
case VM_MAP_REGION_FLAG_PERM_USER:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_RO_U_NA;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_PERM_WRITE:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_RW_U_NA;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_PERM_USER:
|
||||
case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_RO_U_RO;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_PERM_WRITE:
|
||||
case VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_RW_U_NA;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_WRITE:
|
||||
case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_RW_U_RW;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return mmuFlags;
|
||||
}
|
||||
|
||||
/* convert user level mmu flags to L1 descriptors flags */
|
||||
STATIC UINT32 OsCvtSecFlagsToAttrs(UINT32 flags)
|
||||
{
|
||||
UINT32 mmuFlags;
|
||||
|
||||
mmuFlags = OsCvtSecCacheFlagsToMMUFlags(flags);
|
||||
if (mmuFlags == LOS_ERRNO_VM_INVALID_ARGS) {
|
||||
return mmuFlags;
|
||||
}
|
||||
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT;
|
||||
|
||||
mmuFlags |= OsCvtSecAccessFlagsToMMUFlags(flags);
|
||||
|
||||
if (!(flags & VM_MAP_REGION_FLAG_PERM_EXECUTE)) {
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_SECTION_XN;
|
||||
@@ -271,6 +402,9 @@ STATIC VOID OsCvtSecAttsToFlags(PTE_T l1Entry, UINT32 *flags)
|
||||
|
||||
switch (l1Entry & MMU_DESCRIPTOR_L1_TEX_TYPE_MASK) {
|
||||
case MMU_DESCRIPTOR_L1_TYPE_STRONGLY_ORDERED:
|
||||
*flags |= VM_MAP_REGION_FLAG_STRONGLY_ORDERED;
|
||||
break;
|
||||
case MMU_DESCRIPTOR_L1_TYPE_NORMAL_NOCACHE:
|
||||
*flags |= VM_MAP_REGION_FLAG_UNCACHED;
|
||||
break;
|
||||
case MMU_DESCRIPTOR_L1_TYPE_DEVICE_SHARED:
|
||||
@@ -304,34 +438,54 @@ STATIC VOID OsCvtSecAttsToFlags(PTE_T l1Entry, UINT32 *flags)
|
||||
}
|
||||
}
|
||||
|
||||
STATIC UINT32 OsUnmapL2PTE(const LosArchMmu *archMmu, vaddr_t vaddr, UINT32 *count)
|
||||
STATIC UINT32 OsUnmapL2PTE(LosArchMmu *archMmu, PTE_T *pte1, vaddr_t vaddr, UINT32 *count)
|
||||
{
|
||||
UINT32 unmapCount;
|
||||
UINT32 pte2Index;
|
||||
UINT32 intSave;
|
||||
PTE_T *pte2BasePtr = NULL;
|
||||
|
||||
pte2BasePtr = OsGetPte2BasePtr(OsGetPte1((PTE_T *)archMmu->virtTtb, vaddr));
|
||||
if (pte2BasePtr == NULL) {
|
||||
LOS_Panic("%s %d, pte2 base ptr is NULL\n", __FUNCTION__, __LINE__);
|
||||
}
|
||||
SPIN_LOCK_S *lock = NULL;
|
||||
|
||||
pte2Index = OsGetPte2Index(vaddr);
|
||||
unmapCount = MIN2(MMU_DESCRIPTOR_L2_NUMBERS_PER_L1 - pte2Index, *count);
|
||||
|
||||
lock = OsGetPte2Lock(archMmu, *pte1, &intSave);
|
||||
if (lock == NULL) {
|
||||
return unmapCount;
|
||||
}
|
||||
|
||||
pte2BasePtr = OsGetPte2BasePtr(*pte1);
|
||||
if (pte2BasePtr == NULL) {
|
||||
OsUnlockPte2(lock, intSave);
|
||||
return unmapCount;
|
||||
}
|
||||
|
||||
/* unmap page run */
|
||||
OsClearPte2Continuous(&pte2BasePtr[pte2Index], unmapCount);
|
||||
|
||||
/* invalidate tlb */
|
||||
OsArmInvalidateTlbMvaRangeNoBarrier(vaddr, unmapCount);
|
||||
OsUnlockPte2(lock, intSave);
|
||||
|
||||
*count -= unmapCount;
|
||||
return unmapCount;
|
||||
}
|
||||
|
||||
STATIC UINT32 OsUnmapSection(LosArchMmu *archMmu, vaddr_t *vaddr, UINT32 *count)
|
||||
STATIC UINT32 OsUnmapSection(LosArchMmu *archMmu, PTE_T *l1Entry, vaddr_t *vaddr, UINT32 *count)
|
||||
{
|
||||
UINT32 intSave;
|
||||
PADDR_T pte1Paddr;
|
||||
SPIN_LOCK_S *lock = NULL;
|
||||
|
||||
pte1Paddr = OsGetPte1Paddr(archMmu->physTtb, *vaddr);
|
||||
lock = OsGetPte1Lock(archMmu, pte1Paddr, &intSave);
|
||||
if (!OsIsPte1Section(*l1Entry)) {
|
||||
OsUnlockPte1(lock, intSave);
|
||||
return 0;
|
||||
}
|
||||
OsClearPte1(OsGetPte1Ptr((PTE_T *)archMmu->virtTtb, *vaddr));
|
||||
OsArmInvalidateTlbMvaNoBarrier(*vaddr);
|
||||
OsUnlockPte1(lock, intSave);
|
||||
|
||||
*vaddr += MMU_DESCRIPTOR_L1_SMALL_SIZE;
|
||||
*count -= MMU_DESCRIPTOR_L2_NUMBERS_PER_L1;
|
||||
@@ -339,20 +493,18 @@ STATIC UINT32 OsUnmapSection(LosArchMmu *archMmu, vaddr_t *vaddr, UINT32 *count)
|
||||
return MMU_DESCRIPTOR_L2_NUMBERS_PER_L1;
|
||||
}
|
||||
|
||||
|
||||
BOOL OsArchMmuInit(LosArchMmu *archMmu, VADDR_T *virtTtb)
|
||||
{
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
if (OsAllocAsid(&archMmu->asid) != LOS_OK) {
|
||||
VM_ERR("alloc arch mmu asid failed");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
status_t retval = LOS_MuxInit(&archMmu->mtx, NULL);
|
||||
if (retval != LOS_OK) {
|
||||
VM_ERR("Create mutex for arch mmu failed, status: %d", retval);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef LOSCFG_PAGE_TABLE_FINE_LOCK
|
||||
LOS_SpinInit(&archMmu->lock);
|
||||
#endif
|
||||
LOS_ListInit(&archMmu->ptList);
|
||||
archMmu->virtTtb = virtTtb;
|
||||
archMmu->physTtb = (VADDR_T)(UINTPTR)virtTtb - KERNEL_ASPACE_BASE + SYS_MEM_BASE;
|
||||
@@ -401,45 +553,55 @@ STATUS_T LOS_ArchMmuQuery(const LosArchMmu *archMmu, VADDR_T vaddr, PADDR_T *pad
|
||||
|
||||
STATUS_T LOS_ArchMmuUnmap(LosArchMmu *archMmu, VADDR_T vaddr, size_t count)
|
||||
{
|
||||
PTE_T l1Entry;
|
||||
PTE_T *l1Entry = NULL;
|
||||
INT32 unmapped = 0;
|
||||
UINT32 unmapCount = 0;
|
||||
INT32 tryTime = TRY_MAX_TIMES;
|
||||
|
||||
while (count > 0) {
|
||||
l1Entry = OsGetPte1(archMmu->virtTtb, vaddr);
|
||||
if (OsIsPte1Invalid(l1Entry)) {
|
||||
l1Entry = OsGetPte1Ptr(archMmu->virtTtb, vaddr);
|
||||
if (OsIsPte1Invalid(*l1Entry)) {
|
||||
unmapCount = OsUnmapL1Invalid(&vaddr, &count);
|
||||
} else if (OsIsPte1Section(l1Entry)) {
|
||||
} else if (OsIsPte1Section(*l1Entry)) {
|
||||
if (MMU_DESCRIPTOR_IS_L1_SIZE_ALIGNED(vaddr) && count >= MMU_DESCRIPTOR_L2_NUMBERS_PER_L1) {
|
||||
unmapCount = OsUnmapSection(archMmu, &vaddr, &count);
|
||||
unmapCount = OsUnmapSection(archMmu, l1Entry, &vaddr, &count);
|
||||
} else {
|
||||
LOS_Panic("%s %d, unimplemented\n", __FUNCTION__, __LINE__);
|
||||
}
|
||||
} else if (OsIsPte1PageTable(l1Entry)) {
|
||||
unmapCount = OsUnmapL2PTE(archMmu, vaddr, &count);
|
||||
OsTryUnmapL1PTE(archMmu, vaddr, OsGetPte2Index(vaddr) + unmapCount,
|
||||
MMU_DESCRIPTOR_L2_NUMBERS_PER_L1 - unmapCount);
|
||||
} else if (OsIsPte1PageTable(*l1Entry)) {
|
||||
unmapCount = OsUnmapL2PTE(archMmu, l1Entry, vaddr, &count);
|
||||
OsTryUnmapL1PTE(archMmu, l1Entry, vaddr, OsGetPte2Index(vaddr) + unmapCount,
|
||||
MMU_DESCRIPTOR_L2_NUMBERS_PER_L1);
|
||||
vaddr += unmapCount << MMU_DESCRIPTOR_L2_SMALL_SHIFT;
|
||||
} else {
|
||||
LOS_Panic("%s %d, unimplemented\n", __FUNCTION__, __LINE__);
|
||||
}
|
||||
tryTime = (unmapCount == 0) ? (tryTime - 1) : tryTime;
|
||||
if (tryTime == 0) {
|
||||
return LOS_ERRNO_VM_FAULT;
|
||||
}
|
||||
unmapped += unmapCount;
|
||||
}
|
||||
OsArmInvalidateTlbBarrier();
|
||||
return unmapped;
|
||||
}
|
||||
|
||||
STATIC UINT32 OsMapSection(const LosArchMmu *archMmu, UINT32 flags, VADDR_T *vaddr,
|
||||
PADDR_T *paddr, UINT32 *count)
|
||||
STATIC UINT32 OsMapSection(MmuMapInfo *mmuMapInfo, UINT32 *count)
|
||||
{
|
||||
UINT32 mmuFlags = 0;
|
||||
UINT32 intSave;
|
||||
PADDR_T pte1Paddr;
|
||||
SPIN_LOCK_S *lock = NULL;
|
||||
|
||||
mmuFlags |= OsCvtSecFlagsToAttrs(flags);
|
||||
OsSavePte1(OsGetPte1Ptr(archMmu->virtTtb, *vaddr),
|
||||
OsTruncPte1(*paddr) | mmuFlags | MMU_DESCRIPTOR_L1_TYPE_SECTION);
|
||||
mmuFlags |= OsCvtSecFlagsToAttrs(*mmuMapInfo->flags);
|
||||
pte1Paddr = OsGetPte1Paddr(mmuMapInfo->archMmu->physTtb, *mmuMapInfo->vaddr);
|
||||
lock = OsGetPte1Lock(mmuMapInfo->archMmu, pte1Paddr, &intSave);
|
||||
OsSavePte1(OsGetPte1Ptr(mmuMapInfo->archMmu->virtTtb, *mmuMapInfo->vaddr),
|
||||
OsTruncPte1(*mmuMapInfo->paddr) | mmuFlags | MMU_DESCRIPTOR_L1_TYPE_SECTION);
|
||||
OsUnlockPte1(lock, intSave);
|
||||
*count -= MMU_DESCRIPTOR_L2_NUMBERS_PER_L1;
|
||||
*vaddr += MMU_DESCRIPTOR_L1_SMALL_SIZE;
|
||||
*paddr += MMU_DESCRIPTOR_L1_SMALL_SIZE;
|
||||
*mmuMapInfo->vaddr += MMU_DESCRIPTOR_L1_SMALL_SIZE;
|
||||
*mmuMapInfo->paddr += MMU_DESCRIPTOR_L1_SMALL_SIZE;
|
||||
|
||||
return MMU_DESCRIPTOR_L2_NUMBERS_PER_L1;
|
||||
}
|
||||
@@ -449,7 +611,6 @@ STATIC STATUS_T OsGetL2Table(LosArchMmu *archMmu, UINT32 l1Index, paddr_t *ppa)
|
||||
UINT32 index;
|
||||
PTE_T ttEntry;
|
||||
VADDR_T *kvaddr = NULL;
|
||||
LosVmPage *vmPage = NULL;
|
||||
UINT32 l2Offset = (MMU_DESCRIPTOR_L2_SMALL_SIZE / MMU_DESCRIPTOR_L1_SMALL_L2_TABLES_PER_PAGE) *
|
||||
(l1Index & (MMU_DESCRIPTOR_L1_SMALL_L2_TABLES_PER_PAGE - 1));
|
||||
/* lookup an existing l2 page table */
|
||||
@@ -462,77 +623,95 @@ STATIC STATUS_T OsGetL2Table(LosArchMmu *archMmu, UINT32 l1Index, paddr_t *ppa)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
/* not found: allocate one (paddr) */
|
||||
vmPage = LOS_PhysPageAlloc();
|
||||
LosVmPage *vmPage = LOS_PhysPageAlloc();
|
||||
if (vmPage == NULL) {
|
||||
VM_ERR("have no memory to save l2 page");
|
||||
return LOS_ERRNO_VM_NO_MEMORY;
|
||||
}
|
||||
LOS_ListAdd(&archMmu->ptList, &vmPage->node);
|
||||
kvaddr = OsVmPageToVaddr(vmPage);
|
||||
#else
|
||||
kvaddr = LOS_MemAlloc(OS_SYS_MEM_ADDR, MMU_DESCRIPTOR_L2_SMALL_SIZE);
|
||||
if (kvaddr == NULL) {
|
||||
VM_ERR("have no memory to save l2 page");
|
||||
return LOS_ERRNO_VM_NO_MEMORY;
|
||||
}
|
||||
#endif
|
||||
(VOID)memset_s(kvaddr, MMU_DESCRIPTOR_L2_SMALL_SIZE, 0, MMU_DESCRIPTOR_L2_SMALL_SIZE);
|
||||
|
||||
/* get physical address */
|
||||
*ppa = LOS_PaddrQuery(kvaddr) + l2Offset;
|
||||
*ppa = OsKVaddrToPaddr((VADDR_T)kvaddr) + l2Offset;
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
STATIC VOID OsMapL1PTE(LosArchMmu *archMmu, PTE_T *pte1Ptr, vaddr_t vaddr, UINT32 flags)
|
||||
{
|
||||
paddr_t pte2Base = 0;
|
||||
|
||||
if (OsGetL2Table(archMmu, OsGetPte1Index(vaddr), &pte2Base) != LOS_OK) {
|
||||
LOS_Panic("%s %d, failed to allocate pagetable\n", __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
*pte1Ptr = pte2Base | MMU_DESCRIPTOR_L1_TYPE_PAGE_TABLE;
|
||||
if (flags & VM_MAP_REGION_FLAG_NS) {
|
||||
*pte1Ptr |= MMU_DESCRIPTOR_L1_PAGETABLE_NON_SECURE;
|
||||
}
|
||||
*pte1Ptr &= MMU_DESCRIPTOR_L1_SMALL_DOMAIN_MASK;
|
||||
*pte1Ptr |= MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT; // use client AP
|
||||
OsSavePte1(OsGetPte1Ptr(archMmu->virtTtb, vaddr), *pte1Ptr);
|
||||
}
|
||||
|
||||
/* convert user level mmu flags to L2 descriptors flags */
|
||||
STATIC UINT32 OsCvtPte2FlagsToAttrs(uint32_t flags)
|
||||
STATIC UINT32 OsCvtPte2CacheFlagsToMMUFlags(UINT32 flags)
|
||||
{
|
||||
UINT32 mmuFlags = 0;
|
||||
|
||||
switch (flags & VM_MAP_REGION_FLAG_CACHE_MASK) {
|
||||
case VM_MAP_REGION_FLAG_CACHED:
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_SHAREABLE;
|
||||
#endif
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_NORMAL_WRITE_BACK_ALLOCATE;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_WRITE_COMBINING:
|
||||
case VM_MAP_REGION_FLAG_UNCACHED:
|
||||
case VM_MAP_REGION_FLAG_STRONGLY_ORDERED:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_STRONGLY_ORDERED;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_UNCACHED:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_NORMAL_NOCACHE;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_UNCACHED_DEVICE:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_DEVICE_SHARED;
|
||||
break;
|
||||
default:
|
||||
return LOS_ERRNO_VM_INVALID_ARGS;
|
||||
}
|
||||
return mmuFlags;
|
||||
}
|
||||
|
||||
switch (flags & (VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_WRITE)) {
|
||||
STATIC UINT32 OsCvtPte2AccessFlagsToMMUFlags(UINT32 flags)
|
||||
{
|
||||
UINT32 mmuFlags = 0;
|
||||
|
||||
switch (flags & (VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE)) {
|
||||
case 0:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_NA_U_NA;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_PERM_READ:
|
||||
case VM_MAP_REGION_FLAG_PERM_USER:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_AP_P_RO_U_NA;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_PERM_WRITE:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_AP_P_RW_U_NA;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_PERM_USER:
|
||||
case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_AP_P_RO_U_RO;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_PERM_WRITE:
|
||||
case VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_AP_P_RW_U_NA;
|
||||
break;
|
||||
case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_WRITE:
|
||||
case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_AP_P_RW_U_RW;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return mmuFlags;
|
||||
}
|
||||
|
||||
/* convert user level mmu flags to L2 descriptors flags */
|
||||
STATIC UINT32 OsCvtPte2FlagsToAttrs(UINT32 flags)
|
||||
{
|
||||
UINT32 mmuFlags;
|
||||
|
||||
mmuFlags = OsCvtPte2CacheFlagsToMMUFlags(flags);
|
||||
if (mmuFlags == LOS_ERRNO_VM_INVALID_ARGS) {
|
||||
return mmuFlags;
|
||||
}
|
||||
|
||||
mmuFlags |= OsCvtPte2AccessFlagsToMMUFlags(flags);
|
||||
|
||||
if (!(flags & VM_MAP_REGION_FLAG_PERM_EXECUTE)) {
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_SMALL_PAGE_XN;
|
||||
@@ -547,32 +726,93 @@ STATIC UINT32 OsCvtPte2FlagsToAttrs(uint32_t flags)
|
||||
return mmuFlags;
|
||||
}
|
||||
|
||||
STATIC UINT32 OsMapL2PageContinous(PTE_T pte1, UINT32 flags, VADDR_T *vaddr, PADDR_T *paddr, UINT32 *count)
|
||||
STATIC UINT32 OsMapL1PTE(MmuMapInfo *mmuMapInfo, PTE_T *l1Entry, UINT32 *count)
|
||||
{
|
||||
PADDR_T pte2Base = 0;
|
||||
PADDR_T pte1Paddr;
|
||||
SPIN_LOCK_S *pte1Lock = NULL;
|
||||
SPIN_LOCK_S *pte2Lock = NULL;
|
||||
PTE_T *pte2BasePtr = NULL;
|
||||
UINT32 saveCounts, archFlags, pte1IntSave, pte2IntSave;
|
||||
|
||||
pte1Paddr = OsGetPte1Paddr(mmuMapInfo->archMmu->physTtb, *mmuMapInfo->vaddr);
|
||||
pte1Lock = OsGetPte1Lock(mmuMapInfo->archMmu, pte1Paddr, &pte1IntSave);
|
||||
if (!OsIsPte1Invalid(*l1Entry)) {
|
||||
OsUnlockPte1(pte1Lock, pte1IntSave);
|
||||
return 0;
|
||||
}
|
||||
if (OsGetL2Table(mmuMapInfo->archMmu, OsGetPte1Index(*mmuMapInfo->vaddr), &pte2Base) != LOS_OK) {
|
||||
LOS_Panic("%s %d, failed to allocate pagetable\n", __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
*l1Entry = pte2Base | MMU_DESCRIPTOR_L1_TYPE_PAGE_TABLE;
|
||||
if (*mmuMapInfo->flags & VM_MAP_REGION_FLAG_NS) {
|
||||
*l1Entry |= MMU_DESCRIPTOR_L1_PAGETABLE_NON_SECURE;
|
||||
}
|
||||
*l1Entry &= MMU_DESCRIPTOR_L1_SMALL_DOMAIN_MASK;
|
||||
*l1Entry |= MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT; // use client AP
|
||||
OsSavePte1(OsGetPte1Ptr(mmuMapInfo->archMmu->virtTtb, *mmuMapInfo->vaddr), *l1Entry);
|
||||
OsUnlockPte1(pte1Lock, pte1IntSave);
|
||||
|
||||
pte2Lock = OsGetPte2Lock(mmuMapInfo->archMmu, *l1Entry, &pte2IntSave);
|
||||
if (pte2Lock == NULL) {
|
||||
LOS_Panic("pte2 should not be null!\n");
|
||||
}
|
||||
pte2BasePtr = (PTE_T *)LOS_PaddrToKVaddr(pte2Base);
|
||||
|
||||
/* compute the arch flags for L2 4K pages */
|
||||
archFlags = OsCvtPte2FlagsToAttrs(*mmuMapInfo->flags);
|
||||
saveCounts = OsSavePte2Continuous(pte2BasePtr, OsGetPte2Index(*mmuMapInfo->vaddr), *mmuMapInfo->paddr | archFlags,
|
||||
*count);
|
||||
OsUnlockPte2(pte2Lock, pte2IntSave);
|
||||
*mmuMapInfo->paddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
|
||||
*mmuMapInfo->vaddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
|
||||
*count -= saveCounts;
|
||||
return saveCounts;
|
||||
}
|
||||
|
||||
STATIC UINT32 OsMapL2PageContinous(MmuMapInfo *mmuMapInfo, PTE_T *pte1, UINT32 *count)
|
||||
{
|
||||
PTE_T *pte2BasePtr = NULL;
|
||||
UINT32 archFlags;
|
||||
UINT32 saveCounts;
|
||||
UINT32 intSave;
|
||||
SPIN_LOCK_S *lock = NULL;
|
||||
|
||||
pte2BasePtr = OsGetPte2BasePtr(pte1);
|
||||
lock = OsGetPte2Lock(mmuMapInfo->archMmu, *pte1, &intSave);
|
||||
if (lock == NULL) {
|
||||
return 0;
|
||||
}
|
||||
pte2BasePtr = OsGetPte2BasePtr(*pte1);
|
||||
if (pte2BasePtr == NULL) {
|
||||
LOS_Panic("%s %d, pte1 %#x error\n", __FUNCTION__, __LINE__, pte1);
|
||||
OsUnlockPte2(lock, intSave);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* compute the arch flags for L2 4K pages */
|
||||
archFlags = OsCvtPte2FlagsToAttrs(flags);
|
||||
saveCounts = OsSavePte2Continuous(pte2BasePtr, OsGetPte2Index(*vaddr), *paddr | archFlags, *count);
|
||||
*paddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
|
||||
*vaddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
|
||||
archFlags = OsCvtPte2FlagsToAttrs(*mmuMapInfo->flags);
|
||||
saveCounts = OsSavePte2Continuous(pte2BasePtr, OsGetPte2Index(*mmuMapInfo->vaddr), *mmuMapInfo->paddr | archFlags,
|
||||
*count);
|
||||
OsUnlockPte2(lock, intSave);
|
||||
*mmuMapInfo->paddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
|
||||
*mmuMapInfo->vaddr += (saveCounts << MMU_DESCRIPTOR_L2_SMALL_SHIFT);
|
||||
*count -= saveCounts;
|
||||
return saveCounts;
|
||||
}
|
||||
|
||||
status_t LOS_ArchMmuMap(LosArchMmu *archMmu, VADDR_T vaddr, PADDR_T paddr, size_t count, UINT32 flags)
|
||||
{
|
||||
PTE_T l1Entry;
|
||||
PTE_T *l1Entry = NULL;
|
||||
UINT32 saveCounts = 0;
|
||||
INT32 mapped = 0;
|
||||
INT32 tryTime = TRY_MAX_TIMES;
|
||||
INT32 checkRst;
|
||||
MmuMapInfo mmuMapInfo = {
|
||||
.archMmu = archMmu,
|
||||
.vaddr = &vaddr,
|
||||
.paddr = &paddr,
|
||||
.flags = &flags,
|
||||
};
|
||||
|
||||
checkRst = OsMapParamCheck(flags, vaddr, paddr);
|
||||
if (checkRst < 0) {
|
||||
@@ -581,24 +821,27 @@ status_t LOS_ArchMmuMap(LosArchMmu *archMmu, VADDR_T vaddr, PADDR_T paddr, size_
|
||||
|
||||
/* see what kind of mapping we can use */
|
||||
while (count > 0) {
|
||||
if (MMU_DESCRIPTOR_IS_L1_SIZE_ALIGNED(vaddr) &&
|
||||
MMU_DESCRIPTOR_IS_L1_SIZE_ALIGNED(paddr) &&
|
||||
if (MMU_DESCRIPTOR_IS_L1_SIZE_ALIGNED(*mmuMapInfo.vaddr) &&
|
||||
MMU_DESCRIPTOR_IS_L1_SIZE_ALIGNED(*mmuMapInfo.paddr) &&
|
||||
count >= MMU_DESCRIPTOR_L2_NUMBERS_PER_L1) {
|
||||
/* compute the arch flags for L1 sections cache, r ,w ,x, domain and type */
|
||||
saveCounts = OsMapSection(archMmu, flags, &vaddr, &paddr, &count);
|
||||
saveCounts = OsMapSection(&mmuMapInfo, &count);
|
||||
} else {
|
||||
/* have to use a L2 mapping, we only allocate 4KB for L1, support 0 ~ 1GB */
|
||||
l1Entry = OsGetPte1(archMmu->virtTtb, vaddr);
|
||||
if (OsIsPte1Invalid(l1Entry)) {
|
||||
OsMapL1PTE(archMmu, &l1Entry, vaddr, flags);
|
||||
saveCounts = OsMapL2PageContinous(l1Entry, flags, &vaddr, &paddr, &count);
|
||||
} else if (OsIsPte1PageTable(l1Entry)) {
|
||||
saveCounts = OsMapL2PageContinous(l1Entry, flags, &vaddr, &paddr, &count);
|
||||
l1Entry = OsGetPte1Ptr(archMmu->virtTtb, *mmuMapInfo.vaddr);
|
||||
if (OsIsPte1Invalid(*l1Entry)) {
|
||||
saveCounts = OsMapL1PTE(&mmuMapInfo, l1Entry, &count);
|
||||
} else if (OsIsPte1PageTable(*l1Entry)) {
|
||||
saveCounts = OsMapL2PageContinous(&mmuMapInfo, l1Entry, &count);
|
||||
} else {
|
||||
LOS_Panic("%s %d, unimplemented tt_entry %x\n", __FUNCTION__, __LINE__, l1Entry);
|
||||
}
|
||||
}
|
||||
mapped += saveCounts;
|
||||
tryTime = (saveCounts == 0) ? (tryTime - 1) : tryTime;
|
||||
if (tryTime == 0) {
|
||||
return LOS_ERRNO_VM_TIMED_OUT;
|
||||
}
|
||||
}
|
||||
|
||||
return mapped;
|
||||
@@ -624,8 +867,7 @@ STATUS_T LOS_ArchMmuChangeProt(LosArchMmu *archMmu, VADDR_T vaddr, size_t count,
|
||||
|
||||
status = LOS_ArchMmuUnmap(archMmu, vaddr, 1);
|
||||
if (status < 0) {
|
||||
VM_ERR("invalid args:aspace %p, vaddr %p, count %d",
|
||||
__FUNCTION__, __LINE__, archMmu, vaddr, count);
|
||||
VM_ERR("invalid args:aspace %p, vaddr %p, count %d", archMmu, vaddr, count);
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
@@ -646,7 +888,7 @@ STATUS_T LOS_ArchMmuMove(LosArchMmu *archMmu, VADDR_T oldVaddr, VADDR_T newVaddr
|
||||
PADDR_T paddr = 0;
|
||||
|
||||
if ((archMmu == NULL) || (oldVaddr == 0) || (newVaddr == 0) || (count == 0)) {
|
||||
VM_ERR("invalid args: archMmu %p, oldVaddr %p, newVddr %p, count %d",
|
||||
VM_ERR("invalid args: archMmu %p, oldVaddr %p, newVaddr %p, count %d",
|
||||
archMmu, oldVaddr, newVaddr, count);
|
||||
return LOS_NOK;
|
||||
}
|
||||
@@ -694,30 +936,35 @@ VOID LOS_ArchMmuContextSwitch(LosArchMmu *archMmu)
|
||||
ttbcr |= MMU_DESCRIPTOR_TTBCR_PD0;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
/* from armv7a arm B3.10.4, we should do synchronization changes of ASID and TTBR. */
|
||||
OsArmWriteContextidr(LOS_GetKVmSpace()->archMmu.asid);
|
||||
ISB;
|
||||
#endif
|
||||
OsArmWriteTtbr0(ttbr);
|
||||
ISB;
|
||||
OsArmWriteTtbcr(ttbcr);
|
||||
ISB;
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
if (archMmu) {
|
||||
OsArmWriteContextidr(archMmu->asid);
|
||||
ISB;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
STATUS_T LOS_ArchMmuDestroy(LosArchMmu *archMmu)
|
||||
{
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
LosVmPage *page = NULL;
|
||||
/* free all of the pages allocated in archMmu->ptList */
|
||||
while ((page = LOS_ListRemoveHeadType(&archMmu->ptList, LosVmPage, node)) != NULL) {
|
||||
LOS_PhysPageFree(page);
|
||||
}
|
||||
|
||||
OsArmWriteTlbiasid(archMmu->asid);
|
||||
OsArmWriteTlbiasidis(archMmu->asid);
|
||||
OsFreeAsid(archMmu->asid);
|
||||
(VOID)LOS_MuxDestroy(&archMmu->mtx);
|
||||
#endif
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
@@ -749,38 +996,34 @@ STATIC VOID OsSwitchTmpTTB(VOID)
|
||||
ISB;
|
||||
}
|
||||
|
||||
VADDR_T *OsGFirstTableGet()
|
||||
{
|
||||
return (VADDR_T *)g_firstPageTable;
|
||||
}
|
||||
|
||||
STATIC VOID OsSetKSectionAttr(VOID)
|
||||
STATIC VOID OsSetKSectionAttr(UINTPTR virtAddr, BOOL uncached)
|
||||
{
|
||||
UINT32 offset = virtAddr - KERNEL_VMM_BASE;
|
||||
/* every section should be page aligned */
|
||||
UINTPTR textStart = (UINTPTR)&__text_start;
|
||||
UINTPTR textEnd = (UINTPTR)&__text_end;
|
||||
UINTPTR rodataStart = (UINTPTR)&__rodata_start;
|
||||
UINTPTR rodataEnd = (UINTPTR)&__rodata_end;
|
||||
UINTPTR ramDataStart = (UINTPTR)&__ram_data_start;
|
||||
UINTPTR bssEnd = (UINTPTR)&__bss_end;
|
||||
UINTPTR textStart = (UINTPTR)&__text_start + offset;
|
||||
UINTPTR textEnd = (UINTPTR)&__text_end + offset;
|
||||
UINTPTR rodataStart = (UINTPTR)&__rodata_start + offset;
|
||||
UINTPTR rodataEnd = (UINTPTR)&__rodata_end + offset;
|
||||
UINTPTR ramDataStart = (UINTPTR)&__ram_data_start + offset;
|
||||
UINTPTR bssEnd = (UINTPTR)&__bss_end + offset;
|
||||
UINT32 bssEndBoundary = ROUNDUP(bssEnd, MB);
|
||||
LosArchMmuInitMapping mmuKernelMappings[] = {
|
||||
{
|
||||
.phys = SYS_MEM_BASE + textStart - KERNEL_VMM_BASE,
|
||||
.phys = SYS_MEM_BASE + textStart - virtAddr,
|
||||
.virt = textStart,
|
||||
.size = ROUNDUP(textEnd - textStart, MMU_DESCRIPTOR_L2_SMALL_SIZE),
|
||||
.flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_EXECUTE,
|
||||
.name = "kernel_text"
|
||||
},
|
||||
{
|
||||
.phys = SYS_MEM_BASE + rodataStart - KERNEL_VMM_BASE,
|
||||
.phys = SYS_MEM_BASE + rodataStart - virtAddr,
|
||||
.virt = rodataStart,
|
||||
.size = ROUNDUP(rodataEnd - rodataStart, MMU_DESCRIPTOR_L2_SMALL_SIZE),
|
||||
.flags = VM_MAP_REGION_FLAG_PERM_READ,
|
||||
.name = "kernel_rodata"
|
||||
},
|
||||
{
|
||||
.phys = SYS_MEM_BASE + ramDataStart - KERNEL_VMM_BASE,
|
||||
.phys = SYS_MEM_BASE + ramDataStart - virtAddr,
|
||||
.virt = ramDataStart,
|
||||
.size = ROUNDUP(bssEndBoundary - ramDataStart, MMU_DESCRIPTOR_L2_SMALL_SIZE),
|
||||
.flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE,
|
||||
@@ -790,26 +1033,29 @@ STATIC VOID OsSetKSectionAttr(VOID)
|
||||
LosVmSpace *kSpace = LOS_GetKVmSpace();
|
||||
status_t status;
|
||||
UINT32 length;
|
||||
paddr_t oldTtPhyBase;
|
||||
int i;
|
||||
INT32 i;
|
||||
LosArchMmuInitMapping *kernelMap = NULL;
|
||||
UINT32 kmallocLength;
|
||||
UINT32 flags;
|
||||
|
||||
/* use second-level mapping of default READ and WRITE */
|
||||
kSpace->archMmu.virtTtb = (PTE_T *)g_firstPageTable;
|
||||
kSpace->archMmu.physTtb = LOS_PaddrQuery(kSpace->archMmu.virtTtb);
|
||||
status = LOS_ArchMmuUnmap(&kSpace->archMmu, KERNEL_VMM_BASE,
|
||||
(bssEndBoundary - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT);
|
||||
if (status != ((bssEndBoundary - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
status = LOS_ArchMmuUnmap(&kSpace->archMmu, virtAddr,
|
||||
(bssEndBoundary - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT);
|
||||
if (status != ((bssEndBoundary - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
VM_ERR("unmap failed, status: %d", status);
|
||||
return;
|
||||
}
|
||||
|
||||
status = LOS_ArchMmuMap(&kSpace->archMmu, KERNEL_VMM_BASE, SYS_MEM_BASE,
|
||||
(textStart - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
|
||||
VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE |
|
||||
VM_MAP_REGION_FLAG_PERM_EXECUTE);
|
||||
if (status != ((textStart - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE | VM_MAP_REGION_FLAG_PERM_EXECUTE;
|
||||
if (uncached) {
|
||||
flags |= VM_MAP_REGION_FLAG_UNCACHED;
|
||||
}
|
||||
status = LOS_ArchMmuMap(&kSpace->archMmu, virtAddr, SYS_MEM_BASE,
|
||||
(textStart - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
|
||||
flags);
|
||||
if (status != ((textStart - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
VM_ERR("mmap failed, status: %d", status);
|
||||
return;
|
||||
}
|
||||
@@ -817,6 +1063,9 @@ STATIC VOID OsSetKSectionAttr(VOID)
|
||||
length = sizeof(mmuKernelMappings) / sizeof(LosArchMmuInitMapping);
|
||||
for (i = 0; i < length; i++) {
|
||||
kernelMap = &mmuKernelMappings[i];
|
||||
if (uncached) {
|
||||
kernelMap->flags |= VM_MAP_REGION_FLAG_UNCACHED;
|
||||
}
|
||||
status = LOS_ArchMmuMap(&kSpace->archMmu, kernelMap->virt, kernelMap->phys,
|
||||
kernelMap->size >> MMU_DESCRIPTOR_L2_SMALL_SHIFT, kernelMap->flags);
|
||||
if (status != (kernelMap->size >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
@@ -826,16 +1075,29 @@ STATIC VOID OsSetKSectionAttr(VOID)
|
||||
LOS_VmSpaceReserve(kSpace, kernelMap->size, kernelMap->virt);
|
||||
}
|
||||
|
||||
kmallocLength = KERNEL_VMM_BASE + SYS_MEM_SIZE_DEFAULT - bssEndBoundary;
|
||||
kmallocLength = virtAddr + SYS_MEM_SIZE_DEFAULT - bssEndBoundary;
|
||||
flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE;
|
||||
if (uncached) {
|
||||
flags |= VM_MAP_REGION_FLAG_UNCACHED;
|
||||
}
|
||||
status = LOS_ArchMmuMap(&kSpace->archMmu, bssEndBoundary,
|
||||
SYS_MEM_BASE + bssEndBoundary - KERNEL_VMM_BASE,
|
||||
kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
|
||||
VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE);
|
||||
SYS_MEM_BASE + bssEndBoundary - virtAddr,
|
||||
kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
|
||||
flags);
|
||||
if (status != (kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
VM_ERR("unmap failed, status: %d", status);
|
||||
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();
|
||||
@@ -869,14 +1131,9 @@ VOID OsInitMappingStartUp(VOID)
|
||||
|
||||
OsSwitchTmpTTB();
|
||||
|
||||
OsSetKSectionAttr();
|
||||
|
||||
OsArchMmuInitPerCPU();
|
||||
OsSetKSectionAttr(KERNEL_VMM_BASE, FALSE);
|
||||
OsSetKSectionAttr(UNCACHED_VMM_BASE, TRUE);
|
||||
OsKSectionNewAttrEnable();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
|
||||
19
arch/arm/arm/src/los_asid.c
Executable file → Normal file
19
arch/arm/arm/src/los_asid.c
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -34,16 +34,13 @@
|
||||
* @ingroup kernel
|
||||
*/
|
||||
|
||||
#include "los_typedef.h"
|
||||
#include "los_asid.h"
|
||||
#include "los_bitmap.h"
|
||||
#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 */
|
||||
|
||||
207
arch/arm/arm/src/los_dispatch.S
Executable file → Normal file
207
arch/arm/arm/src/los_dispatch.S
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
* 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:
|
||||
@@ -32,20 +32,12 @@
|
||||
#include "asm.h"
|
||||
#include "arch_config.h"
|
||||
|
||||
#ifdef LOSCFG_KERNEL_SMP_LOCKDEP
|
||||
.extern OsLockDepCheckOut
|
||||
#endif
|
||||
.extern g_taskSpin
|
||||
.extern g_percpu
|
||||
.global OsStartToRun
|
||||
.extern OsSaveSignalContext
|
||||
.extern OsSchedToUserReleaseLock
|
||||
.global OsTaskSchedule
|
||||
.global OsTaskContextLoad
|
||||
.global OsIrqHandler
|
||||
.global ArchSpinUnlock
|
||||
.global OsSchedToUserSpinUnlock
|
||||
|
||||
.equ OS_TASK_STATUS_RUNNING, 0x0010U
|
||||
.equ OS_PERCPU_STRUCT_SIZE, 0x28U
|
||||
.equ OS_PERCPU_TASK_LOCK_OFFSET, 0x14U
|
||||
.fpu vfpv4
|
||||
|
||||
/* macros to align and unalign the stack on 8 byte boundary for ABI compliance */
|
||||
@@ -88,43 +80,22 @@
|
||||
#endif
|
||||
.endm
|
||||
|
||||
/* R0: new task */
|
||||
OsStartToRun:
|
||||
|
||||
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE)
|
||||
|
||||
LDRH R1, [R0, #4]
|
||||
ORR R1, #OS_TASK_STATUS_RUNNING
|
||||
STRH R1, [R0, #4]
|
||||
|
||||
/* R0 is new task, save it on tpidrprw */
|
||||
MCR p15, 0, R0, c13, c0, 4
|
||||
ISB
|
||||
|
||||
VPUSH {S0} /* fpu */
|
||||
VPOP {S0}
|
||||
VPUSH {D0}
|
||||
VPOP {D0}
|
||||
|
||||
B OsTaskContextLoad
|
||||
|
||||
/*
|
||||
* R0: new task
|
||||
* R1: run task
|
||||
*/
|
||||
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
|
||||
@@ -142,146 +113,96 @@ OsTaskContextLoad:
|
||||
/* restore fpu registers */
|
||||
POP_FPU_REGS R2
|
||||
|
||||
/* 8 bytes stack align */
|
||||
ADD SP, SP, #4
|
||||
|
||||
LDMFD SP!, {R0}
|
||||
MOV R4, R0
|
||||
AND R0, R0, #CPSR_MASK_MODE
|
||||
LDMFD SP!, {R4-R11}
|
||||
LDR R3, [SP, #(11 * 4)]
|
||||
AND R0, R3, #CPSR_MASK_MODE
|
||||
CMP R0, #CPSR_USER_MODE
|
||||
BNE OsKernelTaskLoad
|
||||
|
||||
MVN R2, #CPSR_INT_DISABLE
|
||||
AND R3, R3, R2
|
||||
STR R3, [SP, #(11 * 4)]
|
||||
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
#ifdef LOSCFG_KERNEL_SMP_LOCKDEP
|
||||
/* 8 bytes stack align */
|
||||
SUB SP, SP, #4
|
||||
LDR R0, =g_taskSpin
|
||||
BL OsLockDepCheckOut
|
||||
ADD SP, SP, #4
|
||||
#endif
|
||||
/* R0 = &g_taskSpin.rawLock */
|
||||
LDR R0, =g_taskSpin
|
||||
BL ArchSpinUnlock
|
||||
LDR R2, =g_percpu
|
||||
MRC P15, 0, R3, C0, C0, 5
|
||||
UXTB R3, R3
|
||||
MOV R1, #OS_PERCPU_STRUCT_SIZE
|
||||
MLA R3, R1, R3, R2
|
||||
MOV R2, #0
|
||||
STR R2, [R3, #OS_PERCPU_TASK_LOCK_OFFSET]
|
||||
BL OsSchedToUserReleaseLock
|
||||
#endif
|
||||
|
||||
MVN R3, #CPSR_INT_DISABLE
|
||||
AND R4, R4, R3
|
||||
MSR SPSR_cxsf, R4
|
||||
|
||||
/* restore r0-r12, lr */
|
||||
LDMFD SP!, {R0-R12}
|
||||
/* jump sp, reserved */
|
||||
ADD SP, SP, #(2 * 4)
|
||||
LDMFD SP, {R13, R14}^
|
||||
ADD SP, SP, #(2 * 4)
|
||||
LDMFD SP!, {PC}^
|
||||
LDMFD SP!, {R0-R3, R12, LR}
|
||||
RFEIA SP!
|
||||
|
||||
OsKernelTaskLoad:
|
||||
MSR SPSR_cxsf, R4
|
||||
/* restore r0-r12, lr */
|
||||
LDMFD SP!, {R0-R12}
|
||||
ADD SP, SP, #4
|
||||
LDMFD SP!, {LR, PC}^
|
||||
ADD SP, SP, #(4 * 4)
|
||||
LDMFD SP!, {R0-R3, R12, LR}
|
||||
RFEIA SP!
|
||||
|
||||
OsIrqHandler:
|
||||
SUB LR, LR, #4
|
||||
|
||||
/* push r0-r3 to irq stack */
|
||||
STMFD SP, {R0-R3}
|
||||
SUB R0, SP, #(4 * 4)
|
||||
MRS R1, SPSR
|
||||
MOV R2, LR
|
||||
|
||||
/* Save pc and cpsr to svc sp, ARMv6 and above support */
|
||||
SRSFD #0x13!
|
||||
/* disable irq, switch to svc mode */
|
||||
CPSID i, #0x13
|
||||
|
||||
/* push spsr and pc in svc stack */
|
||||
STMFD SP!, {R1, R2}
|
||||
STMFD SP, {LR}
|
||||
#ifdef LOSCFG_KERNEL_PERF
|
||||
PUSH {R0-R3, R12, LR}
|
||||
MOV R0, LR
|
||||
MOV R1, FP
|
||||
BL OsPerfSetIrqRegs
|
||||
POP {R0-R3, R12, LR}
|
||||
#endif
|
||||
|
||||
AND R3, R1, #CPSR_MASK_MODE
|
||||
CMP R3, #CPSR_USER_MODE
|
||||
BNE OsIrqFromKernel
|
||||
|
||||
/* push user sp, lr in svc stack */
|
||||
STMFD SP!, {R0-R3, R12, LR}
|
||||
STMFD SP, {R13, R14}^
|
||||
|
||||
OsIrqFromKernel:
|
||||
/* from svc not need save sp and lr */
|
||||
SUB SP, SP, #(2 * 4)
|
||||
|
||||
/* pop r0-r3 form irq stack*/
|
||||
LDMFD R0, {R0-R3}
|
||||
|
||||
/* push caller saved regs as trashed regs in svc stack */
|
||||
STMFD SP!, {R0-R3, R12}
|
||||
|
||||
/* 8 bytes stack align */
|
||||
SUB SP, SP, #4
|
||||
SUB SP, SP, #(4 * 4)
|
||||
STR R4, [SP, #0]
|
||||
|
||||
/*
|
||||
* save fpu regs in case in case those been
|
||||
* altered in interrupt handlers.
|
||||
*/
|
||||
PUSH_FPU_REGS R0
|
||||
#ifdef LOSCFG_IRQ_USE_STANDALONE_STACK
|
||||
PUSH {R4}
|
||||
|
||||
MOV R4, SP
|
||||
EXC_SP_SET __svc_stack_top, OS_EXC_SVC_STACK_SIZE, R1, R2
|
||||
#endif
|
||||
|
||||
BLX HalIrqHandler
|
||||
|
||||
#ifdef LOSCFG_IRQ_USE_STANDALONE_STACK
|
||||
MOV SP, R4
|
||||
POP {R4}
|
||||
#endif
|
||||
|
||||
/* process pending signals */
|
||||
BL OsTaskProcSignal
|
||||
|
||||
/* check if needs to schedule */
|
||||
CMP R0, #0
|
||||
BLNE OsSchedPreempt
|
||||
|
||||
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
|
||||
|
||||
607
arch/arm/arm/src/los_exc.c
Executable file → Normal file
607
arch/arm/arm/src/los_exc.c
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user