Compare commits
	
		
			574 Commits
		
	
	
		
			android-5.
			...
			l-preview
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					dec4de456c | ||
| 
						 | 
					4a9e1937c5 | ||
| 
						 | 
					5281e1fb15 | ||
| 
						 | 
					90aa7e374f | ||
| 
						 | 
					8bb12127e6 | ||
| 
						 | 
					3ce0769aa5 | ||
| 
						 | 
					e91d9cd4ad | ||
| 
						 | 
					f5e0258268 | ||
| 
						 | 
					ea6eae182a | ||
| 
						 | 
					4544d9f9bf | ||
| 
						 | 
					71cbcdcf94 | ||
| 
						 | 
					a7c2e0bad6 | ||
| 
						 | 
					97df16ba5c | ||
| 
						 | 
					1816025684 | ||
| 
						 | 
					c229705051 | ||
| 
						 | 
					a6bee4df4c | ||
| 
						 | 
					083769a3df | ||
| 
						 | 
					fee09e556f | ||
| 
						 | 
					94571f9ade | ||
| 
						 | 
					90a29db0f4 | ||
| 
						 | 
					4c0862474e | ||
| 
						 | 
					472cce5c98 | ||
| 
						 | 
					8c3901b299 | ||
| 
						 | 
					efee1ce46a | ||
| 
						 | 
					2698f9ef84 | ||
| 
						 | 
					14538ca75e | ||
| 
						 | 
					62a665a605 | ||
| 
						 | 
					78ba823033 | ||
| 
						 | 
					8dd3b65f2d | ||
| 
						 | 
					488268b134 | ||
| 
						 | 
					e9c216fca5 | ||
| 
						 | 
					9afb2f2106 | ||
| 
						 | 
					d0944d9ed3 | ||
| 
						 | 
					f183f95946 | ||
| 
						 | 
					8a7f8387b3 | ||
| 
						 | 
					ca75f9cdeb | ||
| 
						 | 
					72d72d9126 | ||
| 
						 | 
					0c0e728bd8 | ||
| 
						 | 
					667853d477 | ||
| 
						 | 
					cfd8c45725 | ||
| 
						 | 
					ac3c94d031 | ||
| 
						 | 
					51166d3aa2 | ||
| 
						 | 
					0511534dcb | ||
| 
						 | 
					bfeef2d3a9 | ||
| 
						 | 
					75129ae9f3 | ||
| 
						 | 
					3ea4d56ed4 | ||
| 
						 | 
					1364101067 | ||
| 
						 | 
					b4b15c63a1 | ||
| 
						 | 
					5cc5c5ea0b | ||
| 
						 | 
					2fbb1b653e | ||
| 
						 | 
					5a3ca37458 | ||
| 
						 | 
					c9e4f2de0a | ||
| 
						 | 
					658727e111 | ||
| 
						 | 
					3d773274ad | ||
| 
						 | 
					e8d9057e30 | ||
| 
						 | 
					7d3f553f98 | ||
| 
						 | 
					eeb9aa02b7 | ||
| 
						 | 
					b0fd55608e | ||
| 
						 | 
					6d2dd6a740 | ||
| 
						 | 
					75d66dd9a7 | ||
| 
						 | 
					81fca35672 | ||
| 
						 | 
					6869d26ad9 | ||
| 
						 | 
					b5cba6081b | ||
| 
						 | 
					1aaa17802c | ||
| 
						 | 
					9969fecad2 | ||
| 
						 | 
					f4320e867c | ||
| 
						 | 
					f04a8bc226 | ||
| 
						 | 
					513e29e16f | ||
| 
						 | 
					6d569b9201 | ||
| 
						 | 
					07e5bc152d | ||
| 
						 | 
					a6eef3be10 | ||
| 
						 | 
					884a3de60f | ||
| 
						 | 
					558ec8103b | ||
| 
						 | 
					db6fea86a5 | ||
| 
						 | 
					b84f667e93 | ||
| 
						 | 
					9b543ffeac | ||
| 
						 | 
					ae97a776ea | ||
| 
						 | 
					48be71d02b | ||
| 
						 | 
					4ef0e59f33 | ||
| 
						 | 
					8d0b2dbf21 | ||
| 
						 | 
					d5df4124bb | ||
| 
						 | 
					2d111d9eb1 | ||
| 
						 | 
					b19bd93f8b | ||
| 
						 | 
					1b20dafdbe | ||
| 
						 | 
					cadccfd708 | ||
| 
						 | 
					89fd32362b | ||
| 
						 | 
					7d849ac378 | ||
| 
						 | 
					76ac4d0853 | ||
| 
						 | 
					81156d93c5 | ||
| 
						 | 
					0c8fb51e6b | ||
| 
						 | 
					f8896c6c93 | ||
| 
						 | 
					12e3f22c7c | ||
| 
						 | 
					252c1ac973 | ||
| 
						 | 
					701cf9419b | ||
| 
						 | 
					e04aa450c2 | ||
| 
						 | 
					31e072fc9b | ||
| 
						 | 
					ecf532fa1c | ||
| 
						 | 
					c4bcc75f09 | ||
| 
						 | 
					1f7d5ac538 | ||
| 
						 | 
					6cdeb5234d | ||
| 
						 | 
					0481471b1b | ||
| 
						 | 
					e49491ada4 | ||
| 
						 | 
					3a5aeba4bd | ||
| 
						 | 
					d9898c5b82 | ||
| 
						 | 
					9997daa0ff | ||
| 
						 | 
					b104be321f | ||
| 
						 | 
					b0c0037370 | ||
| 
						 | 
					85a932c0c9 | ||
| 
						 | 
					c8bd2abab2 | ||
| 
						 | 
					96bc37f2e1 | ||
| 
						 | 
					73e6c9b393 | ||
| 
						 | 
					188d093993 | ||
| 
						 | 
					7ca5c4b99b | ||
| 
						 | 
					98ab0c52f5 | ||
| 
						 | 
					d644fecc8e | ||
| 
						 | 
					e93be99da0 | ||
| 
						 | 
					690211fcf8 | ||
| 
						 | 
					a4ed64d4c3 | ||
| 
						 | 
					aa66e88280 | ||
| 
						 | 
					8cf61dab5f | ||
| 
						 | 
					852d4fbbe9 | ||
| 
						 | 
					055a59c3ed | ||
| 
						 | 
					17e7d3208c | ||
| 
						 | 
					abefc93ff3 | ||
| 
						 | 
					a864e72b56 | ||
| 
						 | 
					528ad742c6 | ||
| 
						 | 
					567d3fcb7e | ||
| 
						 | 
					4fcfd3a474 | ||
| 
						 | 
					af12924f67 | ||
| 
						 | 
					5a69da8d7a | ||
| 
						 | 
					f05410edc6 | ||
| 
						 | 
					c08c25b4c9 | ||
| 
						 | 
					21db6ff108 | ||
| 
						 | 
					4a6e71100e | ||
| 
						 | 
					c2d39088d8 | ||
| 
						 | 
					9a05e3818a | ||
| 
						 | 
					fc5a93f7a2 | ||
| 
						 | 
					ebf37e3886 | ||
| 
						 | 
					04643c181c | ||
| 
						 | 
					a71b4c3f14 | ||
| 
						 | 
					c57e5c8289 | ||
| 
						 | 
					2169e17482 | ||
| 
						 | 
					31165edf57 | ||
| 
						 | 
					3c5037f1b3 | ||
| 
						 | 
					87b6906f6e | ||
| 
						 | 
					b05ec5ae93 | ||
| 
						 | 
					8642165344 | ||
| 
						 | 
					0ab5fd9a5a | ||
| 
						 | 
					49eed7db79 | ||
| 
						 | 
					08dc9d83a2 | ||
| 
						 | 
					93951cfa96 | ||
| 
						 | 
					0dc39f9952 | ||
| 
						 | 
					e8a95624b6 | ||
| 
						 | 
					34c987a6dd | ||
| 
						 | 
					b2da456253 | ||
| 
						 | 
					a186b2e0ca | ||
| 
						 | 
					d9cb0ed281 | ||
| 
						 | 
					60452a211c | ||
| 
						 | 
					9f423c554a | ||
| 
						 | 
					c296e4f151 | ||
| 
						 | 
					413de5b0d4 | ||
| 
						 | 
					04303f5a8a | ||
| 
						 | 
					e716044918 | ||
| 
						 | 
					6fe376d392 | ||
| 
						 | 
					adc01348ee | ||
| 
						 | 
					8e4d371091 | ||
| 
						 | 
					13d6023aac | ||
| 
						 | 
					d5e1c583a6 | ||
| 
						 | 
					fb8d60f743 | ||
| 
						 | 
					653676dde8 | ||
| 
						 | 
					755318548d | ||
| 
						 | 
					82e71085c2 | ||
| 
						 | 
					90be6c5fc5 | ||
| 
						 | 
					6ced005123 | ||
| 
						 | 
					bee1993a14 | ||
| 
						 | 
					0bd28a43da | ||
| 
						 | 
					ba8d4f460b | ||
| 
						 | 
					6a310f4ad6 | ||
| 
						 | 
					1b77423eff | ||
| 
						 | 
					77784cb9b7 | ||
| 
						 | 
					bf50e2645d | ||
| 
						 | 
					03fef1f511 | ||
| 
						 | 
					2ad11a96a1 | ||
| 
						 | 
					2f5cf100a8 | ||
| 
						 | 
					e2d86feb7b | ||
| 
						 | 
					3ec67de051 | ||
| 
						 | 
					36a5aa057c | ||
| 
						 | 
					56433ee2a2 | ||
| 
						 | 
					e7c9a387fa | ||
| 
						 | 
					f240aa8089 | ||
| 
						 | 
					34ac60ca16 | ||
| 
						 | 
					7c02d9428c | ||
| 
						 | 
					4a6e9a835a | ||
| 
						 | 
					17cc8e539a | ||
| 
						 | 
					b1a6c319c4 | ||
| 
						 | 
					1cff9a8964 | ||
| 
						 | 
					aea393c096 | ||
| 
						 | 
					8f61d99183 | ||
| 
						 | 
					380a3be757 | ||
| 
						 | 
					148dff3ec6 | ||
| 
						 | 
					370704d69d | ||
| 
						 | 
					837a962bf5 | ||
| 
						 | 
					5cba3c6f8e | ||
| 
						 | 
					2997ae83d5 | ||
| 
						 | 
					e8ba50fe0d | ||
| 
						 | 
					0b8f6d592a | ||
| 
						 | 
					36f451a6d9 | ||
| 
						 | 
					eb27bbae8f | ||
| 
						 | 
					95b0c6a940 | ||
| 
						 | 
					2c58104718 | ||
| 
						 | 
					2214a1ce17 | ||
| 
						 | 
					85ef3b5b80 | ||
| 
						 | 
					ae51accf22 | ||
| 
						 | 
					5c2264a136 | ||
| 
						 | 
					5681fe8eae | ||
| 
						 | 
					26a8eb50a8 | ||
| 
						 | 
					73d2059f9b | ||
| 
						 | 
					f83c208b82 | ||
| 
						 | 
					21451f5bf6 | ||
| 
						 | 
					c729d4f237 | ||
| 
						 | 
					a40a16eab1 | ||
| 
						 | 
					8fb639ca91 | ||
| 
						 | 
					69c2d7dc64 | ||
| 
						 | 
					460ad7454a | ||
| 
						 | 
					e39e47c6b3 | ||
| 
						 | 
					0f001b67fe | ||
| 
						 | 
					d74aa58035 | ||
| 
						 | 
					aad92067bf | ||
| 
						 | 
					66bbf1595c | ||
| 
						 | 
					6abf624d12 | ||
| 
						 | 
					a6ac54a215 | ||
| 
						 | 
					8d8a789c49 | ||
| 
						 | 
					5f35710fad | ||
| 
						 | 
					6487f0d834 | ||
| 
						 | 
					9aea164457 | ||
| 
						 | 
					5920a9ad5f | ||
| 
						 | 
					a4831cb4a3 | ||
| 
						 | 
					ea66004c4a | ||
| 
						 | 
					9990b3973b | ||
| 
						 | 
					33df10f284 | ||
| 
						 | 
					b587f339db | ||
| 
						 | 
					c71483c0b3 | ||
| 
						 | 
					bce18c9163 | ||
| 
						 | 
					d9ff722661 | ||
| 
						 | 
					3c3624f3df | ||
| 
						 | 
					671f96cd44 | ||
| 
						 | 
					011e111d29 | ||
| 
						 | 
					201f36d23b | ||
| 
						 | 
					cf5fc80c3e | ||
| 
						 | 
					14669a939d | ||
| 
						 | 
					d3d89f0d28 | ||
| 
						 | 
					fc829736e1 | ||
| 
						 | 
					b4673c4102 | ||
| 
						 | 
					f903558446 | ||
| 
						 | 
					e07b4da53d | ||
| 
						 | 
					320a01d516 | ||
| 
						 | 
					498eb18b82 | ||
| 
						 | 
					f9e147b0bf | ||
| 
						 | 
					b3ebfecdae | ||
| 
						 | 
					b2a30ee8d2 | ||
| 
						 | 
					8adace5f2c | ||
| 
						 | 
					b58db8b083 | ||
| 
						 | 
					001815ed19 | ||
| 
						 | 
					7b956ede3f | ||
| 
						 | 
					aca9cae309 | ||
| 
						 | 
					27a9aed819 | ||
| 
						 | 
					c74a7680a4 | ||
| 
						 | 
					aa13e839f0 | ||
| 
						 | 
					44352f5f7f | ||
| 
						 | 
					c0cd9ce5df | ||
| 
						 | 
					4b41555ba5 | ||
| 
						 | 
					f0d8970435 | ||
| 
						 | 
					05f0bfd6c5 | ||
| 
						 | 
					afe58ad989 | ||
| 
						 | 
					4ee7c325df | ||
| 
						 | 
					356a6249d8 | ||
| 
						 | 
					071bed8091 | ||
| 
						 | 
					fc8974b7aa | ||
| 
						 | 
					1737b15937 | ||
| 
						 | 
					8f3b8f523e | ||
| 
						 | 
					58bb54c38b | ||
| 
						 | 
					5c1a7fdbd5 | ||
| 
						 | 
					5dea47221a | ||
| 
						 | 
					450aaa018d | ||
| 
						 | 
					e880c736d6 | ||
| 
						 | 
					8da304b997 | ||
| 
						 | 
					a3ad450a2e | ||
| 
						 | 
					28f1770101 | ||
| 
						 | 
					69fb9f3f40 | ||
| 
						 | 
					3b10ba6f1b | ||
| 
						 | 
					319356e39c | ||
| 
						 | 
					c7de919129 | ||
| 
						 | 
					6676a7d4ee | ||
| 
						 | 
					847e52b9b7 | ||
| 
						 | 
					1d53ae2a01 | ||
| 
						 | 
					ec95a9cf11 | ||
| 
						 | 
					296895f1a9 | ||
| 
						 | 
					86f594b19b | ||
| 
						 | 
					29bbc9dd4c | ||
| 
						 | 
					4625dd751e | ||
| 
						 | 
					e057b9fc82 | ||
| 
						 | 
					4cafa3ce80 | ||
| 
						 | 
					9685c30a23 | ||
| 
						 | 
					a492605849 | ||
| 
						 | 
					0cd83ebb0e | ||
| 
						 | 
					5120bcf9f1 | ||
| 
						 | 
					c2048944ff | ||
| 
						 | 
					11387985d2 | ||
| 
						 | 
					e505cc66a6 | ||
| 
						 | 
					4bea498544 | ||
| 
						 | 
					32429606bf | ||
| 
						 | 
					bbe06e0da1 | ||
| 
						 | 
					e0c56efddf | ||
| 
						 | 
					83b637fa28 | ||
| 
						 | 
					851135bf99 | ||
| 
						 | 
					1f39afc8d4 | ||
| 
						 | 
					cc4259ed92 | ||
| 
						 | 
					f6824b26ae | ||
| 
						 | 
					29f06943a1 | ||
| 
						 | 
					416d7ddaff | ||
| 
						 | 
					b6b5cb5389 | ||
| 
						 | 
					f4e721dd51 | ||
| 
						 | 
					af9da4a343 | ||
| 
						 | 
					fbe9d3dfeb | ||
| 
						 | 
					052fa3a34c | ||
| 
						 | 
					15b914c8f3 | ||
| 
						 | 
					4f8268e38f | ||
| 
						 | 
					9e4ffa7032 | ||
| 
						 | 
					857fa6b2a3 | ||
| 
						 | 
					34da32e7dd | ||
| 
						 | 
					6ecd1cd195 | ||
| 
						 | 
					a2c6ae6f84 | ||
| 
						 | 
					b78e60e7b7 | ||
| 
						 | 
					cb322a1168 | ||
| 
						 | 
					a40fdbd565 | ||
| 
						 | 
					64ae11ab76 | ||
| 
						 | 
					cc7e5f489f | ||
| 
						 | 
					6bfcefe02f | ||
| 
						 | 
					07401c7136 | ||
| 
						 | 
					e5055179fd | ||
| 
						 | 
					f1e64b5c17 | ||
| 
						 | 
					f73183f1a3 | ||
| 
						 | 
					7b87d441b0 | ||
| 
						 | 
					59de803af9 | ||
| 
						 | 
					9f5dee55aa | ||
| 
						 | 
					3e4a0099a1 | ||
| 
						 | 
					c674edbf27 | ||
| 
						 | 
					608217e167 | ||
| 
						 | 
					d2bd3c4717 | ||
| 
						 | 
					14241402de | ||
| 
						 | 
					c764fb24cc | ||
| 
						 | 
					57b7a6110e | ||
| 
						 | 
					9e307af982 | ||
| 
						 | 
					ae558d6b4b | ||
| 
						 | 
					a4a8c4feb8 | ||
| 
						 | 
					00aaea3645 | ||
| 
						 | 
					9d34f6a909 | ||
| 
						 | 
					0d15094287 | ||
| 
						 | 
					0b9fa4c9bf | ||
| 
						 | 
					ef619cc083 | ||
| 
						 | 
					4756afe3d5 | ||
| 
						 | 
					4caa1f0977 | ||
| 
						 | 
					538db6d2e6 | ||
| 
						 | 
					2b3b2ecee8 | ||
| 
						 | 
					2e6c5fc4e9 | ||
| 
						 | 
					2bd88d450e | ||
| 
						 | 
					9598b8c415 | ||
| 
						 | 
					47793d6a29 | ||
| 
						 | 
					3157211849 | ||
| 
						 | 
					2320b02c7d | ||
| 
						 | 
					d5fbc37119 | ||
| 
						 | 
					6b841db2ba | ||
| 
						 | 
					b6ed54076a | ||
| 
						 | 
					0e7f8a9e52 | ||
| 
						 | 
					7134fc3089 | ||
| 
						 | 
					c4a1de1ae2 | ||
| 
						 | 
					3bcd414b78 | ||
| 
						 | 
					dc1fb7000a | ||
| 
						 | 
					55244a9bdb | ||
| 
						 | 
					2b021e1066 | ||
| 
						 | 
					b61c50647b | ||
| 
						 | 
					1e8587a479 | ||
| 
						 | 
					c5d6df6f2f | ||
| 
						 | 
					35d226e05d | ||
| 
						 | 
					b9d674c8ad | ||
| 
						 | 
					09c39d6df0 | ||
| 
						 | 
					6f4220c49e | ||
| 
						 | 
					f4c948a9e9 | ||
| 
						 | 
					17f83c93cb | ||
| 
						 | 
					f800969d35 | ||
| 
						 | 
					e4fcc3ad2b | ||
| 
						 | 
					b810462028 | ||
| 
						 | 
					8a76ee821e | ||
| 
						 | 
					02aa70589d | ||
| 
						 | 
					2222eae61e | ||
| 
						 | 
					3a25ab952b | ||
| 
						 | 
					934c8015d5 | ||
| 
						 | 
					ce6b1abbb1 | ||
| 
						 | 
					54d24e099c | ||
| 
						 | 
					6d40d34908 | ||
| 
						 | 
					5d9e145c62 | ||
| 
						 | 
					3c7c9a8d3f | ||
| 
						 | 
					db2e0247ed | ||
| 
						 | 
					fd5ee9aebc | ||
| 
						 | 
					0baf2ca34c | ||
| 
						 | 
					5f5cc45cf0 | ||
| 
						 | 
					205cc41556 | ||
| 
						 | 
					2cfb4e8e2e | ||
| 
						 | 
					2b6cdb5e45 | ||
| 
						 | 
					4571f31bd4 | ||
| 
						 | 
					7d05f741e7 | ||
| 
						 | 
					019d395811 | ||
| 
						 | 
					1467dfe3e8 | ||
| 
						 | 
					d0cce14364 | ||
| 
						 | 
					891ec7a6e4 | ||
| 
						 | 
					8457779b34 | ||
| 
						 | 
					ad5e8b5073 | ||
| 
						 | 
					0d4ccee351 | ||
| 
						 | 
					224ff048ef | ||
| 
						 | 
					104a472958 | ||
| 
						 | 
					76212eeb53 | ||
| 
						 | 
					9a74e4c15c | ||
| 
						 | 
					b3aaf398e1 | ||
| 
						 | 
					4f85c6ffd3 | ||
| 
						 | 
					1f4c536fd5 | ||
| 
						 | 
					f2c1e7ee78 | ||
| 
						 | 
					db0785cbf9 | ||
| 
						 | 
					042426ba63 | ||
| 
						 | 
					6e3823d37e | ||
| 
						 | 
					edd81faff0 | ||
| 
						 | 
					e942b3ed81 | ||
| 
						 | 
					00c16c1b92 | ||
| 
						 | 
					51a22a12ab | ||
| 
						 | 
					4d0f742afe | ||
| 
						 | 
					ca5b6a74a7 | ||
| 
						 | 
					30214b901e | ||
| 
						 | 
					c5a13efa9b | ||
| 
						 | 
					a0db464187 | ||
| 
						 | 
					bc9f9f25bf | ||
| 
						 | 
					3788a1ee8e | ||
| 
						 | 
					3726f9c38b | ||
| 
						 | 
					1c5e415f8c | ||
| 
						 | 
					88a1f520d2 | ||
| 
						 | 
					f2d8c357ee | ||
| 
						 | 
					651a0683ca | ||
| 
						 | 
					92f0c91b82 | ||
| 
						 | 
					01bd32e0e4 | ||
| 
						 | 
					d994622ebf | ||
| 
						 | 
					6b6364a7fc | ||
| 
						 | 
					cdd2f072af | ||
| 
						 | 
					512bc52326 | ||
| 
						 | 
					85ebcfceb6 | ||
| 
						 | 
					e380960813 | ||
| 
						 | 
					f3868fa735 | ||
| 
						 | 
					51fde5b865 | ||
| 
						 | 
					b4b7e0547d | ||
| 
						 | 
					13bab43337 | ||
| 
						 | 
					3a238ae762 | ||
| 
						 | 
					9d2a05a6dd | ||
| 
						 | 
					bb91a1b845 | ||
| 
						 | 
					28285f85a1 | ||
| 
						 | 
					8b91980e4c | ||
| 
						 | 
					1628eb1d43 | ||
| 
						 | 
					afc8672387 | ||
| 
						 | 
					df85f50b82 | ||
| 
						 | 
					de69069fcf | ||
| 
						 | 
					9eae8405e8 | ||
| 
						 | 
					a7ef8188e2 | ||
| 
						 | 
					6a918870ba | ||
| 
						 | 
					447fe1c23b | ||
| 
						 | 
					b6cc8e00cd | ||
| 
						 | 
					36bacd237d | ||
| 
						 | 
					1aec7c1a35 | ||
| 
						 | 
					0f7ed163cf | ||
| 
						 | 
					e03e1eac0b | ||
| 
						 | 
					4ad5066e1d | ||
| 
						 | 
					861c0ef37b | ||
| 
						 | 
					a7dc7600fe | ||
| 
						 | 
					4916706cfe | ||
| 
						 | 
					17886971ff | ||
| 
						 | 
					f4c1a36a45 | ||
| 
						 | 
					2b591b3742 | ||
| 
						 | 
					aa0f2bdbc2 | ||
| 
						 | 
					52f8271fa9 | ||
| 
						 | 
					a406ee6d5f | ||
| 
						 | 
					24dcda0f4f | ||
| 
						 | 
					ed48534718 | ||
| 
						 | 
					50a9630cc2 | ||
| 
						 | 
					905e6d58aa | ||
| 
						 | 
					a4c14fda91 | ||
| 
						 | 
					1abb8bd21d | ||
| 
						 | 
					83b9826e68 | ||
| 
						 | 
					79310994d2 | ||
| 
						 | 
					c7706a02ad | ||
| 
						 | 
					18a1bbe6e1 | ||
| 
						 | 
					40a5217448 | ||
| 
						 | 
					123172ae37 | ||
| 
						 | 
					f1837377d2 | ||
| 
						 | 
					dbf52ec37b | ||
| 
						 | 
					4151ea73b7 | ||
| 
						 | 
					d6f614a4e1 | ||
| 
						 | 
					3e424d0a24 | ||
| 
						 | 
					bc5a3ec6df | ||
| 
						 | 
					7d22a45196 | ||
| 
						 | 
					dd37251c47 | ||
| 
						 | 
					f965075749 | ||
| 
						 | 
					be0e43b776 | ||
| 
						 | 
					f9bfc2ff8e | ||
| 
						 | 
					afe6360627 | ||
| 
						 | 
					337c0cefdc | ||
| 
						 | 
					efe13832dc | ||
| 
						 | 
					8a2ecf868f | ||
| 
						 | 
					21972b61ec | ||
| 
						 | 
					1a918d9be8 | ||
| 
						 | 
					39d903aea9 | ||
| 
						 | 
					8c66fd798e | ||
| 
						 | 
					f1e83cc34a | ||
| 
						 | 
					8dbe3f0f51 | ||
| 
						 | 
					ba23bd0a40 | ||
| 
						 | 
					467e49be70 | ||
| 
						 | 
					5d2f86f363 | ||
| 
						 | 
					ea42a6caea | ||
| 
						 | 
					3758a244cf | ||
| 
						 | 
					e26ac7f776 | ||
| 
						 | 
					ca70453e84 | ||
| 
						 | 
					79b5a39617 | ||
| 
						 | 
					f541650828 | ||
| 
						 | 
					0f7d882bb7 | ||
| 
						 | 
					4d421901e5 | ||
| 
						 | 
					2b67d7dee0 | ||
| 
						 | 
					925d388e24 | ||
| 
						 | 
					3ad8ecb64e | ||
| 
						 | 
					b828eaeb45 | ||
| 
						 | 
					ee7f1b5946 | ||
| 
						 | 
					1fb90a8aa0 | ||
| 
						 | 
					6b55ba54ef | ||
| 
						 | 
					e9731387f4 | ||
| 
						 | 
					97e31dedf0 | ||
| 
						 | 
					7dd126a38c | ||
| 
						 | 
					9c07aee83b | ||
| 
						 | 
					3c2b71ad56 | ||
| 
						 | 
					6425327c32 | ||
| 
						 | 
					d18b87f38d | ||
| 
						 | 
					8a3d1ca183 | ||
| 
						 | 
					76282482db | ||
| 
						 | 
					9f165d24f0 | ||
| 
						 | 
					6bf42ddc79 | ||
| 
						 | 
					2f9c6e38b8 | ||
| 
						 | 
					169e2bf6bd | ||
| 
						 | 
					d7453860a6 | ||
| 
						 | 
					43363ab720 | ||
| 
						 | 
					8b002362d9 | ||
| 
						 | 
					94f84d36a9 | ||
| 
						 | 
					98b088dce7 | ||
| 
						 | 
					f13aa6fc5b | ||
| 
						 | 
					625993dfbb | ||
| 
						 | 
					770d0f6177 | ||
| 
						 | 
					53531ccebb | ||
| 
						 | 
					64035c4a4b | ||
