Compare commits
1041 Commits
android-sd
...
android-sd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a811d7a8e6 | ||
|
|
f0e402dbd2 | ||
|
|
2c287e9510 | ||
|
|
3ef4fecd30 | ||
|
|
98957db553 | ||
|
|
2e0452cbd1 | ||
|
|
f84bc8d6f6 | ||
|
|
204b26b440 | ||
|
|
f4b34b6c39 | ||
|
|
6c0e373d38 | ||
|
|
ec4326084e | ||
|
|
ecf67e152a | ||
|
|
d2eea0e6d6 | ||
|
|
2d51dddf1a | ||
|
|
baa74eff0d | ||
|
|
0c24effd01 | ||
|
|
85049ead25 | ||
|
|
95a7a64ac8 | ||
|
|
882c6af953 | ||
|
|
988ff8ff9f | ||
|
|
f707007435 | ||
|
|
a9dca77315 | ||
|
|
4430aa6aaa | ||
|
|
02e06782fc | ||
|
|
0ef0009044 | ||
|
|
30289f0dd6 | ||
|
|
47dc4d4310 | ||
|
|
88f1ea8f82 | ||
|
|
e58303249b | ||
|
|
2aceb4bcb3 | ||
|
|
e2a17ef444 | ||
|
|
77ac158e90 | ||
|
|
4198fa4c23 | ||
|
|
4b3ff1f0fa | ||
|
|
f8902bf707 | ||
|
|
047a285d41 | ||
|
|
b67d4ec5ba | ||
|
|
950a3c010c | ||
|
|
5151952197 | ||
|
|
e249b05963 | ||
|
|
b2af8b6848 | ||
|
|
1eaa3e6f72 | ||
|
|
66a97ea9fb | ||
|
|
77fd70758a | ||
|
|
4e9d953a0e | ||
|
|
5e58ea07d4 | ||
|
|
e895e6deaa | ||
|
|
965b867512 | ||
|
|
2b270a0cac | ||
|
|
155a70b93f | ||
|
|
c7fda6a96d | ||
|
|
a4ea1a3d2e | ||
|
|
de9db8f7ef | ||
|
|
d4623e56fb | ||
|
|
f7e403d663 | ||
|
|
8a05a01de7 | ||
|
|
2a54e5ecd0 | ||
|
|
fa36875df4 | ||
|
|
b5f053b5a7 | ||
|
|
b338ea30b2 | ||
|
|
88b61cb691 | ||
|
|
bec648ee9f | ||
|
|
8db4b91bd2 | ||
|
|
d2236e2c07 | ||
|
|
38bfa21695 | ||
|
|
478f8ff3f0 | ||
|
|
29861b5d8e | ||
|
|
b2550dd4c8 | ||
|
|
58d15966c8 | ||
|
|
4a9b7c694a | ||
|
|
af4d630e4d | ||
|
|
e007775f4b | ||
|
|
acf5aa76a5 | ||
|
|
f801cf55be | ||
|
|
47bda0c293 | ||
|
|
7593fa8eb7 | ||
|
|
86ec05acc9 | ||
|
|
ccd7ee624a | ||
|
|
90ae787b30 | ||
|
|
666d06fee9 | ||
|
|
0d207ba624 | ||
|
|
cc0f225365 | ||
|
|
7f79814798 | ||
|
|
cc8668f261 | ||
|
|
b03bc56b79 | ||
|
|
e77e1afe24 | ||
|
|
3a936a4980 | ||
|
|
f50b99f471 | ||
|
|
e8b4d67a37 | ||
|
|
59726beda5 | ||
|
|
12949e5d39 | ||
|
|
e3738414a6 | ||
|
|
f9920563da | ||
|
|
67546bf209 | ||
|
|
af4371b46b | ||
|
|
56ba6336d9 | ||
|
|
f1d57e1668 | ||
|
|
cf464878ef | ||
|
|
4d014e15b4 | ||
|
|
b010245490 | ||
|
|
b18d4f6361 | ||
|
|
7c7a7f8e52 | ||
|
|
72fcdbe902 | ||
|
|
d10309c36b | ||
|
|
691ef3c80b | ||
|
|
048569be54 | ||
|
|
973bf681b7 | ||
|
|
77039d3444 | ||
|
|
e8f815473b | ||
|
|
1ad05db9ce | ||
|
|
de0dc25112 | ||
|
|
41ff8b9804 | ||
|
|
6e3b0f2d2e | ||
|
|
09f76cdd9b | ||
|
|
183d0a57a2 | ||
|
|
85811fc7c2 | ||
|
|
dc81b44759 | ||
|
|
bfeab1bbe7 | ||
|
|
2da907059e | ||
|
|
008f4df5ba | ||
|
|
ff4608ae0c | ||
|
|
2e8f4345df | ||
|
|
faf361a6ac | ||
|
|
2fc3e1efda | ||
|
|
b2c5bd543d | ||
|
|
ac3e35cd8f | ||
|
|
a76f2ecaa2 | ||
|
|
26f2e4a163 | ||
|
|
f71d757f6e | ||
|
|
7310a1c432 | ||
|
|
82978cae4e | ||
|
|
ab558163a3 | ||
|
|
b9f0a6eb75 | ||
|
|
be19a36717 | ||
|
|
f34c6d7796 | ||
|
|
bc3740787a | ||
|
|
5ff2347130 | ||
|
|
877ad30fd6 | ||
|
|
507bcabb35 | ||
|
|
e03ab93699 | ||
|
|
63deae5e4f | ||
|
|
c0e3b9ddd6 | ||
|
|
b438c54d02 | ||
|
|
1db615b4ae | ||
|
|
5ac9eee1d3 | ||
|
|
954923858b | ||
|
|
1ad10a566e | ||
|
|
3e2d2936b0 | ||
|
|
b9ad1a1e00 | ||
|
|
6abab301db | ||
|
|
6fe901ef38 | ||
|
|
c6d95add30 | ||
|
|
8c368b5d1d | ||
|
|
fe7d7d4693 | ||
|
|
dde94f4c16 | ||
|
|
92133ca427 | ||
|
|
8b4e8a937b | ||
|
|
17d9be8ad7 | ||
|
|
8900e2de45 | ||
|
|
e5b85f45f9 | ||
|
|
e9b6fc6f82 | ||
|
|
0d7177c0d4 | ||
|
|
829c089f83 | ||
|
|
c4d1fecc10 | ||
|
|
15afed42ca | ||
|
|
f71fa0830a | ||
|
|
66edcd9dad | ||
|
|
5f1d206de3 | ||
|
|
e0d680176f | ||
|
|
2c344d3631 | ||
|
|
4f90a0932c | ||
|
|
d3d09f7d75 | ||
|
|
54662dd4de | ||
|
|
d7440f3725 | ||
|
|
069c64cdf2 | ||
|
|
1389db8b94 | ||
|
|
7cab21885a | ||
|
|
e026b1d89a | ||
|
|
ad18073897 | ||
|
|
d39c3abd5a | ||
|
|
3ffdef19b4 | ||
|
|
c7d9c40012 | ||
|
|
c410a9613a | ||
|
|
144c291866 | ||
|
|
f3cfcd869d | ||
|
|
c23092887f | ||
|
|
48c8880429 | ||
|
|
775dabd4d7 | ||
|
|
9dfaa63a1c | ||
|
|
8c7f4777ec | ||
|
|
d2d8031df1 | ||
|
|
bc366292ff | ||
|
|
3ad36e525f | ||
|
|
3697b52605 | ||
|
|
a190cbb825 | ||
|
|
05fddb41d0 | ||
|
|
a37ce7faa6 | ||
|
|
cbd76d15af | ||
|
|
eb75db7d83 | ||
|
|
81af404b63 | ||
|
|
f72ee26927 | ||
|
|
78a3069f82 | ||
|
|
e8198b97c3 | ||
|
|
0a150ead18 | ||
|
|
26facba288 | ||
|
|
404e28ff8c | ||
|
|
e49df0203c | ||
|
|
170ad35419 | ||
|
|
c7de022590 | ||
|
|
974e16cd82 | ||
|
|
c0b4d18d7d | ||
|
|
5ed48a4d7f | ||
|
|
f861705f8c | ||
|
|
5cd1efb2ba | ||
|
|
1bd035cf11 | ||
|
|
2f7d7c6538 | ||
|
|
4ac3b0a148 | ||
|
|
8af726b24f | ||
|
|
7b0d9b7984 | ||
|
|
bfc1d97531 | ||
|
|
cc1f4acbda | ||
|
|
76f60e2ebd | ||
|
|
fe87596a5b | ||
|
|
c37dcd3d3a | ||
|
|
999089181e | ||
|
|
dd0e991c6a | ||
|
|
2651d6c6cb | ||
|
|
9417a80e48 | ||
|
|
db2903fac3 | ||
|
|
cbeccc849a | ||
|
|
200de748b9 | ||
|
|
2932f04832 | ||
|
|
6d6731adc0 | ||
|
|
efd3983446 | ||
|
|
e5242bfdd7 | ||
|
|
1771a33d11 | ||
|
|
b7beb69075 | ||
|
|
ce5ba8bfcd | ||
|
|
28ae6f5dfd | ||
|
|
cefb93b632 | ||
|
|
6c98cdb192 | ||
|
|
7b841f3b4a | ||
|
|
a7d8f3d50e | ||
|
|
c80ca54f3c | ||
|
|
60ef95e1c1 | ||
|
|
04a83a48ed | ||
|
|
820ad4283d | ||
|
|
74438bb225 | ||
|
|
449d4634be | ||
|
|
9862f5e08b | ||
|
|
09d9dd3acd | ||
|
|
52bf2d5659 | ||
|
|
a626bbdb36 | ||
|
|
4af9141c5c | ||
|
|
29af938cbd | ||
|
|
4d63f33cdc | ||
|
|
ab8850f7e2 | ||
|
|
76aad1d274 | ||
|
|
ae7280994e | ||
|
|
22d366cc09 | ||
|
|
07cd11251f | ||
|
|
105bc26fa6 | ||
|
|
e1cd69a708 | ||
|
|
2e3756b4d3 | ||
|
|
9b3bbcda84 | ||
|
|
32dbc03c73 | ||
|
|
fe43c768ec | ||
|
|
cc213f871b | ||
|
|
8225911775 | ||
|
|
008a0a5d50 | ||
|
|
df88d88f56 | ||
|
|
53493a9b26 | ||
|
|
fdbecf3b5a | ||
|
|
63696738e5 | ||
|
|
261e2232c1 | ||
|
|
b6a971962a | ||
|
|
bedfe38b8b | ||
|
|
056b4bc499 | ||
|
|
77b25702ba | ||
|
|
89a3543568 | ||
|
|
16a0cbaa83 | ||
|
|
b7c6991c9a | ||
|
|
dc320d99f1 | ||
|
|
b6d6ec5326 | ||
|
|
82b69fcbb3 | ||
|
|
370a70948a | ||
|
|
74c0464006 | ||
|
|
b9c6854cd9 | ||
|
|
d8450043b0 | ||
|
|
c50e019734 | ||
|
|
82393decdf | ||
|
|
12c78bbded | ||
|
|
409302f0f9 | ||
|
|
93a9d53485 | ||
|
|
d544bdfac8 | ||
|
|
54655eaf92 | ||
|
|
3d2d448af1 | ||
|
|
69fc1522a3 | ||
|
|
aa6c8994b7 | ||
|
|
b66bc51423 | ||
|
|
de727caee2 | ||
|
|
eab7bddd9e | ||
|
|
ad8ff472b6 | ||
|
|
cfd0345fe0 | ||
|
|
ca09412a1f | ||
|
|
222eec2ecf | ||
|
|
c1eb76198e | ||
|
|
bf9441efb8 | ||
|
|
440e417d5f | ||
|
|
ae5c64413b | ||
|
|
ca7ee8a9e5 | ||
|
|
c60a0027b1 | ||
|
|
35dcf19b2b | ||
|
|
66fba00991 | ||
|
|
7d9f1c46bb | ||
|
|
71c0366fc7 | ||
|
|
e135d7f305 | ||
|
|
a61ac5257b | ||
|
|
9181a5dcfe | ||
|
|
19b1041930 | ||
|
|
89fd9eccdc | ||
|
|
20b94c0ce9 | ||
|
|
5135b3ae6e | ||
|
|
2a22a69e94 | ||
|
|
9eeaa4bd17 | ||
|
|
877dc94609 | ||
|
|
7e3918eb62 | ||
|
|
072a7e6ced | ||
|
|
a4c7933b49 | ||
|
|
0bf5cf87c6 | ||
|
|
06f0e74a2b | ||
|
|
0837c69a63 | ||
|
|
edf09bf990 | ||
|
|
316ee626b7 | ||
|
|
73d99958bb | ||
|
|
fabeb736e9 | ||
|
|
38a02b4b80 | ||
|
|
d71ada630d | ||
|
|
6eee1fc68f | ||
|
|
535477ca5e | ||
|
|
3ede900b64 | ||
|
|
5adc7fdc2b | ||
|
|
b54e5f2a2f | ||
|
|
a1822dced3 | ||
|
|
e36c826f7a | ||
|
|
5140b785a0 | ||
|
|
5520650483 | ||
|
|
29b8fb3d5e | ||
|
|
b6c1e34dca | ||
|
|
f6922be2a5 | ||
|
|
f91e2f7286 | ||
|
|
01030e6388 | ||
|
|
f8b3a920a8 | ||
|
|
a618ea30e1 | ||
|
|
4ec9e343cf | ||
|
|
8793e7c7d2 | ||
|
|
6ccc2c8f43 | ||
|
|
3e83da435b | ||
|
|
9ad1d6f58c | ||
|
|
5467f25f82 | ||
|
|
be1d78b0dc | ||
|
|
abd10011a7 | ||
|
|
dc6d5327bb | ||
|
|
0836a7ffb1 | ||
|
|
387d4b7de9 | ||
|
|
31ab6ac05e | ||
|
|
8cc8f7e0d5 | ||
|
|
709bb0f79c | ||
|
|
df675370d7 | ||
|
|
3fc211983e | ||
|
|
531d348d6e | ||
|
|
a17b85d97b | ||
|
|
a554212992 | ||
|
|
b13ad93f4a | ||
|
|
73ac7d94b7 | ||
|
|
3820229b46 | ||
|
|
d504eee9fa | ||
|
|
d2040cb224 | ||
|
|
f655ce7ef3 | ||
|
|
57e6d9ab48 | ||
|
|
366c01992a | ||
|
|
f3ffb8fa6e | ||
|
|
7812920487 | ||
|
|
10e2d222ce | ||
|
|
d463f6e980 | ||
|
|
34959e0bd5 | ||
|
|
affd1b4243 | ||
|
|
76be660aae | ||
|
|
9f3a8aaf92 | ||
|
|
7e248be764 | ||
|
|
4688279db5 | ||
|
|
3b4c9db256 | ||
|
|
df523880b5 | ||
|
|
e2731d98c1 | ||
|
|
d600617645 | ||
|
|
6ff66601a4 | ||
|
|
cddedade5b | ||
|
|
ce4a5cd5f3 | ||
|
|
924fd92013 | ||
|
|
8173d76740 | ||
|
|
601a49d398 | ||
|
|
9a3d53fad0 | ||
|
|
eaac1e5a1c | ||
|
|
94ce135693 | ||
|
|
7c92b6ca40 | ||
|
|
2b7f68c03d | ||
|
|
4bac8f689e | ||
|
|
7e81ee0453 | ||
|
|
1c861728e5 | ||
|
|
bbf094fdf5 | ||
|
|
c9dbebe344 | ||
|
|
f5385754e2 | ||
|
|
aea5f00df4 | ||
|
|
c164f2a969 | ||
|
|
48955d24b9 | ||
|
|
c6f15ecf76 | ||
|
|
1510795fec | ||
|
|
094651335e | ||
|
|
d7552a3101 | ||
|
|
2f2b721204 | ||
|
|
16d40217d0 | ||
|
|
4f1f149c37 | ||
|
|
9b6a453865 | ||
|
|
0ce92b9625 | ||
|
|
1e304a3bce | ||
|
|
bdcc14d721 | ||
|
|
6437eac15a | ||
|
|
1c30398143 | ||
|
|
f94effdab2 | ||
|
|
fd4685be87 | ||
|
|
52f3ee962b | ||
|
|
82dcfee5fc | ||
|
|
c07196605c | ||
|
|
405b8029a6 | ||
|
|
19e30fc410 | ||
|
|
670766c564 | ||
|
|
a1c0f08d3c | ||
|
|
ecb53eab4b | ||
|
|
994935f64c | ||
|
|
673c092e0f | ||
|
|
402ec70899 | ||
|
|
5483057817 | ||
|
|
f34ecbff0d | ||
|
|
d7daacb463 | ||
|
|
da2611084f | ||
|
|
cbbe9528ca | ||
|
|
4f13bdd45c | ||
|
|
7565d5b118 | ||
|
|
0ca9d0748e | ||
|
|
81f1617a68 | ||
|
|
8d2c5b247e | ||
|
|
b910b6f8de | ||
|
|
c29f295d39 | ||
|
|
f19979710a | ||
|
|
b78aa53904 | ||
|
|
7645355ecd | ||
|
|
bf397b6011 | ||
|
|
a513f70b43 | ||
|
|
21372896ea | ||
|
|
2270dfa0c4 | ||
|
|
ea8fad11d9 | ||
|
|
4e86ebb4b6 | ||
|
|
0c2d318837 | ||
|
|
184216696a | ||
|
|
1ee6e3b737 | ||
|
|
681ccffb45 | ||
|
|
fc0725ec5c | ||
|
|
d6c3369cec | ||
|
|
7a450b4d9e | ||
|
|
643e572233 | ||
|
|
52d6233296 | ||
|
|
c823b2c741 | ||
|
|
616f368076 | ||
|
|
d7dfcb0cb0 | ||
|
|
514ace9534 | ||
|
|
22bd479e2e | ||
|
|
a7916509a3 | ||
|
|
8dfc073b14 | ||
|
|
e35ae86e70 | ||
|
|
9061c6e7ae | ||
|
|
6171d11e72 | ||
|
|
408e3e5046 | ||
|
|
45038ae483 | ||
|
|
12f411d9a6 | ||
|
|
c20d0f3993 | ||
|
|
3460db9490 | ||
|
|
c636ff1944 | ||
|
|
9a9ca7c1e8 | ||
|
|
7d6c3f700b | ||
|
|
541c225320 | ||
|
|
68c1f682ff | ||
|
|
b4fc64c96c | ||
|
|
cc5edd83ec | ||
|
|
9145ad3f0a | ||
|
|
a501f6c7e3 | ||
|
|
edc5fe530f | ||
|
|
7c3323516b | ||
|
|
9dbd4c06fe | ||
|
|
860dc7e25d | ||
|
|
c27103d84c | ||
|
|
00a66a6fe8 | ||
|
|
c98e2365cd | ||
|
|
958dad705a | ||
|
|
0b82e1bd77 | ||
|
|
d33ce20e6d | ||
|
|
344aca8ced | ||
|
|
f7fb9e1ef1 | ||
|
|
7cfe2c5c07 | ||
|
|
5e2a2705f2 | ||
|
|
b109e437fc | ||
|
|
5d967e43d0 | ||
|
|
acda32c8f2 | ||
|
|
2730674ca9 | ||
|
|
a94c708a15 | ||
|
|
654b1501f7 | ||
|
|
0351955a68 | ||
|
|
8958a38329 | ||
|
|
6591be6c52 | ||
|
|
3e210abf7d | ||
|
|
59fae8abaf | ||
|
|
f6ee33cee7 | ||
|
|
3fd5e91e58 | ||
|
|
05f03b8875 | ||
|
|
8211bc6325 | ||
|
|
decb531ce2 | ||
|
|
439fa8ea8c | ||
|
|
8d7355ac2f | ||
|
|
856512ea9c | ||
|
|
fabddfe833 | ||
|
|
b0f0d4276d | ||
|
|
bb5c30a3ee | ||
|
|
326e85eca6 | ||
|
|
c37fc1ab6a | ||
|
|
e1d909f71e | ||
|
|
147b0690a9 | ||
|
|
ad7f966281 | ||
|
|
9b6cc223a3 | ||
|
|
260bf8cfe0 | ||
|
|
b2060b027c | ||
|
|
88bfc28ac4 | ||
|
|
c7dcd67d56 | ||
|
|
f3913b5b68 | ||
|
|
86a4fca0b4 | ||
|
|
e13338429f | ||
|
|
e64259e860 | ||
|
|
6334c662ca | ||
|
|
6331db3fd2 | ||
|
|
8f08e1c902 | ||
|
|
a3e230d1fa | ||
|
|
a099e8e7d3 | ||
|
|
793e6aedf2 | ||
|
|
b9462d5f88 | ||
|
|
67636eea20 | ||
|
|
965dbc6405 | ||
|
|
3fc3b7fd94 | ||
|
|
05ad617b5b | ||
|
|
40e7ed58d7 | ||
|
|
402b93c16d | ||
|
|
2ddf77b377 | ||
|
|
bd73eede46 | ||
|
|
cb228fb4a9 | ||
|
|
8118f62a7d | ||
|
|
b52e4385c4 | ||
|
|
63f99f4a4e | ||
|
|
8941cfa17a | ||
|
|
ff9ff758ad | ||
|
|
48d6c8ed23 | ||
|
|
c6025b6047 | ||
|
|
0ff08d22f0 | ||
|
|
5af97ca851 | ||
|
|
c7bab8cb84 | ||
|
|
bea23e59f7 | ||
|
|
23363ed750 | ||
|
|
a6545f4678 | ||
|
|
c1bd559d5b | ||
|
|
29aa009924 | ||
|
|
20bc061dc7 | ||
|
|
3fad2b17b9 | ||
|
|
240b3349fc | ||
|
|
63d0ceec75 | ||
|
|
fa136e8ca7 | ||
|
|
a5948157fd | ||
|
|
6973e3da87 | ||
|
|
214feeba19 | ||
|
|
effc607e87 | ||
|
|
77093f2a8b | ||
|
|
823aeb9294 | ||
|
|
f2ba5c9afa | ||
|
|
63c4179f59 | ||
|
|
5e94df8a4f | ||
|
|
4d0128f13a | ||
|
|
ec2ab73b87 | ||
|
|
166b7dbd4a | ||
|
|
ece8f502ed | ||
|
|
70f6901c3d | ||
|
|
8df49ad246 | ||
|
|
420f4939b3 | ||
|
|
4442d512c6 | ||
|
|
a5eaa02f62 | ||
|
|
b27631b9ae | ||
|
|
1608416811 | ||
|
|
8c54c56723 | ||
|
|
9b549c39c9 | ||
|
|
ca622f5748 | ||
|
|
8f88aa7d38 | ||
|
|
c5cab3452d | ||
|
|
d1a6918508 | ||
|
|
c2f1d215b1 | ||
|
|
f525fb525b | ||
|
|
c9142d4d8e | ||
|
|
20afd4e70c | ||
|
|
571da80c58 | ||
|
|
cffdf6693f | ||
|
|
0f5b48ce28 | ||
|
|
85b06f9365 | ||
|
|
6d3f548294 | ||
|
|
7c5c68f5c7 | ||
|
|
5056f1fad1 | ||
|
|
29d03a8f39 | ||
|
|
3cb8cdea3c | ||
|
|
631498de43 | ||
|
|
fd49579f3a | ||
|
|
524c87c61c | ||
|
|
009f38478e | ||
|
|
8f2887be93 | ||
|
|
5ff025a50c | ||
|
|
ff7eae7b08 | ||
|
|
76656afc6d | ||
|
|
f41855949d | ||
|
|
e4db460a54 | ||
|
|
ec8addcc8a | ||
|
|
8b11c4cec2 | ||
|
|
7e5993bec7 | ||
|
|
71a18dd435 | ||
|
|
1a6b0bb3a6 | ||
|
|
7d11009a97 | ||
|
|
d06a73bcb3 | ||
|
|
b7630f018a | ||
|
|
459049719c | ||
|
|
d0c250271c | ||
|
|
158ad015c2 | ||
|
|
3069270d86 | ||
|
|
204c6e5ff3 | ||
|
|
0a2301598c | ||
|
|
f186a1819a | ||
|
|
db2e7a4cb6 | ||
|
|
31431f454a | ||
|
|
143ad4cf31 | ||
|
|
252a5c854a | ||
|
|
f0ddaa2fac | ||
|
|
e1dd3c287b | ||
|
|
9d40326830 | ||
|
|
e1d591540e | ||
|
|
7d2e24eb16 | ||
|
|
857fc9eab9 | ||
|
|
83a73d1afe | ||
|
|
207d7673e5 | ||
|
|
5a095ef287 | ||
|
|
03539a36b6 | ||
|
|
1ebb243d1a | ||
|
|
cb9ba3c88a | ||
|
|
1dd9efc541 | ||
|
|
75917c84d1 | ||
|
|
2481468f22 | ||
|
|
41c2a112c2 | ||
|
|
d7b60b207b | ||
|
|
c84ff11dad | ||
|
|
b23f193dcc | ||
|
|
15ed08d065 | ||
|
|
7cce04381a | ||
|
|
d155ba57a3 | ||
|
|
dc6c2b779b | ||
|
|
d8f9198644 | ||
|
|
38e81b4294 | ||
|
|
ed434302f0 | ||
|
|
82576526e3 | ||
|
|
1727a041b5 | ||
|
|
574e8ec28f | ||
|
|
ee6916c007 | ||
|
|
c62d55cbae | ||
|
|
75931ee6e1 | ||
|
|
918e6a730c | ||
|
|
fc9e525fe0 | ||
|
|
1b56aaa659 | ||
|
|
f2f7bf76df | ||
|
|
83a38b8c44 | ||
|
|
8034415ddd | ||
|
|
4dc3a7e1ed | ||
|
|
537867aed8 | ||
|
|
804147cb7d | ||
|
|
2a5fab9a5f | ||
|
|
dbd5ecad26 | ||
|
|
08e72d0161 | ||
|
|
fd8bd2c432 | ||
|
|
22167aafba | ||
|
|
58a00b4977 | ||
|
|
eab2889e66 | ||
|
|
7d4da4ea5c | ||
|
|
8e38a509d2 | ||
|
|
57f8d4b5b5 | ||
|
|
e2390bff2e | ||
|
|
1d8b9ef92c | ||
|
|
da0d8534f1 | ||
|
|
a674a571db | ||
|
|
a4e84d285c | ||
|
|
08b51e2c09 | ||
|
|
12cbf0605e | ||
|
|
017f438534 | ||
|
|
9c3eca7bce | ||
|
|
2eef0ca111 | ||
|
|
9b25457498 | ||
|
|
e34c7ffc57 | ||
|
|
a2758f19ce | ||
|
|
ff0d1ce4df | ||
|
|
53daf4757d | ||
|
|
e636e1f2c1 | ||
|
|
2ddea18f81 | ||
|
|
5a6c96396b | ||
|
|
e0f1fca46c | ||
|
|
3f31504db9 | ||
|
|
4fab6f901c | ||
|
|
efcf8893a9 | ||
|
|
2cc0894992 | ||
|
|
b091dd9bf2 | ||
|
|
ed87404c44 | ||
|
|
203aae7d79 | ||
|
|
22d80c0b35 | ||
|
|
94179a509e | ||
|
|
5fb8130be9 | ||
|
|
baeacba04d | ||
|
|
6b99103c31 | ||
|
|
91b76aa298 | ||
|
|
4a9d6e50bb | ||
|
|
bfb300152c | ||
|
|
762a4fe2ee | ||
|
|
f848321c4f | ||
|
|
8ecb4770a0 | ||
|
|
8266cf94d3 | ||
|
|
35d592cc5a | ||
|
|
ef9876569a | ||
|
|
6b8fd05414 | ||
|
|
ff219e57c0 | ||
|
|
b5e8d57664 | ||
|
|
307d1c982d | ||
|
|
cebc8fb086 | ||
|
|
a401160cee | ||
|
|
f0ec06ba60 | ||
|
|
e54cc75f59 | ||
|
|
8565e21f4d | ||
|
|
0613dce0a7 | ||
|
|
1a78fbb5c8 | ||
|
|
d5099016f7 | ||
|
|
f0a9d98a39 | ||
|
|
470835b215 | ||
|
|
85611165ab | ||
|
|
03273f8fc0 | ||
|
|
ad7ff82771 | ||
|
|
7f03d2356f | ||
|
|
92cf47c006 | ||
|
|
cd15bacf33 | ||
|
|
8777e2f54e | ||
|
|
61ff83475c | ||
|
|
d09f5a2e01 | ||
|
|
66929e845d | ||
|
|
0fdc190cc0 | ||
|
|
07a387e196 | ||
|
|
048822d6af | ||
|
|
17ed54ddcf | ||
|
|
199213bba9 | ||
|
|
8c4f3ce8d0 | ||
|
|
3a7ea52f17 | ||
|
|
8aeaa478df | ||
|
|
485fc9f4ef | ||
|
|
1302f6936b | ||
|
|
fdb119297a | ||
|
|
b955ffa5b3 | ||
|
|
4e362f230b | ||
|
|
cd834618c4 | ||
|
|
ddb2f13549 | ||
|
|
30c8b110f3 | ||
|
|
8fd682f7f2 | ||
|
|
ea76f41478 | ||
|
|
32913bf7d9 | ||
|
|
8149d73652 | ||
|
|
b52c941ed4 | ||
|
|
8491327448 | ||
|
|
faca92f2f1 | ||
|
|
2ab5bfd43f | ||
|
|
665a2207af | ||
|
|
126601dd3f | ||
|
|
eaae81082c | ||
|
|
891966d020 | ||
|
|
1ca0b9d158 | ||
|
|
16a8fcce9f | ||
|
|
b8e1e9685e | ||
|
|
2f33c5a8e4 | ||
|
|
f082444291 | ||
|
|
d1860ad8dd | ||
|
|
e80f799d89 | ||
|
|
a677907ee8 | ||
|
|
9f7df549a2 | ||
|
|
884147c7d0 | ||
|
|
21eab513e7 | ||
|
|
aac0dc97a9 | ||
|
|
0814eea3ec | ||
|
|
d73b5cafa0 | ||
|
|
6e9e53d15f | ||
|
|
6625986f3a | ||
|
|
ad812ef2a4 | ||
|
|
9bcaf0ea6d | ||
|
|
adb6989786 | ||
|
|
1a823691a2 | ||
|
|
06823da2f0 | ||
|
|
76d56cf4a9 | ||
|
|
be741d4728 | ||
|
|
26b666b35e | ||
|
|
c59ba4595b | ||
|
|
ca9a0712b8 | ||
|
|
56ae6bdaa1 | ||
|
|
654325de02 | ||
|
|
db6d20be77 | ||
|
|
36c8c1039f | ||
|
|
4b29af0a1b | ||
|
|
06e1831f19 | ||
|
|
27a5923b24 | ||
|
|
e5cf8166dc | ||
|
|
3df3e672f5 | ||
|
|
94a85f6636 | ||
|
|
151fac68c3 | ||
|
|
d027ffdd7a | ||
|
|
9ec0f03a0d | ||
|
|
fa3f72ee53 | ||
|
|
4597687335 | ||
|
|
be101bf39a | ||
|
|
fa944c190c | ||
|
|
1fe109ecf3 | ||
|
|
93cb308137 | ||
|
|
079989259f | ||
|
|
6d074bb71a | ||
|
|
da16ad11fe | ||
|
|
a2b1bbc9a6 | ||
|
|
3690bcb217 | ||
|
|
4053f8530d | ||
|
|
446a772bc4 | ||
|
|
73c88b70b2 | ||
|
|
cff86bdc02 | ||
|
|
568ee0d135 | ||
|
|
dc755140c1 | ||
|
|
86addd65ab | ||
|
|
67e7a93844 | ||
|
|
4fc1273459 | ||
|
|
16310b5582 | ||
|
|
d638a500e9 | ||
|
|
ec37237d69 | ||
|
|
a1d3e0d8eb | ||
|
|
2e236c132f | ||
|
|
fcf16907c7 | ||
|
|
93b8f941f2 | ||
|
|
906dbea2b4 | ||
|
|
83c366cf09 | ||
|
|
1fb6662d1a | ||
|
|
7dbbfac0fc | ||
|
|
5d8fd2a0bc | ||
|
|
76ab561b4d | ||
|
|
f1a17e762b | ||
|
|
49a05c060a | ||
|
|
58b2c1616b | ||
|
|
f351ae488b | ||
|
|
d6b58b03b8 | ||
|
|
09049311a2 | ||
|
|
8f627eec55 | ||
|
|
32c226d6ed | ||
|
|
058d6d88b9 | ||
|
|
f39a3fe67d | ||
|
|
bec678c5a7 | ||
|
|
1625c7a837 | ||
|
|
a7bd1bf276 | ||
|
|
9db064a0d3 | ||
|
|
5d7181a71c | ||
|
|
0245c426ee | ||
|
|
09d695d782 | ||
|
|
25b7a16a6e | ||
|
|
44eae4c7af | ||
|
|
a43debbc43 | ||
|
|
b118b9c5cd | ||
|
|
a7ad339910 | ||
|
|
3350468499 | ||
|
|
f5d1693e3c | ||
|
|
a0b800aba9 | ||
|
|
e1414aa96b | ||
|
|
632c07c092 | ||
|
|
514126b2b5 | ||
|
|
1fc51769de | ||
|
|
056daf6a1c | ||
|
|
52764f5546 | ||
|
|
8584a922dc | ||
|
|
7cad7230ff | ||
|
|
b70659d8ea | ||
|
|
b57db7581c | ||
|
|
70f0e9d86d | ||
|
|
f20d59e691 | ||
|
|
c3650d6a4b | ||
|
|
73fa5fdaf9 | ||
|
|
d8545e2690 | ||
|
|
4a1f3cb4eb | ||
|
|
3452e301ec | ||
|
|
cd24e61e57 | ||
|
|
79fcc6948d | ||
|
|
de3c594723 | ||
|
|
df49ebabfe | ||
|
|
45af9ba7c4 | ||
|
|
5f926c2679 | ||
|
|
ea29cd5a4a | ||
|
|
d6045cba4e | ||
|
|
fc5ea79c5e | ||
|
|
023e5409df | ||
|
|
b6f40f0027 | ||
|
|
e4cb70aef3 | ||
|
|
09670ec2d1 | ||
|
|
697011d3c4 | ||
|
|
c61f990566 | ||
|
|
208898ee77 | ||
|
|
11f3d5a431 | ||
|
|
e4ade69654 | ||
|
|
a70e3eb15c | ||
|
|
348eea2dbe | ||
|
|
5977ee02f6 | ||
|
|
e83c56dfbb | ||
|
|
13585da4b4 | ||
|
|
68d03fdbd8 | ||
|
|
f40d3e7608 | ||
|
|
6519c8124e | ||
|
|
646ca9f1c9 | ||
|
|
334379dada | ||
|
|
f920b20654 | ||
|
|
5936e36f6b | ||
|
|
fbc3abcbfc | ||
|
|
85aad90956 | ||
|
|
a5cb76bca0 | ||
|
|
3ea9368d92 | ||
|
|
f6aa779383 | ||
|
|
ddaa771cd5 | ||
|
|
24aae1b1d4 | ||
|
|
55b9099976 | ||
|
|
e2bb45a7c0 | ||
|
|
cb4d9c0e1d | ||
|
|
e2cb764778 | ||
|
|
61f90d1898 | ||
|
|
7c0c379372 | ||
|
|
b7590d784f | ||
|
|
cb9e9ccb2b | ||
|
|
d6da8336b8 | ||
|
|
022d303116 | ||
|
|
6c6de44f04 | ||
|
|
6855359e57 | ||
|
|
6e9d51701e | ||
|
|
c5819d427d | ||
|
|
04c3d4d709 | ||
|
|
6d77a81456 | ||
|
|
aed4a4c90b | ||
|
|
253b763160 | ||
|
|
5e7783097a | ||
|
|
bec5dec947 | ||
|
|
338a06f4bc | ||
|
|
0e0bd58631 | ||
|
|
d999c93401 | ||
|
|
e796d39d80 | ||
|
|
495f16cbac | ||
|
|
86ad80b6be | ||
|
|
f1a39dce60 | ||
|
|
ca6fe7bebe | ||
|
|
de44d0b2bd | ||
|
|
95a17848d3 | ||
|
|
10c8ce59a4 | ||
|
|
f638339d09 | ||
|
|
5f64df4bc3 | ||
|
|
71b9eedbea | ||
|
|
7e2daefe6c | ||
|
|
0fec6b9d88 | ||
|
|
b385229837 | ||
|
|
90c4c1e82b | ||
|
|
e31bfae2ba | ||
|
|
a938409c0e | ||
|
|
fd7d5acdeb | ||
|
|
87426ed37a | ||
|
|
8180b08fb2 | ||
|
|
2f3309c9e3 | ||
|
|
9831ad3ce6 | ||
|
|
4b469eae40 | ||
|
|
9bf330b567 | ||
|
|
468319ce4f | ||
|
|
0aa8289c6f | ||
|
|
16e818f90b | ||
|
|
7939908c83 | ||
|
|
8e8a7b1f0f | ||
|
|
994e9a5ed1 | ||
|
|
9bf1daaaf9 | ||
|
|
29992cf978 | ||
|
|
f3dbdbe269 | ||
|
|
31f0610798 | ||
|
|
143970a5b0 | ||
|
|
125207c307 | ||
|
|
c8be370b34 | ||
|
|
98873f6540 | ||
|
|
a5c0d72bfb | ||
|
|
bcb2edac65 | ||
|
|
9ab38c67eb | ||
|
|
d9ad62343c | ||
|
|
c66f220c44 | ||
|
|
f5c6dc8b7c | ||
|
|
b7001bce52 | ||
|
|
74cf48f0c1 | ||
|
|
b99c197b27 | ||
|
|
451159035a | ||
|
|
3abc9d98c9 | ||
|
|
3ec1bd2c7a | ||
|
|
26bee12899 | ||
|
|
370bbc5dea | ||
|
|
d0e629a68e | ||
|
|
268bec521c | ||
|
|
fa6128ad17 | ||
|
|
2d461c7c00 | ||
|
|
b0d9c83041 | ||
|
|
a0223a888f | ||
|
|
3b242f82b5 | ||
|
|
999f7711cd | ||
|
|
7a796df91d | ||
|
|
39ac5c2714 | ||
|
|
19726f59d7 | ||
|
|
d3f2d49f3a | ||
|
|
68990d19e4 | ||
|
|
9ac3e4377f | ||
|
|
af60b29097 | ||
|
|
fadfe40155 | ||
|
|
dda5d14a6b | ||
|
|
2abf4606f9 | ||
|
|
a11bb504ec | ||
|
|
d34ff3cb96 | ||
|
|
a4f633ff2a | ||
|
|
c8b9ba7d41 | ||
|
|
88f6fa70d7 |
@@ -1,10 +0,0 @@
|
|||||||
# Copyright 2010 Google Inc. All Rights Reserved.
|
|
||||||
#Fri Jul 16 10:03:08 PDT 2010
|
|
||||||
currentVersion=Unknown
|
|
||||||
version=Unknown
|
|
||||||
isNative=true
|
|
||||||
feedurl=http\://www.openbsd.org/security.html
|
|
||||||
name=openbsd
|
|
||||||
keywords=openbsd
|
|
||||||
onDevice=true
|
|
||||||
homepage=http\://openbsd.org
|
|
||||||
368
libc/Android.mk
368
libc/Android.mk
@@ -9,7 +9,6 @@ libc_common_src_files := \
|
|||||||
unistd/abort.c \
|
unistd/abort.c \
|
||||||
unistd/alarm.c \
|
unistd/alarm.c \
|
||||||
unistd/brk.c \
|
unistd/brk.c \
|
||||||
unistd/creat.c \
|
|
||||||
unistd/daemon.c \
|
unistd/daemon.c \
|
||||||
unistd/eventfd.c \
|
unistd/eventfd.c \
|
||||||
unistd/exec.c \
|
unistd/exec.c \
|
||||||
@@ -18,7 +17,6 @@ libc_common_src_files := \
|
|||||||
unistd/fstatfs.c \
|
unistd/fstatfs.c \
|
||||||
unistd/ftime.c \
|
unistd/ftime.c \
|
||||||
unistd/ftok.c \
|
unistd/ftok.c \
|
||||||
unistd/getcwd.c \
|
|
||||||
unistd/getdtablesize.c \
|
unistd/getdtablesize.c \
|
||||||
unistd/gethostname.c \
|
unistd/gethostname.c \
|
||||||
unistd/getopt_long.c \
|
unistd/getopt_long.c \
|
||||||
@@ -31,7 +29,6 @@ libc_common_src_files := \
|
|||||||
unistd/killpg.c \
|
unistd/killpg.c \
|
||||||
unistd/lseek64.c \
|
unistd/lseek64.c \
|
||||||
unistd/mmap.c \
|
unistd/mmap.c \
|
||||||
unistd/nice.c \
|
|
||||||
unistd/open.c \
|
unistd/open.c \
|
||||||
unistd/openat.c \
|
unistd/openat.c \
|
||||||
unistd/opendir.c \
|
unistd/opendir.c \
|
||||||
@@ -64,7 +61,6 @@ libc_common_src_files := \
|
|||||||
unistd/sigwait.c \
|
unistd/sigwait.c \
|
||||||
unistd/sleep.c \
|
unistd/sleep.c \
|
||||||
unistd/statfs.c \
|
unistd/statfs.c \
|
||||||
unistd/strsignal.c \
|
|
||||||
unistd/syslog.c \
|
unistd/syslog.c \
|
||||||
unistd/system.c \
|
unistd/system.c \
|
||||||
unistd/tcgetpgrp.c \
|
unistd/tcgetpgrp.c \
|
||||||
@@ -140,6 +136,11 @@ libc_common_src_files := \
|
|||||||
stdio/vsscanf.c \
|
stdio/vsscanf.c \
|
||||||
stdio/wbuf.c \
|
stdio/wbuf.c \
|
||||||
stdio/wsetup.c \
|
stdio/wsetup.c \
|
||||||
|
stdio/__fgets_chk.c \
|
||||||
|
stdio/__snprintf_chk.c \
|
||||||
|
stdio/__sprintf_chk.c \
|
||||||
|
stdio/__vsnprintf_chk.c \
|
||||||
|
stdio/__vsprintf_chk.c \
|
||||||
stdlib/_rand48.c \
|
stdlib/_rand48.c \
|
||||||
stdlib/assert.c \
|
stdlib/assert.c \
|
||||||
stdlib/atexit.c \
|
stdlib/atexit.c \
|
||||||
@@ -189,8 +190,6 @@ libc_common_src_files := \
|
|||||||
string/strcoll.c \
|
string/strcoll.c \
|
||||||
string/strcspn.c \
|
string/strcspn.c \
|
||||||
string/strdup.c \
|
string/strdup.c \
|
||||||
string/strerror.c \
|
|
||||||
string/strerror_r.c \
|
|
||||||
string/strlcat.c \
|
string/strlcat.c \
|
||||||
string/strlcpy.c \
|
string/strlcpy.c \
|
||||||
string/strncat.c \
|
string/strncat.c \
|
||||||
@@ -204,7 +203,16 @@ libc_common_src_files := \
|
|||||||
string/strstr.c \
|
string/strstr.c \
|
||||||
string/strtok.c \
|
string/strtok.c \
|
||||||
string/strtotimeval.c \
|
string/strtotimeval.c \
|
||||||
string/strxfrm.c \
|
string/__memcpy_chk.c \
|
||||||
|
string/__memmove_chk.c \
|
||||||
|
string/__memset_chk.c \
|
||||||
|
string/__strcat_chk.c \
|
||||||
|
string/__strcpy_chk.c \
|
||||||
|
string/__strlcat_chk.c \
|
||||||
|
string/__strlcpy_chk.c \
|
||||||
|
string/__strlen_chk.c \
|
||||||
|
string/__strncat_chk.c \
|
||||||
|
string/__strncpy_chk.c \
|
||||||
wchar/wcpcpy.c \
|
wchar/wcpcpy.c \
|
||||||
wchar/wcpncpy.c \
|
wchar/wcpncpy.c \
|
||||||
wchar/wcscasecmp.c \
|
wchar/wcscasecmp.c \
|
||||||
@@ -249,6 +257,7 @@ libc_common_src_files := \
|
|||||||
tzcode/strftime.c \
|
tzcode/strftime.c \
|
||||||
tzcode/strptime.c \
|
tzcode/strptime.c \
|
||||||
bionic/__set_errno.c \
|
bionic/__set_errno.c \
|
||||||
|
bionic/bionic_clone.c \
|
||||||
bionic/cpuacct.c \
|
bionic/cpuacct.c \
|
||||||
bionic/arc4random.c \
|
bionic/arc4random.c \
|
||||||
bionic/basename.c \
|
bionic/basename.c \
|
||||||
@@ -262,6 +271,7 @@ libc_common_src_files := \
|
|||||||
bionic/fdprintf.c \
|
bionic/fdprintf.c \
|
||||||
bionic/fork.c \
|
bionic/fork.c \
|
||||||
bionic/fts.c \
|
bionic/fts.c \
|
||||||
|
bionic/getcwd.cpp \
|
||||||
bionic/if_nametoindex.c \
|
bionic/if_nametoindex.c \
|
||||||
bionic/if_indextoname.c \
|
bionic/if_indextoname.c \
|
||||||
bionic/ioctl.c \
|
bionic/ioctl.c \
|
||||||
@@ -278,9 +288,12 @@ libc_common_src_files := \
|
|||||||
bionic/sched_cpucount.c \
|
bionic/sched_cpucount.c \
|
||||||
bionic/semaphore.c \
|
bionic/semaphore.c \
|
||||||
bionic/sha1.c \
|
bionic/sha1.c \
|
||||||
bionic/ssp.c \
|
bionic/strerror.cpp \
|
||||||
bionic/stubs.c \
|
bionic/strerror_r.cpp \
|
||||||
|
bionic/strsignal.cpp \
|
||||||
|
bionic/stubs.cpp \
|
||||||
bionic/system_properties.c \
|
bionic/system_properties.c \
|
||||||
|
bionic/tdestroy.c \
|
||||||
bionic/time64.c \
|
bionic/time64.c \
|
||||||
bionic/thread_atexit.c \
|
bionic/thread_atexit.c \
|
||||||
bionic/utime.c \
|
bionic/utime.c \
|
||||||
@@ -315,10 +328,21 @@ libc_common_src_files := \
|
|||||||
netbsd/nameser/ns_netint.c \
|
netbsd/nameser/ns_netint.c \
|
||||||
netbsd/nameser/ns_print.c \
|
netbsd/nameser/ns_print.c \
|
||||||
netbsd/nameser/ns_samedomain.c \
|
netbsd/nameser/ns_samedomain.c \
|
||||||
regex/regcomp.c \
|
|
||||||
regex/regerror.c \
|
libc_upstream_netbsd_src_files := \
|
||||||
regex/regexec.c \
|
upstream-netbsd/libc/compat-43/creat.c \
|
||||||
regex/regfree.c \
|
upstream-netbsd/libc/gen/ftw.c \
|
||||||
|
upstream-netbsd/libc/gen/nftw.c \
|
||||||
|
upstream-netbsd/libc/gen/nice.c \
|
||||||
|
upstream-netbsd/libc/gen/psignal.c \
|
||||||
|
upstream-netbsd/libc/regex/regcomp.c \
|
||||||
|
upstream-netbsd/libc/regex/regerror.c \
|
||||||
|
upstream-netbsd/libc/regex/regexec.c \
|
||||||
|
upstream-netbsd/libc/regex/regfree.c \
|
||||||
|
upstream-netbsd/libc/stdlib/tdelete.c \
|
||||||
|
upstream-netbsd/libc/stdlib/tfind.c \
|
||||||
|
upstream-netbsd/libc/stdlib/tsearch.c \
|
||||||
|
upstream-netbsd/libc/string/strxfrm.c \
|
||||||
|
|
||||||
# The following files are common, but must be compiled
|
# The following files are common, but must be compiled
|
||||||
# with different C flags when building a static C library.
|
# with different C flags when building a static C library.
|
||||||
@@ -341,19 +365,19 @@ libc_static_common_src_files := \
|
|||||||
# =========================================================
|
# =========================================================
|
||||||
ifeq ($(TARGET_ARCH),arm)
|
ifeq ($(TARGET_ARCH),arm)
|
||||||
libc_common_src_files += \
|
libc_common_src_files += \
|
||||||
bionic/bionic_clone.c \
|
|
||||||
arch-arm/bionic/__get_pc.S \
|
|
||||||
arch-arm/bionic/__get_sp.S \
|
arch-arm/bionic/__get_sp.S \
|
||||||
arch-arm/bionic/_exit_with_stack_teardown.S \
|
arch-arm/bionic/_exit_with_stack_teardown.S \
|
||||||
arch-arm/bionic/_setjmp.S \
|
arch-arm/bionic/_setjmp.S \
|
||||||
arch-arm/bionic/abort_arm.S \
|
arch-arm/bionic/abort_arm.S \
|
||||||
arch-arm/bionic/atomics_arm.S \
|
arch-arm/bionic/atomics_arm.c \
|
||||||
arch-arm/bionic/clone.S \
|
arch-arm/bionic/clone.S \
|
||||||
arch-arm/bionic/eabi.c \
|
arch-arm/bionic/eabi.c \
|
||||||
arch-arm/bionic/ffs.S \
|
arch-arm/bionic/ffs.S \
|
||||||
|
arch-arm/bionic/futex_arm.S \
|
||||||
arch-arm/bionic/kill.S \
|
arch-arm/bionic/kill.S \
|
||||||
arch-arm/bionic/libgcc_compat.c \
|
arch-arm/bionic/libgcc_compat.c \
|
||||||
arch-arm/bionic/tkill.S \
|
arch-arm/bionic/tkill.S \
|
||||||
|
arch-arm/bionic/tgkill.S \
|
||||||
arch-arm/bionic/memcmp.S \
|
arch-arm/bionic/memcmp.S \
|
||||||
arch-arm/bionic/memcmp16.S \
|
arch-arm/bionic/memcmp16.S \
|
||||||
arch-arm/bionic/memcpy.S \
|
arch-arm/bionic/memcpy.S \
|
||||||
@@ -388,16 +412,16 @@ libc_arch_static_src_files := \
|
|||||||
|
|
||||||
libc_arch_dynamic_src_files := \
|
libc_arch_dynamic_src_files := \
|
||||||
arch-arm/bionic/exidx_dynamic.c
|
arch-arm/bionic/exidx_dynamic.c
|
||||||
else # !arm
|
endif # arm
|
||||||
|
|
||||||
ifeq ($(TARGET_ARCH),x86)
|
ifeq ($(TARGET_ARCH),x86)
|
||||||
libc_common_src_files += \
|
libc_common_src_files += \
|
||||||
arch-x86/bionic/__get_sp.S \
|
arch-x86/bionic/__get_sp.S \
|
||||||
arch-x86/bionic/__get_tls.c \
|
arch-x86/bionic/__get_tls.c \
|
||||||
arch-x86/bionic/__set_tls.c \
|
arch-x86/bionic/__set_tls.c \
|
||||||
arch-x86/bionic/atomics_x86.S \
|
|
||||||
arch-x86/bionic/clone.S \
|
arch-x86/bionic/clone.S \
|
||||||
arch-x86/bionic/_exit_with_stack_teardown.S \
|
arch-x86/bionic/_exit_with_stack_teardown.S \
|
||||||
|
arch-x86/bionic/futex_x86.S \
|
||||||
arch-x86/bionic/setjmp.S \
|
arch-x86/bionic/setjmp.S \
|
||||||
arch-x86/bionic/_setjmp.S \
|
arch-x86/bionic/_setjmp.S \
|
||||||
arch-x86/bionic/sigsetjmp.S \
|
arch-x86/bionic/sigsetjmp.S \
|
||||||
@@ -421,32 +445,71 @@ libc_common_src_files += \
|
|||||||
libc_static_common_src_files += \
|
libc_static_common_src_files += \
|
||||||
bionic/pthread.c \
|
bionic/pthread.c \
|
||||||
|
|
||||||
# this is needed for static versions of libc
|
|
||||||
libc_arch_static_src_files := \
|
libc_arch_static_src_files := \
|
||||||
arch-x86/bionic/dl_iterate_phdr_static.c
|
bionic/dl_iterate_phdr_static.c
|
||||||
|
|
||||||
libc_arch_dynamic_src_files :=
|
libc_arch_dynamic_src_files :=
|
||||||
else # !x86
|
endif # x86
|
||||||
|
|
||||||
endif # !x86
|
ifeq ($(TARGET_ARCH),mips)
|
||||||
endif # !arm
|
libc_common_src_files += \
|
||||||
|
arch-mips/bionic/__get_sp.S \
|
||||||
|
arch-mips/bionic/__get_tls.c \
|
||||||
|
arch-mips/bionic/__set_tls.c \
|
||||||
|
arch-mips/bionic/_exit_with_stack_teardown.S \
|
||||||
|
arch-mips/bionic/_setjmp.S \
|
||||||
|
arch-mips/bionic/futex_mips.S \
|
||||||
|
arch-mips/bionic/bzero.S \
|
||||||
|
arch-mips/bionic/cacheflush.c \
|
||||||
|
arch-mips/bionic/clone.S \
|
||||||
|
arch-mips/bionic/ffs.S \
|
||||||
|
arch-mips/bionic/memcmp16.S \
|
||||||
|
arch-mips/bionic/memmove.c \
|
||||||
|
arch-mips/bionic/pipe.S \
|
||||||
|
arch-mips/bionic/setjmp.S \
|
||||||
|
arch-mips/bionic/sigsetjmp.S \
|
||||||
|
arch-mips/bionic/vfork.S
|
||||||
|
|
||||||
|
libc_common_src_files += \
|
||||||
|
arch-mips/string/memset.S \
|
||||||
|
arch-mips/string/memcpy.S \
|
||||||
|
arch-mips/string/mips_strlen.c
|
||||||
|
|
||||||
|
libc_common_src_files += \
|
||||||
|
string/bcopy.c \
|
||||||
|
string/memcmp.c \
|
||||||
|
string/strcmp.c \
|
||||||
|
string/strcpy.c \
|
||||||
|
string/strncmp.c
|
||||||
|
|
||||||
|
libc_common_src_files += \
|
||||||
|
bionic/pthread-atfork.c \
|
||||||
|
bionic/pthread-rwlocks.c \
|
||||||
|
bionic/pthread-timers.c \
|
||||||
|
bionic/ptrace.c
|
||||||
|
|
||||||
|
libc_static_common_src_files += \
|
||||||
|
bionic/pthread.c
|
||||||
|
|
||||||
|
libc_arch_static_src_files := \
|
||||||
|
bionic/dl_iterate_phdr_static.c
|
||||||
|
|
||||||
|
libc_arch_dynamic_src_files :=
|
||||||
|
endif # mips
|
||||||
|
|
||||||
# Define some common cflags
|
# Define some common cflags
|
||||||
# ========================================================
|
# ========================================================
|
||||||
libc_common_cflags := \
|
libc_common_cflags := \
|
||||||
-DWITH_ERRLIST \
|
-DWITH_ERRLIST \
|
||||||
-DANDROID_CHANGES \
|
-DANDROID_CHANGES \
|
||||||
-DUSE_LOCKS \
|
|
||||||
-DREALLOC_ZERO_BYTES_FREES \
|
|
||||||
-D_LIBC=1 \
|
-D_LIBC=1 \
|
||||||
-DSOFTFLOAT \
|
|
||||||
-DFLOATING_POINT \
|
-DFLOATING_POINT \
|
||||||
-DINET6 \
|
-DINET6 \
|
||||||
-I$(LOCAL_PATH)/private \
|
-I$(LOCAL_PATH)/private \
|
||||||
-DUSE_DL_PREFIX \
|
|
||||||
-DPOSIX_MISTAKE \
|
-DPOSIX_MISTAKE \
|
||||||
-DLOG_ON_HEAP_ERROR \
|
-DLOG_ON_HEAP_ERROR \
|
||||||
-std=gnu99
|
-std=gnu99 \
|
||||||
|
-Wall -Wextra
|
||||||
|
|
||||||
# these macro definitions are required to implement the
|
# these macro definitions are required to implement the
|
||||||
# 'timezone' and 'daylight' global variables, as well as
|
# 'timezone' and 'daylight' global variables, as well as
|
||||||
@@ -468,6 +531,7 @@ ifneq ($(BOARD_MALLOC_ALIGNMENT),)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET_ARCH),arm)
|
ifeq ($(TARGET_ARCH),arm)
|
||||||
|
libc_common_cflags += -DSOFTFLOAT
|
||||||
libc_common_cflags += -fstrict-aliasing
|
libc_common_cflags += -fstrict-aliasing
|
||||||
libc_crt_target_cflags := -mthumb-interwork
|
libc_crt_target_cflags := -mthumb-interwork
|
||||||
#
|
#
|
||||||
@@ -488,13 +552,30 @@ ifeq ($(TARGET_ARCH),arm)
|
|||||||
ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
|
ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
|
||||||
libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
|
libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
|
||||||
endif
|
endif
|
||||||
else # !arm
|
ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
|
||||||
ifeq ($(TARGET_ARCH),x86)
|
libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
|
||||||
libc_crt_target_cflags :=
|
endif
|
||||||
# TARGET_GLOBAL_CFLAGS from build/core/combo/TARGET_linux-x86.mk sets all required flags.
|
|
||||||
endif # x86
|
|
||||||
endif # !arm
|
endif # !arm
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH),x86)
|
||||||
|
libc_common_cflags += -DSOFTFLOAT
|
||||||
|
libc_crt_target_cflags :=
|
||||||
|
ifeq ($(ARCH_X86_HAVE_SSE2),true)
|
||||||
|
libc_crt_target_cflags += -DUSE_SSE2=1
|
||||||
|
endif
|
||||||
|
ifeq ($(ARCH_X86_HAVE_SSSE3),true)
|
||||||
|
libc_crt_target_cflags += -DUSE_SSSE3=1
|
||||||
|
endif
|
||||||
|
endif # x86
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH),mips)
|
||||||
|
ifneq ($(ARCH_MIPS_HAS_FPU),true)
|
||||||
|
libc_common_cflags += -DSOFTFLOAT
|
||||||
|
endif
|
||||||
|
libc_common_cflags += -fstrict-aliasing
|
||||||
|
libc_crt_target_cflags := $(TARGET_GLOBAL_CFLAGS)
|
||||||
|
endif # mips
|
||||||
|
|
||||||
# Define ANDROID_SMP appropriately.
|
# Define ANDROID_SMP appropriately.
|
||||||
ifeq ($(TARGET_CPU_SMP),true)
|
ifeq ($(TARGET_CPU_SMP),true)
|
||||||
libc_common_cflags += -DANDROID_SMP=1
|
libc_common_cflags += -DANDROID_SMP=1
|
||||||
@@ -502,82 +583,145 @@ else
|
|||||||
libc_common_cflags += -DANDROID_SMP=0
|
libc_common_cflags += -DANDROID_SMP=0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Needed to access private/__dso_handle.S from
|
# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
|
||||||
# crtbegin_xxx.S and crtend_xxx.S
|
libc_crt_target_cflags += \
|
||||||
#
|
-I$(LOCAL_PATH)/include \
|
||||||
libc_crt_target_cflags += -I$(LOCAL_PATH)/private
|
-DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
|
||||||
|
|
||||||
ifeq ($(TARGET_ARCH),arm)
|
|
||||||
libc_crt_target_cflags += -DCRT_LEGACY_WORKAROUND
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define some common includes
|
# Define some common includes
|
||||||
# ========================================================
|
# ========================================================
|
||||||
libc_common_c_includes := \
|
libc_common_c_includes := \
|
||||||
$(LOCAL_PATH)/stdlib \
|
$(LOCAL_PATH)/stdlib \
|
||||||
$(LOCAL_PATH)/string \
|
$(LOCAL_PATH)/string \
|
||||||
$(LOCAL_PATH)/stdio
|
$(LOCAL_PATH)/stdio \
|
||||||
|
external/safe-iop/include
|
||||||
|
|
||||||
# Needed to access private/__dso_handle.S from
|
# Needed to access private/__dso_handle.h from
|
||||||
# crtbegin_xxx.S and crtend_xxx.S
|
# crtbegin_xxx.S and crtend_xxx.S
|
||||||
#
|
libc_crt_target_cflags += \
|
||||||
libc_crt_target_cflags += -I$(LOCAL_PATH)/private
|
-I$(LOCAL_PATH)/private \
|
||||||
|
-I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
|
||||||
|
|
||||||
# Define the libc run-time (crt) support object files that must be built,
|
# Define the libc run-time (crt) support object files that must be built,
|
||||||
# which are needed to build all other objects (shared/static libs and
|
# which are needed to build all other objects (shared/static libs and
|
||||||
# executables)
|
# executables)
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
|
# ARM, MIPS, and x86 all need crtbegin_so/crtend_so.
|
||||||
ifneq ($(filter arm x86,$(TARGET_ARCH)),)
|
|
||||||
# ARM and x86 need crtbegin_so/crtend_so.
|
|
||||||
#
|
#
|
||||||
# For x86, the .init section must point to a function that calls all
|
# For x86, the .init section must point to a function that calls all
|
||||||
# entries in the .ctors section. (on ARM this is done through the
|
# entries in the .ctors section. (on ARM this is done through the
|
||||||
# .init_array section instead).
|
# .init_array section instead).
|
||||||
#
|
#
|
||||||
# For both platforms, the .fini_array section must point to a function
|
# For all the platforms, the .fini_array section must point to a function
|
||||||
# that will call __cxa_finalize(&__dso_handle) in order to ensure that
|
# that will call __cxa_finalize(&__dso_handle) in order to ensure that
|
||||||
# static C++ destructors are properly called on dlclose().
|
# static C++ destructors are properly called on dlclose().
|
||||||
#
|
#
|
||||||
|
ifeq ($(TARGET_ARCH),arm)
|
||||||
libc_crt_target_so_cflags := $(libc_crt_target_cflags)
|
libc_crtbegin_extension := c
|
||||||
ifeq ($(TARGET_ARCH),x86)
|
libc_crt_target_so_cflags :=
|
||||||
# This flag must be added for x86 targets, but not for ARM
|
|
||||||
libc_crt_target_so_cflags += -fPIC
|
|
||||||
endif
|
endif
|
||||||
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
|
ifeq ($(TARGET_ARCH),mips)
|
||||||
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
|
libc_crtbegin_extension := S
|
||||||
|
libc_crt_target_so_cflags := -fPIC
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_ARCH),x86)
|
||||||
|
libc_crtbegin_extension := S
|
||||||
|
libc_crt_target_so_cflags := -fPIC
|
||||||
|
endif
|
||||||
|
ifeq ($(libc_crtbegin_extension),)
|
||||||
|
$(error $(TARGET_ARCH) not supported)
|
||||||
|
endif
|
||||||
|
libc_crt_target_so_cflags += $(libc_crt_target_cflags)
|
||||||
|
libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.$(libc_crtbegin_extension)
|
||||||
|
libc_crt_target_crtbegin_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.$(libc_crtbegin_extension)
|
||||||
|
|
||||||
|
# See the comment in crtbrand.c for the reason why we need to generate
|
||||||
|
# crtbrand.s before generating crtbrand.o.
|
||||||
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
|
||||||
|
$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
|
$(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -S \
|
||||||
|
-MD -MF $(@:%.s=%.d) -o $@ $<
|
||||||
|
$(hide) sed -i -e '/\.note\.ABI-tag/s/progbits/note/' $@
|
||||||
|
$(call transform-d-to-p-args,$(@:%.s=%.d),$(@:%.s=%.P))
|
||||||
|
-include $(GEN:%.s=%.P)
|
||||||
ALL_GENERATED_SOURCES += $(GEN)
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
|
|
||||||
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
|
||||||
|
$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
|
||||||
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
|
|
||||||
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
|
||||||
|
$(GEN): $(libc_crt_target_crtbegin_so_file)
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
|
||||||
|
-MD -MF $(@:%.o=%.d) -o $@ -c $<
|
||||||
|
$(transform-d-to-p)
|
||||||
|
-include $(GEN:%.o=%.P)
|
||||||
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
|
|
||||||
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
|
||||||
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
|
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
|
$(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
|
||||||
|
-MD -MF $(@:%.o=%.d) -o $@ -c $<
|
||||||
|
$(transform-d-to-p)
|
||||||
|
-include $(GEN:%.o=%.P)
|
||||||
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
|
|
||||||
|
# The following two are installed to device
|
||||||
|
GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtbegin_so.o
|
||||||
|
$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
|
||||||
|
$(hide) mkdir -p $(dir $@) && cp -f $< $@
|
||||||
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
|
|
||||||
|
GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtend_so.o
|
||||||
|
$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
|
||||||
|
$(hide) mkdir -p $(dir $@) && cp -f $< $@
|
||||||
ALL_GENERATED_SOURCES += $(GEN)
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
endif # TARGET_ARCH == x86 || TARGET_ARCH == arm
|
|
||||||
|
|
||||||
|
|
||||||
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o
|
||||||
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_static.S
|
$(GEN): $(libc_crt_target_crtbegin_file)
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
|
$(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
|
||||||
|
-MD -MF $(@:%.o=%.d) -o $@ -c $<
|
||||||
|
$(transform-d-to-p)
|
||||||
|
-include $(GEN:%.o=%.P)
|
||||||
ALL_GENERATED_SOURCES += $(GEN)
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
|
|
||||||
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
|
||||||
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_dynamic.S
|
$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
|
$(hide) $(TARGET_LD) -r -o $@ $^
|
||||||
ALL_GENERATED_SOURCES += $(GEN)
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
|
|
||||||
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o
|
||||||
|
$(GEN): $(libc_crt_target_crtbegin_file)
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
|
||||||
|
-MD -MF $(@:%.o=%.d) -o $@ -c $<
|
||||||
|
$(transform-d-to-p)
|
||||||
|
-include $(GEN:%.o=%.P)
|
||||||
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
|
|
||||||
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
|
||||||
|
$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(hide) $(TARGET_LD) -r -o $@ $^
|
||||||
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
|
|
||||||
# We rename crtend.o to crtend_android.o to avoid a
|
# We rename crtend.o to crtend_android.o to avoid a
|
||||||
# name clash between gcc and bionic.
|
# name clash between gcc and bionic.
|
||||||
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
|
||||||
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
|
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
|
$(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
|
||||||
|
-MD -MF $(@:%.o=%.d) -o $@ -c $<
|
||||||
|
$(transform-d-to-p)
|
||||||
|
-include $(GEN:%.o=%.P)
|
||||||
ALL_GENERATED_SOURCES += $(GEN)
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
|
|
||||||
|
|
||||||
@@ -585,18 +729,60 @@ ALL_GENERATED_SOURCES += $(GEN)
|
|||||||
# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
|
# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
|
||||||
WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
|
WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
|
||||||
|
|
||||||
|
# ========================================================
|
||||||
|
# libbionic_ssp.a - stack protector code
|
||||||
|
# ========================================================
|
||||||
|
#
|
||||||
|
# The stack protector code needs to be compiled
|
||||||
|
# with -fno-stack-protector, since it modifies the
|
||||||
|
# stack canary.
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := bionic/ssp.c
|
||||||
|
LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
|
||||||
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
|
LOCAL_MODULE := libbionic_ssp
|
||||||
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
|
||||||
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
|
# ========================================================
|
||||||
|
# libc_netbsd.a - upstream NetBSD C library code
|
||||||
|
# ========================================================
|
||||||
|
#
|
||||||
|
# These files are built with the netbsd-compat.h header file
|
||||||
|
# automatically included.
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
|
||||||
|
LOCAL_CFLAGS := \
|
||||||
|
$(libc_common_cflags) \
|
||||||
|
-I$(LOCAL_PATH)/upstream-netbsd \
|
||||||
|
-include upstream-netbsd/netbsd-compat.h
|
||||||
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
|
LOCAL_MODULE := libc_netbsd
|
||||||
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
|
||||||
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
# ========================================================
|
# ========================================================
|
||||||
# libc_common.a
|
# libc_common.a
|
||||||
# ========================================================
|
# ========================================================
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_SRC_FILES := $(libc_common_src_files)
|
LOCAL_SRC_FILES := $(libc_common_src_files)
|
||||||
LOCAL_CFLAGS := $(libc_common_cflags)
|
LOCAL_CFLAGS := $(libc_common_cflags)
|
||||||
ifeq ($(TARGET_ARCH),arm)
|
|
||||||
LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
|
|
||||||
endif
|
|
||||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
LOCAL_MODULE := libc_common
|
LOCAL_MODULE := libc_common
|
||||||
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
|
LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_netbsd
|
||||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
|
||||||
include $(BUILD_STATIC_LIBRARY)
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
@@ -624,6 +810,7 @@ LOCAL_CFLAGS := $(libc_common_cflags) \
|
|||||||
-DLIBC_STATIC
|
-DLIBC_STATIC
|
||||||
|
|
||||||
LOCAL_MODULE := libc_nomalloc
|
LOCAL_MODULE := libc_nomalloc
|
||||||
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
||||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
|
||||||
@@ -639,13 +826,14 @@ LOCAL_SRC_FILES := \
|
|||||||
$(libc_arch_static_src_files) \
|
$(libc_arch_static_src_files) \
|
||||||
$(libc_static_common_src_files) \
|
$(libc_static_common_src_files) \
|
||||||
bionic/dlmalloc.c \
|
bionic/dlmalloc.c \
|
||||||
bionic/malloc_debug_common.c \
|
bionic/malloc_debug_common.cpp \
|
||||||
bionic/libc_init_static.c
|
bionic/libc_init_static.c
|
||||||
|
|
||||||
LOCAL_CFLAGS := $(libc_common_cflags) \
|
LOCAL_CFLAGS := $(libc_common_cflags) \
|
||||||
-DLIBC_STATIC
|
-DLIBC_STATIC
|
||||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
LOCAL_MODULE := libc
|
LOCAL_MODULE := libc
|
||||||
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
||||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
|
||||||
@@ -657,17 +845,36 @@ include $(BUILD_STATIC_LIBRARY)
|
|||||||
# ========================================================
|
# ========================================================
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_CFLAGS := $(libc_common_cflags)
|
# pthread deadlock prediction:
|
||||||
|
# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for
|
||||||
|
# pthread deadlock prediction.
|
||||||
|
# Since this code is experimental it is disabled by default.
|
||||||
|
# see libc/bionic/pthread_debug.c for details
|
||||||
|
|
||||||
|
LOCAL_CFLAGS := $(libc_common_cflags) -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
|
||||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
|
|
||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
$(libc_arch_dynamic_src_files) \
|
$(libc_arch_dynamic_src_files) \
|
||||||
$(libc_static_common_src_files) \
|
$(libc_static_common_src_files) \
|
||||||
bionic/dlmalloc.c \
|
bionic/dlmalloc.c \
|
||||||
bionic/malloc_debug_common.c \
|
bionic/malloc_debug_common.cpp \
|
||||||
|
bionic/pthread_debug.c \
|
||||||
bionic/libc_init_dynamic.c
|
bionic/libc_init_dynamic.c
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH),arm)
|
||||||
|
LOCAL_NO_CRT := true
|
||||||
|
LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := \
|
||||||
|
arch-arm/bionic/crtbegin_so.c \
|
||||||
|
arch-arm/bionic/atexit_legacy.c \
|
||||||
|
$(LOCAL_SRC_FILES) \
|
||||||
|
arch-arm/bionic/crtend_so.S
|
||||||
|
endif
|
||||||
|
|
||||||
LOCAL_MODULE:= libc
|
LOCAL_MODULE:= libc
|
||||||
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
|
|
||||||
# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
|
# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
|
||||||
# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
|
# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
|
||||||
@@ -704,11 +911,15 @@ LOCAL_CFLAGS := \
|
|||||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
|
|
||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
bionic/malloc_debug_leak.c
|
bionic/malloc_debug_leak.cpp \
|
||||||
|
bionic/malloc_debug_check.cpp \
|
||||||
|
bionic/malloc_debug_check_mapinfo.cpp \
|
||||||
|
bionic/malloc_debug_stacktrace.cpp
|
||||||
|
|
||||||
LOCAL_MODULE:= libc_malloc_debug_leak
|
LOCAL_MODULE:= libc_malloc_debug_leak
|
||||||
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := libc
|
LOCAL_SHARED_LIBRARIES := libc libdl
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
||||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
|
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
|
||||||
@@ -731,11 +942,12 @@ LOCAL_CFLAGS := \
|
|||||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
|
|
||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
bionic/malloc_debug_qemu.c
|
bionic/malloc_debug_qemu.cpp
|
||||||
|
|
||||||
LOCAL_MODULE:= libc_malloc_debug_qemu
|
LOCAL_MODULE:= libc_malloc_debug_qemu
|
||||||
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := libc
|
LOCAL_SHARED_LIBRARIES := libc libdl
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
||||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
|
||||||
|
|||||||
4238
libc/NOTICE
4238
libc/NOTICE
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
# this file is used to list all the syscalls that will be supported by
|
# this file is used to list all the syscalls that will be supported by
|
||||||
# the Bionic C library. It is used to automatically generate the syscall
|
# the Bionic C library. It is used to automatically generate the syscall
|
||||||
# stubs, the list of syscall constants (__NR_xxxx) and the content of <linux/_unitsd.h>
|
# stubs, the list of syscall constants (__NR_xxxx) and the content of <linux/_unistd.h>
|
||||||
#
|
#
|
||||||
# each non comment line has the following format:
|
# each non comment line has the following format:
|
||||||
#
|
#
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
# a relevant C stub
|
# a relevant C stub
|
||||||
#
|
#
|
||||||
# - additionally, if the syscall number is different amoung ARM, and x86, MIPS use:
|
# - additionally, if the syscall number is different amoung ARM, and x86, MIPS use:
|
||||||
# return_type funcname[:syscall_name](parameters) arm_number,x86_number, mips_number
|
# return_type funcname[:syscall_name](parameters) arm_number,x86_number,mips_number
|
||||||
#
|
#
|
||||||
# the file is processed by a python script named gensyscalls.py
|
# the file is processed by a python script named gensyscalls.py
|
||||||
#
|
#
|
||||||
@@ -62,6 +62,7 @@ int getgroups:getgroups32(int, gid_t *) 205,205,-1
|
|||||||
int getgroups:getgroups(int, gid_t *) -1,-1,80
|
int getgroups:getgroups(int, gid_t *) -1,-1,80
|
||||||
pid_t getpgid(pid_t) 132
|
pid_t getpgid(pid_t) 132
|
||||||
pid_t getppid() 64
|
pid_t getppid() 64
|
||||||
|
pid_t getsid(pid_t) 147
|
||||||
pid_t setsid() 66
|
pid_t setsid() 66
|
||||||
int setgid:setgid32(gid_t) 214,214,-1
|
int setgid:setgid32(gid_t) 214,214,-1
|
||||||
int setgid:setgid(gid_t) -1,-1,46
|
int setgid:setgid(gid_t) -1,-1,46
|
||||||
@@ -76,6 +77,7 @@ void* __brk:brk(void*) 45
|
|||||||
# see comments in arch-arm/bionic/kill.S to understand why we don't generate an ARM stub for kill/tkill
|
# see comments in arch-arm/bionic/kill.S to understand why we don't generate an ARM stub for kill/tkill
|
||||||
int kill(pid_t, int) -1,37,37
|
int kill(pid_t, int) -1,37,37
|
||||||
int tkill(pid_t tid, int sig) -1,238,236
|
int tkill(pid_t tid, int sig) -1,238,236
|
||||||
|
int tgkill(pid_t tgid, pid_t tid, int sig) -1,270,266
|
||||||
int __ptrace:ptrace(int request, int pid, void* addr, void* data) 26
|
int __ptrace:ptrace(int request, int pid, void* addr, void* data) 26
|
||||||
int __set_thread_area:set_thread_area(void* user_desc) -1,243,283
|
int __set_thread_area:set_thread_area(void* user_desc) -1,243,283
|
||||||
int __getpriority:getpriority(int, int) 96
|
int __getpriority:getpriority(int, int) 96
|
||||||
@@ -121,6 +123,8 @@ int mprotect(const void *, size_t, int) 125
|
|||||||
int madvise(const void *, size_t, int) 220,219,218
|
int madvise(const void *, size_t, int) 220,219,218
|
||||||
int mlock(const void *addr, size_t len) 150,150,154
|
int mlock(const void *addr, size_t len) 150,150,154
|
||||||
int munlock(const void *addr, size_t len) 151,151,155
|
int munlock(const void *addr, size_t len) 151,151,155
|
||||||
|
int mlockall(int flags) 152,152,156
|
||||||
|
int munlockall() 153,153,157
|
||||||
int mincore(void* start, size_t length, unsigned char* vec) 219,218,217
|
int mincore(void* start, size_t length, unsigned char* vec) 219,218,217
|
||||||
int __ioctl:ioctl(int, int, void *) 54
|
int __ioctl:ioctl(int, int, void *) 54
|
||||||
int readv(int, const struct iovec *, int) 145
|
int readv(int, const struct iovec *, int) 145
|
||||||
@@ -177,6 +181,7 @@ int rmdir(const char *) 40
|
|||||||
int rename(const char *, const char *) 38
|
int rename(const char *, const char *) 38
|
||||||
int __getcwd:getcwd(char * buf, size_t size) 183,183,203
|
int __getcwd:getcwd(char * buf, size_t size) 183,183,203
|
||||||
int access(const char *, int) 33
|
int access(const char *, int) 33
|
||||||
|
int faccessat(int, const char *, int, int) 334,307,300
|
||||||
int symlink(const char *, const char *) 83
|
int symlink(const char *, const char *) 83
|
||||||
int fchdir(int) 133
|
int fchdir(int) 133
|
||||||
int truncate(const char*, off_t) 92
|
int truncate(const char*, off_t) 92
|
||||||
@@ -189,6 +194,7 @@ ssize_t llistxattr(const char *, char *, size_t) 233,233,231
|
|||||||
int removexattr(const char *, const char *) 235,235,233
|
int removexattr(const char *, const char *) 235,235,233
|
||||||
int lremovexattr(const char *, const char *) 236,236,234
|
int lremovexattr(const char *, const char *) 236,236,234
|
||||||
int __statfs64:statfs64(const char *, size_t, struct statfs *) 266,268,255
|
int __statfs64:statfs64(const char *, size_t, struct statfs *) 266,268,255
|
||||||
|
long unshare(unsigned long) 337,310,303
|
||||||
|
|
||||||
# time
|
# time
|
||||||
int pause () 29
|
int pause () 29
|
||||||
@@ -213,7 +219,8 @@ int utimensat(int, const char *, const struct timespec times[2], int)
|
|||||||
# signals
|
# signals
|
||||||
int sigaction(int, const struct sigaction *, struct sigaction *) 67
|
int sigaction(int, const struct sigaction *, struct sigaction *) 67
|
||||||
int sigprocmask(int, const sigset_t *, sigset_t *) 126
|
int sigprocmask(int, const sigset_t *, sigset_t *) 126
|
||||||
int __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask) 72
|
int __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask) 72,72,-1
|
||||||
|
int __sigsuspend:sigsuspend(const sigset_t *mask) -1,-1,72
|
||||||
int __rt_sigaction:rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize) 174,174,194
|
int __rt_sigaction:rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize) 174,174,194
|
||||||
int __rt_sigprocmask:rt_sigprocmask (int how, const sigset_t *set, sigset_t *oset, size_t sigsetsize) 175,175,195
|
int __rt_sigprocmask:rt_sigprocmask (int how, const sigset_t *set, sigset_t *oset, size_t sigsetsize) 175,175,195
|
||||||
int __rt_sigtimedwait:rt_sigtimedwait(const sigset_t *set, struct siginfo_t *info, struct timespec_t *timeout, size_t sigset_size) 177,177,197
|
int __rt_sigtimedwait:rt_sigtimedwait(const sigset_t *set, struct siginfo_t *info, struct timespec_t *timeout, size_t sigset_size) 177,177,197
|
||||||
@@ -281,6 +288,7 @@ int delete_module(const char*, unsigned int) 129
|
|||||||
int klogctl:syslog(int, char *, int) 103
|
int klogctl:syslog(int, char *, int) 103
|
||||||
int sysinfo(struct sysinfo *) 116
|
int sysinfo(struct sysinfo *) 116
|
||||||
int personality(unsigned long) 136
|
int personality(unsigned long) 136
|
||||||
|
long perf_event_open(struct perf_event_attr *attr_uptr, pid_t pid, int cpu, int group_fd, unsigned long flags) 364
|
||||||
|
|
||||||
# futex
|
# futex
|
||||||
int futex(void *, int, int, void *, void *, int) 240,240,238
|
int futex(void *, int, int, void *, void *, int) 240,240,238
|
||||||
|
|||||||
35
libc/arch-arm/bionic/atexit.h
Normal file
35
libc/arch-arm/bionic/atexit.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern void *__dso_handle;
|
||||||
|
|
||||||
|
__attribute__ ((visibility ("hidden")))
|
||||||
|
int atexit(void (*func)(void))
|
||||||
|
{
|
||||||
|
return (__cxa_atexit((void (*)(void *))func, (void *)0, &__dso_handle));
|
||||||
|
}
|
||||||
60
libc/arch-arm/bionic/atexit_legacy.c
Normal file
60
libc/arch-arm/bionic/atexit_legacy.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2012 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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 <sys/types.h>
|
||||||
|
#include <private/logd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This source file should only be included by libc.so, its purpose is
|
||||||
|
* to support legacy ARM binaries by exporting a publicly visible
|
||||||
|
* implementation of atexit().
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int __cxa_atexit(void (*func)(void *), void *arg, void *dso);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register a function to be performed at exit.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
atexit(void (*func)(void))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Exit functions queued by this version of atexit will not be called
|
||||||
|
* on dlclose(), and when they are called (at program exit), the
|
||||||
|
* calling library may have been dlclose()'d, causing the program to
|
||||||
|
* crash.
|
||||||
|
*/
|
||||||
|
static char const warning[] =
|
||||||
|
"WARNING: generic atexit() called from legacy shared library\n";
|
||||||
|
|
||||||
|
__libc_android_log_print(ANDROID_LOG_WARN, "libc", warning);
|
||||||
|
fprintf(stderr, warning);
|
||||||
|
|
||||||
|
return (__cxa_atexit((void (*)(void *))func, NULL, NULL));
|
||||||
|
}
|
||||||
@@ -1,236 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2008 The Android Open Source Project
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * 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.
|
|
||||||
*
|
|
||||||
* 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 OWNER 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 <sys/linux-syscalls.h>
|
|
||||||
#include <machine/asm.h>
|
|
||||||
#include <machine/cpu-features.h>
|
|
||||||
|
|
||||||
#define FUTEX_WAIT 0
|
|
||||||
#define FUTEX_WAKE 1
|
|
||||||
|
|
||||||
#if defined(__ARM_HAVE_LDREX_STREX)
|
|
||||||
/*
|
|
||||||
* ===========================================================================
|
|
||||||
* ARMv6+ implementation
|
|
||||||
* ===========================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* r0(addr) -> r0(old) */
|
|
||||||
ENTRY(__atomic_dec)
|
|
||||||
mov r1, r0 @ copy addr so we don't clobber it
|
|
||||||
1: ldrex r0, [r1] @ load current value into r0
|
|
||||||
sub r2, r0, #1 @ generate new value into r2
|
|
||||||
strex r3, r2, [r1] @ try to store new value; result in r3
|
|
||||||
cmp r3, #0 @ success?
|
|
||||||
bxeq lr @ yes, return
|
|
||||||
b 1b @ no, retry
|
|
||||||
END(__atomic_dec)
|
|
||||||
|
|
||||||
/* r0(addr) -> r0(old) */
|
|
||||||
ENTRY(__atomic_inc)
|
|
||||||
mov r1, r0
|
|
||||||
1: ldrex r0, [r1]
|
|
||||||
add r2, r0, #1
|
|
||||||
strex r3, r2, [r1]
|
|
||||||
cmp r3, #0
|
|
||||||
bxeq lr
|
|
||||||
b 1b
|
|
||||||
END(__atomic_inc)
|
|
||||||
|
|
||||||
/* r0(old) r1(new) r2(addr) -> r0(zero_if_succeeded) */
|
|
||||||
ENTRY(__atomic_cmpxchg)
|
|
||||||
1: mov ip, #2 @ ip=2 means "new != old"
|
|
||||||
ldrex r3, [r2] @ load current value into r3
|
|
||||||
teq r0, r3 @ new == old?
|
|
||||||
strexeq ip, r1, [r2] @ yes, try store, set ip to 0 or 1
|
|
||||||
teq ip, #1 @ strex failure?
|
|
||||||
beq 1b @ yes, retry
|
|
||||||
mov r0, ip @ return 0 on success, 2 on failure
|
|
||||||
bx lr
|
|
||||||
END(__atomic_cmpxchg)
|
|
||||||
|
|
||||||
/* r0(new) r1(addr) -> r0(old) */
|
|
||||||
ENTRY(__atomic_swap)
|
|
||||||
1: ldrex r2, [r1]
|
|
||||||
strex r3, r0, [r1]
|
|
||||||
teq r3, #0
|
|
||||||
bne 1b
|
|
||||||
mov r0, r2
|
|
||||||
bx lr
|
|
||||||
END(__atomic_swap)
|
|
||||||
|
|
||||||
#else /*not defined __ARM_HAVE_LDREX_STREX*/
|
|
||||||
/*
|
|
||||||
* ===========================================================================
|
|
||||||
* Pre-ARMv6 implementation
|
|
||||||
* ===========================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* int __kernel_cmpxchg(int oldval, int newval, int* ptr) */
|
|
||||||
.equ kernel_cmpxchg, 0xFFFF0FC0
|
|
||||||
.equ kernel_atomic_base, 0xFFFF0FFF
|
|
||||||
|
|
||||||
/* r0(addr) -> r0(old) */
|
|
||||||
ENTRY(__atomic_dec)
|
|
||||||
.save {r4, lr}
|
|
||||||
stmdb sp!, {r4, lr}
|
|
||||||
mov r2, r0
|
|
||||||
1: @ atomic_dec
|
|
||||||
ldr r0, [r2]
|
|
||||||
mov r3, #kernel_atomic_base
|
|
||||||
add lr, pc, #4
|
|
||||||
sub r1, r0, #1
|
|
||||||
add pc, r3, #(kernel_cmpxchg - kernel_atomic_base)
|
|
||||||
bcc 1b
|
|
||||||
add r0, r1, #1
|
|
||||||
ldmia sp!, {r4, lr}
|
|
||||||
bx lr
|
|
||||||
END(__atomic_dec)
|
|
||||||
|
|
||||||
/* r0(addr) -> r0(old) */
|
|
||||||
ENTRY(__atomic_inc)
|
|
||||||
.save {r4, lr}
|
|
||||||
stmdb sp!, {r4, lr}
|
|
||||||
mov r2, r0
|
|
||||||
1: @ atomic_inc
|
|
||||||
ldr r0, [r2]
|
|
||||||
mov r3, #kernel_atomic_base
|
|
||||||
add lr, pc, #4
|
|
||||||
add r1, r0, #1
|
|
||||||
add pc, r3, #(kernel_cmpxchg - kernel_atomic_base)
|
|
||||||
bcc 1b
|
|
||||||
sub r0, r1, #1
|
|
||||||
ldmia sp!, {r4, lr}
|
|
||||||
bx lr
|
|
||||||
END(__atomic_inc)
|
|
||||||
|
|
||||||
/* r0(old) r1(new) r2(addr) -> r0(zero_if_succeeded) */
|
|
||||||
ENTRY(__atomic_cmpxchg)
|
|
||||||
.save {r4, lr}
|
|
||||||
stmdb sp!, {r4, lr}
|
|
||||||
mov r4, r0 /* r4 = save oldvalue */
|
|
||||||
1: @ atomic_cmpxchg
|
|
||||||
mov r3, #kernel_atomic_base
|
|
||||||
add lr, pc, #4
|
|
||||||
mov r0, r4 /* r0 = oldvalue */
|
|
||||||
add pc, r3, #(kernel_cmpxchg - kernel_atomic_base)
|
|
||||||
bcs 2f /* swap was made. we're good, return. */
|
|
||||||
ldr r3, [r2] /* swap not made, see if it's because *ptr!=oldvalue */
|
|
||||||
cmp r3, r4
|
|
||||||
beq 1b
|
|
||||||
2: @ atomic_cmpxchg
|
|
||||||
ldmia sp!, {r4, lr}
|
|
||||||
bx lr
|
|
||||||
END(__atomic_cmpxchg)
|
|
||||||
|
|
||||||
/* r0(new) r1(addr) -> r0(old) */
|
|
||||||
ENTRY(__atomic_swap)
|
|
||||||
swp r0, r0, [r1]
|
|
||||||
bx lr
|
|
||||||
END(__atomic_swap)
|
|
||||||
|
|
||||||
#endif /*not defined __ARM_HAVE_LDREX_STREX*/
|
|
||||||
|
|
||||||
|
|
||||||
/* __futex_wait(*ftx, val, *timespec) */
|
|
||||||
/* __futex_wake(*ftx, counter) */
|
|
||||||
/* __futex_syscall3(*ftx, op, val) */
|
|
||||||
/* __futex_syscall4(*ftx, op, val, *timespec) */
|
|
||||||
|
|
||||||
.global __futex_wait
|
|
||||||
.type __futex_wait, %function
|
|
||||||
|
|
||||||
.global __futex_wake
|
|
||||||
.type __futex_wake, %function
|
|
||||||
|
|
||||||
.global __futex_syscall3
|
|
||||||
.type __futex_syscall3, %function
|
|
||||||
|
|
||||||
.global __futex_syscall4
|
|
||||||
.type __futex_syscall4, %function
|
|
||||||
|
|
||||||
#if __ARM_EABI__
|
|
||||||
|
|
||||||
ENTRY(__futex_syscall3)
|
|
||||||
stmdb sp!, {r4, r7}
|
|
||||||
.save {r4, r7}
|
|
||||||
ldr r7, =__NR_futex
|
|
||||||
swi #0
|
|
||||||
ldmia sp!, {r4, r7}
|
|
||||||
bx lr
|
|
||||||
END(__futex_syscall3)
|
|
||||||
|
|
||||||
ENTRY(__futex_wait)
|
|
||||||
stmdb sp!, {r4, r7}
|
|
||||||
.save {r4, r7}
|
|
||||||
mov r3, r2
|
|
||||||
mov r2, r1
|
|
||||||
mov r1, #FUTEX_WAIT
|
|
||||||
ldr r7, =__NR_futex
|
|
||||||
swi #0
|
|
||||||
ldmia sp!, {r4, r7}
|
|
||||||
bx lr
|
|
||||||
END(__futex_wait)
|
|
||||||
|
|
||||||
ENTRY(__futex_wake)
|
|
||||||
.save {r4, r7}
|
|
||||||
stmdb sp!, {r4, r7}
|
|
||||||
mov r2, r1
|
|
||||||
mov r1, #FUTEX_WAKE
|
|
||||||
ldr r7, =__NR_futex
|
|
||||||
swi #0
|
|
||||||
ldmia sp!, {r4, r7}
|
|
||||||
bx lr
|
|
||||||
END(__futex_wake)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
ENTRY(__futex_syscall3)
|
|
||||||
swi #__NR_futex
|
|
||||||
bx lr
|
|
||||||
END(__futex_syscall3)
|
|
||||||
|
|
||||||
ENTRY(__futex_wait)
|
|
||||||
mov r3, r2
|
|
||||||
mov r2, r1
|
|
||||||
mov r1, #FUTEX_WAIT
|
|
||||||
swi #__NR_futex
|
|
||||||
bx lr
|
|
||||||
END(__futex_wait)
|
|
||||||
|
|
||||||
ENTRY(__futex_wake)
|
|
||||||
mov r2, r1
|
|
||||||
mov r1, #FUTEX_WAKE
|
|
||||||
swi #__NR_futex
|
|
||||||
bx lr
|
|
||||||
END(__futex_wake)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ENTRY(__futex_syscall4)
|
|
||||||
b __futex_syscall3
|
|
||||||
END(__futex_syscall4)
|
|
||||||
87
libc/arch-arm/bionic/atomics_arm.c
Normal file
87
libc/arch-arm/bionic/atomics_arm.c
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* The purpose of this file is to export a small set of atomic-related
|
||||||
|
* functions from the C library, to ensure binary ABI compatibility for
|
||||||
|
* the NDK.
|
||||||
|
*
|
||||||
|
* These functions were initially exposed by the NDK through <sys/atomics.h>,
|
||||||
|
* which was unfortunate because their implementation didn't provide any
|
||||||
|
* memory barriers at all.
|
||||||
|
*
|
||||||
|
* This wasn't a problem for the platform code that used them, because it
|
||||||
|
* used explicit barrier instructions around them. On the other hand, it means
|
||||||
|
* that any NDK-generated machine code that linked against them would not
|
||||||
|
* perform correctly when running on multi-core devices.
|
||||||
|
*
|
||||||
|
* To fix this, the platform code was first modified to not use any of these
|
||||||
|
* functions (everything is now inlined through assembly statements, see
|
||||||
|
* libc/private/bionic_arm_inline.h and the headers it includes.
|
||||||
|
*
|
||||||
|
* The functions here are thus only for the benefit of NDK applications,
|
||||||
|
* and now includes full memory barriers to prevent any random memory ordering
|
||||||
|
* issue from cropping.
|
||||||
|
*
|
||||||
|
* Note that we also provide an updated <sys/atomics.h> header that defines
|
||||||
|
* always_inlined versions of the functions that use the GCC builtin
|
||||||
|
* intrinsics to perform the same thing.
|
||||||
|
*
|
||||||
|
* NOTE: There is no need for a similar file for non-ARM platforms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* DO NOT INCLUDE <sys/atomics.h> HERE ! */
|
||||||
|
|
||||||
|
int
|
||||||
|
__atomic_cmpxchg(int old, int _new, volatile int *ptr)
|
||||||
|
{
|
||||||
|
/* We must return 0 on success */
|
||||||
|
return __sync_val_compare_and_swap(ptr, old, _new) != old;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
__atomic_swap(int _new, volatile int *ptr)
|
||||||
|
{
|
||||||
|
int prev;
|
||||||
|
do {
|
||||||
|
prev = *ptr;
|
||||||
|
} while (__sync_val_compare_and_swap(ptr, prev, _new) != prev);
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
__atomic_dec(volatile int *ptr)
|
||||||
|
{
|
||||||
|
return __sync_fetch_and_sub (ptr, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
__atomic_inc(volatile int *ptr)
|
||||||
|
{
|
||||||
|
return __sync_fetch_and_add (ptr, 1);
|
||||||
|
}
|
||||||
@@ -30,8 +30,7 @@
|
|||||||
|
|
||||||
ENTRY(__pthread_clone)
|
ENTRY(__pthread_clone)
|
||||||
@ insert the args onto the new stack
|
@ insert the args onto the new stack
|
||||||
str r0, [r1, #-4]
|
stmdb r1!, {r0, r3}
|
||||||
str r3, [r1, #-8]
|
|
||||||
|
|
||||||
@ do the system call
|
@ do the system call
|
||||||
@ get flags
|
@ get flags
|
||||||
@@ -60,8 +59,7 @@ ENTRY(__pthread_clone)
|
|||||||
@ to the C __thread_entry function which does some setup and then
|
@ to the C __thread_entry function which does some setup and then
|
||||||
@ calls the thread's start function
|
@ calls the thread's start function
|
||||||
|
|
||||||
ldr r0, [sp, #-4]
|
pop {r0, r1}
|
||||||
ldr r1, [sp, #-8]
|
|
||||||
mov r2, sp @ __thread_entry needs the TLS pointer
|
mov r2, sp @ __thread_entry needs the TLS pointer
|
||||||
b __thread_entry
|
b __thread_entry
|
||||||
|
|
||||||
|
|||||||
68
libc/arch-arm/bionic/crtbegin.c
Normal file
68
libc/arch-arm/bionic/crtbegin.c
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
void (**preinit_array)(void);
|
||||||
|
void (**init_array)(void);
|
||||||
|
void (**fini_array)(void);
|
||||||
|
} structors_array_t;
|
||||||
|
|
||||||
|
extern int main(int argc, char **argv, char **env);
|
||||||
|
|
||||||
|
extern void __libc_init(
|
||||||
|
unsigned int *elfdata,
|
||||||
|
void (*onexit)(void),
|
||||||
|
int (*slingshot)(int, char**, char**),
|
||||||
|
structors_array_t const * const structors
|
||||||
|
);
|
||||||
|
|
||||||
|
__attribute__ ((section (".preinit_array")))
|
||||||
|
void (*__PREINIT_ARRAY__)(void) = (void (*)(void)) -1;
|
||||||
|
|
||||||
|
__attribute__ ((section (".init_array")))
|
||||||
|
void (*__INIT_ARRAY__)(void) = (void (*)(void)) -1;
|
||||||
|
|
||||||
|
__attribute__ ((section (".fini_array")))
|
||||||
|
void (*__FINI_ARRAY__)(void) = (void (*)(void)) -1;
|
||||||
|
|
||||||
|
__attribute__((visibility("hidden")))
|
||||||
|
void _start() {
|
||||||
|
structors_array_t array;
|
||||||
|
void *elfdata;
|
||||||
|
|
||||||
|
array.preinit_array = &__PREINIT_ARRAY__;
|
||||||
|
array.init_array = &__INIT_ARRAY__;
|
||||||
|
array.fini_array = &__FINI_ARRAY__;
|
||||||
|
|
||||||
|
elfdata = __builtin_frame_address(0) + sizeof(void *);
|
||||||
|
__libc_init(elfdata, (void *) 0, &main, &array);
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "__dso_handle.h"
|
||||||
|
#include "atexit.h"
|
||||||
58
libc/arch-arm/bionic/crtbegin_so.c
Normal file
58
libc/arch-arm/bionic/crtbegin_so.c
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern void __cxa_finalize(void *);
|
||||||
|
extern void *__dso_handle;
|
||||||
|
|
||||||
|
__attribute__((visibility("hidden"),destructor))
|
||||||
|
void __on_dlclose() {
|
||||||
|
__cxa_finalize(&__dso_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CRT_LEGACY_WORKAROUND should only be defined when building
|
||||||
|
* this file as part of the platform's C library.
|
||||||
|
*
|
||||||
|
* The C library already defines a function named 'atexit()'
|
||||||
|
* for backwards compatibility with older NDK-generated binaries.
|
||||||
|
*
|
||||||
|
* For newer ones, 'atexit' is actually embedded in the C
|
||||||
|
* runtime objects that are linked into the final ELF
|
||||||
|
* binary (shared library or executable), and will call
|
||||||
|
* __cxa_atexit() in order to un-register any atexit()
|
||||||
|
* handler when a library is unloaded.
|
||||||
|
*
|
||||||
|
* This function must be global *and* hidden. Only the
|
||||||
|
* code inside the same ELF binary should be able to access it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CRT_LEGACY_WORKAROUND
|
||||||
|
#include "__dso_handle.h"
|
||||||
|
#else
|
||||||
|
#include "__dso_handle_so.h"
|
||||||
|
#include "atexit.h"
|
||||||
|
#endif
|
||||||
@@ -35,6 +35,6 @@
|
|||||||
.section .fini_array, "aw"
|
.section .fini_array, "aw"
|
||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
.section .ctors, "aw"
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
.long 0
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -26,13 +26,6 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This is the same than crtend.S except that a shared library
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
* cannot have a .preinit_array
|
.section .note.GNU-stack,"",%progbits
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
.section .init_array, "aw"
|
|
||||||
.long 0
|
|
||||||
|
|
||||||
.section .fini_array, "aw"
|
|
||||||
.long 0
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,22 +30,6 @@
|
|||||||
|
|
||||||
extern int __cxa_atexit(void (*)(void*), void*, void* );
|
extern int __cxa_atexit(void (*)(void*), void*, void* );
|
||||||
|
|
||||||
/* Temporary hack: this variable should not be part of the C library
|
|
||||||
* itself, but placed in the .bss section of each executable or
|
|
||||||
* shared library instead.
|
|
||||||
*
|
|
||||||
* We keep it here temporarily until the build system has been
|
|
||||||
* modified properly to use crtbegin_so.S and crtend_so.S when
|
|
||||||
* generating shared libraries.
|
|
||||||
*
|
|
||||||
* It must be a 'weak' symbol to avoid conflicts with the definitions
|
|
||||||
* that have been moved to crtbegin_static.S and crtbegin_dynamic.S
|
|
||||||
*
|
|
||||||
* For the record, it is used for static C++ object construction
|
|
||||||
* and destruction. See http://www.codesourcery.com/public/cxx-abi/abi.html#dso-dtor
|
|
||||||
*/
|
|
||||||
void* __attribute__((weak)) __dso_handle;
|
|
||||||
|
|
||||||
/* The "C++ ABI for ARM" document states that static C++ constructors,
|
/* The "C++ ABI for ARM" document states that static C++ constructors,
|
||||||
* which are called from the .init_array, should manually call
|
* which are called from the .init_array, should manually call
|
||||||
* __aeabi_atexit() to register static destructors explicitely.
|
* __aeabi_atexit() to register static destructors explicitely.
|
||||||
|
|||||||
@@ -25,12 +25,8 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
typedef long unsigned int *_Unwind_Ptr;
|
|
||||||
|
|
||||||
/* Stubbed out in libdl and defined in the dynamic linker.
|
#include <link.h>
|
||||||
* Same semantics as __gnu_Unwind_Find_exidx().
|
|
||||||
*/
|
|
||||||
extern _Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);
|
|
||||||
|
|
||||||
/* For a given PC, find the .so that it belongs to.
|
/* For a given PC, find the .so that it belongs to.
|
||||||
* Returns the base address of the .ARM.exidx section
|
* Returns the base address of the .ARM.exidx section
|
||||||
|
|||||||
@@ -25,7 +25,8 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
typedef long unsigned int *_Unwind_Ptr;
|
|
||||||
|
#include <link.h>
|
||||||
|
|
||||||
/* Find the .ARM.exidx section (which in the case of a static executable
|
/* Find the .ARM.exidx section (which in the case of a static executable
|
||||||
* can be identified through its start and end symbols), and return its
|
* can be identified through its start and end symbols), and return its
|
||||||
|
|||||||
112
libc/arch-arm/bionic/futex_arm.S
Normal file
112
libc/arch-arm/bionic/futex_arm.S
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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 <sys/linux-syscalls.h>
|
||||||
|
#include <machine/asm.h>
|
||||||
|
#include <machine/cpu-features.h>
|
||||||
|
|
||||||
|
#define FUTEX_WAIT 0
|
||||||
|
#define FUTEX_WAKE 1
|
||||||
|
|
||||||
|
/* __futex_wait(*ftx, val, *timespec) */
|
||||||
|
/* __futex_wake(*ftx, counter) */
|
||||||
|
/* __futex_syscall3(*ftx, op, val) */
|
||||||
|
/* __futex_syscall4(*ftx, op, val, *timespec) */
|
||||||
|
|
||||||
|
.global __futex_wait
|
||||||
|
.type __futex_wait, %function
|
||||||
|
|
||||||
|
.global __futex_wake
|
||||||
|
.type __futex_wake, %function
|
||||||
|
|
||||||
|
.global __futex_syscall3
|
||||||
|
.type __futex_syscall3, %function
|
||||||
|
|
||||||
|
.global __futex_syscall4
|
||||||
|
.type __futex_syscall4, %function
|
||||||
|
|
||||||
|
#if __ARM_EABI__
|
||||||
|
|
||||||
|
ENTRY(__futex_syscall3)
|
||||||
|
stmdb sp!, {r4, r7}
|
||||||
|
.save {r4, r7}
|
||||||
|
ldr r7, =__NR_futex
|
||||||
|
swi #0
|
||||||
|
ldmia sp!, {r4, r7}
|
||||||
|
bx lr
|
||||||
|
END(__futex_syscall3)
|
||||||
|
|
||||||
|
ENTRY(__futex_wait)
|
||||||
|
stmdb sp!, {r4, r7}
|
||||||
|
.save {r4, r7}
|
||||||
|
mov r3, r2
|
||||||
|
mov r2, r1
|
||||||
|
mov r1, #FUTEX_WAIT
|
||||||
|
ldr r7, =__NR_futex
|
||||||
|
swi #0
|
||||||
|
ldmia sp!, {r4, r7}
|
||||||
|
bx lr
|
||||||
|
END(__futex_wait)
|
||||||
|
|
||||||
|
ENTRY(__futex_wake)
|
||||||
|
.save {r4, r7}
|
||||||
|
stmdb sp!, {r4, r7}
|
||||||
|
mov r2, r1
|
||||||
|
mov r1, #FUTEX_WAKE
|
||||||
|
ldr r7, =__NR_futex
|
||||||
|
swi #0
|
||||||
|
ldmia sp!, {r4, r7}
|
||||||
|
bx lr
|
||||||
|
END(__futex_wake)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
ENTRY(__futex_syscall3)
|
||||||
|
swi #__NR_futex
|
||||||
|
bx lr
|
||||||
|
END(__futex_syscall3)
|
||||||
|
|
||||||
|
ENTRY(__futex_wait)
|
||||||
|
mov r3, r2
|
||||||
|
mov r2, r1
|
||||||
|
mov r1, #FUTEX_WAIT
|
||||||
|
swi #__NR_futex
|
||||||
|
bx lr
|
||||||
|
END(__futex_wait)
|
||||||
|
|
||||||
|
ENTRY(__futex_wake)
|
||||||
|
mov r2, r1
|
||||||
|
mov r1, #FUTEX_WAKE
|
||||||
|
swi #__NR_futex
|
||||||
|
bx lr
|
||||||
|
END(__futex_wake)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ENTRY(__futex_syscall4)
|
||||||
|
b __futex_syscall3
|
||||||
|
END(__futex_syscall4)
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
* any native shared library generated with it should now be safe from that
|
* any native shared library generated with it should now be safe from that
|
||||||
* problem. On the other hand, existing shared libraries distributed with
|
* problem. On the other hand, existing shared libraries distributed with
|
||||||
* applications that were generated with a previous version of the NDK
|
* applications that were generated with a previous version of the NDK
|
||||||
* still need all 1.5/1.6 helper functions in libc.so and libn.so
|
* still need all 1.5/1.6 helper functions in libc.so and libm.so
|
||||||
*
|
*
|
||||||
* After 3.2, the toolchain was updated again, adding __aeabi_f2uiz to the
|
* After 3.2, the toolchain was updated again, adding __aeabi_f2uiz to the
|
||||||
* list of requirements. Technically, this is due to mis-linked NDK libraries
|
* list of requirements. Technically, this is due to mis-linked NDK libraries
|
||||||
@@ -113,6 +113,8 @@
|
|||||||
XX(__aeabi_l2d) \
|
XX(__aeabi_l2d) \
|
||||||
XX(__aeabi_l2f) \
|
XX(__aeabi_l2f) \
|
||||||
XX(__aeabi_lmul) \
|
XX(__aeabi_lmul) \
|
||||||
|
XX(__aeabi_llsl) \
|
||||||
|
XX(__aeabi_llsr) \
|
||||||
XX(__aeabi_ui2d) \
|
XX(__aeabi_ui2d) \
|
||||||
XX(__aeabi_ui2f) \
|
XX(__aeabi_ui2f) \
|
||||||
XX(__aeabi_ul2d) \
|
XX(__aeabi_ul2d) \
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <machine/cpu-features.h>
|
#include <machine/cpu-features.h>
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
|
|
||||||
#if defined(__ARM_NEON__)
|
#if defined(__ARM_NEON__) && !defined(ARCH_ARM_USE_NON_NEON_MEMCPY)
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.fpu neon
|
.fpu neon
|
||||||
|
|||||||
@@ -25,37 +25,27 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
/* unlike our auto-generated syscall stubs, this code saves lr
|
||||||
|
on the stack, as well as a few other registers. this makes
|
||||||
|
our stack unwinder happy, when we generate debug stack
|
||||||
|
traces after the C library or other parts of the system
|
||||||
|
abort due to a fatal runtime error (e.g. detection
|
||||||
|
of a corrupted malloc heap).
|
||||||
|
*/
|
||||||
|
|
||||||
# Implement static C++ destructors when the shared
|
#include <sys/linux-syscalls.h>
|
||||||
# library is unloaded through dlclose().
|
#include <machine/asm.h>
|
||||||
#
|
|
||||||
# A call to this function must be the first entry
|
|
||||||
# in the .fini_array. See 3.3.5.3.C of C++ ABI
|
|
||||||
# standard.
|
|
||||||
#
|
|
||||||
__on_dlclose:
|
|
||||||
adr r0, 0f
|
|
||||||
ldr r0, [r0]
|
|
||||||
b __cxa_finalize
|
|
||||||
|
|
||||||
0:
|
#ifndef __NR_tgkill
|
||||||
.long __dso_handle
|
#define __NR_tgkill 268
|
||||||
|
|
||||||
.section .init_array, "aw"
|
|
||||||
.globl __INIT_ARRAY__
|
|
||||||
__INIT_ARRAY__:
|
|
||||||
.long -1
|
|
||||||
|
|
||||||
.section .fini_array, "aw"
|
|
||||||
.globl __FINI_ARRAY__
|
|
||||||
__FINI_ARRAY__:
|
|
||||||
.long -1
|
|
||||||
.long __on_dlclose
|
|
||||||
|
|
||||||
#ifdef CRT_LEGACY_WORKAROUND
|
|
||||||
#include "__dso_handle.S"
|
|
||||||
#else
|
|
||||||
#include "__dso_handle_so.S"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "atexit.S"
|
ENTRY(tgkill)
|
||||||
|
stmfd sp!, {r4-r7, ip, lr}
|
||||||
|
ldr r7, =__NR_tgkill
|
||||||
|
swi #0
|
||||||
|
ldmfd sp!, {r4-r7, ip, lr}
|
||||||
|
movs r0, r0
|
||||||
|
bxpl lr
|
||||||
|
b __set_syscall_errno
|
||||||
|
END(tgkill)
|
||||||
@@ -18,6 +18,7 @@ syscall_src += arch-arm/syscalls/readahead.S
|
|||||||
syscall_src += arch-arm/syscalls/getgroups.S
|
syscall_src += arch-arm/syscalls/getgroups.S
|
||||||
syscall_src += arch-arm/syscalls/getpgid.S
|
syscall_src += arch-arm/syscalls/getpgid.S
|
||||||
syscall_src += arch-arm/syscalls/getppid.S
|
syscall_src += arch-arm/syscalls/getppid.S
|
||||||
|
syscall_src += arch-arm/syscalls/getsid.S
|
||||||
syscall_src += arch-arm/syscalls/setsid.S
|
syscall_src += arch-arm/syscalls/setsid.S
|
||||||
syscall_src += arch-arm/syscalls/setgid.S
|
syscall_src += arch-arm/syscalls/setgid.S
|
||||||
syscall_src += arch-arm/syscalls/__setreuid.S
|
syscall_src += arch-arm/syscalls/__setreuid.S
|
||||||
@@ -58,6 +59,8 @@ syscall_src += arch-arm/syscalls/mprotect.S
|
|||||||
syscall_src += arch-arm/syscalls/madvise.S
|
syscall_src += arch-arm/syscalls/madvise.S
|
||||||
syscall_src += arch-arm/syscalls/mlock.S
|
syscall_src += arch-arm/syscalls/mlock.S
|
||||||
syscall_src += arch-arm/syscalls/munlock.S
|
syscall_src += arch-arm/syscalls/munlock.S
|
||||||
|
syscall_src += arch-arm/syscalls/mlockall.S
|
||||||
|
syscall_src += arch-arm/syscalls/munlockall.S
|
||||||
syscall_src += arch-arm/syscalls/mincore.S
|
syscall_src += arch-arm/syscalls/mincore.S
|
||||||
syscall_src += arch-arm/syscalls/__ioctl.S
|
syscall_src += arch-arm/syscalls/__ioctl.S
|
||||||
syscall_src += arch-arm/syscalls/readv.S
|
syscall_src += arch-arm/syscalls/readv.S
|
||||||
@@ -108,6 +111,7 @@ syscall_src += arch-arm/syscalls/rmdir.S
|
|||||||
syscall_src += arch-arm/syscalls/rename.S
|
syscall_src += arch-arm/syscalls/rename.S
|
||||||
syscall_src += arch-arm/syscalls/__getcwd.S
|
syscall_src += arch-arm/syscalls/__getcwd.S
|
||||||
syscall_src += arch-arm/syscalls/access.S
|
syscall_src += arch-arm/syscalls/access.S
|
||||||
|
syscall_src += arch-arm/syscalls/faccessat.S
|
||||||
syscall_src += arch-arm/syscalls/symlink.S
|
syscall_src += arch-arm/syscalls/symlink.S
|
||||||
syscall_src += arch-arm/syscalls/fchdir.S
|
syscall_src += arch-arm/syscalls/fchdir.S
|
||||||
syscall_src += arch-arm/syscalls/truncate.S
|
syscall_src += arch-arm/syscalls/truncate.S
|
||||||
@@ -120,6 +124,7 @@ syscall_src += arch-arm/syscalls/llistxattr.S
|
|||||||
syscall_src += arch-arm/syscalls/removexattr.S
|
syscall_src += arch-arm/syscalls/removexattr.S
|
||||||
syscall_src += arch-arm/syscalls/lremovexattr.S
|
syscall_src += arch-arm/syscalls/lremovexattr.S
|
||||||
syscall_src += arch-arm/syscalls/__statfs64.S
|
syscall_src += arch-arm/syscalls/__statfs64.S
|
||||||
|
syscall_src += arch-arm/syscalls/unshare.S
|
||||||
syscall_src += arch-arm/syscalls/pause.S
|
syscall_src += arch-arm/syscalls/pause.S
|
||||||
syscall_src += arch-arm/syscalls/gettimeofday.S
|
syscall_src += arch-arm/syscalls/gettimeofday.S
|
||||||
syscall_src += arch-arm/syscalls/settimeofday.S
|
syscall_src += arch-arm/syscalls/settimeofday.S
|
||||||
@@ -183,6 +188,7 @@ syscall_src += arch-arm/syscalls/delete_module.S
|
|||||||
syscall_src += arch-arm/syscalls/klogctl.S
|
syscall_src += arch-arm/syscalls/klogctl.S
|
||||||
syscall_src += arch-arm/syscalls/sysinfo.S
|
syscall_src += arch-arm/syscalls/sysinfo.S
|
||||||
syscall_src += arch-arm/syscalls/personality.S
|
syscall_src += arch-arm/syscalls/personality.S
|
||||||
|
syscall_src += arch-arm/syscalls/perf_event_open.S
|
||||||
syscall_src += arch-arm/syscalls/futex.S
|
syscall_src += arch-arm/syscalls/futex.S
|
||||||
syscall_src += arch-arm/syscalls/epoll_create.S
|
syscall_src += arch-arm/syscalls/epoll_create.S
|
||||||
syscall_src += arch-arm/syscalls/epoll_ctl.S
|
syscall_src += arch-arm/syscalls/epoll_ctl.S
|
||||||
|
|||||||
14
libc/arch-arm/syscalls/faccessat.S
Normal file
14
libc/arch-arm/syscalls/faccessat.S
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <machine/asm.h>
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
ENTRY(faccessat)
|
||||||
|
.save {r4, r7}
|
||||||
|
stmfd sp!, {r4, r7}
|
||||||
|
ldr r7, =__NR_faccessat
|
||||||
|
swi #0
|
||||||
|
ldmfd sp!, {r4, r7}
|
||||||
|
movs r0, r0
|
||||||
|
bxpl lr
|
||||||
|
b __set_syscall_errno
|
||||||
|
END(faccessat)
|
||||||
14
libc/arch-arm/syscalls/getsid.S
Normal file
14
libc/arch-arm/syscalls/getsid.S
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <machine/asm.h>
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
ENTRY(getsid)
|
||||||
|
.save {r4, r7}
|
||||||
|
stmfd sp!, {r4, r7}
|
||||||
|
ldr r7, =__NR_getsid
|
||||||
|
swi #0
|
||||||
|
ldmfd sp!, {r4, r7}
|
||||||
|
movs r0, r0
|
||||||
|
bxpl lr
|
||||||
|
b __set_syscall_errno
|
||||||
|
END(getsid)
|
||||||
14
libc/arch-arm/syscalls/mlockall.S
Normal file
14
libc/arch-arm/syscalls/mlockall.S
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <machine/asm.h>
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
ENTRY(mlockall)
|
||||||
|
.save {r4, r7}
|
||||||
|
stmfd sp!, {r4, r7}
|
||||||
|
ldr r7, =__NR_mlockall
|
||||||
|
swi #0
|
||||||
|
ldmfd sp!, {r4, r7}
|
||||||
|
movs r0, r0
|
||||||
|
bxpl lr
|
||||||
|
b __set_syscall_errno
|
||||||
|
END(mlockall)
|
||||||
14
libc/arch-arm/syscalls/munlockall.S
Normal file
14
libc/arch-arm/syscalls/munlockall.S
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <machine/asm.h>
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
ENTRY(munlockall)
|
||||||
|
.save {r4, r7}
|
||||||
|
stmfd sp!, {r4, r7}
|
||||||
|
ldr r7, =__NR_munlockall
|
||||||
|
swi #0
|
||||||
|
ldmfd sp!, {r4, r7}
|
||||||
|
movs r0, r0
|
||||||
|
bxpl lr
|
||||||
|
b __set_syscall_errno
|
||||||
|
END(munlockall)
|
||||||
16
libc/arch-arm/syscalls/perf_event_open.S
Normal file
16
libc/arch-arm/syscalls/perf_event_open.S
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <machine/asm.h>
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
ENTRY(perf_event_open)
|
||||||
|
mov ip, sp
|
||||||
|
.save {r4, r5, r6, r7}
|
||||||
|
stmfd sp!, {r4, r5, r6, r7}
|
||||||
|
ldmfd ip, {r4, r5, r6}
|
||||||
|
ldr r7, =__NR_perf_event_open
|
||||||
|
swi #0
|
||||||
|
ldmfd sp!, {r4, r5, r6, r7}
|
||||||
|
movs r0, r0
|
||||||
|
bxpl lr
|
||||||
|
b __set_syscall_errno
|
||||||
|
END(perf_event_open)
|
||||||
14
libc/arch-arm/syscalls/unshare.S
Normal file
14
libc/arch-arm/syscalls/unshare.S
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <machine/asm.h>
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
ENTRY(unshare)
|
||||||
|
.save {r4, r7}
|
||||||
|
stmfd sp!, {r4, r7}
|
||||||
|
ldr r7, =__NR_unshare
|
||||||
|
swi #0
|
||||||
|
ldmfd sp!, {r4, r7}
|
||||||
|
movs r0, r0
|
||||||
|
bxpl lr
|
||||||
|
b __set_syscall_errno
|
||||||
|
END(unshare)
|
||||||
@@ -25,11 +25,15 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include <sys/resource.h>
|
.text
|
||||||
|
|
||||||
int nice(int increment)
|
/* void *__get_sp(void) */
|
||||||
{
|
|
||||||
int priority = getpriority(PRIO_PROCESS, 0);
|
|
||||||
|
|
||||||
return setpriority( PRIO_PROCESS, 0, priority+increment);
|
.type __get_sp, @function
|
||||||
}
|
.global __get_sp
|
||||||
|
.align 4
|
||||||
|
.ent __get_sp
|
||||||
|
__get_sp:
|
||||||
|
move $v0, $sp
|
||||||
|
j $ra
|
||||||
|
.end __get_sp
|
||||||
@@ -25,14 +25,13 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include <signal.h>
|
void* __get_tls(void)
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
char*
|
|
||||||
strsignal(int sig)
|
|
||||||
{
|
{
|
||||||
if ((unsigned)sig < NSIG)
|
register void *tls asm("v1");
|
||||||
return (char*) sys_siglist[sig];
|
asm (".set push\n\t"
|
||||||
else
|
".set mips32r2\n\t"
|
||||||
return "Invalid signal number";
|
"rdhwr %0,$29\n\t"
|
||||||
|
".set pop"
|
||||||
|
: "=r"(tls));
|
||||||
|
return tls;
|
||||||
}
|
}
|
||||||
@@ -25,10 +25,11 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include <unistd.h>
|
#include <pthread.h>
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
int creat(const char* pathname, mode_t mode)
|
extern int __set_thread_area(void *u_info);
|
||||||
|
|
||||||
|
int __set_tls(void *ptr)
|
||||||
{
|
{
|
||||||
return open(pathname, O_WRONLY|O_TRUNC|O_CREAT, mode);
|
return __set_thread_area(ptr);
|
||||||
}
|
}
|
||||||
51
libc/arch-mips/bionic/_exit_with_stack_teardown.S
Normal file
51
libc/arch-mips/bionic/_exit_with_stack_teardown.S
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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/unistd.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
/* void _exit_with_stack_teardown(void * stackBase, int stackSize, int retCode) */
|
||||||
|
|
||||||
|
.type _exit_with_stack_teardown, @function
|
||||||
|
.global _exit_with_stack_teardown
|
||||||
|
.align 4
|
||||||
|
.ent _exit_with_stack_teardown
|
||||||
|
_exit_with_stack_teardown:
|
||||||
|
move $s0,$a2 /* preserve retCode for exit() call */
|
||||||
|
|
||||||
|
li $v0,__NR_munmap
|
||||||
|
syscall /* the stack is destroyed by this call */
|
||||||
|
move $a0,$s0
|
||||||
|
li $v0,__NR_exit
|
||||||
|
syscall
|
||||||
|
|
||||||
|
/* exit() should never return, cause a crash if it does */
|
||||||
|
move $a0,$0
|
||||||
|
lw $a0,($a0)
|
||||||
|
.end _exit_with_stack_teardown
|
||||||
188
libc/arch-mips/bionic/_setjmp.S
Normal file
188
libc/arch-mips/bionic/_setjmp.S
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
/* $OpenBSD: _setjmp.S,v 1.4 2005/08/07 16:40:15 espie Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
|
||||||
|
*
|
||||||
|
* 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 Opsycon AB 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 AUTHOR ``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 AUTHOR 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 <machine/asm.h>
|
||||||
|
#include <machine/regnum.h>
|
||||||
|
#include <machine/signal.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* _setjmp, _longjmp (not restoring signal state)
|
||||||
|
*
|
||||||
|
* XXX FPSET should probably be taken from SR setting. hmmm...
|
||||||
|
* GPOFF and FRAMESIZE must be the same for both _setjmp and _longjmp!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
FRAMESZ= MKFSIZ(0,4)
|
||||||
|
GPOFF= FRAMESZ-2*REGSZ
|
||||||
|
|
||||||
|
#define FPREG64_S(FPR, OFF, BASE) \
|
||||||
|
swc1 FPR, OFF(BASE) ; \
|
||||||
|
mfhc1 t0, FPR ; \
|
||||||
|
sw t0, OFF+4(BASE) ;
|
||||||
|
|
||||||
|
#define FPREG64_L(FPR, OFF, BASE) \
|
||||||
|
lw t0, OFF+4(BASE) ; \
|
||||||
|
lw t1, OFF(BASE) ; \
|
||||||
|
mtc1 t1, FPR ; \
|
||||||
|
mthc1 t0, FPR ; \
|
||||||
|
|
||||||
|
LEAF(_setjmp, FRAMESZ)
|
||||||
|
PTR_SUBU sp, FRAMESZ
|
||||||
|
SETUP_GP64(GPOFF, _setjmp)
|
||||||
|
SAVE_GP(GPOFF)
|
||||||
|
.set noreorder
|
||||||
|
#if defined(__mips64)
|
||||||
|
dli v0, 0xACEDBADE # sigcontext magic number
|
||||||
|
#else
|
||||||
|
li v0, 0xACEDBADE # sigcontext magic number
|
||||||
|
#endif
|
||||||
|
REG_S v0, SC_REGS+ZERO*REGSZ(a0)
|
||||||
|
REG_S s0, SC_REGS+S0*REGSZ(a0)
|
||||||
|
REG_S s1, SC_REGS+S1*REGSZ(a0)
|
||||||
|
REG_S s2, SC_REGS+S2*REGSZ(a0)
|
||||||
|
REG_S s3, SC_REGS+S3*REGSZ(a0)
|
||||||
|
REG_S s4, SC_REGS+S4*REGSZ(a0)
|
||||||
|
REG_S s5, SC_REGS+S5*REGSZ(a0)
|
||||||
|
REG_S s6, SC_REGS+S6*REGSZ(a0)
|
||||||
|
REG_S s7, SC_REGS+S7*REGSZ(a0)
|
||||||
|
REG_S s8, SC_REGS+S8*REGSZ(a0)
|
||||||
|
REG_L v0, GPOFF(sp)
|
||||||
|
REG_S v0, SC_REGS+GP*REGSZ(a0)
|
||||||
|
PTR_ADDU v0, sp, FRAMESZ
|
||||||
|
REG_S v0, SC_REGS+SP*REGSZ(a0)
|
||||||
|
REG_S ra, SC_PC(a0)
|
||||||
|
|
||||||
|
#if !defined(SOFTFLOAT)
|
||||||
|
li v0, 1 # be nice if we could tell
|
||||||
|
REG_S v0, SC_FPUSED(a0) # sc_fpused = 1
|
||||||
|
cfc1 v0, $31
|
||||||
|
#if _MIPS_FPSET == 32
|
||||||
|
FPREG64_S($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
|
||||||
|
#else
|
||||||
|
swc1 $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
|
||||||
|
#endif
|
||||||
|
REG_S v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
|
||||||
|
#endif /* !SOFTFLOAT */
|
||||||
|
RESTORE_GP64
|
||||||
|
PTR_ADDU sp, FRAMESZ
|
||||||
|
j ra
|
||||||
|
move v0, zero
|
||||||
|
END(_setjmp)
|
||||||
|
|
||||||
|
LEAF(_longjmp, FRAMESZ)
|
||||||
|
PTR_SUBU sp, FRAMESZ
|
||||||
|
SETUP_GP64(GPOFF, _longjmp)
|
||||||
|
SAVE_GP(GPOFF)
|
||||||
|
.set noreorder
|
||||||
|
REG_L v0, SC_REGS+ZERO*REGSZ(a0)
|
||||||
|
bne v0, 0xACEDBADE, botch # jump if error
|
||||||
|
REG_L ra, SC_PC(a0)
|
||||||
|
REG_L v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
|
||||||
|
REG_L s0, SC_REGS+S0*REGSZ(a0)
|
||||||
|
REG_L s1, SC_REGS+S1*REGSZ(a0)
|
||||||
|
REG_L s2, SC_REGS+S2*REGSZ(a0)
|
||||||
|
REG_L s3, SC_REGS+S3*REGSZ(a0)
|
||||||
|
REG_L s4, SC_REGS+S4*REGSZ(a0)
|
||||||
|
REG_L s5, SC_REGS+S5*REGSZ(a0)
|
||||||
|
REG_L s6, SC_REGS+S6*REGSZ(a0)
|
||||||
|
REG_L s7, SC_REGS+S7*REGSZ(a0)
|
||||||
|
REG_L s8, SC_REGS+S8*REGSZ(a0)
|
||||||
|
REG_L gp, SC_REGS+GP*REGSZ(a0)
|
||||||
|
REG_L sp, SC_REGS+SP*REGSZ(a0)
|
||||||
|
#if !defined(SOFTFLOAT)
|
||||||
|
ctc1 v0, $31
|
||||||
|
#if _MIPS_FPSET == 32
|
||||||
|
FPREG64_L($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
|
||||||
|
#else
|
||||||
|
lwc1 $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
|
||||||
|
#endif
|
||||||
|
#endif /* !SOFTFLOAT */
|
||||||
|
bne a1, zero, 1f
|
||||||
|
nop
|
||||||
|
li a1, 1 # never return 0!
|
||||||
|
1:
|
||||||
|
j ra
|
||||||
|
move v0, a1
|
||||||
|
|
||||||
|
botch:
|
||||||
|
jal longjmperror
|
||||||
|
nop
|
||||||
|
jal abort
|
||||||
|
nop
|
||||||
|
RESTORE_GP64
|
||||||
|
PTR_ADDU sp, FRAMESZ
|
||||||
|
END(_longjmp)
|
||||||
|
|
||||||
43
libc/arch-mips/bionic/atexit.S
Normal file
43
libc/arch-mips/bionic/atexit.S
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*/
|
||||||
|
.text
|
||||||
|
.globl atexit
|
||||||
|
.hidden atexit
|
||||||
|
.type atexit, @function
|
||||||
|
.align 4
|
||||||
|
.ent atexit
|
||||||
|
atexit:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
.set reorder
|
||||||
|
la $t9, __cxa_atexit
|
||||||
|
move $a1, $0
|
||||||
|
la $a2, __dso_handle
|
||||||
|
j $t9
|
||||||
|
.size atexit, .-atexit
|
||||||
|
.end atexit
|
||||||
45
libc/arch-mips/bionic/bzero.S
Normal file
45
libc/arch-mips/bionic/bzero.S
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*/
|
||||||
|
.text
|
||||||
|
|
||||||
|
/*
|
||||||
|
* void bzero(void *s, size_t n);
|
||||||
|
*/
|
||||||
|
.type bzero, @function
|
||||||
|
.global bzero
|
||||||
|
.align 4
|
||||||
|
.ent bzero
|
||||||
|
.set noreorder
|
||||||
|
bzero:
|
||||||
|
.cpload $t9
|
||||||
|
move $a2,$a1
|
||||||
|
la $t9,memset
|
||||||
|
j $t9
|
||||||
|
move $a1,$zero
|
||||||
|
.end bzero
|
||||||
|
|
||||||
101
libc/arch-mips/bionic/cacheflush.c
Normal file
101
libc/arch-mips/bionic/cacheflush.c
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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/cachectl.h>
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#include <logd.h>
|
||||||
|
#define XLOG(...) \
|
||||||
|
__libc_android_log_print(ANDROID_LOG_DEBUG,"libc-cacheflush",__VA_ARGS__)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Linux historically defines a cacheflush(3) routine for MIPS
|
||||||
|
* with this signature:
|
||||||
|
* int cacheflush(char *addr, int nbytes, int cache);
|
||||||
|
*
|
||||||
|
* Android defines an alternate cacheflush routine which exposes the
|
||||||
|
* ARM system call interface:
|
||||||
|
* int cacheflush (long start, long end, long flags)
|
||||||
|
*
|
||||||
|
* This is an attempt to maintain compatibility between the historical MIPS
|
||||||
|
* usage for software previously ported to MIPS and Android specific
|
||||||
|
* uses of cacheflush()
|
||||||
|
*
|
||||||
|
* Use the gcc __clear_cache builtin if possible. This will generate inline synci
|
||||||
|
* instructions if available or call _flush_cache(start, len, BCACHE) directly
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (__GNUC__)
|
||||||
|
#define GCC_VERSION ((__GNUC__*10000) + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This is the Android signature */
|
||||||
|
int cacheflush (long start, long end, long flags)
|
||||||
|
{
|
||||||
|
if (end < start) {
|
||||||
|
/*
|
||||||
|
* It looks like this is really MIPS style cacheflush call
|
||||||
|
* start => addr
|
||||||
|
* end => nbytes
|
||||||
|
*/
|
||||||
|
#ifdef DEBUG
|
||||||
|
static int warned = 0;
|
||||||
|
if (!warned) {
|
||||||
|
XLOG("called with (start,len) instead of (start,end)");
|
||||||
|
warned = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
end += start;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(ARCH_MIPS_USE_FLUSHCACHE_SYSCALL) && \
|
||||||
|
defined(GCC_VERSION) && (GCC_VERSION >= 40300)
|
||||||
|
|
||||||
|
#if (__mips_isa_rev >= 2) && (GCC_VERSION < 40403)
|
||||||
|
/*
|
||||||
|
* Modify "start" and "end" to avoid GCC 4.3.0-4.4.2 bug in
|
||||||
|
* mips_expand_synci_loop that may execute synci one more time.
|
||||||
|
* "start" points to the first byte of the cache line.
|
||||||
|
* "end" points to the last byte of the line before the last cache line.
|
||||||
|
* Because size is always a multiple of 4, this is safe to set
|
||||||
|
* "end" to the last byte.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
int lineSize;
|
||||||
|
asm("rdhwr %0, $1" : "=r" (lineSize));
|
||||||
|
start = start & (-lineSize);
|
||||||
|
end = (end & (-lineSize)) - 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
__builtin___clear_cache((char *)start, (char *)end);
|
||||||
|
#else
|
||||||
|
_flush_cache((char *)start, end-start, BCACHE);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
145
libc/arch-mips/bionic/clone.S
Normal file
145
libc/arch-mips/bionic/clone.S
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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 <linux/sched.h>
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
#include <linux/errno.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
.type __pthread_clone, @function
|
||||||
|
.global __pthread_clone
|
||||||
|
.align 4
|
||||||
|
.ent __pthread_clone
|
||||||
|
|
||||||
|
/*
|
||||||
|
* int __pthread_clone(int (*fn)(void*), void *child_stack,
|
||||||
|
* int flags, void *arg);
|
||||||
|
*/
|
||||||
|
|
||||||
|
__pthread_clone:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
.set reorder
|
||||||
|
|
||||||
|
# set up child stack
|
||||||
|
subu $a1,16
|
||||||
|
sw $a0,0($a1) # fn
|
||||||
|
sw $a3,4($a1) # arg
|
||||||
|
# sw $a1+16,8($a1) # tls
|
||||||
|
|
||||||
|
/*
|
||||||
|
* int sys_clone(int flags, void *child_stack, int *parent_tidptr,
|
||||||
|
* struct user_desc *newtls, int *child_tidptr);
|
||||||
|
*/
|
||||||
|
|
||||||
|
move $a0,$a2 # flags
|
||||||
|
# move $a1,$a1 # child_stack
|
||||||
|
move $a2,$0 # parent_tidptr
|
||||||
|
move $a3,$0 # user_desc
|
||||||
|
and $a0,~(CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)
|
||||||
|
# make sure the kernel doesn't access child_tidptr
|
||||||
|
|
||||||
|
li $v0,__NR_clone
|
||||||
|
syscall
|
||||||
|
|
||||||
|
bnez $a3,.L__error
|
||||||
|
|
||||||
|
beqz $v0,.L__thread_start
|
||||||
|
|
||||||
|
j $ra
|
||||||
|
|
||||||
|
.L__thread_start:
|
||||||
|
lw $a0,0($sp) # fn
|
||||||
|
lw $a1,4($sp) # arg
|
||||||
|
addu $a2,$sp,16 # tls
|
||||||
|
|
||||||
|
# void __thread_entry(int (*func)(void*), void *arg, void *tls)
|
||||||
|
la $t9, __thread_entry
|
||||||
|
j $t9
|
||||||
|
|
||||||
|
.L__error:
|
||||||
|
move $a0,$v0
|
||||||
|
la $t9,__set_errno
|
||||||
|
j $t9
|
||||||
|
|
||||||
|
.end __pthread_clone
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# This function is defined as:
|
||||||
|
#
|
||||||
|
# pid_t __bionic_clone( int flags, void *child_stack,
|
||||||
|
# pid_t *pid, void *tls, pid_t *ctid,
|
||||||
|
# int (*fn)(void *), void* arg );
|
||||||
|
#
|
||||||
|
# NOTE: This is not the same signature than the GLibc
|
||||||
|
# __clone function here !! Placing 'fn' and 'arg'
|
||||||
|
# at the end of the parameter list makes the
|
||||||
|
# implementation much simpler.
|
||||||
|
#
|
||||||
|
.text
|
||||||
|
.type __bionic_clone, @function
|
||||||
|
.global __bionic_clone
|
||||||
|
.align 4
|
||||||
|
.ent __bionic_clone
|
||||||
|
__bionic_clone:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
.set reorder
|
||||||
|
|
||||||
|
# set up child stack
|
||||||
|
subu $a1,16
|
||||||
|
lw $t0,20($sp) # fn
|
||||||
|
lw $t1,24($sp) # arg
|
||||||
|
sw $t0,0($a1) # fn
|
||||||
|
sw $t1,4($a1) # arg
|
||||||
|
|
||||||
|
# remainder of arguments are correct for clone system call
|
||||||
|
li $v0,__NR_clone
|
||||||
|
syscall
|
||||||
|
|
||||||
|
bnez $a3,.L__error_bc
|
||||||
|
|
||||||
|
beqz $v0,.L__thread_start_bc
|
||||||
|
|
||||||
|
j $ra
|
||||||
|
|
||||||
|
.L__thread_start_bc:
|
||||||
|
lw $a0,0($sp) # fn
|
||||||
|
lw $a1,4($sp) # arg
|
||||||
|
|
||||||
|
# void __bionic_clone_entry(int (*func)(void*), void *arg)
|
||||||
|
la $t9,__bionic_clone_entry
|
||||||
|
j $t9
|
||||||
|
|
||||||
|
.L__error_bc:
|
||||||
|
move $a0,$v0
|
||||||
|
la $t9,__set_errno
|
||||||
|
j $t9
|
||||||
|
|
||||||
|
.end __bionic_clone
|
||||||
|
|
||||||
@@ -27,7 +27,8 @@
|
|||||||
*/
|
*/
|
||||||
.text
|
.text
|
||||||
.align 4
|
.align 4
|
||||||
.type _start,#function
|
.type __start,@function
|
||||||
|
.globl __start
|
||||||
.globl _start
|
.globl _start
|
||||||
|
|
||||||
# this is the small startup code that is first run when
|
# this is the small startup code that is first run when
|
||||||
@@ -47,39 +48,99 @@
|
|||||||
#
|
#
|
||||||
# - address of the constructor list
|
# - address of the constructor list
|
||||||
#
|
#
|
||||||
_start:
|
|
||||||
mov r0, sp
|
|
||||||
mov r1, #0
|
|
||||||
ldr r2, =main
|
|
||||||
adr r3, 1f
|
|
||||||
ldr r4, =__libc_init
|
|
||||||
bx r4
|
|
||||||
|
|
||||||
1: .long __PREINIT_ARRAY__
|
.ent __start
|
||||||
.long __INIT_ARRAY__
|
__start:
|
||||||
.long __FINI_ARRAY__
|
_start:
|
||||||
.long __CTOR_LIST__
|
bal 1f
|
||||||
|
1:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $ra
|
||||||
|
.set reorder
|
||||||
|
|
||||||
|
move $a0, $sp
|
||||||
|
move $a1, $0
|
||||||
|
la $a2, main
|
||||||
|
la $a3, 1f
|
||||||
|
subu $sp, 32
|
||||||
|
la $t9, __libc_init
|
||||||
|
j $t9
|
||||||
|
.end __start
|
||||||
|
|
||||||
|
1: .long __PREINIT_ARRAY__
|
||||||
|
.long __INIT_ARRAY__
|
||||||
|
.long __FINI_ARRAY__
|
||||||
|
|
||||||
.section .preinit_array, "aw"
|
.section .preinit_array, "aw"
|
||||||
|
.type __PREINIT_ARRAY__, @object
|
||||||
.globl __PREINIT_ARRAY__
|
.globl __PREINIT_ARRAY__
|
||||||
__PREINIT_ARRAY__:
|
__PREINIT_ARRAY__:
|
||||||
.long -1
|
.long -1
|
||||||
|
|
||||||
.section .init_array, "aw"
|
.section .init_array, "aw"
|
||||||
|
.type __INIT_ARRAY__, @object
|
||||||
.globl __INIT_ARRAY__
|
.globl __INIT_ARRAY__
|
||||||
__INIT_ARRAY__:
|
__INIT_ARRAY__:
|
||||||
.long -1
|
.long -1
|
||||||
|
|
||||||
.section .fini_array, "aw"
|
.section .fini_array, "aw"
|
||||||
|
.type __FINI_ARRAY__, @object
|
||||||
.globl __FINI_ARRAY__
|
.globl __FINI_ARRAY__
|
||||||
__FINI_ARRAY__:
|
__FINI_ARRAY__:
|
||||||
.long -1
|
.long -1
|
||||||
|
.long __do_global_dtors_aux
|
||||||
|
|
||||||
.section .ctors, "aw"
|
.abicalls
|
||||||
.globl __CTOR_LIST__
|
.text
|
||||||
__CTOR_LIST__:
|
.align 2
|
||||||
.long -1
|
.set nomips16
|
||||||
|
.ent __do_global_dtors_aux
|
||||||
|
.type __do_global_dtors_aux, @function
|
||||||
|
__do_global_dtors_aux:
|
||||||
|
.frame $sp,32,$31 # vars= 0, regs= 1/0, args= 16, gp= 8
|
||||||
|
.mask 0x80000000,-4
|
||||||
|
.fmask 0x00000000,0
|
||||||
|
.set noreorder
|
||||||
|
.cpload $25
|
||||||
|
.set nomacro
|
||||||
|
addiu $sp,$sp,-32
|
||||||
|
sw $31,28($sp)
|
||||||
|
.cprestore 16
|
||||||
|
lw $2,%got(completed.1269)($28)
|
||||||
|
lbu $2,%lo(completed.1269)($2)
|
||||||
|
bne $2,$0,$L8
|
||||||
|
nop
|
||||||
|
|
||||||
|
$L4:
|
||||||
|
lw $2,%got(__cxa_finalize)($28)
|
||||||
|
beq $2,$0,$L6
|
||||||
|
nop
|
||||||
|
|
||||||
|
lw $2,%got(__dso_handle)($28)
|
||||||
|
lw $4,0($2)
|
||||||
|
lw $25,%call16(__cxa_finalize)($28)
|
||||||
|
.reloc 1f,R_MIPS_JALR,__cxa_finalize
|
||||||
|
1: jalr $25
|
||||||
|
nop
|
||||||
|
|
||||||
|
lw $28,16($sp)
|
||||||
|
$L6:
|
||||||
|
lw $2,%got(completed.1269)($28)
|
||||||
|
li $3,1 # 0x1
|
||||||
|
sb $3,%lo(completed.1269)($2)
|
||||||
|
$L8:
|
||||||
|
lw $31,28($sp)
|
||||||
|
addiu $sp,$sp,32
|
||||||
|
j $31
|
||||||
|
nop
|
||||||
|
|
||||||
|
.set macro
|
||||||
|
.set reorder
|
||||||
|
.end __do_global_dtors_aux
|
||||||
|
.size __do_global_dtors_aux, .-__do_global_dtors_aux
|
||||||
|
.local completed.1269
|
||||||
|
.comm completed.1269,1,1
|
||||||
|
.weak __cxa_finalize
|
||||||
|
|
||||||
#include "__dso_handle.S"
|
#include "__dso_handle.S"
|
||||||
#include "atexit.S"
|
#include "atexit.S"
|
||||||
@@ -25,60 +25,70 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
.text
|
|
||||||
.align 4
|
|
||||||
.type _start,#function
|
|
||||||
.globl _start
|
|
||||||
|
|
||||||
# this is the small startup code that is first run when
|
|
||||||
# any executable that is dynamically-linked with Bionic
|
|
||||||
# runs.
|
|
||||||
#
|
|
||||||
# it's purpose is to call __libc_init with appropriate
|
|
||||||
# arguments, which are:
|
|
||||||
#
|
|
||||||
# - the address of the raw data block setup by the Linux
|
|
||||||
# kernel ELF loader
|
|
||||||
#
|
|
||||||
# - address of an "onexit" function, not used on any
|
|
||||||
# platform supported by Bionic
|
|
||||||
#
|
|
||||||
# - address of the "main" function of the program.
|
|
||||||
#
|
|
||||||
# - address of the constructor list
|
|
||||||
#
|
|
||||||
_start:
|
|
||||||
mov r0, sp
|
|
||||||
mov r1, #0
|
|
||||||
ldr r2, =main
|
|
||||||
adr r3, 1f
|
|
||||||
ldr r4, =__libc_init
|
|
||||||
bx r4
|
|
||||||
|
|
||||||
1: .long __PREINIT_ARRAY__
|
|
||||||
.long __INIT_ARRAY__
|
|
||||||
.long __FINI_ARRAY__
|
|
||||||
.long __CTOR_LIST__
|
|
||||||
|
|
||||||
.section .preinit_array, "aw"
|
|
||||||
.globl __PREINIT_ARRAY__
|
|
||||||
__PREINIT_ARRAY__:
|
|
||||||
.long -1
|
|
||||||
|
|
||||||
.section .init_array, "aw"
|
.section .init_array, "aw"
|
||||||
|
.type __INIT_ARRAY__, @object
|
||||||
.globl __INIT_ARRAY__
|
.globl __INIT_ARRAY__
|
||||||
__INIT_ARRAY__:
|
__INIT_ARRAY__:
|
||||||
.long -1
|
.long -1
|
||||||
|
|
||||||
.section .fini_array, "aw"
|
.section .fini_array, "aw"
|
||||||
|
.type __FINI_ARRAY__, @object
|
||||||
.globl __FINI_ARRAY__
|
.globl __FINI_ARRAY__
|
||||||
__FINI_ARRAY__:
|
__FINI_ARRAY__:
|
||||||
.long -1
|
.long -1
|
||||||
|
.long __do_global_dtors_aux
|
||||||
|
|
||||||
.section .ctors, "aw"
|
.abicalls
|
||||||
.globl __CTOR_LIST__
|
.text
|
||||||
__CTOR_LIST__:
|
.align 2
|
||||||
.long -1
|
.set nomips16
|
||||||
|
.ent __do_global_dtors_aux
|
||||||
|
.type __do_global_dtors_aux, @function
|
||||||
|
__do_global_dtors_aux:
|
||||||
|
.frame $sp,32,$31 # vars= 0, regs= 1/0, args= 16, gp= 8
|
||||||
|
.mask 0x80000000,-4
|
||||||
|
.fmask 0x00000000,0
|
||||||
|
.set noreorder
|
||||||
|
.cpload $25
|
||||||
|
.set nomacro
|
||||||
|
addiu $sp,$sp,-32
|
||||||
|
sw $31,28($sp)
|
||||||
|
.cprestore 16
|
||||||
|
lw $2,%got(completed.1269)($28)
|
||||||
|
lbu $2,%lo(completed.1269)($2)
|
||||||
|
bne $2,$0,$L8
|
||||||
|
nop
|
||||||
|
|
||||||
#include "__dso_handle.S"
|
$L4:
|
||||||
|
lw $2,%got(__cxa_finalize)($28)
|
||||||
|
beq $2,$0,$L6
|
||||||
|
nop
|
||||||
|
|
||||||
|
lw $2,%got(__dso_handle)($28)
|
||||||
|
lw $4,0($2)
|
||||||
|
lw $25,%call16(__cxa_finalize)($28)
|
||||||
|
.reloc 1f,R_MIPS_JALR,__cxa_finalize
|
||||||
|
1: jalr $25
|
||||||
|
nop
|
||||||
|
|
||||||
|
lw $28,16($sp)
|
||||||
|
$L6:
|
||||||
|
lw $2,%got(completed.1269)($28)
|
||||||
|
li $3,1 # 0x1
|
||||||
|
sb $3,%lo(completed.1269)($2)
|
||||||
|
$L8:
|
||||||
|
lw $31,28($sp)
|
||||||
|
addiu $sp,$sp,32
|
||||||
|
j $31
|
||||||
|
nop
|
||||||
|
|
||||||
|
.set macro
|
||||||
|
.set reorder
|
||||||
|
.end __do_global_dtors_aux
|
||||||
|
.size __do_global_dtors_aux, .-__do_global_dtors_aux
|
||||||
|
.local completed.1269
|
||||||
|
.comm completed.1269,1,1
|
||||||
|
.weak __cxa_finalize
|
||||||
|
|
||||||
|
#include "__dso_handle_so.S"
|
||||||
#include "atexit.S"
|
#include "atexit.S"
|
||||||
@@ -25,10 +25,13 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
.global __get_pc
|
|
||||||
.type __get_pc, %function
|
.section .preinit_array, "aw"
|
||||||
|
.long 0
|
||||||
|
|
||||||
__get_pc:
|
.section .init_array, "aw"
|
||||||
mov r0, pc
|
.long 0
|
||||||
bx lr
|
|
||||||
|
.section .fini_array, "aw"
|
||||||
|
.long 0
|
||||||
|
|
||||||
5
libc/arch-mips/bionic/crtend_so.S
Normal file
5
libc/arch-mips/bionic/crtend_so.S
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
.section .init_array, "aw"
|
||||||
|
.long 0
|
||||||
|
|
||||||
|
.section .fini_array, "aw"
|
||||||
|
.long 0
|
||||||
92
libc/arch-mips/bionic/ffs.S
Normal file
92
libc/arch-mips/bionic/ffs.S
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/* $NetBSD: ffs.S,v 1.5 2003/04/05 23:08:52 bjh21 Exp $ */
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001 Christopher Gilbert
|
||||||
|
* 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. The name of the company nor the name of the author may be used to
|
||||||
|
* endorse or promote products derived from this software without specific
|
||||||
|
* prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ffs - find first set bit, this algorithm isolates the first set
|
||||||
|
* bit, then multiplies the number by 0x0450fbaf which leaves the top
|
||||||
|
* 6 bits as an index into the table. This algorithm should be a win
|
||||||
|
* over the checking each bit in turn as per the C compiled version.
|
||||||
|
*
|
||||||
|
* This is the ffs algorithm devised by d.seal and posted to comp.sys.arm on
|
||||||
|
* 16 Feb 1994.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
.ent ffs
|
||||||
|
.type ffs, @function
|
||||||
|
.global ffs
|
||||||
|
.align 4
|
||||||
|
.set noreorder
|
||||||
|
ffs:
|
||||||
|
#if (__mips==32)
|
||||||
|
subu $t0,$0,$a0
|
||||||
|
and $a0,$t0
|
||||||
|
clz $t0,$a0
|
||||||
|
li $v0,32
|
||||||
|
j $ra
|
||||||
|
subu $v0,$t0
|
||||||
|
#else
|
||||||
|
/* Size of the ffs routine in bytes
|
||||||
|
* This is used to index .L_ffs_table from $t9
|
||||||
|
* FIXME: there must be a better way to do this
|
||||||
|
*/
|
||||||
|
#define FFSSIZE 12*4
|
||||||
|
subu $t0,$0,$a0
|
||||||
|
and $a0,$t0
|
||||||
|
/*
|
||||||
|
* now a0 has at most one set bit, call this X
|
||||||
|
* if X = 0, all further instructions are skipped
|
||||||
|
*/
|
||||||
|
sll $t0,$a0,4 /* t0 = X * 0x00000010 */
|
||||||
|
or $a0,$t0 /* a0 = X * 0x00000011 */
|
||||||
|
sll $t0,$a0,6 /* t0 = X * 0x00000440 */
|
||||||
|
or $a0,$t0 /* a0 = X * 0x00000451 */
|
||||||
|
sll $t0,$a0,16 /* t0 = X * 0x04510000 */
|
||||||
|
subu $a0,$t0,$a0 /* a0 = X * 0x0450fbaf */
|
||||||
|
|
||||||
|
/* now lookup in table indexed on top 6 bits of a0 */
|
||||||
|
srl $a0,25
|
||||||
|
addu $t9,$a0
|
||||||
|
j $ra
|
||||||
|
lbu $v0,FFSSIZE($t9)
|
||||||
|
.L_ffs_table:
|
||||||
|
/* 0 1 2 3 4 5 6 7 */
|
||||||
|
.byte 0, 1, 2, 13, 3, 7, 0, 14 /* 0- 7 */
|
||||||
|
.byte 4, 0, 8, 0, 0, 0, 0, 15 /* 8-15 */
|
||||||
|
.byte 11, 5, 0, 0, 9, 0, 0, 26 /* 16-23 */
|
||||||
|
.byte 0, 0, 0, 0, 0, 22, 28, 16 /* 24-31 */
|
||||||
|
.byte 32, 12, 6, 0, 0, 0, 0, 0 /* 32-39 */
|
||||||
|
.byte 10, 0, 0, 25, 0, 0, 21, 27 /* 40-47 */
|
||||||
|
.byte 31, 0, 0, 0, 0, 24, 0, 20 /* 48-55 */
|
||||||
|
.byte 30, 0, 23, 19, 29, 18, 17, 0 /* 56-63 */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
.end ffs
|
||||||
142
libc/arch-mips/bionic/futex_mips.S
Normal file
142
libc/arch-mips/bionic/futex_mips.S
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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/unistd.h>
|
||||||
|
|
||||||
|
#define FUTEX_WAIT 0
|
||||||
|
#define FUTEX_WAKE 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* __futex_wait(*ftx, val, *timespec)
|
||||||
|
* futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
|
||||||
|
*/
|
||||||
|
.type __futex_wait, @function
|
||||||
|
.global __futex_wait
|
||||||
|
.align 4
|
||||||
|
.ent __futex_wait
|
||||||
|
__futex_wait:
|
||||||
|
subu $sp,4*6
|
||||||
|
sw $0,20($sp) /* val3 */
|
||||||
|
sw $0,16($sp) /* addr2 */
|
||||||
|
move $a3,$a2 /* timespec */
|
||||||
|
move $a2,$a1 /* val */
|
||||||
|
li $a1,FUTEX_WAIT /* op */
|
||||||
|
# move $a0,$a0 /* ftx */
|
||||||
|
li $v0,__NR_futex
|
||||||
|
syscall
|
||||||
|
.set noreorder
|
||||||
|
bnez $a3, 1f /* Check for error */
|
||||||
|
neg $v0 /* Negate error number if it's valid */
|
||||||
|
move $v0,$0 /* Otherwise return 0 */
|
||||||
|
1:
|
||||||
|
.set reorder
|
||||||
|
addu $sp,4*6
|
||||||
|
j $ra
|
||||||
|
.end __futex_wait
|
||||||
|
|
||||||
|
/*
|
||||||
|
* int __futex_wake(volatile void *ftx, int count)
|
||||||
|
* int futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
|
||||||
|
*/
|
||||||
|
.type __futex_wake, @function
|
||||||
|
.globl __futex_wake
|
||||||
|
.align 4
|
||||||
|
.ent __futex_wake
|
||||||
|
__futex_wake:
|
||||||
|
subu $sp,4*6
|
||||||
|
sw $0,20($sp) /* val3 */
|
||||||
|
sw $0,16($sp) /* addr2 */
|
||||||
|
move $a3,$0 /* timespec */
|
||||||
|
move $a2,$a1 /* val */
|
||||||
|
li $a1,FUTEX_WAKE /* op */
|
||||||
|
# move $a0,$a0 /* ftx */
|
||||||
|
li $v0,__NR_futex
|
||||||
|
syscall
|
||||||
|
.set noreorder
|
||||||
|
bnez $a3, 1f /* Check for error */
|
||||||
|
neg $v0 /* Negate error number if it's valid */
|
||||||
|
move $v0,$0 /* Otherwise return 0 */
|
||||||
|
1:
|
||||||
|
.set reorder
|
||||||
|
addu $sp,4*6
|
||||||
|
j $ra
|
||||||
|
.end __futex_wake
|
||||||
|
|
||||||
|
/* __futex_syscall3(*ftx, op, val)
|
||||||
|
* futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
|
||||||
|
*/
|
||||||
|
.type __futex_syscall3, @function
|
||||||
|
.global __futex_syscall3
|
||||||
|
.align 4
|
||||||
|
.ent __futex_syscall3
|
||||||
|
__futex_syscall3:
|
||||||
|
subu $sp,4*6
|
||||||
|
sw $0,20($sp) /* val3 */
|
||||||
|
sw $0,16($sp) /* addr2 */
|
||||||
|
move $a3,$0 /* timespec */
|
||||||
|
# move $a2,$a2 /* val */
|
||||||
|
# li $a1,$a1 /* op */
|
||||||
|
# move $a0,$a0 /* ftx */
|
||||||
|
li $v0,__NR_futex
|
||||||
|
syscall
|
||||||
|
.set noreorder
|
||||||
|
bnez $a3, 1f /* Check for error */
|
||||||
|
neg $v0 /* Negate error number if it's valid */
|
||||||
|
move $v0,$0 /* Otherwise return 0 */
|
||||||
|
1:
|
||||||
|
.set reorder
|
||||||
|
addu $sp,4*6
|
||||||
|
j $ra
|
||||||
|
.end __futex_syscall3
|
||||||
|
|
||||||
|
/* __futex_syscall4(*ftx, op, val)
|
||||||
|
* futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
|
||||||
|
*/
|
||||||
|
.type __futex_syscall4, @function
|
||||||
|
.global __futex_syscall4
|
||||||
|
.align 4
|
||||||
|
.ent __futex_syscall4
|
||||||
|
__futex_syscall4:
|
||||||
|
subu $sp,4*6
|
||||||
|
sw $0,20($sp) /* val3 */
|
||||||
|
sw $0,16($sp) /* addr2 */
|
||||||
|
# move $a3,$a3 /* timespec */
|
||||||
|
# move $a2,$a2 /* val */
|
||||||
|
# li $a1,$a1 /* op */
|
||||||
|
# move $a0,$a0 /* ftx */
|
||||||
|
li $v0,__NR_futex
|
||||||
|
syscall
|
||||||
|
.set noreorder
|
||||||
|
bnez $a3, 1f /* Check for error */
|
||||||
|
neg $v0 /* Negate error number if it's valid */
|
||||||
|
move $v0,$0 /* Otherwise return 0 */
|
||||||
|
1:
|
||||||
|
.set reorder
|
||||||
|
addu $sp,4*6
|
||||||
|
j $ra
|
||||||
|
.end __futex_syscall4
|
||||||
55
libc/arch-mips/bionic/memcmp16.S
Normal file
55
libc/arch-mips/bionic/memcmp16.S
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*/
|
||||||
|
.text
|
||||||
|
|
||||||
|
/*
|
||||||
|
* u4 __memcmp16(const u2* s0, const u2* s1, size_t count);
|
||||||
|
*/
|
||||||
|
.type __memcmp16, @function
|
||||||
|
.global __memcmp16
|
||||||
|
.align 4
|
||||||
|
.ent __memcmp16
|
||||||
|
__memcmp16:
|
||||||
|
li $t0,0
|
||||||
|
li $t1,0
|
||||||
|
beqz $a2,done /* 0 length string */
|
||||||
|
beq $a0,$a1,done /* strings are identical */
|
||||||
|
|
||||||
|
/* Unoptimised... */
|
||||||
|
1: lhu $t0,0($a0)
|
||||||
|
lhu $t1,0($a1)
|
||||||
|
addu $a1,2
|
||||||
|
bne $t0,$t1,done
|
||||||
|
addu $a0,2
|
||||||
|
subu $a2,1
|
||||||
|
bnez $a2,1b
|
||||||
|
|
||||||
|
done:
|
||||||
|
subu $v0,$t0,$t1
|
||||||
|
j $ra
|
||||||
|
.end __memcmp16
|
||||||
44
libc/arch-mips/bionic/memmove.c
Normal file
44
libc/arch-mips/bionic/memmove.c
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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 <string.h>
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
|
void *memmove(void *dst, const void *src, size_t n)
|
||||||
|
{
|
||||||
|
const char *p = src;
|
||||||
|
char *q = dst;
|
||||||
|
/* We can use the optimized memcpy if the destination is completely below the
|
||||||
|
* source (i.e. q + n <= p), or if it is completely over it (i.e. q >= p+n).
|
||||||
|
*/
|
||||||
|
if (__builtin_expect((q + n < p) || (q >= p + n), 1)) {
|
||||||
|
return memcpy(dst, src, n);
|
||||||
|
} else {
|
||||||
|
bcopy(src, dst, n);
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
}
|
||||||
60
libc/arch-mips/bionic/pipe.S
Normal file
60
libc/arch-mips/bionic/pipe.S
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The MIPS pipe syscall returns results in two registers, which
|
||||||
|
* we have to copy into the supplied array. This prevents us from
|
||||||
|
* using an auto-generated stub.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <asm/unistd.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
/* int pipe(int[]) */
|
||||||
|
|
||||||
|
.type pipe,@function
|
||||||
|
.global pipe
|
||||||
|
.align 4
|
||||||
|
.ent pipe
|
||||||
|
pipe:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
li $v0,__NR_pipe
|
||||||
|
syscall /* syscall returns results in v0,v1 */
|
||||||
|
bnez $a3, 1f /* check errno */
|
||||||
|
nop
|
||||||
|
sw $v0, 0($a0)
|
||||||
|
sw $v1, 4($a0)
|
||||||
|
j $ra
|
||||||
|
move $v0, $zero
|
||||||
|
1:
|
||||||
|
la $t9, __set_errno
|
||||||
|
j $t9
|
||||||
|
move $a0, $v0 /* delay slot, prepare args for __set_errno */
|
||||||
|
.end pipe
|
||||||
211
libc/arch-mips/bionic/setjmp.S
Normal file
211
libc/arch-mips/bionic/setjmp.S
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
/* $OpenBSD: setjmp.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
|
||||||
|
*
|
||||||
|
* 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 Opsycon AB 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 AUTHOR ``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 AUTHOR 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 <machine/asm.h>
|
||||||
|
#include <machine/regnum.h>
|
||||||
|
#include <machine/signal.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* setjmp, longjmp implementation for libc. this code depends
|
||||||
|
* on the layout of the struct sigcontext in machine/signal.h.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
FRAMESZ= MKFSIZ(2,6)
|
||||||
|
A1OFF= FRAMESZ-4*REGSZ
|
||||||
|
A0OFF= FRAMESZ-3*REGSZ
|
||||||
|
GPOFF= FRAMESZ-2*REGSZ
|
||||||
|
RAOFF= FRAMESZ-1*REGSZ
|
||||||
|
|
||||||
|
#define FPREG64_S(FPR, OFF, BASE) \
|
||||||
|
swc1 FPR, OFF(BASE) ; \
|
||||||
|
mfhc1 t0, FPR ; \
|
||||||
|
sw t0, OFF+4(BASE) ;
|
||||||
|
|
||||||
|
#define FPREG64_L(FPR, OFF, BASE) \
|
||||||
|
lw t0, OFF+4(BASE) ; \
|
||||||
|
lw t1, OFF(BASE) ; \
|
||||||
|
mtc1 t1, FPR ; \
|
||||||
|
mthc1 t0, FPR ; \
|
||||||
|
|
||||||
|
NON_LEAF(setjmp, FRAMESZ, ra)
|
||||||
|
.mask 0x80000000, RAOFF
|
||||||
|
PTR_SUBU sp, FRAMESZ # allocate stack frame
|
||||||
|
SETUP_GP64(GPOFF, setjmp)
|
||||||
|
SAVE_GP(GPOFF)
|
||||||
|
.set reorder
|
||||||
|
REG_S ra, RAOFF(sp) # save state
|
||||||
|
REG_S a0, A0OFF(sp)
|
||||||
|
|
||||||
|
move a0, zero # get current signal mask
|
||||||
|
jal sigblock
|
||||||
|
|
||||||
|
REG_L v1, A0OFF(sp) # v1 = jmpbuf
|
||||||
|
REG_S v0, SC_MASK(v1) # save sc_mask = sigblock(0)
|
||||||
|
|
||||||
|
REG_L a0, A0OFF(sp) # restore jmpbuf
|
||||||
|
REG_L ra, RAOFF(sp)
|
||||||
|
REG_S ra, SC_PC(a0) # sc_pc = return address
|
||||||
|
#if defined(__mips64)
|
||||||
|
dli v0, 0xACEDBADE # sigcontext magic number
|
||||||
|
#else
|
||||||
|
li v0, 0xACEDBADE # sigcontext magic number
|
||||||
|
#endif
|
||||||
|
REG_S v0, SC_REGS+ZERO*REGSZ(a0)
|
||||||
|
REG_S s0, SC_REGS+S0*REGSZ(a0)
|
||||||
|
REG_S s1, SC_REGS+S1*REGSZ(a0)
|
||||||
|
REG_S s2, SC_REGS+S2*REGSZ(a0)
|
||||||
|
REG_S s3, SC_REGS+S3*REGSZ(a0)
|
||||||
|
REG_S s4, SC_REGS+S4*REGSZ(a0)
|
||||||
|
REG_S s5, SC_REGS+S5*REGSZ(a0)
|
||||||
|
REG_S s6, SC_REGS+S6*REGSZ(a0)
|
||||||
|
REG_S s7, SC_REGS+S7*REGSZ(a0)
|
||||||
|
REG_S s8, SC_REGS+S8*REGSZ(a0)
|
||||||
|
REG_L v0, GPOFF(sp)
|
||||||
|
REG_S v0, SC_REGS+GP*REGSZ(a0)
|
||||||
|
PTR_ADDU v0, sp, FRAMESZ
|
||||||
|
REG_S v0, SC_REGS+SP*REGSZ(a0)
|
||||||
|
|
||||||
|
#if !defined(SOFTFLOAT)
|
||||||
|
li v0, 1 # be nice if we could tell
|
||||||
|
REG_S v0, SC_FPUSED(a0) # sc_fpused = 1
|
||||||
|
cfc1 v0, $31
|
||||||
|
#if _MIPS_FPSET == 32
|
||||||
|
FPREG64_S($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_S($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
|
||||||
|
#else
|
||||||
|
swc1 $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
|
||||||
|
swc1 $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
|
||||||
|
#endif
|
||||||
|
REG_S v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
|
||||||
|
#endif /* !SOFTFLOAT */
|
||||||
|
move v0, zero
|
||||||
|
RESTORE_GP64
|
||||||
|
PTR_ADDU sp, FRAMESZ
|
||||||
|
j ra
|
||||||
|
|
||||||
|
botch:
|
||||||
|
jal longjmperror
|
||||||
|
jal abort
|
||||||
|
RESTORE_GP64
|
||||||
|
PTR_ADDU sp, FRAMESZ
|
||||||
|
END(setjmp)
|
||||||
|
|
||||||
|
|
||||||
|
LEAF(longjmp, FRAMESZ)
|
||||||
|
PTR_SUBU sp, FRAMESZ
|
||||||
|
SETUP_GP64(GPOFF, longjmp)
|
||||||
|
SAVE_GP(GPOFF)
|
||||||
|
.set reorder
|
||||||
|
sw a1, A1OFF(sp)
|
||||||
|
sw a0, A0OFF(sp)
|
||||||
|
|
||||||
|
lw a0, SC_MASK(a0)
|
||||||
|
jal sigsetmask
|
||||||
|
|
||||||
|
lw a0, A0OFF(sp)
|
||||||
|
lw a1, A1OFF(sp)
|
||||||
|
|
||||||
|
.set noreorder
|
||||||
|
REG_L v0, SC_REGS+ZERO*REGSZ(a0)
|
||||||
|
bne v0, 0xACEDBADE, botch # jump if error
|
||||||
|
REG_L ra, SC_PC(a0)
|
||||||
|
REG_L s0, SC_REGS+S0*REGSZ(a0)
|
||||||
|
REG_L s1, SC_REGS+S1*REGSZ(a0)
|
||||||
|
REG_L s2, SC_REGS+S2*REGSZ(a0)
|
||||||
|
REG_L s3, SC_REGS+S3*REGSZ(a0)
|
||||||
|
REG_L s4, SC_REGS+S4*REGSZ(a0)
|
||||||
|
REG_L s5, SC_REGS+S5*REGSZ(a0)
|
||||||
|
REG_L s6, SC_REGS+S6*REGSZ(a0)
|
||||||
|
REG_L s7, SC_REGS+S7*REGSZ(a0)
|
||||||
|
REG_L s8, SC_REGS+S8*REGSZ(a0)
|
||||||
|
REG_L gp, SC_REGS+GP*REGSZ(a0)
|
||||||
|
REG_L sp, SC_REGS+SP*REGSZ(a0)
|
||||||
|
|
||||||
|
#if !defined(SOFTFLOAT)
|
||||||
|
REG_L v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
|
||||||
|
ctc1 v0, $31
|
||||||
|
#if _MIPS_FPSET == 32
|
||||||
|
FPREG64_L($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f21, SC_FPREGS+((F21-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f22, SC_FPREGS+((F22-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f23, SC_FPREGS+((F23-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f24, SC_FPREGS+((F24-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f25, SC_FPREGS+((F25-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f26, SC_FPREGS+((F26-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f27, SC_FPREGS+((F27-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f28, SC_FPREGS+((F28-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f29, SC_FPREGS+((F29-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f30, SC_FPREGS+((F30-F0)*REGSZ_FP), a0)
|
||||||
|
FPREG64_L($f31, SC_FPREGS+((F31-F0)*REGSZ_FP), a0)
|
||||||
|
#else
|
||||||
|
lwc1 $f20, SC_FPREGS+((F20-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f21, SC_FPREGS+((F21-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f22, SC_FPREGS+((F22-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f23, SC_FPREGS+((F23-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f24, SC_FPREGS+((F24-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f25, SC_FPREGS+((F25-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f26, SC_FPREGS+((F26-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f27, SC_FPREGS+((F27-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f28, SC_FPREGS+((F28-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f29, SC_FPREGS+((F29-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f30, SC_FPREGS+((F30-F0)*REGSZ_FP)(a0)
|
||||||
|
lwc1 $f31, SC_FPREGS+((F31-F0)*REGSZ_FP)(a0)
|
||||||
|
#endif
|
||||||
|
#endif /* !SOFTFLOAT */
|
||||||
|
bne a1, zero, 1f
|
||||||
|
nop
|
||||||
|
li a1, 1 # never return 0!
|
||||||
|
1:
|
||||||
|
j ra
|
||||||
|
move v0, a1
|
||||||
|
|
||||||
|
END(longjmp)
|
||||||
77
libc/arch-mips/bionic/sigsetjmp.S
Normal file
77
libc/arch-mips/bionic/sigsetjmp.S
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/* $OpenBSD: sigsetjmp.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 1991, 1993, 1995,
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* This code is derived from software contributed to Berkeley by
|
||||||
|
* Havard Eidnes.
|
||||||
|
*
|
||||||
|
* 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 University 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 REGENTS 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 REGENTS 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 <machine/asm.h>
|
||||||
|
#include <machine/regnum.h>
|
||||||
|
#include <machine/setjmp.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* trampolines for sigsetjmp and siglongjmp save and restore mask.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
FRAMESZ= MKFSIZ(1,1)
|
||||||
|
GPOFF= FRAMESZ-2*REGSZ
|
||||||
|
|
||||||
|
LEAF(sigsetjmp, FRAMESZ)
|
||||||
|
PTR_SUBU sp, FRAMESZ
|
||||||
|
SETUP_GP64(GPOFF, sigsetjmp)
|
||||||
|
.set reorder
|
||||||
|
REG_S a1, (_JBLEN*REGSZ)(a0) # save "savemask"
|
||||||
|
bne a1, 0x0, 1f # do saving of signal mask?
|
||||||
|
LA t9, _setjmp
|
||||||
|
RESTORE_GP64
|
||||||
|
PTR_ADDU sp, FRAMESZ
|
||||||
|
jr t9
|
||||||
|
|
||||||
|
1: LA t9, setjmp
|
||||||
|
RESTORE_GP64
|
||||||
|
PTR_ADDU sp, FRAMESZ
|
||||||
|
jr t9
|
||||||
|
END(sigsetjmp)
|
||||||
|
|
||||||
|
LEAF(siglongjmp, FRAMESZ)
|
||||||
|
PTR_SUBU sp, FRAMESZ
|
||||||
|
SETUP_GP64(GPOFF, siglongjmp)
|
||||||
|
.set reorder
|
||||||
|
REG_L t0, (_JBLEN*REGSZ)(a0) # get "savemask"
|
||||||
|
bne t0, 0x0, 1f # restore signal mask?
|
||||||
|
LA t9, _longjmp
|
||||||
|
RESTORE_GP64
|
||||||
|
PTR_ADDU sp, FRAMESZ
|
||||||
|
jr t9
|
||||||
|
1:
|
||||||
|
LA t9, longjmp
|
||||||
|
RESTORE_GP64
|
||||||
|
PTR_ADDU sp, FRAMESZ
|
||||||
|
jr t9
|
||||||
|
END(siglongjmp)
|
||||||
56
libc/arch-mips/bionic/vfork.S
Normal file
56
libc/arch-mips/bionic/vfork.S
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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/unistd.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
/* int vfork() implemented using clone() */
|
||||||
|
|
||||||
|
.type vfork, @function
|
||||||
|
.global vfork
|
||||||
|
.align 4
|
||||||
|
.ent vfork
|
||||||
|
vfork:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
|
||||||
|
li $a0, 0x4112 /* CLONE_VM | CLONE_VFORK | SIGCHLD */
|
||||||
|
move $a1, $sp
|
||||||
|
li $v0, __NR_clone
|
||||||
|
syscall
|
||||||
|
bnez $a3,1f
|
||||||
|
nop
|
||||||
|
|
||||||
|
j $ra
|
||||||
|
nop
|
||||||
|
1:
|
||||||
|
la $t9,__set_errno
|
||||||
|
j $t9
|
||||||
|
move $a0,$v0
|
||||||
|
.end vfork
|
||||||
77
libc/arch-mips/include/endian.h
Normal file
77
libc/arch-mips/include/endian.h
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/* $OpenBSD: endian.h,v 1.5 2006/02/27 23:35:59 miod Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 _MIPS64_ENDIAN_H_
|
||||||
|
#define _MIPS64_ENDIAN_H_
|
||||||
|
|
||||||
|
#if defined(__MIPSEL__)
|
||||||
|
#define _BYTE_ORDER _LITTLE_ENDIAN
|
||||||
|
#endif
|
||||||
|
#if defined(__MIPSEB__)
|
||||||
|
#define _BYTE_ORDER _BIG_ENDIAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_BYTE_ORDER) && !defined(lint)
|
||||||
|
#error "__MIPSEL__ or __MIPSEB__ must be defined to define BYTE_ORDER!!!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
|
||||||
|
#if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
|
||||||
|
#define __swap16md(x) ({ \
|
||||||
|
register uint16_t _x = (x); \
|
||||||
|
register uint16_t _r; \
|
||||||
|
__asm volatile ("wsbh %0, %1" : "=r" (_r) : "r" (_x)); \
|
||||||
|
_r; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define __swap32md(x) ({ \
|
||||||
|
register uint32_t _x = (x); \
|
||||||
|
register uint32_t _r; \
|
||||||
|
__asm volatile ("wsbh %0, %1; rotr %0, %0, 16" : "=r" (_r) : "r" (_x)); \
|
||||||
|
_r; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define __swap64md(x) ({ \
|
||||||
|
uint64_t _swap64md_x = (x); \
|
||||||
|
(uint64_t) __swap32md(_swap64md_x >> 32) | \
|
||||||
|
(uint64_t) __swap32md(_swap64md_x & 0xffffffff) << 32; \
|
||||||
|
})
|
||||||
|
|
||||||
|
/* Tell sys/endian.h we have MD variants of the swap macros. */
|
||||||
|
#define MD_SWAP
|
||||||
|
|
||||||
|
#endif /* __mips32r2__ */
|
||||||
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
|
|
||||||
|
#include <sys/endian.h>
|
||||||
|
|
||||||
|
#define __STRICT_ALIGNMENT
|
||||||
|
|
||||||
|
#endif /* _MIPS64_ENDIAN_H_ */
|
||||||
145
libc/arch-mips/include/machine/_types.h
Normal file
145
libc/arch-mips/include/machine/_types.h
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
/* $OpenBSD: _types.h,v 1.5 2008/07/21 20:50:54 martynas Exp $ */
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 1990, 1993
|
||||||
|
* The Regents of the University of California. 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 University 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 REGENTS 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 REGENTS 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.
|
||||||
|
*
|
||||||
|
* @(#)types.h 8.3 (Berkeley) 1/5/94
|
||||||
|
* @(#)ansi.h 8.2 (Berkeley) 1/4/94
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MIPS64__TYPES_H_
|
||||||
|
#define _MIPS64__TYPES_H_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need to handle the various ISA levels for sizes.
|
||||||
|
*/
|
||||||
|
#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */
|
||||||
|
#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */
|
||||||
|
#define _MIPS_ISA_MIPS3 3 /* R4000 */
|
||||||
|
#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */
|
||||||
|
|
||||||
|
/* 7.18.1.1 Exact-width integer types */
|
||||||
|
typedef __signed char __int8_t;
|
||||||
|
typedef unsigned char __uint8_t;
|
||||||
|
typedef short __int16_t;
|
||||||
|
typedef unsigned short __uint16_t;
|
||||||
|
typedef int __int32_t;
|
||||||
|
typedef unsigned int __uint32_t;
|
||||||
|
/* LONGLONG */
|
||||||
|
typedef long long __int64_t;
|
||||||
|
/* LONGLONG */
|
||||||
|
typedef unsigned long long __uint64_t;
|
||||||
|
|
||||||
|
/* 7.18.1.2 Minimum-width integer types */
|
||||||
|
typedef __int8_t __int_least8_t;
|
||||||
|
typedef __uint8_t __uint_least8_t;
|
||||||
|
typedef __int16_t __int_least16_t;
|
||||||
|
typedef __uint16_t __uint_least16_t;
|
||||||
|
typedef __int32_t __int_least32_t;
|
||||||
|
typedef __uint32_t __uint_least32_t;
|
||||||
|
typedef __int64_t __int_least64_t;
|
||||||
|
typedef __uint64_t __uint_least64_t;
|
||||||
|
|
||||||
|
/* 7.18.1.3 Fastest minimum-width integer types */
|
||||||
|
typedef __int32_t __int_fast8_t;
|
||||||
|
typedef __uint32_t __uint_fast8_t;
|
||||||
|
typedef __int32_t __int_fast16_t;
|
||||||
|
typedef __uint32_t __uint_fast16_t;
|
||||||
|
typedef __int32_t __int_fast32_t;
|
||||||
|
typedef __uint32_t __uint_fast32_t;
|
||||||
|
typedef __int64_t __int_fast64_t;
|
||||||
|
typedef __uint64_t __uint_fast64_t;
|
||||||
|
|
||||||
|
/* 7.18.1.4 Integer types capable of holding object pointers */
|
||||||
|
typedef long __intptr_t;
|
||||||
|
typedef unsigned long __uintptr_t;
|
||||||
|
|
||||||
|
/* 7.18.1.5 Greatest-width integer types */
|
||||||
|
typedef __int64_t __intmax_t;
|
||||||
|
typedef __uint64_t __uintmax_t;
|
||||||
|
|
||||||
|
/* Register size */
|
||||||
|
#if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4)
|
||||||
|
typedef __int64_t __register_t;
|
||||||
|
typedef __int64_t f_register_t; /* XXX */
|
||||||
|
#else
|
||||||
|
typedef __int32_t __register_t;
|
||||||
|
typedef __int32_t f_register_t; /* XXX */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* VM system types */
|
||||||
|
typedef unsigned long __vaddr_t;
|
||||||
|
typedef unsigned long __paddr_t;
|
||||||
|
typedef unsigned long __vsize_t;
|
||||||
|
typedef unsigned long __psize_t;
|
||||||
|
|
||||||
|
/* Standard system types */
|
||||||
|
typedef int __clock_t;
|
||||||
|
typedef int __clockid_t;
|
||||||
|
typedef double __double_t;
|
||||||
|
typedef float __float_t;
|
||||||
|
typedef long long __off_t;
|
||||||
|
typedef long __ptrdiff_t;
|
||||||
|
/*typedef unsigned long __size_t;*/
|
||||||
|
typedef long __ssize_t;
|
||||||
|
typedef int __time_t;
|
||||||
|
typedef int __timer_t;
|
||||||
|
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||||
|
typedef __builtin_va_list __va_list;
|
||||||
|
#else
|
||||||
|
typedef char * __va_list;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Wide character support types */
|
||||||
|
#ifndef __cplusplus
|
||||||
|
typedef int __wchar_t;
|
||||||
|
#endif
|
||||||
|
typedef int __wint_t;
|
||||||
|
typedef int __rune_t;
|
||||||
|
typedef void * __wctrans_t;
|
||||||
|
typedef void * __wctype_t;
|
||||||
|
|
||||||
|
#ifdef __MIPSEB__
|
||||||
|
#define _BYTE_ORDER _BIG_ENDIAN
|
||||||
|
#else
|
||||||
|
#define _BYTE_ORDER _LITTLE_ENDIAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_KERNEL)
|
||||||
|
typedef struct label_t {
|
||||||
|
__register_t val[14];
|
||||||
|
} label_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* XXX check why this still has to be defined. pmap.c issue? */
|
||||||
|
#define __SWAP_BROKEN
|
||||||
|
|
||||||
|
/* Feature test macros */
|
||||||
|
#define __HAVE_TIMECOUNTER
|
||||||
|
|
||||||
|
#endif /* _MIPS64__TYPES_H_ */
|
||||||
305
libc/arch-mips/include/machine/asm.h
Normal file
305
libc/arch-mips/include/machine/asm.h
Normal file
@@ -0,0 +1,305 @@
|
|||||||
|
/* $OpenBSD: asm.h,v 1.7 2004/10/20 12:49:15 pefo Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 _MIPS64_ASM_H
|
||||||
|
#define _MIPS64_ASM_H
|
||||||
|
|
||||||
|
#include <machine/regdef.h>
|
||||||
|
|
||||||
|
#ifdef NEED_OLD_RM7KFIX
|
||||||
|
#define ITLBNOPFIX nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;
|
||||||
|
#else
|
||||||
|
#define ITLBNOPFIX nop;nop;nop;nop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _MIPS_ISA_MIPS1 1 /* R2000/R3000 */
|
||||||
|
#define _MIPS_ISA_MIPS2 2 /* R4000/R6000 */
|
||||||
|
#define _MIPS_ISA_MIPS3 3 /* R4000 */
|
||||||
|
#define _MIPS_ISA_MIPS4 4 /* TFP (R1x000) */
|
||||||
|
#ifdef __linux__
|
||||||
|
#define _MIPS_ISA_MIPS5 5
|
||||||
|
#define _MIPS_ISA_MIPS32 6
|
||||||
|
#define _MIPS_ISA_MIPS64 7
|
||||||
|
#else
|
||||||
|
#define _MIPS_ISA_MIPS32 32 /* MIPS32 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ABICALLS) && !defined(_NO_ABICALLS)
|
||||||
|
#define ABICALLS .abicalls
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ABICALLS) && !defined(_KERNEL)
|
||||||
|
ABICALLS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _C_LABEL(x) x /* XXX Obsolete but keep for a while */
|
||||||
|
|
||||||
|
#if !defined(__MIPSEL__) && !defined(__MIPSEB__)
|
||||||
|
#error "__MIPSEL__ or __MIPSEB__ must be defined"
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* Define how to access unaligned data word
|
||||||
|
*/
|
||||||
|
#if defined(__MIPSEL__)
|
||||||
|
#define LWLO lwl
|
||||||
|
#define LWHI lwr
|
||||||
|
#define SWLO swl
|
||||||
|
#define SWHI swr
|
||||||
|
#define LDLO ldl
|
||||||
|
#define LDHI ldr
|
||||||
|
#define SDLO sdl
|
||||||
|
#define SDHI sdr
|
||||||
|
#endif
|
||||||
|
#if defined(__MIPSEB__)
|
||||||
|
#define LWLO lwr
|
||||||
|
#define LWHI lwl
|
||||||
|
#define SWLO swr
|
||||||
|
#define SWHI swl
|
||||||
|
#define LDLO ldr
|
||||||
|
#define LDHI ldl
|
||||||
|
#define SDLO sdr
|
||||||
|
#define SDHI sdl
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define programming environment for ABI.
|
||||||
|
*/
|
||||||
|
#if defined(ABICALLS) && !defined(_KERNEL) && !defined(_STANDALONE)
|
||||||
|
|
||||||
|
#ifndef _MIPS_SIM
|
||||||
|
#define _MIPS_SIM 1
|
||||||
|
#define _ABIO32 1
|
||||||
|
#endif
|
||||||
|
#ifndef _MIPS_ISA
|
||||||
|
#define _MIPS_ISA 2
|
||||||
|
#define _MIPS_ISA_MIPS2 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
|
||||||
|
#define NARGSAVE 4
|
||||||
|
|
||||||
|
#define SETUP_GP \
|
||||||
|
.set noreorder; \
|
||||||
|
.cpload t9; \
|
||||||
|
.set reorder;
|
||||||
|
|
||||||
|
#define SAVE_GP(x) \
|
||||||
|
.cprestore x
|
||||||
|
|
||||||
|
#define SETUP_GP64(gpoff, name)
|
||||||
|
#define RESTORE_GP64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (_MIPS_SIM == _ABI64) || (_MIPS_SIM == _ABIN32)
|
||||||
|
#define NARGSAVE 0
|
||||||
|
|
||||||
|
#define SETUP_GP
|
||||||
|
#define SAVE_GP(x)
|
||||||
|
#define SETUP_GP64(gpoff, name) \
|
||||||
|
.cpsetup t9, gpoff, name
|
||||||
|
#define RESTORE_GP64 \
|
||||||
|
.cpreturn
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MKFSIZ(narg,locals) (((narg+locals)*REGSZ+31)&(~31))
|
||||||
|
|
||||||
|
#else /* defined(ABICALLS) && !defined(_KERNEL) */
|
||||||
|
|
||||||
|
#define NARGSAVE 4
|
||||||
|
#define SETUP_GP
|
||||||
|
#define SAVE_GP(x)
|
||||||
|
|
||||||
|
#define ALIGNSZ 16 /* Stack layout alignment */
|
||||||
|
#define FRAMESZ(sz) (((sz) + (ALIGNSZ-1)) & ~(ALIGNSZ-1))
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Basic register operations based on selected ISA
|
||||||
|
*/
|
||||||
|
#if (_MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2 || _MIPS_ISA == _MIPS_ISA_MIPS32)
|
||||||
|
#define REGSZ 4 /* 32 bit mode register size */
|
||||||
|
#define LOGREGSZ 2 /* log rsize */
|
||||||
|
#define REG_S sw
|
||||||
|
#define REG_L lw
|
||||||
|
#define CF_SZ 24 /* Call frame size */
|
||||||
|
#define CF_ARGSZ 16 /* Call frame arg size */
|
||||||
|
#define CF_RA_OFFS 20 /* Call ra save offset */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4)
|
||||||
|
#define REGSZ 8 /* 64 bit mode register size */
|
||||||
|
#define LOGREGSZ 3 /* log rsize */
|
||||||
|
#define REG_S sd
|
||||||
|
#define REG_L ld
|
||||||
|
#define CF_SZ 48 /* Call frame size (multiple of ALIGNSZ) */
|
||||||
|
#define CF_ARGSZ 32 /* Call frame arg size */
|
||||||
|
#define CF_RA_OFFS 40 /* Call ra save offset */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define REGSZ_FP 8 /* 64 bit FP register size */
|
||||||
|
|
||||||
|
#ifndef __LP64__
|
||||||
|
#define PTR_L lw
|
||||||
|
#define PTR_S sw
|
||||||
|
#define PTR_SUB sub
|
||||||
|
#define PTR_ADD add
|
||||||
|
#define PTR_SUBU subu
|
||||||
|
#define PTR_ADDU addu
|
||||||
|
#define LI li
|
||||||
|
#define LA la
|
||||||
|
#define PTR_SLL sll
|
||||||
|
#define PTR_SRL srl
|
||||||
|
#define PTR_VAL .word
|
||||||
|
#else
|
||||||
|
#define PTR_L ld
|
||||||
|
#define PTR_S sd
|
||||||
|
#define PTR_ADD dadd
|
||||||
|
#define PTR_SUB dsub
|
||||||
|
#define PTR_SUBU dsubu
|
||||||
|
#define PTR_ADDU daddu
|
||||||
|
#define LI dli
|
||||||
|
#define LA dla
|
||||||
|
#define PTR_SLL dsll
|
||||||
|
#define PTR_SRL dsrl
|
||||||
|
#define PTR_VAL .dword
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define -pg profile entry code.
|
||||||
|
*/
|
||||||
|
#if defined(XGPROF) || defined(XPROF)
|
||||||
|
#define MCOUNT \
|
||||||
|
PTR_SUBU sp, sp, 32; \
|
||||||
|
SAVE_GP(16); \
|
||||||
|
sw ra, 28(sp); \
|
||||||
|
sw gp, 24(sp); \
|
||||||
|
.set noat; \
|
||||||
|
.set noreorder; \
|
||||||
|
move AT, ra; \
|
||||||
|
jal _mcount; \
|
||||||
|
PTR_SUBU sp, sp, 8; \
|
||||||
|
lw ra, 28(sp); \
|
||||||
|
PTR_ADDU sp, sp, 32; \
|
||||||
|
.set reorder; \
|
||||||
|
.set at;
|
||||||
|
#else
|
||||||
|
#define MCOUNT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* LEAF(x, fsize)
|
||||||
|
*
|
||||||
|
* Declare a leaf routine.
|
||||||
|
*/
|
||||||
|
#define LEAF(x, fsize) \
|
||||||
|
.align 3; \
|
||||||
|
.globl x; \
|
||||||
|
.ent x, 0; \
|
||||||
|
x: ; \
|
||||||
|
.frame sp, fsize, ra; \
|
||||||
|
SETUP_GP \
|
||||||
|
MCOUNT
|
||||||
|
|
||||||
|
#define ALEAF(x) \
|
||||||
|
.globl x; \
|
||||||
|
x:
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NLEAF(x)
|
||||||
|
*
|
||||||
|
* Declare a non-profiled leaf routine.
|
||||||
|
*/
|
||||||
|
#define NLEAF(x, fsize) \
|
||||||
|
.align 3; \
|
||||||
|
.globl x; \
|
||||||
|
.ent x, 0; \
|
||||||
|
x: ; \
|
||||||
|
.frame sp, fsize, ra; \
|
||||||
|
SETUP_GP
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NON_LEAF(x)
|
||||||
|
*
|
||||||
|
* Declare a non-leaf routine (a routine that makes other C calls).
|
||||||
|
*/
|
||||||
|
#define NON_LEAF(x, fsize, retpc) \
|
||||||
|
.align 3; \
|
||||||
|
.globl x; \
|
||||||
|
.ent x, 0; \
|
||||||
|
x: ; \
|
||||||
|
.frame sp, fsize, retpc; \
|
||||||
|
SETUP_GP \
|
||||||
|
MCOUNT
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NNON_LEAF(x)
|
||||||
|
*
|
||||||
|
* Declare a non-profiled non-leaf routine
|
||||||
|
* (a routine that makes other C calls).
|
||||||
|
*/
|
||||||
|
#define NNON_LEAF(x, fsize, retpc) \
|
||||||
|
.align 3; \
|
||||||
|
.globl x; \
|
||||||
|
.ent x, 0; \
|
||||||
|
x: ; \
|
||||||
|
.frame sp, fsize, retpc \
|
||||||
|
SETUP_GP
|
||||||
|
|
||||||
|
/*
|
||||||
|
* END(x)
|
||||||
|
*
|
||||||
|
* Mark end of a procedure.
|
||||||
|
*/
|
||||||
|
#define END(x) \
|
||||||
|
.end x
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macros to panic and printf from assembly language.
|
||||||
|
*/
|
||||||
|
#define PANIC(msg) \
|
||||||
|
LA a0, 9f; \
|
||||||
|
jal panic; \
|
||||||
|
nop ; \
|
||||||
|
MSG(msg)
|
||||||
|
|
||||||
|
#define PRINTF(msg) \
|
||||||
|
la a0, 9f; \
|
||||||
|
jal printf; \
|
||||||
|
nop ; \
|
||||||
|
MSG(msg)
|
||||||
|
|
||||||
|
#define MSG(msg) \
|
||||||
|
.rdata; \
|
||||||
|
9: .asciiz msg; \
|
||||||
|
.text
|
||||||
|
|
||||||
|
#define ASMSTR(str) \
|
||||||
|
.asciiz str; \
|
||||||
|
.align 3
|
||||||
|
|
||||||
|
#endif /* !_MIPS_ASM_H */
|
||||||
47
libc/arch-mips/include/machine/cdefs.h
Normal file
47
libc/arch-mips/include/machine/cdefs.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/* $OpenBSD: cdefs.h,v 1.4 2006/01/10 00:04:04 millert Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 _MIPS_CDEFS_H_
|
||||||
|
#define _MIPS_CDEFS_H_
|
||||||
|
|
||||||
|
#if defined(lint)
|
||||||
|
#define __indr_reference(sym,alias) __lint_equal__(sym,alias)
|
||||||
|
#define __warn_references(sym,msg)
|
||||||
|
#define __weak_alias(alias,sym) __lint_equal__(sym,alias)
|
||||||
|
#elif defined(__GNUC__) && defined(__STDC__)
|
||||||
|
#define __weak_alias(alias,sym) \
|
||||||
|
__asm__(".weak " __STRING(alias) " ; " \
|
||||||
|
__STRING(alias) " = " __STRING(sym))
|
||||||
|
#define __warn_references(sym,msg) \
|
||||||
|
__asm__(".section .gnu.warning." __STRING(sym) \
|
||||||
|
" ; .ascii \"" msg "\" ; .text")
|
||||||
|
#define __indr_references(sym,msg) /* nothing */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_MIPS_CDEFS_H_ */
|
||||||
188
libc/arch-mips/include/machine/exec.h
Normal file
188
libc/arch-mips/include/machine/exec.h
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
/* $OpenBSD: exec.h,v 1.1 2004/10/18 19:05:36 grange Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 _MIPS64_EXEC_H_
|
||||||
|
#define _MIPS64_EXEC_H_
|
||||||
|
|
||||||
|
#define __LDPGSZ 4096
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define what exec "formats" we should handle.
|
||||||
|
*/
|
||||||
|
#define NATIVE_EXEC_ELF
|
||||||
|
#define NATIVE_ELFSIZE 64
|
||||||
|
#define EXEC_SCRIPT
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If included from sys/exec.h define kernels ELF format.
|
||||||
|
*/
|
||||||
|
#ifdef __LP64__
|
||||||
|
#define ARCH_ELFSIZE 64
|
||||||
|
#define DB_ELFSIZE 64
|
||||||
|
#define ELF_TARG_CLASS ELFCLASS64
|
||||||
|
#else
|
||||||
|
#define ARCH_ELFSIZE 32
|
||||||
|
#define DB_ELFSIZE 32
|
||||||
|
#define ELF_TARG_CLASS ELFCLASS32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__MIPSEB__)
|
||||||
|
#define ELF_TARG_DATA ELFDATA2MSB
|
||||||
|
#else
|
||||||
|
#define ELF_TARG_DATA ELFDATA2LSB
|
||||||
|
#endif
|
||||||
|
#define ELF_TARG_MACH EM_MIPS
|
||||||
|
|
||||||
|
#define _NLIST_DO_ELF
|
||||||
|
|
||||||
|
#if defined(_LP64)
|
||||||
|
#define _KERN_DO_ELF64
|
||||||
|
#if defined(COMPAT_O32)
|
||||||
|
#define _KERN_DO_ELF
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define _KERN_DO_ELF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Information taken from MIPS ABI supplemental */
|
||||||
|
|
||||||
|
/* Architecture dependent Segment types - p_type */
|
||||||
|
#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
|
||||||
|
|
||||||
|
/* Architecture dependent d_tag field for Elf32_Dyn. */
|
||||||
|
#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */
|
||||||
|
#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
|
||||||
|
#define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */
|
||||||
|
#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
|
||||||
|
#define DT_MIPS_FLAGS 0x70000005 /* Flags */
|
||||||
|
#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */
|
||||||
|
#define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */
|
||||||
|
#define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */
|
||||||
|
#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */
|
||||||
|
#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */
|
||||||
|
#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */
|
||||||
|
#define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */
|
||||||
|
#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
|
||||||
|
#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */
|
||||||
|
#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
|
||||||
|
#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */
|
||||||
|
|
||||||
|
#define DT_PROCNUM (DT_MIPS_RLD_MAP - DT_LOPROC + 1)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Legal values for e_flags field of Elf32_Ehdr.
|
||||||
|
*/
|
||||||
|
#define EF_MIPS_NOREORDER 0x00000001 /* .noreorder was used */
|
||||||
|
#define EF_MIPS_PIC 0x00000002 /* Contains PIC code */
|
||||||
|
#define EF_MIPS_CPIC 0x00000004 /* Uses PIC calling sequence */
|
||||||
|
#define EF_MIPS_ABI2 0x00000020 /* -n32 on Irix 6 */
|
||||||
|
#define EF_MIPS_32BITMODE 0x00000100 /* 64 bit in 32 bit mode... */
|
||||||
|
#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
|
||||||
|
#define E_MIPS_ARCH_1 0x00000000
|
||||||
|
#define E_MIPS_ARCH_2 0x10000000
|
||||||
|
#define E_MIPS_ARCH_3 0x20000000
|
||||||
|
#define E_MIPS_ARCH_4 0x30000000
|
||||||
|
#define EF_MIPS_ABI 0x0000f000 /* ABI level */
|
||||||
|
#define E_MIPS_ABI_NONE 0x00000000 /* ABI level not set */
|
||||||
|
#define E_MIPS_ABI_O32 0x00001000
|
||||||
|
#define E_MIPS_ABI_O64 0x00002000
|
||||||
|
#define E_MIPS_ABI_EABI32 0x00004000
|
||||||
|
#define E_MIPS_ABI_EABI64 0x00004000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mips special sections.
|
||||||
|
*/
|
||||||
|
#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
|
||||||
|
#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
|
||||||
|
#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Legal values for sh_type field of Elf32_Shdr.
|
||||||
|
*/
|
||||||
|
#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */
|
||||||
|
#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */
|
||||||
|
#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
|
||||||
|
#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
|
||||||
|
#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information */
|
||||||
|
#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Legal values for sh_flags field of Elf32_Shdr.
|
||||||
|
*/
|
||||||
|
#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/*
|
||||||
|
* Entries found in sections of type SHT_MIPS_GPTAB.
|
||||||
|
*/
|
||||||
|
typedef union {
|
||||||
|
struct {
|
||||||
|
Elf32_Word gt_current_g_value; /* -G val used in compilation */
|
||||||
|
Elf32_Word gt_unused; /* Not used */
|
||||||
|
} gt_header; /* First entry in section */
|
||||||
|
struct {
|
||||||
|
Elf32_Word gt_g_value; /* If this val were used for -G */
|
||||||
|
Elf32_Word gt_bytes; /* This many bytes would be used */
|
||||||
|
} gt_entry; /* Subsequent entries in section */
|
||||||
|
} Elf32_gptab;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Entry found in sections of type SHT_MIPS_REGINFO.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
Elf32_Word ri_gprmask; /* General registers used */
|
||||||
|
Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
|
||||||
|
Elf32_Sword ri_gp_value; /* $gp register value */
|
||||||
|
} Elf32_RegInfo;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mips relocations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define R_MIPS_NONE 0 /* No reloc */
|
||||||
|
#define R_MIPS_16 1 /* Direct 16 bit */
|
||||||
|
#define R_MIPS_32 2 /* Direct 32 bit */
|
||||||
|
#define R_MIPS_REL32 3 /* PC relative 32 bit */
|
||||||
|
#define R_MIPS_26 4 /* Direct 26 bit shifted */
|
||||||
|
#define R_MIPS_HI16 5 /* High 16 bit */
|
||||||
|
#define R_MIPS_LO16 6 /* Low 16 bit */
|
||||||
|
#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
|
||||||
|
#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
|
||||||
|
#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
|
||||||
|
#define R_MIPS_PC16 10 /* PC relative 16 bit */
|
||||||
|
#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
|
||||||
|
#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
|
||||||
|
|
||||||
|
#define R_MIPS_64 18
|
||||||
|
|
||||||
|
#define R_MIPS_REL32_64 ((R_MIPS_64 << 8) | R_MIPS_REL32)
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* !_MIPS64_EXEC_H_ */
|
||||||
169
libc/arch-mips/include/machine/ieee.h
Normal file
169
libc/arch-mips/include/machine/ieee.h
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
/* $OpenBSD: ieee.h,v 1.4 2010/01/23 19:11:21 miod Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1992, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software was developed by the Computer Systems Engineering group
|
||||||
|
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||||
|
* contributed to Berkeley.
|
||||||
|
*
|
||||||
|
* All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Lawrence Berkeley Laboratory.
|
||||||
|
*
|
||||||
|
* 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 University 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 REGENTS 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 REGENTS 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.
|
||||||
|
*
|
||||||
|
* @(#)ieee.h 8.1 (Berkeley) 6/11/93
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ieee.h defines the machine-dependent layout of the machine's IEEE
|
||||||
|
* floating point. It does *not* define (yet?) any of the rounding
|
||||||
|
* mode bits, exceptions, and so forth.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define the number of bits in each fraction and exponent.
|
||||||
|
*
|
||||||
|
* k k+1
|
||||||
|
* Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
|
||||||
|
*
|
||||||
|
* (-exp_bias+1)
|
||||||
|
* as fractions that look like 0.fffff x 2 . This means that
|
||||||
|
*
|
||||||
|
* -126
|
||||||
|
* the number 0.10000 x 2 , for instance, is the same as the normalized
|
||||||
|
*
|
||||||
|
* -127 -128
|
||||||
|
* float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
|
||||||
|
*
|
||||||
|
* -129
|
||||||
|
* in the fraction; to represent 2 , we need two, and so on. This
|
||||||
|
*
|
||||||
|
* (-exp_bias-fracbits+1)
|
||||||
|
* implies that the smallest denormalized number is 2
|
||||||
|
*
|
||||||
|
* for whichever format we are talking about: for single precision, for
|
||||||
|
*
|
||||||
|
* -126 -149
|
||||||
|
* instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
|
||||||
|
*
|
||||||
|
* -149 == -127 - 23 + 1.
|
||||||
|
*/
|
||||||
|
#define SNG_EXPBITS 8
|
||||||
|
#define SNG_FRACBITS 23
|
||||||
|
|
||||||
|
#define DBL_EXPBITS 11
|
||||||
|
#define DBL_FRACHBITS 20
|
||||||
|
#define DBL_FRACLBITS 32
|
||||||
|
#define DBL_FRACBITS 52
|
||||||
|
|
||||||
|
#define EXT_EXPBITS 15
|
||||||
|
#define EXT_FRACHBITS 16
|
||||||
|
#define EXT_FRACHMBITS 32
|
||||||
|
#define EXT_FRACLMBITS 32
|
||||||
|
#define EXT_FRACLBITS 32
|
||||||
|
#define EXT_FRACBITS 112
|
||||||
|
|
||||||
|
#define EXT_IMPLICIT_NBIT
|
||||||
|
|
||||||
|
#define EXT_TO_ARRAY32(p, a) do { \
|
||||||
|
(a)[0] = (uint32_t)(p)->ext_fracl; \
|
||||||
|
(a)[1] = (uint32_t)(p)->ext_fraclm; \
|
||||||
|
(a)[2] = (uint32_t)(p)->ext_frachm; \
|
||||||
|
(a)[3] = (uint32_t)(p)->ext_frach; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
struct ieee_single {
|
||||||
|
#ifdef __MIPSEB__
|
||||||
|
u_int sng_sign:1;
|
||||||
|
u_int sng_exp:8;
|
||||||
|
u_int sng_frac:23;
|
||||||
|
#else
|
||||||
|
u_int sng_frac:23;
|
||||||
|
u_int sng_exp:8;
|
||||||
|
u_int sng_sign:1;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ieee_double {
|
||||||
|
#ifdef __MIPSEB__
|
||||||
|
u_int dbl_sign:1;
|
||||||
|
u_int dbl_exp:11;
|
||||||
|
u_int dbl_frach:20;
|
||||||
|
u_int dbl_fracl;
|
||||||
|
#else
|
||||||
|
u_int dbl_fracl;
|
||||||
|
u_int dbl_frach:20;
|
||||||
|
u_int dbl_exp:11;
|
||||||
|
u_int dbl_sign:1;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ieee_ext {
|
||||||
|
#ifdef __MIPSEB__
|
||||||
|
u_int ext_sign:1;
|
||||||
|
u_int ext_exp:15;
|
||||||
|
u_int ext_frach:16;
|
||||||
|
u_int ext_frachm;
|
||||||
|
u_int ext_fraclm;
|
||||||
|
u_int ext_fracl;
|
||||||
|
#else
|
||||||
|
u_int ext_fracl;
|
||||||
|
u_int ext_fraclm;
|
||||||
|
u_int ext_frachm;
|
||||||
|
u_int ext_frach:16;
|
||||||
|
u_int ext_exp:15;
|
||||||
|
u_int ext_sign:1;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
|
||||||
|
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
|
||||||
|
* Floats whose exponent is zero are either zero (iff all fraction
|
||||||
|
* bits are zero) or subnormal values.
|
||||||
|
*
|
||||||
|
* A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
|
||||||
|
* high fraction; if the bit is set, it is a `quiet NaN'.
|
||||||
|
*/
|
||||||
|
#define SNG_EXP_INFNAN 255
|
||||||
|
#define DBL_EXP_INFNAN 2047
|
||||||
|
#define EXT_EXP_INFNAN 32767
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define SNG_QUIETNAN (1 << 22)
|
||||||
|
#define DBL_QUIETNAN (1 << 19)
|
||||||
|
#define EXT_QUIETNAN (1 << 15)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exponent biases.
|
||||||
|
*/
|
||||||
|
#define SNG_EXP_BIAS 127
|
||||||
|
#define DBL_EXP_BIAS 1023
|
||||||
|
#define EXT_EXP_BIAS 16383
|
||||||
8
libc/arch-mips/include/machine/internal_types.h
Normal file
8
libc/arch-mips/include/machine/internal_types.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/* $OpenBSD: internal_types.h,v 1.1 2004/08/06 20:56:02 pefo Exp $ */
|
||||||
|
/* Public domain */
|
||||||
|
#ifndef _MIPS64_INTERNAL_TYPES_H_
|
||||||
|
#define _MIPS64_INTERNAL_TYPES_H_
|
||||||
|
|
||||||
|
/* Machine special type definitions */
|
||||||
|
|
||||||
|
#endif
|
||||||
42
libc/arch-mips/include/machine/kernel.h
Normal file
42
libc/arch-mips/include/machine/kernel.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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 _ARCH_MIPS_KERNEL_H
|
||||||
|
#define _ARCH_MIPS_KERNEL_H
|
||||||
|
|
||||||
|
/* this file contains kernel-specific definitions that were optimized out of
|
||||||
|
our processed kernel headers, but still useful nonetheless... */
|
||||||
|
|
||||||
|
typedef unsigned long __kernel_blkcnt_t;
|
||||||
|
typedef unsigned long __kernel_blksize_t;
|
||||||
|
|
||||||
|
/* these aren't really defined by the kernel headers though... */
|
||||||
|
typedef unsigned long __kernel_fsblkcnt_t;
|
||||||
|
typedef unsigned long __kernel_fsfilcnt_t;
|
||||||
|
typedef unsigned int __kernel_id_t;
|
||||||
|
|
||||||
|
#endif /* _ARCH_MIPS_KERNEL_H */
|
||||||
62
libc/arch-mips/include/machine/limits.h
Normal file
62
libc/arch-mips/include/machine/limits.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/* $OpenBSD: limits.h,v 1.5 2007/05/07 20:51:07 kettenis Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1988, 1993
|
||||||
|
* The Regents of the University of California. 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 University 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 REGENTS 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 REGENTS 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.
|
||||||
|
*
|
||||||
|
* @(#)limits.h 8.3 (Berkeley) 1/4/94
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MIPS_LIMITS_H_
|
||||||
|
#define _MIPS_LIMITS_H_
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
|
||||||
|
|
||||||
|
#ifndef SIZE_MAX
|
||||||
|
#define SIZE_MAX ULONG_MAX /* max value for a size_t */
|
||||||
|
#endif
|
||||||
|
#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
|
||||||
|
|
||||||
|
#if __BSD_VISIBLE
|
||||||
|
#define SIZE_T_MAX ULONG_MAX /* max value for a size_t (historic) */
|
||||||
|
|
||||||
|
/* Quads and longs are the same on mips64 */
|
||||||
|
#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */
|
||||||
|
#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */
|
||||||
|
#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */
|
||||||
|
|
||||||
|
#endif /* __BSD_VISIBLE */
|
||||||
|
|
||||||
|
|
||||||
|
#define LONGLONG_BIT 64
|
||||||
|
#define LONGLONG_MIN (-9223372036854775807LL-1)
|
||||||
|
#define LONGLONG_MAX 9223372036854775807LL
|
||||||
|
#define ULONGLONG_MAX 18446744073709551615ULL
|
||||||
|
|
||||||
|
#endif /* !_MIPS_LIMITS_H_ */
|
||||||
92
libc/arch-mips/include/machine/regdef.h
Normal file
92
libc/arch-mips/include/machine/regdef.h
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/* $OpenBSD: regdef.h,v 1.3 2005/08/07 07:29:44 miod Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1992, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* This code is derived from software contributed to Berkeley by
|
||||||
|
* Ralph Campbell. This file is derived from the MIPS RISC
|
||||||
|
* Architecture book by Gerry Kane.
|
||||||
|
*
|
||||||
|
* 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 University 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 REGENTS 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 REGENTS 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.
|
||||||
|
*
|
||||||
|
* @(#)regdef.h 8.1 (Berkeley) 6/10/93
|
||||||
|
*/
|
||||||
|
#ifndef _MIPS_REGDEF_H_
|
||||||
|
#define _MIPS_REGDEF_H_
|
||||||
|
|
||||||
|
#define zero $0 /* always zero */
|
||||||
|
#define AT $at /* assembler temp */
|
||||||
|
#define v0 $2 /* return value */
|
||||||
|
#define v1 $3
|
||||||
|
#define a0 $4 /* argument registers */
|
||||||
|
#define a1 $5
|
||||||
|
#define a2 $6
|
||||||
|
#define a3 $7
|
||||||
|
#if defined(__mips_n32) || defined(__mips_n64)
|
||||||
|
#define a4 $8 /* expanded register arguments */
|
||||||
|
#define a5 $9
|
||||||
|
#define a6 $10
|
||||||
|
#define a7 $11
|
||||||
|
#define ta0 $8 /* alias */
|
||||||
|
#define ta1 $9
|
||||||
|
#define ta2 $10
|
||||||
|
#define ta3 $11
|
||||||
|
#define t0 $12 /* temp registers (not saved across subroutine calls) */
|
||||||
|
#define t1 $13
|
||||||
|
#define t2 $14
|
||||||
|
#define t3 $15
|
||||||
|
#else
|
||||||
|
#define t0 $8 /* temp registers (not saved across subroutine calls) */
|
||||||
|
#define t1 $9
|
||||||
|
#define t2 $10
|
||||||
|
#define t3 $11
|
||||||
|
#define t4 $12
|
||||||
|
#define t5 $13
|
||||||
|
#define t6 $14
|
||||||
|
#define t7 $15
|
||||||
|
#define ta0 $12 /* alias */
|
||||||
|
#define ta1 $13
|
||||||
|
#define ta2 $14
|
||||||
|
#define ta3 $15
|
||||||
|
#endif
|
||||||
|
#define s0 $16 /* saved across subroutine calls (callee saved) */
|
||||||
|
#define s1 $17
|
||||||
|
#define s2 $18
|
||||||
|
#define s3 $19
|
||||||
|
#define s4 $20
|
||||||
|
#define s5 $21
|
||||||
|
#define s6 $22
|
||||||
|
#define s7 $23
|
||||||
|
#define t8 $24 /* two more temp registers */
|
||||||
|
#define t9 $25
|
||||||
|
#define k0 $26 /* kernel temporary */
|
||||||
|
#define k1 $27
|
||||||
|
#define gp $28 /* global pointer */
|
||||||
|
#define sp $29 /* stack pointer */
|
||||||
|
#define s8 $30 /* one more callee saved */
|
||||||
|
#define ra $31 /* return address */
|
||||||
|
|
||||||
|
#endif /* !_MIPS_REGDEF_H_ */
|
||||||
119
libc/arch-mips/include/machine/regnum.h
Normal file
119
libc/arch-mips/include/machine/regnum.h
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/* $OpenBSD: regnum.h,v 1.3 2004/08/10 20:28:13 deraadt Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 _MIPS64_REGNUM_H_
|
||||||
|
#define _MIPS64_REGNUM_H_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Location of the saved registers relative to ZERO.
|
||||||
|
* Usage is p->p_regs[XX].
|
||||||
|
*/
|
||||||
|
#define ZERO 0
|
||||||
|
#define AST 1
|
||||||
|
#define V0 2
|
||||||
|
#define V1 3
|
||||||
|
#define A0 4
|
||||||
|
#define A1 5
|
||||||
|
#define A2 6
|
||||||
|
#define A3 7
|
||||||
|
#define T0 8
|
||||||
|
#define T1 9
|
||||||
|
#define T2 10
|
||||||
|
#define T3 11
|
||||||
|
#define T4 12
|
||||||
|
#define T5 13
|
||||||
|
#define T6 14
|
||||||
|
#define T7 15
|
||||||
|
#define S0 16
|
||||||
|
#define S1 17
|
||||||
|
#define S2 18
|
||||||
|
#define S3 19
|
||||||
|
#define S4 20
|
||||||
|
#define S5 21
|
||||||
|
#define S6 22
|
||||||
|
#define S7 23
|
||||||
|
#define T8 24
|
||||||
|
#define T9 25
|
||||||
|
#define K0 26
|
||||||
|
#define K1 27
|
||||||
|
#define GP 28
|
||||||
|
#define SP 29
|
||||||
|
#define S8 30
|
||||||
|
#define RA 31
|
||||||
|
#define SR 32
|
||||||
|
#define PS SR /* alias for SR */
|
||||||
|
#define MULLO 33
|
||||||
|
#define MULHI 34
|
||||||
|
#define BADVADDR 35
|
||||||
|
#define CAUSE 36
|
||||||
|
#define PC 37
|
||||||
|
#define IC 38
|
||||||
|
#define CPL 39
|
||||||
|
|
||||||
|
#define NUMSAVEREGS 40 /* Number of registers saved in trap */
|
||||||
|
|
||||||
|
#define FPBASE NUMSAVEREGS
|
||||||
|
#define F0 (FPBASE+0)
|
||||||
|
#define F1 (FPBASE+1)
|
||||||
|
#define F2 (FPBASE+2)
|
||||||
|
#define F3 (FPBASE+3)
|
||||||
|
#define F4 (FPBASE+4)
|
||||||
|
#define F5 (FPBASE+5)
|
||||||
|
#define F6 (FPBASE+6)
|
||||||
|
#define F7 (FPBASE+7)
|
||||||
|
#define F8 (FPBASE+8)
|
||||||
|
#define F9 (FPBASE+9)
|
||||||
|
#define F10 (FPBASE+10)
|
||||||
|
#define F11 (FPBASE+11)
|
||||||
|
#define F12 (FPBASE+12)
|
||||||
|
#define F13 (FPBASE+13)
|
||||||
|
#define F14 (FPBASE+14)
|
||||||
|
#define F15 (FPBASE+15)
|
||||||
|
#define F16 (FPBASE+16)
|
||||||
|
#define F17 (FPBASE+17)
|
||||||
|
#define F18 (FPBASE+18)
|
||||||
|
#define F19 (FPBASE+19)
|
||||||
|
#define F20 (FPBASE+20)
|
||||||
|
#define F21 (FPBASE+21)
|
||||||
|
#define F22 (FPBASE+22)
|
||||||
|
#define F23 (FPBASE+23)
|
||||||
|
#define F24 (FPBASE+24)
|
||||||
|
#define F25 (FPBASE+25)
|
||||||
|
#define F26 (FPBASE+26)
|
||||||
|
#define F27 (FPBASE+27)
|
||||||
|
#define F28 (FPBASE+28)
|
||||||
|
#define F29 (FPBASE+29)
|
||||||
|
#define F30 (FPBASE+30)
|
||||||
|
#define F31 (FPBASE+31)
|
||||||
|
#define FSR (FPBASE+32)
|
||||||
|
|
||||||
|
#define NUMFPREGS 33
|
||||||
|
|
||||||
|
#define NREGS (NUMSAVEREGS + NUMFPREGS)
|
||||||
|
|
||||||
|
#endif /* !_MIPS64_REGNUM_H_ */
|
||||||
10
libc/arch-mips/include/machine/setjmp.h
Normal file
10
libc/arch-mips/include/machine/setjmp.h
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/* $OpenBSD: setjmp.h,v 1.2 2004/08/10 21:10:56 pefo Exp $ */
|
||||||
|
|
||||||
|
/* Public domain */
|
||||||
|
|
||||||
|
#ifndef _MIPS_SETJMP_H_
|
||||||
|
#define _MIPS_SETJMP_H_
|
||||||
|
|
||||||
|
#define _JBLEN 157 /* size, in longs, of a jmp_buf */
|
||||||
|
|
||||||
|
#endif /* !_MIPS_SETJMP_H_ */
|
||||||
147
libc/arch-mips/include/machine/signal.h
Normal file
147
libc/arch-mips/include/machine/signal.h
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
/* $OpenBSD: signal.h,v 1.8 2006/01/09 18:18:37 millert Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1992, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* This code is derived from software contributed to Berkeley by
|
||||||
|
* Ralph Campbell.
|
||||||
|
*
|
||||||
|
* 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 University 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 REGENTS 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 REGENTS 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.
|
||||||
|
*
|
||||||
|
* @(#)signal.h 8.1 (Berkeley) 6/10/93
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MIPS_SIGNAL_H_
|
||||||
|
#define _MIPS_SIGNAL_H_
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
#if !defined(__LANGUAGE_ASSEMBLY)
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Machine-dependent signal definitions
|
||||||
|
*/
|
||||||
|
typedef int sig_atomic_t;
|
||||||
|
|
||||||
|
#if __BSD_VISIBLE || __XPG_VISIBLE >= 420
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Information pushed on stack when a signal is delivered.
|
||||||
|
* This is used by the kernel to restore state following
|
||||||
|
* execution of the signal handler. It is also made available
|
||||||
|
* to the handler to allow it to restore state properly if
|
||||||
|
* a non-standard exit is performed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The Linux and OpenBSD sigcontext structures are slightly different
|
||||||
|
* This is the Linux O32 ABI compatible sigcontext
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct sigcontext {
|
||||||
|
unsigned int sc_regmask;
|
||||||
|
unsigned int sc_status;
|
||||||
|
unsigned long long sc_pc;
|
||||||
|
unsigned long long sc_regs[32];
|
||||||
|
unsigned long long sc_fpregs[32];
|
||||||
|
unsigned int sc_acx;
|
||||||
|
unsigned int sc_fpc_csr;
|
||||||
|
unsigned int sc_fpc_eir;
|
||||||
|
unsigned int sc_used_math;
|
||||||
|
unsigned int sc_dsp;
|
||||||
|
unsigned long long sc_mdhi;
|
||||||
|
unsigned long long sc_mdlo;
|
||||||
|
unsigned long sc_hi1;
|
||||||
|
unsigned long sc_lo1;
|
||||||
|
unsigned long sc_hi2;
|
||||||
|
unsigned long sc_lo2;
|
||||||
|
unsigned long sc_hi3;
|
||||||
|
unsigned long sc_lo3;
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
struct sigcontext {
|
||||||
|
long sc_onstack; /* sigstack state to restore */
|
||||||
|
long sc_mask; /* signal mask to restore */
|
||||||
|
__register_t sc_pc; /* pc at time of signal */
|
||||||
|
__register_t sc_regs[32]; /* processor regs 0 to 31 */
|
||||||
|
__register_t mullo; /* mullo and mulhi registers... */
|
||||||
|
__register_t mulhi; /* mullo and mulhi registers... */
|
||||||
|
f_register_t sc_fpregs[33]; /* fp regs 0 to 31 and csr */
|
||||||
|
long sc_fpused; /* fp has been used */
|
||||||
|
long sc_fpc_eir; /* floating point exception instruction reg */
|
||||||
|
long xxx[8]; /* XXX reserved */
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
|
||||||
|
|
||||||
|
#else /* __LANGUAGE_ASSEMBLY */
|
||||||
|
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
|
||||||
|
#define SC_REGMASK (0*REGSZ)
|
||||||
|
#define SC_STATUS (1*REGSZ)
|
||||||
|
#define SC_PC (2*REGSZ)
|
||||||
|
#define SC_REGS (SC_PC+8)
|
||||||
|
#define SC_FPREGS (SC_REGS+32*8)
|
||||||
|
#define SC_ACX (SC_FPREGS+32*REGSZ_FP)
|
||||||
|
#define SC_FPC_CSR (SC_ACX+1*REGSZ)
|
||||||
|
#define SC_FPC_EIR (SC_ACX+2*REGSZ)
|
||||||
|
#define SC_USED_MATH (SC_ACX+3*REGSZ)
|
||||||
|
#define SC_DSP (SC_ACX+4*REGSZ)
|
||||||
|
#define SC_MDHI (SC_ACX+5*REGSZ)
|
||||||
|
#define SC_MDLO (SC_MDHI+8)
|
||||||
|
#define SC_HI1 (SC_MDLO+8)
|
||||||
|
#define SC_LO1 (SC_HI1+1*REGSZ)
|
||||||
|
#define SC_HI2 (SC_HI1+2*REGSZ)
|
||||||
|
#define SC_LO2 (SC_HI1+3*REGSZ)
|
||||||
|
#define SC_HI3 (SC_HI1+4*REGSZ)
|
||||||
|
#define SC_LO3 (SC_HI1+5*REGSZ)
|
||||||
|
/* OpenBSD compatibility */
|
||||||
|
#define SC_MASK SC_REGMASK
|
||||||
|
#define SC_FPUSED SC_USED_MATH
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define SC_ONSTACK (0 * REGSZ)
|
||||||
|
#define SC_MASK (1 * REGSZ)
|
||||||
|
#define SC_PC (2 * REGSZ)
|
||||||
|
#define SC_REGS (3 * REGSZ)
|
||||||
|
#define SC_MULLO (35 * REGSZ)
|
||||||
|
#define SC_MULHI (36 * REGSZ)
|
||||||
|
#define SC_FPREGS (37 * REGSZ)
|
||||||
|
#define SC_FPUSED (70 * REGSZ)
|
||||||
|
#define SC_FPC_EIR (71 * REGSZ)
|
||||||
|
|
||||||
|
#endif /* __ANDROID__ */
|
||||||
|
|
||||||
|
#endif /* __LANGUAGE_ASSEMBLY */
|
||||||
|
|
||||||
|
#endif /* !_MIPS_SIGNAL_H_ */
|
||||||
423
libc/arch-mips/string/memcpy.S
Normal file
423
libc/arch-mips/string/memcpy.S
Normal file
@@ -0,0 +1,423 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009
|
||||||
|
* MIPS Technologies, Inc., California.
|
||||||
|
*
|
||||||
|
* 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 MIPS Technologies, Inc., 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 MIPS TECHNOLOGIES, INC. ``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 MIPS TECHNOLOGIES, INC. 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
*
|
||||||
|
* memcpy.S
|
||||||
|
* Version: "043009"
|
||||||
|
*
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Include files
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
#include "machine/asm.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This routine could be optimized for MIPS64. The current code only
|
||||||
|
* uses MIPS32 instructions.
|
||||||
|
*/
|
||||||
|
#if defined(__MIPSEB__)
|
||||||
|
# define LWHI lwl /* high part is left in big-endian */
|
||||||
|
# define SWHI swl /* high part is left in big-endian */
|
||||||
|
# define LWLO lwr /* low part is right in big-endian */
|
||||||
|
# define SWLO swr /* low part is right in big-endian */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__MIPSEL__)
|
||||||
|
# define LWHI lwr /* high part is right in little-endian */
|
||||||
|
# define SWHI swr /* high part is right in little-endian */
|
||||||
|
# define LWLO lwl /* low part is left in big-endian */
|
||||||
|
# define SWLO swl /* low part is left in big-endian */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
LEAF(memcpy,0)
|
||||||
|
|
||||||
|
.set noreorder
|
||||||
|
.set noat
|
||||||
|
/*
|
||||||
|
* Below we handle the case where memcpy is called with overlapping src and dst.
|
||||||
|
* Although memcpy is not required to handle this case, some parts of Android like Skia
|
||||||
|
* rely on such usage. We call memmove to handle such cases.
|
||||||
|
*/
|
||||||
|
subu t0,a0,a1
|
||||||
|
sra AT,t0,31
|
||||||
|
xor t1,t0,AT
|
||||||
|
subu t0,t1,AT
|
||||||
|
sltu AT,t0,a2
|
||||||
|
beq AT,zero,.Lmemcpy
|
||||||
|
la t9,memmove
|
||||||
|
jr t9
|
||||||
|
nop
|
||||||
|
.Lmemcpy:
|
||||||
|
slti AT,a2,8
|
||||||
|
bne AT,zero,.Llast8
|
||||||
|
move v0,a0 # memcpy returns the dst pointer
|
||||||
|
|
||||||
|
# Test if the src and dst are word-aligned, or can be made word-aligned
|
||||||
|
xor t8,a1,a0
|
||||||
|
andi t8,t8,0x3 # t8 is a0/a1 word-displacement
|
||||||
|
|
||||||
|
bne t8,zero,.Lunaligned
|
||||||
|
negu a3,a0
|
||||||
|
|
||||||
|
andi a3,a3,0x3 # we need to copy a3 bytes to make a0/a1 aligned
|
||||||
|
beq a3,zero,.Lchk16w # when a3=0 then the dst (a0) is word-aligned
|
||||||
|
subu a2,a2,a3 # now a2 is the remining bytes count
|
||||||
|
|
||||||
|
LWHI t8,0(a1)
|
||||||
|
addu a1,a1,a3
|
||||||
|
SWHI t8,0(a0)
|
||||||
|
addu a0,a0,a3
|
||||||
|
|
||||||
|
# Now the dst/src are mutually word-aligned with word-aligned addresses
|
||||||
|
.Lchk16w:
|
||||||
|
andi t8,a2,0x3f # any whole 64-byte chunks?
|
||||||
|
# t8 is the byte count after 64-byte chunks
|
||||||
|
|
||||||
|
beq a2,t8,.Lchk8w # if a2==t8, no 64-byte chunks
|
||||||
|
# There will be at most 1 32-byte chunk after it
|
||||||
|
subu a3,a2,t8 # subtract from a2 the reminder
|
||||||
|
# Here a3 counts bytes in 16w chunks
|
||||||
|
addu a3,a0,a3 # Now a3 is the final dst after 64-byte chunks
|
||||||
|
|
||||||
|
addu t0,a0,a2 # t0 is the "past the end" address
|
||||||
|
|
||||||
|
# When in the loop we exercise "pref 30,x(a0)", the a0+x should not be past
|
||||||
|
# the "t0-32" address
|
||||||
|
# This means: for x=128 the last "safe" a0 address is "t0-160"
|
||||||
|
# Alternatively, for x=64 the last "safe" a0 address is "t0-96"
|
||||||
|
# In the current version we will use "pref 30,128(a0)", so "t0-160" is the limit
|
||||||
|
subu t9,t0,160 # t9 is the "last safe pref 30,128(a0)" address
|
||||||
|
|
||||||
|
pref 0,0(a1) # bring the first line of src, addr 0
|
||||||
|
pref 0,32(a1) # bring the second line of src, addr 32
|
||||||
|
pref 0,64(a1) # bring the third line of src, addr 64
|
||||||
|
pref 30,32(a0) # safe, as we have at least 64 bytes ahead
|
||||||
|
# In case the a0 > t9 don't use "pref 30" at all
|
||||||
|
sgtu v1,a0,t9
|
||||||
|
bgtz v1,.Lloop16w # skip "pref 30,64(a0)" for too short arrays
|
||||||
|
nop
|
||||||
|
# otherwise, start with using pref30
|
||||||
|
pref 30,64(a0)
|
||||||
|
.Lloop16w:
|
||||||
|
pref 0,96(a1)
|
||||||
|
lw t0,0(a1)
|
||||||
|
bgtz v1,.Lskip_pref30_96 # skip "pref 30,96(a0)"
|
||||||
|
lw t1,4(a1)
|
||||||
|
pref 30,96(a0) # continue setting up the dest, addr 96
|
||||||
|
.Lskip_pref30_96:
|
||||||
|
lw t2,8(a1)
|
||||||
|
lw t3,12(a1)
|
||||||
|
lw t4,16(a1)
|
||||||
|
lw t5,20(a1)
|
||||||
|
lw t6,24(a1)
|
||||||
|
lw t7,28(a1)
|
||||||
|
pref 0,128(a1) # bring the next lines of src, addr 128
|
||||||
|
|
||||||
|
sw t0,0(a0)
|
||||||
|
sw t1,4(a0)
|
||||||
|
sw t2,8(a0)
|
||||||
|
sw t3,12(a0)
|
||||||
|
sw t4,16(a0)
|
||||||
|
sw t5,20(a0)
|
||||||
|
sw t6,24(a0)
|
||||||
|
sw t7,28(a0)
|
||||||
|
|
||||||
|
lw t0,32(a1)
|
||||||
|
bgtz v1,.Lskip_pref30_128 # skip "pref 30,128(a0)"
|
||||||
|
lw t1,36(a1)
|
||||||
|
pref 30,128(a0) # continue setting up the dest, addr 128
|
||||||
|
.Lskip_pref30_128:
|
||||||
|
lw t2,40(a1)
|
||||||
|
lw t3,44(a1)
|
||||||
|
lw t4,48(a1)
|
||||||
|
lw t5,52(a1)
|
||||||
|
lw t6,56(a1)
|
||||||
|
lw t7,60(a1)
|
||||||
|
pref 0, 160(a1) # bring the next lines of src, addr 160
|
||||||
|
|
||||||
|
sw t0,32(a0)
|
||||||
|
sw t1,36(a0)
|
||||||
|
sw t2,40(a0)
|
||||||
|
sw t3,44(a0)
|
||||||
|
sw t4,48(a0)
|
||||||
|
sw t5,52(a0)
|
||||||
|
sw t6,56(a0)
|
||||||
|
sw t7,60(a0)
|
||||||
|
|
||||||
|
addiu a0,a0,64 # adding 64 to dest
|
||||||
|
sgtu v1,a0,t9
|
||||||
|
bne a0,a3,.Lloop16w
|
||||||
|
addiu a1,a1,64 # adding 64 to src
|
||||||
|
move a2,t8
|
||||||
|
|
||||||
|
# Here we have src and dest word-aligned but less than 64-bytes to go
|
||||||
|
|
||||||
|
.Lchk8w:
|
||||||
|
pref 0, 0x0(a1)
|
||||||
|
andi t8,a2,0x1f # is there a 32-byte chunk?
|
||||||
|
# the t8 is the reminder count past 32-bytes
|
||||||
|
beq a2,t8,.Lchk1w # when a2=t8, no 32-byte chunk
|
||||||
|
nop
|
||||||
|
|
||||||
|
lw t0,0(a1)
|
||||||
|
lw t1,4(a1)
|
||||||
|
lw t2,8(a1)
|
||||||
|
lw t3,12(a1)
|
||||||
|
lw t4,16(a1)
|
||||||
|
lw t5,20(a1)
|
||||||
|
lw t6,24(a1)
|
||||||
|
lw t7,28(a1)
|
||||||
|
addiu a1,a1,32
|
||||||
|
|
||||||
|
sw t0,0(a0)
|
||||||
|
sw t1,4(a0)
|
||||||
|
sw t2,8(a0)
|
||||||
|
sw t3,12(a0)
|
||||||
|
sw t4,16(a0)
|
||||||
|
sw t5,20(a0)
|
||||||
|
sw t6,24(a0)
|
||||||
|
sw t7,28(a0)
|
||||||
|
addiu a0,a0,32
|
||||||
|
|
||||||
|
.Lchk1w:
|
||||||
|
andi a2,t8,0x3 # now a2 is the reminder past 1w chunks
|
||||||
|
beq a2,t8,.Llast8
|
||||||
|
subu a3,t8,a2 # a3 is count of bytes in 1w chunks
|
||||||
|
addu a3,a0,a3 # now a3 is the dst address past the 1w chunks
|
||||||
|
|
||||||
|
# copying in words (4-byte chunks)
|
||||||
|
.LwordCopy_loop:
|
||||||
|
lw t3,0(a1) # the first t3 may be equal t0 ... optimize?
|
||||||
|
addiu a1,a1,4
|
||||||
|
addiu a0,a0,4
|
||||||
|
bne a0,a3,.LwordCopy_loop
|
||||||
|
sw t3,-4(a0)
|
||||||
|
|
||||||
|
# For the last (<8) bytes
|
||||||
|
.Llast8:
|
||||||
|
blez a2,.Lleave
|
||||||
|
addu a3,a0,a2 # a3 is the last dst address
|
||||||
|
.Llast8loop:
|
||||||
|
lb v1,0(a1)
|
||||||
|
addiu a1,a1,1
|
||||||
|
addiu a0,a0,1
|
||||||
|
bne a0,a3,.Llast8loop
|
||||||
|
sb v1,-1(a0)
|
||||||
|
|
||||||
|
.Lleave:
|
||||||
|
j ra
|
||||||
|
nop
|
||||||
|
|
||||||
|
#
|
||||||
|
# UNALIGNED case
|
||||||
|
#
|
||||||
|
|
||||||
|
.Lunaligned:
|
||||||
|
# got here with a3="negu a0"
|
||||||
|
andi a3,a3,0x3 # test if the a0 is word aligned
|
||||||
|
beqz a3,.Lua_chk16w
|
||||||
|
subu a2,a2,a3 # bytes left after initial a3 bytes
|
||||||
|
|
||||||
|
LWHI v1,0(a1)
|
||||||
|
LWLO v1,3(a1)
|
||||||
|
addu a1,a1,a3 # a3 may be here 1, 2 or 3
|
||||||
|
SWHI v1,0(a0)
|
||||||
|
addu a0,a0,a3 # below the dst will be word aligned (NOTE1)
|
||||||
|
|
||||||
|
.Lua_chk16w:
|
||||||
|
andi t8,a2,0x3f # any whole 64-byte chunks?
|
||||||
|
# t8 is the byte count after 64-byte chunks
|
||||||
|
beq a2,t8,.Lua_chk8w # if a2==t8, no 64-byte chunks
|
||||||
|
# There will be at most 1 32-byte chunk after it
|
||||||
|
subu a3,a2,t8 # subtract from a2 the reminder
|
||||||
|
# Here a3 counts bytes in 16w chunks
|
||||||
|
addu a3,a0,a3 # Now a3 is the final dst after 64-byte chunks
|
||||||
|
|
||||||
|
addu t0,a0,a2 # t0 is the "past the end" address
|
||||||
|
|
||||||
|
subu t9,t0,160 # t9 is the "last safe pref 30,128(a0)" address
|
||||||
|
|
||||||
|
pref 0,0(a1) # bring the first line of src, addr 0
|
||||||
|
pref 0,32(a1) # bring the second line of src, addr 32
|
||||||
|
pref 0,64(a1) # bring the third line of src, addr 64
|
||||||
|
pref 30,32(a0) # safe, as we have at least 64 bytes ahead
|
||||||
|
# In case the a0 > t9 don't use "pref 30" at all
|
||||||
|
sgtu v1,a0,t9
|
||||||
|
bgtz v1,.Lua_loop16w # skip "pref 30,64(a0)" for too short arrays
|
||||||
|
nop
|
||||||
|
# otherwise, start with using pref30
|
||||||
|
pref 30,64(a0)
|
||||||
|
.Lua_loop16w:
|
||||||
|
pref 0,96(a1)
|
||||||
|
LWHI t0,0(a1)
|
||||||
|
LWLO t0,3(a1)
|
||||||
|
LWHI t1,4(a1)
|
||||||
|
bgtz v1,.Lua_skip_pref30_96
|
||||||
|
LWLO t1,7(a1)
|
||||||
|
pref 30,96(a0) # continue setting up the dest, addr 96
|
||||||
|
.Lua_skip_pref30_96:
|
||||||
|
LWHI t2,8(a1)
|
||||||
|
LWLO t2,11(a1)
|
||||||
|
LWHI t3,12(a1)
|
||||||
|
LWLO t3,15(a1)
|
||||||
|
LWHI t4,16(a1)
|
||||||
|
LWLO t4,19(a1)
|
||||||
|
LWHI t5,20(a1)
|
||||||
|
LWLO t5,23(a1)
|
||||||
|
LWHI t6,24(a1)
|
||||||
|
LWLO t6,27(a1)
|
||||||
|
LWHI t7,28(a1)
|
||||||
|
LWLO t7,31(a1)
|
||||||
|
pref 0,128(a1) # bring the next lines of src, addr 128
|
||||||
|
|
||||||
|
sw t0,0(a0)
|
||||||
|
sw t1,4(a0)
|
||||||
|
sw t2,8(a0)
|
||||||
|
sw t3,12(a0)
|
||||||
|
sw t4,16(a0)
|
||||||
|
sw t5,20(a0)
|
||||||
|
sw t6,24(a0)
|
||||||
|
sw t7,28(a0)
|
||||||
|
|
||||||
|
LWHI t0,32(a1)
|
||||||
|
LWLO t0,35(a1)
|
||||||
|
LWHI t1,36(a1)
|
||||||
|
bgtz v1,.Lua_skip_pref30_128
|
||||||
|
LWLO t1,39(a1)
|
||||||
|
pref 30,128(a0) # continue setting up the dest, addr 128
|
||||||
|
.Lua_skip_pref30_128:
|
||||||
|
LWHI t2,40(a1)
|
||||||
|
LWLO t2,43(a1)
|
||||||
|
LWHI t3,44(a1)
|
||||||
|
LWLO t3,47(a1)
|
||||||
|
LWHI t4,48(a1)
|
||||||
|
LWLO t4,51(a1)
|
||||||
|
LWHI t5,52(a1)
|
||||||
|
LWLO t5,55(a1)
|
||||||
|
LWHI t6,56(a1)
|
||||||
|
LWLO t6,59(a1)
|
||||||
|
LWHI t7,60(a1)
|
||||||
|
LWLO t7,63(a1)
|
||||||
|
pref 0, 160(a1) # bring the next lines of src, addr 160
|
||||||
|
|
||||||
|
sw t0,32(a0)
|
||||||
|
sw t1,36(a0)
|
||||||
|
sw t2,40(a0)
|
||||||
|
sw t3,44(a0)
|
||||||
|
sw t4,48(a0)
|
||||||
|
sw t5,52(a0)
|
||||||
|
sw t6,56(a0)
|
||||||
|
sw t7,60(a0)
|
||||||
|
|
||||||
|
addiu a0,a0,64 # adding 64 to dest
|
||||||
|
sgtu v1,a0,t9
|
||||||
|
bne a0,a3,.Lua_loop16w
|
||||||
|
addiu a1,a1,64 # adding 64 to src
|
||||||
|
move a2,t8
|
||||||
|
|
||||||
|
# Here we have src and dest word-aligned but less than 64-bytes to go
|
||||||
|
|
||||||
|
.Lua_chk8w:
|
||||||
|
pref 0, 0x0(a1)
|
||||||
|
andi t8,a2,0x1f # is there a 32-byte chunk?
|
||||||
|
# the t8 is the reminder count
|
||||||
|
beq a2,t8,.Lua_chk1w # when a2=t8, no 32-byte chunk
|
||||||
|
nop
|
||||||
|
|
||||||
|
LWHI t0,0(a1)
|
||||||
|
LWLO t0,3(a1)
|
||||||
|
LWHI t1,4(a1)
|
||||||
|
LWLO t1,7(a1)
|
||||||
|
LWHI t2,8(a1)
|
||||||
|
LWLO t2,11(a1)
|
||||||
|
LWHI t3,12(a1)
|
||||||
|
LWLO t3,15(a1)
|
||||||
|
LWHI t4,16(a1)
|
||||||
|
LWLO t4,19(a1)
|
||||||
|
LWHI t5,20(a1)
|
||||||
|
LWLO t5,23(a1)
|
||||||
|
LWHI t6,24(a1)
|
||||||
|
LWLO t6,27(a1)
|
||||||
|
LWHI t7,28(a1)
|
||||||
|
LWLO t7,31(a1)
|
||||||
|
addiu a1,a1,32
|
||||||
|
|
||||||
|
sw t0,0(a0)
|
||||||
|
sw t1,4(a0)
|
||||||
|
sw t2,8(a0)
|
||||||
|
sw t3,12(a0)
|
||||||
|
sw t4,16(a0)
|
||||||
|
sw t5,20(a0)
|
||||||
|
sw t6,24(a0)
|
||||||
|
sw t7,28(a0)
|
||||||
|
addiu a0,a0,32
|
||||||
|
|
||||||
|
.Lua_chk1w:
|
||||||
|
andi a2,t8,0x3 # now a2 is the reminder past 1w chunks
|
||||||
|
beq a2,t8,.Lua_smallCopy
|
||||||
|
subu a3,t8,a2 # a3 is count of bytes in 1w chunks
|
||||||
|
addu a3,a0,a3 # now a3 is the dst address past the 1w chunks
|
||||||
|
|
||||||
|
# copying in words (4-byte chunks)
|
||||||
|
.Lua_wordCopy_loop:
|
||||||
|
LWHI v1,0(a1)
|
||||||
|
LWLO v1,3(a1)
|
||||||
|
addiu a1,a1,4
|
||||||
|
addiu a0,a0,4 # note: dst=a0 is word aligned here, see NOTE1
|
||||||
|
bne a0,a3,.Lua_wordCopy_loop
|
||||||
|
sw v1,-4(a0)
|
||||||
|
|
||||||
|
# Now less than 4 bytes (value in a2) left to copy
|
||||||
|
.Lua_smallCopy:
|
||||||
|
beqz a2,.Lleave
|
||||||
|
addu a3,a0,a2 # a3 is the last dst address
|
||||||
|
.Lua_smallCopy_loop:
|
||||||
|
lb v1,0(a1)
|
||||||
|
addiu a1,a1,1
|
||||||
|
addiu a0,a0,1
|
||||||
|
bne a0,a3,.Lua_smallCopy_loop
|
||||||
|
sb v1,-1(a0)
|
||||||
|
|
||||||
|
j ra
|
||||||
|
nop
|
||||||
|
|
||||||
|
.set at
|
||||||
|
.set reorder
|
||||||
|
|
||||||
|
END(memcpy)
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Implementation : Static functions
|
||||||
|
************************************************************************/
|
||||||
323
libc/arch-mips/string/memset.S
Normal file
323
libc/arch-mips/string/memset.S
Normal file
@@ -0,0 +1,323 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009
|
||||||
|
* MIPS Technologies, Inc., California.
|
||||||
|
*
|
||||||
|
* 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 MIPS Technologies, Inc., 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 MIPS TECHNOLOGIES, INC. ``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 MIPS TECHNOLOGIES, INC. 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
*
|
||||||
|
* memset.S, version "64h" with 1 cache line horizon for "pref 30" and 14 nops
|
||||||
|
* Version: "043009"
|
||||||
|
*
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Include files
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
#include "machine/asm.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This routine could be optimized for MIPS64. The current code only
|
||||||
|
* uses MIPS32 instructions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__MIPSEB__)
|
||||||
|
# define SWHI swl /* high part is left in big-endian */
|
||||||
|
# define SWLO swr /* low part is right in big-endian */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__MIPSEL__)
|
||||||
|
# define SWHI swr /* high part is right in little-endian */
|
||||||
|
# define SWLO swl /* low part is left in little-endian */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !(defined(XGPROF) || defined(XPROF))
|
||||||
|
#undef SETUP_GP
|
||||||
|
#define SETUP_GP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#define DBG #
|
||||||
|
#else
|
||||||
|
#define DBG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* void _memset16(uint16_t* dst, uint16_t value, size_t size);
|
||||||
|
*/
|
||||||
|
|
||||||
|
LEAF(_memset16,0)
|
||||||
|
.set noreorder
|
||||||
|
DBG /* Check parameters */
|
||||||
|
DBG andi t0,a0,1 # a0 must be halfword aligned
|
||||||
|
DBG tne t0,zero
|
||||||
|
DBG andi t2,a2,1 # a2 must be even
|
||||||
|
DBG tne t2,zero
|
||||||
|
|
||||||
|
#ifdef FIXARGS
|
||||||
|
# ensure count is even
|
||||||
|
#if (__mips==32) && (__mips_isa_rev>=2)
|
||||||
|
ins a2,zero,0,1
|
||||||
|
#else
|
||||||
|
ori a2,1
|
||||||
|
xori a2,1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (__mips==32) && (__mips_isa_rev>=2)
|
||||||
|
ins a1,a1,16,16
|
||||||
|
#else
|
||||||
|
andi a1,0xffff
|
||||||
|
sll t3,a1,16
|
||||||
|
or a1,t3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
beqz a2,.Ldone
|
||||||
|
andi t1,a0,2
|
||||||
|
beqz t1,.Lalignok
|
||||||
|
addu t0,a0,a2 # t0 is the "past the end" address
|
||||||
|
sh a1,0(a0) # store one halfword to get aligned
|
||||||
|
addu a0,2
|
||||||
|
subu a2,2
|
||||||
|
.Lalignok:
|
||||||
|
slti t1,a2,4 # .Laligned for 4 or more bytes
|
||||||
|
beqz t1,.Laligned
|
||||||
|
sne t1,a2,2 # one more halfword?
|
||||||
|
bnez t1,.Ldone
|
||||||
|
nop
|
||||||
|
sh a1,0(a0)
|
||||||
|
.Ldone:
|
||||||
|
j ra
|
||||||
|
nop
|
||||||
|
.set reorder
|
||||||
|
END(_memset16)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* void _memset32(uint32_t* dst, uint32_t value, size_t size);
|
||||||
|
*/
|
||||||
|
|
||||||
|
LEAF(_memset32,0)
|
||||||
|
.set noreorder
|
||||||
|
DBG /* Check parameters */
|
||||||
|
DBG andi t0,a0,3 # a0 must be word aligned
|
||||||
|
DBG tne t0,zero
|
||||||
|
DBG andi t2,a2,3 # a2 must be a multiple of 4 bytes
|
||||||
|
DBG tne t2,zero
|
||||||
|
|
||||||
|
#ifdef FIXARGS
|
||||||
|
# ensure count is a multiple of 4
|
||||||
|
#if (__mips==32) && (__mips_isa_rev>=2)
|
||||||
|
ins $a2,$0,0,2
|
||||||
|
#else
|
||||||
|
ori a2,3
|
||||||
|
xori a2,3
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bnez a2,.Laligned # any work to do?
|
||||||
|
addu t0,a0,a2 # t0 is the "past the end" address
|
||||||
|
|
||||||
|
j ra
|
||||||
|
nop
|
||||||
|
.set reorder
|
||||||
|
END(_memset32)
|
||||||
|
|
||||||
|
LEAF(memset,0)
|
||||||
|
|
||||||
|
.set noreorder
|
||||||
|
.set noat
|
||||||
|
|
||||||
|
addu t0,a0,a2 # t0 is the "past the end" address
|
||||||
|
slti AT,a2,4 # is a2 less than 4?
|
||||||
|
bne AT,zero,.Llast4 # if yes, go to last4
|
||||||
|
move v0,a0 # memset returns the dst pointer
|
||||||
|
|
||||||
|
beq a1,zero,.Lset0
|
||||||
|
subu v1,zero,a0
|
||||||
|
|
||||||
|
# smear byte into 32 bit word
|
||||||
|
#if (__mips==32) && (__mips_isa_rev>=2)
|
||||||
|
ins a1, a1, 8, 8 # Replicate fill byte into half-word.
|
||||||
|
ins a1, a1, 16, 16 # Replicate fill byte into word.
|
||||||
|
#else
|
||||||
|
and a1,0xff
|
||||||
|
sll AT,a1,8
|
||||||
|
or a1,AT
|
||||||
|
sll AT,a1,16
|
||||||
|
or a1,AT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.Lset0:
|
||||||
|
andi v1,v1,0x3 # word-unaligned address?
|
||||||
|
beq v1,zero,.Laligned # v1 is the unalignment count
|
||||||
|
subu a2,a2,v1
|
||||||
|
SWHI a1,0(a0)
|
||||||
|
addu a0,a0,v1
|
||||||
|
|
||||||
|
# Here we have the "word-aligned" a0 (until the "last4")
|
||||||
|
.Laligned:
|
||||||
|
andi t8,a2,0x3f # any 64-byte chunks?
|
||||||
|
# t8 is the byte count past 64-byte chunks
|
||||||
|
beq a2,t8,.Lchk8w # when a2==t8, no 64-byte chunks
|
||||||
|
# There will be at most 1 32-byte chunk then
|
||||||
|
subu a3,a2,t8 # subtract from a2 the reminder
|
||||||
|
# Here a3 counts bytes in 16w chunks
|
||||||
|
addu a3,a0,a3 # Now a3 is the final dst after 64-byte chunks
|
||||||
|
|
||||||
|
# Find out, if there are any 64-byte chunks after which will be still at least
|
||||||
|
# 96 bytes left. The value "96" is calculated as needed buffer for
|
||||||
|
# "pref 30,64(a0)" prefetch, which can be used as "pref 30,0(a0)" after
|
||||||
|
# incrementing "a0" by 64.
|
||||||
|
# For "a2" below 160 there will be no such "pref 30 safe" 64-byte chunk.
|
||||||
|
#
|
||||||
|
sltiu v1,a2,160
|
||||||
|
bgtz v1,.Lloop16w_nopref30 # skip "pref 30,0(a0)"
|
||||||
|
subu t7,a2,96 # subtract "pref 30 unsafe" region
|
||||||
|
# below we have at least 1 64-byte chunk which is "pref 30 safe"
|
||||||
|
andi t6,t7,0x3f # t6 is past "64-byte safe chunks" reminder
|
||||||
|
subu t5,t7,t6 # subtract from t7 the reminder
|
||||||
|
# Here t5 counts bytes in 16w "safe" chunks
|
||||||
|
addu t4,a0,t5 # Now t4 is the dst after 64-byte "safe" chunks
|
||||||
|
|
||||||
|
# Don't use "pref 30,0(a0)" for a0 in a "middle" of a cache line
|
||||||
|
# pref 30,0(a0)
|
||||||
|
# Here we are in the region, where it is safe to use "pref 30,64(a0)"
|
||||||
|
.Lloop16w:
|
||||||
|
addiu a0,a0,64
|
||||||
|
pref 30,-32(a0) # continue setting up the dest, addr 64-32
|
||||||
|
sw a1,-64(a0)
|
||||||
|
sw a1,-60(a0)
|
||||||
|
sw a1,-56(a0)
|
||||||
|
sw a1,-52(a0)
|
||||||
|
sw a1,-48(a0)
|
||||||
|
sw a1,-44(a0)
|
||||||
|
sw a1,-40(a0)
|
||||||
|
sw a1,-36(a0)
|
||||||
|
nop
|
||||||
|
nop # the extra nop instructions help to balance
|
||||||
|
nop # cycles needed for "store" + "fill" + "evict"
|
||||||
|
nop # For 64byte store there are needed 8 fill
|
||||||
|
nop # and 8 evict cycles, i.e. at least 32 instr.
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
pref 30,0(a0) # continue setting up the dest, addr 64-0
|
||||||
|
sw a1,-32(a0)
|
||||||
|
sw a1,-28(a0)
|
||||||
|
sw a1,-24(a0)
|
||||||
|
sw a1,-20(a0)
|
||||||
|
sw a1,-16(a0)
|
||||||
|
sw a1,-12(a0)
|
||||||
|
sw a1,-8(a0)
|
||||||
|
sw a1,-4(a0)
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop # NOTE: adding 14 nop-s instead of 12 nop-s
|
||||||
|
nop # gives better results for "fast" memory
|
||||||
|
nop
|
||||||
|
bne a0,t4,.Lloop16w
|
||||||
|
nop
|
||||||
|
|
||||||
|
beq a0,a3,.Lchk8w # maybe no more 64-byte chunks?
|
||||||
|
nop # this "delayed slot" is useless ...
|
||||||
|
|
||||||
|
.Lloop16w_nopref30: # there could be up to 3 "64-byte nopref30" chunks
|
||||||
|
addiu a0,a0,64
|
||||||
|
sw a1,-64(a0)
|
||||||
|
sw a1,-60(a0)
|
||||||
|
sw a1,-56(a0)
|
||||||
|
sw a1,-52(a0)
|
||||||
|
sw a1,-48(a0)
|
||||||
|
sw a1,-44(a0)
|
||||||
|
sw a1,-40(a0)
|
||||||
|
sw a1,-36(a0)
|
||||||
|
sw a1,-32(a0)
|
||||||
|
sw a1,-28(a0)
|
||||||
|
sw a1,-24(a0)
|
||||||
|
sw a1,-20(a0)
|
||||||
|
sw a1,-16(a0)
|
||||||
|
sw a1,-12(a0)
|
||||||
|
sw a1,-8(a0)
|
||||||
|
bne a0,a3,.Lloop16w_nopref30
|
||||||
|
sw a1,-4(a0)
|
||||||
|
|
||||||
|
.Lchk8w: # t8 here is the byte count past 64-byte chunks
|
||||||
|
|
||||||
|
andi t7,t8,0x1f # is there a 32-byte chunk?
|
||||||
|
# the t7 is the reminder count past 32-bytes
|
||||||
|
beq t8,t7,.Lchk1w # when t8==t7, no 32-byte chunk
|
||||||
|
move a2,t7
|
||||||
|
|
||||||
|
sw a1,0(a0)
|
||||||
|
sw a1,4(a0)
|
||||||
|
sw a1,8(a0)
|
||||||
|
sw a1,12(a0)
|
||||||
|
sw a1,16(a0)
|
||||||
|
sw a1,20(a0)
|
||||||
|
sw a1,24(a0)
|
||||||
|
sw a1,28(a0)
|
||||||
|
addiu a0,a0,32
|
||||||
|
|
||||||
|
.Lchk1w:
|
||||||
|
andi t8,a2,0x3 # now t8 is the reminder past 1w chunks
|
||||||
|
beq a2,t8,.Llast4aligned
|
||||||
|
subu a3,a2,t8 # a3 is the count of bytes in 1w chunks
|
||||||
|
addu a3,a0,a3 # now a3 is the dst address past the 1w chunks
|
||||||
|
|
||||||
|
# copying in words (4-byte chunks)
|
||||||
|
.LwordCopy_loop:
|
||||||
|
addiu a0,a0,4
|
||||||
|
bne a0,a3,.LwordCopy_loop
|
||||||
|
sw a1,-4(a0)
|
||||||
|
|
||||||
|
# store last 0-3 bytes
|
||||||
|
# this will repeat the last store if the memset finishes on a word boundary
|
||||||
|
.Llast4aligned:
|
||||||
|
j ra
|
||||||
|
SWLO a1,-1(t0)
|
||||||
|
|
||||||
|
.Llast4:
|
||||||
|
beq a0,t0,.Llast4e
|
||||||
|
.Llast4l:
|
||||||
|
addiu a0,a0,1
|
||||||
|
bne a0,t0,.Llast4l
|
||||||
|
sb a1,-1(a0)
|
||||||
|
.Llast4e:
|
||||||
|
j ra
|
||||||
|
nop
|
||||||
|
|
||||||
|
.set at
|
||||||
|
.set reorder
|
||||||
|
|
||||||
|
END(memset)
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Implementation : Static functions
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
148
libc/arch-mips/string/mips-string-ops.h
Normal file
148
libc/arch-mips/string/mips-string-ops.h
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010 MIPS Technologies, Inc.
|
||||||
|
*
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
* * Neither the name of MIPS Technologies Inc. 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
|
||||||
|
* OWNER 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 __MIPS_STRING_OPS_H
|
||||||
|
#define __MIPS_STRING_OPS_H
|
||||||
|
/* This definition of the byte bitfields uses the
|
||||||
|
assumption that the layout of the bitfields is
|
||||||
|
equivalent to the layout in memory. Generally,
|
||||||
|
for the MIPS ABIs, this is true. If you compile
|
||||||
|
the strcmp.c file with -DSMOKE_TEST_NEW_STRCMP,
|
||||||
|
this assumption will be tested.
|
||||||
|
|
||||||
|
Also, regardless of char signedness, ANSI C dictates that
|
||||||
|
strcmp() treats each character as unsigned char. For
|
||||||
|
strlen and the like, signedness doesn't matter.
|
||||||
|
|
||||||
|
Also, this code assumes that there are 8-bits per 'char'. */
|
||||||
|
|
||||||
|
#if __mips64
|
||||||
|
typedef struct bits
|
||||||
|
{
|
||||||
|
unsigned B0:8, B1:8, B2:8, B3:8, B4:8, B5:8, B6:8, B7:8;
|
||||||
|
} bits_t;
|
||||||
|
#else
|
||||||
|
typedef struct bits
|
||||||
|
{
|
||||||
|
unsigned B0:8, B1:8, B2:8, B3:8;
|
||||||
|
} bits_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _ULW
|
||||||
|
/* for MIPS GCC, there is no unaligned builtins - so this code forces
|
||||||
|
the compiler to treat the pointer access as unaligned. */
|
||||||
|
struct ulw
|
||||||
|
{
|
||||||
|
unsigned b;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
#define _ULW(__x) ((struct ulw *) ((char *)(&__x)))->b;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This union assumes that small structures can be in registers. If
|
||||||
|
not, then memory accesses will be done - not optimal, but ok. */
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
unsigned v;
|
||||||
|
bits_t b;
|
||||||
|
} bitfields_t;
|
||||||
|
|
||||||
|
#ifndef detect_zero
|
||||||
|
/* __mips_dsp, __mips_dspr2, and __mips64 are predefined by
|
||||||
|
the compiler, based on command line options. */
|
||||||
|
#if (__mips_dsp || __mips_dspr2) && !__mips64
|
||||||
|
#define __mips_using_dsp 1
|
||||||
|
|
||||||
|
/* DSP 4-lane (8 unsigned bits per line) subtract and saturate
|
||||||
|
* Intrinsic operation. How this works:
|
||||||
|
* Given a 4-byte string of "ABC\0", subtract this as
|
||||||
|
* an unsigned integer from 0x01010101:
|
||||||
|
* 0x01010101
|
||||||
|
* - 0x41424300
|
||||||
|
* -----------
|
||||||
|
( 0xbfbebe01 <-- answer without saturation
|
||||||
|
* 0x00000001 <-- answer with saturation
|
||||||
|
* When this 4-lane vector is treated as an unsigned int value,
|
||||||
|
* a non-zero answer indicates the presence of a zero in the
|
||||||
|
* original 4-byte argument. */
|
||||||
|
|
||||||
|
typedef signed char v4i8 __attribute__ ((vector_size (4)));
|
||||||
|
|
||||||
|
#define detect_zero(__x,__y,__01s,__80s)\
|
||||||
|
((unsigned) __builtin_mips_subu_s_qb((v4i8) __01s,(v4i8) __x))
|
||||||
|
|
||||||
|
/* sets all 4 lanes to requested byte. */
|
||||||
|
#define set_byte_lanes(__x) ((unsigned) __builtin_mips_repl_qb(__x))
|
||||||
|
|
||||||
|
/* sets all 4 lanes to 0x01. */
|
||||||
|
#define def_and_set_01(__x) unsigned __x = (unsigned) __builtin_mips_repl_qb(0x01)
|
||||||
|
|
||||||
|
/* sets all 4 lanes to 0x80. Not needed when subu_s.qb used. */
|
||||||
|
#define def_and_set_80(__x) /* do nothing */
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* this version, originally published in the 80's, uses
|
||||||
|
a reverse-carry-set like determination of the zero byte.
|
||||||
|
The steps are, for __x = 0x31ff0001:
|
||||||
|
__x - _01s = 0x30fdff00
|
||||||
|
~__x = 0xce00fffe
|
||||||
|
((__x - _01s) & ~__x) = 0x0000ff00
|
||||||
|
x & _80s = 0x00008000 <- byte 3 was zero
|
||||||
|
Some implementaions naively assume that characters are
|
||||||
|
always 7-bit unsigned ASCII. With that assumption, the
|
||||||
|
"& ~x" is usually discarded. Since character strings
|
||||||
|
are 8-bit, the and is needed to catch the case of
|
||||||
|
a false positive when the byte is 0x80. */
|
||||||
|
|
||||||
|
#define detect_zero(__x,__y,_01s,_80s)\
|
||||||
|
((unsigned) (((__x) - _01s) & ~(__x)) & _80s)
|
||||||
|
|
||||||
|
#if __mips64
|
||||||
|
#define def_and_set_80(__x) unsigned __x = 0x8080808080808080ul
|
||||||
|
#define def_and_set_01(__x) unsigned __x = 0x0101010101010101ul
|
||||||
|
#else
|
||||||
|
#define def_and_set_80(__x) unsigned __x = 0x80808080ul
|
||||||
|
#define def_and_set_01(__x) unsigned __x = 0x01010101ul
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* dealing with 'void *' conversions without using extra variables. */
|
||||||
|
#define get_byte(__x,__idx) (((unsigned char *) (__x))[__idx])
|
||||||
|
#define set_byte(__x,__idx,__fill) ((unsigned char *) (__x))[__idx] = (__fill)
|
||||||
|
#define get_word(__x,__idx) (((unsigned *) (__x))[__idx])
|
||||||
|
#define set_word(__x,__idx,__fill) ((unsigned *) (__x))[__idx] = (__fill)
|
||||||
|
#define inc_ptr_as(__type,__x,__inc) __x = (void *) (((__type) __x) + (__inc))
|
||||||
|
#define cvt_ptr_to(__type,__x) ((__type) (__x))
|
||||||
|
|
||||||
|
#endif
|
||||||
223
libc/arch-mips/string/mips_strlen.c
Normal file
223
libc/arch-mips/string/mips_strlen.c
Normal file
@@ -0,0 +1,223 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010 MIPS Technologies, Inc.
|
||||||
|
*
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
* * Neither the name of MIPS Technologies Inc. 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
|
||||||
|
* OWNER 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 "mips-string-ops.h"
|
||||||
|
|
||||||
|
#define do_strlen_word(__av) {\
|
||||||
|
if (detect_zero(x,x,_01s,_80s)) break;\
|
||||||
|
x = __av;\
|
||||||
|
cnt += sizeof (unsigned);\
|
||||||
|
}
|
||||||
|
|
||||||
|
#define do_strlen_byte(__x) {\
|
||||||
|
if ((bx.b.B##__x) == 0) break;\
|
||||||
|
++cnt;\
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SMOKE_TEST_MIPS_STRLEN
|
||||||
|
#define strlen my_strlen
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int
|
||||||
|
strlen (const void *_a)
|
||||||
|
{
|
||||||
|
int cnt = 0;
|
||||||
|
unsigned x;
|
||||||
|
|
||||||
|
/* align the string to word boundary so we can do word at a time. */
|
||||||
|
if ((cvt_ptr_to (unsigned, _a) & (sizeof (unsigned) - 1)) != 0)
|
||||||
|
{
|
||||||
|
if ((cvt_ptr_to (unsigned, _a) & 1) != 0)
|
||||||
|
{
|
||||||
|
if (get_byte (_a, 0) == 0)
|
||||||
|
return cnt;
|
||||||
|
/* set bit 1 so 2-bytes are checked and incremented. */
|
||||||
|
inc_ptr_as (char *, _a, 1);
|
||||||
|
++cnt;
|
||||||
|
}
|
||||||
|
if ((cvt_ptr_to (unsigned, _a) & 2) != 0)
|
||||||
|
{
|
||||||
|
if (get_byte (_a, 0) == 0)
|
||||||
|
return cnt + 0;
|
||||||
|
if (get_byte (_a, 1) == 0)
|
||||||
|
return cnt + 1;
|
||||||
|
inc_ptr_as (char *, _a, 2);
|
||||||
|
cnt += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if __mips64
|
||||||
|
#error strlen: mips64 check for 4-byte alignment not implemented.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (1)
|
||||||
|
{
|
||||||
|
def_and_set_01 (_01s);
|
||||||
|
def_and_set_80 (_80s);
|
||||||
|
|
||||||
|
/* as advantagous as it is to performance, this code cannot pre-load
|
||||||
|
the following word, nor can it prefetch the next line at the start
|
||||||
|
of the loop since the string can be at the end of a page with the
|
||||||
|
following page unmapped. There are tests in the suite to catch
|
||||||
|
any attempt to go beyond the current word. */
|
||||||
|
x = get_word (_a, 0);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* doing 8 words should cover most strings. */
|
||||||
|
do_strlen_word (get_word (_a, 1));
|
||||||
|
do_strlen_word (get_word (_a, 2));
|
||||||
|
do_strlen_word (get_word (_a, 3));
|
||||||
|
do_strlen_word (get_word (_a, 4));
|
||||||
|
do_strlen_word (get_word (_a, 5));
|
||||||
|
do_strlen_word (get_word (_a, 6));
|
||||||
|
do_strlen_word (get_word (_a, 7));
|
||||||
|
do_strlen_word (get_word (_a, 8));
|
||||||
|
inc_ptr_as (unsigned *, _a, 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* pull apart the last word processed and find the zero. */
|
||||||
|
bitfields_t bx;
|
||||||
|
bx.v = x;
|
||||||
|
#if __mips64
|
||||||
|
do_strlen_byte (0);
|
||||||
|
do_strlen_byte (1);
|
||||||
|
do_strlen_byte (2);
|
||||||
|
do_strlen_byte (3);
|
||||||
|
do_strlen_byte (4);
|
||||||
|
do_strlen_byte (5);
|
||||||
|
do_strlen_byte (6);
|
||||||
|
#else
|
||||||
|
do_strlen_byte (0);
|
||||||
|
do_strlen_byte (1);
|
||||||
|
do_strlen_byte (2);
|
||||||
|
#endif
|
||||||
|
/* last byte is zero */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef do_strlen_byte
|
||||||
|
#undef do_strlen_word
|
||||||
|
|
||||||
|
#if SMOKE_TEST_MIPS_STRLEN
|
||||||
|
#include <stdio.h>
|
||||||
|
char str1[] = "DHRYSTONE PROGRAM, 1'ST STRING";
|
||||||
|
char str2[] = "DHRYSTONE PROGRAM, 2'ST STRING";
|
||||||
|
|
||||||
|
char str3[] = "another string";
|
||||||
|
char str4[] = "another";
|
||||||
|
|
||||||
|
char str5[] = "somes tring";
|
||||||
|
char str6[] = "somes_tring";
|
||||||
|
|
||||||
|
char str7[16], str8[16];
|
||||||
|
|
||||||
|
static char *
|
||||||
|
chk (unsigned mine, unsigned libs, int *errors)
|
||||||
|
{
|
||||||
|
static char answer[1024];
|
||||||
|
char *result = mine == libs ? "PASS" : "FAIL";
|
||||||
|
sprintf (answer, "new_strlen=%d: lib_strlen=%d: %s!", mine, libs, result);
|
||||||
|
if (mine != libs)
|
||||||
|
(*errors)++;
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
int errors = 0;
|
||||||
|
/* set -1 in one position */
|
||||||
|
str6[5] = 0xff;
|
||||||
|
/* set zero in same position with junk in following 3 */
|
||||||
|
str7[0] = str8[0] = 0;
|
||||||
|
str7[1] = 0xff;
|
||||||
|
str7[2] = 'a';
|
||||||
|
str7[3] = 2;
|
||||||
|
str8[1] = 's';
|
||||||
|
str8[2] = -2;
|
||||||
|
str8[3] = 0;
|
||||||
|
|
||||||
|
fprintf (stderr, "========== mips_strlen%s test...\n",
|
||||||
|
argv[0] ? argv[0] : "unknown strlen");
|
||||||
|
#define P(__x,__y) {\
|
||||||
|
int a = my_strlen(__x + __y);\
|
||||||
|
int b = (strlen)(__x + __y) /* library version */;\
|
||||||
|
fprintf(stderr,"%s+%d: %s\n",#__x,__y,chk(a,b,&errors));\
|
||||||
|
}
|
||||||
|
|
||||||
|
P (str1, 0);
|
||||||
|
P (str1, 1);
|
||||||
|
P (str1, 2);
|
||||||
|
P (str1, 3);
|
||||||
|
|
||||||
|
P (str2, 0);
|
||||||
|
P (str2, 1);
|
||||||
|
P (str2, 2);
|
||||||
|
P (str2, 3);
|
||||||
|
|
||||||
|
P (str3, 0);
|
||||||
|
P (str3, 1);
|
||||||
|
P (str3, 2);
|
||||||
|
P (str3, 3);
|
||||||
|
|
||||||
|
P (str4, 0);
|
||||||
|
P (str4, 1);
|
||||||
|
P (str4, 2);
|
||||||
|
P (str4, 3);
|
||||||
|
|
||||||
|
P (str5, 0);
|
||||||
|
P (str5, 1);
|
||||||
|
P (str5, 2);
|
||||||
|
P (str5, 3);
|
||||||
|
|
||||||
|
P (str6, 0);
|
||||||
|
P (str6, 1);
|
||||||
|
P (str6, 2);
|
||||||
|
P (str6, 3);
|
||||||
|
|
||||||
|
P (str7, 0);
|
||||||
|
P (str7, 1);
|
||||||
|
P (str7, 2);
|
||||||
|
P (str7, 3);
|
||||||
|
|
||||||
|
P (str8, 0);
|
||||||
|
P (str8, 1);
|
||||||
|
P (str8, 2);
|
||||||
|
P (str8, 3);
|
||||||
|
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -19,6 +19,7 @@ syscall_src += arch-mips/syscalls/readahead.S
|
|||||||
syscall_src += arch-mips/syscalls/getgroups.S
|
syscall_src += arch-mips/syscalls/getgroups.S
|
||||||
syscall_src += arch-mips/syscalls/getpgid.S
|
syscall_src += arch-mips/syscalls/getpgid.S
|
||||||
syscall_src += arch-mips/syscalls/getppid.S
|
syscall_src += arch-mips/syscalls/getppid.S
|
||||||
|
syscall_src += arch-mips/syscalls/getsid.S
|
||||||
syscall_src += arch-mips/syscalls/setsid.S
|
syscall_src += arch-mips/syscalls/setsid.S
|
||||||
syscall_src += arch-mips/syscalls/setgid.S
|
syscall_src += arch-mips/syscalls/setgid.S
|
||||||
syscall_src += arch-mips/syscalls/__setreuid.S
|
syscall_src += arch-mips/syscalls/__setreuid.S
|
||||||
@@ -27,6 +28,7 @@ syscall_src += arch-mips/syscalls/setresgid.S
|
|||||||
syscall_src += arch-mips/syscalls/__brk.S
|
syscall_src += arch-mips/syscalls/__brk.S
|
||||||
syscall_src += arch-mips/syscalls/kill.S
|
syscall_src += arch-mips/syscalls/kill.S
|
||||||
syscall_src += arch-mips/syscalls/tkill.S
|
syscall_src += arch-mips/syscalls/tkill.S
|
||||||
|
syscall_src += arch-mips/syscalls/tgkill.S
|
||||||
syscall_src += arch-mips/syscalls/__ptrace.S
|
syscall_src += arch-mips/syscalls/__ptrace.S
|
||||||
syscall_src += arch-mips/syscalls/__set_thread_area.S
|
syscall_src += arch-mips/syscalls/__set_thread_area.S
|
||||||
syscall_src += arch-mips/syscalls/__getpriority.S
|
syscall_src += arch-mips/syscalls/__getpriority.S
|
||||||
@@ -61,6 +63,8 @@ syscall_src += arch-mips/syscalls/mprotect.S
|
|||||||
syscall_src += arch-mips/syscalls/madvise.S
|
syscall_src += arch-mips/syscalls/madvise.S
|
||||||
syscall_src += arch-mips/syscalls/mlock.S
|
syscall_src += arch-mips/syscalls/mlock.S
|
||||||
syscall_src += arch-mips/syscalls/munlock.S
|
syscall_src += arch-mips/syscalls/munlock.S
|
||||||
|
syscall_src += arch-mips/syscalls/mlockall.S
|
||||||
|
syscall_src += arch-mips/syscalls/munlockall.S
|
||||||
syscall_src += arch-mips/syscalls/mincore.S
|
syscall_src += arch-mips/syscalls/mincore.S
|
||||||
syscall_src += arch-mips/syscalls/__ioctl.S
|
syscall_src += arch-mips/syscalls/__ioctl.S
|
||||||
syscall_src += arch-mips/syscalls/readv.S
|
syscall_src += arch-mips/syscalls/readv.S
|
||||||
@@ -110,6 +114,7 @@ syscall_src += arch-mips/syscalls/rmdir.S
|
|||||||
syscall_src += arch-mips/syscalls/rename.S
|
syscall_src += arch-mips/syscalls/rename.S
|
||||||
syscall_src += arch-mips/syscalls/__getcwd.S
|
syscall_src += arch-mips/syscalls/__getcwd.S
|
||||||
syscall_src += arch-mips/syscalls/access.S
|
syscall_src += arch-mips/syscalls/access.S
|
||||||
|
syscall_src += arch-mips/syscalls/faccessat.S
|
||||||
syscall_src += arch-mips/syscalls/symlink.S
|
syscall_src += arch-mips/syscalls/symlink.S
|
||||||
syscall_src += arch-mips/syscalls/fchdir.S
|
syscall_src += arch-mips/syscalls/fchdir.S
|
||||||
syscall_src += arch-mips/syscalls/truncate.S
|
syscall_src += arch-mips/syscalls/truncate.S
|
||||||
@@ -122,6 +127,7 @@ syscall_src += arch-mips/syscalls/llistxattr.S
|
|||||||
syscall_src += arch-mips/syscalls/removexattr.S
|
syscall_src += arch-mips/syscalls/removexattr.S
|
||||||
syscall_src += arch-mips/syscalls/lremovexattr.S
|
syscall_src += arch-mips/syscalls/lremovexattr.S
|
||||||
syscall_src += arch-mips/syscalls/__statfs64.S
|
syscall_src += arch-mips/syscalls/__statfs64.S
|
||||||
|
syscall_src += arch-mips/syscalls/unshare.S
|
||||||
syscall_src += arch-mips/syscalls/pause.S
|
syscall_src += arch-mips/syscalls/pause.S
|
||||||
syscall_src += arch-mips/syscalls/gettimeofday.S
|
syscall_src += arch-mips/syscalls/gettimeofday.S
|
||||||
syscall_src += arch-mips/syscalls/settimeofday.S
|
syscall_src += arch-mips/syscalls/settimeofday.S
|
||||||
@@ -185,6 +191,7 @@ syscall_src += arch-mips/syscalls/delete_module.S
|
|||||||
syscall_src += arch-mips/syscalls/klogctl.S
|
syscall_src += arch-mips/syscalls/klogctl.S
|
||||||
syscall_src += arch-mips/syscalls/sysinfo.S
|
syscall_src += arch-mips/syscalls/sysinfo.S
|
||||||
syscall_src += arch-mips/syscalls/personality.S
|
syscall_src += arch-mips/syscalls/personality.S
|
||||||
|
syscall_src += arch-mips/syscalls/perf_event_open.S
|
||||||
syscall_src += arch-mips/syscalls/futex.S
|
syscall_src += arch-mips/syscalls/futex.S
|
||||||
syscall_src += arch-mips/syscalls/epoll_create.S
|
syscall_src += arch-mips/syscalls/epoll_create.S
|
||||||
syscall_src += arch-mips/syscalls/epoll_ctl.S
|
syscall_src += arch-mips/syscalls/epoll_ctl.S
|
||||||
|
|||||||
22
libc/arch-mips/syscalls/faccessat.S
Normal file
22
libc/arch-mips/syscalls/faccessat.S
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
.text
|
||||||
|
.globl faccessat
|
||||||
|
.align 4
|
||||||
|
.ent faccessat
|
||||||
|
|
||||||
|
faccessat:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
li $v0, __NR_faccessat
|
||||||
|
syscall
|
||||||
|
bnez $a3, 1f
|
||||||
|
move $a0, $v0
|
||||||
|
j $ra
|
||||||
|
nop
|
||||||
|
1:
|
||||||
|
la $t9,__set_errno
|
||||||
|
j $t9
|
||||||
|
nop
|
||||||
|
.set reorder
|
||||||
|
.end faccessat
|
||||||
22
libc/arch-mips/syscalls/getsid.S
Normal file
22
libc/arch-mips/syscalls/getsid.S
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
.text
|
||||||
|
.globl getsid
|
||||||
|
.align 4
|
||||||
|
.ent getsid
|
||||||
|
|
||||||
|
getsid:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
li $v0, __NR_getsid
|
||||||
|
syscall
|
||||||
|
bnez $a3, 1f
|
||||||
|
move $a0, $v0
|
||||||
|
j $ra
|
||||||
|
nop
|
||||||
|
1:
|
||||||
|
la $t9,__set_errno
|
||||||
|
j $t9
|
||||||
|
nop
|
||||||
|
.set reorder
|
||||||
|
.end getsid
|
||||||
22
libc/arch-mips/syscalls/mlockall.S
Normal file
22
libc/arch-mips/syscalls/mlockall.S
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
.text
|
||||||
|
.globl mlockall
|
||||||
|
.align 4
|
||||||
|
.ent mlockall
|
||||||
|
|
||||||
|
mlockall:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
li $v0, __NR_mlockall
|
||||||
|
syscall
|
||||||
|
bnez $a3, 1f
|
||||||
|
move $a0, $v0
|
||||||
|
j $ra
|
||||||
|
nop
|
||||||
|
1:
|
||||||
|
la $t9,__set_errno
|
||||||
|
j $t9
|
||||||
|
nop
|
||||||
|
.set reorder
|
||||||
|
.end mlockall
|
||||||
22
libc/arch-mips/syscalls/munlockall.S
Normal file
22
libc/arch-mips/syscalls/munlockall.S
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
.text
|
||||||
|
.globl munlockall
|
||||||
|
.align 4
|
||||||
|
.ent munlockall
|
||||||
|
|
||||||
|
munlockall:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
li $v0, __NR_munlockall
|
||||||
|
syscall
|
||||||
|
bnez $a3, 1f
|
||||||
|
move $a0, $v0
|
||||||
|
j $ra
|
||||||
|
nop
|
||||||
|
1:
|
||||||
|
la $t9,__set_errno
|
||||||
|
j $t9
|
||||||
|
nop
|
||||||
|
.set reorder
|
||||||
|
.end munlockall
|
||||||
22
libc/arch-mips/syscalls/perf_event_open.S
Normal file
22
libc/arch-mips/syscalls/perf_event_open.S
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
.text
|
||||||
|
.globl perf_event_open
|
||||||
|
.align 4
|
||||||
|
.ent perf_event_open
|
||||||
|
|
||||||
|
perf_event_open:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
li $v0, __NR_perf_event_open
|
||||||
|
syscall
|
||||||
|
bnez $a3, 1f
|
||||||
|
move $a0, $v0
|
||||||
|
j $ra
|
||||||
|
nop
|
||||||
|
1:
|
||||||
|
la $t9,__set_errno
|
||||||
|
j $t9
|
||||||
|
nop
|
||||||
|
.set reorder
|
||||||
|
.end perf_event_open
|
||||||
22
libc/arch-mips/syscalls/tgkill.S
Normal file
22
libc/arch-mips/syscalls/tgkill.S
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
.text
|
||||||
|
.globl tgkill
|
||||||
|
.align 4
|
||||||
|
.ent tgkill
|
||||||
|
|
||||||
|
tgkill:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
li $v0, __NR_tgkill
|
||||||
|
syscall
|
||||||
|
bnez $a3, 1f
|
||||||
|
move $a0, $v0
|
||||||
|
j $ra
|
||||||
|
nop
|
||||||
|
1:
|
||||||
|
la $t9,__set_errno
|
||||||
|
j $t9
|
||||||
|
nop
|
||||||
|
.set reorder
|
||||||
|
.end tgkill
|
||||||
22
libc/arch-mips/syscalls/unshare.S
Normal file
22
libc/arch-mips/syscalls/unshare.S
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
.text
|
||||||
|
.globl unshare
|
||||||
|
.align 4
|
||||||
|
.ent unshare
|
||||||
|
|
||||||
|
unshare:
|
||||||
|
.set noreorder
|
||||||
|
.cpload $t9
|
||||||
|
li $v0, __NR_unshare
|
||||||
|
syscall
|
||||||
|
bnez $a3, 1f
|
||||||
|
move $a0, $v0
|
||||||
|
j $ra
|
||||||
|
nop
|
||||||
|
1:
|
||||||
|
la $t9,__set_errno
|
||||||
|
j $t9
|
||||||
|
nop
|
||||||
|
.set reorder
|
||||||
|
.end unshare
|
||||||
42
libc/arch-x86/bionic/__dso_handle.S
Normal file
42
libc/arch-x86/bionic/__dso_handle.S
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# The __dso_handle global variable is used by static
|
||||||
|
# C++ constructors and destructors in the binary.
|
||||||
|
# See http://www.codesourcery.com/public/cxx-abi/abi.html#dso-dtor
|
||||||
|
#
|
||||||
|
.section .bss
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
#ifndef CRT_LEGACY_WORKAROUND
|
||||||
|
.hidden __dso_handle
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.globl __dso_handle
|
||||||
|
__dso_handle:
|
||||||
|
.long 0
|
||||||
38
libc/arch-x86/bionic/__dso_handle_so.S
Normal file
38
libc/arch-x86/bionic/__dso_handle_so.S
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# The __dso_handle global variable is used by static
|
||||||
|
# C++ constructors and destructors in the binary.
|
||||||
|
# See http://www.codesourcery.com/public/cxx-abi/abi.html#dso-dtor
|
||||||
|
#
|
||||||
|
.data
|
||||||
|
.align 4
|
||||||
|
.hidden __dso_handle
|
||||||
|
.globl __dso_handle
|
||||||
|
__dso_handle:
|
||||||
|
.long __dso_handle
|
||||||
@@ -33,7 +33,7 @@ __pthread_clone:
|
|||||||
test %eax, %eax
|
test %eax, %eax
|
||||||
jns 1f
|
jns 1f
|
||||||
|
|
||||||
# an error occured, set errno and return -1
|
# an error occurred, set errno and return -1
|
||||||
negl %eax
|
negl %eax
|
||||||
call __set_errno
|
call __set_errno
|
||||||
orl $-1, %eax
|
orl $-1, %eax
|
||||||
@@ -53,7 +53,60 @@ __pthread_clone:
|
|||||||
popl %ebx
|
popl %ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
/* XXX: TODO: Add __bionic_clone here
|
|
||||||
* See bionic/bionic_clone.c and arch-arm/bionic/clone.S
|
/*
|
||||||
* for more details...
|
* int __bionic_clone(unsigned long clone_flags,
|
||||||
|
* void* newsp,
|
||||||
|
* int *parent_tidptr,
|
||||||
|
* void *new_tls,
|
||||||
|
* int *child_tidptr,
|
||||||
|
* int (*fn)(void *),
|
||||||
|
* void *arg);
|
||||||
*/
|
*/
|
||||||
|
.text
|
||||||
|
.globl __bionic_clone
|
||||||
|
.type __bionic_clone, @function
|
||||||
|
.align 4
|
||||||
|
__bionic_clone:
|
||||||
|
pushl %ebx
|
||||||
|
pushl %esi
|
||||||
|
pushl %edi
|
||||||
|
|
||||||
|
# insert arguments onto the child stack
|
||||||
|
movl 20(%esp), %ecx
|
||||||
|
andl $~15, %ecx
|
||||||
|
movl 36(%esp), %eax
|
||||||
|
movl %eax, -16(%ecx)
|
||||||
|
movl 40(%esp), %eax
|
||||||
|
movl %eax, -12(%ecx)
|
||||||
|
|
||||||
|
subl $16, %ecx
|
||||||
|
movl 16(%esp), %ebx
|
||||||
|
movl 24(%esp), %edx
|
||||||
|
movl 32(%esp), %esi
|
||||||
|
movl 28(%esp), %edi
|
||||||
|
movl $__NR_clone, %eax
|
||||||
|
int $0x80
|
||||||
|
test %eax, %eax
|
||||||
|
jns 1f
|
||||||
|
|
||||||
|
# an error occurred, set errno and return -1
|
||||||
|
negl %eax
|
||||||
|
call __set_errno
|
||||||
|
orl $-1, %eax
|
||||||
|
jmp 2f
|
||||||
|
|
||||||
|
1:
|
||||||
|
jnz 2f
|
||||||
|
|
||||||
|
# we're in the child now, call __bionic_clone_entry
|
||||||
|
# with the appropriate arguments on the child stack
|
||||||
|
# we already placed most of them
|
||||||
|
call __bionic_clone_entry
|
||||||
|
hlt
|
||||||
|
|
||||||
|
2:
|
||||||
|
popl %edi
|
||||||
|
popl %esi
|
||||||
|
popl %ebx
|
||||||
|
ret
|
||||||
|
|||||||
@@ -30,8 +30,7 @@
|
|||||||
.globl _start
|
.globl _start
|
||||||
|
|
||||||
# this is the small startup code that is first run when
|
# this is the small startup code that is first run when
|
||||||
# any executable that is dynamically-linked with Bionic
|
# any executable that is linked with Bionic runs.
|
||||||
# runs.
|
|
||||||
#
|
#
|
||||||
# it's purpose is to call __libc_init with appropriate
|
# it's purpose is to call __libc_init with appropriate
|
||||||
# arguments, which are:
|
# arguments, which are:
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
# bionic/arch-x86/bionic/crtbegin_static.S
|
|
||||||
#
|
|
||||||
# Copyright 2006, The Android Open Source Project
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
# * Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# * 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.
|
|
||||||
# * Neither the name of Google Inc. 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 Google Inc. ``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 Google Inc. 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.
|
|
||||||
|
|
||||||
.text
|
|
||||||
.align 4
|
|
||||||
.type _start, @function
|
|
||||||
.globl _start
|
|
||||||
|
|
||||||
# this is the small startup code that is first run when
|
|
||||||
# any executable that is statically-linked with Bionic
|
|
||||||
# runs.
|
|
||||||
#
|
|
||||||
# it's purpose is to call __libc_init with appropriate
|
|
||||||
# arguments, which are:
|
|
||||||
#
|
|
||||||
# - the address of the raw data block setup by the Linux
|
|
||||||
# kernel ELF loader
|
|
||||||
#
|
|
||||||
# - address of an "onexit" function, not used on any
|
|
||||||
# platform supported by Bionic
|
|
||||||
#
|
|
||||||
# - address of the "main" function of the program. We
|
|
||||||
# can't hard-code it in the adr pseudo instruction
|
|
||||||
# so we use a tiny trampoline that will get relocated
|
|
||||||
# by the dynamic linker before this code runs
|
|
||||||
#
|
|
||||||
# - address of the constructor list
|
|
||||||
#
|
|
||||||
_start:
|
|
||||||
mov %esp, %eax
|
|
||||||
# before push arguments, align the stack to a 16 byte boundary
|
|
||||||
andl $~15, %esp
|
|
||||||
mov $1f, %edx
|
|
||||||
pushl %edx
|
|
||||||
mov $0f, %edx
|
|
||||||
pushl %edx
|
|
||||||
mov $0, %edx
|
|
||||||
pushl %edx
|
|
||||||
pushl %eax
|
|
||||||
call __libc_init
|
|
||||||
|
|
||||||
0: jmp main
|
|
||||||
|
|
||||||
1: .long __PREINIT_ARRAY__
|
|
||||||
.long __INIT_ARRAY__
|
|
||||||
.long __FINI_ARRAY__
|
|
||||||
|
|
||||||
.section .preinit_array, "aw"
|
|
||||||
.globl __PREINIT_ARRAY__
|
|
||||||
__PREINIT_ARRAY__:
|
|
||||||
.long -1
|
|
||||||
|
|
||||||
.section .init_array, "aw"
|
|
||||||
.globl __INIT_ARRAY__
|
|
||||||
__INIT_ARRAY__:
|
|
||||||
.long -1
|
|
||||||
.long frame_dummy
|
|
||||||
|
|
||||||
.section .fini_array, "aw"
|
|
||||||
.globl __FINI_ARRAY__
|
|
||||||
__FINI_ARRAY__:
|
|
||||||
.long -1
|
|
||||||
.long __do_global_dtors_aux
|
|
||||||
|
|
||||||
.section .eh_frame,"a",@progbits
|
|
||||||
.align 4
|
|
||||||
.type __EH_FRAME_BEGIN__, @object
|
|
||||||
__EH_FRAME_BEGIN__:
|
|
||||||
.text
|
|
||||||
.p2align 4,,15
|
|
||||||
.type __do_global_dtors_aux, @function
|
|
||||||
__do_global_dtors_aux:
|
|
||||||
pushl %ebp
|
|
||||||
movl %esp, %ebp
|
|
||||||
subl $24, %esp
|
|
||||||
cmpb $0, completed.4454
|
|
||||||
jne .L4
|
|
||||||
movl $__deregister_frame_info_bases, %eax
|
|
||||||
testl %eax, %eax
|
|
||||||
je .L3
|
|
||||||
movl $__EH_FRAME_BEGIN__, (%esp)
|
|
||||||
call __deregister_frame_info_bases
|
|
||||||
.L3:
|
|
||||||
movb $1, completed.4454
|
|
||||||
.L4:
|
|
||||||
leave
|
|
||||||
ret
|
|
||||||
.text
|
|
||||||
.p2align 4,,15
|
|
||||||
.type frame_dummy, @function
|
|
||||||
frame_dummy:
|
|
||||||
pushl %ebp
|
|
||||||
movl $__register_frame_info_bases, %eax
|
|
||||||
movl %esp, %ebp
|
|
||||||
subl $24, %esp
|
|
||||||
testl %eax, %eax
|
|
||||||
je .L7
|
|
||||||
movl %ebx, 12(%esp)
|
|
||||||
movl $0, 8(%esp)
|
|
||||||
movl $object.4466, 4(%esp)
|
|
||||||
movl $__EH_FRAME_BEGIN__, (%esp)
|
|
||||||
call __register_frame_info_bases
|
|
||||||
.L7:
|
|
||||||
leave
|
|
||||||
ret
|
|
||||||
.local completed.4454
|
|
||||||
.comm completed.4454,1,1
|
|
||||||
.local object.4466
|
|
||||||
.comm object.4466,24,4
|
|
||||||
.weak __register_frame_info_bases
|
|
||||||
.weak __deregister_frame_info_bases
|
|
||||||
|
|
||||||
#include "__dso_handle.S"
|
|
||||||
#include "atexit.S"
|
|
||||||
#include "__stack_chk_fail_local.S"
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
/* bionic/arch-x86/bionic/dl_iterate_phdr_static.c
|
|
||||||
**
|
|
||||||
** Copyright 2006, The Android Open Source Project
|
|
||||||
**
|
|
||||||
** Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions are met:
|
|
||||||
** * Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** * 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.
|
|
||||||
** * Neither the name of Google Inc. 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 Google Inc. ``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 Google Inc. 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 <sys/types.h>
|
|
||||||
#include <linux/elf.h>
|
|
||||||
|
|
||||||
/* TODO: Move this into a header that linker.h can also pull it in.
|
|
||||||
* Silly to have same struct in 2 places. This is temporary. */
|
|
||||||
struct dl_phdr_info
|
|
||||||
{
|
|
||||||
Elf32_Addr dlpi_addr;
|
|
||||||
const char *dlpi_name;
|
|
||||||
const Elf32_Phdr *dlpi_phdr;
|
|
||||||
Elf32_Half dlpi_phnum;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Dynamic binaries get this from the dynamic linker (system/linker), which
|
|
||||||
* we don't pull in for static bins. We also don't have a list of so's to
|
|
||||||
* iterate over, since there's really only a single monolithic blob of
|
|
||||||
* code/data.
|
|
||||||
*
|
|
||||||
* All we need to do is to find where the executable is in memory, and grab the
|
|
||||||
* phdr and phnum from there.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* ld provides this to us in the default link script */
|
|
||||||
extern void *__executable_start;
|
|
||||||
|
|
||||||
int
|
|
||||||
dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size, void *data),
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
struct dl_phdr_info dl_info;
|
|
||||||
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) &__executable_start;
|
|
||||||
Elf32_Phdr *phdr = (Elf32_Phdr *)((unsigned long)ehdr + ehdr->e_phoff);
|
|
||||||
|
|
||||||
/* TODO: again, copied from linker.c. Find a better home for this
|
|
||||||
* later. */
|
|
||||||
if (ehdr->e_ident[EI_MAG0] != ELFMAG0) return -1;
|
|
||||||
if (ehdr->e_ident[EI_MAG1] != ELFMAG1) return -1;
|
|
||||||
if (ehdr->e_ident[EI_MAG2] != ELFMAG2) return -1;
|
|
||||||
if (ehdr->e_ident[EI_MAG3] != ELFMAG3) return -1;
|
|
||||||
|
|
||||||
dl_info.dlpi_addr = 0;
|
|
||||||
dl_info.dlpi_name = NULL;
|
|
||||||
dl_info.dlpi_phdr = phdr;
|
|
||||||
dl_info.dlpi_phnum = ehdr->e_phnum;
|
|
||||||
return cb(&dl_info, sizeof (struct dl_phdr_info), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Generic syscall call.
|
* Generic syscall call.
|
||||||
* Upon entry
|
* Upon entry:
|
||||||
* %eax: system call number
|
* %eax: system call number - caller save
|
||||||
* %ebx: arg0 to system call
|
* %ebx: arg0 to system call - callee save
|
||||||
* %ecx: arg..
|
* %ecx: arg1 - caller save
|
||||||
* %edx: arg..
|
* %edx: arg2 - caller save
|
||||||
* %esi: arg..
|
* %esi: arg3 - callee save
|
||||||
* %edi: arg..
|
* %edi: arg4 - callee save
|
||||||
* We push these (to save them) load them up with the
|
* %ebp: arg5 - callee save
|
||||||
* values from the calling frame (not all will actually be valid)
|
|
||||||
* and make the syscall.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/linux-syscalls.h>
|
#include <sys/linux-syscalls.h>
|
||||||
@@ -20,26 +18,37 @@
|
|||||||
.align 4
|
.align 4
|
||||||
|
|
||||||
syscall:
|
syscall:
|
||||||
|
# Push the callee save registers.
|
||||||
push %ebx
|
push %ebx
|
||||||
push %esi
|
push %esi
|
||||||
push %edi
|
push %edi
|
||||||
mov 16(%esp),%eax
|
push %ebp
|
||||||
mov 20(%esp),%ebx
|
|
||||||
mov 24(%esp),%ecx
|
|
||||||
mov 28(%esp),%edx
|
|
||||||
mov 32(%esp),%esi
|
|
||||||
mov 36(%esp),%edi
|
|
||||||
|
|
||||||
|
# Load all the arguments from the calling frame.
|
||||||
|
# (Not all will be valid, depending on the syscall.)
|
||||||
|
mov 20(%esp),%eax
|
||||||
|
mov 24(%esp),%ebx
|
||||||
|
mov 28(%esp),%ecx
|
||||||
|
mov 32(%esp),%edx
|
||||||
|
mov 36(%esp),%esi
|
||||||
|
mov 40(%esp),%edi
|
||||||
|
mov 44(%esp),%ebp
|
||||||
|
|
||||||
|
# Make the system call.
|
||||||
int $0x80
|
int $0x80
|
||||||
|
|
||||||
|
# Error?
|
||||||
cmpl $-4095, %eax
|
cmpl $-4095, %eax
|
||||||
jb 1f
|
jb 1f
|
||||||
|
# Yes, so set errno.
|
||||||
negl %eax
|
negl %eax
|
||||||
pushl %eax
|
pushl %eax
|
||||||
call __set_errno
|
call __set_errno
|
||||||
addl $4, %esp
|
addl $4, %esp
|
||||||
orl $-1, %eax
|
orl $-1, %eax
|
||||||
1:
|
1:
|
||||||
|
# Restore the callee save registers.
|
||||||
|
pop %ebp
|
||||||
pop %edi
|
pop %edi
|
||||||
pop %esi
|
pop %esi
|
||||||
pop %ebx
|
pop %ebx
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ typedef long int ssize_t;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <linux/types.h>
|
|
||||||
|
|
||||||
/* 7.18.1.1 Exact-width integer types */
|
/* 7.18.1.1 Exact-width integer types */
|
||||||
typedef __signed char __int8_t;
|
typedef __signed char __int8_t;
|
||||||
typedef unsigned char __uint8_t;
|
typedef unsigned char __uint8_t;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ name: \
|
|||||||
/* calculate left number to compare */ \
|
/* calculate left number to compare */ \
|
||||||
mov $16, %esi; \
|
mov $16, %esi; \
|
||||||
sub %ecx, %esi; \
|
sub %ecx, %esi; \
|
||||||
cmp %esi, %ebp; \
|
cmpl %esi, %ebp; \
|
||||||
jbe L(more8byteseq); \
|
jbe L(more8byteseq); \
|
||||||
sub %esi, %ebp
|
sub %esi, %ebp
|
||||||
#endif
|
#endif
|
||||||
@@ -116,7 +116,7 @@ ENTRY (ssse3_strcmp_latest)
|
|||||||
movl STR2(%esp), %eax
|
movl STR2(%esp), %eax
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
movl CNT(%esp), %ebp
|
movl CNT(%esp), %ebp
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
jb L(less16bytes_sncmp)
|
jb L(less16bytes_sncmp)
|
||||||
jmp L(more16bytes)
|
jmp L(more16bytes)
|
||||||
#endif
|
#endif
|
||||||
@@ -172,18 +172,18 @@ ENTRY (ssse3_strcmp_latest)
|
|||||||
add $8, %edx
|
add $8, %edx
|
||||||
add $8, %eax
|
add $8, %eax
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $8, %ebp
|
cmpl $8, %ebp
|
||||||
lea -8(%ebp), %ebp
|
lea -8(%ebp), %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
L(more16bytes):
|
L(more16bytes):
|
||||||
#endif
|
#endif
|
||||||
movl %edx, %ecx
|
movl %edx, %ecx
|
||||||
and $0xfff, %ecx
|
and $0xfff, %ecx
|
||||||
cmp $0xff0, %ecx
|
cmpl $0xff0, %ecx
|
||||||
ja L(crosspage)
|
ja L(crosspage)
|
||||||
mov %eax, %ecx
|
mov %eax, %ecx
|
||||||
and $0xfff, %ecx
|
and $0xfff, %ecx
|
||||||
cmp $0xff0, %ecx
|
cmpl $0xff0, %ecx
|
||||||
ja L(crosspage)
|
ja L(crosspage)
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
movlpd (%eax), %xmm1
|
movlpd (%eax), %xmm1
|
||||||
@@ -197,7 +197,7 @@ L(more16bytes):
|
|||||||
sub $0xffff, %ecx
|
sub $0xffff, %ecx
|
||||||
jnz L(less16bytes)
|
jnz L(less16bytes)
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(eq)
|
jbe L(eq)
|
||||||
#endif
|
#endif
|
||||||
@@ -220,7 +220,7 @@ L(crosspage):
|
|||||||
xor %ecx, %eax
|
xor %ecx, %eax
|
||||||
xor %edi, %edx
|
xor %edi, %edx
|
||||||
xor %ebx, %ebx
|
xor %ebx, %ebx
|
||||||
cmp %edi, %ecx
|
cmpl %edi, %ecx
|
||||||
je L(ashr_0)
|
je L(ashr_0)
|
||||||
ja L(bigger)
|
ja L(bigger)
|
||||||
or $0x20, %ebx
|
or $0x20, %ebx
|
||||||
@@ -229,37 +229,37 @@ L(crosspage):
|
|||||||
L(bigger):
|
L(bigger):
|
||||||
lea 15(%edi), %edi
|
lea 15(%edi), %edi
|
||||||
sub %ecx, %edi
|
sub %ecx, %edi
|
||||||
cmp $8, %edi
|
cmpl $8, %edi
|
||||||
jle L(ashr_less_8)
|
jle L(ashr_less_8)
|
||||||
cmp $14, %edi
|
cmpl $14, %edi
|
||||||
je L(ashr_15)
|
je L(ashr_15)
|
||||||
cmp $13, %edi
|
cmpl $13, %edi
|
||||||
je L(ashr_14)
|
je L(ashr_14)
|
||||||
cmp $12, %edi
|
cmpl $12, %edi
|
||||||
je L(ashr_13)
|
je L(ashr_13)
|
||||||
cmp $11, %edi
|
cmpl $11, %edi
|
||||||
je L(ashr_12)
|
je L(ashr_12)
|
||||||
cmp $10, %edi
|
cmpl $10, %edi
|
||||||
je L(ashr_11)
|
je L(ashr_11)
|
||||||
cmp $9, %edi
|
cmpl $9, %edi
|
||||||
je L(ashr_10)
|
je L(ashr_10)
|
||||||
L(ashr_less_8):
|
L(ashr_less_8):
|
||||||
je L(ashr_9)
|
je L(ashr_9)
|
||||||
cmp $7, %edi
|
cmpl $7, %edi
|
||||||
je L(ashr_8)
|
je L(ashr_8)
|
||||||
cmp $6, %edi
|
cmpl $6, %edi
|
||||||
je L(ashr_7)
|
je L(ashr_7)
|
||||||
cmp $5, %edi
|
cmpl $5, %edi
|
||||||
je L(ashr_6)
|
je L(ashr_6)
|
||||||
cmp $4, %edi
|
cmpl $4, %edi
|
||||||
je L(ashr_5)
|
je L(ashr_5)
|
||||||
cmp $3, %edi
|
cmpl $3, %edi
|
||||||
je L(ashr_4)
|
je L(ashr_4)
|
||||||
cmp $2, %edi
|
cmpl $2, %edi
|
||||||
je L(ashr_3)
|
je L(ashr_3)
|
||||||
cmp $1, %edi
|
cmpl $1, %edi
|
||||||
je L(ashr_2)
|
je L(ashr_2)
|
||||||
cmp $0, %edi
|
cmpl $0, %edi
|
||||||
je L(ashr_1)
|
je L(ashr_1)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -297,7 +297,7 @@ L(loop_ashr_0):
|
|||||||
sub $0xffff, %esi
|
sub $0xffff, %esi
|
||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -355,7 +355,7 @@ L(gobble_ashr_1):
|
|||||||
sub $0xffff, %esi
|
sub $0xffff, %esi
|
||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -380,7 +380,7 @@ L(gobble_ashr_1):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -396,7 +396,7 @@ L(nibble_ashr_1):
|
|||||||
jnz L(ashr_1_exittail)
|
jnz L(ashr_1_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $15, %ebp
|
cmpl $15, %ebp
|
||||||
jbe L(ashr_1_exittail)
|
jbe L(ashr_1_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -462,7 +462,7 @@ L(gobble_ashr_2):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -486,7 +486,7 @@ L(gobble_ashr_2):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -502,7 +502,7 @@ L(nibble_ashr_2):
|
|||||||
jnz L(ashr_2_exittail)
|
jnz L(ashr_2_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $14, %ebp
|
cmpl $14, %ebp
|
||||||
jbe L(ashr_2_exittail)
|
jbe L(ashr_2_exittail)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -569,7 +569,7 @@ L(gobble_ashr_3):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -593,7 +593,7 @@ L(gobble_ashr_3):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -609,7 +609,7 @@ L(nibble_ashr_3):
|
|||||||
jnz L(ashr_3_exittail)
|
jnz L(ashr_3_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $13, %ebp
|
cmpl $13, %ebp
|
||||||
jbe L(ashr_3_exittail)
|
jbe L(ashr_3_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -675,7 +675,7 @@ L(gobble_ashr_4):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -700,7 +700,7 @@ L(gobble_ashr_4):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -717,7 +717,7 @@ L(nibble_ashr_4):
|
|||||||
jnz L(ashr_4_exittail)
|
jnz L(ashr_4_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $12, %ebp
|
cmpl $12, %ebp
|
||||||
jbe L(ashr_4_exittail)
|
jbe L(ashr_4_exittail)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -784,7 +784,7 @@ L(gobble_ashr_5):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -808,7 +808,7 @@ L(gobble_ashr_5):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -824,7 +824,7 @@ L(nibble_ashr_5):
|
|||||||
jnz L(ashr_5_exittail)
|
jnz L(ashr_5_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $11, %ebp
|
cmpl $11, %ebp
|
||||||
jbe L(ashr_5_exittail)
|
jbe L(ashr_5_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -891,7 +891,7 @@ L(gobble_ashr_6):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -915,7 +915,7 @@ L(gobble_ashr_6):
|
|||||||
sub $0xffff, %esi
|
sub $0xffff, %esi
|
||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -932,7 +932,7 @@ L(nibble_ashr_6):
|
|||||||
jnz L(ashr_6_exittail)
|
jnz L(ashr_6_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $10, %ebp
|
cmpl $10, %ebp
|
||||||
jbe L(ashr_6_exittail)
|
jbe L(ashr_6_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -999,7 +999,7 @@ L(gobble_ashr_7):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1024,7 +1024,7 @@ L(gobble_ashr_7):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1041,7 +1041,7 @@ L(nibble_ashr_7):
|
|||||||
jnz L(ashr_7_exittail)
|
jnz L(ashr_7_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $9, %ebp
|
cmpl $9, %ebp
|
||||||
jbe L(ashr_7_exittail)
|
jbe L(ashr_7_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -1108,7 +1108,7 @@ L(gobble_ashr_8):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1132,7 +1132,7 @@ L(gobble_ashr_8):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1148,7 +1148,7 @@ L(nibble_ashr_8):
|
|||||||
jnz L(ashr_8_exittail)
|
jnz L(ashr_8_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $8, %ebp
|
cmpl $8, %ebp
|
||||||
jbe L(ashr_8_exittail)
|
jbe L(ashr_8_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -1215,7 +1215,7 @@ L(gobble_ashr_9):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1239,7 +1239,7 @@ L(gobble_ashr_9):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1255,7 +1255,7 @@ L(nibble_ashr_9):
|
|||||||
jnz L(ashr_9_exittail)
|
jnz L(ashr_9_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $7, %ebp
|
cmpl $7, %ebp
|
||||||
jbe L(ashr_9_exittail)
|
jbe L(ashr_9_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -1321,7 +1321,7 @@ L(gobble_ashr_10):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1345,7 +1345,7 @@ L(gobble_ashr_10):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1361,7 +1361,7 @@ L(nibble_ashr_10):
|
|||||||
jnz L(ashr_10_exittail)
|
jnz L(ashr_10_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $6, %ebp
|
cmpl $6, %ebp
|
||||||
jbe L(ashr_10_exittail)
|
jbe L(ashr_10_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -1427,7 +1427,7 @@ L(gobble_ashr_11):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1451,7 +1451,7 @@ L(gobble_ashr_11):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1467,7 +1467,7 @@ L(nibble_ashr_11):
|
|||||||
jnz L(ashr_11_exittail)
|
jnz L(ashr_11_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $5, %ebp
|
cmpl $5, %ebp
|
||||||
jbe L(ashr_11_exittail)
|
jbe L(ashr_11_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -1533,7 +1533,7 @@ L(gobble_ashr_12):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1558,7 +1558,7 @@ L(gobble_ashr_12):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1574,7 +1574,7 @@ L(nibble_ashr_12):
|
|||||||
jnz L(ashr_12_exittail)
|
jnz L(ashr_12_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $4, %ebp
|
cmpl $4, %ebp
|
||||||
jbe L(ashr_12_exittail)
|
jbe L(ashr_12_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -1640,7 +1640,7 @@ L(gobble_ashr_13):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1664,7 +1664,7 @@ L(gobble_ashr_13):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1680,7 +1680,7 @@ L(nibble_ashr_13):
|
|||||||
jnz L(ashr_13_exittail)
|
jnz L(ashr_13_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $3, %ebp
|
cmpl $3, %ebp
|
||||||
jbe L(ashr_13_exittail)
|
jbe L(ashr_13_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -1746,7 +1746,7 @@ L(gobble_ashr_14):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1770,7 +1770,7 @@ L(gobble_ashr_14):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1786,7 +1786,7 @@ L(nibble_ashr_14):
|
|||||||
jnz L(ashr_14_exittail)
|
jnz L(ashr_14_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $2, %ebp
|
cmpl $2, %ebp
|
||||||
jbe L(ashr_14_exittail)
|
jbe L(ashr_14_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -1853,7 +1853,7 @@ L(gobble_ashr_15):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1877,7 +1877,7 @@ L(gobble_ashr_15):
|
|||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $16, %ebp
|
cmpl $16, %ebp
|
||||||
lea -16(%ebp), %ebp
|
lea -16(%ebp), %ebp
|
||||||
jbe L(more8byteseq)
|
jbe L(more8byteseq)
|
||||||
#endif
|
#endif
|
||||||
@@ -1893,7 +1893,7 @@ L(nibble_ashr_15):
|
|||||||
jnz L(ashr_15_exittail)
|
jnz L(ashr_15_exittail)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $1, %ebp
|
cmpl $1, %ebp
|
||||||
jbe L(ashr_15_exittail)
|
jbe L(ashr_15_exittail)
|
||||||
#endif
|
#endif
|
||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
@@ -1955,12 +1955,12 @@ L(less16bytes):
|
|||||||
test $0x40, %cl
|
test $0x40, %cl
|
||||||
jnz L(Byte6)
|
jnz L(Byte6)
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $7, %ebp
|
cmpl $7, %ebp
|
||||||
jbe L(eq)
|
jbe L(eq)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
movzx 7(%eax), %ecx
|
movzbl 7(%eax), %ecx
|
||||||
movzx 7(%edx), %eax
|
movzbl 7(%edx), %eax
|
||||||
|
|
||||||
sub %ecx, %eax
|
sub %ecx, %eax
|
||||||
RETURN
|
RETURN
|
||||||
@@ -1968,11 +1968,11 @@ L(less16bytes):
|
|||||||
.p2align 4
|
.p2align 4
|
||||||
L(Byte0):
|
L(Byte0):
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $0, %ebp
|
cmpl $0, %ebp
|
||||||
jbe L(eq)
|
jbe L(eq)
|
||||||
#endif
|
#endif
|
||||||
movzx (%eax), %ecx
|
movzbl (%eax), %ecx
|
||||||
movzx (%edx), %eax
|
movzbl (%edx), %eax
|
||||||
|
|
||||||
sub %ecx, %eax
|
sub %ecx, %eax
|
||||||
RETURN
|
RETURN
|
||||||
@@ -1980,11 +1980,11 @@ L(Byte0):
|
|||||||
.p2align 4
|
.p2align 4
|
||||||
L(Byte1):
|
L(Byte1):
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $1, %ebp
|
cmpl $1, %ebp
|
||||||
jbe L(eq)
|
jbe L(eq)
|
||||||
#endif
|
#endif
|
||||||
movzx 1(%eax), %ecx
|
movzbl 1(%eax), %ecx
|
||||||
movzx 1(%edx), %eax
|
movzbl 1(%edx), %eax
|
||||||
|
|
||||||
sub %ecx, %eax
|
sub %ecx, %eax
|
||||||
RETURN
|
RETURN
|
||||||
@@ -1992,11 +1992,11 @@ L(Byte1):
|
|||||||
.p2align 4
|
.p2align 4
|
||||||
L(Byte2):
|
L(Byte2):
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $2, %ebp
|
cmpl $2, %ebp
|
||||||
jbe L(eq)
|
jbe L(eq)
|
||||||
#endif
|
#endif
|
||||||
movzx 2(%eax), %ecx
|
movzbl 2(%eax), %ecx
|
||||||
movzx 2(%edx), %eax
|
movzbl 2(%edx), %eax
|
||||||
|
|
||||||
sub %ecx, %eax
|
sub %ecx, %eax
|
||||||
RETURN
|
RETURN
|
||||||
@@ -2004,11 +2004,11 @@ L(Byte2):
|
|||||||
.p2align 4
|
.p2align 4
|
||||||
L(Byte3):
|
L(Byte3):
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $3, %ebp
|
cmpl $3, %ebp
|
||||||
jbe L(eq)
|
jbe L(eq)
|
||||||
#endif
|
#endif
|
||||||
movzx 3(%eax), %ecx
|
movzbl 3(%eax), %ecx
|
||||||
movzx 3(%edx), %eax
|
movzbl 3(%edx), %eax
|
||||||
|
|
||||||
sub %ecx, %eax
|
sub %ecx, %eax
|
||||||
RETURN
|
RETURN
|
||||||
@@ -2016,11 +2016,11 @@ L(Byte3):
|
|||||||
.p2align 4
|
.p2align 4
|
||||||
L(Byte4):
|
L(Byte4):
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $4, %ebp
|
cmpl $4, %ebp
|
||||||
jbe L(eq)
|
jbe L(eq)
|
||||||
#endif
|
#endif
|
||||||
movzx 4(%eax), %ecx
|
movzbl 4(%eax), %ecx
|
||||||
movzx 4(%edx), %eax
|
movzbl 4(%edx), %eax
|
||||||
|
|
||||||
sub %ecx, %eax
|
sub %ecx, %eax
|
||||||
RETURN
|
RETURN
|
||||||
@@ -2028,11 +2028,11 @@ L(Byte4):
|
|||||||
.p2align 4
|
.p2align 4
|
||||||
L(Byte5):
|
L(Byte5):
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $5, %ebp
|
cmpl $5, %ebp
|
||||||
jbe L(eq)
|
jbe L(eq)
|
||||||
#endif
|
#endif
|
||||||
movzx 5(%eax), %ecx
|
movzbl 5(%eax), %ecx
|
||||||
movzx 5(%edx), %eax
|
movzbl 5(%edx), %eax
|
||||||
|
|
||||||
sub %ecx, %eax
|
sub %ecx, %eax
|
||||||
RETURN
|
RETURN
|
||||||
@@ -2040,11 +2040,11 @@ L(Byte5):
|
|||||||
.p2align 4
|
.p2align 4
|
||||||
L(Byte6):
|
L(Byte6):
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $6, %ebp
|
cmpl $6, %ebp
|
||||||
jbe L(eq)
|
jbe L(eq)
|
||||||
#endif
|
#endif
|
||||||
movzx 6(%eax), %ecx
|
movzbl 6(%eax), %ecx
|
||||||
movzx 6(%edx), %eax
|
movzbl 6(%edx), %eax
|
||||||
|
|
||||||
sub %ecx, %eax
|
sub %ecx, %eax
|
||||||
RETURN
|
RETURN
|
||||||
@@ -2054,7 +2054,7 @@ L(2next_8_bytes):
|
|||||||
add $8, %eax
|
add $8, %eax
|
||||||
add $8, %edx
|
add $8, %edx
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $8, %ebp
|
cmpl $8, %ebp
|
||||||
lea -8(%ebp), %ebp
|
lea -8(%ebp), %ebp
|
||||||
jbe L(eq)
|
jbe L(eq)
|
||||||
#endif
|
#endif
|
||||||
@@ -2081,11 +2081,11 @@ L(2next_8_bytes):
|
|||||||
jnz L(Byte6)
|
jnz L(Byte6)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
cmp $7, %ebp
|
cmpl $7, %ebp
|
||||||
jbe L(eq)
|
jbe L(eq)
|
||||||
#endif
|
#endif
|
||||||
movzx 7(%eax), %ecx
|
movzbl 7(%eax), %ecx
|
||||||
movzx 7(%edx), %eax
|
movzbl 7(%edx), %eax
|
||||||
|
|
||||||
sub %ecx, %eax
|
sub %ecx, %eax
|
||||||
RETURN
|
RETURN
|
||||||
@@ -2129,7 +2129,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $1, %ebp
|
cmpl $1, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 1(%eax), %ecx
|
movzbl 1(%eax), %ecx
|
||||||
@@ -2138,7 +2138,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $2, %ebp
|
cmpl $2, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 2(%eax), %ecx
|
movzbl 2(%eax), %ecx
|
||||||
@@ -2147,7 +2147,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $3, %ebp
|
cmpl $3, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 3(%eax), %ecx
|
movzbl 3(%eax), %ecx
|
||||||
@@ -2156,7 +2156,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $4, %ebp
|
cmpl $4, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 4(%eax), %ecx
|
movzbl 4(%eax), %ecx
|
||||||
@@ -2165,7 +2165,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $5, %ebp
|
cmpl $5, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 5(%eax), %ecx
|
movzbl 5(%eax), %ecx
|
||||||
@@ -2174,7 +2174,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $6, %ebp
|
cmpl $6, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 6(%eax), %ecx
|
movzbl 6(%eax), %ecx
|
||||||
@@ -2183,7 +2183,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $7, %ebp
|
cmpl $7, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 7(%eax), %ecx
|
movzbl 7(%eax), %ecx
|
||||||
@@ -2193,7 +2193,7 @@ L(less16bytes_sncmp):
|
|||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
|
|
||||||
cmp $8, %ebp
|
cmpl $8, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 8(%eax), %ecx
|
movzbl 8(%eax), %ecx
|
||||||
@@ -2202,7 +2202,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $9, %ebp
|
cmpl $9, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 9(%eax), %ecx
|
movzbl 9(%eax), %ecx
|
||||||
@@ -2211,7 +2211,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $10, %ebp
|
cmpl $10, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 10(%eax), %ecx
|
movzbl 10(%eax), %ecx
|
||||||
@@ -2220,7 +2220,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $11, %ebp
|
cmpl $11, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 11(%eax), %ecx
|
movzbl 11(%eax), %ecx
|
||||||
@@ -2230,7 +2230,7 @@ L(less16bytes_sncmp):
|
|||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
|
|
||||||
cmp $12, %ebp
|
cmpl $12, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 12(%eax), %ecx
|
movzbl 12(%eax), %ecx
|
||||||
@@ -2239,7 +2239,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $13, %ebp
|
cmpl $13, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 13(%eax), %ecx
|
movzbl 13(%eax), %ecx
|
||||||
@@ -2248,7 +2248,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $14, %ebp
|
cmpl $14, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 14(%eax), %ecx
|
movzbl 14(%eax), %ecx
|
||||||
@@ -2257,7 +2257,7 @@ L(less16bytes_sncmp):
|
|||||||
test %cl, %cl
|
test %cl, %cl
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
cmp $15, %ebp
|
cmpl $15, %ebp
|
||||||
je L(eq)
|
je L(eq)
|
||||||
|
|
||||||
movzbl 15(%eax), %ecx
|
movzbl 15(%eax), %ecx
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ syscall_src += arch-x86/syscalls/readahead.S
|
|||||||
syscall_src += arch-x86/syscalls/getgroups.S
|
syscall_src += arch-x86/syscalls/getgroups.S
|
||||||
syscall_src += arch-x86/syscalls/getpgid.S
|
syscall_src += arch-x86/syscalls/getpgid.S
|
||||||
syscall_src += arch-x86/syscalls/getppid.S
|
syscall_src += arch-x86/syscalls/getppid.S
|
||||||
|
syscall_src += arch-x86/syscalls/getsid.S
|
||||||
syscall_src += arch-x86/syscalls/setsid.S
|
syscall_src += arch-x86/syscalls/setsid.S
|
||||||
syscall_src += arch-x86/syscalls/setgid.S
|
syscall_src += arch-x86/syscalls/setgid.S
|
||||||
syscall_src += arch-x86/syscalls/__setreuid.S
|
syscall_src += arch-x86/syscalls/__setreuid.S
|
||||||
@@ -27,6 +28,7 @@ syscall_src += arch-x86/syscalls/setresgid.S
|
|||||||
syscall_src += arch-x86/syscalls/__brk.S
|
syscall_src += arch-x86/syscalls/__brk.S
|
||||||
syscall_src += arch-x86/syscalls/kill.S
|
syscall_src += arch-x86/syscalls/kill.S
|
||||||
syscall_src += arch-x86/syscalls/tkill.S
|
syscall_src += arch-x86/syscalls/tkill.S
|
||||||
|
syscall_src += arch-x86/syscalls/tgkill.S
|
||||||
syscall_src += arch-x86/syscalls/__ptrace.S
|
syscall_src += arch-x86/syscalls/__ptrace.S
|
||||||
syscall_src += arch-x86/syscalls/__set_thread_area.S
|
syscall_src += arch-x86/syscalls/__set_thread_area.S
|
||||||
syscall_src += arch-x86/syscalls/__getpriority.S
|
syscall_src += arch-x86/syscalls/__getpriority.S
|
||||||
@@ -61,6 +63,8 @@ syscall_src += arch-x86/syscalls/mprotect.S
|
|||||||
syscall_src += arch-x86/syscalls/madvise.S
|
syscall_src += arch-x86/syscalls/madvise.S
|
||||||
syscall_src += arch-x86/syscalls/mlock.S
|
syscall_src += arch-x86/syscalls/mlock.S
|
||||||
syscall_src += arch-x86/syscalls/munlock.S
|
syscall_src += arch-x86/syscalls/munlock.S
|
||||||
|
syscall_src += arch-x86/syscalls/mlockall.S
|
||||||
|
syscall_src += arch-x86/syscalls/munlockall.S
|
||||||
syscall_src += arch-x86/syscalls/mincore.S
|
syscall_src += arch-x86/syscalls/mincore.S
|
||||||
syscall_src += arch-x86/syscalls/__ioctl.S
|
syscall_src += arch-x86/syscalls/__ioctl.S
|
||||||
syscall_src += arch-x86/syscalls/readv.S
|
syscall_src += arch-x86/syscalls/readv.S
|
||||||
@@ -111,6 +115,7 @@ syscall_src += arch-x86/syscalls/rmdir.S
|
|||||||
syscall_src += arch-x86/syscalls/rename.S
|
syscall_src += arch-x86/syscalls/rename.S
|
||||||
syscall_src += arch-x86/syscalls/__getcwd.S
|
syscall_src += arch-x86/syscalls/__getcwd.S
|
||||||
syscall_src += arch-x86/syscalls/access.S
|
syscall_src += arch-x86/syscalls/access.S
|
||||||
|
syscall_src += arch-x86/syscalls/faccessat.S
|
||||||
syscall_src += arch-x86/syscalls/symlink.S
|
syscall_src += arch-x86/syscalls/symlink.S
|
||||||
syscall_src += arch-x86/syscalls/fchdir.S
|
syscall_src += arch-x86/syscalls/fchdir.S
|
||||||
syscall_src += arch-x86/syscalls/truncate.S
|
syscall_src += arch-x86/syscalls/truncate.S
|
||||||
@@ -123,6 +128,7 @@ syscall_src += arch-x86/syscalls/llistxattr.S
|
|||||||
syscall_src += arch-x86/syscalls/removexattr.S
|
syscall_src += arch-x86/syscalls/removexattr.S
|
||||||
syscall_src += arch-x86/syscalls/lremovexattr.S
|
syscall_src += arch-x86/syscalls/lremovexattr.S
|
||||||
syscall_src += arch-x86/syscalls/__statfs64.S
|
syscall_src += arch-x86/syscalls/__statfs64.S
|
||||||
|
syscall_src += arch-x86/syscalls/unshare.S
|
||||||
syscall_src += arch-x86/syscalls/pause.S
|
syscall_src += arch-x86/syscalls/pause.S
|
||||||
syscall_src += arch-x86/syscalls/gettimeofday.S
|
syscall_src += arch-x86/syscalls/gettimeofday.S
|
||||||
syscall_src += arch-x86/syscalls/settimeofday.S
|
syscall_src += arch-x86/syscalls/settimeofday.S
|
||||||
@@ -186,6 +192,7 @@ syscall_src += arch-x86/syscalls/delete_module.S
|
|||||||
syscall_src += arch-x86/syscalls/klogctl.S
|
syscall_src += arch-x86/syscalls/klogctl.S
|
||||||
syscall_src += arch-x86/syscalls/sysinfo.S
|
syscall_src += arch-x86/syscalls/sysinfo.S
|
||||||
syscall_src += arch-x86/syscalls/personality.S
|
syscall_src += arch-x86/syscalls/personality.S
|
||||||
|
syscall_src += arch-x86/syscalls/perf_event_open.S
|
||||||
syscall_src += arch-x86/syscalls/futex.S
|
syscall_src += arch-x86/syscalls/futex.S
|
||||||
syscall_src += arch-x86/syscalls/epoll_create.S
|
syscall_src += arch-x86/syscalls/epoll_create.S
|
||||||
syscall_src += arch-x86/syscalls/epoll_ctl.S
|
syscall_src += arch-x86/syscalls/epoll_ctl.S
|
||||||
|
|||||||
32
libc/arch-x86/syscalls/faccessat.S
Normal file
32
libc/arch-x86/syscalls/faccessat.S
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
.type faccessat, @function
|
||||||
|
.globl faccessat
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
faccessat:
|
||||||
|
pushl %ebx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %edx
|
||||||
|
pushl %esi
|
||||||
|
mov 20(%esp), %ebx
|
||||||
|
mov 24(%esp), %ecx
|
||||||
|
mov 28(%esp), %edx
|
||||||
|
mov 32(%esp), %esi
|
||||||
|
movl $__NR_faccessat, %eax
|
||||||
|
int $0x80
|
||||||
|
cmpl $-129, %eax
|
||||||
|
jb 1f
|
||||||
|
negl %eax
|
||||||
|
pushl %eax
|
||||||
|
call __set_errno
|
||||||
|
addl $4, %esp
|
||||||
|
orl $-1, %eax
|
||||||
|
1:
|
||||||
|
popl %esi
|
||||||
|
popl %edx
|
||||||
|
popl %ecx
|
||||||
|
popl %ebx
|
||||||
|
ret
|
||||||
23
libc/arch-x86/syscalls/getsid.S
Normal file
23
libc/arch-x86/syscalls/getsid.S
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
.type getsid, @function
|
||||||
|
.globl getsid
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
getsid:
|
||||||
|
pushl %ebx
|
||||||
|
mov 8(%esp), %ebx
|
||||||
|
movl $__NR_getsid, %eax
|
||||||
|
int $0x80
|
||||||
|
cmpl $-129, %eax
|
||||||
|
jb 1f
|
||||||
|
negl %eax
|
||||||
|
pushl %eax
|
||||||
|
call __set_errno
|
||||||
|
addl $4, %esp
|
||||||
|
orl $-1, %eax
|
||||||
|
1:
|
||||||
|
popl %ebx
|
||||||
|
ret
|
||||||
23
libc/arch-x86/syscalls/mlockall.S
Normal file
23
libc/arch-x86/syscalls/mlockall.S
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
.type mlockall, @function
|
||||||
|
.globl mlockall
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
mlockall:
|
||||||
|
pushl %ebx
|
||||||
|
mov 8(%esp), %ebx
|
||||||
|
movl $__NR_mlockall, %eax
|
||||||
|
int $0x80
|
||||||
|
cmpl $-129, %eax
|
||||||
|
jb 1f
|
||||||
|
negl %eax
|
||||||
|
pushl %eax
|
||||||
|
call __set_errno
|
||||||
|
addl $4, %esp
|
||||||
|
orl $-1, %eax
|
||||||
|
1:
|
||||||
|
popl %ebx
|
||||||
|
ret
|
||||||
20
libc/arch-x86/syscalls/munlockall.S
Normal file
20
libc/arch-x86/syscalls/munlockall.S
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
.type munlockall, @function
|
||||||
|
.globl munlockall
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
munlockall:
|
||||||
|
movl $__NR_munlockall, %eax
|
||||||
|
int $0x80
|
||||||
|
cmpl $-129, %eax
|
||||||
|
jb 1f
|
||||||
|
negl %eax
|
||||||
|
pushl %eax
|
||||||
|
call __set_errno
|
||||||
|
addl $4, %esp
|
||||||
|
orl $-1, %eax
|
||||||
|
1:
|
||||||
|
ret
|
||||||
35
libc/arch-x86/syscalls/perf_event_open.S
Normal file
35
libc/arch-x86/syscalls/perf_event_open.S
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
.type perf_event_open, @function
|
||||||
|
.globl perf_event_open
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
perf_event_open:
|
||||||
|
pushl %ebx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %edx
|
||||||
|
pushl %esi
|
||||||
|
pushl %edi
|
||||||
|
mov 24(%esp), %ebx
|
||||||
|
mov 28(%esp), %ecx
|
||||||
|
mov 32(%esp), %edx
|
||||||
|
mov 36(%esp), %esi
|
||||||
|
mov 40(%esp), %edi
|
||||||
|
movl $__NR_perf_event_open, %eax
|
||||||
|
int $0x80
|
||||||
|
cmpl $-129, %eax
|
||||||
|
jb 1f
|
||||||
|
negl %eax
|
||||||
|
pushl %eax
|
||||||
|
call __set_errno
|
||||||
|
addl $4, %esp
|
||||||
|
orl $-1, %eax
|
||||||
|
1:
|
||||||
|
popl %edi
|
||||||
|
popl %esi
|
||||||
|
popl %edx
|
||||||
|
popl %ecx
|
||||||
|
popl %ebx
|
||||||
|
ret
|
||||||
29
libc/arch-x86/syscalls/tgkill.S
Normal file
29
libc/arch-x86/syscalls/tgkill.S
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
.type tgkill, @function
|
||||||
|
.globl tgkill
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
tgkill:
|
||||||
|
pushl %ebx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %edx
|
||||||
|
mov 16(%esp), %ebx
|
||||||
|
mov 20(%esp), %ecx
|
||||||
|
mov 24(%esp), %edx
|
||||||
|
movl $__NR_tgkill, %eax
|
||||||
|
int $0x80
|
||||||
|
cmpl $-129, %eax
|
||||||
|
jb 1f
|
||||||
|
negl %eax
|
||||||
|
pushl %eax
|
||||||
|
call __set_errno
|
||||||
|
addl $4, %esp
|
||||||
|
orl $-1, %eax
|
||||||
|
1:
|
||||||
|
popl %edx
|
||||||
|
popl %ecx
|
||||||
|
popl %ebx
|
||||||
|
ret
|
||||||
23
libc/arch-x86/syscalls/unshare.S
Normal file
23
libc/arch-x86/syscalls/unshare.S
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* autogenerated by gensyscalls.py */
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
.text
|
||||||
|
.type unshare, @function
|
||||||
|
.globl unshare
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
unshare:
|
||||||
|
pushl %ebx
|
||||||
|
mov 8(%esp), %ebx
|
||||||
|
movl $__NR_unshare, %eax
|
||||||
|
int $0x80
|
||||||
|
cmpl $-129, %eax
|
||||||
|
jb 1f
|
||||||
|
negl %eax
|
||||||
|
pushl %eax
|
||||||
|
call __set_errno
|
||||||
|
addl $4, %esp
|
||||||
|
orl $-1, %eax
|
||||||
|
1:
|
||||||
|
popl %ebx
|
||||||
|
ret
|
||||||
59
libc/bionic/ThreadLocalBuffer.h
Normal file
59
libc/bionic/ThreadLocalBuffer.h
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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 _BIONIC_THREAD_LOCAL_BUFFER_H_included
|
||||||
|
#define _BIONIC_THREAD_LOCAL_BUFFER_H_included
|
||||||
|
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
// libstdc++ currently contains __cxa_guard_acquire and __cxa_guard_release,
|
||||||
|
// so we make do with macros instead of a C++ class.
|
||||||
|
// TODO: move __cxa_guard_acquire and __cxa_guard_release into libc.
|
||||||
|
|
||||||
|
#define GLOBAL_INIT_THREAD_LOCAL_BUFFER(name) \
|
||||||
|
static pthread_once_t name ## _once; \
|
||||||
|
static pthread_key_t name ## _key; \
|
||||||
|
static void name ## _key_destroy(void* buffer) { \
|
||||||
|
free(buffer); \
|
||||||
|
} \
|
||||||
|
static void name ## _key_init() { \
|
||||||
|
pthread_key_create(&name ## _key, name ## _key_destroy); \
|
||||||
|
}
|
||||||
|
|
||||||
|
// Leaves "name_buffer" and "name_byte_count" defined and initialized.
|
||||||
|
#define LOCAL_INIT_THREAD_LOCAL_BUFFER(type, name, byte_count) \
|
||||||
|
pthread_once(&name ## _once, name ## _key_init); \
|
||||||
|
type name ## _buffer = reinterpret_cast<type>(pthread_getspecific(name ## _key)); \
|
||||||
|
if (name ## _buffer == NULL) { \
|
||||||
|
name ## _buffer = reinterpret_cast<type>(malloc(byte_count)); \
|
||||||
|
pthread_setspecific(name ## _key, name ## _buffer); \
|
||||||
|
} \
|
||||||
|
const size_t name ## _buffer_size = byte_count
|
||||||
|
|
||||||
|
#endif // _BIONIC_THREAD_LOCAL_BUFFER_H_included
|
||||||
@@ -31,9 +31,6 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/* WARNING: AT THE MOMENT, THIS IS ONLY SUPPORTED ON ARM
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int __bionic_clone(unsigned long clone_flags,
|
extern int __bionic_clone(unsigned long clone_flags,
|
||||||
void* newsp,
|
void* newsp,
|
||||||
int *parent_tidptr,
|
int *parent_tidptr,
|
||||||
|
|||||||
63
libc/bionic/crtbrand.c
Normal file
63
libc/bionic/crtbrand.c
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright 2000 David E. O'Brien, John D. Polstra.
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 <stdint.h>
|
||||||
|
|
||||||
|
#define ABI_VENDOR "Android"
|
||||||
|
#define ABI_SECTION ".note.android.ident"
|
||||||
|
#define ABI_NOTETYPE 1
|
||||||
|
#define ABI_ANDROID_API PLATFORM_SDK_VERSION
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Special ".note" entry to tag an Android binary and specify the ABI version.
|
||||||
|
*
|
||||||
|
* For all arches except sparc, gcc emits the section directive for the
|
||||||
|
* following struct with a PROGBITS type. However, the section should be
|
||||||
|
* of NOTE type, according to the Generic SysV ABI spec.
|
||||||
|
*
|
||||||
|
* Unfortunately, there is no clean way to tell gcc to use another section type,
|
||||||
|
* so this C file (or the C file that includes it) must be compiled in multiple
|
||||||
|
* steps:
|
||||||
|
*
|
||||||
|
* - Compile the .c file to a .s file.
|
||||||
|
* - Edit the .s file to change the 'progbits' type to 'note', for the section
|
||||||
|
* directive that defines the .note.ABI-tag section.
|
||||||
|
* - Compile the .s file to an object file.
|
||||||
|
*
|
||||||
|
* These steps are done in the invididual Makefiles for each applicable arch.
|
||||||
|
*/
|
||||||
|
static const struct {
|
||||||
|
int32_t namesz;
|
||||||
|
int32_t descsz;
|
||||||
|
int32_t type;
|
||||||
|
char name[sizeof ABI_VENDOR];
|
||||||
|
int32_t android_api;
|
||||||
|
} abitag __attribute__ ((section (ABI_SECTION), aligned(4), used)) = {
|
||||||
|
sizeof ABI_VENDOR,
|
||||||
|
sizeof(int32_t),
|
||||||
|
ABI_NOTETYPE,
|
||||||
|
ABI_VENDOR,
|
||||||
|
ABI_ANDROID_API,
|
||||||
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 The Android Open Source Project
|
* Copyright (C) 2006 The Android Open Source Project
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -25,71 +25,41 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include <sys/atomics.h>
|
|
||||||
|
|
||||||
#define FUTEX_SYSCALL 240
|
#include <sys/types.h>
|
||||||
#define FUTEX_WAIT 0
|
#include <linux/elf.h>
|
||||||
#define FUTEX_WAKE 1
|
#include <link.h>
|
||||||
|
|
||||||
int __futex_wait(volatile void *ftx, int val)
|
/* Dynamic binaries get this from the dynamic linker (system/linker), which
|
||||||
|
* we don't pull in for static bins. We also don't have a list of so's to
|
||||||
|
* iterate over, since there's really only a single monolithic blob of
|
||||||
|
* code/data.
|
||||||
|
*
|
||||||
|
* All we need to do is to find where the executable is in memory, and grab the
|
||||||
|
* phdr and phnum from there.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ld provides this to us in the default link script */
|
||||||
|
extern void *__executable_start;
|
||||||
|
|
||||||
|
int
|
||||||
|
dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size, void *data),
|
||||||
|
void *data)
|
||||||
{
|
{
|
||||||
int ret;
|
struct dl_phdr_info dl_info;
|
||||||
asm volatile (
|
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) &__executable_start;
|
||||||
"int $0x80;"
|
Elf32_Phdr *phdr = (Elf32_Phdr *)((unsigned long)ehdr + ehdr->e_phoff);
|
||||||
: "=a" (ret)
|
|
||||||
: "0" (FUTEX_SYSCALL),
|
|
||||||
"b" (ftx),
|
|
||||||
"c" (FUTEX_WAIT),
|
|
||||||
"d" (val),
|
|
||||||
"S" (0)
|
|
||||||
);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int __futex_wake(volatile void *ftx, int count)
|
/* TODO: again, copied from linker.c. Find a better home for this
|
||||||
{
|
* later. */
|
||||||
int ret;
|
if (ehdr->e_ident[EI_MAG0] != ELFMAG0) return -1;
|
||||||
asm volatile (
|
if (ehdr->e_ident[EI_MAG1] != ELFMAG1) return -1;
|
||||||
"int $0x80;"
|
if (ehdr->e_ident[EI_MAG2] != ELFMAG2) return -1;
|
||||||
: "=a" (ret)
|
if (ehdr->e_ident[EI_MAG3] != ELFMAG3) return -1;
|
||||||
: "0" (FUTEX_SYSCALL),
|
|
||||||
"b" (ftx),
|
|
||||||
"c" (FUTEX_WAKE),
|
|
||||||
"d" (count)
|
|
||||||
);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int __atomic_cmpxchg(int old, int new, volatile int* addr) {
|
dl_info.dlpi_addr = 0;
|
||||||
int xchg;
|
dl_info.dlpi_name = NULL;
|
||||||
asm volatile (
|
dl_info.dlpi_phdr = phdr;
|
||||||
"lock;"
|
dl_info.dlpi_phnum = ehdr->e_phnum;
|
||||||
"cmpxchg %%ecx, (%%edx);"
|
return cb(&dl_info, sizeof (struct dl_phdr_info), data);
|
||||||
"setne %%al;"
|
|
||||||
: "=a" (xchg)
|
|
||||||
: "a" (old),
|
|
||||||
"c" (new),
|
|
||||||
"d" (addr)
|
|
||||||
);
|
|
||||||
return xchg;
|
|
||||||
}
|
|
||||||
|
|
||||||
int __atomic_swap(int new, volatile int* addr) {
|
|
||||||
int old;
|
|
||||||
asm volatile (
|
|
||||||
"lock;"
|
|
||||||
"xchg %%ecx, (%%edx);"
|
|
||||||
: "=c" (old)
|
|
||||||
: "c" (new),
|
|
||||||
"d" (addr)
|
|
||||||
);
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
int __atomic_dec(volatile int* addr) {
|
|
||||||
int old;
|
|
||||||
do {
|
|
||||||
old = *addr;
|
|
||||||
} while (atomic_cmpxchg(old, old-1, addr));
|
|
||||||
return old;
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,655 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
Default header file for malloc-2.8.x, written by Doug Lea
|
* Copyright (C) 2012 The Android Open Source Project
|
||||||
and released to the public domain, as explained at
|
*
|
||||||
http://creativecommons.org/licenses/publicdomain.
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
last update: Mon Aug 15 08:55:52 2005 Doug Lea (dl at gee)
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
This header is for ANSI C/C++ only. You can set any of
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
the following #defines before including:
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* If USE_DL_PREFIX is defined, it is assumed that malloc.c
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
was also compiled with this option, so all routines
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
have names starting with "dl".
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
* If HAVE_USR_INCLUDE_MALLOC_H is defined, it is assumed that this
|
|
||||||
file will be #included AFTER <malloc.h>. This is needed only if
|
|
||||||
your system defines a struct mallinfo that is incompatible with the
|
|
||||||
standard one declared here. Otherwise, you can include this file
|
|
||||||
INSTEAD of your system system <malloc.h>. At least on ANSI, all
|
|
||||||
declarations should be compatible with system versions
|
|
||||||
|
|
||||||
* If MSPACES is defined, declarations for mspace versions are included.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MALLOC_280_H
|
|
||||||
#define MALLOC_280_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stddef.h> /* for size_t */
|
|
||||||
|
|
||||||
#if !ONLY_MSPACES
|
|
||||||
|
|
||||||
/* Check an additional macro for the five primary functions */
|
|
||||||
#if !defined(USE_DL_PREFIX)
|
|
||||||
#define dlcalloc calloc
|
|
||||||
#define dlfree free
|
|
||||||
#define dlmalloc malloc
|
|
||||||
#define dlmemalign memalign
|
|
||||||
#define dlrealloc realloc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef USE_DL_PREFIX
|
|
||||||
#define dlvalloc valloc
|
|
||||||
#define dlpvalloc pvalloc
|
|
||||||
#define dlmallinfo mallinfo
|
|
||||||
#define dlmallopt mallopt
|
|
||||||
#define dlmalloc_trim malloc_trim
|
|
||||||
#define dlmalloc_walk_free_pages \
|
|
||||||
malloc_walk_free_pages
|
|
||||||
#define dlmalloc_walk_heap \
|
|
||||||
malloc_walk_heap
|
|
||||||
#define dlmalloc_stats malloc_stats
|
|
||||||
#define dlmalloc_usable_size malloc_usable_size
|
|
||||||
#define dlmalloc_footprint malloc_footprint
|
|
||||||
#define dlmalloc_max_allowed_footprint \
|
|
||||||
malloc_max_allowed_footprint
|
|
||||||
#define dlmalloc_set_max_allowed_footprint \
|
|
||||||
malloc_set_max_allowed_footprint
|
|
||||||
#define dlmalloc_max_footprint malloc_max_footprint
|
|
||||||
#define dlindependent_calloc independent_calloc
|
|
||||||
#define dlindependent_comalloc independent_comalloc
|
|
||||||
#endif /* USE_DL_PREFIX */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
malloc(size_t n)
|
|
||||||
Returns a pointer to a newly allocated chunk of at least n bytes, or
|
|
||||||
null if no space is available, in which case errno is set to ENOMEM
|
|
||||||
on ANSI C systems.
|
|
||||||
|
|
||||||
If n is zero, malloc returns a minimum-sized chunk. (The minimum
|
|
||||||
size is 16 bytes on most 32bit systems, and 32 bytes on 64bit
|
|
||||||
systems.) Note that size_t is an unsigned type, so calls with
|
|
||||||
arguments that would be negative if signed are interpreted as
|
|
||||||
requests for huge amounts of space, which will often fail. The
|
|
||||||
maximum supported value of n differs across systems, but is in all
|
|
||||||
cases less than the maximum representable value of a size_t.
|
|
||||||
*/
|
|
||||||
void* dlmalloc(size_t);
|
|
||||||
|
|
||||||
/*
|
|
||||||
free(void* p)
|
|
||||||
Releases the chunk of memory pointed to by p, that had been previously
|
|
||||||
allocated using malloc or a related routine such as realloc.
|
|
||||||
It has no effect if p is null. If p was not malloced or already
|
|
||||||
freed, free(p) will by default cuase the current program to abort.
|
|
||||||
*/
|
|
||||||
void dlfree(void*);
|
|
||||||
|
|
||||||
/*
|
|
||||||
calloc(size_t n_elements, size_t element_size);
|
|
||||||
Returns a pointer to n_elements * element_size bytes, with all locations
|
|
||||||
set to zero.
|
|
||||||
*/
|
|
||||||
void* dlcalloc(size_t, size_t);
|
|
||||||
|
|
||||||
/*
|
|
||||||
realloc(void* p, size_t n)
|
|
||||||
Returns a pointer to a chunk of size n that contains the same data
|
|
||||||
as does chunk p up to the minimum of (n, p's size) bytes, or null
|
|
||||||
if no space is available.
|
|
||||||
|
|
||||||
The returned pointer may or may not be the same as p. The algorithm
|
|
||||||
prefers extending p in most cases when possible, otherwise it
|
|
||||||
employs the equivalent of a malloc-copy-free sequence.
|
|
||||||
|
|
||||||
If p is null, realloc is equivalent to malloc.
|
|
||||||
|
|
||||||
If space is not available, realloc returns null, errno is set (if on
|
|
||||||
ANSI) and p is NOT freed.
|
|
||||||
|
|
||||||
if n is for fewer bytes than already held by p, the newly unused
|
|
||||||
space is lopped off and freed if possible. realloc with a size
|
|
||||||
argument of zero (re)allocates a minimum-sized chunk.
|
|
||||||
|
|
||||||
The old unix realloc convention of allowing the last-free'd chunk
|
|
||||||
to be used as an argument to realloc is not supported.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void* dlrealloc(void*, size_t);
|
|
||||||
|
|
||||||
/*
|
|
||||||
memalign(size_t alignment, size_t n);
|
|
||||||
Returns a pointer to a newly allocated chunk of n bytes, aligned
|
|
||||||
in accord with the alignment argument.
|
|
||||||
|
|
||||||
The alignment argument should be a power of two. If the argument is
|
|
||||||
not a power of two, the nearest greater power is used.
|
|
||||||
8-byte alignment is guaranteed by normal malloc calls, so don't
|
|
||||||
bother calling memalign with an argument of 8 or less.
|
|
||||||
|
|
||||||
Overreliance on memalign is a sure way to fragment space.
|
|
||||||
*/
|
|
||||||
void* dlmemalign(size_t, size_t);
|
|
||||||
|
|
||||||
/*
|
|
||||||
valloc(size_t n);
|
|
||||||
Equivalent to memalign(pagesize, n), where pagesize is the page
|
|
||||||
size of the system. If the pagesize is unknown, 4096 is used.
|
|
||||||
*/
|
|
||||||
void* dlvalloc(size_t);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mallopt(int parameter_number, int parameter_value)
|
|
||||||
Sets tunable parameters The format is to provide a
|
|
||||||
(parameter-number, parameter-value) pair. mallopt then sets the
|
|
||||||
corresponding parameter to the argument value if it can (i.e., so
|
|
||||||
long as the value is meaningful), and returns 1 if successful else
|
|
||||||
0. SVID/XPG/ANSI defines four standard param numbers for mallopt,
|
|
||||||
normally defined in malloc.h. None of these are use in this malloc,
|
|
||||||
so setting them has no effect. But this malloc also supports other
|
|
||||||
options in mallopt:
|
|
||||||
|
|
||||||
Symbol param # default allowed param values
|
|
||||||
M_TRIM_THRESHOLD -1 2*1024*1024 any (-1U disables trimming)
|
|
||||||
M_GRANULARITY -2 page size any power of 2 >= page size
|
|
||||||
M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support)
|
|
||||||
*/
|
|
||||||
int dlmallopt(int, int);
|
|
||||||
|
|
||||||
#define M_TRIM_THRESHOLD (-1)
|
|
||||||
#define M_GRANULARITY (-2)
|
|
||||||
#define M_MMAP_THRESHOLD (-3)
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
malloc_footprint();
|
|
||||||
Returns the number of bytes obtained from the system. The total
|
|
||||||
number of bytes allocated by malloc, realloc etc., is less than this
|
|
||||||
value. Unlike mallinfo, this function returns only a precomputed
|
|
||||||
result, so can be called frequently to monitor memory consumption.
|
|
||||||
Even if locks are otherwise defined, this function does not use them,
|
|
||||||
so results might not be up to date.
|
|
||||||
*/
|
|
||||||
size_t dlmalloc_footprint();
|
|
||||||
|
|
||||||
/*
|
|
||||||
malloc_max_allowed_footprint();
|
|
||||||
Returns the number of bytes that the heap is allowed to obtain
|
|
||||||
from the system. malloc_footprint() should always return a
|
|
||||||
size less than or equal to max_allowed_footprint, unless the
|
|
||||||
max_allowed_footprint was set to a value smaller than the
|
|
||||||
footprint at the time.
|
|
||||||
|
|
||||||
This function is only available if dlmalloc.c was compiled
|
|
||||||
with USE_MAX_ALLOWED_FOOTPRINT set.
|
|
||||||
*/
|
|
||||||
size_t dlmalloc_max_allowed_footprint();
|
|
||||||
|
|
||||||
/*
|
|
||||||
malloc_set_max_allowed_footprint();
|
|
||||||
Set the maximum number of bytes that the heap is allowed to
|
|
||||||
obtain from the system. The size will be rounded up to a whole
|
|
||||||
page, and the rounded number will be returned from future calls
|
|
||||||
to malloc_max_allowed_footprint(). If the new max_allowed_footprint
|
|
||||||
is larger than the current footprint, the heap will never grow
|
|
||||||
larger than max_allowed_footprint. If the new max_allowed_footprint
|
|
||||||
is smaller than the current footprint, the heap will not grow
|
|
||||||
further.
|
|
||||||
|
|
||||||
This function is only available if dlmalloc.c was compiled
|
|
||||||
with USE_MAX_ALLOWED_FOOTPRINT set.
|
|
||||||
|
|
||||||
TODO: try to force the heap to give up memory in the shrink case,
|
|
||||||
and update this comment once that happens.
|
|
||||||
*/
|
|
||||||
void dlmalloc_set_max_allowed_footprint(size_t bytes);
|
|
||||||
|
|
||||||
/*
|
|
||||||
malloc_max_footprint();
|
|
||||||
Returns the maximum number of bytes obtained from the system. This
|
|
||||||
value will be greater than current footprint if deallocated space
|
|
||||||
has been reclaimed by the system. The peak number of bytes allocated
|
|
||||||
by malloc, realloc etc., is less than this value. Unlike mallinfo,
|
|
||||||
this function returns only a precomputed result, so can be called
|
|
||||||
frequently to monitor memory consumption. Even if locks are
|
|
||||||
otherwise defined, this function does not use them, so results might
|
|
||||||
not be up to date.
|
|
||||||
*/
|
|
||||||
size_t dlmalloc_max_footprint(void);
|
|
||||||
|
|
||||||
#if !NO_MALLINFO
|
|
||||||
/*
|
|
||||||
mallinfo()
|
|
||||||
Returns (by copy) a struct containing various summary statistics:
|
|
||||||
|
|
||||||
arena: current total non-mmapped bytes allocated from system
|
|
||||||
ordblks: the number of free chunks
|
|
||||||
smblks: always zero.
|
|
||||||
hblks: current number of mmapped regions
|
|
||||||
hblkhd: total bytes held in mmapped regions
|
|
||||||
usmblks: the maximum total allocated space. This will be greater
|
|
||||||
than current total if trimming has occurred.
|
|
||||||
fsmblks: always zero
|
|
||||||
uordblks: current total allocated space (normal or mmapped)
|
|
||||||
fordblks: total free space
|
|
||||||
keepcost: the maximum number of bytes that could ideally be released
|
|
||||||
back to system via malloc_trim. ("ideally" means that
|
|
||||||
it ignores page restrictions etc.)
|
|
||||||
|
|
||||||
Because these fields are ints, but internal bookkeeping may
|
|
||||||
be kept as longs, the reported values may wrap around zero and
|
|
||||||
thus be inaccurate.
|
|
||||||
*/
|
|
||||||
#ifndef HAVE_USR_INCLUDE_MALLOC_H
|
|
||||||
#ifndef _MALLOC_H_
|
|
||||||
#ifndef MALLINFO_FIELD_TYPE
|
|
||||||
#define MALLINFO_FIELD_TYPE size_t
|
|
||||||
#endif /* MALLINFO_FIELD_TYPE */
|
|
||||||
struct mallinfo {
|
|
||||||
MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */
|
|
||||||
MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */
|
|
||||||
MALLINFO_FIELD_TYPE smblks; /* always 0 */
|
|
||||||
MALLINFO_FIELD_TYPE hblks; /* always 0 */
|
|
||||||
MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */
|
|
||||||
MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */
|
|
||||||
MALLINFO_FIELD_TYPE fsmblks; /* always 0 */
|
|
||||||
MALLINFO_FIELD_TYPE uordblks; /* total allocated space */
|
|
||||||
MALLINFO_FIELD_TYPE fordblks; /* total free space */
|
|
||||||
MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */
|
|
||||||
};
|
|
||||||
#endif /* _MALLOC_H_ */
|
|
||||||
#endif /* HAVE_USR_INCLUDE_MALLOC_H */
|
|
||||||
|
|
||||||
struct mallinfo dlmallinfo(void);
|
|
||||||
#endif /* NO_MALLINFO */
|
|
||||||
|
|
||||||
/*
|
|
||||||
independent_calloc(size_t n_elements, size_t element_size, void* chunks[]);
|
|
||||||
|
|
||||||
independent_calloc is similar to calloc, but instead of returning a
|
|
||||||
single cleared space, it returns an array of pointers to n_elements
|
|
||||||
independent elements that can hold contents of size elem_size, each
|
|
||||||
of which starts out cleared, and can be independently freed,
|
|
||||||
realloc'ed etc. The elements are guaranteed to be adjacently
|
|
||||||
allocated (this is not guaranteed to occur with multiple callocs or
|
|
||||||
mallocs), which may also improve cache locality in some
|
|
||||||
applications.
|
|
||||||
|
|
||||||
The "chunks" argument is optional (i.e., may be null, which is
|
|
||||||
probably the most typical usage). If it is null, the returned array
|
|
||||||
is itself dynamically allocated and should also be freed when it is
|
|
||||||
no longer needed. Otherwise, the chunks array must be of at least
|
|
||||||
n_elements in length. It is filled in with the pointers to the
|
|
||||||
chunks.
|
|
||||||
|
|
||||||
In either case, independent_calloc returns this pointer array, or
|
|
||||||
null if the allocation failed. If n_elements is zero and "chunks"
|
|
||||||
is null, it returns a chunk representing an array with zero elements
|
|
||||||
(which should be freed if not wanted).
|
|
||||||
|
|
||||||
Each element must be individually freed when it is no longer
|
|
||||||
needed. If you'd like to instead be able to free all at once, you
|
|
||||||
should instead use regular calloc and assign pointers into this
|
|
||||||
space to represent elements. (In this case though, you cannot
|
|
||||||
independently free elements.)
|
|
||||||
|
|
||||||
independent_calloc simplifies and speeds up implementations of many
|
|
||||||
kinds of pools. It may also be useful when constructing large data
|
|
||||||
structures that initially have a fixed number of fixed-sized nodes,
|
|
||||||
but the number is not known at compile time, and some of the nodes
|
|
||||||
may later need to be freed. For example:
|
|
||||||
|
|
||||||
struct Node { int item; struct Node* next; };
|
|
||||||
|
|
||||||
struct Node* build_list() {
|
|
||||||
struct Node** pool;
|
|
||||||
int n = read_number_of_nodes_needed();
|
|
||||||
if (n <= 0) return 0;
|
|
||||||
pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0);
|
|
||||||
if (pool == 0) die();
|
|
||||||
// organize into a linked list...
|
|
||||||
struct Node* first = pool[0];
|
|
||||||
for (i = 0; i < n-1; ++i)
|
|
||||||
pool[i]->next = pool[i+1];
|
|
||||||
free(pool); // Can now free the array (or not, if it is needed later)
|
|
||||||
return first;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
void** dlindependent_calloc(size_t, size_t, void**);
|
|
||||||
|
|
||||||
/*
|
|
||||||
independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]);
|
|
||||||
|
|
||||||
independent_comalloc allocates, all at once, a set of n_elements
|
|
||||||
chunks with sizes indicated in the "sizes" array. It returns
|
|
||||||
an array of pointers to these elements, each of which can be
|
|
||||||
independently freed, realloc'ed etc. The elements are guaranteed to
|
|
||||||
be adjacently allocated (this is not guaranteed to occur with
|
|
||||||
multiple callocs or mallocs), which may also improve cache locality
|
|
||||||
in some applications.
|
|
||||||
|
|
||||||
The "chunks" argument is optional (i.e., may be null). If it is null
|
|
||||||
the returned array is itself dynamically allocated and should also
|
|
||||||
be freed when it is no longer needed. Otherwise, the chunks array
|
|
||||||
must be of at least n_elements in length. It is filled in with the
|
|
||||||
pointers to the chunks.
|
|
||||||
|
|
||||||
In either case, independent_comalloc returns this pointer array, or
|
|
||||||
null if the allocation failed. If n_elements is zero and chunks is
|
|
||||||
null, it returns a chunk representing an array with zero elements
|
|
||||||
(which should be freed if not wanted).
|
|
||||||
|
|
||||||
Each element must be individually freed when it is no longer
|
|
||||||
needed. If you'd like to instead be able to free all at once, you
|
|
||||||
should instead use a single regular malloc, and assign pointers at
|
|
||||||
particular offsets in the aggregate space. (In this case though, you
|
|
||||||
cannot independently free elements.)
|
|
||||||
|
|
||||||
independent_comallac differs from independent_calloc in that each
|
|
||||||
element may have a different size, and also that it does not
|
|
||||||
automatically clear elements.
|
|
||||||
|
|
||||||
independent_comalloc can be used to speed up allocation in cases
|
|
||||||
where several structs or objects must always be allocated at the
|
|
||||||
same time. For example:
|
|
||||||
|
|
||||||
struct Head { ... }
|
|
||||||
struct Foot { ... }
|
|
||||||
|
|
||||||
void send_message(char* msg) {
|
|
||||||
int msglen = strlen(msg);
|
|
||||||
size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) };
|
|
||||||
void* chunks[3];
|
|
||||||
if (independent_comalloc(3, sizes, chunks) == 0)
|
|
||||||
die();
|
|
||||||
struct Head* head = (struct Head*)(chunks[0]);
|
|
||||||
char* body = (char*)(chunks[1]);
|
|
||||||
struct Foot* foot = (struct Foot*)(chunks[2]);
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
|
|
||||||
In general though, independent_comalloc is worth using only for
|
|
||||||
larger values of n_elements. For small values, you probably won't
|
|
||||||
detect enough difference from series of malloc calls to bother.
|
|
||||||
|
|
||||||
Overuse of independent_comalloc can increase overall memory usage,
|
|
||||||
since it cannot reuse existing noncontiguous small chunks that
|
|
||||||
might be available for some of the elements.
|
|
||||||
*/
|
|
||||||
void** dlindependent_comalloc(size_t, size_t*, void**);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
pvalloc(size_t n);
|
|
||||||
Equivalent to valloc(minimum-page-that-holds(n)), that is,
|
|
||||||
round up n to nearest pagesize.
|
|
||||||
*/
|
*/
|
||||||
void* dlpvalloc(size_t);
|
|
||||||
|
|
||||||
/*
|
#ifndef LIBC_BIONIC_DLMALLOC_H_
|
||||||
malloc_trim(size_t pad);
|
#define LIBC_BIONIC_DLMALLOC_H_
|
||||||
|
|
||||||
If possible, gives memory back to the system (via negative arguments
|
/* Configure dlmalloc. */
|
||||||
to sbrk) if there is unused memory at the `high' end of the malloc
|
#define HAVE_GETPAGESIZE 1
|
||||||
pool or in unused MMAP segments. You can call this after freeing
|
#define MALLOC_INSPECT_ALL 1
|
||||||
large blocks of memory to potentially reduce the system-level memory
|
#define MSPACES 0
|
||||||
requirements of a program. However, it cannot guarantee to reduce
|
#define REALLOC_ZERO_BYTES_FREES 1
|
||||||
memory. Under some allocation patterns, some large free blocks of
|
#define USE_DL_PREFIX 1
|
||||||
memory will be locked between two used chunks, so they cannot be
|
#define USE_LOCKS 1
|
||||||
given back to the system.
|
#define LOCK_AT_FORK 1
|
||||||
|
#define USE_RECURSIVE_LOCK 0
|
||||||
|
#define USE_SPIN_LOCKS 0
|
||||||
|
|
||||||
The `pad' argument to malloc_trim represents the amount of free
|
/* Include the proper definitions. */
|
||||||
trailing space to leave untrimmed. If this argument is zero, only
|
#include "../upstream-dlmalloc/malloc.h"
|
||||||
the minimum amount of memory to maintain internal data structures
|
|
||||||
will be left. Non-zero arguments can be supplied to maintain enough
|
|
||||||
trailing space to service future expected allocations without having
|
|
||||||
to re-obtain memory from the system.
|
|
||||||
|
|
||||||
Malloc_trim returns 1 if it actually released any memory, else 0.
|
#endif // LIBC_BIONIC_DLMALLOC_H_
|
||||||
*/
|
|
||||||
int dlmalloc_trim(size_t);
|
|
||||||
|
|
||||||
/*
|
|
||||||
malloc_walk_free_pages(handler, harg)
|
|
||||||
|
|
||||||
Calls the provided handler on each free region in the heap. The
|
|
||||||
memory between start and end are guaranteed not to contain any
|
|
||||||
important data, so the handler is free to alter the contents
|
|
||||||
in any way. This can be used to advise the OS that large free
|
|
||||||
regions may be swapped out.
|
|
||||||
|
|
||||||
The value in harg will be passed to each call of the handler.
|
|
||||||
*/
|
|
||||||
void dlmalloc_walk_free_pages(void(*handler)(void *start, void *end, void *arg),
|
|
||||||
void *harg);
|
|
||||||
|
|
||||||
/*
|
|
||||||
malloc_walk_heap(handler, harg)
|
|
||||||
|
|
||||||
Calls the provided handler on each object or free region in the
|
|
||||||
heap. The handler will receive the chunk pointer and length, the
|
|
||||||
object pointer and length, and the value in harg on each call.
|
|
||||||
*/
|
|
||||||
void dlmalloc_walk_heap(void(*handler)(const void *chunkptr, size_t chunklen,
|
|
||||||
const void *userptr, size_t userlen,
|
|
||||||
void *arg),
|
|
||||||
void *harg);
|
|
||||||
|
|
||||||
/*
|
|
||||||
malloc_usable_size(void* p);
|
|
||||||
|
|
||||||
Returns the number of bytes you can actually use in
|
|
||||||
an allocated chunk, which may be more than you requested (although
|
|
||||||
often not) due to alignment and minimum size constraints.
|
|
||||||
You can use this many bytes without worrying about
|
|
||||||
overwriting other allocated objects. This is not a particularly great
|
|
||||||
programming practice. malloc_usable_size can be more useful in
|
|
||||||
debugging and assertions, for example:
|
|
||||||
|
|
||||||
p = malloc(n);
|
|
||||||
assert(malloc_usable_size(p) >= 256);
|
|
||||||
*/
|
|
||||||
size_t dlmalloc_usable_size(void*);
|
|
||||||
|
|
||||||
/*
|
|
||||||
malloc_stats();
|
|
||||||
Prints on stderr the amount of space obtained from the system (both
|
|
||||||
via sbrk and mmap), the maximum amount (which may be more than
|
|
||||||
current if malloc_trim and/or munmap got called), and the current
|
|
||||||
number of bytes allocated via malloc (or realloc, etc) but not yet
|
|
||||||
freed. Note that this is the number of bytes allocated, not the
|
|
||||||
number requested. It will be larger than the number requested
|
|
||||||
because of alignment and bookkeeping overhead. Because it includes
|
|
||||||
alignment wastage as being in use, this figure may be greater than
|
|
||||||
zero even when no user-level chunks are allocated.
|
|
||||||
|
|
||||||
The reported current and maximum system memory can be inaccurate if
|
|
||||||
a program makes other calls to system memory allocation functions
|
|
||||||
(normally sbrk) outside of malloc.
|
|
||||||
|
|
||||||
malloc_stats prints only the most commonly interesting statistics.
|
|
||||||
More information can be obtained by calling mallinfo.
|
|
||||||
*/
|
|
||||||
void dlmalloc_stats();
|
|
||||||
|
|
||||||
#endif /* !ONLY_MSPACES */
|
|
||||||
|
|
||||||
#if MSPACES
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace is an opaque type representing an independent
|
|
||||||
region of space that supports mspace_malloc, etc.
|
|
||||||
*/
|
|
||||||
typedef void* mspace;
|
|
||||||
|
|
||||||
/*
|
|
||||||
create_mspace creates and returns a new independent space with the
|
|
||||||
given initial capacity, or, if 0, the default granularity size. It
|
|
||||||
returns null if there is no system memory available to create the
|
|
||||||
space. If argument locked is non-zero, the space uses a separate
|
|
||||||
lock to control access. The capacity of the space will grow
|
|
||||||
dynamically as needed to service mspace_malloc requests. You can
|
|
||||||
control the sizes of incremental increases of this space by
|
|
||||||
compiling with a different DEFAULT_GRANULARITY or dynamically
|
|
||||||
setting with mallopt(M_GRANULARITY, value).
|
|
||||||
*/
|
|
||||||
mspace create_mspace(size_t capacity, int locked);
|
|
||||||
|
|
||||||
/*
|
|
||||||
destroy_mspace destroys the given space, and attempts to return all
|
|
||||||
of its memory back to the system, returning the total number of
|
|
||||||
bytes freed. After destruction, the results of access to all memory
|
|
||||||
used by the space become undefined.
|
|
||||||
*/
|
|
||||||
size_t destroy_mspace(mspace msp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
create_mspace_with_base uses the memory supplied as the initial base
|
|
||||||
of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this
|
|
||||||
space is used for bookkeeping, so the capacity must be at least this
|
|
||||||
large. (Otherwise 0 is returned.) When this initial space is
|
|
||||||
exhausted, additional memory will be obtained from the system.
|
|
||||||
Destroying this space will deallocate all additionally allocated
|
|
||||||
space (if possible) but not the initial base.
|
|
||||||
*/
|
|
||||||
mspace create_mspace_with_base(void* base, size_t capacity, int locked);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_malloc behaves as malloc, but operates within
|
|
||||||
the given space.
|
|
||||||
*/
|
|
||||||
void* mspace_malloc(mspace msp, size_t bytes);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_free behaves as free, but operates within
|
|
||||||
the given space.
|
|
||||||
|
|
||||||
If compiled with FOOTERS==1, mspace_free is not actually needed.
|
|
||||||
free may be called instead of mspace_free because freed chunks from
|
|
||||||
any space are handled by their originating spaces.
|
|
||||||
*/
|
|
||||||
void mspace_free(mspace msp, void* mem);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_realloc behaves as realloc, but operates within
|
|
||||||
the given space.
|
|
||||||
|
|
||||||
If compiled with FOOTERS==1, mspace_realloc is not actually
|
|
||||||
needed. realloc may be called instead of mspace_realloc because
|
|
||||||
realloced chunks from any space are handled by their originating
|
|
||||||
spaces.
|
|
||||||
*/
|
|
||||||
void* mspace_realloc(mspace msp, void* mem, size_t newsize);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_merge_objects will merge allocated memory mema and memb
|
|
||||||
together, provided memb immediately follows mema. It is roughly as
|
|
||||||
if memb has been freed and mema has been realloced to a larger size.
|
|
||||||
On successfully merging, mema will be returned. If either argument
|
|
||||||
is null or memb does not immediately follow mema, null will be
|
|
||||||
returned.
|
|
||||||
|
|
||||||
Both mema and memb should have been previously allocated using
|
|
||||||
malloc or a related routine such as realloc. If either mema or memb
|
|
||||||
was not malloced or was previously freed, the result is undefined,
|
|
||||||
but like mspace_free, the default is to abort the program.
|
|
||||||
*/
|
|
||||||
void* mspace_merge_objects(mspace msp, void* mema, void* memb);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_calloc behaves as calloc, but operates within
|
|
||||||
the given space.
|
|
||||||
*/
|
|
||||||
void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_memalign behaves as memalign, but operates within
|
|
||||||
the given space.
|
|
||||||
*/
|
|
||||||
void* mspace_memalign(mspace msp, size_t alignment, size_t bytes);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_independent_calloc behaves as independent_calloc, but
|
|
||||||
operates within the given space.
|
|
||||||
*/
|
|
||||||
void** mspace_independent_calloc(mspace msp, size_t n_elements,
|
|
||||||
size_t elem_size, void* chunks[]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_independent_comalloc behaves as independent_comalloc, but
|
|
||||||
operates within the given space.
|
|
||||||
*/
|
|
||||||
void** mspace_independent_comalloc(mspace msp, size_t n_elements,
|
|
||||||
size_t sizes[], void* chunks[]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_footprint() returns the number of bytes obtained from the
|
|
||||||
system for this space.
|
|
||||||
*/
|
|
||||||
size_t mspace_footprint(mspace msp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_max_allowed_footprint() returns the number of bytes that
|
|
||||||
this space is allowed to obtain from the system. See
|
|
||||||
malloc_max_allowed_footprint() for a more in-depth description.
|
|
||||||
|
|
||||||
This function is only available if dlmalloc.c was compiled
|
|
||||||
with USE_MAX_ALLOWED_FOOTPRINT set.
|
|
||||||
*/
|
|
||||||
size_t mspace_max_allowed_footprint(mspace msp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_set_max_allowed_footprint() sets the maximum number of
|
|
||||||
bytes (rounded up to a page) that this space is allowed to
|
|
||||||
obtain from the system. See malloc_set_max_allowed_footprint()
|
|
||||||
for a more in-depth description.
|
|
||||||
|
|
||||||
This function is only available if dlmalloc.c was compiled
|
|
||||||
with USE_MAX_ALLOWED_FOOTPRINT set.
|
|
||||||
*/
|
|
||||||
void mspace_set_max_allowed_footprint(mspace msp, size_t bytes);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_max_footprint() returns the maximum number of bytes obtained
|
|
||||||
from the system over the lifetime of this space.
|
|
||||||
*/
|
|
||||||
size_t mspace_max_footprint(mspace msp);
|
|
||||||
|
|
||||||
|
|
||||||
#if !NO_MALLINFO
|
|
||||||
/*
|
|
||||||
mspace_mallinfo behaves as mallinfo, but reports properties of
|
|
||||||
the given space.
|
|
||||||
*/
|
|
||||||
struct mallinfo mspace_mallinfo(mspace msp);
|
|
||||||
#endif /* NO_MALLINFO */
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_malloc_stats behaves as malloc_stats, but reports
|
|
||||||
properties of the given space.
|
|
||||||
*/
|
|
||||||
void mspace_malloc_stats(mspace msp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mspace_trim behaves as malloc_trim, but
|
|
||||||
operates within the given space.
|
|
||||||
*/
|
|
||||||
int mspace_trim(mspace msp, size_t pad);
|
|
||||||
|
|
||||||
/*
|
|
||||||
An alias for mallopt.
|
|
||||||
*/
|
|
||||||
int mspace_mallopt(int, int);
|
|
||||||
|
|
||||||
#endif /* MSPACES */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}; /* end of extern "C" */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* MALLOC_280_H */
|
|
||||||
|
|||||||
76
libc/bionic/getcwd.cpp
Normal file
76
libc/bionic/getcwd.cpp
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * 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.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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 <errno.h>
|
||||||
|
|
||||||
|
extern "C" int __getcwd(char* buf, size_t size);
|
||||||
|
|
||||||
|
char* getcwd(char* buf, size_t size) {
|
||||||
|
// You can't specify size 0 unless you're asking us to allocate for you.
|
||||||
|
if (buf != NULL && size == 0) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allocate a buffer if necessary.
|
||||||
|
char* allocated_buf = NULL;
|
||||||
|
if (buf == NULL) {
|
||||||
|
size_t allocated_size = size;
|
||||||
|
if (size == 0) {
|
||||||
|
// The Linux kernel won't return more than a page, so translate size 0 to 4KiB.
|
||||||
|
// TODO: if we need to support paths longer than that, we'll have to walk the tree ourselves.
|
||||||
|
size = getpagesize();
|
||||||
|
}
|
||||||
|
buf = allocated_buf = static_cast<char*>(malloc(allocated_size));
|
||||||
|
if (buf == NULL) {
|
||||||
|
// malloc set errno.
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ask the kernel to fill our buffer.
|
||||||
|
int rc = __getcwd(buf, size);
|
||||||
|
if (rc == -1) {
|
||||||
|
free(allocated_buf);
|
||||||
|
// __getcwd set errno.
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we allocated a whole page, only return as large an allocation as necessary.
|
||||||
|
if (allocated_buf != NULL) {
|
||||||
|
if (size == 0) {
|
||||||
|
buf = strdup(allocated_buf);
|
||||||
|
free(allocated_buf);
|
||||||
|
} else {
|
||||||
|
buf = allocated_buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user