| 
						 | 
					ea271fdf26 | ||
| 
						 | 
					52023cb725 | ||
| 
						 | 
					3fa60e10bc | ||
| 
						 | 
					51c914b7fd | ||
| 
						 | 
					27047faf28 | ||
| 
						 | 
					5656a0c494 | ||
| 
						 | 
					e612add051 | ||
| 
						 | 
					ee3608f9d3 | ||
| 
						 | 
					a167eef548 | ||
| 
						 | 
					673bff01ae | ||
| 
						 | 
					76c241b091 | ||
| 
						 | 
					4ae938698c | ||
| 
						 | 
					4f0b67a8db | ||
| 
						 | 
					91f2074e5f | ||
| 
						 | 
					53c3c271dc | 
@@ -4,40 +4,52 @@ Working on bionic
 | 
			
		||||
What are the big pieces of bionic?
 | 
			
		||||
----------------------------------
 | 
			
		||||
 | 
			
		||||
libc/ --- libc.so, libc.a
 | 
			
		||||
  The C library. Stuff like fopen(3) and kill(2).
 | 
			
		||||
libm/ --- libm.so, libm.a
 | 
			
		||||
  The math library. Traditionally Unix systems kept stuff like sin(3) and
 | 
			
		||||
  cos(3) in a separate library to save space in the days before shared
 | 
			
		||||
  libraries.
 | 
			
		||||
libdl/ --- libdl.so
 | 
			
		||||
  The dynamic linker interface library. This is actually just a bunch of
 | 
			
		||||
  stubs that the dynamic linker replaces with pointers to its own
 | 
			
		||||
  implementation at runtime. This is where stuff like dlopen(3) lives.
 | 
			
		||||
libstdc++/ --- libstdc++.so
 | 
			
		||||
  The C++ ABI support functions. The C++ compiler doesn't know how to
 | 
			
		||||
  implement thread-safe static initialization and the like, so it just calls
 | 
			
		||||
  functions that are supplied by the system. Stuff like __cxa_guard_acquire
 | 
			
		||||
  and __cxa_pure_virtual live here.
 | 
			
		||||
#### libc/ --- libc.so, libc.a
 | 
			
		||||
 | 
			
		||||
linker/ --- /system/bin/linker and /system/bin/linker64
 | 
			
		||||
  The dynamic linker. When you run a dynamically-linked executable, its ELF
 | 
			
		||||
  file has a DT_INTERP entry that says "use the following program to start me".
 | 
			
		||||
  On Android, that's either linker or linker64 (depending on whether it's a
 | 
			
		||||
  32-bit or 64-bit executable). It's responsible for loading the ELF executable
 | 
			
		||||
  into memory and resolving references to symbols (so that when your code tries
 | 
			
		||||
  to jump to fopen(3), say, it lands in the right place).
 | 
			
		||||
The C library. Stuff like `fopen(3)` and `kill(2)`.
 | 
			
		||||
 | 
			
		||||
tests/ --- unit tests
 | 
			
		||||
  The tests/ directory contains unit tests. Roughly arranged as one file per
 | 
			
		||||
  publicly-exported header file.
 | 
			
		||||
benchmarks/ --- benchmarks
 | 
			
		||||
  The benchmarks/ directory contains benchmarks.
 | 
			
		||||
#### libm/ --- libm.so, libm.a
 | 
			
		||||
 | 
			
		||||
The math library. Traditionally Unix systems kept stuff like `sin(3)` and
 | 
			
		||||
`cos(3)` in a separate library to save space in the days before shared
 | 
			
		||||
libraries.
 | 
			
		||||
 | 
			
		||||
#### libdl/ --- libdl.so
 | 
			
		||||
 | 
			
		||||
The dynamic linker interface library. This is actually just a bunch of stubs
 | 
			
		||||
that the dynamic linker replaces with pointers to its own implementation at
 | 
			
		||||
runtime. This is where stuff like `dlopen(3)` lives.
 | 
			
		||||
 | 
			
		||||
#### libstdc++/ --- libstdc++.so
 | 
			
		||||
 | 
			
		||||
The C++ ABI support functions. The C++ compiler doesn't know how to implement
 | 
			
		||||
thread-safe static initialization and the like, so it just calls functions that
 | 
			
		||||
are supplied by the system. Stuff like `__cxa_guard_acquire` and
 | 
			
		||||
`__cxa_pure_virtual` live here.
 | 
			
		||||
 | 
			
		||||
#### linker/ --- /system/bin/linker and /system/bin/linker64
 | 
			
		||||
 | 
			
		||||
The dynamic linker. When you run a dynamically-linked executable, its ELF file
 | 
			
		||||
has a `DT_INTERP` entry that says "use the following program to start me".  On
 | 
			
		||||
Android, that's either `linker` or `linker64` (depending on whether it's a
 | 
			
		||||
32-bit or 64-bit executable). It's responsible for loading the ELF executable
 | 
			
		||||
into memory and resolving references to symbols (so that when your code tries to
 | 
			
		||||
jump to `fopen(3)`, say, it lands in the right place).
 | 
			
		||||
 | 
			
		||||
#### tests/ --- unit tests
 | 
			
		||||
 | 
			
		||||
The `tests/` directory contains unit tests. Roughly arranged as one file per
 | 
			
		||||
publicly-exported header file.
 | 
			
		||||
 | 
			
		||||
#### benchmarks/ --- benchmarks
 | 
			
		||||
 | 
			
		||||
The `benchmarks/` directory contains benchmarks.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
What's in libc/?
 | 
			
		||||
----------------
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
libc/
 | 
			
		||||
  arch-arm/
 | 
			
		||||
  arch-arm64/
 | 
			
		||||
@@ -121,6 +133,7 @@ libc/
 | 
			
		||||
  zoneinfo/
 | 
			
		||||
    # Android-format time zone data.
 | 
			
		||||
    # See 'Updating tzdata' later.
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Adding system calls
 | 
			
		||||
@@ -160,3 +173,74 @@ This is fully automated:
 | 
			
		||||
 | 
			
		||||
  1. Run update-tzdata.py.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Running the tests
 | 
			
		||||
-----------------
 | 
			
		||||
 | 
			
		||||
The tests are all built from the tests/ directory.
 | 
			
		||||
 | 
			
		||||
### Device tests
 | 
			
		||||
 | 
			
		||||
    $ mma
 | 
			
		||||
    $ adb sync
 | 
			
		||||
    $ adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests32
 | 
			
		||||
    $ adb shell \
 | 
			
		||||
        /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static32
 | 
			
		||||
    # Only for 64-bit targets
 | 
			
		||||
    $ adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests64
 | 
			
		||||
    $ adb shell \
 | 
			
		||||
        /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static64
 | 
			
		||||
 | 
			
		||||
### Host tests
 | 
			
		||||
 | 
			
		||||
The host tests require that you have `lunch`ed either an x86 or x86_64 target.
 | 
			
		||||
 | 
			
		||||
    $ mma
 | 
			
		||||
    # 64-bit tests for 64-bit targets, 32-bit otherwise.
 | 
			
		||||
    $ mm bionic-unit-tests-run-on-host
 | 
			
		||||
    # Only exists for 64-bit targets.
 | 
			
		||||
    $ mm bionic-unit-tests-run-on-host32
 | 
			
		||||
 | 
			
		||||
### Against glibc
 | 
			
		||||
 | 
			
		||||
As a way to check that our tests do in fact test the correct behavior (and not
 | 
			
		||||
just the behavior we think is correct), it is possible to run the tests against
 | 
			
		||||
the host's glibc.
 | 
			
		||||
 | 
			
		||||
    $ mma
 | 
			
		||||
    $ bionic-unit-tests-glibc32 # already in your path
 | 
			
		||||
    $ bionic-unit-tests-glibc64
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Gathering test coverage
 | 
			
		||||
-----------------------
 | 
			
		||||
 | 
			
		||||
For either host or target coverage, you must first:
 | 
			
		||||
 | 
			
		||||
 * `$ export NATIVE_COVERAGE=true`
 | 
			
		||||
     * Note that the build system is ignorant to this flag being toggled, i.e. if
 | 
			
		||||
       you change this flag, you will have to manually rebuild bionic.
 | 
			
		||||
 * Set `bionic_coverage=true` in `libc/Android.mk` and `libm/Android.mk`.
 | 
			
		||||
 | 
			
		||||
### Coverage from device tests
 | 
			
		||||
 | 
			
		||||
    $ mma
 | 
			
		||||
    $ adb sync
 | 
			
		||||
    $ adb shell \
 | 
			
		||||
        GCOV_PREFIX=/data/local/tmp/gcov \
 | 
			
		||||
        GCOV_PREFIX_STRIP=`echo $ANDROID_BUILD_TOP | grep -o / | wc -l` \
 | 
			
		||||
        /data/nativetest/bionic-unit-tests/bionic-unit-tests32
 | 
			
		||||
    $ acov
 | 
			
		||||
 | 
			
		||||
`acov` will pull all coverage information from the device, push it to the right
 | 
			
		||||
directories, run `lcov`, and open the coverage report in your browser.
 | 
			
		||||
 | 
			
		||||
### Coverage from host tests
 | 
			
		||||
 | 
			
		||||
First, build and run the host tests as usual (see above).
 | 
			
		||||
 | 
			
		||||
    $ croot
 | 
			
		||||
    $ lcov -c -d $ANDROID_PRODUCT_OUT -o coverage.info
 | 
			
		||||
    $ genhtml -o covreport coverage.info # or lcov --list coverage.info
 | 
			
		||||
 | 
			
		||||
The coverage report is now available at `covreport/index.html`.
 | 
			
		||||
@@ -49,9 +49,8 @@ LOCAL_MODULE_STEM_64 := bionic-benchmarks64
 | 
			
		||||
LOCAL_MULTILIB := both
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
			
		||||
LOCAL_CFLAGS += $(benchmark_c_flags)
 | 
			
		||||
LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include
 | 
			
		||||
LOCAL_SHARED_LIBRARIES += libstlport
 | 
			
		||||
LOCAL_SRC_FILES := $(benchmark_src_files)
 | 
			
		||||
LOCAL_CXX_STL := libc++
 | 
			
		||||
include $(BUILD_EXECUTABLE)
 | 
			
		||||
 | 
			
		||||
ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
 | 
			
		||||
 
 | 
			
		||||
@@ -20,8 +20,8 @@
 | 
			
		||||
#include <math.h>
 | 
			
		||||
 | 
			
		||||
// Avoid optimization.
 | 
			
		||||
double d;
 | 
			
		||||
double v;
 | 
			
		||||
volatile double d;
 | 
			
		||||
volatile double v;
 | 
			
		||||
 | 
			
		||||
static void BM_math_sqrt(int iters) {
 | 
			
		||||
  StartBenchmarkTiming();
 | 
			
		||||
 
 | 
			
		||||
@@ -105,3 +105,35 @@ static void BM_pthread_mutex_lock_RECURSIVE(int iters) {
 | 
			
		||||
  StopBenchmarkTiming();
 | 
			
		||||
}
 | 
			
		||||
BENCHMARK(BM_pthread_mutex_lock_RECURSIVE);
 | 
			
		||||
 | 
			
		||||
static void BM_pthread_rw_lock_read(int iters) {
 | 
			
		||||
  StopBenchmarkTiming();
 | 
			
		||||
  pthread_rwlock_t lock;
 | 
			
		||||
  pthread_rwlock_init(&lock, NULL);
 | 
			
		||||
  StartBenchmarkTiming();
 | 
			
		||||
 | 
			
		||||
  for (int i = 0; i < iters; ++i) {
 | 
			
		||||
    pthread_rwlock_rdlock(&lock);
 | 
			
		||||
    pthread_rwlock_unlock(&lock);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  StopBenchmarkTiming();
 | 
			
		||||
  pthread_rwlock_destroy(&lock);
 | 
			
		||||
}
 | 
			
		||||
BENCHMARK(BM_pthread_rw_lock_read);
 | 
			
		||||
 | 
			
		||||
static void BM_pthread_rw_lock_write(int iters) {
 | 
			
		||||
  StopBenchmarkTiming();
 | 
			
		||||
  pthread_rwlock_t lock;
 | 
			
		||||
  pthread_rwlock_init(&lock, NULL);
 | 
			
		||||
  StartBenchmarkTiming();
 | 
			
		||||
 | 
			
		||||
  for (int i = 0; i < iters; ++i) {
 | 
			
		||||
    pthread_rwlock_wrlock(&lock);
 | 
			
		||||
    pthread_rwlock_unlock(&lock);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  StopBenchmarkTiming();
 | 
			
		||||
  pthread_rwlock_destroy(&lock);
 | 
			
		||||
}
 | 
			
		||||
BENCHMARK(BM_pthread_rw_lock_write);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										138
									
								
								libc/Android.mk
									
									
									
									
									
								
							
							
						
						
									
										138
									
								
								libc/Android.mk
									
									
									
									
									
								
							@@ -1,5 +1,7 @@
 | 
			
		||||
LOCAL_PATH := $(call my-dir)
 | 
			
		||||
 | 
			
		||||
bionic_coverage := false
 | 
			
		||||
 | 
			
		||||
# Make everything depend on any changes to included makefiles.
 | 
			
		||||
libc_common_additional_dependencies := $(LOCAL_PATH)/Android.mk
 | 
			
		||||
 | 
			
		||||
@@ -38,8 +40,6 @@ endif
 | 
			
		||||
# =========================================================
 | 
			
		||||
libc_common_src_files := \
 | 
			
		||||
    bionic/bindresvport.c \
 | 
			
		||||
    bionic/daemon.c \
 | 
			
		||||
    bionic/err.c \
 | 
			
		||||
    bionic/ether_aton.c \
 | 
			
		||||
    bionic/ether_ntoa.c \
 | 
			
		||||
    bionic/fts.c \
 | 
			
		||||
@@ -51,17 +51,16 @@ libc_common_src_files := \
 | 
			
		||||
    bionic/ioctl.c \
 | 
			
		||||
    bionic/isatty.c \
 | 
			
		||||
    bionic/memmem.c \
 | 
			
		||||
    bionic/pathconf.c \
 | 
			
		||||
    bionic/pututline.c \
 | 
			
		||||
    bionic/sched_cpualloc.c \
 | 
			
		||||
    bionic/sched_cpucount.c \
 | 
			
		||||
    bionic/semaphore.c \
 | 
			
		||||
    bionic/sigblock.c \
 | 
			
		||||
    bionic/siginterrupt.c \
 | 
			
		||||
    bionic/sigsetmask.c \
 | 
			
		||||
    bionic/system_properties_compat.c \
 | 
			
		||||
    stdio/snprintf.c\
 | 
			
		||||
    stdio/sprintf.c \
 | 
			
		||||
    stdio/stdio_ext.cpp \
 | 
			
		||||
 | 
			
		||||
# Fortify implementations of libc functions.
 | 
			
		||||
libc_common_src_files += \
 | 
			
		||||
@@ -90,6 +89,7 @@ libc_bionic_src_files := \
 | 
			
		||||
    bionic/access.cpp \
 | 
			
		||||
    bionic/assert.cpp \
 | 
			
		||||
    bionic/atof.cpp \
 | 
			
		||||
    bionic/bionic_systrace.cpp \
 | 
			
		||||
    bionic/bionic_time_conversions.cpp \
 | 
			
		||||
    bionic/brk.cpp \
 | 
			
		||||
    bionic/c16rtomb.cpp \
 | 
			
		||||
@@ -98,6 +98,7 @@ libc_bionic_src_files := \
 | 
			
		||||
    bionic/chown.cpp \
 | 
			
		||||
    bionic/clearenv.cpp \
 | 
			
		||||
    bionic/clock.cpp \
 | 
			
		||||
    bionic/clock_nanosleep.cpp \
 | 
			
		||||
    bionic/clone.cpp \
 | 
			
		||||
    bionic/__cmsg_nxthdr.cpp \
 | 
			
		||||
    bionic/connect.cpp \
 | 
			
		||||
@@ -121,6 +122,7 @@ libc_bionic_src_files := \
 | 
			
		||||
    bionic/getpgrp.cpp \
 | 
			
		||||
    bionic/getpid.cpp \
 | 
			
		||||
    bionic/gettid.cpp \
 | 
			
		||||
    bionic/__gnu_basename.cpp \
 | 
			
		||||
    bionic/inotify_init.cpp \
 | 
			
		||||
    bionic/lchown.cpp \
 | 
			
		||||
    bionic/lfs64_support.cpp \
 | 
			
		||||
@@ -132,6 +134,7 @@ libc_bionic_src_files := \
 | 
			
		||||
    bionic/link.cpp \
 | 
			
		||||
    bionic/locale.cpp \
 | 
			
		||||
    bionic/lstat.cpp \
 | 
			
		||||
    bionic/malloc_info.cpp \
 | 
			
		||||
    bionic/mbrtoc16.cpp \
 | 
			
		||||
    bionic/mbrtoc32.cpp \
 | 
			
		||||
    bionic/mbstate.cpp \
 | 
			
		||||
@@ -141,6 +144,7 @@ libc_bionic_src_files := \
 | 
			
		||||
    bionic/mntent.cpp \
 | 
			
		||||
    bionic/NetdClientDispatch.cpp \
 | 
			
		||||
    bionic/open.cpp \
 | 
			
		||||
    bionic/pathconf.cpp \
 | 
			
		||||
    bionic/pause.cpp \
 | 
			
		||||
    bionic/pipe.cpp \
 | 
			
		||||
    bionic/poll.cpp \
 | 
			
		||||
@@ -180,6 +184,7 @@ libc_bionic_src_files := \
 | 
			
		||||
    bionic/scandir.cpp \
 | 
			
		||||
    bionic/sched_getaffinity.cpp \
 | 
			
		||||
    bionic/sched_getcpu.cpp \
 | 
			
		||||
    bionic/semaphore.cpp \
 | 
			
		||||
    bionic/send.cpp \
 | 
			
		||||
    bionic/setegid.cpp \
 | 
			
		||||
    bionic/__set_errno.cpp \
 | 
			
		||||
@@ -238,9 +243,6 @@ libc_upstream_freebsd_src_files := \
 | 
			
		||||
    upstream-freebsd/lib/libc/gen/ldexp.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/gen/sleep.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/gen/usleep.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fclose.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/flags.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fopen.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/abs.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/getopt_long.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/imaxabs.c \
 | 
			
		||||
@@ -286,7 +288,6 @@ libc_upstream_netbsd_src_files := \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/div.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/drand48.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/erand48.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/insque.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/jrand48.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/ldiv.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/lldiv.c \
 | 
			
		||||
@@ -295,14 +296,12 @@ libc_upstream_netbsd_src_files := \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/nrand48.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/_rand48.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/rand_r.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/remque.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/seed48.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/stdlib/srand48.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/string/memccpy.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/string/strcasestr.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/string/strcoll.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/string/strxfrm.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/unistd/killpg.c \
 | 
			
		||||
 | 
			
		||||
libc_upstream_openbsd_gdtoa_src_files := \
 | 
			
		||||
    upstream-openbsd/android/gdtoa_support.cpp \
 | 
			
		||||
@@ -332,10 +331,14 @@ libc_upstream_openbsd_gdtoa_src_files_64 := \
 | 
			
		||||
    upstream-openbsd/lib/libc/gdtoa/strtorQ.c \
 | 
			
		||||
 | 
			
		||||
libc_upstream_openbsd_src_files := \
 | 
			
		||||
    upstream-openbsd/lib/libc/compat-43/killpg.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/crypt/arc4random.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/crypt/arc4random_uniform.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/alarm.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/ctype_.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/daemon.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/err.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/errx.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/exec.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/fnmatch.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/ftok.c \
 | 
			
		||||
@@ -345,6 +348,12 @@ libc_upstream_openbsd_src_files := \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/time.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/tolower_.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/toupper_.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/verr.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/verrx.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/vwarn.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/vwarnx.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/warn.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/gen/warnx.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/locale/btowc.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/locale/mbrlen.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/locale/mbstowcs.c \
 | 
			
		||||
@@ -378,6 +387,7 @@ libc_upstream_openbsd_src_files := \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/asprintf.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/clrerr.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/dprintf.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/fclose.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/fdopen.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/feof.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/ferror.c \
 | 
			
		||||
@@ -390,6 +400,9 @@ libc_upstream_openbsd_src_files := \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/fgetws.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/fileno.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/findfp.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/flags.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/fmemopen.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/fopen.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/fprintf.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/fpurge.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/fputc.c \
 | 
			
		||||
@@ -418,6 +431,8 @@ libc_upstream_openbsd_src_files := \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/getwchar.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/makebuf.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/mktemp.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/open_memstream.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/open_wmemstream.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/perror.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/printf.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/putc.c \
 | 
			
		||||
@@ -466,7 +481,9 @@ libc_upstream_openbsd_src_files := \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdlib/atoll.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdlib/exit.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdlib/getenv.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdlib/insque.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdlib/lsearch.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdlib/remque.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdlib/setenv.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdlib/strtoimax.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdlib/strtol.c \
 | 
			
		||||
@@ -503,7 +520,10 @@ ifneq ($(TARGET_USES_LOGD),false)
 | 
			
		||||
libc_common_cflags += -DTARGET_USES_LOGD
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
use_clang := false
 | 
			
		||||
use_clang := $(USE_CLANG_PLATFORM_BUILD)
 | 
			
		||||
ifeq ($(use_clang),)
 | 
			
		||||
  use_clang := false
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Try to catch typical 32-bit assumptions that break with 64-bit pointers.
 | 
			
		||||
libc_common_cflags += \
 | 
			
		||||
@@ -583,7 +603,9 @@ LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_MODULE := libc_stack_protector
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
@@ -621,7 +643,9 @@ LOCAL_C_INCLUDES := $(libc_common_c_includes) $(LOCAL_PATH)/tzcode/
 | 
			
		||||
LOCAL_MODULE := libc_tzcode
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
@@ -639,7 +663,13 @@ LOCAL_SRC_FILES := \
 | 
			
		||||
    upstream-netbsd/lib/libc/isc/ev_timers.c \
 | 
			
		||||
    upstream-netbsd/lib/libc/resolv/mtctxres.c \
 | 
			
		||||
 | 
			
		||||
LOCAL_CFLAGS := \
 | 
			
		||||
# We use the OpenBSD res_random.
 | 
			
		||||
LOCAL_CFLAGS += \
 | 
			
		||||
    -Dres_randomid=__res_randomid
 | 
			
		||||
LOCAL_SRC_FILES += \
 | 
			
		||||
    upstream-openbsd/lib/libc/net/res_random.c \
 | 
			
		||||
 | 
			
		||||
LOCAL_CFLAGS += \
 | 
			
		||||
    $(libc_common_cflags) \
 | 
			
		||||
    -DANDROID_CHANGES \
 | 
			
		||||
    -DINET6 \
 | 
			
		||||
@@ -657,7 +687,9 @@ LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_MODULE := libc_dns
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
@@ -686,9 +718,12 @@ LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_MODULE := libc_freebsd
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_freebsd_src_files))
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -716,7 +751,9 @@ LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_MODULE := libc_netbsd
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_netbsd_src_files))
 | 
			
		||||
@@ -733,9 +770,19 @@ include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
include $(CLEAR_VARS)
 | 
			
		||||
 | 
			
		||||
LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
 | 
			
		||||
ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
 | 
			
		||||
  # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
 | 
			
		||||
  LOCAL_CLANG := false
 | 
			
		||||
else
 | 
			
		||||
  LOCAL_CLANG := $(use_clang)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
LOCAL_CFLAGS := \
 | 
			
		||||
    $(libc_common_cflags) \
 | 
			
		||||
    -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \
 | 
			
		||||
    -Wno-missing-field-initializers \
 | 
			
		||||
    -Wno-sign-compare \
 | 
			
		||||
    -Wno-uninitialized \
 | 
			
		||||
    -Wno-unused-parameter \
 | 
			
		||||
    -I$(LOCAL_PATH)/private \
 | 
			
		||||
    -I$(LOCAL_PATH)/upstream-openbsd/android/include \
 | 
			
		||||
    -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
 | 
			
		||||
@@ -746,11 +793,13 @@ LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
 | 
			
		||||
LOCAL_CPPFLAGS := $(libc_common_cppflags)
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_MODULE := libc_openbsd
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_openbsd_src_files))
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -765,6 +814,13 @@ include $(CLEAR_VARS)
 | 
			
		||||
 | 
			
		||||
LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32)
 | 
			
		||||
LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64)
 | 
			
		||||
ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
 | 
			
		||||
  # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
 | 
			
		||||
  LOCAL_CLANG := false
 | 
			
		||||
else
 | 
			
		||||
  LOCAL_CLANG := $(use_clang)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
LOCAL_CFLAGS := \
 | 
			
		||||
    $(libc_common_cflags) \
 | 
			
		||||
    -Wno-sign-compare -Wno-uninitialized \
 | 
			
		||||
@@ -778,9 +834,10 @@ LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
 | 
			
		||||
LOCAL_CPPFLAGS := $(libc_common_cppflags)
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_MODULE := libc_gdtoa
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
@@ -796,13 +853,20 @@ LOCAL_SRC_FILES := $(libc_bionic_src_files)
 | 
			
		||||
LOCAL_CFLAGS := $(libc_common_cflags) \
 | 
			
		||||
    -Wframe-larger-than=2048 \
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_ARCH),x86_64)
 | 
			
		||||
  # Clang assembler has problem with ssse3-strcmp-slm.S, http://b/17302991
 | 
			
		||||
  LOCAL_CLANG_ASFLAGS += -no-integrated-as
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
 | 
			
		||||
LOCAL_CPPFLAGS := $(libc_common_cppflags)
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
 | 
			
		||||
LOCAL_MODULE := libc_bionic
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files))
 | 
			
		||||
@@ -821,12 +885,13 @@ LOCAL_CFLAGS := $(libc_common_cflags) \
 | 
			
		||||
 | 
			
		||||
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
 | 
			
		||||
LOCAL_CPPFLAGS := $(libc_common_cppflags)
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
 | 
			
		||||
LOCAL_MODULE := libc_cxa
 | 
			
		||||
# GCC refuses to hide new/delete
 | 
			
		||||
LOCAL_CLANG := true
 | 
			
		||||
LOCAL_CLANG := true # GCC refuses to hide new/delete
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
@@ -844,7 +909,9 @@ endif
 | 
			
		||||
LOCAL_MODULE := libc_syscalls
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
@@ -863,7 +930,9 @@ LOCAL_MODULE := libc_aeabi
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_CFLAGS := $(libc_common_cflags) -fno-builtin
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
@@ -900,10 +969,12 @@ ifneq ($(MALLOC_IMPL),dlmalloc)
 | 
			
		||||
LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
 | 
			
		||||
# TODO: split out the asflags.
 | 
			
		||||
LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files))
 | 
			
		||||
@@ -939,7 +1010,9 @@ LOCAL_MODULE := libc_nomalloc
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
 | 
			
		||||
@@ -960,6 +1033,8 @@ LOCAL_CPPFLAGS := $(libc_common_cppflags)
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_MODULE := libc_malloc
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
@@ -985,7 +1060,9 @@ LOCAL_MODULE := libc
 | 
			
		||||
LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
 | 
			
		||||
@@ -1027,6 +1104,7 @@ LOCAL_STRIP_MODULE := keep_symbols
 | 
			
		||||
 | 
			
		||||
LOCAL_SHARED_LIBRARIES := libdl
 | 
			
		||||
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
 | 
			
		||||
# We'd really like to do this for all architectures, but since this wasn't done
 | 
			
		||||
@@ -1046,6 +1124,7 @@ LOCAL_SRC_FILES_arm += \
 | 
			
		||||
    arch-common/bionic/crtbegin_so.c \
 | 
			
		||||
    arch-arm/bionic/atexit_legacy.c \
 | 
			
		||||
    arch-common/bionic/crtend_so.S
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
include $(BUILD_SHARED_LIBRARY)
 | 
			
		||||
 | 
			
		||||
@@ -1063,10 +1142,7 @@ ifneq ($(TARGET_BUILD_VARIANT),user)
 | 
			
		||||
# ========================================================
 | 
			
		||||
include $(CLEAR_VARS)
 | 
			
		||||
 | 
			
		||||
LOCAL_CFLAGS := \
 | 
			
		||||
    $(libc_common_cflags) \
 | 
			
		||||
    -DMALLOC_LEAK_CHECK \
 | 
			
		||||
 | 
			
		||||
LOCAL_CFLAGS := $(libc_common_cflags)
 | 
			
		||||
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
 | 
			
		||||
LOCAL_CPPFLAGS := $(libc_common_cppflags)
 | 
			
		||||
 | 
			
		||||
@@ -1086,14 +1162,16 @@ LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
 | 
			
		||||
LOCAL_SHARED_LIBRARIES := libc libdl
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
# Only need this for arm since libc++ uses its own unwind code that
 | 
			
		||||
# doesn't mix with the other default unwind code.
 | 
			
		||||
LOCAL_STATIC_LIBRARIES_arm := libc++
 | 
			
		||||
LOCAL_STATIC_LIBRARIES_arm := libunwind_llvm
 | 
			
		||||
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
 | 
			
		||||
 | 
			
		||||
# Don't install on release build
 | 
			
		||||
LOCAL_MODULE_TAGS := eng debug
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
include $(BUILD_SHARED_LIBRARY)
 | 
			
		||||
@@ -1122,10 +1200,12 @@ LOCAL_CLANG := $(use_clang)
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
 | 
			
		||||
 | 
			
		||||
LOCAL_SHARED_LIBRARIES := libc libdl
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
 | 
			
		||||
# Don't install on release build
 | 
			
		||||
LOCAL_MODULE_TAGS := eng debug
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
 | 
			
		||||
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
 | 
			
		||||
include $(BUILD_SHARED_LIBRARY)
 | 
			
		||||
@@ -1142,24 +1222,30 @@ libstdcxx_common_src_files := \
 | 
			
		||||
    bionic/libc_logging.cpp \
 | 
			
		||||
 | 
			
		||||
include $(CLEAR_VARS)
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
 | 
			
		||||
LOCAL_CFLAGS := $(libc_common_cflags)
 | 
			
		||||
LOCAL_CPPFLAGS := $(libc_common_cppflags)
 | 
			
		||||
LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
 | 
			
		||||
LOCAL_MODULE:= libstdc++
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES := libc
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
include $(BUILD_SHARED_LIBRARY)
 | 
			
		||||
 | 
			
		||||
# ========================================================
 | 
			
		||||
# libstdc++.a
 | 
			
		||||
# ========================================================
 | 
			
		||||
include $(CLEAR_VARS)
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
 | 
			
		||||
LOCAL_CFLAGS := $(libc_common_cflags)
 | 
			
		||||
LOCAL_CPPFLAGS := $(libc_common_cppflags)
 | 
			
		||||
LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
 | 
			
		||||
LOCAL_MODULE:= libstdc++
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
			
		||||
LOCAL_CXX_STL := none
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES := libc
 | 
			
		||||
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										130
									
								
								libc/NOTICE
									
									
									
									
									
								
							
							
						
						
									
										130
									
								
								libc/NOTICE
									
									
									
									
									
								
							@@ -2510,35 +2510,6 @@ SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 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.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 1993
 | 
			
		||||
   The Regents of the University of California.  All rights reserved.
 | 
			
		||||
 | 
			
		||||
@@ -3131,38 +3102,6 @@ SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 1999 Kungliga Tekniska Högskolan
 | 
			
		||||
(Royal Institute of Technology, Stockholm, Sweden).
 | 
			
		||||
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 KTH 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 KTH AND ITS 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 KTH OR ITS 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
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2000 Ben Harris.
 | 
			
		||||
Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
 | 
			
		||||
All rights reserved.
 | 
			
		||||
@@ -4422,6 +4361,39 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org>
 | 
			
		||||
 | 
			
		||||
Permission to use, copy, modify, and distribute this software for any
 | 
			
		||||
purpose with or without fee is hereby granted, provided that the above
 | 
			
		||||
copyright notice and this permission notice appear in all copies.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
			
		||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
			
		||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
			
		||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
			
		||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
			
		||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 | 
			
		||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org>
 | 
			
		||||
Copyright (c) 2009 Ted Unangst
 | 
			
		||||
 | 
			
		||||
Permission to use, copy, modify, and distribute this software for any
 | 
			
		||||
purpose with or without fee is hereby granted, provided that the above
 | 
			
		||||
copyright notice and this permission notice appear in all copies.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
			
		||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
			
		||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
			
		||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
			
		||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | 
			
		||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 | 
			
		||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2011 The Android Open Source Project
 | 
			
		||||
Copyright (c) 2008 ARM Ltd
 | 
			
		||||
All rights reserved.
 | 
			
		||||
@@ -4853,6 +4825,42 @@ SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
 | 
			
		||||
Copyright 2008 Damien Miller <djm@openbsd.org>
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
Theo de Raadt <deraadt@openbsd.org> came up with the idea of using
 | 
			
		||||
such a mathematical system to generate more random (yet non-repeating)
 | 
			
		||||
ids to solve the resolver/named problem.  But Niels designed the
 | 
			
		||||
actual system based on the constraints.
 | 
			
		||||
 | 
			
		||||
Later modified by Damien Miller to wrap the LCG output in a 15-bit
 | 
			
		||||
permutation generator based on a Luby-Rackoff block cipher. This
 | 
			
		||||
ensures the output is non-repeating and preserves the MSB twiddle
 | 
			
		||||
trick, but makes it more resistant to LCG prediction.
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright 2000 David E. O'Brien, John D. Polstra.
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -202,9 +202,9 @@ int     swapoff(const char*) all
 | 
			
		||||
int           settimeofday(const struct timeval*, const struct timezone*)   all
 | 
			
		||||
clock_t       times(struct tms*)       all
 | 
			
		||||
int           nanosleep(const struct timespec*, struct timespec*)   all
 | 
			
		||||
int           clock_settime(clockid_t clk_id, const struct timespec* tp)  all
 | 
			
		||||
int           clock_getres(clockid_t clk_id, struct timespec* res)   all
 | 
			
		||||
int           clock_nanosleep(clockid_t clock_id, int flags, const struct timespec* req, struct timespec* rem)  all
 | 
			
		||||
int           clock_settime(clockid_t, const struct timespec*)  all
 | 
			
		||||
int           clock_getres(clockid_t, struct timespec*)   all
 | 
			
		||||
int           __clock_nanosleep:clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*)  all
 | 
			
		||||
int           getitimer(int, const struct itimerval*)   all
 | 
			
		||||
int           setitimer(int, const struct itimerval*, struct itimerval*)  all
 | 
			
		||||
int           __timer_create:timer_create(clockid_t clockid, struct sigevent* evp, __kernel_timer_t* timerid)    all
 | 
			
		||||
@@ -321,7 +321,7 @@ int     __set_tls:__ARM_NR_set_tls(void*)                                 arm
 | 
			
		||||
int     cacheflush:__ARM_NR_cacheflush(long start, long end, long flags)  arm
 | 
			
		||||
 | 
			
		||||
# MIPS-specific
 | 
			
		||||
int     _flush_cache:cacheflush(char* addr, const int nbytes, const int op) mips,mips64
 | 
			
		||||
int     _flush_cache:cacheflush(char* addr, const int nbytes, const int op) mips
 | 
			
		||||
int     __set_tls:set_thread_area(void*) mips,mips64
 | 
			
		||||
 | 
			
		||||
# x86-specific
 | 
			
		||||
 
 | 
			
		||||
@@ -1,22 +1,35 @@
 | 
			
		||||
# arm specific configs
 | 
			
		||||
# 32-bit arm.
 | 
			
		||||
 | 
			
		||||
# These are used by the 32-bit targets, but not the 64-bit ones.
 | 
			
		||||
libc_common_src_files_arm := \
 | 
			
		||||
#
 | 
			
		||||
# Various kinds of LP32 cruft.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
libc_bionic_src_files_arm += \
 | 
			
		||||
    bionic/mmap.cpp \
 | 
			
		||||
 | 
			
		||||
libc_common_src_files_arm += \
 | 
			
		||||
    bionic/legacy_32_bit_support.cpp \
 | 
			
		||||
    bionic/ndk_cruft.cpp \
 | 
			
		||||
    bionic/time64.c \
 | 
			
		||||
 | 
			
		||||
libc_netbsd_src_files_arm += \
 | 
			
		||||
    upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_arm += \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/putw.c \
 | 
			
		||||
 | 
			
		||||
# These are shared by all the 32-bit targets, but not the 64-bit ones.
 | 
			
		||||
libc_bionic_src_files_arm := \
 | 
			
		||||
    bionic/mmap.cpp
 | 
			
		||||
#
 | 
			
		||||
# Default implementations of functions that are commonly optimized.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
libc_common_src_files_arm += \
 | 
			
		||||
libc_bionic_src_files_arm += \
 | 
			
		||||
    bionic/memchr.c \
 | 
			
		||||
    bionic/memrchr.c \
 | 
			
		||||
    bionic/strchr.cpp \
 | 
			
		||||
    bionic/strnlen.c \
 | 
			
		||||
    bionic/strrchr.cpp \
 | 
			
		||||
 | 
			
		||||
libc_freebsd_src_files_arm += \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscat.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcschr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscmp.c \
 | 
			
		||||
@@ -25,8 +38,9 @@ libc_common_src_files_arm += \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsrchr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemcmp.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemmove.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_arm += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/bcopy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpcpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpncpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strlcat.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strlcpy.c \
 | 
			
		||||
@@ -34,20 +48,10 @@ libc_common_src_files_arm += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strncmp.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strncpy.c \
 | 
			
		||||
 | 
			
		||||
# The C++ fortify function implementations for which there is an
 | 
			
		||||
# arm assembler version.
 | 
			
		||||
#
 | 
			
		||||
# Fortify implementations of libc functions.
 | 
			
		||||
# libc_common_src_files_arm +=
 | 
			
		||||
#    bionic/__memcpy_chk.cpp \
 | 
			
		||||
#    bionic/__memset_chk.cpp \
 | 
			
		||||
#    bionic/__strcpy_chk.cpp \
 | 
			
		||||
#    bionic/__strcat_chk.cpp \
 | 
			
		||||
# Inherently architecture-specific code.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
libc_common_cflags_arm := -DSOFTFLOAT
 | 
			
		||||
 | 
			
		||||
##########################################
 | 
			
		||||
### CPU specific source files
 | 
			
		||||
libc_bionic_src_files_arm += \
 | 
			
		||||
    arch-arm/bionic/abort_arm.S \
 | 
			
		||||
    arch-arm/bionic/atomics_arm.c \
 | 
			
		||||
@@ -55,6 +59,7 @@ libc_bionic_src_files_arm += \
 | 
			
		||||
    arch-arm/bionic/_exit_with_stack_teardown.S \
 | 
			
		||||
    arch-arm/bionic/libgcc_compat.c \
 | 
			
		||||
    arch-arm/bionic/memcmp.S \
 | 
			
		||||
    arch-arm/bionic/__restore.S \
 | 
			
		||||
    arch-arm/bionic/_setjmp.S \
 | 
			
		||||
    arch-arm/bionic/setjmp.S \
 | 
			
		||||
    arch-arm/bionic/sigsetjmp.S \
 | 
			
		||||
@@ -63,9 +68,6 @@ libc_bionic_src_files_arm += \
 | 
			
		||||
libc_arch_static_src_files_arm := arch-arm/bionic/exidx_static.c
 | 
			
		||||
libc_arch_dynamic_src_files_arm := arch-arm/bionic/exidx_dynamic.c
 | 
			
		||||
 | 
			
		||||
libc_netbsd_src_files_arm := \
 | 
			
		||||
    upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
 | 
			
		||||
 | 
			
		||||
## CPU variant specific source files
 | 
			
		||||
ifeq ($(strip $(TARGET_$(my_2nd_arch_prefix)CPU_VARIANT)),)
 | 
			
		||||
  $(warning TARGET_$(my_2nd_arch_prefix)ARCH is arm, but TARGET_$(my_2nd_arch_prefix)CPU_VARIANT is not defined)
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,9 @@
 | 
			
		||||
 | 
			
		||||
extern int __cxa_atexit(void (*)(void*), void*, void*);
 | 
			
		||||
 | 
			
		||||
// All of these are weak symbols to avoid multiple definition errors when
 | 
			
		||||
// linking with libstdc++-v3 or compiler-rt.
 | 
			
		||||
 | 
			
		||||
/* The "C++ ABI for ARM" document states that static C++ constructors,
 | 
			
		||||
 * which are called from the .init_array, should manually call
 | 
			
		||||
 * __aeabi_atexit() to register static destructors explicitly.
 | 
			
		||||
@@ -47,35 +50,35 @@ extern int __cxa_atexit(void (*)(void*), void*, void*);
 | 
			
		||||
 * variable from the shared object that contains the constructor/destructor
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// Make this a weak symbol to avoid a multiple definition error when linking with libstdc++-v3.
 | 
			
		||||
int __attribute__((weak))
 | 
			
		||||
__aeabi_atexit(void *object, void (*destructor) (void *), void *dso_handle) {
 | 
			
		||||
    return __cxa_atexit(destructor, object, dso_handle);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void __aeabi_memcpy8(void *dest, const void *src, size_t n) {
 | 
			
		||||
void __attribute__((weak))
 | 
			
		||||
__aeabi_memcpy8(void *dest, const void *src, size_t n) {
 | 
			
		||||
    memcpy(dest, src, n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void __aeabi_memcpy4(void *dest, const void *src, size_t n) {
 | 
			
		||||
void __attribute__((weak)) __aeabi_memcpy4(void *dest, const void *src, size_t n) {
 | 
			
		||||
    memcpy(dest, src, n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void __aeabi_memcpy(void *dest, const void *src, size_t n) {
 | 
			
		||||
void __attribute__((weak)) __aeabi_memcpy(void *dest, const void *src, size_t n) {
 | 
			
		||||
    memcpy(dest, src, n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void __aeabi_memmove8(void *dest, const void *src, size_t n) {
 | 
			
		||||
void __attribute__((weak)) __aeabi_memmove8(void *dest, const void *src, size_t n) {
 | 
			
		||||
    memmove(dest, src, n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void __aeabi_memmove4(void *dest, const void *src, size_t n) {
 | 
			
		||||
void __attribute__((weak)) __aeabi_memmove4(void *dest, const void *src, size_t n) {
 | 
			
		||||
    memmove(dest, src, n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void __aeabi_memmove(void *dest, const void *src, size_t n) {
 | 
			
		||||
void __attribute__((weak)) __aeabi_memmove(void *dest, const void *src, size_t n) {
 | 
			
		||||
    memmove(dest, src, n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -84,27 +87,27 @@ void __aeabi_memmove(void *dest, const void *src, size_t n) {
 | 
			
		||||
 *  This allows __aeabi_memclr to tail-call __aeabi_memset
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
void __aeabi_memset8(void *dest, size_t n, int c) {
 | 
			
		||||
void __attribute__((weak)) __aeabi_memset8(void *dest, size_t n, int c) {
 | 
			
		||||
    memset(dest, c, n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void __aeabi_memset4(void *dest, size_t n, int c) {
 | 
			
		||||
void __attribute__((weak)) __aeabi_memset4(void *dest, size_t n, int c) {
 | 
			
		||||
    memset(dest, c, n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void __aeabi_memset(void *dest, size_t n, int c) {
 | 
			
		||||
void __attribute__((weak)) __aeabi_memset(void *dest, size_t n, int c) {
 | 
			
		||||
    memset(dest, c, n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void __aeabi_memclr8(void *dest, size_t n) {
 | 
			
		||||
void __attribute__((weak)) __aeabi_memclr8(void *dest, size_t n) {
 | 
			
		||||
    __aeabi_memset8(dest, n, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void __aeabi_memclr4(void *dest, size_t n) {
 | 
			
		||||
void __attribute__((weak)) __aeabi_memclr4(void *dest, size_t n) {
 | 
			
		||||
    __aeabi_memset4(dest, n, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void __aeabi_memclr(void *dest, size_t n) {
 | 
			
		||||
void __attribute__((weak)) __aeabi_memclr(void *dest, size_t n) {
 | 
			
		||||
    __aeabi_memset(dest, n, 0);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * Copyright (C) 2014 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
@@ -25,40 +25,37 @@
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _PATHCONF_H_
 | 
			
		||||
#define _PATHCONF_H_
 | 
			
		||||
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
__BEGIN_DECLS
 | 
			
		||||
// gdb is smart enough to unwind through signal frames with just the regular
 | 
			
		||||
// CFI information but libgcc and libunwind both need extra help. We do this
 | 
			
		||||
// by using .fnstart/.fnend and inserting a nop before both __restore and
 | 
			
		||||
// __restore_rt (but covered by the .fnstart/.fnend) so that although they're
 | 
			
		||||
// not inside the functions from objdump's point of view, an unwinder that
 | 
			
		||||
// blindly looks at the previous instruction (but is then smart enough to check
 | 
			
		||||
// the DWARF information to find out where it landed) gets the right answer.
 | 
			
		||||
 | 
			
		||||
/* constants to be used for the 'name' paremeter of pathconf/fpathconf */
 | 
			
		||||
// We need to place .fnstart ourselves (but we may as well keep the free .fnend).
 | 
			
		||||
#undef __bionic_asm_custom_entry
 | 
			
		||||
#define __bionic_asm_custom_entry(f)
 | 
			
		||||
 | 
			
		||||
#define  _PC_FILESIZEBITS       0x0000
 | 
			
		||||
#define  _PC_LINK_MAX           0x0001
 | 
			
		||||
#define  _PC_MAX_CANON          0x0002
 | 
			
		||||
#define  _PC_MAX_INPUT          0x0003
 | 
			
		||||
#define  _PC_NAME_MAX           0x0004
 | 
			
		||||
#define  _PC_PATH_MAX           0x0005
 | 
			
		||||
#define  _PC_PIPE_BUF           0x0006
 | 
			
		||||
#define  _PC_2_SYMLINKS         0x0007
 | 
			
		||||
#define  _PC_ALLOC_SIZE_MIN     0x0008
 | 
			
		||||
#define  _PC_REC_INCR_XFER_SIZE 0x0009
 | 
			
		||||
#define  _PC_REC_MAX_XFER_SIZE  0x000a
 | 
			
		||||
#define  _PC_REC_MIN_XFER_SIZE  0x000b
 | 
			
		||||
#define  _PC_REC_XFER_ALIGN     0x000c
 | 
			
		||||
#define  _PC_SYMLINK_MAX        0x000d
 | 
			
		||||
#define  _PC_CHOWN_RESTRICTED   0x000e
 | 
			
		||||
#define  _PC_NO_TRUNC           0x000f
 | 
			
		||||
#define  _PC_VDISABLE           0x0010
 | 
			
		||||
#define  _PC_ASYNC_IO           0x0011
 | 
			
		||||
#define  _PC_PRIO_IO            0x0012
 | 
			
		||||
#define  _PC_SYNC_IO            0x0013
 | 
			
		||||
 | 
			
		||||
extern long fpathconf(int fildes, int name);
 | 
			
		||||
extern long pathconf(const char *path, int name);
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* _PATHCONF_H_ */
 | 
			
		||||
  .fnstart
 | 
			
		||||
  .save {r0-r15}
 | 
			
		||||
  .pad #32
 | 
			
		||||
  nop
 | 
			
		||||
ENTRY_PRIVATE(__restore)
 | 
			
		||||
  // This function must have exactly this instruction sequence.
 | 
			
		||||
  mov r7, #__NR_sigreturn
 | 
			
		||||
  swi #0
 | 
			
		||||
END(__restore)
 | 
			
		||||
 | 
			
		||||
  .fnstart
 | 
			
		||||
  .save {r0-r15}
 | 
			
		||||
  .pad #160
 | 
			
		||||
  nop
 | 
			
		||||
ENTRY_PRIVATE(__restore_rt)
 | 
			
		||||
  // This function must have exactly this instruction sequence.
 | 
			
		||||
  mov r7, #__NR_rt_sigreturn
 | 
			
		||||
  swi #0
 | 
			
		||||
END(__restore_rt)
 | 
			
		||||
@@ -107,7 +107,7 @@ ENTRY(_longjmp)
 | 
			
		||||
 | 
			
		||||
	/* validation failed, die die die. */
 | 
			
		||||
botch:
 | 
			
		||||
	bl	PIC_SYM(longjmperror, PLT)
 | 
			
		||||
	bl	PIC_SYM(abort, PLT)
 | 
			
		||||
	bl	longjmperror
 | 
			
		||||
	bl	abort
 | 
			
		||||
	b	. - 8		/* Cannot get here */
 | 
			
		||||
END(_longjmp)
 | 
			
		||||
 
 | 
			
		||||
@@ -40,5 +40,5 @@ ENTRY(abort)
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r3, 0
 | 
			
		||||
    .cfi_rel_offset r14, 4
 | 
			
		||||
    bl      PIC_SYM(__libc_android_abort, PLT)
 | 
			
		||||
    bl      __libc_android_abort
 | 
			
		||||
END(abort)
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@ ENTRY(setjmp)
 | 
			
		||||
	.cfi_rel_offset r14, 4
 | 
			
		||||
	mov	r0, #0x00000000
 | 
			
		||||
 | 
			
		||||
	bl	PIC_SYM(sigblock, PLT)
 | 
			
		||||
	bl	sigblock
 | 
			
		||||
	mov	r1, r0
 | 
			
		||||
 | 
			
		||||
	ldmfd	sp!, {r0, r14}
 | 
			
		||||
@@ -108,7 +108,7 @@ ENTRY(longjmp)
 | 
			
		||||
	.cfi_adjust_cfa_offset 4
 | 
			
		||||
 | 
			
		||||
	mov	r0, r2
 | 
			
		||||
	bl	PIC_SYM(sigsetmask, PLT)
 | 
			
		||||
	bl	sigsetmask
 | 
			
		||||
 | 
			
		||||
	add	sp, sp, #4	/* unalign the stack */
 | 
			
		||||
	.cfi_adjust_cfa_offset -4
 | 
			
		||||
@@ -147,7 +147,7 @@ ENTRY(longjmp)
 | 
			
		||||
 | 
			
		||||
	/* validation failed, die die die. */
 | 
			
		||||
botch:
 | 
			
		||||
	bl	PIC_SYM(longjmperror, PLT)
 | 
			
		||||
	bl	PIC_SYM(abort, PLT)
 | 
			
		||||
	bl	longjmperror
 | 
			
		||||
	bl	abort
 | 
			
		||||
	b	. - 8		/* Cannot get here */
 | 
			
		||||
END(longjmp)
 | 
			
		||||
 
 | 
			
		||||
@@ -33,8 +33,6 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define _ALIGN_TEXT .align 0
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
#include <machine/setjmp.h>
 | 
			
		||||
 | 
			
		||||
@@ -50,8 +48,8 @@
 | 
			
		||||
 | 
			
		||||
ENTRY(sigsetjmp)
 | 
			
		||||
	teq	r1, #0
 | 
			
		||||
	beq	PIC_SYM(_setjmp, PLT)
 | 
			
		||||
	b	PIC_SYM(setjmp, PLT)
 | 
			
		||||
	beq	_setjmp
 | 
			
		||||
	b	setjmp
 | 
			
		||||
END(sigsetjmp)
 | 
			
		||||
 | 
			
		||||
.L_setjmp_magic:
 | 
			
		||||
@@ -61,6 +59,6 @@ ENTRY(siglongjmp)
 | 
			
		||||
	ldr	r2, .L_setjmp_magic
 | 
			
		||||
	ldr	r3, [r0]
 | 
			
		||||
	teq	r2, r3
 | 
			
		||||
	beq	PIC_SYM(_longjmp, PLT)
 | 
			
		||||
	b	PIC_SYM(longjmp, PLT)
 | 
			
		||||
	beq	_longjmp
 | 
			
		||||
	b	longjmp
 | 
			
		||||
END(siglongjmp)
 | 
			
		||||
 
 | 
			
		||||
@@ -40,12 +40,10 @@
 | 
			
		||||
ENTRY(__strcat_chk)
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    push    {r0, lr}
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
    push    {r4, r5}
 | 
			
		||||
    .save   {r4, r5}
 | 
			
		||||
    .cfi_adjust_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r4, 0
 | 
			
		||||
    .cfi_rel_offset r5, 4
 | 
			
		||||
@@ -195,9 +193,6 @@ END(__strcat_chk)
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__strcat_chk_failed)
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .save   {r4, r5}
 | 
			
		||||
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,6 @@
 | 
			
		||||
ENTRY(__strcpy_chk)
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    push    {r0, lr}
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
@@ -161,7 +160,6 @@ END(__strcpy_chk)
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__strcpy_chk_failed)
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,6 @@ END(__memcpy_chk)
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
        pld     [r1, #64]
 | 
			
		||||
        push    {r0, lr}
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
@@ -85,7 +84,6 @@ END(memcpy)
 | 
			
		||||
ENTRY_PRIVATE(__memcpy_chk_fail)
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        push    {lr}
 | 
			
		||||
        .save   {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -54,7 +54,6 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(MEMCPY_BASE)
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
@@ -172,7 +171,6 @@ ENTRY_PRIVATE(MEMCPY_BASE)
 | 
			
		||||
END(MEMCPY_BASE)
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(MEMCPY_BASE_ALIGNED)
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
@@ -181,17 +179,14 @@ ENTRY_PRIVATE(MEMCPY_BASE_ALIGNED)
 | 
			
		||||
        // i.e., not keeping the stack looking like users expect
 | 
			
		||||
        // (highest numbered register at highest address).
 | 
			
		||||
        strd    r4, r5, [sp, #-8]!
 | 
			
		||||
        .save   {r4, r5}
 | 
			
		||||
        .cfi_adjust_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r4, 0
 | 
			
		||||
        .cfi_rel_offset r5, 4
 | 
			
		||||
        strd    r6, r7, [sp, #-8]!
 | 
			
		||||
        .save   {r6, r7}
 | 
			
		||||
        .cfi_adjust_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r6, 0
 | 
			
		||||
        .cfi_rel_offset r7, 0
 | 
			
		||||
        strd    r8, r9, [sp, #-8]!
 | 
			
		||||
        .save   {r8, r9}
 | 
			
		||||
        .cfi_adjust_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r8, 0
 | 
			
		||||
        .cfi_rel_offset r9, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,6 @@ ENTRY(__memset_chk)
 | 
			
		||||
        bls         .L_done
 | 
			
		||||
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        .save       {lr}
 | 
			
		||||
        push        {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
@@ -68,7 +67,6 @@ ENTRY(bzero)
 | 
			
		||||
END(bzero)
 | 
			
		||||
 | 
			
		||||
ENTRY(memset)
 | 
			
		||||
        .save       {r0}
 | 
			
		||||
        stmfd       sp!, {r0}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2013 The Android Open Source Project
 | 
			
		||||
 * Copyright (C) 2014 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
@@ -26,9 +26,5 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__rt_sigreturn)
 | 
			
		||||
  movl $__NR_rt_sigreturn, %eax
 | 
			
		||||
  syscall
 | 
			
		||||
END(__rt_sigreturn)
 | 
			
		||||
#define STPCPY
 | 
			
		||||
#include "string_copy.S"
 | 
			
		||||
@@ -168,7 +168,6 @@ ENTRY(strcmp)
 | 
			
		||||
        bne     .L_do_align
 | 
			
		||||
 | 
			
		||||
        /* Fast path.  */
 | 
			
		||||
        .save   {r4-r7}
 | 
			
		||||
        init
 | 
			
		||||
 | 
			
		||||
.L_doubleword_aligned:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2013 The Android Open Source Project
 | 
			
		||||
 * Copyright (C) 2014 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
@@ -25,427 +25,6 @@
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2013 ARM Ltd
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. The name of the company may not be used to endorse or promote
 | 
			
		||||
 *    products derived from this software without specific prior written
 | 
			
		||||
 *    permission.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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 <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
 | 
			
		||||
    .thumb
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
    .macro m_push
 | 
			
		||||
    push    {r0, r4, r5, lr}
 | 
			
		||||
    .endm // m_push
 | 
			
		||||
 | 
			
		||||
    .macro m_pop
 | 
			
		||||
    pop     {r0, r4, r5, pc}
 | 
			
		||||
    .endm // m_pop
 | 
			
		||||
 | 
			
		||||
    .macro m_copy_byte reg, cmd, label
 | 
			
		||||
    ldrb    \reg, [r1], #1
 | 
			
		||||
    strb    \reg, [r0], #1
 | 
			
		||||
    \cmd    \reg, \label
 | 
			
		||||
    .endm // m_copy_byte
 | 
			
		||||
 | 
			
		||||
ENTRY(strcpy)
 | 
			
		||||
    // For short copies, hard-code checking the first 8 bytes since this
 | 
			
		||||
    // new code doesn't win until after about 8 bytes.
 | 
			
		||||
    m_push
 | 
			
		||||
    m_copy_byte reg=r2, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r3, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r4, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r5, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r2, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r3, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r4, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r5, cmd=cbnz, label=strcpy_continue
 | 
			
		||||
 | 
			
		||||
strcpy_finish:
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_continue:
 | 
			
		||||
    pld     [r1, #0]
 | 
			
		||||
    ands    r3, r0, #7
 | 
			
		||||
    beq     strcpy_check_src_align
 | 
			
		||||
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     strcpy_align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, strcpy_complete
 | 
			
		||||
 | 
			
		||||
strcpy_align_to_32:
 | 
			
		||||
    bcc     strcpy_align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, strcpy_complete
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, strcpy_complete
 | 
			
		||||
 | 
			
		||||
strcpy_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     strcpy_check_src_align
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
 | 
			
		||||
strcpy_check_src_align:
 | 
			
		||||
    // At this point dst is aligned to a double word, check if src
 | 
			
		||||
    // is also aligned to a double word.
 | 
			
		||||
    ands    r3, r1, #7
 | 
			
		||||
    bne     strcpy_unaligned_copy
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
strcpy_mainloop:
 | 
			
		||||
    ldrd    r2, r3, [r1], #8
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       strcpy_mainloop
 | 
			
		||||
 | 
			
		||||
strcpy_complete:
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_zero_in_first_register:
 | 
			
		||||
    lsls    lr, ip, #17
 | 
			
		||||
    bne     strcpy_copy1byte
 | 
			
		||||
    bcs     strcpy_copy2bytes
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     strcpy_copy3bytes
 | 
			
		||||
 | 
			
		||||
strcpy_copy4bytes:
 | 
			
		||||
    // Copy 4 bytes to the destiniation.
 | 
			
		||||
    str     r2, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_copy1byte:
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_copy2bytes:
 | 
			
		||||
    strh    r2, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_copy3bytes:
 | 
			
		||||
    strh    r2, [r0], #2
 | 
			
		||||
    lsr     r2, #16
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_zero_in_second_register:
 | 
			
		||||
    lsls    lr, ip, #17
 | 
			
		||||
    bne     strcpy_copy5bytes
 | 
			
		||||
    bcs     strcpy_copy6bytes
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     strcpy_copy7bytes
 | 
			
		||||
 | 
			
		||||
    // Copy 8 bytes to the destination.
 | 
			
		||||
    strd    r2, r3, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_copy5bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_copy6bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strh    r3, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_copy7bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strh    r3, [r0], #2
 | 
			
		||||
    lsr     r3, #16
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_unaligned_copy:
 | 
			
		||||
    // Dst is aligned to a double word, while src is at an unknown alignment.
 | 
			
		||||
    // There are 7 different versions of the unaligned copy code
 | 
			
		||||
    // to prevent overreading the src. The mainloop of every single version
 | 
			
		||||
    // will store 64 bits per loop. The difference is how much of src can
 | 
			
		||||
    // be read without potentially crossing a page boundary.
 | 
			
		||||
    tbb     [pc, r3]
 | 
			
		||||
strcpy_unaligned_branchtable:
 | 
			
		||||
    .byte 0
 | 
			
		||||
    .byte ((strcpy_unalign7 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign6 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign5 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign4 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign3 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign2 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign1 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 7 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign7:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r3, [r1]
 | 
			
		||||
    cbz     r3, strcpy_unalign7_copy5bytes
 | 
			
		||||
    ldrb    r4, [r1, #1]
 | 
			
		||||
    cbz     r4, strcpy_unalign7_copy6bytes
 | 
			
		||||
    ldrb    r5, [r1, #2]
 | 
			
		||||
    cbz     r5, strcpy_unalign7_copy7bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    lsrs    ip, r3, #24
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    beq     strcpy_unalign_return
 | 
			
		||||
    b       strcpy_unalign7
 | 
			
		||||
 | 
			
		||||
strcpy_unalign7_copy5bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
strcpy_unalign_return:
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign7_copy6bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign7_copy7bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    strb    r5, [r0], #1
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 6 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign6:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r4, [r1]
 | 
			
		||||
    cbz     r4, strcpy_unalign_copy5bytes
 | 
			
		||||
    ldrb    r5, [r1, #1]
 | 
			
		||||
    cbz     r5, strcpy_unalign_copy6bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    tst     r3, #0xff0000
 | 
			
		||||
    beq     strcpy_copy7bytes
 | 
			
		||||
    lsrs    ip, r3, #24
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    beq     strcpy_unalign_return
 | 
			
		||||
    b       strcpy_unalign6
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 5 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign5:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r4, [r1]
 | 
			
		||||
    cbz     r4, strcpy_unalign_copy5bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       strcpy_unalign5
 | 
			
		||||
 | 
			
		||||
strcpy_unalign_copy5bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign_copy6bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    strb    r5, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 4 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign4:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       strcpy_unalign4
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 3 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign3:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, strcpy_unalign3_copy1byte
 | 
			
		||||
    ldrb    r3, [r1, #1]
 | 
			
		||||
    cbz     r3, strcpy_unalign3_copy2bytes
 | 
			
		||||
    ldrb    r4, [r1, #2]
 | 
			
		||||
    cbz     r4, strcpy_unalign3_copy3bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    lsrs    lr, r2, #24
 | 
			
		||||
    beq     strcpy_copy4bytes
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       strcpy_unalign3
 | 
			
		||||
 | 
			
		||||
strcpy_unalign3_copy1byte:
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign3_copy2bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign3_copy3bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 2 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign2:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, strcpy_unalign_copy1byte
 | 
			
		||||
    ldrb    r4, [r1, #1]
 | 
			
		||||
    cbz     r4, strcpy_unalign_copy2bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    tst     r2, #0xff0000
 | 
			
		||||
    beq     strcpy_copy3bytes
 | 
			
		||||
    lsrs    ip, r2, #24
 | 
			
		||||
    beq     strcpy_copy4bytes
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       strcpy_unalign2
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 1 byte before possibly crossing a page.
 | 
			
		||||
strcpy_unalign1:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, strcpy_unalign_copy1byte
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       strcpy_unalign1
 | 
			
		||||
 | 
			
		||||
strcpy_unalign_copy1byte:
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign_copy2bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
END(strcpy)
 | 
			
		||||
#define STRCPY
 | 
			
		||||
#include "string_copy.S"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										513
									
								
								libc/arch-arm/cortex-a15/bionic/string_copy.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										513
									
								
								libc/arch-arm/cortex-a15/bionic/string_copy.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,513 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2013 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.
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2013 ARM Ltd
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. The name of the company may not be used to endorse or promote
 | 
			
		||||
 *    products derived from this software without specific prior written
 | 
			
		||||
 *    permission.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(STPCPY) && !defined(STRCPY)
 | 
			
		||||
#error "Either STPCPY or STRCPY must be defined."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
 | 
			
		||||
    .thumb
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    .macro m_push
 | 
			
		||||
    push    {r4, r5, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 12
 | 
			
		||||
    .cfi_rel_offset r4, 0
 | 
			
		||||
    .cfi_rel_offset r5, 4
 | 
			
		||||
    .cfi_rel_offset lr, 8
 | 
			
		||||
    .endm // m_push
 | 
			
		||||
#else
 | 
			
		||||
    .macro m_push
 | 
			
		||||
    push    {r0, r4, r5, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 16
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset r4, 4
 | 
			
		||||
    .cfi_rel_offset r5, 8
 | 
			
		||||
    .cfi_rel_offset lr, 12
 | 
			
		||||
    .endm // m_push
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    .macro m_pop
 | 
			
		||||
    pop     {r4, r5, pc}
 | 
			
		||||
    .endm // m_pop
 | 
			
		||||
#else
 | 
			
		||||
    .macro m_pop
 | 
			
		||||
    pop     {r0, r4, r5, pc}
 | 
			
		||||
    .endm // m_pop
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    .macro m_copy_byte reg, cmd, label
 | 
			
		||||
    ldrb    \reg, [r1], #1
 | 
			
		||||
    strb    \reg, [r0], #1
 | 
			
		||||
    \cmd    \reg, \label
 | 
			
		||||
    .endm // m_copy_byte
 | 
			
		||||
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
ENTRY(stpcpy)
 | 
			
		||||
#else
 | 
			
		||||
ENTRY(strcpy)
 | 
			
		||||
#endif
 | 
			
		||||
    // For short copies, hard-code checking the first 8 bytes since this
 | 
			
		||||
    // new code doesn't win until after about 8 bytes.
 | 
			
		||||
    m_push
 | 
			
		||||
    m_copy_byte reg=r2, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r3, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r4, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r5, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r2, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r3, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r4, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r5, cmd=cbnz, label=.Lstringcopy_continue
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_finish:
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
#endif
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_continue:
 | 
			
		||||
    pld     [r1, #0]
 | 
			
		||||
    ands    r3, r0, #7
 | 
			
		||||
    beq     .Lstringcopy_check_src_align
 | 
			
		||||
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     .Lstringcopy_align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .Lstringcopy_complete
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_align_to_32:
 | 
			
		||||
    bcc     .Lstringcopy_align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .Lstringcopy_complete
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .Lstringcopy_complete
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     .Lstringcopy_check_src_align
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_check_src_align:
 | 
			
		||||
    // At this point dst is aligned to a double word, check if src
 | 
			
		||||
    // is also aligned to a double word.
 | 
			
		||||
    ands    r3, r1, #7
 | 
			
		||||
    bne     .Lstringcopy_unaligned_copy
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
.Lstringcopy_mainloop:
 | 
			
		||||
    ldrd    r2, r3, [r1], #8
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       .Lstringcopy_mainloop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_complete:
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
#endif
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_zero_in_first_register:
 | 
			
		||||
    lsls    lr, ip, #17
 | 
			
		||||
    bne     .Lstringcopy_copy1byte
 | 
			
		||||
    bcs     .Lstringcopy_copy2bytes
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     .Lstringcopy_copy3bytes
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_copy4bytes:
 | 
			
		||||
    // Copy 4 bytes to the destiniation.
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    str     r2, [r0], #3
 | 
			
		||||
#else
 | 
			
		||||
    str     r2, [r0]
 | 
			
		||||
#endif
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_copy1byte:
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_copy2bytes:
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    strh    r2, [r0], #1
 | 
			
		||||
#else
 | 
			
		||||
    strh    r2, [r0]
 | 
			
		||||
#endif
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_copy3bytes:
 | 
			
		||||
    strh    r2, [r0], #2
 | 
			
		||||
    lsr     r2, #16
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_zero_in_second_register:
 | 
			
		||||
    lsls    lr, ip, #17
 | 
			
		||||
    bne     .Lstringcopy_copy5bytes
 | 
			
		||||
    bcs     .Lstringcopy_copy6bytes
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     .Lstringcopy_copy7bytes
 | 
			
		||||
 | 
			
		||||
    // Copy 8 bytes to the destination.
 | 
			
		||||
    strd    r2, r3, [r0]
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    add     r0, r0, #7
 | 
			
		||||
#endif
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_copy5bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_copy6bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    strh    r3, [r0], #1
 | 
			
		||||
#else
 | 
			
		||||
    strh    r3, [r0]
 | 
			
		||||
#endif
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_copy7bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strh    r3, [r0], #2
 | 
			
		||||
    lsr     r3, #16
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unaligned_copy:
 | 
			
		||||
    // Dst is aligned to a double word, while src is at an unknown alignment.
 | 
			
		||||
    // There are 7 different versions of the unaligned copy code
 | 
			
		||||
    // to prevent overreading the src. The mainloop of every single version
 | 
			
		||||
    // will store 64 bits per loop. The difference is how much of src can
 | 
			
		||||
    // be read without potentially crossing a page boundary.
 | 
			
		||||
    tbb     [pc, r3]
 | 
			
		||||
.Lstringcopy_unaligned_branchtable:
 | 
			
		||||
    .byte 0
 | 
			
		||||
    .byte ((.Lstringcopy_unalign7 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign6 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign5 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign4 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign3 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign2 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign1 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 7 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign7:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r3, [r1]
 | 
			
		||||
    cbz     r3, .Lstringcopy_unalign7_copy5bytes
 | 
			
		||||
    ldrb    r4, [r1, #1]
 | 
			
		||||
    cbz     r4, .Lstringcopy_unalign7_copy6bytes
 | 
			
		||||
    ldrb    r5, [r1, #2]
 | 
			
		||||
    cbz     r5, .Lstringcopy_unalign7_copy7bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    lsrs    ip, r3, #24
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    beq     .Lstringcopy_finish
 | 
			
		||||
#else
 | 
			
		||||
    beq     .Lstringcopy_unalign_return
 | 
			
		||||
#endif
 | 
			
		||||
    b       .Lstringcopy_unalign7
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign7_copy5bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
.Lstringcopy_unalign_return:
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign7_copy6bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign7_copy7bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    strb    r5, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 6 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign6:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r4, [r1]
 | 
			
		||||
    cbz     r4, .Lstringcopy_unalign_copy5bytes
 | 
			
		||||
    ldrb    r5, [r1, #1]
 | 
			
		||||
    cbz     r5, .Lstringcopy_unalign_copy6bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    tst     r3, #0xff0000
 | 
			
		||||
    beq     .Lstringcopy_copy7bytes
 | 
			
		||||
    lsrs    ip, r3, #24
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    beq     .Lstringcopy_finish
 | 
			
		||||
#else
 | 
			
		||||
    beq     .Lstringcopy_unalign_return
 | 
			
		||||
#endif
 | 
			
		||||
    b       .Lstringcopy_unalign6
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 5 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign5:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r4, [r1]
 | 
			
		||||
    cbz     r4, .Lstringcopy_unalign_copy5bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       .Lstringcopy_unalign5
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign_copy5bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign_copy6bytes:
 | 
			
		||||
    str     r2, [r0], #4
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    strb    r5, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 4 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign4:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       .Lstringcopy_unalign4
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 3 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign3:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, .Lstringcopy_unalign3_copy1byte
 | 
			
		||||
    ldrb    r3, [r1, #1]
 | 
			
		||||
    cbz     r3, .Lstringcopy_unalign3_copy2bytes
 | 
			
		||||
    ldrb    r4, [r1, #2]
 | 
			
		||||
    cbz     r4, .Lstringcopy_unalign3_copy3bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    lsrs    lr, r2, #24
 | 
			
		||||
    beq     .Lstringcopy_copy4bytes
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       .Lstringcopy_unalign3
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign3_copy1byte:
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign3_copy2bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign3_copy3bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 2 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign2:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, .Lstringcopy_unalign_copy1byte
 | 
			
		||||
    ldrb    r4, [r1, #1]
 | 
			
		||||
    cbz     r4, .Lstringcopy_unalign_copy2bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    tst     r2, #0xff0000
 | 
			
		||||
    beq     .Lstringcopy_copy3bytes
 | 
			
		||||
    lsrs    ip, r2, #24
 | 
			
		||||
    beq     .Lstringcopy_copy4bytes
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       .Lstringcopy_unalign2
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 1 byte before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign1:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, .Lstringcopy_unalign_copy1byte
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    strd    r2, r3, [r0], #8
 | 
			
		||||
    b       .Lstringcopy_unalign1
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign_copy1byte:
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign_copy2bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_pop
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
END(stpcpy)
 | 
			
		||||
#else
 | 
			
		||||
END(strcpy)
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,10 +1,11 @@
 | 
			
		||||
libc_bionic_src_files_arm += \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/memcpy.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/memset.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/stpcpy.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcat.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/__strcat_chk.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcmp.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcpy.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strlen.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/__strcat_chk.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/__strcpy_chk.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strlen.S \
 | 
			
		||||
    bionic/memmove.c \
 | 
			
		||||
 
 | 
			
		||||
@@ -40,12 +40,10 @@
 | 
			
		||||
ENTRY(__strcat_chk)
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    push    {r0, lr}
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
    push    {r4, r5}
 | 
			
		||||
    .save   {r4, r5}
 | 
			
		||||
    .cfi_adjust_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r4, 0
 | 
			
		||||
    .cfi_rel_offset r5, 4
 | 
			
		||||
@@ -199,8 +197,6 @@ END(__strcat_chk)
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__strcat_chk_fail)
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .save   {r4, r5}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,6 @@
 | 
			
		||||
ENTRY(__strcpy_chk)
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    push    {r0, lr}
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
@@ -165,7 +164,6 @@ END(__strcpy_chk)
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__strcpy_chk_fail)
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,6 @@ END(__memcpy_chk)
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
        pld     [r1, #0]
 | 
			
		||||
        stmfd   sp!, {r0, lr}
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
@@ -64,7 +63,6 @@ END(memcpy)
 | 
			
		||||
ENTRY_PRIVATE(__memcpy_chk_fail)
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        push    {lr}
 | 
			
		||||
        .save   {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,6 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(MEMCPY_BASE)
 | 
			
		||||
        .save       {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
@@ -139,14 +138,12 @@ ENTRY_PRIVATE(MEMCPY_BASE)
 | 
			
		||||
END(MEMCPY_BASE)
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(MEMCPY_BASE_ALIGNED)
 | 
			
		||||
        .save       {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
        /* Simple arm-only copy loop to handle aligned copy operations */
 | 
			
		||||
        stmfd       sp!, {r4-r8}
 | 
			
		||||
        .save       {r4-r8}
 | 
			
		||||
        .cfi_adjust_cfa_offset 20
 | 
			
		||||
        .cfi_rel_offset r4, 0
 | 
			
		||||
        .cfi_rel_offset r5, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,6 @@ ENTRY(__memset_chk)
 | 
			
		||||
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        push        {lr}
 | 
			
		||||
        .save       {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
 | 
			
		||||
@@ -72,7 +71,6 @@ ENTRY(memset)
 | 
			
		||||
        bhi         __memset_large_copy
 | 
			
		||||
 | 
			
		||||
        stmfd       sp!, {r0}
 | 
			
		||||
        .save       {r0}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
 | 
			
		||||
@@ -114,7 +112,6 @@ ENTRY_PRIVATE(__memset_large_copy)
 | 
			
		||||
         * offset = (4-(src&3))&3 = -src & 3
 | 
			
		||||
         */
 | 
			
		||||
        stmfd       sp!, {r0, r4-r7, lr}
 | 
			
		||||
        .save       {r0, r4-r7, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 24
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset r4, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2013 The Android Open Source Project
 | 
			
		||||
 * Copyright (C) 2014 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
@@ -26,9 +26,5 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__rt_sigreturn)
 | 
			
		||||
  mov     x8, __NR_rt_sigreturn
 | 
			
		||||
  svc     #0
 | 
			
		||||
END(__rt_sigreturn)
 | 
			
		||||
#define STPCPY
 | 
			
		||||
#include "string_copy.S"
 | 
			
		||||
@@ -168,7 +168,6 @@ ENTRY(strcmp)
 | 
			
		||||
        bne     .L_do_align
 | 
			
		||||
 | 
			
		||||
        /* Fast path.  */
 | 
			
		||||
        .save   {r4-r7}
 | 
			
		||||
        init
 | 
			
		||||
 | 
			
		||||
.L_doubleword_aligned:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2013 The Android Open Source Project
 | 
			
		||||
 * Copyright (C) 2014 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
@@ -25,432 +25,6 @@
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2013 ARM Ltd
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. The name of the company may not be used to endorse or promote
 | 
			
		||||
 *    products derived from this software without specific prior written
 | 
			
		||||
 *    permission.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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 <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
 | 
			
		||||
    .thumb
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
    .macro m_push
 | 
			
		||||
    push    {r0, r4, r5, lr}
 | 
			
		||||
    .endm // m_push
 | 
			
		||||
 | 
			
		||||
    .macro m_ret inst
 | 
			
		||||
    \inst   {r0, r4, r5, pc}
 | 
			
		||||
    .endm // m_ret
 | 
			
		||||
 | 
			
		||||
    .macro m_copy_byte reg, cmd, label
 | 
			
		||||
    ldrb    \reg, [r1], #1
 | 
			
		||||
    strb    \reg, [r0], #1
 | 
			
		||||
    \cmd    \reg, \label
 | 
			
		||||
    .endm // m_copy_byte
 | 
			
		||||
 | 
			
		||||
ENTRY(strcpy)
 | 
			
		||||
    // Unroll the first 8 bytes that will be copied.
 | 
			
		||||
    m_push
 | 
			
		||||
    m_copy_byte reg=r2, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r3, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r4, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r5, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r2, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r3, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r4, cmd=cbz, label=strcpy_finish
 | 
			
		||||
    m_copy_byte reg=r5, cmd=cbnz, label=strcpy_continue
 | 
			
		||||
 | 
			
		||||
strcpy_finish:
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_continue:
 | 
			
		||||
    pld     [r1, #0]
 | 
			
		||||
    ands    r3, r0, #7
 | 
			
		||||
    bne     strcpy_align_dst
 | 
			
		||||
 | 
			
		||||
strcpy_check_src_align:
 | 
			
		||||
    // At this point dst is aligned to a double word, check if src
 | 
			
		||||
    // is also aligned to a double word.
 | 
			
		||||
    ands    r3, r1, #7
 | 
			
		||||
    bne     strcpy_unaligned_copy
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
strcpy_mainloop:
 | 
			
		||||
    ldmia   r1!, {r2, r3}
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       strcpy_mainloop
 | 
			
		||||
 | 
			
		||||
strcpy_zero_in_first_register:
 | 
			
		||||
    lsls    lr, ip, #17
 | 
			
		||||
    itt     ne
 | 
			
		||||
    strbne  r2, [r0]
 | 
			
		||||
    m_ret   inst=popne
 | 
			
		||||
    itt     cs
 | 
			
		||||
    strhcs  r2, [r0]
 | 
			
		||||
    m_ret   inst=popcs
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    itt     eq
 | 
			
		||||
    streq   r2, [r0]
 | 
			
		||||
    m_ret   inst=popeq
 | 
			
		||||
    strh    r2, [r0], #2
 | 
			
		||||
    lsr     r3, r2, #16
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_zero_in_second_register:
 | 
			
		||||
    lsls    lr, ip, #17
 | 
			
		||||
    ittt    ne
 | 
			
		||||
    stmiane r0!, {r2}
 | 
			
		||||
    strbne  r3, [r0]
 | 
			
		||||
    m_ret   inst=popne
 | 
			
		||||
    ittt    cs
 | 
			
		||||
    strcs   r2, [r0], #4
 | 
			
		||||
    strhcs  r3, [r0]
 | 
			
		||||
    m_ret   inst=popcs
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    itt     eq
 | 
			
		||||
    stmiaeq r0, {r2, r3}
 | 
			
		||||
    m_ret   inst=popeq
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strh    r3, [r0], #2
 | 
			
		||||
    lsr     r4, r3, #16
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_align_dst:
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     strcpy_align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, strcpy_complete
 | 
			
		||||
 | 
			
		||||
strcpy_align_to_32:
 | 
			
		||||
    bcc     strcpy_align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r4, [r1], #1
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    cmp     r4, #0
 | 
			
		||||
    it      eq
 | 
			
		||||
    m_ret   inst=popeq
 | 
			
		||||
    ldrb    r5, [r1], #1
 | 
			
		||||
    strb    r5, [r0], #1
 | 
			
		||||
    cmp     r5, #0
 | 
			
		||||
    it      eq
 | 
			
		||||
    m_ret   inst=popeq
 | 
			
		||||
 | 
			
		||||
strcpy_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     strcpy_check_src_align
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    b       strcpy_check_src_align
 | 
			
		||||
 | 
			
		||||
strcpy_complete:
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_unaligned_copy:
 | 
			
		||||
    // Dst is aligned to a double word, while src is at an unknown alignment.
 | 
			
		||||
    // There are 7 different versions of the unaligned copy code
 | 
			
		||||
    // to prevent overreading the src. The mainloop of every single version
 | 
			
		||||
    // will store 64 bits per loop. The difference is how much of src can
 | 
			
		||||
    // be read without potentially crossing a page boundary.
 | 
			
		||||
    tbb     [pc, r3]
 | 
			
		||||
strcpy_unaligned_branchtable:
 | 
			
		||||
    .byte 0
 | 
			
		||||
    .byte ((strcpy_unalign7 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign6 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign5 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign4 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign3 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign2 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((strcpy_unalign1 - strcpy_unaligned_branchtable)/2)
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 7 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign7:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r3, [r1]
 | 
			
		||||
    cbz     r3, strcpy_unalign7_copy5bytes
 | 
			
		||||
    ldrb    r4, [r1, #1]
 | 
			
		||||
    cbz     r4, strcpy_unalign7_copy6bytes
 | 
			
		||||
    ldrb    r5, [r1, #2]
 | 
			
		||||
    cbz     r5, strcpy_unalign7_copy7bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    lsrs    ip, r3, #24
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    beq     strcpy_unalign_return
 | 
			
		||||
    b       strcpy_unalign7
 | 
			
		||||
 | 
			
		||||
strcpy_unalign7_copy5bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
strcpy_unalign_return:
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign7_copy6bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign7_copy7bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    strb    r5, [r0], #1
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 6 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign6:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r4, [r1]
 | 
			
		||||
    cbz     r4, strcpy_unalign_copy5bytes
 | 
			
		||||
    ldrb    r5, [r1, #1]
 | 
			
		||||
    cbz     r5, strcpy_unalign_copy6bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    tst     r3, #0xff0000
 | 
			
		||||
    beq     strcpy_unalign6_copy7bytes
 | 
			
		||||
    lsrs    ip, r3, #24
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    beq     strcpy_unalign_return
 | 
			
		||||
    b       strcpy_unalign6
 | 
			
		||||
 | 
			
		||||
strcpy_unalign6_copy7bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strh    r3, [r0], #2
 | 
			
		||||
    lsr     r3, #16
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 5 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign5:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r4, [r1]
 | 
			
		||||
    cbz     r4, strcpy_unalign_copy5bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       strcpy_unalign5
 | 
			
		||||
 | 
			
		||||
strcpy_unalign_copy5bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign_copy6bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    strb    r5, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 4 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign4:
 | 
			
		||||
    ldmia   r1!, {r2}
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldmia   r1!, {r3}
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       strcpy_unalign4
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 3 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign3:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, strcpy_unalign3_copy1byte
 | 
			
		||||
    ldrb    r3, [r1, #1]
 | 
			
		||||
    cbz     r3, strcpy_unalign3_copy2bytes
 | 
			
		||||
    ldrb    r4, [r1, #2]
 | 
			
		||||
    cbz     r4, strcpy_unalign3_copy3bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    lsrs    lr, r2, #24
 | 
			
		||||
    beq     strcpy_unalign_copy4bytes
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       strcpy_unalign3
 | 
			
		||||
 | 
			
		||||
strcpy_unalign3_copy1byte:
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign3_copy2bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign3_copy3bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 2 bytes before possibly crossing a page.
 | 
			
		||||
strcpy_unalign2:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, strcpy_unalign_copy1byte
 | 
			
		||||
    ldrb    r3, [r1, #1]
 | 
			
		||||
    cbz     r3, strcpy_unalign_copy2bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    tst     r2, #0xff0000
 | 
			
		||||
    beq     strcpy_unalign_copy3bytes
 | 
			
		||||
    lsrs    ip, r2, #24
 | 
			
		||||
    beq     strcpy_unalign_copy4bytes
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       strcpy_unalign2
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 1 byte before possibly crossing a page.
 | 
			
		||||
strcpy_unalign1:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, strcpy_unalign_copy1byte
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcpy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       strcpy_unalign1
 | 
			
		||||
 | 
			
		||||
strcpy_unalign_copy1byte:
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign_copy2bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign_copy3bytes:
 | 
			
		||||
    strh    r2, [r0], #2
 | 
			
		||||
    lsr     r2, #16
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
strcpy_unalign_copy4bytes:
 | 
			
		||||
    stmia   r0, {r2}
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
END(strcpy)
 | 
			
		||||
#define STRCPY
 | 
			
		||||
#include "string_copy.S"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										535
									
								
								libc/arch-arm/cortex-a9/bionic/string_copy.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										535
									
								
								libc/arch-arm/cortex-a9/bionic/string_copy.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,535 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2013 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.
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2013 ARM Ltd
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. The name of the company may not be used to endorse or promote
 | 
			
		||||
 *    products derived from this software without specific prior written
 | 
			
		||||
 *    permission.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(STPCPY) && !defined(STRCPY)
 | 
			
		||||
#error "Either STPCPY or STRCPY must be defined."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
 | 
			
		||||
    .thumb
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    .macro m_push
 | 
			
		||||
    push    {r4, r5, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 12
 | 
			
		||||
    .cfi_rel_offset r4, 0
 | 
			
		||||
    .cfi_rel_offset r5, 4
 | 
			
		||||
    .cfi_rel_offset lr, 8
 | 
			
		||||
    .endm // m_push
 | 
			
		||||
#else
 | 
			
		||||
    .macro m_push
 | 
			
		||||
    push    {r0, r4, r5, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 16
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset r4, 4
 | 
			
		||||
    .cfi_rel_offset r5, 8
 | 
			
		||||
    .cfi_rel_offset lr, 12
 | 
			
		||||
    .endm // m_push
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    .macro m_ret inst
 | 
			
		||||
    \inst   {r4, r5, pc}
 | 
			
		||||
    .endm // m_ret
 | 
			
		||||
#else
 | 
			
		||||
    .macro m_ret inst
 | 
			
		||||
    \inst   {r0, r4, r5, pc}
 | 
			
		||||
    .endm // m_ret
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    .macro m_copy_byte reg, cmd, label
 | 
			
		||||
    ldrb    \reg, [r1], #1
 | 
			
		||||
    strb    \reg, [r0], #1
 | 
			
		||||
    \cmd    \reg, \label
 | 
			
		||||
    .endm // m_copy_byte
 | 
			
		||||
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
ENTRY(stpcpy)
 | 
			
		||||
#else
 | 
			
		||||
ENTRY(strcpy)
 | 
			
		||||
#endif
 | 
			
		||||
    // Unroll the first 8 bytes that will be copied.
 | 
			
		||||
    m_push
 | 
			
		||||
    m_copy_byte reg=r2, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r3, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r4, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r5, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r2, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r3, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r4, cmd=cbz, label=.Lstringcopy_finish
 | 
			
		||||
    m_copy_byte reg=r5, cmd=cbnz, label=.Lstringcopy_continue
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_finish:
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
#endif
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_continue:
 | 
			
		||||
    pld     [r1, #0]
 | 
			
		||||
    ands    r3, r0, #7
 | 
			
		||||
    bne     .Lstringcopy_align_dst
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_check_src_align:
 | 
			
		||||
    // At this point dst is aligned to a double word, check if src
 | 
			
		||||
    // is also aligned to a double word.
 | 
			
		||||
    ands    r3, r1, #7
 | 
			
		||||
    bne     .Lstringcopy_unaligned_copy
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
.Lstringcopy_mainloop:
 | 
			
		||||
    ldmia   r1!, {r2, r3}
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       .Lstringcopy_mainloop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_zero_in_first_register:
 | 
			
		||||
    lsls    lr, ip, #17
 | 
			
		||||
    itt     ne
 | 
			
		||||
    strbne  r2, [r0]
 | 
			
		||||
    m_ret   inst=popne
 | 
			
		||||
    itt     cs
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    strhcs  r2, [r0], #1
 | 
			
		||||
#else
 | 
			
		||||
    strhcs  r2, [r0]
 | 
			
		||||
#endif
 | 
			
		||||
    m_ret   inst=popcs
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    itt     eq
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    streq   r2, [r0], #3
 | 
			
		||||
#else
 | 
			
		||||
    streq   r2, [r0]
 | 
			
		||||
#endif
 | 
			
		||||
    m_ret   inst=popeq
 | 
			
		||||
    strh    r2, [r0], #2
 | 
			
		||||
    lsr     r3, r2, #16
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_zero_in_second_register:
 | 
			
		||||
    lsls    lr, ip, #17
 | 
			
		||||
    ittt    ne
 | 
			
		||||
    stmiane r0!, {r2}
 | 
			
		||||
    strbne  r3, [r0]
 | 
			
		||||
    m_ret   inst=popne
 | 
			
		||||
    ittt    cs
 | 
			
		||||
    strcs   r2, [r0], #4
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    strhcs  r3, [r0], #1
 | 
			
		||||
#else
 | 
			
		||||
    strhcs  r3, [r0]
 | 
			
		||||
#endif
 | 
			
		||||
    m_ret   inst=popcs
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    ittt    eq
 | 
			
		||||
#else
 | 
			
		||||
    itt     eq
 | 
			
		||||
#endif
 | 
			
		||||
    stmiaeq r0, {r2, r3}
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    addeq   r0, r0, #7
 | 
			
		||||
#endif
 | 
			
		||||
    m_ret   inst=popeq
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strh    r3, [r0], #2
 | 
			
		||||
    lsr     r4, r3, #16
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_align_dst:
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     .Lstringcopy_align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .Lstringcopy_complete
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_align_to_32:
 | 
			
		||||
    bcc     .Lstringcopy_align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r4, [r1], #1
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    cmp     r4, #0
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    itt     eq
 | 
			
		||||
    subeq   r0, r0, #1
 | 
			
		||||
#else
 | 
			
		||||
    it      eq
 | 
			
		||||
#endif
 | 
			
		||||
    m_ret   inst=popeq
 | 
			
		||||
    ldrb    r5, [r1], #1
 | 
			
		||||
    strb    r5, [r0], #1
 | 
			
		||||
    cmp     r5, #0
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    itt     eq
 | 
			
		||||
    subeq   r0, r0, #1
 | 
			
		||||
#else
 | 
			
		||||
    it      eq
 | 
			
		||||
#endif
 | 
			
		||||
    m_ret   inst=popeq
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     .Lstringcopy_check_src_align
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    b       .Lstringcopy_check_src_align
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_complete:
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
#endif
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unaligned_copy:
 | 
			
		||||
    // Dst is aligned to a double word, while src is at an unknown alignment.
 | 
			
		||||
    // There are 7 different versions of the unaligned copy code
 | 
			
		||||
    // to prevent overreading the src. The mainloop of every single version
 | 
			
		||||
    // will store 64 bits per loop. The difference is how much of src can
 | 
			
		||||
    // be read without potentially crossing a page boundary.
 | 
			
		||||
    tbb     [pc, r3]
 | 
			
		||||
.Lstringcopy_unaligned_branchtable:
 | 
			
		||||
    .byte 0
 | 
			
		||||
    .byte ((.Lstringcopy_unalign7 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign6 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign5 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign4 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign3 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign2 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
    .byte ((.Lstringcopy_unalign1 - .Lstringcopy_unaligned_branchtable)/2)
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 7 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign7:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r3, [r1]
 | 
			
		||||
    cbz     r3, .Lstringcopy_unalign7_copy5bytes
 | 
			
		||||
    ldrb    r4, [r1, #1]
 | 
			
		||||
    cbz     r4, .Lstringcopy_unalign7_copy6bytes
 | 
			
		||||
    ldrb    r5, [r1, #2]
 | 
			
		||||
    cbz     r5, .Lstringcopy_unalign7_copy7bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    lsrs    ip, r3, #24
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    beq     .Lstringcopy_finish
 | 
			
		||||
#else
 | 
			
		||||
    beq     .Lstringcopy_unalign_return
 | 
			
		||||
#endif
 | 
			
		||||
    b       .Lstringcopy_unalign7
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign7_copy5bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
.Lstringcopy_unalign_return:
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign7_copy6bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign7_copy7bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    strb    r5, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 6 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign6:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r4, [r1]
 | 
			
		||||
    cbz     r4, .Lstringcopy_unalign_copy5bytes
 | 
			
		||||
    ldrb    r5, [r1, #1]
 | 
			
		||||
    cbz     r5, .Lstringcopy_unalign_copy6bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    tst     r3, #0xff0000
 | 
			
		||||
    beq     .Lstringcopy_unalign6_copy7bytes
 | 
			
		||||
    lsrs    ip, r3, #24
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    beq     .Lstringcopy_finish
 | 
			
		||||
#else
 | 
			
		||||
    beq     .Lstringcopy_unalign_return
 | 
			
		||||
#endif
 | 
			
		||||
    b       .Lstringcopy_unalign6
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign6_copy7bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strh    r3, [r0], #2
 | 
			
		||||
    lsr     r3, #16
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 5 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign5:
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldrb    r4, [r1]
 | 
			
		||||
    cbz     r4, .Lstringcopy_unalign_copy5bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       .Lstringcopy_unalign5
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign_copy5bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign_copy6bytes:
 | 
			
		||||
    stmia   r0!, {r2}
 | 
			
		||||
    strb    r4, [r0], #1
 | 
			
		||||
    strb    r5, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 4 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign4:
 | 
			
		||||
    ldmia   r1!, {r2}
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    ldmia   r1!, {r3}
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       .Lstringcopy_unalign4
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 3 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign3:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, .Lstringcopy_unalign3_copy1byte
 | 
			
		||||
    ldrb    r3, [r1, #1]
 | 
			
		||||
    cbz     r3, .Lstringcopy_unalign3_copy2bytes
 | 
			
		||||
    ldrb    r4, [r1, #2]
 | 
			
		||||
    cbz     r4, .Lstringcopy_unalign3_copy3bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    lsrs    lr, r2, #24
 | 
			
		||||
    beq     .Lstringcopy_unalign_copy4bytes
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       .Lstringcopy_unalign3
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign3_copy1byte:
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign3_copy2bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign3_copy3bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r3, [r0], #1
 | 
			
		||||
    strb    r4, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 2 bytes before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign2:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, .Lstringcopy_unalign_copy1byte
 | 
			
		||||
    ldrb    r3, [r1, #1]
 | 
			
		||||
    cbz     r3, .Lstringcopy_unalign_copy2bytes
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    tst     r2, #0xff0000
 | 
			
		||||
    beq     .Lstringcopy_unalign_copy3bytes
 | 
			
		||||
    lsrs    ip, r2, #24
 | 
			
		||||
    beq     .Lstringcopy_unalign_copy4bytes
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       .Lstringcopy_unalign2
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
    // Can read 1 byte before possibly crossing a page.
 | 
			
		||||
.Lstringcopy_unalign1:
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    cbz     r2, .Lstringcopy_unalign_copy1byte
 | 
			
		||||
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .Lstringcopy_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    stmia   r0!, {r2, r3}
 | 
			
		||||
    b       .Lstringcopy_unalign1
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign_copy1byte:
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign_copy2bytes:
 | 
			
		||||
    strb    r2, [r0], #1
 | 
			
		||||
    strb    r3, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign_copy3bytes:
 | 
			
		||||
    strh    r2, [r0], #2
 | 
			
		||||
    lsr     r2, #16
 | 
			
		||||
    strb    r2, [r0]
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
 | 
			
		||||
.Lstringcopy_unalign_copy4bytes:
 | 
			
		||||
    stmia   r0, {r2}
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
    add     r0, r0, #3
 | 
			
		||||
#endif
 | 
			
		||||
    m_ret   inst=pop
 | 
			
		||||
#if defined(STPCPY)
 | 
			
		||||
END(stpcpy)
 | 
			
		||||
#else
 | 
			
		||||
END(strcpy)
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,10 +1,11 @@
 | 
			
		||||
libc_bionic_src_files_arm += \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/memcpy.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/memset.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/stpcpy.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/strcat.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/__strcat_chk.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/strcmp.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/strcpy.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/strlen.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/__strcat_chk.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/__strcpy_chk.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/strlen.S \
 | 
			
		||||
    bionic/memmove.c \
 | 
			
		||||
 
 | 
			
		||||
@@ -40,12 +40,10 @@
 | 
			
		||||
ENTRY(__strcat_chk)
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    push    {r0, lr}
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
    push    {r4, r5}
 | 
			
		||||
    .save   {r4, r5}
 | 
			
		||||
    .cfi_adjust_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r4, 0
 | 
			
		||||
    .cfi_rel_offset r5, 4
 | 
			
		||||
@@ -195,9 +193,6 @@ END(__strcat_chk)
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__strcat_chk_failed)
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .save   {r4, r5}
 | 
			
		||||
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,6 @@
 | 
			
		||||
ENTRY(__strcpy_chk)
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    push    {r0, lr}
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
@@ -161,7 +160,6 @@ END(__strcpy_chk)
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__strcpy_chk_failed)
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,6 @@ END(__memcpy_chk)
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
        pld     [r1, #64]
 | 
			
		||||
        push    {r0, lr}
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
@@ -85,7 +84,6 @@ END(memcpy)
 | 
			
		||||
ENTRY_PRIVATE(__memcpy_chk_fail)
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        push    {lr}
 | 
			
		||||
        .save   {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,8 @@ libc_bionic_src_files_arm += \
 | 
			
		||||
 | 
			
		||||
# Use cortex-a15 versions of strcat/strcpy/strlen.
 | 
			
		||||
libc_bionic_src_files_arm += \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/stpcpy.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcat.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcmp.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcpy.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strlen.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcmp.S \
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,5 @@ libc_bionic_src_files_arm += \
 | 
			
		||||
    bionic/memmove.c \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpcpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strcat.c \
 | 
			
		||||
 
 | 
			
		||||
@@ -38,9 +38,7 @@
 | 
			
		||||
#ifndef _ARM32_ASM_H_
 | 
			
		||||
#define _ARM32_ASM_H_
 | 
			
		||||
 | 
			
		||||
#ifndef _ALIGN_TEXT
 | 
			
		||||
# define _ALIGN_TEXT .align 0
 | 
			
		||||
#endif
 | 
			
		||||
#define __bionic_asm_align 0
 | 
			
		||||
 | 
			
		||||
#undef __bionic_asm_custom_entry
 | 
			
		||||
#undef __bionic_asm_custom_end
 | 
			
		||||
@@ -50,10 +48,4 @@
 | 
			
		||||
#undef __bionic_asm_function_type
 | 
			
		||||
#define __bionic_asm_function_type #function
 | 
			
		||||
 | 
			
		||||
#if defined(__ELF__) && defined(PIC)
 | 
			
		||||
#define PIC_SYM(x,y) x ## ( ## y ## )
 | 
			
		||||
#else
 | 
			
		||||
#define PIC_SYM(x,y) x
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* !_ARM_ASM_H_ */
 | 
			
		||||
 
 | 
			
		||||
@@ -40,12 +40,10 @@
 | 
			
		||||
ENTRY(__strcat_chk)
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    push    {r0, lr}
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
    push    {r4, r5}
 | 
			
		||||
    .save   {r4, r5}
 | 
			
		||||
    .cfi_adjust_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r4, 0
 | 
			
		||||
    .cfi_rel_offset r5, 4
 | 
			
		||||
@@ -194,8 +192,6 @@ END(__strcat_chk)
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__strcat_chk_failed)
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .save   {r4, r5}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,6 @@
 | 
			
		||||
ENTRY(__strcpy_chk)
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    push    {r0, lr}
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
@@ -161,7 +160,6 @@ END(__strcpy_chk)
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__strcpy_chk_failed)
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,6 @@ END(__memcpy_chk)
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
        pld     [r1, #64]
 | 
			
		||||
        stmfd   sp!, {r0, lr}
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
@@ -66,7 +65,6 @@ END(memcpy)
 | 
			
		||||
ENTRY_PRIVATE(__memcpy_chk_fail)
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        push    {lr}
 | 
			
		||||
        .save   {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,6 @@
 | 
			
		||||
// Assumes neon instructions and a cache line size of 32 bytes.
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(MEMCPY_BASE)
 | 
			
		||||
        .save {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,6 @@ ENTRY(__memset_chk)
 | 
			
		||||
        bls         .L_done
 | 
			
		||||
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        .save       {lr}
 | 
			
		||||
        push        {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
@@ -69,7 +68,6 @@ END(bzero)
 | 
			
		||||
 | 
			
		||||
/* memset() returns its first argument.  */
 | 
			
		||||
ENTRY(memset)
 | 
			
		||||
        .save       {r0}
 | 
			
		||||
        stmfd       sp!, {r0}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
 
 | 
			
		||||
@@ -168,7 +168,6 @@ ENTRY(strcmp)
 | 
			
		||||
        bne     .L_do_align
 | 
			
		||||
 | 
			
		||||
        /* Fast path.  */
 | 
			
		||||
        .save   {r4-r7}
 | 
			
		||||
        init
 | 
			
		||||
 | 
			
		||||
.L_doubleword_aligned:
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@ libc_bionic_src_files_arm += \
 | 
			
		||||
 | 
			
		||||
# Use cortex-a15 versions of strcat/strcpy/strlen and standard memmove
 | 
			
		||||
libc_bionic_src_files_arm += \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/stpcpy.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcat.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcpy.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strlen.S \
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(clock_nanosleep)
 | 
			
		||||
ENTRY(__clock_nanosleep)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_clock_nanosleep
 | 
			
		||||
    swi     #0
 | 
			
		||||
@@ -11,4 +11,4 @@ ENTRY(clock_nanosleep)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno_internal
 | 
			
		||||
END(clock_nanosleep)
 | 
			
		||||
END(__clock_nanosleep)
 | 
			
		||||
@@ -1,8 +1,17 @@
 | 
			
		||||
# arm64 specific configs
 | 
			
		||||
# 64-bit arm.
 | 
			
		||||
 | 
			
		||||
libc_common_src_files_arm64 := \
 | 
			
		||||
#
 | 
			
		||||
# Default implementations of functions that are commonly optimized.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
libc_bionic_src_files_arm64 += \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
    bionic/memrchr.c \
 | 
			
		||||
    bionic/strrchr.cpp \
 | 
			
		||||
 | 
			
		||||
libc_freebsd_src_files_arm64 += \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscat.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcschr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscmp.c \
 | 
			
		||||
@@ -10,6 +19,8 @@ libc_common_src_files_arm64 := \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcslen.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsrchr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemcmp.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_arm64 += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpncpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strcat.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strlcat.c \
 | 
			
		||||
@@ -17,19 +28,13 @@ libc_common_src_files_arm64 := \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strncat.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strncpy.c \
 | 
			
		||||
 | 
			
		||||
# Fortify implementations of libc functions.
 | 
			
		||||
libc_common_src_files_arm64 += \
 | 
			
		||||
    bionic/__memcpy_chk.cpp \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
#
 | 
			
		||||
# Inherently architecture-specific code.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
##########################################
 | 
			
		||||
### CPU specific source files
 | 
			
		||||
libc_bionic_src_files_arm64 := \
 | 
			
		||||
libc_bionic_src_files_arm64 += \
 | 
			
		||||
    arch-arm64/bionic/__bionic_clone.S \
 | 
			
		||||
    arch-arm64/bionic/_exit_with_stack_teardown.S \
 | 
			
		||||
    arch-arm64/bionic/__rt_sigreturn.S \
 | 
			
		||||
    arch-arm64/bionic/_setjmp.S \
 | 
			
		||||
    arch-arm64/bionic/setjmp.S \
 | 
			
		||||
    arch-arm64/bionic/__set_tls.c \
 | 
			
		||||
@@ -53,7 +58,7 @@ ifeq ($(strip $(TARGET_CPU_VARIANT)),)
 | 
			
		||||
endif
 | 
			
		||||
cpu_variant_mk := $(LOCAL_PATH)/arch-arm64/$(TARGET_CPU_VARIANT)/$(TARGET_CPU_VARIANT).mk
 | 
			
		||||
ifeq ($(wildcard $(cpu_variant_mk)),)
 | 
			
		||||
$(error "TARGET_CPU_VARIANT not set or set to an unknown value. Possible values are generic, generic-neon, denver64. Use generic for devices that do not have a CPU similar to any of the supported cpu variants.")
 | 
			
		||||
$(error "TARGET_CPU_VARIANT not set or set to an unknown value. Possible values are generic, denver64. Use generic for devices that do not have a CPU similar to any of the supported cpu variants.")
 | 
			
		||||
endif
 | 
			
		||||
include $(cpu_variant_mk)
 | 
			
		||||
libc_common_additional_dependencies += $(cpu_variank_mk)
 | 
			
		||||
 
 | 
			
		||||
@@ -105,7 +105,7 @@ ENTRY(_longjmp)
 | 
			
		||||
 | 
			
		||||
    /* validation failed, die die die */
 | 
			
		||||
.L_fail:
 | 
			
		||||
    bl      PIC_SYM(longjmperror, PLT)
 | 
			
		||||
    bl      PIC_SYM(abort, PLT)
 | 
			
		||||
    bl      longjmperror
 | 
			
		||||
    bl      abort
 | 
			
		||||
    b        . - 8       /* Cannot get here */
 | 
			
		||||
END(_longjmp)
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ ENTRY(setjmp)
 | 
			
		||||
    stp     x0, x30, [sp, #-16]!
 | 
			
		||||
 | 
			
		||||
    mov     x0, xzr
 | 
			
		||||
    bl      PIC_SYM(sigblock, PLT)
 | 
			
		||||
    bl      sigblock
 | 
			
		||||
    mov     w1, w0
 | 
			
		||||
 | 
			
		||||
    ldp     x0, x30, [sp], #16
 | 
			
		||||
@@ -117,7 +117,7 @@ ENTRY(longjmp)
 | 
			
		||||
 | 
			
		||||
    /* validation failed, die die die */
 | 
			
		||||
.L_fail:
 | 
			
		||||
    bl      PIC_SYM(longjmperror, PLT)
 | 
			
		||||
    bl      PIC_SYM(abort, PLT)
 | 
			
		||||
    bl      longjmperror
 | 
			
		||||
    bl      abort
 | 
			
		||||
    b       . - 8       /* Cannot get here */
 | 
			
		||||
END(longjmp)
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
ENTRY(sigsetjmp)
 | 
			
		||||
    cbz     w1, PIC_SYM(_setjmp, PLT)
 | 
			
		||||
    b       PIC_SYM(setjmp, PLT)
 | 
			
		||||
    cbz     w1, _setjmp
 | 
			
		||||
    b       setjmp
 | 
			
		||||
END(sigsetjmp)
 | 
			
		||||
 | 
			
		||||
.L_setjmp_magic:
 | 
			
		||||
@@ -46,6 +46,6 @@ ENTRY(siglongjmp)
 | 
			
		||||
    ldr     w2, .L_setjmp_magic
 | 
			
		||||
    ldr     w3, [x0]
 | 
			
		||||
    cmp     w2, w3
 | 
			
		||||
    b.eq    PIC_SYM(_longjmp, PLT)
 | 
			
		||||
    b       PIC_SYM(longjmp, PLT)
 | 
			
		||||
    b.eq    _longjmp
 | 
			
		||||
    b       longjmp
 | 
			
		||||
END(siglongjmp)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,205 +1,63 @@
 | 
			
		||||
/* Copyright (c) 2012, Linaro Limited
 | 
			
		||||
   All rights reserved.
 | 
			
		||||
   Copyright (c) 2014, NVIDIA Corporation.  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 the Linaro nor the
 | 
			
		||||
         names of its contributors may be used to endorse or promote products
 | 
			
		||||
         derived from this software without specific prior written permission.
 | 
			
		||||
 | 
			
		||||
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 | 
			
		||||
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 | 
			
		||||
   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
			
		||||
   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 | 
			
		||||
   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 | 
			
		||||
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 | 
			
		||||
   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 | 
			
		||||
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | 
			
		||||
   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/* Assumptions:
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * denver, ARMv8-a, AArch64
 | 
			
		||||
 * Unaligned accesses
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// Prototype: void *memcpy (void *dst, const void *src, size_t count).
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
#include <private/libc_events.h>
 | 
			
		||||
 | 
			
		||||
#define dstin	x0
 | 
			
		||||
#define src	x1
 | 
			
		||||
#define count	x2
 | 
			
		||||
#define tmp1	x3
 | 
			
		||||
#define tmp1w	w3
 | 
			
		||||
#define tmp2	x4
 | 
			
		||||
#define tmp2w	w4
 | 
			
		||||
#define tmp3	x5
 | 
			
		||||
#define tmp3w	w5
 | 
			
		||||
#define dst	x6
 | 
			
		||||
ENTRY(__memcpy_chk)
 | 
			
		||||
  cmp   x2, x3
 | 
			
		||||
  b.hi  __memcpy_chk_fail
 | 
			
		||||
 | 
			
		||||
#define A_l	x7
 | 
			
		||||
#define A_h	x8
 | 
			
		||||
#define B_l	x9
 | 
			
		||||
#define B_h	x10
 | 
			
		||||
#define C_l	x11
 | 
			
		||||
#define C_h	x12
 | 
			
		||||
#define D_l	x13
 | 
			
		||||
#define D_h	x14
 | 
			
		||||
 | 
			
		||||
#define QA_l	q0
 | 
			
		||||
#define QA_h	q1
 | 
			
		||||
#define QB_l	q2
 | 
			
		||||
#define QB_h	q3
 | 
			
		||||
  // Fall through to memcpy...
 | 
			
		||||
END(__memcpy_chk)
 | 
			
		||||
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
 | 
			
		||||
	mov	dst, dstin
 | 
			
		||||
	cmp	count, #64
 | 
			
		||||
	b.ge	.Lcpy_not_short
 | 
			
		||||
	cmp	count, #15
 | 
			
		||||
	b.le	.Ltail15tiny
 | 
			
		||||
 | 
			
		||||
	/* Deal with small copies quickly by dropping straight into the
 | 
			
		||||
	 * exit block.  */
 | 
			
		||||
.Ltail63:
 | 
			
		||||
	/* Copy up to 48 bytes of data.  At this point we only need the
 | 
			
		||||
	 * bottom 6 bits of count to be accurate.  */
 | 
			
		||||
	ands	tmp1, count, #0x30
 | 
			
		||||
	b.eq	.Ltail15
 | 
			
		||||
	add	dst, dst, tmp1
 | 
			
		||||
	add	src, src, tmp1
 | 
			
		||||
	cmp	tmp1w, #0x20
 | 
			
		||||
	b.eq	1f
 | 
			
		||||
	b.lt	2f
 | 
			
		||||
	ldp	A_l, A_h, [src, #-48]
 | 
			
		||||
	stp	A_l, A_h, [dst, #-48]
 | 
			
		||||
1:
 | 
			
		||||
	ldp	A_l, A_h, [src, #-32]
 | 
			
		||||
	stp	A_l, A_h, [dst, #-32]
 | 
			
		||||
2:
 | 
			
		||||
	ldp	A_l, A_h, [src, #-16]
 | 
			
		||||
	stp	A_l, A_h, [dst, #-16]
 | 
			
		||||
 | 
			
		||||
.Ltail15:
 | 
			
		||||
	ands	count, count, #15
 | 
			
		||||
	beq	1f
 | 
			
		||||
	add	src, src, count
 | 
			
		||||
	ldp	A_l, A_h, [src, #-16]
 | 
			
		||||
	add	dst, dst, count
 | 
			
		||||
	stp	A_l, A_h, [dst, #-16]
 | 
			
		||||
1:
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
.Ltail15tiny:
 | 
			
		||||
	/* Copy up to 15 bytes of data.  Does not assume additional data
 | 
			
		||||
	   being copied.  */
 | 
			
		||||
	tbz	count, #3, 1f
 | 
			
		||||
	ldr	tmp1, [src], #8
 | 
			
		||||
	str	tmp1, [dst], #8
 | 
			
		||||
1:
 | 
			
		||||
	tbz	count, #2, 1f
 | 
			
		||||
	ldr	tmp1w, [src], #4
 | 
			
		||||
	str	tmp1w, [dst], #4
 | 
			
		||||
1:
 | 
			
		||||
	tbz	count, #1, 1f
 | 
			
		||||
	ldrh	tmp1w, [src], #2
 | 
			
		||||
	strh	tmp1w, [dst], #2
 | 
			
		||||
1:
 | 
			
		||||
	tbz	count, #0, 1f
 | 
			
		||||
	ldrb	tmp1w, [src]
 | 
			
		||||
	strb	tmp1w, [dst]
 | 
			
		||||
1:
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
.Lcpy_not_short:
 | 
			
		||||
	/* We don't much care about the alignment of DST, but we want SRC
 | 
			
		||||
	 * to be 128-bit (16 byte) aligned so that we don't cross cache line
 | 
			
		||||
	 * boundaries on both loads and stores.  */
 | 
			
		||||
	neg	tmp2, src
 | 
			
		||||
	ands	tmp2, tmp2, #15		/* Bytes to reach alignment.  */
 | 
			
		||||
	b.eq	2f
 | 
			
		||||
	sub	count, count, tmp2
 | 
			
		||||
	/* Copy more data than needed; it's faster than jumping
 | 
			
		||||
	 * around copying sub-Quadword quantities.  We know that
 | 
			
		||||
	 * it can't overrun.  */
 | 
			
		||||
	ldp	A_l, A_h, [src]
 | 
			
		||||
	add	src, src, tmp2
 | 
			
		||||
	stp	A_l, A_h, [dst]
 | 
			
		||||
	add	dst, dst, tmp2
 | 
			
		||||
	/* There may be less than 63 bytes to go now.  */
 | 
			
		||||
	cmp	count, #63
 | 
			
		||||
	b.le	.Ltail63
 | 
			
		||||
2:
 | 
			
		||||
	subs	count, count, #128
 | 
			
		||||
	b.ge	.Lcpy_body_large
 | 
			
		||||
	/* Less than 128 bytes to copy, so handle 64 here and then jump
 | 
			
		||||
	 * to the tail.  */
 | 
			
		||||
	ldp	QA_l, QA_h, [src]
 | 
			
		||||
	ldp	QB_l, QB_h, [src, #32]
 | 
			
		||||
	stp	QA_l, QA_h, [dst]
 | 
			
		||||
	stp	QB_l, QB_h, [dst, #32]
 | 
			
		||||
	tst	count, #0x3f
 | 
			
		||||
	add	src, src, #64
 | 
			
		||||
	add	dst, dst, #64
 | 
			
		||||
	b.ne	.Ltail63
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
	/* Critical loop.  Start at a new cache line boundary.  Assuming
 | 
			
		||||
	 * 64 bytes per line this ensures the entire loop is in one line.  */
 | 
			
		||||
	.p2align 6
 | 
			
		||||
.Lcpy_body_large:
 | 
			
		||||
	cmp	count, 65536
 | 
			
		||||
	bhi	.Lcpy_body_huge
 | 
			
		||||
	/* There are at least 128 bytes to copy.  */
 | 
			
		||||
	ldp	QA_l, QA_h, [src, #0]
 | 
			
		||||
	sub	dst, dst, #32		/* Pre-bias.  */
 | 
			
		||||
	ldp	QB_l, QB_h, [src, #32]!	/* src += 64 - Pre-bias.  */
 | 
			
		||||
1:
 | 
			
		||||
	stp	QA_l, QA_h, [dst, #32]
 | 
			
		||||
	ldp	QA_l, QA_h, [src, #32]
 | 
			
		||||
	stp	QB_l, QB_h, [dst, #64]!
 | 
			
		||||
	ldp	QB_l, QB_h, [src, #64]!
 | 
			
		||||
 | 
			
		||||
	subs	count, count, #64
 | 
			
		||||
	b.ge	1b
 | 
			
		||||
 | 
			
		||||
	stp	QA_l, QA_h, [dst, #32]
 | 
			
		||||
	stp	QB_l, QB_h, [dst, #64]
 | 
			
		||||
	add	src, src, #32
 | 
			
		||||
	add	dst, dst, #64 + 32
 | 
			
		||||
	tst	count, #0x3f
 | 
			
		||||
	b.ne	.Ltail63
 | 
			
		||||
	ret
 | 
			
		||||
.Lcpy_body_huge:
 | 
			
		||||
	/* There are at least 128 bytes to copy.  */
 | 
			
		||||
	ldp	QA_l, QA_h, [src, #0]
 | 
			
		||||
	sub	dst, dst, #32		/* Pre-bias.  */
 | 
			
		||||
	ldp	QB_l, QB_h, [src, #32]!
 | 
			
		||||
1:
 | 
			
		||||
	stnp	QA_l, QA_h, [dst, #32]
 | 
			
		||||
	stnp	QB_l, QB_h, [dst, #64]
 | 
			
		||||
	ldp	QA_l, QA_h, [src, #32]
 | 
			
		||||
	ldp	QB_l, QB_h, [src, #64]!
 | 
			
		||||
	add	dst, dst, #64
 | 
			
		||||
 | 
			
		||||
	subs	count, count, #64
 | 
			
		||||
	b.ge	1b
 | 
			
		||||
 | 
			
		||||
	stnp	QA_l, QA_h, [dst, #32]
 | 
			
		||||
	stnp	QB_l, QB_h, [dst, #64]
 | 
			
		||||
	add	src, src, #32
 | 
			
		||||
	add	dst, dst, #64 + 32
 | 
			
		||||
	tst	count, #0x3f
 | 
			
		||||
	b.ne	.Ltail63
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
  #include "memcpy_base.S"
 | 
			
		||||
END(memcpy)
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__memcpy_chk_fail)
 | 
			
		||||
  // Preserve for accurate backtrace.
 | 
			
		||||
  stp  x29, x30, [sp, -16]!
 | 
			
		||||
  .cfi_def_cfa_offset 16
 | 
			
		||||
  .cfi_rel_offset x29, 0
 | 
			
		||||
  .cfi_rel_offset x30, 8
 | 
			
		||||
 | 
			
		||||
  adrp  x0, error_string
 | 
			
		||||
  add   x0, x0, :lo12:error_string
 | 
			
		||||
  ldr   x1, error_code
 | 
			
		||||
  bl    __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
  .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 | 
			
		||||
END(__memcpy_chk_fail)
 | 
			
		||||
 | 
			
		||||
  .data
 | 
			
		||||
  .align 2
 | 
			
		||||
error_string:
 | 
			
		||||
  .string "memcpy: prevented write past end of buffer"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										199
									
								
								libc/arch-arm64/denver64/bionic/memcpy_base.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										199
									
								
								libc/arch-arm64/denver64/bionic/memcpy_base.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,199 @@
 | 
			
		||||
/* Copyright (c) 2012, Linaro Limited
 | 
			
		||||
   All rights reserved.
 | 
			
		||||
   Copyright (c) 2014, NVIDIA Corporation.  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 the Linaro nor the
 | 
			
		||||
         names of its contributors may be used to endorse or promote products
 | 
			
		||||
         derived from this software without specific prior written permission.
 | 
			
		||||
 | 
			
		||||
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 | 
			
		||||
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 | 
			
		||||
   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
			
		||||
   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 | 
			
		||||
   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 | 
			
		||||
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 | 
			
		||||
   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 | 
			
		||||
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | 
			
		||||
   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/* Assumptions:
 | 
			
		||||
 *
 | 
			
		||||
 * denver, ARMv8-a, AArch64
 | 
			
		||||
 * Unaligned accesses
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define dstin	x0
 | 
			
		||||
#define src	x1
 | 
			
		||||
#define count	x2
 | 
			
		||||
#define tmp1	x3
 | 
			
		||||
#define tmp1w	w3
 | 
			
		||||
#define tmp2	x4
 | 
			
		||||
#define tmp2w	w4
 | 
			
		||||
#define tmp3	x5
 | 
			
		||||
#define tmp3w	w5
 | 
			
		||||
#define dst	x6
 | 
			
		||||
 | 
			
		||||
#define A_l	x7
 | 
			
		||||
#define A_h	x8
 | 
			
		||||
#define B_l	x9
 | 
			
		||||
#define B_h	x10
 | 
			
		||||
#define C_l	x11
 | 
			
		||||
#define C_h	x12
 | 
			
		||||
#define D_l	x13
 | 
			
		||||
#define D_h	x14
 | 
			
		||||
 | 
			
		||||
#define QA_l	q0
 | 
			
		||||
#define QA_h	q1
 | 
			
		||||
#define QB_l	q2
 | 
			
		||||
#define QB_h	q3
 | 
			
		||||
 | 
			
		||||
	mov	dst, dstin
 | 
			
		||||
	cmp	count, #64
 | 
			
		||||
	b.ge	.Lcpy_not_short
 | 
			
		||||
	cmp	count, #15
 | 
			
		||||
	b.le	.Ltail15tiny
 | 
			
		||||
 | 
			
		||||
	/* Deal with small copies quickly by dropping straight into the
 | 
			
		||||
	 * exit block.  */
 | 
			
		||||
.Ltail63:
 | 
			
		||||
	/* Copy up to 48 bytes of data.  At this point we only need the
 | 
			
		||||
	 * bottom 6 bits of count to be accurate.  */
 | 
			
		||||
	ands	tmp1, count, #0x30
 | 
			
		||||
	b.eq	.Ltail15
 | 
			
		||||
	add	dst, dst, tmp1
 | 
			
		||||
	add	src, src, tmp1
 | 
			
		||||
	cmp	tmp1w, #0x20
 | 
			
		||||
	b.eq	1f
 | 
			
		||||
	b.lt	2f
 | 
			
		||||
	ldp	A_l, A_h, [src, #-48]
 | 
			
		||||
	stp	A_l, A_h, [dst, #-48]
 | 
			
		||||
1:
 | 
			
		||||
	ldp	A_l, A_h, [src, #-32]
 | 
			
		||||
	stp	A_l, A_h, [dst, #-32]
 | 
			
		||||
2:
 | 
			
		||||
	ldp	A_l, A_h, [src, #-16]
 | 
			
		||||
	stp	A_l, A_h, [dst, #-16]
 | 
			
		||||
 | 
			
		||||
.Ltail15:
 | 
			
		||||
	ands	count, count, #15
 | 
			
		||||
	beq	1f
 | 
			
		||||
	add	src, src, count
 | 
			
		||||
	ldp	A_l, A_h, [src, #-16]
 | 
			
		||||
	add	dst, dst, count
 | 
			
		||||
	stp	A_l, A_h, [dst, #-16]
 | 
			
		||||
1:
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
.Ltail15tiny:
 | 
			
		||||
	/* Copy up to 15 bytes of data.  Does not assume additional data
 | 
			
		||||
	   being copied.  */
 | 
			
		||||
	tbz	count, #3, 1f
 | 
			
		||||
	ldr	tmp1, [src], #8
 | 
			
		||||
	str	tmp1, [dst], #8
 | 
			
		||||
1:
 | 
			
		||||
	tbz	count, #2, 1f
 | 
			
		||||
	ldr	tmp1w, [src], #4
 | 
			
		||||
	str	tmp1w, [dst], #4
 | 
			
		||||
1:
 | 
			
		||||
	tbz	count, #1, 1f
 | 
			
		||||
	ldrh	tmp1w, [src], #2
 | 
			
		||||
	strh	tmp1w, [dst], #2
 | 
			
		||||
1:
 | 
			
		||||
	tbz	count, #0, 1f
 | 
			
		||||
	ldrb	tmp1w, [src]
 | 
			
		||||
	strb	tmp1w, [dst]
 | 
			
		||||
1:
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
.Lcpy_not_short:
 | 
			
		||||
	/* We don't much care about the alignment of DST, but we want SRC
 | 
			
		||||
	 * to be 128-bit (16 byte) aligned so that we don't cross cache line
 | 
			
		||||
	 * boundaries on both loads and stores.  */
 | 
			
		||||
	neg	tmp2, src
 | 
			
		||||
	ands	tmp2, tmp2, #15		/* Bytes to reach alignment.  */
 | 
			
		||||
	b.eq	2f
 | 
			
		||||
	sub	count, count, tmp2
 | 
			
		||||
	/* Copy more data than needed; it's faster than jumping
 | 
			
		||||
	 * around copying sub-Quadword quantities.  We know that
 | 
			
		||||
	 * it can't overrun.  */
 | 
			
		||||
	ldp	A_l, A_h, [src]
 | 
			
		||||
	add	src, src, tmp2
 | 
			
		||||
	stp	A_l, A_h, [dst]
 | 
			
		||||
	add	dst, dst, tmp2
 | 
			
		||||
	/* There may be less than 63 bytes to go now.  */
 | 
			
		||||
	cmp	count, #63
 | 
			
		||||
	b.le	.Ltail63
 | 
			
		||||
2:
 | 
			
		||||
	subs	count, count, #128
 | 
			
		||||
	b.ge	.Lcpy_body_large
 | 
			
		||||
	/* Less than 128 bytes to copy, so handle 64 here and then jump
 | 
			
		||||
	 * to the tail.  */
 | 
			
		||||
	ldp	QA_l, QA_h, [src]
 | 
			
		||||
	ldp	QB_l, QB_h, [src, #32]
 | 
			
		||||
	stp	QA_l, QA_h, [dst]
 | 
			
		||||
	stp	QB_l, QB_h, [dst, #32]
 | 
			
		||||
	tst	count, #0x3f
 | 
			
		||||
	add	src, src, #64
 | 
			
		||||
	add	dst, dst, #64
 | 
			
		||||
	b.ne	.Ltail63
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
	/* Critical loop.  Start at a new cache line boundary.  Assuming
 | 
			
		||||
	 * 64 bytes per line this ensures the entire loop is in one line.  */
 | 
			
		||||
	.p2align 6
 | 
			
		||||
.Lcpy_body_large:
 | 
			
		||||
	cmp	count, 65536
 | 
			
		||||
	bhi	.Lcpy_body_huge
 | 
			
		||||
	/* There are at least 128 bytes to copy.  */
 | 
			
		||||
	ldp	QA_l, QA_h, [src, #0]
 | 
			
		||||
	sub	dst, dst, #32		/* Pre-bias.  */
 | 
			
		||||
	ldp	QB_l, QB_h, [src, #32]!	/* src += 64 - Pre-bias.  */
 | 
			
		||||
1:
 | 
			
		||||
	stp	QA_l, QA_h, [dst, #32]
 | 
			
		||||
	ldp	QA_l, QA_h, [src, #32]
 | 
			
		||||
	stp	QB_l, QB_h, [dst, #64]!
 | 
			
		||||
	ldp	QB_l, QB_h, [src, #64]!
 | 
			
		||||
 | 
			
		||||
	subs	count, count, #64
 | 
			
		||||
	b.ge	1b
 | 
			
		||||
 | 
			
		||||
	stp	QA_l, QA_h, [dst, #32]
 | 
			
		||||
	stp	QB_l, QB_h, [dst, #64]
 | 
			
		||||
	add	src, src, #32
 | 
			
		||||
	add	dst, dst, #64 + 32
 | 
			
		||||
	tst	count, #0x3f
 | 
			
		||||
	b.ne	.Ltail63
 | 
			
		||||
	ret
 | 
			
		||||
.Lcpy_body_huge:
 | 
			
		||||
	/* There are at least 128 bytes to copy.  */
 | 
			
		||||
	ldp	QA_l, QA_h, [src, #0]
 | 
			
		||||
	sub	dst, dst, #32		/* Pre-bias.  */
 | 
			
		||||
	ldp	QB_l, QB_h, [src, #32]!
 | 
			
		||||
1:
 | 
			
		||||
	stnp	QA_l, QA_h, [dst, #32]
 | 
			
		||||
	stnp	QB_l, QB_h, [dst, #64]
 | 
			
		||||
	ldp	QA_l, QA_h, [src, #32]
 | 
			
		||||
	ldp	QB_l, QB_h, [src, #64]!
 | 
			
		||||
	add	dst, dst, #64
 | 
			
		||||
 | 
			
		||||
	subs	count, count, #64
 | 
			
		||||
	b.ge	1b
 | 
			
		||||
 | 
			
		||||
	stnp	QA_l, QA_h, [dst, #32]
 | 
			
		||||
	stnp	QB_l, QB_h, [dst, #64]
 | 
			
		||||
	add	src, src, #32
 | 
			
		||||
	add	dst, dst, #64 + 32
 | 
			
		||||
	tst	count, #0x3f
 | 
			
		||||
	b.ne	.Ltail63
 | 
			
		||||
	ret
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
libc_bionic_src_files_arm64 += \
 | 
			
		||||
    arch-arm64/generic/bionic/memchr.S \
 | 
			
		||||
    arch-arm64/generic/bionic/memcmp.S \
 | 
			
		||||
    arch-arm64/generic/bionic/memmove.S \
 | 
			
		||||
    arch-arm64/generic/bionic/memset.S \
 | 
			
		||||
    arch-arm64/generic/bionic/stpcpy.S \
 | 
			
		||||
    arch-arm64/generic/bionic/strchr.S \
 | 
			
		||||
    arch-arm64/generic/bionic/strcmp.S \
 | 
			
		||||
    arch-arm64/generic/bionic/strcpy.S \
 | 
			
		||||
    arch-arm64/generic/bionic/strlen.S \
 | 
			
		||||
    arch-arm64/generic/bionic/strncmp.S \
 | 
			
		||||
    arch-arm64/generic/bionic/strnlen.S \
 | 
			
		||||
    arch-arm64/generic-neon/bionic/memcpy.S \
 | 
			
		||||
@@ -1,184 +1,63 @@
 | 
			
		||||
/* Copyright (c) 2012, Linaro Limited
 | 
			
		||||
   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 the Linaro nor the
 | 
			
		||||
         names of its contributors may be used to endorse or promote products
 | 
			
		||||
         derived from this software without specific prior written permission.
 | 
			
		||||
 | 
			
		||||
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 | 
			
		||||
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 | 
			
		||||
   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
			
		||||
   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 | 
			
		||||
   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 | 
			
		||||
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 | 
			
		||||
   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 | 
			
		||||
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | 
			
		||||
   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/* Assumptions:
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * ARMv8-a, AArch64
 | 
			
		||||
 * Unaligned accesses
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// Prototype: void *memcpy (void *dst, const void *src, size_t count).
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
#include <private/libc_events.h>
 | 
			
		||||
 | 
			
		||||
#define dstin	x0
 | 
			
		||||
#define src	x1
 | 
			
		||||
#define count	x2
 | 
			
		||||
#define tmp1	x3
 | 
			
		||||
#define tmp1w	w3
 | 
			
		||||
#define tmp2	x4
 | 
			
		||||
#define tmp2w	w4
 | 
			
		||||
#define tmp3	x5
 | 
			
		||||
#define tmp3w	w5
 | 
			
		||||
#define dst	x6
 | 
			
		||||
ENTRY(__memcpy_chk)
 | 
			
		||||
  cmp   x2, x3
 | 
			
		||||
  b.hi  __memcpy_chk_fail
 | 
			
		||||
 | 
			
		||||
#define A_l	x7
 | 
			
		||||
#define A_h	x8
 | 
			
		||||
#define B_l	x9
 | 
			
		||||
#define B_h	x10
 | 
			
		||||
#define C_l	x11
 | 
			
		||||
#define C_h	x12
 | 
			
		||||
#define D_l	x13
 | 
			
		||||
#define D_h	x14
 | 
			
		||||
  // Fall through to memcpy...
 | 
			
		||||
END(__memcpy_chk)
 | 
			
		||||
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
 | 
			
		||||
	mov	dst, dstin
 | 
			
		||||
	cmp	count, #64
 | 
			
		||||
	b.ge	.Lcpy_not_short
 | 
			
		||||
	cmp	count, #15
 | 
			
		||||
	b.le	.Ltail15tiny
 | 
			
		||||
 | 
			
		||||
	/* Deal with small copies quickly by dropping straight into the
 | 
			
		||||
	 * exit block.  */
 | 
			
		||||
.Ltail63:
 | 
			
		||||
	/* Copy up to 48 bytes of data.  At this point we only need the
 | 
			
		||||
	 * bottom 6 bits of count to be accurate.  */
 | 
			
		||||
	ands	tmp1, count, #0x30
 | 
			
		||||
	b.eq	.Ltail15
 | 
			
		||||
	add	dst, dst, tmp1
 | 
			
		||||
	add	src, src, tmp1
 | 
			
		||||
	cmp	tmp1w, #0x20
 | 
			
		||||
	b.eq	1f
 | 
			
		||||
	b.lt	2f
 | 
			
		||||
	ldp	A_l, A_h, [src, #-48]
 | 
			
		||||
	stp	A_l, A_h, [dst, #-48]
 | 
			
		||||
1:
 | 
			
		||||
	ldp	A_l, A_h, [src, #-32]
 | 
			
		||||
	stp	A_l, A_h, [dst, #-32]
 | 
			
		||||
2:
 | 
			
		||||
	ldp	A_l, A_h, [src, #-16]
 | 
			
		||||
	stp	A_l, A_h, [dst, #-16]
 | 
			
		||||
 | 
			
		||||
.Ltail15:
 | 
			
		||||
	ands	count, count, #15
 | 
			
		||||
	beq	1f
 | 
			
		||||
	add	src, src, count
 | 
			
		||||
	ldp	A_l, A_h, [src, #-16]
 | 
			
		||||
	add	dst, dst, count
 | 
			
		||||
	stp	A_l, A_h, [dst, #-16]
 | 
			
		||||
1:
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
.Ltail15tiny:
 | 
			
		||||
	/* Copy up to 15 bytes of data.  Does not assume additional data
 | 
			
		||||
	   being copied.  */
 | 
			
		||||
	tbz	count, #3, 1f
 | 
			
		||||
	ldr	tmp1, [src], #8
 | 
			
		||||
	str	tmp1, [dst], #8
 | 
			
		||||
1:
 | 
			
		||||
	tbz	count, #2, 1f
 | 
			
		||||
	ldr	tmp1w, [src], #4
 | 
			
		||||
	str	tmp1w, [dst], #4
 | 
			
		||||
1:
 | 
			
		||||
	tbz	count, #1, 1f
 | 
			
		||||
	ldrh	tmp1w, [src], #2
 | 
			
		||||
	strh	tmp1w, [dst], #2
 | 
			
		||||
1:
 | 
			
		||||
	tbz	count, #0, 1f
 | 
			
		||||
	ldrb	tmp1w, [src]
 | 
			
		||||
	strb	tmp1w, [dst]
 | 
			
		||||
1:
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
.Lcpy_not_short:
 | 
			
		||||
	/* We don't much care about the alignment of DST, but we want SRC
 | 
			
		||||
	 * to be 128-bit (16 byte) aligned so that we don't cross cache line
 | 
			
		||||
	 * boundaries on both loads and stores.  */
 | 
			
		||||
	neg	tmp2, src
 | 
			
		||||
	ands	tmp2, tmp2, #15		/* Bytes to reach alignment.  */
 | 
			
		||||
	b.eq	2f
 | 
			
		||||
	sub	count, count, tmp2
 | 
			
		||||
	/* Copy more data than needed; it's faster than jumping
 | 
			
		||||
	 * around copying sub-Quadword quantities.  We know that
 | 
			
		||||
	 * it can't overrun.  */
 | 
			
		||||
	ldp	A_l, A_h, [src]
 | 
			
		||||
	add	src, src, tmp2
 | 
			
		||||
	stp	A_l, A_h, [dst]
 | 
			
		||||
	add	dst, dst, tmp2
 | 
			
		||||
	/* There may be less than 63 bytes to go now.  */
 | 
			
		||||
	cmp	count, #63
 | 
			
		||||
	b.le	.Ltail63
 | 
			
		||||
2:
 | 
			
		||||
	subs	count, count, #128
 | 
			
		||||
	b.ge	.Lcpy_body_large
 | 
			
		||||
	/* Less than 128 bytes to copy, so handle 64 here and then jump
 | 
			
		||||
	 * to the tail.  */
 | 
			
		||||
	ldp	A_l, A_h, [src]
 | 
			
		||||
	ldp	B_l, B_h, [src, #16]
 | 
			
		||||
	ldp	C_l, C_h, [src, #32]
 | 
			
		||||
	ldp	D_l, D_h, [src, #48]
 | 
			
		||||
	stp	A_l, A_h, [dst]
 | 
			
		||||
	stp	B_l, B_h, [dst, #16]
 | 
			
		||||
	stp	C_l, C_h, [dst, #32]
 | 
			
		||||
	stp	D_l, D_h, [dst, #48]
 | 
			
		||||
	tst	count, #0x3f
 | 
			
		||||
	add	src, src, #64
 | 
			
		||||
	add	dst, dst, #64
 | 
			
		||||
	b.ne	.Ltail63
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
	/* Critical loop.  Start at a new cache line boundary.  Assuming
 | 
			
		||||
	 * 64 bytes per line this ensures the entire loop is in one line.  */
 | 
			
		||||
	.p2align 6
 | 
			
		||||
.Lcpy_body_large:
 | 
			
		||||
	/* There are at least 128 bytes to copy.  */
 | 
			
		||||
	ldp	A_l, A_h, [src, #0]
 | 
			
		||||
	sub	dst, dst, #16		/* Pre-bias.  */
 | 
			
		||||
	ldp	B_l, B_h, [src, #16]
 | 
			
		||||
	ldp	C_l, C_h, [src, #32]
 | 
			
		||||
	ldp	D_l, D_h, [src, #48]!	/* src += 64 - Pre-bias.  */
 | 
			
		||||
1:
 | 
			
		||||
	stp	A_l, A_h, [dst, #16]
 | 
			
		||||
	ldp	A_l, A_h, [src, #16]
 | 
			
		||||
	stp	B_l, B_h, [dst, #32]
 | 
			
		||||
	ldp	B_l, B_h, [src, #32]
 | 
			
		||||
	stp	C_l, C_h, [dst, #48]
 | 
			
		||||
	ldp	C_l, C_h, [src, #48]
 | 
			
		||||
	stp	D_l, D_h, [dst, #64]!
 | 
			
		||||
	ldp	D_l, D_h, [src, #64]!
 | 
			
		||||
	subs	count, count, #64
 | 
			
		||||
	b.ge	1b
 | 
			
		||||
	stp	A_l, A_h, [dst, #16]
 | 
			
		||||
	stp	B_l, B_h, [dst, #32]
 | 
			
		||||
	stp	C_l, C_h, [dst, #48]
 | 
			
		||||
	stp	D_l, D_h, [dst, #64]
 | 
			
		||||
	add	src, src, #16
 | 
			
		||||
	add	dst, dst, #64 + 16
 | 
			
		||||
	tst	count, #0x3f
 | 
			
		||||
	b.ne	.Ltail63
 | 
			
		||||
	ret
 | 
			
		||||
  #include "memcpy_base.S"
 | 
			
		||||
END(memcpy)
 | 
			
		||||
 | 
			
		||||
ENTRY_PRIVATE(__memcpy_chk_fail)
 | 
			
		||||
  // Preserve for accurate backtrace.
 | 
			
		||||
  stp  x29, x30, [sp, -16]!
 | 
			
		||||
  .cfi_def_cfa_offset 16
 | 
			
		||||
  .cfi_rel_offset x29, 0
 | 
			
		||||
  .cfi_rel_offset x30, 8
 | 
			
		||||
 | 
			
		||||
  adrp  x0, error_string
 | 
			
		||||
  add   x0, x0, :lo12:error_string
 | 
			
		||||
  ldr   x1, error_code
 | 
			
		||||
  bl    __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
  .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 | 
			
		||||
END(__memcpy_chk_fail)
 | 
			
		||||
 | 
			
		||||
  .data
 | 
			
		||||
  .align 2
 | 
			
		||||
error_string:
 | 
			
		||||
  .string "memcpy: prevented write past end of buffer"
 | 
			
		||||
 
 | 
			
		||||
@@ -32,8 +32,6 @@
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
#define dstin	x0
 | 
			
		||||
#define src	x1
 | 
			
		||||
#define count	x2
 | 
			
		||||
@@ -54,13 +52,6 @@
 | 
			
		||||
#define D_l	x13
 | 
			
		||||
#define D_h	x14
 | 
			
		||||
 | 
			
		||||
#define QA_l q0
 | 
			
		||||
#define QA_h q1
 | 
			
		||||
#define QB_l q2
 | 
			
		||||
#define QB_h q3
 | 
			
		||||
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
 | 
			
		||||
	mov	dst, dstin
 | 
			
		||||
	cmp	count, #64
 | 
			
		||||
	b.ge	.Lcpy_not_short
 | 
			
		||||
@@ -142,10 +133,14 @@ ENTRY(memcpy)
 | 
			
		||||
	b.ge	.Lcpy_body_large
 | 
			
		||||
	/* Less than 128 bytes to copy, so handle 64 here and then jump
 | 
			
		||||
	 * to the tail.  */
 | 
			
		||||
	ldp QA_l, QA_h, [src]
 | 
			
		||||
	ldp QB_l, QB_h, [src, #32]
 | 
			
		||||
	stp QA_l, QA_h, [dst]
 | 
			
		||||
	stp QB_l, QB_h, [dst, #32]
 | 
			
		||||
	ldp	A_l, A_h, [src]
 | 
			
		||||
	ldp	B_l, B_h, [src, #16]
 | 
			
		||||
	ldp	C_l, C_h, [src, #32]
 | 
			
		||||
	ldp	D_l, D_h, [src, #48]
 | 
			
		||||
	stp	A_l, A_h, [dst]
 | 
			
		||||
	stp	B_l, B_h, [dst, #16]
 | 
			
		||||
	stp	C_l, C_h, [dst, #32]
 | 
			
		||||
	stp	D_l, D_h, [dst, #48]
 | 
			
		||||
	tst	count, #0x3f
 | 
			
		||||
	add	src, src, #64
 | 
			
		||||
	add	dst, dst, #64
 | 
			
		||||
@@ -157,23 +152,28 @@ ENTRY(memcpy)
 | 
			
		||||
	.p2align 6
 | 
			
		||||
.Lcpy_body_large:
 | 
			
		||||
	/* There are at least 128 bytes to copy.  */
 | 
			
		||||
	ldp QA_l, QA_h, [src, #0]
 | 
			
		||||
	sub	dst, dst, #32		/* Pre-bias.  */
 | 
			
		||||
	ldp QB_l, QB_h, [src, #32]!	/* src += 64 - Pre-bias.  */
 | 
			
		||||
	ldp	A_l, A_h, [src, #0]
 | 
			
		||||
	sub	dst, dst, #16		/* Pre-bias.  */
 | 
			
		||||
	ldp	B_l, B_h, [src, #16]
 | 
			
		||||
	ldp	C_l, C_h, [src, #32]
 | 
			
		||||
	ldp	D_l, D_h, [src, #48]!	/* src += 64 - Pre-bias.  */
 | 
			
		||||
1:
 | 
			
		||||
	stp QA_l, QA_h, [dst, #32]
 | 
			
		||||
	ldp QA_l, QA_h, [src, #32]
 | 
			
		||||
	stp QB_l, QB_h, [dst, #64]!
 | 
			
		||||
	ldp QB_l, QB_h, [src, #64]!
 | 
			
		||||
 | 
			
		||||
	stp	A_l, A_h, [dst, #16]
 | 
			
		||||
	ldp	A_l, A_h, [src, #16]
 | 
			
		||||
	stp	B_l, B_h, [dst, #32]
 | 
			
		||||
	ldp	B_l, B_h, [src, #32]
 | 
			
		||||
	stp	C_l, C_h, [dst, #48]
 | 
			
		||||
	ldp	C_l, C_h, [src, #48]
 | 
			
		||||
	stp	D_l, D_h, [dst, #64]!
 | 
			
		||||
	ldp	D_l, D_h, [src, #64]!
 | 
			
		||||
	subs	count, count, #64
 | 
			
		||||
	b.ge	1b
 | 
			
		||||
 | 
			
		||||
	stp QA_l, QA_h, [dst, #32]
 | 
			
		||||
	stp QB_l, QB_h, [dst, #64]
 | 
			
		||||
	add	src, src, #32
 | 
			
		||||
	add	dst, dst, #64 + 32
 | 
			
		||||
	stp	A_l, A_h, [dst, #16]
 | 
			
		||||
	stp	B_l, B_h, [dst, #32]
 | 
			
		||||
	stp	C_l, C_h, [dst, #48]
 | 
			
		||||
	stp	D_l, D_h, [dst, #64]
 | 
			
		||||
	add	src, src, #16
 | 
			
		||||
	add	dst, dst, #64 + 16
 | 
			
		||||
	tst	count, #0x3f
 | 
			
		||||
	b.ne	.Ltail63
 | 
			
		||||
	ret
 | 
			
		||||
END(memcpy)
 | 
			
		||||
@@ -38,17 +38,9 @@
 | 
			
		||||
#ifndef _AARCH64_ASM_H_
 | 
			
		||||
#define _AARCH64_ASM_H_
 | 
			
		||||
 | 
			
		||||
#ifndef _ALIGN_TEXT
 | 
			
		||||
# define _ALIGN_TEXT .align 0
 | 
			
		||||
#endif
 | 
			
		||||
#define __bionic_asm_align 0
 | 
			
		||||
 | 
			
		||||
#undef __bionic_asm_function_type
 | 
			
		||||
#define __bionic_asm_function_type %function
 | 
			
		||||
 | 
			
		||||
#if defined(__ELF__) && defined(PIC)
 | 
			
		||||
#define PIC_SYM(x,y) x ## ( ## y ## )
 | 
			
		||||
#else
 | 
			
		||||
#define PIC_SYM(x,y) x
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* _AARCH64_ASM_H_ */
 | 
			
		||||
 
 | 
			
		||||
@@ -99,6 +99,7 @@
 | 
			
		||||
#define R_AARCH64_RELATIVE              1027    /* Adjust by program base.  */
 | 
			
		||||
#define R_AARCH64_TLS_TPREL64           1030
 | 
			
		||||
#define R_AARCH64_TLS_DTPREL32          1031
 | 
			
		||||
#define R_AARCH64_IRELATIVE             1032
 | 
			
		||||
 | 
			
		||||
#define R_TYPE(name)        __CONCAT(R_AARCH64_,name)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(clock_nanosleep)
 | 
			
		||||
ENTRY(__clock_nanosleep)
 | 
			
		||||
    mov     x8, __NR_clock_nanosleep
 | 
			
		||||
    svc     #0
 | 
			
		||||
 | 
			
		||||
@@ -11,4 +11,5 @@ ENTRY(clock_nanosleep)
 | 
			
		||||
    b.hi    __set_errno_internal
 | 
			
		||||
 | 
			
		||||
    ret
 | 
			
		||||
END(clock_nanosleep)
 | 
			
		||||
END(__clock_nanosleep)
 | 
			
		||||
.hidden __clock_nanosleep
 | 
			
		||||
@@ -28,9 +28,7 @@
 | 
			
		||||
#ifndef _MIPS64_ASM_H
 | 
			
		||||
#define _MIPS64_ASM_H
 | 
			
		||||
 | 
			
		||||
#ifndef _ALIGN_TEXT
 | 
			
		||||
# define _ALIGN_TEXT .align 4
 | 
			
		||||
#endif
 | 
			
		||||
#define __bionic_asm_align 4
 | 
			
		||||
 | 
			
		||||
#undef __bionic_asm_custom_entry
 | 
			
		||||
#undef __bionic_asm_custom_end
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +1,32 @@
 | 
			
		||||
# mips specific configs
 | 
			
		||||
# 32-bit mips.
 | 
			
		||||
 | 
			
		||||
# These are shared by all the 32-bit targets, but not the 64-bit ones.
 | 
			
		||||
libc_common_src_files_mips := \
 | 
			
		||||
#
 | 
			
		||||
# Various kinds of LP32 cruft.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
libc_bionic_src_files_mips += \
 | 
			
		||||
    bionic/mmap.cpp \
 | 
			
		||||
 | 
			
		||||
libc_common_src_files_mips += \
 | 
			
		||||
    bionic/legacy_32_bit_support.cpp \
 | 
			
		||||
    bionic/ndk_cruft.cpp \
 | 
			
		||||
    bionic/time64.c \
 | 
			
		||||
 | 
			
		||||
libc_netbsd_src_files_mips += \
 | 
			
		||||
    upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_mips += \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/putw.c \
 | 
			
		||||
 | 
			
		||||
# These are shared by all the 32-bit targets, but not the 64-bit ones.
 | 
			
		||||
libc_bionic_src_files_mips += \
 | 
			
		||||
     bionic/mmap.cpp
 | 
			
		||||
#
 | 
			
		||||
# Default implementations of functions that are commonly optimized.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
libc_common_src_files_mips += \
 | 
			
		||||
libc_bionic_src_files_mips += \
 | 
			
		||||
    bionic/__memcpy_chk.cpp \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
    bionic/memchr.c \
 | 
			
		||||
    bionic/memcmp.c \
 | 
			
		||||
    bionic/memmove.c \
 | 
			
		||||
@@ -19,6 +34,8 @@ libc_common_src_files_mips += \
 | 
			
		||||
    bionic/strchr.cpp \
 | 
			
		||||
    bionic/strnlen.c \
 | 
			
		||||
    bionic/strrchr.cpp \
 | 
			
		||||
 | 
			
		||||
libc_freebsd_src_files_mips += \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscat.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcschr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscmp.c \
 | 
			
		||||
@@ -27,6 +44,8 @@ libc_common_src_files_mips += \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsrchr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemcmp.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemmove.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_mips += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/bcopy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpcpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpncpy.c \
 | 
			
		||||
@@ -39,16 +58,10 @@ libc_common_src_files_mips += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strncmp.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strncpy.c \
 | 
			
		||||
 | 
			
		||||
# Fortify implementations of libc functions.
 | 
			
		||||
libc_common_src_files_mips += \
 | 
			
		||||
    bionic/__memcpy_chk.cpp \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
#
 | 
			
		||||
# Inherently architecture-specific code.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##########################################
 | 
			
		||||
### CPU specific source files
 | 
			
		||||
libc_bionic_src_files_mips += \
 | 
			
		||||
    arch-mips/bionic/__bionic_clone.S \
 | 
			
		||||
    arch-mips/bionic/bzero.S \
 | 
			
		||||
@@ -69,13 +82,12 @@ libc_bionic_src_files_mips += \
 | 
			
		||||
else
 | 
			
		||||
libc_bionic_src_files_mips += \
 | 
			
		||||
    bionic/memcpy.cpp \
 | 
			
		||||
    bionic/memset.c
 | 
			
		||||
libc_common_src_files_mips += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strlen.c
 | 
			
		||||
endif
 | 
			
		||||
    bionic/memset.c \
 | 
			
		||||
 | 
			
		||||
libc_netbsd_src_files_mips := \
 | 
			
		||||
    upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
 | 
			
		||||
libc_openbsd_src_files_mips += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strlen.c \
 | 
			
		||||
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
libc_crt_target_cflags_mips := \
 | 
			
		||||
    $($(my_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,7 @@
 | 
			
		||||
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include "mips-string-ops.h"
 | 
			
		||||
 | 
			
		||||
#define do_strlen_word(__av) {\
 | 
			
		||||
@@ -47,8 +48,8 @@
 | 
			
		||||
#define strlen my_strlen
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
strlen (const void *_a)
 | 
			
		||||
size_t
 | 
			
		||||
strlen (const char *_a)
 | 
			
		||||
{
 | 
			
		||||
  int cnt = 0;
 | 
			
		||||
  unsigned x;
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(clock_nanosleep)
 | 
			
		||||
ENTRY(__clock_nanosleep)
 | 
			
		||||
    .set noreorder
 | 
			
		||||
    .cpload t9
 | 
			
		||||
    li v0, __NR_clock_nanosleep
 | 
			
		||||
@@ -16,4 +16,4 @@ ENTRY(clock_nanosleep)
 | 
			
		||||
    j t9
 | 
			
		||||
    nop
 | 
			
		||||
    .set reorder
 | 
			
		||||
END(clock_nanosleep)
 | 
			
		||||
END(__clock_nanosleep)
 | 
			
		||||
@@ -52,7 +52,7 @@ LEAF(syscall,FRAMESZ)
 | 
			
		||||
#else
 | 
			
		||||
	move	a3, a4
 | 
			
		||||
	move	a4, a5
 | 
			
		||||
	REG_L	a5, FRAMESZ(sp)
 | 
			
		||||
	move	a5, a6
 | 
			
		||||
#endif
 | 
			
		||||
	syscall
 | 
			
		||||
	move	a0, v0
 | 
			
		||||
 
 | 
			
		||||
@@ -28,9 +28,7 @@
 | 
			
		||||
#ifndef _MIPS64_ASM_H
 | 
			
		||||
#define _MIPS64_ASM_H
 | 
			
		||||
 | 
			
		||||
#ifndef _ALIGN_TEXT
 | 
			
		||||
# define _ALIGN_TEXT .align 4
 | 
			
		||||
#endif
 | 
			
		||||
#define __bionic_asm_align 4
 | 
			
		||||
 | 
			
		||||
#undef __bionic_asm_custom_entry
 | 
			
		||||
#undef __bionic_asm_custom_end
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,25 @@
 | 
			
		||||
# mips64 specific configs
 | 
			
		||||
# 64-bit mips.
 | 
			
		||||
 | 
			
		||||
libc_common_src_files_mips64 := \
 | 
			
		||||
#
 | 
			
		||||
# Default implementations of functions that are commonly optimized.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
libc_bionic_src_files_mips64 += \
 | 
			
		||||
    bionic/__memcpy_chk.cpp \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
    bionic/memchr.c \
 | 
			
		||||
    bionic/memcmp.c \
 | 
			
		||||
    bionic/memcpy.cpp \
 | 
			
		||||
    bionic/memmove.c \
 | 
			
		||||
    bionic/memrchr.c \
 | 
			
		||||
    bionic/memset.c \
 | 
			
		||||
    bionic/strchr.cpp \
 | 
			
		||||
    bionic/strnlen.c \
 | 
			
		||||
    bionic/strrchr.cpp \
 | 
			
		||||
 | 
			
		||||
libc_freebsd_src_files_mips64 += \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscat.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcschr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscmp.c \
 | 
			
		||||
@@ -16,6 +28,8 @@ libc_common_src_files_mips64 := \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsrchr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemcmp.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemmove.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_mips64 += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpcpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpncpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strcat.c \
 | 
			
		||||
@@ -28,45 +42,31 @@ libc_common_src_files_mips64 := \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strncmp.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strncpy.c \
 | 
			
		||||
 | 
			
		||||
# Fortify implementations of libc functions.
 | 
			
		||||
libc_common_src_files_mips64 += \
 | 
			
		||||
    bionic/__memcpy_chk.cpp \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
#
 | 
			
		||||
# Inherently architecture-specific code.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##########################################
 | 
			
		||||
### CPU specific source files
 | 
			
		||||
libc_bionic_src_files_mips64 := \
 | 
			
		||||
libc_bionic_src_files_mips64 += \
 | 
			
		||||
    arch-mips64/bionic/__bionic_clone.S \
 | 
			
		||||
    arch-mips64/bionic/_exit_with_stack_teardown.S \
 | 
			
		||||
    arch-mips64/bionic/__get_sp.S \
 | 
			
		||||
    arch-mips64/bionic/_setjmp.S \
 | 
			
		||||
    arch-mips64/bionic/setjmp.S \
 | 
			
		||||
    arch-mips64/bionic/sigsetjmp.S \
 | 
			
		||||
    arch-mips64/bionic/syscall.S \
 | 
			
		||||
    arch-mips64/bionic/vfork.S \
 | 
			
		||||
 | 
			
		||||
# FIXME TODO
 | 
			
		||||
## libc_bionic_src_files_mips64 += arch-mips64/string/memcpy.S
 | 
			
		||||
## libc_bionic_src_files_mips64 += arch-mips64/string/memset.S
 | 
			
		||||
libc_bionic_src_files_mips64 += bionic/memcpy.cpp
 | 
			
		||||
libc_bionic_src_files_mips64 += bionic/memset.c
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
libc_crt_target_cflags_mips64 := \
 | 
			
		||||
    $($(my_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
 | 
			
		||||
    -I$(LOCAL_PATH)/arch-mips64/include
 | 
			
		||||
    -I$(LOCAL_PATH)/arch-mips64/include \
 | 
			
		||||
 | 
			
		||||
libc_crt_target_crtbegin_file_mips64 := \
 | 
			
		||||
    $(LOCAL_PATH)/arch-mips64/bionic/crtbegin.c
 | 
			
		||||
    $(LOCAL_PATH)/arch-mips64/bionic/crtbegin.c \
 | 
			
		||||
 | 
			
		||||
libc_crt_target_crtbegin_so_file_mips64 := \
 | 
			
		||||
    $(LOCAL_PATH)/arch-common/bionic/crtbegin_so.c
 | 
			
		||||
    $(LOCAL_PATH)/arch-common/bionic/crtbegin_so.c \
 | 
			
		||||
 | 
			
		||||
libc_crt_target_so_cflags_mips64 := \
 | 
			
		||||
    -fPIC
 | 
			
		||||
    -fPIC \
 | 
			
		||||
 | 
			
		||||
libc_crt_target_ldflags_mips64 := \
 | 
			
		||||
    -melf64ltsmip
 | 
			
		||||
    -melf64ltsmip \
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(clock_nanosleep)
 | 
			
		||||
ENTRY(__clock_nanosleep)
 | 
			
		||||
    .set push
 | 
			
		||||
    .set noreorder
 | 
			
		||||
    li v0, __NR_clock_nanosleep
 | 
			
		||||
@@ -22,4 +22,5 @@ ENTRY(clock_nanosleep)
 | 
			
		||||
    j t9
 | 
			
		||||
    move ra, t0
 | 
			
		||||
    .set pop
 | 
			
		||||
END(clock_nanosleep)
 | 
			
		||||
END(__clock_nanosleep)
 | 
			
		||||
.hidden __clock_nanosleep
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
/* Generated by gensyscalls.py. Do not edit. */
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(_flush_cache)
 | 
			
		||||
    .set push
 | 
			
		||||
    .set noreorder
 | 
			
		||||
    li v0, __NR_cacheflush
 | 
			
		||||
    syscall
 | 
			
		||||
    bnez a3, 1f
 | 
			
		||||
    move a0, v0
 | 
			
		||||
    j ra
 | 
			
		||||
    nop
 | 
			
		||||
1:
 | 
			
		||||
    move t0, ra
 | 
			
		||||
    bal     2f
 | 
			
		||||
    nop
 | 
			
		||||
2:
 | 
			
		||||
    .cpsetup ra, t1, 2b
 | 
			
		||||
    LA t9,__set_errno_internal
 | 
			
		||||
    .cpreturn
 | 
			
		||||
    j t9
 | 
			
		||||
    move ra, t0
 | 
			
		||||
    .set pop
 | 
			
		||||
END(_flush_cache)
 | 
			
		||||
@@ -65,21 +65,21 @@ name:	\
 | 
			
		||||
ENTRY (wcslen)
 | 
			
		||||
	mov	STR(%esp), %edx
 | 
			
		||||
#endif
 | 
			
		||||
	cmp	$0, (%edx)
 | 
			
		||||
	cmpl	$0, (%edx)
 | 
			
		||||
	jz	L(exit_tail0)
 | 
			
		||||
	cmp	$0, 4(%edx)
 | 
			
		||||
	cmpl	$0, 4(%edx)
 | 
			
		||||
	jz	L(exit_tail1)
 | 
			
		||||
	cmp	$0, 8(%edx)
 | 
			
		||||
	cmpl	$0, 8(%edx)
 | 
			
		||||
	jz	L(exit_tail2)
 | 
			
		||||
	cmp	$0, 12(%edx)
 | 
			
		||||
	cmpl	$0, 12(%edx)
 | 
			
		||||
	jz	L(exit_tail3)
 | 
			
		||||
	cmp	$0, 16(%edx)
 | 
			
		||||
	cmpl	$0, 16(%edx)
 | 
			
		||||
	jz	L(exit_tail4)
 | 
			
		||||
	cmp	$0, 20(%edx)
 | 
			
		||||
	cmpl	$0, 20(%edx)
 | 
			
		||||
	jz	L(exit_tail5)
 | 
			
		||||
	cmp	$0, 24(%edx)
 | 
			
		||||
	cmpl	$0, 24(%edx)
 | 
			
		||||
	jz	L(exit_tail6)
 | 
			
		||||
	cmp	$0, 28(%edx)
 | 
			
		||||
	cmpl	$0, 28(%edx)
 | 
			
		||||
	jz	L(exit_tail7)
 | 
			
		||||
 | 
			
		||||
	pxor	%xmm0, %xmm0
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										37
									
								
								libc/arch-x86/bionic/__restore.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								libc/arch-x86/bionic/__restore.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2014 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 <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
// This function must have exactly this instruction sequence for gdb and libunwind.
 | 
			
		||||
// This function must have exactly this name for gdb.
 | 
			
		||||
ENTRY(__restore)
 | 
			
		||||
  popl %eax
 | 
			
		||||
  movl $__NR_sigreturn, %eax
 | 
			
		||||
  int $0x80
 | 
			
		||||
END(__restore)
 | 
			
		||||
							
								
								
									
										36
									
								
								libc/arch-x86/bionic/__restore_rt.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								libc/arch-x86/bionic/__restore_rt.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2014 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 <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
// This function must have exactly this instruction sequence for gdb and libunwind.
 | 
			
		||||
// This function must have exactly this name for gdb.
 | 
			
		||||
ENTRY(__restore_rt)
 | 
			
		||||
  movl $__NR_rt_sigreturn, %eax
 | 
			
		||||
  int $0x80
 | 
			
		||||
END(__restore_rt)
 | 
			
		||||
@@ -49,15 +49,6 @@
 | 
			
		||||
#define PIC_GOT(x)	x@GOT(%ebx)
 | 
			
		||||
#define PIC_GOTOFF(x)	x@GOTOFF(%ebx)
 | 
			
		||||
 | 
			
		||||
/* let kernels and others override entrypoint alignment */
 | 
			
		||||
#if !defined(_ALIGN_TEXT) && !defined(_KERNEL)
 | 
			
		||||
# ifdef _STANDALONE
 | 
			
		||||
#  define _ALIGN_TEXT .align 1
 | 
			
		||||
# elif defined __ELF__
 | 
			
		||||
#  define _ALIGN_TEXT .align 16
 | 
			
		||||
# else
 | 
			
		||||
#  define _ALIGN_TEXT .align 4
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
#define __bionic_asm_align 16
 | 
			
		||||
 | 
			
		||||
#endif /* !_I386_ASM_H_ */
 | 
			
		||||
 
 | 
			
		||||
@@ -59,5 +59,6 @@
 | 
			
		||||
#define	R_386_TLS_GOTDESC	39
 | 
			
		||||
#define	R_386_TLS_DESC_CALL	40
 | 
			
		||||
#define	R_386_TLS_DESC		41
 | 
			
		||||
#define	R_386_IRELATIVE		42
 | 
			
		||||
 | 
			
		||||
#define	R_TYPE(name)	__CONCAT(R_386_,name)
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(clock_nanosleep)
 | 
			
		||||
ENTRY(__clock_nanosleep)
 | 
			
		||||
    pushl   %ebx
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset ebx, 0
 | 
			
		||||
@@ -33,4 +33,4 @@ ENTRY(clock_nanosleep)
 | 
			
		||||
    popl    %ecx
 | 
			
		||||
    popl    %ebx
 | 
			
		||||
    ret
 | 
			
		||||
END(clock_nanosleep)
 | 
			
		||||
END(__clock_nanosleep)
 | 
			
		||||
@@ -1,31 +1,46 @@
 | 
			
		||||
# x86 specific configs
 | 
			
		||||
# 32-bit x86.
 | 
			
		||||
 | 
			
		||||
# These are shared by all the 32-bit targets, but not the 64-bit ones.
 | 
			
		||||
libc_common_src_files_x86 := \
 | 
			
		||||
#
 | 
			
		||||
# Various kinds of LP32 cruft.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
libc_bionic_src_files_x86 += \
 | 
			
		||||
    bionic/mmap.cpp \
 | 
			
		||||
 | 
			
		||||
libc_common_src_files_x86 += \
 | 
			
		||||
    bionic/legacy_32_bit_support.cpp \
 | 
			
		||||
    bionic/ndk_cruft.cpp \
 | 
			
		||||
    bionic/time64.c \
 | 
			
		||||
 | 
			
		||||
libc_netbsd_src_files_x86 += \
 | 
			
		||||
    upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_x86 += \
 | 
			
		||||
    upstream-openbsd/lib/libc/stdio/putw.c \
 | 
			
		||||
 | 
			
		||||
# Fortify implementations of libc functions.
 | 
			
		||||
#
 | 
			
		||||
# Default implementations of functions that are commonly optimized.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
libc_common_src_files_x86 += \
 | 
			
		||||
    bionic/__memcpy_chk.cpp \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
 | 
			
		||||
libc_freebsd_src_files_x86 += \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemmove.c \
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Inherently architecture-specific functions.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# These are shared by all the 32-bit targets, but not the 64-bit ones.
 | 
			
		||||
libc_bionic_src_files_x86 := \
 | 
			
		||||
    bionic/mmap.cpp
 | 
			
		||||
 | 
			
		||||
##########################################
 | 
			
		||||
### CPU specific source files
 | 
			
		||||
libc_bionic_src_files_x86 += \
 | 
			
		||||
    arch-x86/bionic/__bionic_clone.S \
 | 
			
		||||
    arch-x86/bionic/_exit_with_stack_teardown.S \
 | 
			
		||||
    arch-x86/bionic/libgcc_compat.c \
 | 
			
		||||
    arch-x86/bionic/__restore_rt.S \
 | 
			
		||||
    arch-x86/bionic/__restore.S \
 | 
			
		||||
    arch-x86/bionic/_setjmp.S \
 | 
			
		||||
    arch-x86/bionic/setjmp.S \
 | 
			
		||||
    arch-x86/bionic/__set_tls.c \
 | 
			
		||||
@@ -41,9 +56,6 @@ endif
 | 
			
		||||
include $(arch_variant_mk)
 | 
			
		||||
libc_common_additional_dependencies += $(arch_variant_mk)
 | 
			
		||||
 | 
			
		||||
libc_netbsd_src_files_x86 := \
 | 
			
		||||
    upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
 | 
			
		||||
 | 
			
		||||
arch_variant_mk :=
 | 
			
		||||
 | 
			
		||||
libc_crt_target_cflags_x86 := \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								libc/arch-x86_64/bionic/__restore_rt.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								libc/arch-x86_64/bionic/__restore_rt.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2013 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 <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
// This function must have exactly this instruction sequence for gdb and libunwind.
 | 
			
		||||
// This function must have exactly this name for gdb.
 | 
			
		||||
ENTRY(__restore_rt)
 | 
			
		||||
  mov $__NR_rt_sigreturn, %rax
 | 
			
		||||
  syscall
 | 
			
		||||
END(__restore_rt)
 | 
			
		||||
@@ -40,13 +40,6 @@
 | 
			
		||||
#define PIC_PLT(x)	x@PLT
 | 
			
		||||
#define PIC_GOT(x)	x@GOTPCREL(%rip)
 | 
			
		||||
 | 
			
		||||
/* let kernels and others override entrypoint alignment */
 | 
			
		||||
#ifndef _ALIGN_TEXT
 | 
			
		||||
# ifdef _STANDALONE
 | 
			
		||||
#  define _ALIGN_TEXT .align 4
 | 
			
		||||
# else
 | 
			
		||||
#  define _ALIGN_TEXT .align 16
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
#define __bionic_asm_align 16
 | 
			
		||||
 | 
			
		||||
#endif /* !_AMD64_ASM_H_ */
 | 
			
		||||
 
 | 
			
		||||
@@ -46,6 +46,8 @@
 | 
			
		||||
#define R_X86_64_GOTTPOFF	22
 | 
			
		||||
#define R_X86_64_TPOFF32	23
 | 
			
		||||
 | 
			
		||||
#define R_X86_64_IRELATIVE	37
 | 
			
		||||
 | 
			
		||||
#define	R_TYPE(name)	__CONCAT(R_X86_64_,name)
 | 
			
		||||
 | 
			
		||||
#else	/*	!__i386__	*/
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(clock_nanosleep)
 | 
			
		||||
ENTRY(__clock_nanosleep)
 | 
			
		||||
    movq    %rcx, %r10
 | 
			
		||||
    movl    $__NR_clock_nanosleep, %eax
 | 
			
		||||
    syscall
 | 
			
		||||
@@ -13,4 +13,5 @@ ENTRY(clock_nanosleep)
 | 
			
		||||
    call    __set_errno_internal
 | 
			
		||||
1:
 | 
			
		||||
    ret
 | 
			
		||||
END(clock_nanosleep)
 | 
			
		||||
END(__clock_nanosleep)
 | 
			
		||||
.hidden __clock_nanosleep
 | 
			
		||||
@@ -1,11 +1,21 @@
 | 
			
		||||
# x86_64 specific configs
 | 
			
		||||
# 64-bit x86.
 | 
			
		||||
 | 
			
		||||
libc_common_src_files_x86_64 := \
 | 
			
		||||
#
 | 
			
		||||
# Default implementations of functions that are commonly optimized.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
libc_bionic_src_files_x86_64 += \
 | 
			
		||||
    bionic/__memcpy_chk.cpp \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
    bionic/memchr.c \
 | 
			
		||||
    bionic/memrchr.c \
 | 
			
		||||
    bionic/strchr.cpp \
 | 
			
		||||
    bionic/strnlen.c \
 | 
			
		||||
    bionic/strrchr.cpp \
 | 
			
		||||
 | 
			
		||||
libc_freebsd_src_files_x86_64 += \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscat.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcschr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscmp.c \
 | 
			
		||||
@@ -14,23 +24,19 @@ libc_common_src_files_x86_64 := \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsrchr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemcmp.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemmove.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_x86_64 += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strlcat.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strlcpy.c \
 | 
			
		||||
 | 
			
		||||
# Fortify implementations of libc functions.
 | 
			
		||||
libc_common_src_files_x86_64 += \
 | 
			
		||||
    bionic/__memcpy_chk.cpp \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
#
 | 
			
		||||
# Inherently architecture-specific code.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##########################################
 | 
			
		||||
### CPU specific source files
 | 
			
		||||
libc_bionic_src_files_x86_64 := \
 | 
			
		||||
libc_bionic_src_files_x86_64 += \
 | 
			
		||||
    arch-x86_64/bionic/__bionic_clone.S \
 | 
			
		||||
    arch-x86_64/bionic/_exit_with_stack_teardown.S \
 | 
			
		||||
    arch-x86_64/bionic/__rt_sigreturn.S \
 | 
			
		||||
    arch-x86_64/bionic/__restore_rt.S \
 | 
			
		||||
    arch-x86_64/bionic/_setjmp.S \
 | 
			
		||||
    arch-x86_64/bionic/setjmp.S \
 | 
			
		||||
    arch-x86_64/bionic/__set_tls.c \
 | 
			
		||||
@@ -38,6 +44,10 @@ libc_bionic_src_files_x86_64 := \
 | 
			
		||||
    arch-x86_64/bionic/syscall.S \
 | 
			
		||||
    arch-x86_64/bionic/vfork.S \
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Optimized memory/string functions.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
libc_bionic_src_files_x86_64 += \
 | 
			
		||||
    arch-x86_64/string/sse2-memcpy-slm.S \
 | 
			
		||||
    arch-x86_64/string/sse2-memmove-slm.S \
 | 
			
		||||
@@ -55,15 +65,15 @@ libc_bionic_src_files_x86_64 += \
 | 
			
		||||
 | 
			
		||||
libc_crt_target_cflags_x86_64 += \
 | 
			
		||||
    -m64 \
 | 
			
		||||
    -I$(LOCAL_PATH)/arch-x86_64/include
 | 
			
		||||
    -I$(LOCAL_PATH)/arch-x86_64/include \
 | 
			
		||||
 | 
			
		||||
libc_crt_target_ldflags_x86_64 := -melf_x86_64
 | 
			
		||||
libc_crt_target_ldflags_x86_64 := -melf_x86_64 \
 | 
			
		||||
 | 
			
		||||
libc_crt_target_crtbegin_file_x86_64 := \
 | 
			
		||||
    $(LOCAL_PATH)/arch-common/bionic/crtbegin.c
 | 
			
		||||
    $(LOCAL_PATH)/arch-common/bionic/crtbegin.c \
 | 
			
		||||
 | 
			
		||||
libc_crt_target_crtbegin_so_file_x86_64 := \
 | 
			
		||||
    $(LOCAL_PATH)/arch-common/bionic/crtbegin_so.c
 | 
			
		||||
    $(LOCAL_PATH)/arch-common/bionic/crtbegin_so.c \
 | 
			
		||||
 | 
			
		||||
libc_crt_target_so_cflags_x86_64 := \
 | 
			
		||||
    -fPIC
 | 
			
		||||
    -fPIC \
 | 
			
		||||
 
 | 
			
		||||
@@ -43,8 +43,8 @@
 | 
			
		||||
 * This fgets check is called if _FORTIFY_SOURCE is defined and
 | 
			
		||||
 * greater than 0.
 | 
			
		||||
 */
 | 
			
		||||
extern "C" char* __fgets_chk(char* dest, int supplied_size,
 | 
			
		||||
                             FILE* stream, size_t dest_len_from_compiler) {
 | 
			
		||||
char* __fgets_chk(char* dest, int supplied_size, FILE* stream,
 | 
			
		||||
                  size_t dest_len_from_compiler) {
 | 
			
		||||
  if (supplied_size < 0) {
 | 
			
		||||
    __fortify_chk_fail("fgets: buffer size < 0", 0);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2011 The Android Open Source Project
 | 
			
		||||
 * Copyright (C) 2014 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
@@ -26,16 +26,10 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _BIONIC_PTHREAD_H
 | 
			
		||||
#define _BIONIC_PTHREAD_H
 | 
			
		||||
#define _GNU_SOURCE 1
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
 | 
			
		||||
__BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
/* Internal, not an NDK API */
 | 
			
		||||
extern pid_t __pthread_gettid(pthread_t thid);
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* _BIONIC_PTHREAD_H */
 | 
			
		||||
extern "C" const char* __gnu_basename(const char* path) {
 | 
			
		||||
  const char* last_slash = strrchr(path, '/');
 | 
			
		||||
  return (last_slash != NULL) ? last_slash + 1 : path;
 | 
			
		||||
}
 | 
			
		||||
@@ -32,9 +32,9 @@
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include "private/libc_logging.h"
 | 
			
		||||
 | 
			
		||||
extern "C"
 | 
			
		||||
ssize_t __recvfrom_chk(int socket, void* buf, size_t len, size_t buflen, unsigned int flags,
 | 
			
		||||
                       const struct sockaddr* src_addr, socklen_t* addrlen) {
 | 
			
		||||
ssize_t __recvfrom_chk(int socket, void* buf, size_t len, size_t buflen,
 | 
			
		||||
                       int flags, const struct sockaddr* src_addr,
 | 
			
		||||
                       socklen_t* addrlen) {
 | 
			
		||||
  if (__predict_false(len > buflen)) {
 | 
			
		||||
    __fortify_chk_fail("recvfrom: prevented write past end of buffer", 0);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										107
									
								
								libc/bionic/bionic_systrace.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								libc/bionic/bionic_systrace.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,107 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2014 The Android Open Source Project
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <cutils/trace.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
#include "private/bionic_systrace.h"
 | 
			
		||||
#include "private/libc_logging.h"
 | 
			
		||||
 | 
			
		||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
 | 
			
		||||
#include <sys/_system_properties.h>
 | 
			
		||||
 | 
			
		||||
#define WRITE_OFFSET   32
 | 
			
		||||
 | 
			
		||||
static const prop_info* g_pinfo = NULL;
 | 
			
		||||
static uint32_t g_serial = -1;
 | 
			
		||||
static uint64_t g_tags = 0;
 | 
			
		||||
static int g_trace_marker_fd = -1;
 | 
			
		||||
 | 
			
		||||
static bool should_trace() {
 | 
			
		||||
  // If g_pinfo is null, this means that systrace hasn't been run and it's safe to
 | 
			
		||||
  // assume that no trace writing will need to take place.  However, to avoid running
 | 
			
		||||
  // this costly find check each time, we set it to a non-tracing value so that next
 | 
			
		||||
  // time, it will just check the serial to see if the value has been changed.
 | 
			
		||||
  // this function also deals with the bootup case, during which the call to property
 | 
			
		||||
  // set will fail if the property server hasn't yet started.
 | 
			
		||||
  if (g_pinfo == NULL) {
 | 
			
		||||
    g_pinfo = __system_property_find("debug.atrace.tags.enableflags");
 | 
			
		||||
    if (g_pinfo == NULL) {
 | 
			
		||||
      __system_property_set("debug.atrace.tags.enableflags", "0");
 | 
			
		||||
      g_pinfo = __system_property_find("debug.atrace.tags.enableflags");
 | 
			
		||||
      if (g_pinfo == NULL) {
 | 
			
		||||
        return false;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Find out which tags have been enabled on the command line and set
 | 
			
		||||
  // the value of tags accordingly.  If the value of the property changes,
 | 
			
		||||
  // the serial will also change, so the costly system_property_read function
 | 
			
		||||
  // can be avoided by calling the much cheaper system_property_serial
 | 
			
		||||
  // first.  The values within pinfo may change, but its location is guaranteed
 | 
			
		||||
  // not to move.
 | 
			
		||||
  const uint32_t cur_serial = __system_property_serial(g_pinfo);
 | 
			
		||||
  if (cur_serial != g_serial) {
 | 
			
		||||
    g_serial = cur_serial;
 | 
			
		||||
    char value[PROP_VALUE_MAX];
 | 
			
		||||
    __system_property_read(g_pinfo, 0, value);
 | 
			
		||||
    g_tags = strtoull(value, NULL, 0);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Finally, verify that this tag value enables bionic tracing.
 | 
			
		||||
  return ((g_tags & ATRACE_TAG_BIONIC) != 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ScopedTrace::ScopedTrace(const char* message) {
 | 
			
		||||
  if (!should_trace()) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (g_trace_marker_fd == -1) {
 | 
			
		||||
    g_trace_marker_fd = open("/sys/kernel/debug/tracing/trace_marker", O_CLOEXEC | O_WRONLY);
 | 
			
		||||
    if (g_trace_marker_fd == -1) {
 | 
			
		||||
      __libc_fatal("Could not open kernel trace file: %s\n", strerror(errno));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // If bionic tracing has been enabled, then write the message to the
 | 
			
		||||
  // kernel trace_marker.
 | 
			
		||||
  int length = strlen(message);
 | 
			
		||||
  char buf[length + WRITE_OFFSET];
 | 
			
		||||
  size_t len = snprintf(buf, length + WRITE_OFFSET, "B|%d|%s", getpid(), message);
 | 
			
		||||
  ssize_t wbytes = TEMP_FAILURE_RETRY(write(g_trace_marker_fd, buf, len));
 | 
			
		||||
 | 
			
		||||
  // Error while writing
 | 
			
		||||
  if (static_cast<size_t>(wbytes) != len) {
 | 
			
		||||
    __libc_fatal("Could not write to kernel trace file: %s\n", strerror(errno));
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ScopedTrace::~ScopedTrace() {
 | 
			
		||||
  if (!should_trace()) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ssize_t wbytes = TEMP_FAILURE_RETRY(write(g_trace_marker_fd, "E", 1));
 | 
			
		||||
 | 
			
		||||
  // Error while writing
 | 
			
		||||
  if (static_cast<size_t>(wbytes) != 1) {
 | 
			
		||||
    __libc_fatal("Could not write to kernel trace file: %s\n", strerror(errno));
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -28,6 +28,8 @@
 | 
			
		||||
 | 
			
		||||
#include "private/bionic_time_conversions.h"
 | 
			
		||||
 | 
			
		||||
#include "private/bionic_constants.h"
 | 
			
		||||
 | 
			
		||||
bool timespec_from_timeval(timespec& ts, const timeval& tv) {
 | 
			
		||||
  // Whole seconds can just be copied.
 | 
			
		||||
  ts.tv_sec = tv.tv_sec;
 | 
			
		||||
@@ -49,3 +51,19 @@ void timeval_from_timespec(timeval& tv, const timespec& ts) {
 | 
			
		||||
  tv.tv_sec = ts.tv_sec;
 | 
			
		||||
  tv.tv_usec = ts.tv_nsec / 1000;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Initializes 'ts' with the difference between 'abs_ts' and the current time
 | 
			
		||||
// according to 'clock'. Returns false if abstime already expired, true otherwise.
 | 
			
		||||
bool timespec_from_absolute_timespec(timespec& ts, const timespec& abs_ts, clockid_t clock) {
 | 
			
		||||
  clock_gettime(clock, &ts);
 | 
			
		||||
  ts.tv_sec = abs_ts.tv_sec - ts.tv_sec;
 | 
			
		||||
  ts.tv_nsec = abs_ts.tv_nsec - ts.tv_nsec;
 | 
			
		||||
  if (ts.tv_nsec < 0) {
 | 
			
		||||
    ts.tv_sec--;
 | 
			
		||||
    ts.tv_nsec += NS_PER_S;
 | 
			
		||||
  }
 | 
			
		||||
  if (ts.tv_nsec < 0 || ts.tv_sec < 0) {
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@
 | 
			
		||||
#include <sys/sysconf.h>
 | 
			
		||||
#include <sys/times.h>
 | 
			
		||||
 | 
			
		||||
#define NS_PER_S 1000000000 // No "private/bionic_constants.h" in lmp-dev.
 | 
			
		||||
#include "private/bionic_constants.h"
 | 
			
		||||
 | 
			
		||||
// http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock.html
 | 
			
		||||
clock_t clock() {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								libc/bionic/clock_nanosleep.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								libc/bionic/clock_nanosleep.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2014 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 <time.h>
 | 
			
		||||
 | 
			
		||||
#include "private/ErrnoRestorer.h"
 | 
			
		||||
 | 
			
		||||
extern "C" int __clock_nanosleep(clockid_t, int, const timespec*, timespec*);
 | 
			
		||||
 | 
			
		||||
int clock_nanosleep(clockid_t clock_id, int flags, const timespec* in, timespec* out) {
 | 
			
		||||
  ErrnoRestorer errno_restorer;
 | 
			
		||||
  return (__clock_nanosleep(clock_id, flags, in, out) == 0) ? 0 : errno;
 | 
			
		||||
}
 | 
			
		||||
@@ -26,7 +26,7 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define __GNU_SOURCE 1
 | 
			
		||||
#define _GNU_SOURCE 1
 | 
			
		||||
#include <sched.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <stdarg.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -71,7 +71,7 @@ __LIBC_HIDDEN__ mapinfo_t* mapinfo_create(pid_t pid) {
 | 
			
		||||
  struct mapinfo_t* milist = NULL;
 | 
			
		||||
  char data[1024]; // Used to read lines as well as to construct the filename.
 | 
			
		||||
  snprintf(data, sizeof(data), "/proc/%d/maps", pid);
 | 
			
		||||
  FILE* fp = fopen(data, "r");
 | 
			
		||||
  FILE* fp = fopen(data, "re");
 | 
			
		||||
  if (fp != NULL) {
 | 
			
		||||
    while (fgets(data, sizeof(data), fp) != NULL) {
 | 
			
		||||
      mapinfo_t* mi = parse_maps_line(data);
 | 
			
		||||
 
 | 
			
		||||
@@ -78,7 +78,7 @@ DIR* fdopendir(int fd) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DIR* opendir(const char* path) {
 | 
			
		||||
  int fd = open(path, O_RDONLY | O_DIRECTORY);
 | 
			
		||||
  int fd = open(path, O_CLOEXEC | O_DIRECTORY | O_RDONLY);
 | 
			
		||||
  return (fd != -1) ? __allocate_DIR(fd) : NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -62,6 +62,11 @@ int dl_iterate_phdr(int (*cb)(struct dl_phdr_info* info, size_t size, void* data
 | 
			
		||||
 | 
			
		||||
  // Try the VDSO if that didn't work.
 | 
			
		||||
  ElfW(Ehdr)* ehdr_vdso = reinterpret_cast<ElfW(Ehdr)*>(getauxval(AT_SYSINFO_EHDR));
 | 
			
		||||
  if (ehdr_vdso == nullptr) {
 | 
			
		||||
    // There is no VDSO, so there's nowhere left to look.
 | 
			
		||||
    return rc;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  struct dl_phdr_info vdso_info;
 | 
			
		||||
  vdso_info.dlpi_addr = 0;
 | 
			
		||||
  vdso_info.dlpi_name = NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,7 @@
 | 
			
		||||
 | 
			
		||||
#include "dlmalloc.h"
 | 
			
		||||
 | 
			
		||||
#include "malloc.h"
 | 
			
		||||
#include "private/bionic_prctl.h"
 | 
			
		||||
#include "private/libc_logging.h"
 | 
			
		||||
 | 
			
		||||
@@ -54,3 +55,25 @@ static void* named_anonymous_mmap(size_t length) {
 | 
			
		||||
  prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, map, length, "libc_malloc");
 | 
			
		||||
  return map;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Since dlmalloc isn't the default, we'll leave this unimplemented for now. If
 | 
			
		||||
// we decide we need it later, we can fill it in.
 | 
			
		||||
size_t __mallinfo_narenas() {
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
size_t __mallinfo_nbins() {
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct mallinfo __mallinfo_arena_info(size_t aidx __unused) {
 | 
			
		||||
  struct mallinfo mi;
 | 
			
		||||
  memset(&mi, 0, sizeof(mi));
 | 
			
		||||
  return mi;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct mallinfo __mallinfo_bin_info(size_t aidx __unused, size_t bidx __unused) {
 | 
			
		||||
  struct mallinfo mi;
 | 
			
		||||
  memset(&mi, 0, sizeof(mi));
 | 
			
		||||
  return mi;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,68 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 1999 Kungliga Tekniska H<>gskolan
 | 
			
		||||
 * (Royal Institute of Technology, Stockholm, Sweden). 
 | 
			
		||||
 * 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 KTH 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 KTH AND ITS 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 KTH OR ITS 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. */
 | 
			
		||||
 | 
			
		||||
/* $Heimdal: hash.h,v 1.1 1999/03/22 19:16:25 joda Exp $
 | 
			
		||||
   $NetBSD: hash.h,v 1.1.1.3 2002/09/12 12:41:42 joda Exp $ */
 | 
			
		||||
 | 
			
		||||
/* stuff in common between md4, md5, and sha1 */
 | 
			
		||||
 | 
			
		||||
#ifndef __hash_h__
 | 
			
		||||
#define __hash_h__
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#ifndef min
 | 
			
		||||
#define min(a,b) (((a)>(b))?(b):(a))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Vector Crays doesn't have a good 32-bit type, or more precisely,
 | 
			
		||||
   int32_t as defined by <bind/bitypes.h> isn't 32 bits, and we don't
 | 
			
		||||
   want to depend in being able to redefine this type.  To cope with
 | 
			
		||||
   this we have to clamp the result in some places to [0,2^32); no
 | 
			
		||||
   need to do this on other machines.  Did I say this was a mess?
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
#ifdef _CRAY
 | 
			
		||||
#define CRAYFIX(X) ((X) & 0xffffffff)
 | 
			
		||||
#else
 | 
			
		||||
#define CRAYFIX(X) (X)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static inline u_int32_t
 | 
			
		||||
cshift (u_int32_t x, unsigned int n)
 | 
			
		||||
{
 | 
			
		||||
    x = CRAYFIX(x);
 | 
			
		||||
    return CRAYFIX((x << n) | (x >> (32 - n)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif /* __hash_h__ */
 | 
			
		||||
@@ -17,11 +17,20 @@
 | 
			
		||||
#include <ftw.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
int mkstemp64(char* filename) {
 | 
			
		||||
  // Delegation will work in this case because all the transitive dependencies
 | 
			
		||||
  // are already 64-bit ready. In particular, we don't have non-O_LARGEFILE
 | 
			
		||||
  // open (our open is actually open64) and stat and stat64 are the same.
 | 
			
		||||
  return mkstemp(filename);
 | 
			
		||||
// Delegation will work in these cases because all the transitive dependencies
 | 
			
		||||
// are already 64-bit ready. In particular, we don't have non-O_LARGEFILE
 | 
			
		||||
// open (our open is actually open64) and stat and stat64 are the same.
 | 
			
		||||
int mkstemp64(char* path) {
 | 
			
		||||
  return mkstemp(path);
 | 
			
		||||
}
 | 
			
		||||
int mkostemp64(char* path, int flags) {
 | 
			
		||||
  return mkostemp(path, flags);
 | 
			
		||||
}
 | 
			
		||||
int mkstemps64(char* path, int suffix_length) {
 | 
			
		||||
  return mkstemps(path, suffix_length);
 | 
			
		||||
}
 | 
			
		||||
int mkostemps64(char* path, int suffix_length, int flags) {
 | 
			
		||||
  return mkostemps(path, suffix_length, flags);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
typedef int (*ftw_fn)(const char*, const struct stat*, int);
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@ extern "C" int __system_properties_init(void);
 | 
			
		||||
extern "C" int __set_tls(void* ptr);
 | 
			
		||||
extern "C" int __set_tid_address(int* tid_address);
 | 
			
		||||
 | 
			
		||||
void __libc_init_vdso();
 | 
			
		||||
__LIBC_HIDDEN__ void __libc_init_vdso();
 | 
			
		||||
 | 
			
		||||
// Not public, but well-known in the BSDs.
 | 
			
		||||
const char* __progname;
 | 
			
		||||
 
 | 
			
		||||
@@ -75,10 +75,12 @@ struct BufferOutputStream {
 | 
			
		||||
      len = strlen(data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    total += len;
 | 
			
		||||
 | 
			
		||||
    while (len > 0) {
 | 
			
		||||
      int avail = end_ - pos_;
 | 
			
		||||
      if (avail == 0) {
 | 
			
		||||
        break;
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
      if (avail > len) {
 | 
			
		||||
        avail = len;
 | 
			
		||||
@@ -87,11 +89,10 @@ struct BufferOutputStream {
 | 
			
		||||
      pos_ += avail;
 | 
			
		||||
      pos_[0] = '\0';
 | 
			
		||||
      len -= avail;
 | 
			
		||||
      total += avail;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  int total;
 | 
			
		||||
  size_t total;
 | 
			
		||||
 | 
			
		||||
 private:
 | 
			
		||||
  char* buffer_;
 | 
			
		||||
@@ -109,18 +110,19 @@ struct FdOutputStream {
 | 
			
		||||
      len = strlen(data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    total += len;
 | 
			
		||||
 | 
			
		||||
    while (len > 0) {
 | 
			
		||||
      int rc = TEMP_FAILURE_RETRY(write(fd_, data, len));
 | 
			
		||||
      if (rc == -1) {
 | 
			
		||||
        break;
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
      data += rc;
 | 
			
		||||
      len -= rc;
 | 
			
		||||
      total += rc;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  int total;
 | 
			
		||||
  size_t total;
 | 
			
		||||
 | 
			
		||||
 private:
 | 
			
		||||
  int fd_;
 | 
			
		||||
 
 | 
			
		||||
@@ -29,14 +29,13 @@
 | 
			
		||||
// Contains definition of structures, global variables, and implementation of
 | 
			
		||||
// routines that are used by malloc leak detection code and other components in
 | 
			
		||||
// the system. The trick is that some components expect these data and
 | 
			
		||||
// routines to be defined / implemented in libc.so library, regardless
 | 
			
		||||
// whether or not MALLOC_LEAK_CHECK macro is defined. To make things even
 | 
			
		||||
// more tricky, malloc leak detection code, implemented in
 | 
			
		||||
// libc_malloc_debug.so also requires access to these variables and routines
 | 
			
		||||
// (to fill allocation entry hash table, for example). So, all relevant
 | 
			
		||||
// variables and routines are defined / implemented here and exported
 | 
			
		||||
// to all, leak detection code and other components via dynamic (libc.so),
 | 
			
		||||
// or static (libc.a) linking.
 | 
			
		||||
// routines to be defined / implemented in libc.so, regardless whether or not
 | 
			
		||||
// malloc leak detection code is going to run. To make things even more tricky,
 | 
			
		||||
// malloc leak detection code, implemented in libc_malloc_debug.so also
 | 
			
		||||
// requires access to these variables and routines (to fill allocation entry
 | 
			
		||||
// hash table, for example). So, all relevant variables and routines are
 | 
			
		||||
// defined / implemented here and exported to all, leak detection code and
 | 
			
		||||
// other components via dynamic (libc.so), or static (libc.a) linking.
 | 
			
		||||
 | 
			
		||||
#include "malloc_debug_common.h"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -55,13 +55,6 @@
 | 
			
		||||
#include "private/libc_logging.h"
 | 
			
		||||
#include "private/ScopedPthreadMutexLocker.h"
 | 
			
		||||
 | 
			
		||||
// This file should be included into the build only when
 | 
			
		||||
// MALLOC_LEAK_CHECK, or MALLOC_QEMU_INSTRUMENT, or both
 | 
			
		||||
// macros are defined.
 | 
			
		||||
#ifndef MALLOC_LEAK_CHECK
 | 
			
		||||
#error MALLOC_LEAK_CHECK is not defined.
 | 
			
		||||
#endif  // !MALLOC_LEAK_CHECK
 | 
			
		||||
 | 
			
		||||
extern int gMallocLeakZygoteChild;
 | 
			
		||||
extern HashTable* g_hash_table;
 | 
			
		||||
extern const MallocDebug* g_malloc_dispatch;
 | 
			
		||||
 
 | 
			
		||||
@@ -606,7 +606,7 @@ extern "C" bool malloc_debug_initialize(HashTable*, const MallocDebug* malloc_di
 | 
			
		||||
     * the memory mapped spaces into writes to an I/O port that emulator
 | 
			
		||||
     * "listens to" on the other end. Note that until we open and map that
 | 
			
		||||
     * device, logging to emulator's stdout will not be available. */
 | 
			
		||||
    int fd = open("/dev/qemu_trace", O_RDWR);
 | 
			
		||||
    int fd = open("/dev/qemu_trace", O_CLOEXEC | O_RDWR);
 | 
			
		||||
    if (fd < 0) {
 | 
			
		||||
        error_log("Unable to open /dev/qemu_trace");
 | 
			
		||||
        return false;
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user