Compare commits
	
		
			1292 Commits
		
	
	
		
			jb-mr1.1-d
			...
			kitkat-mr2
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					081db840be | ||
| 
						 | 
					04583ce9b9 | ||
| 
						 | 
					abf91850f9 | ||
| 
						 | 
					806f3bd7aa | ||
| 
						 | 
					5fddfb8915 | ||
| 
						 | 
					5ab8d33aa6 | ||
| 
						 | 
					be662187aa | ||
| 
						 | 
					8e39d2f9f4 | ||
| 
						 | 
					fbefb252b0 | ||
| 
						 | 
					ac6bc31942 | ||
| 
						 | 
					f87684eea1 | ||
| 
						 | 
					303f08b439 | ||
| 
						 | 
					3fce401590 | ||
| 
						 | 
					e1fe52ccf1 | ||
| 
						 | 
					21f5927605 | ||
| 
						 | 
					33f6390064 | ||
| 
						 | 
					34c2a9fc37 | ||
| 
						 | 
					f4af911065 | ||
| 
						 | 
					7bfef355b1 | ||
| 
						 | 
					6d1f85dcdc | ||
| 
						 | 
					e0d1d4cf49 | ||
| 
						 | 
					6ebc24fcc3 | ||
| 
						 | 
					7751d9158f | ||
| 
						 | 
					d3f9e8155b | ||
| 
						 | 
					5d0ad38c72 | ||
| 
						 | 
					ca2c6f75a8 | ||
| 
						 | 
					592c07084b | ||
| 
						 | 
					b30f6eb026 | ||
| 
						 | 
					9e6104d54f | ||
| 
						 | 
					05292dd65b | ||
| 
						 | 
					cc7f0dc5a1 | ||
| 
						 | 
					9a74e36f48 | ||
| 
						 | 
					25519f0fb0 | ||
| 
						 | 
					883ef2499c | ||
| 
						 | 
					82a8fe37d7 | ||
| 
						 | 
					49c0d471a8 | ||
| 
						 | 
					05332f2ce7 | ||
| 
						 | 
					da4bedf52f | ||
| 
						 | 
					6ab75bf41e | ||
| 
						 | 
					e9e10c13ff | ||
| 
						 | 
					8eca269b4b | ||
| 
						 | 
					26ac803232 | ||
| 
						 | 
					d67662b9d6 | ||
| 
						 | 
					345eb225ae | ||
| 
						 | 
					f0c10a4a16 | ||
| 
						 | 
					13ea69528e | ||
| 
						 | 
					9ef1fbb644 | ||
| 
						 | 
					948fbefa2a | ||
| 
						 | 
					5f7ccea3ff | ||
| 
						 | 
					de19a0c55d | ||
| 
						 | 
					f0c3d90913 | ||
| 
						 | 
					3912f90e56 | ||
| 
						 | 
					5951e84646 | ||
| 
						 | 
					f63a467cdd | ||
| 
						 | 
					9e9d1e016f | ||
| 
						 | 
					ceb670cfc0 | ||
| 
						 | 
					1036cd7939 | ||
| 
						 | 
					5ec2ab68f9 | ||
| 
						 | 
					840a114eb1 | ||
| 
						 | 
					86125acacd | ||
| 
						 | 
					6beb3ea6a1 | ||
| 
						 | 
					21b4ffa737 | ||
| 
						 | 
					dce94165a5 | ||
| 
						 | 
					d7d5049d58 | ||
| 
						 | 
					5427eb5c63 | ||
| 
						 | 
					ee48fed518 | ||
| 
						 | 
					d0be7c8f9a | ||
| 
						 | 
					632fd5183a | ||
| 
						 | 
					e2066293e8 | ||
| 
						 | 
					b922ed3498 | ||
| 
						 | 
					4e24dcc8d8 | ||
| 
						 | 
					b683cf117d | ||
| 
						 | 
					7f4074d17d | ||
| 
						 | 
					6771b9cef6 | ||
| 
						 | 
					7c860db074 | ||
| 
						 | 
					2b899b04e9 | ||
| 
						 | 
					1ce6654163 | ||
| 
						 | 
					e1857431e8 | ||
| 
						 | 
					e66ffef900 | ||
| 
						 | 
					28e0ec8d61 | ||
| 
						 | 
					cd927519a9 | ||
| 
						 | 
					a0473d77b2 | ||
| 
						 | 
					662bb875e4 | ||
| 
						 | 
					a9c5bb972d | ||
| 
						 | 
					1d8d9a308c | ||
| 
						 | 
					1714c787b6 | ||
| 
						 | 
					49b24b4efb | ||
| 
						 | 
					b78f43579f | ||
| 
						 | 
					3287dccf2e | ||
| 
						 | 
					d0313e7a2a | ||
| 
						 | 
					baa91f4f89 | ||
| 
						 | 
					aa2733d17b | ||
| 
						 | 
					772b797b7b | ||
| 
						 | 
					a6ed05c1c4 | ||
| 
						 | 
					d119b7b6f4 | ||
| 
						 | 
					0a9c615a89 | ||
| 
						 | 
					7e5d7485b7 | ||
| 
						 | 
					e6345f1a1e | ||
| 
						 | 
					e0805a94c5 | ||
| 
						 | 
					1d1fe3bb69 | ||
| 
						 | 
					abf3638317 | ||
| 
						 | 
					101b5e1f6c | ||
| 
						 | 
					c03e1e7439 | ||
| 
						 | 
					efddf44c8e | ||
| 
						 | 
					326b52760d | ||
| 
						 | 
					9a73d08f4c | ||
| 
						 | 
					838f01fdc7 | ||
| 
						 | 
					478314a109 | ||
| 
						 | 
					a9feb5e33a | ||
| 
						 | 
					e320a8c780 | ||
| 
						 | 
					48161c898b | ||
| 
						 | 
					a59b7ed8c3 | ||
| 
						 | 
					bfba6aac99 | ||
| 
						 | 
					c847f749fe | ||
| 
						 | 
					c5749f1f42 | ||
| 
						 | 
					58ccd60877 | ||
| 
						 | 
					aa9116f0ed | ||
| 
						 | 
					c2902edfc4 | ||
| 
						 | 
					8b56ba8896 | ||
| 
						 | 
					178c418573 | ||
| 
						 | 
					15d2784fc1 | ||
| 
						 | 
					00196d1a46 | ||
| 
						 | 
					3c212645a0 | ||
| 
						 | 
					81b4698059 | ||
| 
						 | 
					ac74b8565a | ||
| 
						 | 
					b6b2375df8 | ||
| 
						 | 
					66f8452a14 | ||
| 
						 | 
					cbf07a2514 | ||
| 
						 | 
					4add6968be | ||
| 
						 | 
					e35d6c28df | ||
| 
						 | 
					a5a3b3bdb1 | ||
| 
						 | 
					4763ef2b5b | ||
| 
						 | 
					0976c97fe4 | ||
| 
						 | 
					81b7df7315 | ||
| 
						 | 
					dd4eb67a48 | ||
| 
						 | 
					6f08b8659a | ||
| 
						 | 
					849bfd5811 | ||
| 
						 | 
					66cb2edba5 | ||
| 
						 | 
					69205c5433 | ||
| 
						 | 
					7ff868a630 | ||
| 
						 | 
					b1d7fd4969 | ||
| 
						 | 
					152dcf3b3f | ||
| 
						 | 
					79dfb1afda | ||
| 
						 | 
					617a1e4977 | ||
| 
						 | 
					f2f6b2bad3 | ||
| 
						 | 
					62d6b7526a | ||
| 
						 | 
					10a954dea6 | ||
| 
						 | 
					d2acf124ed | ||
| 
						 | 
					2a18ea1462 | ||
| 
						 | 
					7256fbd9b2 | ||
| 
						 | 
					993ea1061b | ||
| 
						 | 
					5148661f8d | ||
| 
						 | 
					d8d10a8994 | ||
| 
						 | 
					674be7e0fc | ||
| 
						 | 
					67e9f47476 | ||
| 
						 | 
					2fc0717977 | ||
| 
						 | 
					fc2ada9741 | ||
| 
						 | 
					f384be3b5c | ||
| 
						 | 
					2d7d92e811 | ||
| 
						 | 
					d3522051ce | ||
| 
						 | 
					7e56f462ad | ||
| 
						 | 
					47c7e33ccb | ||
| 
						 | 
					4fa5d6a5db | ||
| 
						 | 
					ff20b91106 | ||
| 
						 | 
					ef49e99d92 | ||
| 
						 | 
					bb17967761 | ||
| 
						 | 
					f9a1d1cf5f | ||
| 
						 | 
					1087e0df4f | ||
| 
						 | 
					09f561b38b | ||
| 
						 | 
					731f7c2d0e | ||
| 
						 | 
					c39214e0ac | ||
| 
						 | 
					b89a334df8 | ||
| 
						 | 
					273df910b5 | ||
| 
						 | 
					4df412cba6 | ||
| 
						 | 
					f3f72e7f27 | ||
| 
						 | 
					74b06f8ddc | ||
| 
						 | 
					f33dce1ab6 | ||
| 
						 | 
					233050b15e | ||
| 
						 | 
					b1397f97f1 | ||
| 
						 | 
					62bdd03120 | ||
| 
						 | 
					b611d36c3a | ||
| 
						 | 
					24400ac1e3 | ||
| 
						 | 
					1456ec759c | ||
| 
						 | 
					20cb10824b | ||
| 
						 | 
					601f968ced | ||
| 
						 | 
					1f75ee8606 | ||
| 
						 | 
					a8b954c51e | ||
| 
						 | 
					be438a4c40 | ||
| 
						 | 
					fac9199c76 | ||
| 
						 | 
					997368d60d | ||
| 
						 | 
					833dc584d4 | ||
| 
						 | 
					742aad3584 | ||
| 
						 | 
					7c808b29d5 | ||
| 
						 | 
					e4723161d5 | ||
| 
						 | 
					2aac0fcc20 | ||
| 
						 | 
					dcd237a897 | ||
| 
						 | 
					553a5ec407 | ||
| 
						 | 
					9db12e44af | ||
| 
						 | 
					c6ac3ae269 | ||
| 
						 | 
					269daac2f1 | ||
| 
						 | 
					4b17283c98 | ||
| 
						 | 
					28d298a673 | ||
| 
						 | 
					5da8df2840 | ||
| 
						 | 
					22570f51a5 | ||
| 
						 | 
					a289964bca | ||
| 
						 | 
					fda0c06605 | ||
| 
						 | 
					2018cfa85d | ||
| 
						 | 
					9a268a10bb | ||
| 
						 | 
					f9ef0106da | ||
| 
						 | 
					e4450b447e | ||
| 
						 | 
					2f76830a01 | ||
| 
						 | 
					146d79c22a | ||
| 
						 | 
					9145ae66d7 | ||
| 
						 | 
					6937468d37 | ||
| 
						 | 
					43508014c4 | ||
| 
						 | 
					d9643a3119 | ||
| 
						 | 
					caad18c7d1 | ||
| 
						 | 
					4fc4c9be84 | ||
| 
						 | 
					db6dd600d2 | ||
| 
						 | 
					baa61864c5 | ||
| 
						 | 
					51371ee0d8 | ||
| 
						 | 
					ad76c85b9c | ||
| 
						 | 
					285b42a04c | ||
| 
						 | 
					4fe82929eb | ||
| 
						 | 
					fc761f8cc0 | ||
| 
						 | 
					be30c7a78a | ||
| 
						 | 
					d5276422ca | ||
| 
						 | 
					4482d85139 | ||
| 
						 | 
					d31287d601 | ||
| 
						 | 
					7180213557 | ||
| 
						 | 
					4261a08409 | ||
| 
						 | 
					5f7f7fca27 | ||
| 
						 | 
					c79de97ccc | ||
| 
						 | 
					de76bafb21 | ||
| 
						 | 
					44c273c293 | ||
| 
						 | 
					890aa0d937 | ||
| 
						 | 
					fa8cc0629f | ||
| 
						 | 
					b938756eb3 | ||
| 
						 | 
					982463d99b | ||
| 
						 | 
					a99e29e610 | ||
| 
						 | 
					492ce95d9f | ||
| 
						 | 
					fb9b7b436f | ||
| 
						 | 
					5f05348c18 | ||
| 
						 | 
					954480393f | ||
| 
						 | 
					0f76e2340c | ||
| 
						 | 
					6ac8e6a46d | ||
| 
						 | 
					a823883548 | ||
| 
						 | 
					22476056b0 | ||
| 
						 | 
					ae9353387d | ||
| 
						 | 
					100d678438 | ||
| 
						 | 
					cf3c9ce0f5 | ||
| 
						 | 
					cb25359a2e | ||
| 
						 | 
					5bfa3ee8b3 | ||
| 
						 | 
					33ae76abf3 | ||
| 
						 | 
					5fed0eeabd | ||
| 
						 | 
					cb4fd62762 | ||
| 
						 | 
					33df38a04c | ||
| 
						 | 
					d32969701b | ||
| 
						 | 
					373ea006ce | ||
| 
						 | 
					1d174a9c17 | ||
| 
						 | 
					700b548738 | ||
| 
						 | 
					f4250508d5 | ||
| 
						 | 
					6e06d4b106 | ||
| 
						 | 
					577418403d | ||
| 
						 | 
					1791cb0001 | ||
| 
						 | 
					fb11350c81 | ||
| 
						 | 
					13e23302c9 | ||
| 
						 | 
					83476f0747 | ||
| 
						 | 
					227079bb67 | ||
| 
						 | 
					6a87df87a2 | ||
| 
						 | 
					bf03f1b4d6 | ||
| 
						 | 
					d98d35c538 | ||
| 
						 | 
					3bf6279034 | ||
| 
						 | 
					45ef218bde | ||
| 
						 | 
					e421bd71c3 | ||
| 
						 | 
					ce7c2f28c6 | ||
| 
						 | 
					ba6c021a53 | ||
| 
						 | 
					3b599c1dde | ||
| 
						 | 
					1a38e06383 | ||
| 
						 | 
					cb83bdfa6b | ||
| 
						 | 
					66a061c8b5 | ||
| 
						 | 
					f6e6e5e727 | ||
| 
						 | 
					9edf071a5d | ||
| 
						 | 
					d2dbf16358 | ||
| 
						 | 
					37d9f75dde | ||
| 
						 | 
					dc1038b790 | ||
| 
						 | 
					a658ed09e5 | ||
| 
						 | 
					afd4e2999c | ||
| 
						 | 
					31d61f13ab | ||
| 
						 | 
					638503b515 | ||
| 
						 | 
					8f5440c486 | ||
| 
						 | 
					c1e4183c7a | ||
| 
						 | 
					fa3af2dd67 | ||
| 
						 | 
					af975b076f | ||
| 
						 | 
					050374836f | ||
| 
						 | 
					de1b73dd70 | ||
| 
						 | 
					ddbf561e5e | ||
| 
						 | 
					7ae23868b4 | ||
| 
						 | 
					b0cd876974 | ||
| 
						 | 
					5065eef801 | ||
| 
						 | 
					3267163200 | ||
| 
						 | 
					5f4d2df2fc | ||
| 
						 | 
					460b70d063 | ||
| 
						 | 
					dc5f5f857c | ||
| 
						 | 
					7e06ab5655 | ||
| 
						 | 
					b0a2262c3f | ||
| 
						 | 
					7ac852fb05 | ||
| 
						 | 
					3da47942d3 | ||
| 
						 | 
					1e88a7abca | ||
| 
						 | 
					834f83de3f | ||
| 
						 | 
					2df16acc42 | ||
| 
						 | 
					6d88e4e96b | ||
| 
						 | 
					26cc1d6838 | ||
| 
						 | 
					4a0c222bb1 | ||
| 
						 | 
					d20a04c5cf | ||
| 
						 | 
					77f90de728 | ||
| 
						 | 
					b181747aa1 | ||
| 
						 | 
					d978d21d19 | ||
| 
						 | 
					72254952e1 | ||
| 
						 | 
					5074892e0a | ||
| 
						 | 
					efc78bbb9f | ||
| 
						 | 
					1b14c72420 | ||
| 
						 | 
					6bcf71c9ac | ||
| 
						 | 
					fc6f5a0865 | ||
| 
						 | 
					b3a7db2dc2 | ||
| 
						 | 
					83245ba45f | ||
| 
						 | 
					87594a32b8 | ||
| 
						 | 
					3d594c2580 | ||
| 
						 | 
					a24d14c05d | ||
| 
						 | 
					0c9bb49a9d | ||
| 
						 | 
					b166e699dc | ||
| 
						 | 
					e51cd6f9c9 | ||
| 
						 | 
					e84cfbefd8 | ||
| 
						 | 
					5a6a0a9445 | ||
| 
						 | 
					0ecb96c3a2 | ||
| 
						 | 
					b9e2dae427 | ||
| 
						 | 
					bedd8e3de1 | ||
| 
						 | 
					ce208f3389 | ||
| 
						 | 
					a7b5635e60 | ||
| 
						 | 
					8ed5aec934 | ||
| 
						 | 
					4b47d9f978 | ||
| 
						 | 
					f1b25d0788 | ||
| 
						 | 
					ae533cb111 | ||
| 
						 | 
					680e3f94a0 | ||
| 
						 | 
					20b0fec8ab | ||
| 
						 | 
					81bfade818 | ||
| 
						 | 
					8ea08d3ff9 | ||
| 
						 | 
					b472f50057 | ||
| 
						 | 
					7ca9057f53 | ||
| 
						 | 
					72ce296f28 | ||
| 
						 | 
					dc1782b156 | ||
| 
						 | 
					9e1905794b | ||
| 
						 | 
					75c9e17682 | ||
| 
						 | 
					027a8fae77 | ||
| 
						 | 
					c702a90467 | ||
| 
						 | 
					b5aa654be6 | ||
| 
						 | 
					9b7ae336ee | ||
| 
						 | 
					d9349abf29 | ||
| 
						 | 
					5630e54c3b | ||
| 
						 | 
					fe09748a5f | ||
| 
						 | 
					3010061a53 | ||
| 
						 | 
					af5d6029e5 | ||
| 
						 | 
					cf34265338 | ||
| 
						 | 
					080d2aa8dc | ||
| 
						 | 
					88cc328c17 | ||
| 
						 | 
					47b2e046cd | ||
| 
						 | 
					46bf467a15 | ||
| 
						 | 
					33cf35317b | ||
| 
						 | 
					d5234a3b08 | ||
| 
						 | 
					4c8eba6f2a | ||
| 
						 | 
					0ae3304f83 | ||
| 
						 | 
					5b75f3bfa1 | ||
| 
						 | 
					231ea5a414 | ||
| 
						 | 
					217c816480 | ||
| 
						 | 
					0a7fe99153 | ||
| 
						 | 
					543f3f0ec4 | ||
| 
						 | 
					975d4464ce | ||
| 
						 | 
					940e30cf34 | ||
| 
						 | 
					20516923f5 | ||
| 
						 | 
					0128b2c752 | ||
| 
						 | 
					7c7f098995 | ||
| 
						 | 
					d3d014da91 | ||
| 
						 | 
					47e46ed157 | ||
| 
						 | 
					01678789bc | ||
| 
						 | 
					562804ff87 | ||
| 
						 | 
					3136623600 | ||
| 
						 | 
					91cc8014e8 | ||
| 
						 | 
					ff5fb5cc4b | ||
| 
						 | 
					509fc80697 | ||
| 
						 | 
					46fa11a0ae | ||
| 
						 | 
					d1ad4f6dab | ||
| 
						 | 
					04c0ac14a4 | ||
| 
						 | 
					60e5144ca3 | ||
| 
						 | 
					b928bda83d | ||
| 
						 | 
					5ff2b9aafd | ||
| 
						 | 
					d146e8e4e9 | ||
| 
						 | 
					a28cb8bd35 | ||
| 
						 | 
					30d7485dd3 | ||
| 
						 | 
					a74e6c21e7 | ||
| 
						 | 
					58f3dbdacd | ||
| 
						 | 
					738370d938 | ||
| 
						 | 
					3c2ab6ffbb | ||
| 
						 | 
					ca54ae44a4 | ||
| 
						 | 
					0d4e9fe58a | ||
| 
						 | 
					a078f9dcf0 | ||
| 
						 | 
					77a2932836 | ||
| 
						 | 
					f8867a5632 | ||
| 
						 | 
					49f6e97062 | ||
| 
						 | 
					3353e6535a | ||
| 
						 | 
					37cd8800d5 | ||
| 
						 | 
					262b7384e4 | ||
| 
						 | 
					237ac7be01 | ||
| 
						 | 
					a14f7933f4 | ||
| 
						 | 
					e68c711e78 | ||
| 
						 | 
					f0c9683e17 | ||
| 
						 | 
					c9757ac81e | ||
| 
						 | 
					137a9ad176 | ||
| 
						 | 
					4f614a7036 | ||
| 
						 | 
					4d8fe5177e | ||
| 
						 | 
					2a9966da82 | ||
| 
						 | 
					240bc95be1 | ||
| 
						 | 
					874ea191de | ||
| 
						 | 
					65fe3ea708 | ||
| 
						 | 
					b9aab3a462 | ||
| 
						 | 
					33cd3f6848 | ||
| 
						 | 
					6c6949fc00 | ||
| 
						 | 
					8355ab5524 | ||
| 
						 | 
					c9bf778112 | ||
| 
						 | 
					2ff94a0964 | ||
| 
						 | 
					3fa53b5978 | ||
| 
						 | 
					d411fbd497 | ||
| 
						 | 
					90a293f7d3 | ||
| 
						 | 
					780cf25bf4 | ||
| 
						 | 
					aed0c3ac54 | ||
| 
						 | 
					56a1b492c4 | ||
| 
						 | 
					89357dc730 | ||
| 
						 | 
					cfb0b8bd5e | ||
| 
						 | 
					83966db80b | ||
| 
						 | 
					b03dc7cfa3 | ||
| 
						 | 
					95a46909c7 | ||
| 
						 | 
					9aa57e09ef | ||
| 
						 | 
					ed572aaa0d | ||
| 
						 | 
					59f27ec089 | ||
| 
						 | 
					46de17d26d | ||
| 
						 | 
					baa836baa4 | ||
| 
						 | 
					eb22fc331e | ||
| 
						 | 
					537e1aa9c6 | ||
| 
						 | 
					b6e895e80f | ||
| 
						 | 
					389b5c1ee5 | ||
| 
						 | 
					70ef50862c | ||
| 
						 | 
					14cbb15b99 | ||
| 
						 | 
					41dcafc276 | ||
| 
						 | 
					dd15d3cb28 | ||
| 
						 | 
					dc7e8b892d | ||
| 
						 | 
					6180ab7850 | ||
| 
						 | 
					4f89ab3166 | ||
| 
						 | 
					652c68c50e | ||
| 
						 | 
					9f10e6a96a | ||
| 
						 | 
					c689ed1ef7 | ||
| 
						 | 
					9a41d425ea | ||
| 
						 | 
					d23a87d3b1 | ||
| 
						 | 
					94dcdb0352 | ||
| 
						 | 
					5274339979 | ||
| 
						 | 
					35a2a61d49 | ||
| 
						 | 
					39e4ed9699 | ||
| 
						 | 
					cf4a53020d | ||
| 
						 | 
					5703eb8007 | ||
| 
						 | 
					a1826f6e59 | ||
| 
						 | 
					5fe62e50f6 | ||
| 
						 | 
					651b3e1f9e | ||
| 
						 | 
					6c48aca345 | ||
| 
						 | 
					ab911a02af | ||
| 
						 | 
					637d50e6c0 | ||
| 
						 | 
					980d21745c | ||
| 
						 | 
					b9cfe21c6e | ||
| 
						 | 
					76db50ddc9 | ||
| 
						 | 
					dbc23ea51c | ||
| 
						 | 
					101dadf6a6 | ||
| 
						 | 
					3fe5b10948 | ||
| 
						 | 
					61735a9069 | ||
| 
						 | 
					55c015cddd | ||
| 
						 | 
					7b1d164a4e | ||
| 
						 | 
					e27483c788 | ||
| 
						 | 
					ccaa0fa6e9 | ||
| 
						 | 
					7ffad9c120 | ||
| 
						 | 
					bc37bf00f8 | ||
| 
						 | 
					bb9842b61e | ||
| 
						 | 
					cad988dafb | ||
| 
						 | 
					d4cc0b8a61 | ||
| 
						 | 
					8bed98c3ce | ||
| 
						 | 
					fe7f46c088 | ||
| 
						 | 
					7b4d77e400 | ||
| 
						 | 
					f89ce5b518 | ||
| 
						 | 
					9c7b510a40 | ||
| 
						 | 
					291f5c1e4b | ||
| 
						 | 
					ddbe8a23a8 | ||
| 
						 | 
					9207e5aed8 | ||
| 
						 | 
					cd6f4804d2 | ||
| 
						 | 
					fbfedc7a7c | ||
| 
						 | 
					acec23561e | ||
| 
						 | 
					98ac1d64bd | ||
| 
						 | 
					f3810dbb0a | ||
| 
						 | 
					13ab55918a | ||
| 
						 | 
					f5dc908695 | ||
| 
						 | 
					4bc546860e | ||
| 
						 | 
					57148994df | ||
| 
						 | 
					9b84824dfd | ||
| 
						 | 
					a69103ffe4 | ||
| 
						 | 
					c099884c7c | ||
| 
						 | 
					90e19c328f | ||
| 
						 | 
					168486f073 | ||
| 
						 | 
					a0340cf139 | ||
| 
						 | 
					fe51d25e83 | ||
| 
						 | 
					40147728d2 | ||
| 
						 | 
					1fe1137576 | ||
| 
						 | 
					4ea3580749 | ||
| 
						 | 
					5014f417ea | ||
| 
						 | 
					6517d138fd | ||
| 
						 | 
					5a3cc2018c | ||
| 
						 | 
					6ffaa931c3 | ||
| 
						 | 
					ea01edd2d4 | ||
| 
						 | 
					02dc65183b | ||
| 
						 | 
					cc91c517bf | ||
| 
						 | 
					9ef66e842f | ||
| 
						 | 
					50bc9395e4 | ||
| 
						 | 
					7506673f63 | ||
| 
						 | 
					8dd195c509 | ||
| 
						 | 
					309e107f01 | ||
| 
						 | 
					1ec2cf5ba8 | ||
| 
						 | 
					a66f6570c1 | ||
| 
						 | 
					e919b116d3 | ||
| 
						 | 
					21ede92d79 | ||
| 
						 | 
					c099b270c6 | ||
| 
						 | 
					62bb090f8e | ||
| 
						 | 
					e2bce30360 | ||
| 
						 | 
					96449b3dc1 | ||
| 
						 | 
					113054c4eb | ||
| 
						 | 
					5b661481a8 | ||
| 
						 | 
					b24b6e1419 | ||
| 
						 | 
					e59ecd3279 | ||
| 
						 | 
					c01274c4aa | ||
| 
						 | 
					2903a0bac3 | ||
| 
						 | 
					f9e4a6e93b | ||
| 
						 | 
					0f7607f372 | ||
| 
						 | 
					a3ce0bb1ad | ||
| 
						 | 
					a3de6b47bf | ||
| 
						 | 
					d02dd19d51 | ||
| 
						 | 
					267290b340 | ||
| 
						 | 
					8398f82ddd | ||
| 
						 | 
					6ed55e06fd | ||
| 
						 | 
					024f418af2 | ||
| 
						 | 
					887049e46b | ||
| 
						 | 
					416d231f97 | ||
| 
						 | 
					fd59d4d3ea | ||
| 
						 | 
					47a46646f0 | ||
| 
						 | 
					6147c2941e | ||
| 
						 | 
					d74b3bb1cb | ||
| 
						 | 
					c813182d20 | ||
| 
						 | 
					da2c158645 | ||
| 
						 | 
					8a6abe380d | ||
| 
						 | 
					69684aa312 | ||
| 
						 | 
					9451037195 | ||
| 
						 | 
					999dff0ef3 | ||
| 
						 | 
					a850ad4cf4 | ||
| 
						 | 
					e24ec2ad4c | ||
| 
						 | 
					bb06498d89 | ||
| 
						 | 
					369f92349f | ||
| 
						 | 
					7a7d39c3f0 | ||
| 
						 | 
					263be8b1a0 | ||
| 
						 | 
					c538edc1e8 | ||
| 
						 | 
					053ceea117 | ||
| 
						 | 
					c82b339a7d | ||
| 
						 | 
					9386a33ea0 | ||
| 
						 | 
					3c1504d9d7 | ||
| 
						 | 
					93f3811b74 | ||
| 
						 | 
					a500fdb18e | ||
| 
						 | 
					af66ca6b19 | ||
| 
						 | 
					0c973d7049 | ||
| 
						 | 
					4584721b5a | ||
| 
						 | 
					9792b2d160 | ||
| 
						 | 
					ba61bb55c4 | ||
| 
						 | 
					a3fe475c9f | ||
| 
						 | 
					cf3fc45376 | ||
| 
						 | 
					dce1b3e26a | ||
| 
						 | 
					e0e5b2f6e7 | ||
| 
						 | 
					65163750b1 | ||
| 
						 | 
					749a9e022c | ||
| 
						 | 
					fbb4198857 | ||
| 
						 | 
					b826ebf41e | ||
| 
						 | 
					85598626f4 | ||
| 
						 | 
					74c7d3ff03 | ||
| 
						 | 
					90763e0aee | ||
| 
						 | 
					f30ff61ef6 | ||
| 
						 | 
					f0fc7b9bf9 | ||
| 
						 | 
					b44f9600a3 | ||
| 
						 | 
					a0dcecc53e | ||
| 
						 | 
					b80a05fa67 | ||
| 
						 | 
					bc0d7f736c | ||
| 
						 | 
					847a62270f | ||
| 
						 | 
					d74a0ffba8 | ||
| 
						 | 
					1d509cc043 | ||
| 
						 | 
					472d7115f1 | ||
| 
						 | 
					ddda044a81 | ||
| 
						 | 
					5686bb3003 | ||
| 
						 | 
					731381ad5f | ||
| 
						 | 
					dfde829fc1 | ||
| 
						 | 
					c8ded7c6b1 | ||
| 
						 | 
					a316725740 | ||
| 
						 | 
					bd43b613b8 | ||
| 
						 | 
					06a06d5091 | ||
| 
						 | 
					3a6178f8b9 | ||
| 
						 | 
					71afd31535 | ||
| 
						 | 
					1e40ace49e | ||
| 
						 | 
					17a0d1915f | ||
| 
						 | 
					a596aa6abf | ||
| 
						 | 
					01c0e19e42 | ||
| 
						 | 
					2810ec5464 | ||
| 
						 | 
					5bed5501d7 | ||
| 
						 | 
					3077d88347 | ||
| 
						 | 
					c48968d268 | ||
| 
						 | 
					b11037a42a | ||
| 
						 | 
					455637f251 | ||
| 
						 | 
					5c9a25cc23 | ||
| 
						 | 
					f977d2dc1d | ||
| 
						 | 
					a2e42c3798 | ||
| 
						 | 
					6d460efed9 | ||
| 
						 | 
					c9edc07977 | ||
| 
						 | 
					39e2a408a6 | ||
| 
						 | 
					3e036b0c99 | ||
| 
						 | 
					e269711a1b | ||
| 
						 | 
					774266bfa2 | ||
| 
						 | 
					f46e14544b | ||
| 
						 | 
					9088af19b4 | ||
| 
						 | 
					fd56f2a3cc | ||
| 
						 | 
					bad0c4d8bb | ||
| 
						 | 
					1565771b2a | ||
| 
						 | 
					ed12f36a09 | ||
| 
						 | 
					6380d21a05 | ||
| 
						 | 
					92a197f305 | ||
| 
						 | 
					d7dc414afd | ||
| 
						 | 
					987fc5a3c4 | ||
| 
						 | 
					90f7546c68 | ||
| 
						 | 
					cf23cbb1d4 | ||
| 
						 | 
					12ea800566 | ||
| 
						 | 
					5f8292050f | ||
| 
						 | 
					744df77d47 | ||
| 
						 | 
					cc71361ed6 | ||
| 
						 | 
					270595f4c9 | ||
| 
						 | 
					e1b0db1392 | ||
| 
						 | 
					50d42294bd | ||
| 
						 | 
					9d6a2c28a5 | ||
| 
						 | 
					045e01caed | ||
| 
						 | 
					c204b501f4 | ||
| 
						 | 
					9ede4549fe | ||
| 
						 | 
					f8d689bc56 | ||
| 
						 | 
					18fcfa79d3 | ||
| 
						 | 
					8dcbb90dea | ||
| 
						 | 
					f85fc022f5 | ||
| 
						 | 
					f694ed1cdb | ||
| 
						 | 
					4982e345cf | ||
| 
						 | 
					2d48d0ea36 | ||
| 
						 | 
					c9358706c6 | ||
| 
						 | 
					2e7b8d6399 | ||
| 
						 | 
					65461bbe25 | ||
| 
						 | 
					e450d655ba | ||
| 
						 | 
					45508566d1 | ||
| 
						 | 
					a00988312b | ||
| 
						 | 
					76ade2ed60 | ||
| 
						 | 
					f557e90b34 | ||
| 
						 | 
					2f44c05bc5 | ||
| 
						 | 
					f0cd52305a | ||
| 
						 | 
					8cca015403 | ||
| 
						 | 
					b0b974c10c | ||
| 
						 | 
					2a66ccf1bb | ||
| 
						 | 
					4f73423c68 | ||
| 
						 | 
					0052a6188b | ||
| 
						 | 
					b4d6f28cc3 | ||
| 
						 | 
					a3214c6562 | ||
| 
						 | 
					6734451334 | ||
| 
						 | 
					60414ba165 | ||
| 
						 | 
					746f128602 | ||
| 
						 | 
					5d998b4a21 | ||
| 
						 | 
					947695bd9b | ||
| 
						 | 
					5487ecb52a | ||
| 
						 | 
					e9cdce33f3 | ||
| 
						 | 
					3c9afb5e17 | ||
| 
						 | 
					a9a5870d16 | ||
| 
						 | 
					1a6e73d0ac | ||
| 
						 | 
					70d97ae3d0 | ||
| 
						 | 
					7c8af2252a | ||
| 
						 | 
					24ec903cd8 | ||
| 
						 | 
					3284773891 | ||
| 
						 | 
					03e712357d | ||
| 
						 | 
					8c73f69cf4 | ||
| 
						 | 
					36cb88b70c | ||
| 
						 | 
					23167e7556 | ||
| 
						 | 
					1467dfa5cd | ||
| 
						 | 
					3d0bf2b30c | ||
| 
						 | 
					a60f381814 | ||
| 
						 | 
					9969b48d23 | ||
| 
						 | 
					b2525ba8a0 | ||
| 
						 | 
					7915b22e8f | ||
| 
						 | 
					60ac09bdb2 | ||
| 
						 | 
					a4b20d712b | ||
| 
						 | 
					b8e1033c5b | ||
| 
						 | 
					e5412a9a95 | ||
| 
						 | 
					cd9c4cfae3 | ||
| 
						 | 
					022d7c50db | ||
| 
						 | 
					bf32ffcf02 | ||
| 
						 | 
					6d6f5e618e | ||
| 
						 | 
					0b765862e1 | ||
| 
						 | 
					e767b0f555 | ||
| 
						 | 
					568eb7bd76 | ||
| 
						 | 
					5bb64976a0 | ||
| 
						 | 
					7a9749eca0 | ||
| 
						 | 
					8a01572272 | ||
| 
						 | 
					4706606c88 | ||
| 
						 | 
					a7a3bcef75 | ||
| 
						 | 
					a312b02e85 | ||
| 
						 | 
					30be06bc7a | ||
| 
						 | 
					0f644ccf6d | ||
| 
						 | 
					0a2ee4750a | ||
| 
						 | 
					ad7c275e45 | ||
| 
						 | 
					4bf33991b2 | ||
| 
						 | 
					6b89c6341f | ||
| 
						 | 
					c7b9f954a5 | ||
| 
						 | 
					91392116ff | ||
| 
						 | 
					85598b9668 | ||
| 
						 | 
					165825e3e8 | ||
| 
						 | 
					9c0c056bed | ||
| 
						 | 
					6b1aa1b16b | ||
| 
						 | 
					6646adeac0 | ||
| 
						 | 
					bbef1f5750 | ||
| 
						 | 
					bac72abae4 | ||
| 
						 | 
					50a2cd865e | ||
| 
						 | 
					01b5c0f126 | ||
| 
						 | 
					0864ade9de | ||
| 
						 | 
					8f4880e2c6 | ||
| 
						 | 
					5673f9f73b | ||
| 
						 | 
					bc08713ba4 | ||
| 
						 | 
					f5fc5d467c | ||
| 
						 | 
					2527a8b5a6 | ||
| 
						 | 
					9043202b5b | ||
| 
						 | 
					c1a5d20d08 | ||
| 
						 | 
					9a0b658c9c | ||
| 
						 | 
					d18e5bb412 | ||
| 
						 | 
					a2cfd1a27f | ||
| 
						 | 
					8c65a1e466 | ||
| 
						 | 
					a2517de384 | ||
| 
						 | 
					074a94c01e | ||
| 
						 | 
					b3b0037884 | ||
| 
						 | 
					97a8217ae1 | ||
| 
						 | 
					3f7b1cd3ac | ||
| 
						 | 
					fbb281b15d | ||
| 
						 | 
					7eaed030de | ||
| 
						 | 
					6ad68558ed | ||
| 
						 | 
					e5e6e17c5b | ||
| 
						 | 
					c6ef78e83e | ||
| 
						 | 
					136e00d6e9 | ||
| 
						 | 
					c96ad9bcd2 | ||
| 
						 | 
					7b69ac535a | ||
| 
						 | 
					69a278f679 | ||
| 
						 | 
					adff4e8630 | ||
| 
						 | 
					ee84789761 | ||
| 
						 | 
					5b5aa0317c | ||
| 
						 | 
					3f794facd3 | ||
| 
						 | 
					7ef3ccb7bb | ||
| 
						 | 
					81e0f35acc | ||
| 
						 | 
					781c4b19f4 | ||
| 
						 | 
					98650e04e6 | ||
| 
						 | 
					2125c15506 | ||
| 
						 | 
					e290a7e348 | ||
| 
						 | 
					2ec68f6833 | ||
| 
						 | 
					0a1ab287ff | ||
| 
						 | 
					29cc4946ac | ||
| 
						 | 
					947b3ab02b | ||
| 
						 | 
					f85e173616 | ||
| 
						 | 
					89d7f5e482 | ||
| 
						 | 
					1f415124ec | ||
| 
						 | 
					b9ef7f4e12 | ||
| 
						 | 
					ae280bcdbe | ||
| 
						 | 
					04190c53e3 | ||
| 
						 | 
					52b3aed798 | ||
| 
						 | 
					55fc93a909 | ||
| 
						 | 
					cc64677342 | ||
| 
						 | 
					424f21b6a7 | ||
| 
						 | 
					c7f9669226 | ||
| 
						 | 
					7c83a1ed81 | ||
| 
						 | 
					730da15840 | ||
| 
						 | 
					bfc25aa33c | ||
| 
						 | 
					04766565d3 | ||
| 
						 | 
					9c102ccf95 | ||
| 
						 | 
					fbae9f3c30 | ||
| 
						 | 
					de8481bcf7 | ||
| 
						 | 
					6e1a5cf31b | ||
| 
						 | 
					e9ca2d80ed | ||
| 
						 | 
					acdde8c1cf | ||
| 
						 | 
					30f1622a34 | ||
| 
						 | 
					82f4cc5de4 | ||
| 
						 | 
					c453d42e20 | ||
| 
						 | 
					aa13eaa934 | ||
| 
						 | 
					d9cb69881a | ||
| 
						 | 
					a6cef2de96 | ||
| 
						 | 
					92ce5cc4bc | ||
| 
						 | 
					ed1068c86e | ||
| 
						 | 
					726642cfa5 | ||
| 
						 | 
					dd8439141a | ||
| 
						 | 
					bcedca25d3 | ||
| 
						 | 
					41fb968c42 | ||
| 
						 | 
					5d36baee95 | ||
| 
						 | 
					d2a3e69c26 | ||
| 
						 | 
					bfe0640e41 | ||
| 
						 | 
					a6b24b7afb | ||
| 
						 | 
					7dfc6a3cd1 | ||
| 
						 | 
					e974e95160 | ||
| 
						 | 
					d470955eb5 | ||
| 
						 | 
					72e983d628 | ||
| 
						 | 
					448f1f08c2 | ||
| 
						 | 
					caeb0bf53c | ||
| 
						 | 
					8f8bc0664a | ||
| 
						 | 
					55779c4316 | ||
| 
						 | 
					aa96db5ba0 | ||
| 
						 | 
					37d6d8e933 | ||
| 
						 | 
					44f8f7b86a | ||
| 
						 | 
					cae2173952 | ||
| 
						 | 
					77272874f8 | ||
| 
						 | 
					5593d50c72 | ||
| 
						 | 
					6f55284103 | ||
| 
						 | 
					82232f0e6b | ||
| 
						 | 
					4174337525 | ||
| 
						 | 
					6af19237b7 | ||
| 
						 | 
					15c401d4ac | ||
| 
						 | 
					56a007c157 | ||
| 
						 | 
					f93de61e7b | ||
| 
						 | 
					7331af73f2 | ||
| 
						 | 
					dfa1e59b7d | ||
| 
						 | 
					8561261b5e | ||
| 
						 | 
					2346559cb4 | ||
| 
						 | 
					4c897b692d | ||
| 
						 | 
					5ca3e4a349 | ||
| 
						 | 
					a7603ff87a | ||
| 
						 | 
					8ca1da6e71 | ||
| 
						 | 
					6aca0ce367 | ||
| 
						 | 
					2db16ea38e | ||
| 
						 | 
					32a2340067 | ||
| 
						 | 
					d41c26e2d8 | ||
| 
						 | 
					a244e4eb61 | ||
| 
						 | 
					761b344bff | ||
| 
						 | 
					bc35693e6b | ||
| 
						 | 
					d8ceaf5afa | ||
| 
						 | 
					dde1d876b1 | ||
| 
						 | 
					f4e258c22e | ||
| 
						 | 
					78715fca0b | ||
| 
						 | 
					ac480b422a | ||
| 
						 | 
					1bb43b02ad | ||
| 
						 | 
					191f880bdf | ||
| 
						 | 
					23731e841a | ||
| 
						 | 
					13478d856a | ||
| 
						 | 
					0f6882f43d | ||
| 
						 | 
					a2b8b833d2 | ||
| 
						 | 
					b940711587 | ||
| 
						 | 
					5bb4f54b4d | ||
| 
						 | 
					1b21249d5a | ||
| 
						 | 
					376bce0097 | ||
| 
						 | 
					c087b7a80f | ||
| 
						 | 
					63358ae068 | ||
| 
						 | 
					01cf1678e7 | ||
| 
						 | 
					5eef90699d | ||
| 
						 | 
					7d2bc92717 | ||
| 
						 | 
					8c372fc77e | ||
| 
						 | 
					dd698ec89a | ||
| 
						 | 
					389ebfa16f | ||
| 
						 | 
					a7d9b655e5 | ||
| 
						 | 
					c63e59039d | ||
| 
						 | 
					ffc807fdb6 | ||
| 
						 | 
					a3e0f95fba | ||
| 
						 | 
					001437e861 | ||
| 
						 | 
					5dc29e97a6 | ||
| 
						 | 
					4b9ed9e153 | ||
| 
						 | 
					1c3039301b | ||
| 
						 | 
					a9ebf6c951 | ||
| 
						 | 
					6dd470d4d0 | ||
| 
						 | 
					d418c2bd0a | ||
| 
						 | 
					303339e8d1 | ||
| 
						 | 
					d1f2fafb72 | ||
| 
						 | 
					b72952171b | ||
| 
						 | 
					54a2587446 | ||
| 
						 | 
					46b3f0bb97 | ||
| 
						 | 
					9cdd76954d | ||
| 
						 | 
					96a5819afb | ||
| 
						 | 
					fb7a4850b8 | ||
| 
						 | 
					37247ae63c | ||
| 
						 | 
					322c7edba3 | ||
| 
						 | 
					3c72524611 | ||
| 
						 | 
					8db7a4cb20 | ||
| 
						 | 
					0243962d20 | ||
| 
						 | 
					4c59597089 | ||
| 
						 | 
					8dfe0daf6f | ||
| 
						 | 
					278c059663 | ||
| 
						 | 
					d9397a7c5e | ||
| 
						 | 
					a1b8c145cb | ||
| 
						 | 
					3638641014 | ||
| 
						 | 
					2a523d1a06 | ||
| 
						 | 
					62228694a0 | ||
| 
						 | 
					8482fbb691 | ||
| 
						 | 
					609ca692a9 | ||
| 
						 | 
					ac10757e2a | ||
| 
						 | 
					98ce9888b1 | ||
| 
						 | 
					85e76a3652 | ||
| 
						 | 
					3eaa03df03 | ||
| 
						 | 
					0f01df7fc9 | ||
| 
						 | 
					ddbb728eff | ||
| 
						 | 
					472fdc95a6 | ||
| 
						 | 
					f5b111df06 | ||
| 
						 | 
					d72183aa16 | ||
| 
						 | 
					828aaaac5e | ||
| 
						 | 
					9d28f5bf4a | ||
| 
						 | 
					28fa8e109e | ||
| 
						 | 
					7f0976ef0e | ||
| 
						 | 
					774cef56ee | ||
| 
						 | 
					bdd209561e | ||
| 
						 | 
					0b9b068b3f | ||
| 
						 | 
					f27874740f | ||
| 
						 | 
					0acf4069e9 | ||
| 
						 | 
					25e3f4a90d | ||
| 
						 | 
					8897a9565a | ||
| 
						 | 
					f669fdf11e | ||
| 
						 | 
					16f7b78fd1 | ||
| 
						 | 
					5f0de35c3e | ||
| 
						 | 
					1136b7d821 | ||
| 
						 | 
					b002a2ff77 | ||
| 
						 | 
					b1d1a7682f | ||
| 
						 | 
					f10c5a2215 | ||
| 
						 | 
					c82bc4f472 | ||
| 
						 | 
					f73a885f53 | ||
| 
						 | 
					bf1d225593 | ||
| 
						 | 
					c5c99adeed | ||
| 
						 | 
					e230306135 | ||
| 
						 | 
					dbcf3ed458 | ||
| 
						 | 
					89f9b30e4d | ||
| 
						 | 
					ff1c00a29e | ||
| 
						 | 
					927d904d52 | ||
| 
						 | 
					bcd18c0485 | ||
| 
						 | 
					dde6b88a9f | ||
| 
						 | 
					31ecd0c342 | ||
| 
						 | 
					b3aff045b2 | ||
| 
						 | 
					1a18895ebc | ||
| 
						 | 
					27b8421a15 | ||
| 
						 | 
					7cfe0d2602 | ||
| 
						 | 
					0112ee2190 | ||
| 
						 | 
					e7cc7957ac | ||
| 
						 | 
					6405103a32 | ||
| 
						 | 
					9e22af2363 | ||
| 
						 | 
					86050b9e92 | ||
| 
						 | 
					a4e964d200 | ||
| 
						 | 
					7f7f232f4a | ||
| 
						 | 
					1165da8390 | ||
| 
						 | 
					32cefdbc7a | ||
| 
						 | 
					14ab1a63d6 | ||
| 
						 | 
					76c8c61517 | ||
| 
						 | 
					8ffe08c86b | ||
| 
						 | 
					f1464ff956 | ||
| 
						 | 
					0529a52c60 | ||
| 
						 | 
					8deebb34d3 | ||
| 
						 | 
					376889ad71 | ||
| 
						 | 
					73dd37d8fe | ||
| 
						 | 
					7e29f81163 | ||
| 
						 | 
					ef06105819 | ||
| 
						 | 
					d09bdc7148 | ||
| 
						 | 
					19dd1567a0 | ||
| 
						 | 
					0c11611c11 | ||
| 
						 | 
					78851f10d1 | ||
| 
						 | 
					8868be3a9f | ||
| 
						 | 
					5043c376c9 | ||
| 
						 | 
					76187899a6 | ||
| 
						 | 
					375e10f739 | ||
| 
						 | 
					326cb73c58 | ||
| 
						 | 
					00ab4eb0db | ||
| 
						 | 
					8dd63f31ba | ||
| 
						 | 
					27a7a5c138 | ||
| 
						 | 
					5c532dc8ee | ||
| 
						 | 
					e9d6575e10 | ||
| 
						 | 
					803bd660b6 | ||
| 
						 | 
					36a9f354c0 | ||
| 
						 | 
					0ce87c8984 | ||
| 
						 | 
					2937d9ab54 | ||
| 
						 | 
					d020802e37 | ||
| 
						 | 
					efe3ca7b48 | ||
| 
						 | 
					05ab167cf7 | ||
| 
						 | 
					b9cb7ee082 | ||
| 
						 | 
					78b90c744d | ||
| 
						 | 
					f096529317 | ||
| 
						 | 
					42d7a26d23 | ||
| 
						 | 
					d08e76cd35 | ||
| 
						 | 
					edb53b3e9d | ||
| 
						 | 
					a710682db3 | ||
| 
						 | 
					5e6213af54 | ||
| 
						 | 
					439bc8d540 | ||
| 
						 | 
					1c88362021 | ||
| 
						 | 
					c3d031ee91 | ||
| 
						 | 
					babe7e16a1 | ||
| 
						 | 
					49dd0409e0 | ||
| 
						 | 
					a03b2b075f | ||
| 
						 | 
					db11fdef1a | ||
| 
						 | 
					ae7af291e6 | ||
| 
						 | 
					59b8677562 | ||
| 
						 | 
					dcb8209409 | ||
| 
						 | 
					2e51dc444f | ||
| 
						 | 
					3fa99562ea | ||
| 
						 | 
					4ef6bc2e62 | ||
| 
						 | 
					4ad0910774 | ||
| 
						 | 
					e12a238d41 | ||
| 
						 | 
					e8be11969f | ||
| 
						 | 
					7492875448 | ||
| 
						 | 
					3b48de92c7 | ||
| 
						 | 
					80a161db5c | ||
| 
						 | 
					d8366eae3b | ||
| 
						 | 
					321b545ad9 | ||
| 
						 | 
					947f74dc95 | ||
| 
						 | 
					4867b00666 | ||
| 
						 | 
					03ff63cee0 | ||
| 
						 | 
					72f43a929f | ||
| 
						 | 
					c16ea16134 | ||
| 
						 | 
					8dd20fcd88 | ||
| 
						 | 
					3269d63772 | ||
| 
						 | 
					3a681c8db1 | ||
| 
						 | 
					aec9a254a2 | ||
| 
						 | 
					6f3222ea42 | ||
| 
						 | 
					5b3aa025f3 | ||
| 
						 | 
					da273a17e7 | ||
| 
						 | 
					02a6ca7ef5 | ||
| 
						 | 
					6aa473274c | ||
| 
						 | 
					b3dc5c60aa | ||
| 
						 | 
					aad391b8a6 | ||
| 
						 | 
					1233104f5e | ||
| 
						 | 
					dfaf06ac03 | ||
| 
						 | 
					930a507786 | ||
| 
						 | 
					2c9590664f | ||
| 
						 | 
					bace2c47d3 | ||
| 
						 | 
					d15c8737ce | ||
| 
						 | 
					d052eb6b47 | ||
| 
						 | 
					dc20297f8d | ||
| 
						 | 
					da71c7d9a3 | ||
| 
						 | 
					5793235ec4 | ||
| 
						 | 
					f1566fd692 | ||
| 
						 | 
					d752fc0286 | ||
| 
						 | 
					1d0129b1b2 | ||
| 
						 | 
					80bcf54766 | ||
| 
						 | 
					eb15e1d485 | ||
| 
						 | 
					ceda36fa12 | ||
| 
						 | 
					d781dfdb09 | ||
| 
						 | 
					02c3513e5f | ||
| 
						 | 
					00fe4a20d7 | ||
| 
						 | 
					7a6ae1d667 | ||
| 
						 | 
					e892414bd3 | ||
| 
						 | 
					a4242290a1 | ||
| 
						 | 
					b5b52e73e9 | ||
| 
						 | 
					a9b0cd68de | ||
| 
						 | 
					8478dbc85f | ||
| 
						 | 
					864d48917a | ||
| 
						 | 
					08c4e30e23 | ||
| 
						 | 
					4d2ea14288 | ||
| 
						 | 
					c7358ee57c | ||
| 
						 | 
					7d617d0db9 | ||
| 
						 | 
					5e805afa79 | ||
| 
						 | 
					d4834a217e | ||
| 
						 | 
					5ce5edd6cf | ||
| 
						 | 
					96b52e104a | ||
| 
						 | 
					5b006f3d08 | ||
| 
						 | 
					4e0b489a0c | ||
| 
						 | 
					a7bb83475b | ||
| 
						 | 
					0f96dd8dcb | ||
| 
						 | 
					2654447c0e | ||
| 
						 | 
					4cdc426207 | ||
| 
						 | 
					217e616772 | ||
| 
						 | 
					1d212fa6eb | ||
| 
						 | 
					1d8b87d2b4 | ||
| 
						 | 
					c866dc20bf | ||
| 
						 | 
					8b8cc88d39 | ||
| 
						 | 
					3135c87ca8 | ||
| 
						 | 
					9407c5c126 | ||
| 
						 | 
					1b62d4e72e | ||
| 
						 | 
					421083359e | ||
| 
						 | 
					933746ad7d | ||
| 
						 | 
					bde97cf154 | ||
| 
						 | 
					18ee86f892 | ||
| 
						 | 
					174b6d0e19 | ||
| 
						 | 
					a7bc708e0c | ||
| 
						 | 
					0f7814264c | ||
| 
						 | 
					c0e8400361 | ||
| 
						 | 
					c63dda22dd | ||
| 
						 | 
					9648b588b4 | ||
| 
						 | 
					f190a16e5e | ||
| 
						 | 
					9eaa953642 | ||
| 
						 | 
					826215bec2 | ||
| 
						 | 
					87f487f6ce | ||
| 
						 | 
					2734345095 | ||
| 
						 | 
					b2d2b30a13 | ||
| 
						 | 
					4089dea451 | ||
| 
						 | 
					66d71c8f13 | ||
| 
						 | 
					aff37491a1 | ||
| 
						 | 
					f0f052f28d | ||
| 
						 | 
					3622c73cfc | ||
| 
						 | 
					9ab8851756 | ||
| 
						 | 
					c41e2216f4 | ||
| 
						 | 
					5a16e92eb5 | ||
| 
						 | 
					ed0570bf0c | ||
| 
						 | 
					1cae8da8e7 | ||
| 
						 | 
					c34bdc957c | ||
| 
						 | 
					2d5d80985e | ||
| 
						 | 
					399f54c133 | ||
| 
						 | 
					ae554abd41 | ||
| 
						 | 
					f0a9cd7847 | ||
| 
						 | 
					6cdf8dd025 | ||
| 
						 | 
					4fbb1569f5 | ||
| 
						 | 
					95114ff5c5 | ||
| 
						 | 
					be02504f5f | ||
| 
						 | 
					b5d5173139 | ||
| 
						 | 
					b28c547aa4 | ||
| 
						 | 
					7f1464c03c | ||
| 
						 | 
					eab85a379d | ||
| 
						 | 
					04373fe6fe | ||
| 
						 | 
					4dc7206c94 | ||
| 
						 | 
					326e4037e9 | ||
| 
						 | 
					2e223d208f | ||
| 
						 | 
					4137d67cde | ||
| 
						 | 
					6a3d9af46e | ||
| 
						 | 
					100e313c75 | ||
| 
						 | 
					0a2d31838f | ||
| 
						 | 
					1be6e685a5 | ||
| 
						 | 
					0147bd2f78 | ||
| 
						 | 
					f680b0f404 | ||
| 
						 | 
					2fb6457efb | ||
| 
						 | 
					23042bab43 | ||
| 
						 | 
					a638642f44 | ||
| 
						 | 
					51d1a14c80 | ||
| 
						 | 
					0647355bef | ||
| 
						 | 
					25b3416960 | ||
| 
						 | 
					7c7609f95e | ||
| 
						 | 
					c08088376a | ||
| 
						 | 
					9f3c0d32a4 | ||
| 
						 | 
					2b83e0e67e | ||
| 
						 | 
					f9355bc5cd | ||
| 
						 | 
					e06f77dce0 | ||
| 
						 | 
					284de14ebb | ||
| 
						 | 
					dcc80e127c | ||
| 
						 | 
					73b5a72134 | ||
| 
						 | 
					5c5b720d81 | ||
| 
						 | 
					41bb2eb806 | ||
| 
						 | 
					7379f525be | ||
| 
						 | 
					0e4065e8c7 | ||
| 
						 | 
					62466a55bf | ||
| 
						 | 
					cd1fb029eb | ||
| 
						 | 
					07ab5cbbed | ||
| 
						 | 
					6a163a1bf1 | ||
| 
						 | 
					8631744c49 | ||
| 
						 | 
					4aebbf63c3 | ||
| 
						 | 
					ce061964f7 | ||
| 
						 | 
					9f7d6840da | ||
| 
						 | 
					9a78257905 | ||
| 
						 | 
					218c7f5dbe | ||
| 
						 | 
					b8ceb988ea | ||
| 
						 | 
					e290cd1606 | ||
| 
						 | 
					20599f5c9e | ||
| 
						 | 
					62fd0b699a | ||
| 
						 | 
					d203fba8f0 | ||
| 
						 | 
					b3cbcb3547 | ||
| 
						 | 
					b35a90d682 | ||
| 
						 | 
					593315c327 | ||
| 
						 | 
					f28d8d7042 | ||
| 
						 | 
					c99828169b | ||
| 
						 | 
					58deb845c5 | ||
| 
						 | 
					1c24c54840 | ||
| 
						 | 
					457e60a2f8 | ||
| 
						 | 
					bc30d0a798 | ||
| 
						 | 
					db18cbdd85 | ||
| 
						 | 
					ec0d2a86b7 | ||
| 
						 | 
					48468f258a | ||
| 
						 | 
					3ee5775a0f | ||
| 
						 | 
					6b08ed7937 | ||
| 
						 | 
					5f517ce256 | ||
| 
						 | 
					839ae785d8 | ||
| 
						 | 
					a4e3391db2 | ||
| 
						 | 
					6709aba126 | ||
| 
						 | 
					35c3408b0d | ||
| 
						 | 
					5fe555ecac | ||
| 
						 | 
					72758a138e | ||
| 
						 | 
					31abfc3a98 | ||
| 
						 | 
					230752b861 | ||
| 
						 | 
					e59f4c31cb | ||
| 
						 | 
					9416782be5 | ||
| 
						 | 
					97b9643c5b | ||
| 
						 | 
					c64bb00cdf | ||
| 
						 | 
					953de64819 | ||
| 
						 | 
					47cac977f5 | ||
| 
						 | 
					80921057d4 | ||
| 
						 | 
					5006660be8 | ||
| 
						 | 
					99696a9373 | ||
| 
						 | 
					995f8c925f | ||
| 
						 | 
					bbe3d3916f | ||
| 
						 | 
					b46a1d8890 | ||
| 
						 | 
					e2862bb984 | ||
| 
						 | 
					2bdfdfbf09 | ||
| 
						 | 
					3985fbb348 | ||
| 
						 | 
					3487c9b4a8 | ||
| 
						 | 
					98b62860cf | ||
| 
						 | 
					92042e8b91 | ||
| 
						 | 
					0b8770ccbd | ||
| 
						 | 
					6acc9d10e2 | ||
| 
						 | 
					4beae98ae0 | ||
| 
						 | 
					d03266b2b7 | ||
| 
						 | 
					758b1c46fb | ||
| 
						 | 
					230df050ed | ||
| 
						 | 
					1f6639a1bf | ||
| 
						 | 
					342e174b24 | ||
| 
						 | 
					cd6fd2f14d | ||
| 
						 | 
					4b027b381f | ||
| 
						 | 
					0a14d9f5c8 | ||
| 
						 | 
					4628d2f6bb | ||
| 
						 | 
					26145cfc18 | ||
| 
						 | 
					1d16b89289 | ||
| 
						 | 
					b8d2695c82 | ||
| 
						 | 
					0681b2e477 | ||
| 
						 | 
					c05ca5f058 | ||
| 
						 | 
					cc9f4d56c0 | ||
| 
						 | 
					422bb8b5c4 | ||
| 
						 | 
					ea4900b89a | ||
| 
						 | 
					8af9d9a7d0 | ||
| 
						 | 
					6bdc30e923 | ||
| 
						 | 
					a10b277de2 | ||
| 
						 | 
					0febe091a5 | ||
| 
						 | 
					d52075bd97 | ||
| 
						 | 
					50b4523380 | ||
| 
						 | 
					71c9a05614 | ||
| 
						 | 
					66c033868f | ||
| 
						 | 
					4a5ab7a191 | ||
| 
						 | 
					79f3698f39 | ||
| 
						 | 
					5dcf871abb | ||
| 
						 | 
					f574ce603a | ||
| 
						 | 
					259f4a1503 | ||
| 
						 | 
					dd8cd5d6bc | ||
| 
						 | 
					c97c5fc788 | ||
| 
						 | 
					6a80cc9e08 | ||
| 
						 | 
					d7a941f210 | ||
| 
						 | 
					4a20a7f77c | ||
| 
						 | 
					63c16f85c5 | ||
| 
						 | 
					c383a32926 | ||
| 
						 | 
					1bb1aea178 | ||
| 
						 | 
					c2817899e4 | ||
| 
						 | 
					75501a17f2 | ||
| 
						 | 
					b17cd156b5 | ||
| 
						 | 
					cb221a5cbe | ||
| 
						 | 
					444a2bf314 | ||
| 
						 | 
					f1e95d935f | ||
| 
						 | 
					1ab6f486de | ||
| 
						 | 
					a8e76ddf9e | ||
| 
						 | 
					40805076f9 | ||
| 
						 | 
					baa35efba8 | ||
| 
						 | 
					6dd6634bf6 | ||
| 
						 | 
					60ca41ebb7 | ||
| 
						 | 
					fa844eff32 | ||
| 
						 | 
					31096ceb79 | ||
| 
						 | 
					6f2e8f9878 | ||
| 
						 | 
					dec42d9112 | ||
| 
						 | 
					839c4f1eb6 | ||
| 
						 | 
					b11eaaed35 | ||
| 
						 | 
					15b3aef581 | ||
| 
						 | 
					031226a9fd | ||
| 
						 | 
					7478b0bfa6 | ||
| 
						 | 
					65f12237b8 | ||
| 
						 | 
					889a706637 | ||
| 
						 | 
					855a3779be | ||
| 
						 | 
					36c27b547e | ||
| 
						 | 
					967c9f7fcb | ||
| 
						 | 
					fccadc38bd | ||
| 
						 | 
					963a8fc036 | ||
| 
						 | 
					3a6e56534d | ||
| 
						 | 
					2a258c9f2d | ||
| 
						 | 
					543960121c | ||
| 
						 | 
					96ca71a7a6 | ||
| 
						 | 
					338d3fbc8b | ||
| 
						 | 
					0f004be596 | ||
| 
						 | 
					120e7fbeb9 | ||
| 
						 | 
					d8b46b7bc4 | ||
| 
						 | 
					a68c57ee5f | ||
| 
						 | 
					f40c69c259 | ||
| 
						 | 
					1e52e79b70 | ||
| 
						 | 
					aaba380787 | ||
| 
						 | 
					43ef6784df | ||
| 
						 | 
					d18f341398 | ||
| 
						 | 
					761ba27d62 | ||
| 
						 | 
					beb349348e | 
@@ -62,7 +62,6 @@ libc_common_src_files := \
 | 
			
		||||
	string/strcspn.c \
 | 
			
		||||
	string/strdup.c \
 | 
			
		||||
	string/strpbrk.c \
 | 
			
		||||
	string/__strrchr_chk.c \
 | 
			
		||||
	string/strsep.c \
 | 
			
		||||
	string/strspn.c \
 | 
			
		||||
	string/strstr.c \
 | 
			
		||||
@@ -105,6 +104,7 @@ libc_common_src_files := \
 | 
			
		||||
	bionic/md5.c \
 | 
			
		||||
	bionic/memmem.c \
 | 
			
		||||
	bionic/memswap.c \
 | 
			
		||||
	bionic/name_mem.c \
 | 
			
		||||
	bionic/openat.c \
 | 
			
		||||
	bionic/open.c \
 | 
			
		||||
	bionic/pathconf.c \
 | 
			
		||||
@@ -181,6 +181,25 @@ libc_common_src_files := \
 | 
			
		||||
	netbsd/nameser/ns_print.c \
 | 
			
		||||
	netbsd/nameser/ns_samedomain.c \
 | 
			
		||||
 | 
			
		||||
# Fortify implementations of libc functions.
 | 
			
		||||
libc_common_src_files += \
 | 
			
		||||
    bionic/__fgets_chk.cpp \
 | 
			
		||||
    bionic/__memcpy_chk.cpp \
 | 
			
		||||
    bionic/__memmove_chk.cpp \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
    bionic/__strchr_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/__strlcat_chk.cpp \
 | 
			
		||||
    bionic/__strlcpy_chk.cpp \
 | 
			
		||||
    bionic/__strlen_chk.cpp \
 | 
			
		||||
    bionic/__strncat_chk.cpp \
 | 
			
		||||
    bionic/__strncpy_chk.cpp \
 | 
			
		||||
    bionic/__strrchr_chk.cpp \
 | 
			
		||||
    bionic/__umask_chk.cpp \
 | 
			
		||||
    bionic/__vsnprintf_chk.cpp \
 | 
			
		||||
    bionic/__vsprintf_chk.cpp \
 | 
			
		||||
 | 
			
		||||
libc_bionic_src_files := \
 | 
			
		||||
    bionic/abort.cpp \
 | 
			
		||||
    bionic/assert.cpp \
 | 
			
		||||
@@ -189,15 +208,12 @@ libc_bionic_src_files := \
 | 
			
		||||
    bionic/__errno.c \
 | 
			
		||||
    bionic/eventfd_read.cpp \
 | 
			
		||||
    bionic/eventfd_write.cpp \
 | 
			
		||||
    bionic/__fgets_chk.cpp \
 | 
			
		||||
    bionic/futimens.cpp \
 | 
			
		||||
    bionic/getauxval.cpp \
 | 
			
		||||
    bionic/getcwd.cpp \
 | 
			
		||||
    bionic/libc_init_common.cpp \
 | 
			
		||||
    bionic/libc_logging.cpp \
 | 
			
		||||
    bionic/libgen.cpp \
 | 
			
		||||
    bionic/__memcpy_chk.cpp \
 | 
			
		||||
    bionic/__memmove_chk.cpp \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/mmap.cpp \
 | 
			
		||||
    bionic/pthread_attr.cpp \
 | 
			
		||||
    bionic/pthread_detach.cpp \
 | 
			
		||||
@@ -220,24 +236,13 @@ libc_bionic_src_files := \
 | 
			
		||||
    bionic/signalfd.cpp \
 | 
			
		||||
    bionic/sigwait.cpp \
 | 
			
		||||
    bionic/statvfs.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
    bionic/__strchr_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/strerror.cpp \
 | 
			
		||||
    bionic/strerror_r.cpp \
 | 
			
		||||
    bionic/__strlcat_chk.cpp \
 | 
			
		||||
    bionic/__strlcpy_chk.cpp \
 | 
			
		||||
    bionic/__strlen_chk.cpp \
 | 
			
		||||
    bionic/__strncat_chk.cpp \
 | 
			
		||||
    bionic/__strncpy_chk.cpp \
 | 
			
		||||
    bionic/strsignal.cpp \
 | 
			
		||||
    bionic/stubs.cpp \
 | 
			
		||||
    bionic/sysconf.cpp \
 | 
			
		||||
    bionic/tdestroy.cpp \
 | 
			
		||||
    bionic/tmpfile.cpp \
 | 
			
		||||
    bionic/__umask_chk.cpp \
 | 
			
		||||
    bionic/__vsnprintf_chk.cpp \
 | 
			
		||||
    bionic/__vsprintf_chk.cpp \
 | 
			
		||||
    bionic/wait.cpp \
 | 
			
		||||
    bionic/wchar.cpp \
 | 
			
		||||
 | 
			
		||||
@@ -282,7 +287,12 @@ libc_upstream_freebsd_src_files := \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/tempnam.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/tmpnam.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/wsetup.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/abs.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/getopt_long.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/imaxabs.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/imaxdiv.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/labs.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/llabs.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/qsort.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/realpath.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcpcpy.c \
 | 
			
		||||
@@ -357,7 +367,6 @@ libc_common_src_files += \
 | 
			
		||||
	bionic/memmove.c.arm \
 | 
			
		||||
	string/bcopy.c \
 | 
			
		||||
	string/strncmp.c \
 | 
			
		||||
	string/strcat.c \
 | 
			
		||||
	string/strncat.c \
 | 
			
		||||
	string/strncpy.c \
 | 
			
		||||
	bionic/strchr.cpp \
 | 
			
		||||
@@ -800,6 +809,9 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
 | 
			
		||||
    libc_tzcode
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
 | 
			
		||||
# TODO: split out the asflags.
 | 
			
		||||
LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
 | 
			
		||||
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,6 @@ _LIBC_ARCH_COMMON_SRC_FILES := \
 | 
			
		||||
    arch-arm/bionic/_setjmp.S \
 | 
			
		||||
    arch-arm/bionic/setjmp.S \
 | 
			
		||||
    arch-arm/bionic/sigsetjmp.S \
 | 
			
		||||
    arch-arm/bionic/strcpy.S \
 | 
			
		||||
    arch-arm/bionic/syscall.S \
 | 
			
		||||
    arch-arm/bionic/tgkill.S \
 | 
			
		||||
    arch-arm/bionic/tkill.S \
 | 
			
		||||
@@ -27,6 +26,17 @@ _LIBC_ARCH_STATIC_SRC_FILES := \
 | 
			
		||||
_LIBC_ARCH_DYNAMIC_SRC_FILES := \
 | 
			
		||||
    arch-arm/bionic/exidx_dynamic.c
 | 
			
		||||
 | 
			
		||||
# Remove the C++ fortify function implementations for which there is an
 | 
			
		||||
# arm assembler version.
 | 
			
		||||
_LIBC_FORTIFY_FILES_TO_REMOVE := \
 | 
			
		||||
    bionic/__memcpy_chk.cpp \
 | 
			
		||||
    bionic/__memset_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
 | 
			
		||||
libc_common_src_files := \
 | 
			
		||||
    $(filter-out $(_LIBC_FORTIFY_FILES_TO_REMOVE),$(libc_common_src_files))
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(wildcard bionic/libc/arch-arm/$(TARGET_CPU_VARIANT)/$(TARGET_CPU_VARIANT).mk)),)
 | 
			
		||||
$(error "TARGET_CPU_VARIANT not set or set to an unknown value. Possible values are cortex-a7, cortex-a8, cortex-a9, cortex-a15, krait. Use generic for devices that do not have a CPU similar to any of the supported cpu variants.")
 | 
			
		||||
endif
 | 
			
		||||
 
 | 
			
		||||
@@ -30,8 +30,8 @@
 | 
			
		||||
 * dynamic linker to copy their definition into the final libc.so binary.
 | 
			
		||||
 *
 | 
			
		||||
 * They are required to ensure backwards binary compatibility with
 | 
			
		||||
 * Android 1.5, 1.6 and even 3.0  system images. Some applications built
 | 
			
		||||
 * using the NDK require them to be here.
 | 
			
		||||
 * libc.so provided by the platform and binaries built with the NDK or
 | 
			
		||||
 * different versions/configurations of toolchains.
 | 
			
		||||
 *
 | 
			
		||||
 * Now, for a more elaborate description of the issue:
 | 
			
		||||
 *
 | 
			
		||||
@@ -48,7 +48,9 @@
 | 
			
		||||
 *         gcc <options> -o libfoo.so  foo.a libgcc.a -lc -lm
 | 
			
		||||
 *
 | 
			
		||||
 * This ensures that any helper function needed by the code in foo.a is copied
 | 
			
		||||
 * into the final libfoo.so. Unfortunately, the Android build system has been
 | 
			
		||||
 * into the final libfoo.so. However, doing so will link a bunch of other __cxa
 | 
			
		||||
 * functions from libgcc.a into each .so and executable, causing 4k+ increase
 | 
			
		||||
 * in every binary. Therefore the Android platform build system has been
 | 
			
		||||
 * using this instead:
 | 
			
		||||
 *
 | 
			
		||||
 *         gcc <options> -o libfoo.so foo.a -lc -lm libgcc.a
 | 
			
		||||
@@ -58,9 +60,10 @@
 | 
			
		||||
 * into libfoo.so. Instead, a symbol import definition will be added to it
 | 
			
		||||
 * so libfoo.so can directly call the one in libc.so at runtime.
 | 
			
		||||
 *
 | 
			
		||||
 * When changing toolchains for 2.0, the set of helper functions copied to
 | 
			
		||||
 * libc.so changed, which resulted in some native shared libraries generated
 | 
			
		||||
 * with the NDK to fail to load properly.
 | 
			
		||||
 * When refreshing toolchains for new versions or using different architecture
 | 
			
		||||
 * flags, the set of helper functions copied to libc.so may change, which
 | 
			
		||||
 * resulted in some native shared libraries generated with the NDK or prebuilts
 | 
			
		||||
 * from vendors to fail to load properly.
 | 
			
		||||
 *
 | 
			
		||||
 * The NDK has been fixed after 1.6_r1 to use the correct link command, so
 | 
			
		||||
 * any native shared library generated with it should now be safe from that
 | 
			
		||||
@@ -73,6 +76,11 @@
 | 
			
		||||
 * but it is easier to add a single function here than asking several app
 | 
			
		||||
 * developers to fix their build.
 | 
			
		||||
 *
 | 
			
		||||
 * The __aeabi_idiv function is added to the list since cortex-a15 supports
 | 
			
		||||
 * HW idiv instructions so the system libc.so doesn't pull in the reference to
 | 
			
		||||
 * __aeabi_idiv but legacy libraries built against cortex-a9 targets still need
 | 
			
		||||
 * it.
 | 
			
		||||
 *
 | 
			
		||||
 * Final note: some of the functions below should really be in libm.so to
 | 
			
		||||
 *             completely reflect the state of 1.5/1.6 system images. However,
 | 
			
		||||
 *             since libm.so depends on libc.so, it's easier to put all of
 | 
			
		||||
@@ -113,6 +121,7 @@
 | 
			
		||||
    XX(__aeabi_idiv)         \
 | 
			
		||||
    XX(__aeabi_l2d)          \
 | 
			
		||||
    XX(__aeabi_l2f)          \
 | 
			
		||||
    XX(__aeabi_lasr)         \
 | 
			
		||||
    XX(__aeabi_lmul)         \
 | 
			
		||||
    XX(__aeabi_llsl)         \
 | 
			
		||||
    XX(__aeabi_llsr)         \
 | 
			
		||||
@@ -123,7 +132,7 @@
 | 
			
		||||
    XX(__cmpdf2)             \
 | 
			
		||||
    XX(__divdf3)             \
 | 
			
		||||
    XX(__divsf3)             \
 | 
			
		||||
    XX(__eqdf2)             \
 | 
			
		||||
    XX(__eqdf2)              \
 | 
			
		||||
    XX(__extendsfdf2)        \
 | 
			
		||||
    XX(__fixdfsi)            \
 | 
			
		||||
    XX(__fixsfsi)            \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										227
									
								
								libc/arch-arm/cortex-a15/bionic/__strcat_chk.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										227
									
								
								libc/arch-arm/cortex-a15/bionic/__strcat_chk.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,227 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
 | 
			
		||||
    .thumb
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
// Get the length of src string, then get the source of the dst string.
 | 
			
		||||
// Check that the two lengths together don't exceed the threshold, then
 | 
			
		||||
// do a memcpy of the data.
 | 
			
		||||
ENTRY(__strcat_chk)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
    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
 | 
			
		||||
 | 
			
		||||
    mov     lr, r2
 | 
			
		||||
 | 
			
		||||
    // Save the dst register to r5
 | 
			
		||||
    mov     r5, r0
 | 
			
		||||
 | 
			
		||||
    // Zero out r4
 | 
			
		||||
    eor     r4, r4, r4
 | 
			
		||||
 | 
			
		||||
    // r1 contains the address of the string to count.
 | 
			
		||||
.L_strlen_start:
 | 
			
		||||
    mov     r0, r1
 | 
			
		||||
    ands    r3, r1, #7
 | 
			
		||||
    beq     .L_mainloop
 | 
			
		||||
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     .L_align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
 | 
			
		||||
.L_align_to_32:
 | 
			
		||||
    bcc     .L_align_to_64
 | 
			
		||||
    ands    ip, r3, #2
 | 
			
		||||
    beq     .L_align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
 | 
			
		||||
.L_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     .L_mainloop
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
.L_mainloop:
 | 
			
		||||
    ldrd    r2, r3, [r1], #8
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
    b       .L_mainloop
 | 
			
		||||
 | 
			
		||||
.L_update_count_and_finish:
 | 
			
		||||
    sub     r3, r1, r0
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_zero_in_first_register:
 | 
			
		||||
    sub     r3, r1, r0
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    bne     .L_sub8_and_finish
 | 
			
		||||
    bcs     .L_sub7_and_finish
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     .L_sub6_and_finish
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #5
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub8_and_finish:
 | 
			
		||||
    sub     r3, r3, #8
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub7_and_finish:
 | 
			
		||||
    sub     r3, r3, #7
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub6_and_finish:
 | 
			
		||||
    sub     r3, r3, #6
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_zero_in_second_register:
 | 
			
		||||
    sub     r3, r1, r0
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    bne     .L_sub4_and_finish
 | 
			
		||||
    bcs     .L_sub3_and_finish
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     .L_sub2_and_finish
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub4_and_finish:
 | 
			
		||||
    sub     r3, r3, #4
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub3_and_finish:
 | 
			
		||||
    sub     r3, r3, #3
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub2_and_finish:
 | 
			
		||||
    sub     r3, r3, #2
 | 
			
		||||
 | 
			
		||||
.L_finish:
 | 
			
		||||
    cmp     r4, #0
 | 
			
		||||
    bne     .L_strlen_done
 | 
			
		||||
 | 
			
		||||
    // Time to get the dst string length.
 | 
			
		||||
    mov     r1, r5
 | 
			
		||||
 | 
			
		||||
    // Save the original source address to r5.
 | 
			
		||||
    mov     r5, r0
 | 
			
		||||
 | 
			
		||||
    // Save the current length (adding 1 for the terminator).
 | 
			
		||||
    add     r4, r3, #1
 | 
			
		||||
    b       .L_strlen_start
 | 
			
		||||
 | 
			
		||||
    // r0 holds the pointer to the dst string.
 | 
			
		||||
    // r3 holds the dst string length.
 | 
			
		||||
    // r4 holds the src string length + 1.
 | 
			
		||||
.L_strlen_done:
 | 
			
		||||
    add     r2, r3, r4
 | 
			
		||||
    cmp     r2, lr
 | 
			
		||||
    bhi     __strcat_chk_failed
 | 
			
		||||
 | 
			
		||||
    // Set up the registers for the memcpy code.
 | 
			
		||||
    mov     r1, r5
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
    mov     r2, r4
 | 
			
		||||
    add     r0, r0, r3
 | 
			
		||||
    pop     {r4, r5}
 | 
			
		||||
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(__strcat_chk)
 | 
			
		||||
 | 
			
		||||
#define MEMCPY_BASE         __strcat_chk_memcpy_base
 | 
			
		||||
#define MEMCPY_BASE_ALIGNED __strcat_chk_memcpy_base_aligned
 | 
			
		||||
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY(__strcat_chk_failed)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .save   {r4, r5}
 | 
			
		||||
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
    .cfi_adjust_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r4, 0
 | 
			
		||||
    .cfi_rel_offset r5, 4
 | 
			
		||||
 | 
			
		||||
    ldr     r0, error_message
 | 
			
		||||
    ldr     r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
    add     r0, pc
 | 
			
		||||
    bl      __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
    .word   BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
    .word   error_string-(1b+4)
 | 
			
		||||
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(__strcat_chk_failed)
 | 
			
		||||
 | 
			
		||||
    .data
 | 
			
		||||
error_string:
 | 
			
		||||
    .string "strcat buffer overflow"
 | 
			
		||||
							
								
								
									
										188
									
								
								libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										188
									
								
								libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,188 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
 | 
			
		||||
    .thumb
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
// Get the length of the source string first, then do a memcpy of the data
 | 
			
		||||
// instead of a strcpy.
 | 
			
		||||
ENTRY(__strcpy_chk)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    push    {r0, lr}
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
    mov     lr, r2
 | 
			
		||||
    mov     r0, r1
 | 
			
		||||
 | 
			
		||||
    ands    r3, r1, #7
 | 
			
		||||
    beq     .L_mainloop
 | 
			
		||||
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     .L_align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
 | 
			
		||||
.L_align_to_32:
 | 
			
		||||
    bcc     .L_align_to_64
 | 
			
		||||
    ands    ip, r3, #2
 | 
			
		||||
    beq     .L_align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
 | 
			
		||||
.L_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     .L_mainloop
 | 
			
		||||
    ldr     r3, [r0], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
.L_mainloop:
 | 
			
		||||
    ldrd    r2, r3, [r0], #8
 | 
			
		||||
 | 
			
		||||
    pld     [r0, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
    b       .L_mainloop
 | 
			
		||||
 | 
			
		||||
.L_update_count_and_finish:
 | 
			
		||||
    sub     r3, r0, r1
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_zero_in_first_register:
 | 
			
		||||
    sub     r3, r0, r1
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    bne     .L_sub8_and_finish
 | 
			
		||||
    bcs     .L_sub7_and_finish
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     .L_sub6_and_finish
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #5
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub8_and_finish:
 | 
			
		||||
    sub     r3, r3, #8
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub7_and_finish:
 | 
			
		||||
    sub     r3, r3, #7
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub6_and_finish:
 | 
			
		||||
    sub     r3, r3, #6
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_zero_in_second_register:
 | 
			
		||||
    sub     r3, r0, r1
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    bne     .L_sub4_and_finish
 | 
			
		||||
    bcs     .L_sub3_and_finish
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     .L_sub2_and_finish
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub4_and_finish:
 | 
			
		||||
    sub     r3, r3, #4
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub3_and_finish:
 | 
			
		||||
    sub     r3, r3, #3
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub2_and_finish:
 | 
			
		||||
    sub     r3, r3, #2
 | 
			
		||||
 | 
			
		||||
.L_check_size:
 | 
			
		||||
    pld     [r1, #0]
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
    ldr     r0, [sp]
 | 
			
		||||
    cmp     r3, lr
 | 
			
		||||
    bhs     __strcpy_chk_failed
 | 
			
		||||
 | 
			
		||||
    // Add 1 for copy length to get the string terminator.
 | 
			
		||||
    add     r2, r3, #1
 | 
			
		||||
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(__strcpy_chk)
 | 
			
		||||
 | 
			
		||||
#define MEMCPY_BASE         __strcpy_chk_memcpy_base
 | 
			
		||||
#define MEMCPY_BASE_ALIGNED __strcpy_chk_memcpy_base_aligned
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY(__strcpy_chk_failed)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
    ldr     r0, error_message
 | 
			
		||||
    ldr     r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
    add     r0, pc
 | 
			
		||||
    bl      __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
    .word   BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
    .word   error_string-(1b+4)
 | 
			
		||||
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(__strcpy_chk_failed)
 | 
			
		||||
 | 
			
		||||
    .data
 | 
			
		||||
error_string:
 | 
			
		||||
    .string "strcpy buffer overflow"
 | 
			
		||||
@@ -53,272 +53,60 @@
 | 
			
		||||
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
    /* Prototype: void *memcpy (void *dst, const void *src, size_t count).  */
 | 
			
		||||
// Prototype: void *memcpy (void *dst, const void *src, size_t count).
 | 
			
		||||
 | 
			
		||||
        // This version is tuned for the Cortex-A15 processor.
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
        .text
 | 
			
		||||
        .syntax unified
 | 
			
		||||
        .fpu    neon
 | 
			
		||||
 | 
			
		||||
#define CACHE_LINE_SIZE 64
 | 
			
		||||
ENTRY(__memcpy_chk)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        cmp     r2, r3
 | 
			
		||||
        bhi     __memcpy_chk_fail
 | 
			
		||||
 | 
			
		||||
        // Fall through to memcpy...
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(__memcpy_chk)
 | 
			
		||||
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
        // Assumes that n >= 0, and dst, src are valid pointers.
 | 
			
		||||
        // For any sizes less than 832 use the neon code that doesn't
 | 
			
		||||
        // care about the src alignment. This avoids any checks
 | 
			
		||||
        // for src alignment, and offers the best improvement since
 | 
			
		||||
        // smaller sized copies are dominated by the overhead of
 | 
			
		||||
        // the pre and post main loop.
 | 
			
		||||
        // For larger copies, if src and dst cannot both be aligned to
 | 
			
		||||
        // word boundaries, use the neon code.
 | 
			
		||||
        // For all other copies, align dst to a double word boundary
 | 
			
		||||
        // and copy using LDRD/STRD instructions.
 | 
			
		||||
 | 
			
		||||
        // Save registers (r0 holds the return value):
 | 
			
		||||
        // optimized push {r0, lr}.
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        pld     [r1, #(CACHE_LINE_SIZE*16)]
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        pld     [r1, #64]
 | 
			
		||||
        push    {r0, lr}
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
        cmp     r2, #16
 | 
			
		||||
        blo     copy_less_than_16_unknown_align
 | 
			
		||||
 | 
			
		||||
        cmp     r2, #832
 | 
			
		||||
        bge     check_alignment
 | 
			
		||||
 | 
			
		||||
copy_unknown_alignment:
 | 
			
		||||
        // Unknown alignment of src and dst.
 | 
			
		||||
        // Assumes that the first few bytes have already been prefetched.
 | 
			
		||||
 | 
			
		||||
        // Align destination to 128 bits. The mainloop store instructions
 | 
			
		||||
        // require this alignment or they will throw an exception.
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #0xF
 | 
			
		||||
        beq         2f
 | 
			
		||||
 | 
			
		||||
        // Copy up to 15 bytes (count in r3).
 | 
			
		||||
        sub         r2, r2, r3
 | 
			
		||||
        movs        ip, r3, lsl #31
 | 
			
		||||
 | 
			
		||||
        itt         mi
 | 
			
		||||
        ldrbmi      lr, [r1], #1
 | 
			
		||||
        strbmi      lr, [r0], #1
 | 
			
		||||
        itttt       cs
 | 
			
		||||
        ldrbcs      ip, [r1], #1
 | 
			
		||||
        ldrbcs      lr, [r1], #1
 | 
			
		||||
        strbcs      ip, [r0], #1
 | 
			
		||||
        strbcs      lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        movs        ip, r3, lsl #29
 | 
			
		||||
        bge         1f
 | 
			
		||||
        // Copies 4 bytes, dst 32 bits aligned before, at least 64 bits after.
 | 
			
		||||
        vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
 | 
			
		||||
        vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]!
 | 
			
		||||
1:      bcc         2f
 | 
			
		||||
        // Copies 8 bytes, dst 64 bits aligned before, at least 128 bits after.
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0, :64]!
 | 
			
		||||
 | 
			
		||||
2:      // Make sure we have at least 64 bytes to copy.
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        blo         2f
 | 
			
		||||
 | 
			
		||||
1:      // The main loop copies 64 bytes at a time.
 | 
			
		||||
        vld1.8      {d0  - d3},   [r1]!
 | 
			
		||||
        vld1.8      {d4  - d7},   [r1]!
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*4)]
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        vst1.8      {d0  - d3},   [r0, :128]!
 | 
			
		||||
        vst1.8      {d4  - d7},   [r0, :128]!
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
2:      // Fix-up the remaining count and make sure we have >= 32 bytes left.
 | 
			
		||||
        adds        r2, r2, #32
 | 
			
		||||
        blo         3f
 | 
			
		||||
 | 
			
		||||
        // 32 bytes. These cache lines were already preloaded.
 | 
			
		||||
        vld1.8      {d0 - d3},  [r1]!
 | 
			
		||||
        sub         r2, r2, #32
 | 
			
		||||
        vst1.8      {d0 - d3},  [r0, :128]!
 | 
			
		||||
3:      // Less than 32 left.
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
        tst         r2, #0x10
 | 
			
		||||
        beq         copy_less_than_16_unknown_align
 | 
			
		||||
        // Copies 16 bytes, destination 128 bits aligned.
 | 
			
		||||
        vld1.8      {d0, d1}, [r1]!
 | 
			
		||||
        vst1.8      {d0, d1}, [r0, :128]!
 | 
			
		||||
 | 
			
		||||
copy_less_than_16_unknown_align:
 | 
			
		||||
        // Copy up to 15 bytes (count in r2).
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
        bcc         1f
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0]!
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
 | 
			
		||||
        vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0]!
 | 
			
		||||
 | 
			
		||||
2:      // Copy 0 to 4 bytes.
 | 
			
		||||
        lsls        r2, r2, #31
 | 
			
		||||
        itt         ne
 | 
			
		||||
        ldrbne      lr, [r1], #1
 | 
			
		||||
        strbne      lr, [r0], #1
 | 
			
		||||
        itttt       cs
 | 
			
		||||
        ldrbcs      ip, [r1], #1
 | 
			
		||||
        ldrbcs      lr, [r1]
 | 
			
		||||
        strbcs      ip, [r0], #1
 | 
			
		||||
        strbcs      lr, [r0]
 | 
			
		||||
 | 
			
		||||
        pop         {r0, pc}
 | 
			
		||||
 | 
			
		||||
check_alignment:
 | 
			
		||||
        // If src and dst cannot both be aligned to a word boundary,
 | 
			
		||||
        // use the unaligned copy version.
 | 
			
		||||
        eor     r3, r0, r1
 | 
			
		||||
        ands    r3, r3, #0x3
 | 
			
		||||
        bne     copy_unknown_alignment
 | 
			
		||||
 | 
			
		||||
        // To try and improve performance, stack layout changed,
 | 
			
		||||
        // i.e., not keeping the stack looking like users expect
 | 
			
		||||
        // (highest numbered register at highest address).
 | 
			
		||||
        // TODO: Add debug frame directives.
 | 
			
		||||
        // We don't need exception unwind directives, because the code below
 | 
			
		||||
        // does not throw any exceptions and does not call any other functions.
 | 
			
		||||
        // Generally, newlib functions like this lack debug information for
 | 
			
		||||
        // assembler source.
 | 
			
		||||
        .save   {r4, r5}
 | 
			
		||||
        strd    r4, r5, [sp, #-8]!
 | 
			
		||||
        .save   {r6, r7}
 | 
			
		||||
        strd    r6, r7, [sp, #-8]!
 | 
			
		||||
        .save   {r8, r9}
 | 
			
		||||
        strd    r8, r9, [sp, #-8]!
 | 
			
		||||
 | 
			
		||||
        // Optimized for already aligned dst code.
 | 
			
		||||
        ands    ip, r0, #3
 | 
			
		||||
        bne     dst_not_word_aligned
 | 
			
		||||
 | 
			
		||||
word_aligned:
 | 
			
		||||
        // Align the destination buffer to 8 bytes, to make sure double
 | 
			
		||||
        // loads and stores don't cross a cache line boundary,
 | 
			
		||||
        // as they are then more expensive even if the data is in the cache
 | 
			
		||||
        // (require two load/store issue cycles instead of one).
 | 
			
		||||
        // If only one of the buffers is not 8 bytes aligned,
 | 
			
		||||
        // then it's more important to align dst than src,
 | 
			
		||||
        // because there is more penalty for stores
 | 
			
		||||
        // than loads that cross a cacheline boundary.
 | 
			
		||||
        // This check and realignment are only done if there is >= 832
 | 
			
		||||
        // bytes to copy.
 | 
			
		||||
 | 
			
		||||
        // Dst is word aligned, but check if it is already double word aligned.
 | 
			
		||||
        ands    r3, r0, #4
 | 
			
		||||
        beq     1f
 | 
			
		||||
        ldr     r3, [r1], #4
 | 
			
		||||
        str     r3, [r0], #4
 | 
			
		||||
        sub     r2, #4
 | 
			
		||||
 | 
			
		||||
1:      // Can only get here if > 64 bytes to copy, so don't do check r2.
 | 
			
		||||
        sub     r2, #64
 | 
			
		||||
 | 
			
		||||
2:      // Every loop iteration copies 64 bytes.
 | 
			
		||||
        .irp    offset, #0, #8, #16, #24, #32
 | 
			
		||||
        ldrd    r4, r5, [r1, \offset]
 | 
			
		||||
        strd    r4, r5, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
 | 
			
		||||
        ldrd    r4, r5, [r1, #40]
 | 
			
		||||
        ldrd    r6, r7, [r1, #48]
 | 
			
		||||
        ldrd    r8, r9, [r1, #56]
 | 
			
		||||
 | 
			
		||||
        // Keep the pld as far from the next load as possible.
 | 
			
		||||
        // The amount to prefetch was determined experimentally using
 | 
			
		||||
        // large sizes, and verifying the prefetch size does not affect
 | 
			
		||||
        // the smaller copies too much.
 | 
			
		||||
        // WARNING: If the ldrd and strd instructions get too far away
 | 
			
		||||
        //          from each other, performance suffers. Three loads
 | 
			
		||||
        //          in a row is the best tradeoff.
 | 
			
		||||
        pld     [r1, #(CACHE_LINE_SIZE*16)]
 | 
			
		||||
        strd    r4, r5, [r0, #40]
 | 
			
		||||
        strd    r6, r7, [r0, #48]
 | 
			
		||||
        strd    r8, r9, [r0, #56]
 | 
			
		||||
 | 
			
		||||
        add     r0, r0, #64
 | 
			
		||||
        add     r1, r1, #64
 | 
			
		||||
        subs    r2, r2, #64
 | 
			
		||||
        bge     2b
 | 
			
		||||
 | 
			
		||||
        // Fix-up the remaining count and make sure we have >= 32 bytes left.
 | 
			
		||||
        adds    r2, r2, #32
 | 
			
		||||
        blo     4f
 | 
			
		||||
 | 
			
		||||
        // Copy 32 bytes. These cache lines were already preloaded.
 | 
			
		||||
        .irp    offset, #0, #8, #16, #24
 | 
			
		||||
        ldrd    r4, r5, [r1, \offset]
 | 
			
		||||
        strd    r4, r5, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
        add     r1, r1, #32
 | 
			
		||||
        add     r0, r0, #32
 | 
			
		||||
        sub     r2, r2, #32
 | 
			
		||||
4:      // Less than 32 left.
 | 
			
		||||
        add     r2, r2, #32
 | 
			
		||||
        tst     r2, #0x10
 | 
			
		||||
        beq     5f
 | 
			
		||||
        // Copy 16 bytes.
 | 
			
		||||
        .irp    offset, #0, #8
 | 
			
		||||
        ldrd    r4, r5, [r1, \offset]
 | 
			
		||||
        strd    r4, r5, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
        add     r1, r1, #16
 | 
			
		||||
        add     r0, r0, #16
 | 
			
		||||
 | 
			
		||||
5:      // Copy up to 15 bytes (count in r2).
 | 
			
		||||
        movs    ip, r2, lsl #29
 | 
			
		||||
        bcc     1f
 | 
			
		||||
        // Copy 8 bytes.
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        strd    r4, r5, [r0], #8
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        // Copy 4 bytes.
 | 
			
		||||
        ldr     r4, [r1], #4
 | 
			
		||||
        str     r4, [r0], #4
 | 
			
		||||
2:      // Copy 0 to 4 bytes.
 | 
			
		||||
        lsls    r2, r2, #31
 | 
			
		||||
        itt     ne
 | 
			
		||||
        ldrbne  lr, [r1], #1
 | 
			
		||||
        strbne  lr, [r0], #1
 | 
			
		||||
        itttt   cs
 | 
			
		||||
        ldrbcs  ip, [r1], #1
 | 
			
		||||
        ldrbcs  lr, [r1]
 | 
			
		||||
        strbcs  ip, [r0], #1
 | 
			
		||||
        strbcs  lr, [r0]
 | 
			
		||||
 | 
			
		||||
        // Restore registers: optimized pop {r0, pc}
 | 
			
		||||
        ldrd    r8, r9, [sp], #8
 | 
			
		||||
        ldrd    r6, r7, [sp], #8
 | 
			
		||||
        ldrd    r4, r5, [sp], #8
 | 
			
		||||
        pop     {r0, pc}
 | 
			
		||||
 | 
			
		||||
dst_not_word_aligned:
 | 
			
		||||
        // Align dst to word.
 | 
			
		||||
        rsb     ip, ip, #4
 | 
			
		||||
        cmp     ip, #2
 | 
			
		||||
 | 
			
		||||
        itt     gt
 | 
			
		||||
        ldrbgt  lr, [r1], #1
 | 
			
		||||
        strbgt  lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        itt     ge
 | 
			
		||||
        ldrbge  lr, [r1], #1
 | 
			
		||||
        strbge  lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        ldrb    lr, [r1], #1
 | 
			
		||||
        strb    lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        sub     r2, r2, ip
 | 
			
		||||
 | 
			
		||||
        // Src is guaranteed to be at least word aligned by this point.
 | 
			
		||||
        b       word_aligned
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(memcpy)
 | 
			
		||||
 | 
			
		||||
#define MEMCPY_BASE         __memcpy_base
 | 
			
		||||
#define MEMCPY_BASE_ALIGNED __memcpy_base_aligned
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY(__memcpy_chk_fail)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        push    {lr}
 | 
			
		||||
        .save   {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
 | 
			
		||||
        ldr     r0, error_message
 | 
			
		||||
        ldr     r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
        add     r0, pc
 | 
			
		||||
        bl      __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
        .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
        .word   error_string-(1b+8)
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(__memcpy_chk_fail)
 | 
			
		||||
 | 
			
		||||
        .data
 | 
			
		||||
error_string:
 | 
			
		||||
        .string "memcpy buffer overflow"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										329
									
								
								libc/arch-arm/cortex-a15/bionic/memcpy_base.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										329
									
								
								libc/arch-arm/cortex-a15/bionic/memcpy_base.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,329 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *  * Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 *  * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 | 
			
		||||
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 | 
			
		||||
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 | 
			
		||||
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 | 
			
		||||
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 | 
			
		||||
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
ENTRY(MEMCPY_BASE)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
        // Assumes that n >= 0, and dst, src are valid pointers.
 | 
			
		||||
        // For any sizes less than 832 use the neon code that doesn't
 | 
			
		||||
        // care about the src alignment. This avoids any checks
 | 
			
		||||
        // for src alignment, and offers the best improvement since
 | 
			
		||||
        // smaller sized copies are dominated by the overhead of
 | 
			
		||||
        // the pre and post main loop.
 | 
			
		||||
        // For larger copies, if src and dst cannot both be aligned to
 | 
			
		||||
        // word boundaries, use the neon code.
 | 
			
		||||
        // For all other copies, align dst to a double word boundary
 | 
			
		||||
        // and copy using LDRD/STRD instructions.
 | 
			
		||||
 | 
			
		||||
        cmp     r2, #16
 | 
			
		||||
        blo     .L_copy_less_than_16_unknown_align
 | 
			
		||||
 | 
			
		||||
        // TODO: The aligned copy code is extremely slow copying some large
 | 
			
		||||
        //       buffers so always go through the unaligned path for now.
 | 
			
		||||
        //cmp     r2, #832
 | 
			
		||||
        //bge     .L_check_alignment
 | 
			
		||||
 | 
			
		||||
.L_copy_unknown_alignment:
 | 
			
		||||
        // Unknown alignment of src and dst.
 | 
			
		||||
        // Assumes that the first few bytes have already been prefetched.
 | 
			
		||||
 | 
			
		||||
        // Align destination to 128 bits. The mainloop store instructions
 | 
			
		||||
        // require this alignment or they will throw an exception.
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #0xF
 | 
			
		||||
        beq         2f
 | 
			
		||||
 | 
			
		||||
        // Copy up to 15 bytes (count in r3).
 | 
			
		||||
        sub         r2, r2, r3
 | 
			
		||||
        movs        ip, r3, lsl #31
 | 
			
		||||
 | 
			
		||||
        itt         mi
 | 
			
		||||
        ldrbmi      lr, [r1], #1
 | 
			
		||||
        strbmi      lr, [r0], #1
 | 
			
		||||
        itttt       cs
 | 
			
		||||
        ldrbcs      ip, [r1], #1
 | 
			
		||||
        ldrbcs      lr, [r1], #1
 | 
			
		||||
        strbcs      ip, [r0], #1
 | 
			
		||||
        strbcs      lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        movs        ip, r3, lsl #29
 | 
			
		||||
        bge         1f
 | 
			
		||||
        // Copies 4 bytes, dst 32 bits aligned before, at least 64 bits after.
 | 
			
		||||
        vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
 | 
			
		||||
        vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]!
 | 
			
		||||
1:      bcc         2f
 | 
			
		||||
        // Copies 8 bytes, dst 64 bits aligned before, at least 128 bits after.
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0, :64]!
 | 
			
		||||
 | 
			
		||||
2:      // Make sure we have at least 64 bytes to copy.
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        blo         2f
 | 
			
		||||
 | 
			
		||||
1:      // The main loop copies 64 bytes at a time.
 | 
			
		||||
        vld1.8      {d0  - d3},   [r1]!
 | 
			
		||||
        vld1.8      {d4  - d7},   [r1]!
 | 
			
		||||
        pld         [r1, #(64*4)]
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        vst1.8      {d0  - d3},   [r0, :128]!
 | 
			
		||||
        vst1.8      {d4  - d7},   [r0, :128]!
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
2:      // Fix-up the remaining count and make sure we have >= 32 bytes left.
 | 
			
		||||
        adds        r2, r2, #32
 | 
			
		||||
        blo         3f
 | 
			
		||||
 | 
			
		||||
        // 32 bytes. These cache lines were already preloaded.
 | 
			
		||||
        vld1.8      {d0 - d3},  [r1]!
 | 
			
		||||
        sub         r2, r2, #32
 | 
			
		||||
        vst1.8      {d0 - d3},  [r0, :128]!
 | 
			
		||||
3:      // Less than 32 left.
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
        tst         r2, #0x10
 | 
			
		||||
        beq         .L_copy_less_than_16_unknown_align
 | 
			
		||||
        // Copies 16 bytes, destination 128 bits aligned.
 | 
			
		||||
        vld1.8      {d0, d1}, [r1]!
 | 
			
		||||
        vst1.8      {d0, d1}, [r0, :128]!
 | 
			
		||||
 | 
			
		||||
.L_copy_less_than_16_unknown_align:
 | 
			
		||||
        // Copy up to 15 bytes (count in r2).
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
        bcc         1f
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0]!
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
 | 
			
		||||
        vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0]!
 | 
			
		||||
 | 
			
		||||
2:      // Copy 0 to 4 bytes.
 | 
			
		||||
        lsls        r2, r2, #31
 | 
			
		||||
        itt         ne
 | 
			
		||||
        ldrbne      lr, [r1], #1
 | 
			
		||||
        strbne      lr, [r0], #1
 | 
			
		||||
        itttt       cs
 | 
			
		||||
        ldrbcs      ip, [r1], #1
 | 
			
		||||
        ldrbcs      lr, [r1]
 | 
			
		||||
        strbcs      ip, [r0], #1
 | 
			
		||||
        strbcs      lr, [r0]
 | 
			
		||||
 | 
			
		||||
        pop         {r0, pc}
 | 
			
		||||
 | 
			
		||||
.L_check_alignment:
 | 
			
		||||
        // If src and dst cannot both be aligned to a word boundary,
 | 
			
		||||
        // use the unaligned copy version.
 | 
			
		||||
        eor     r3, r0, r1
 | 
			
		||||
        ands    r3, r3, #0x3
 | 
			
		||||
        bne     .L_copy_unknown_alignment
 | 
			
		||||
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(MEMCPY_BASE)
 | 
			
		||||
 | 
			
		||||
ENTRY(MEMCPY_BASE_ALIGNED)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
        // To try and improve performance, stack layout changed,
 | 
			
		||||
        // 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
 | 
			
		||||
 | 
			
		||||
        // Optimized for already aligned dst code.
 | 
			
		||||
        ands    ip, r0, #3
 | 
			
		||||
        bne     .L_dst_not_word_aligned
 | 
			
		||||
 | 
			
		||||
.L_word_aligned:
 | 
			
		||||
        // Align the destination buffer to 8 bytes, to make sure double
 | 
			
		||||
        // loads and stores don't cross a cache line boundary,
 | 
			
		||||
        // as they are then more expensive even if the data is in the cache
 | 
			
		||||
        // (require two load/store issue cycles instead of one).
 | 
			
		||||
        // If only one of the buffers is not 8 bytes aligned,
 | 
			
		||||
        // then it's more important to align dst than src,
 | 
			
		||||
        // because there is more penalty for stores
 | 
			
		||||
        // than loads that cross a cacheline boundary.
 | 
			
		||||
        // This check and realignment are only done if there is >= 832
 | 
			
		||||
        // bytes to copy.
 | 
			
		||||
 | 
			
		||||
        // Dst is word aligned, but check if it is already double word aligned.
 | 
			
		||||
        ands    r3, r0, #4
 | 
			
		||||
        beq     1f
 | 
			
		||||
        ldr     r3, [r1], #4
 | 
			
		||||
        str     r3, [r0], #4
 | 
			
		||||
        sub     r2, #4
 | 
			
		||||
 | 
			
		||||
1:      // Can only get here if > 64 bytes to copy, so don't do check r2.
 | 
			
		||||
        sub     r2, #64
 | 
			
		||||
 | 
			
		||||
2:      // Every loop iteration copies 64 bytes.
 | 
			
		||||
        .irp    offset, #0, #8, #16, #24, #32
 | 
			
		||||
        ldrd    r4, r5, [r1, \offset]
 | 
			
		||||
        strd    r4, r5, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
 | 
			
		||||
        ldrd    r4, r5, [r1, #40]
 | 
			
		||||
        ldrd    r6, r7, [r1, #48]
 | 
			
		||||
        ldrd    r8, r9, [r1, #56]
 | 
			
		||||
 | 
			
		||||
        // Keep the pld as far from the next load as possible.
 | 
			
		||||
        // The amount to prefetch was determined experimentally using
 | 
			
		||||
        // large sizes, and verifying the prefetch size does not affect
 | 
			
		||||
        // the smaller copies too much.
 | 
			
		||||
        // WARNING: If the ldrd and strd instructions get too far away
 | 
			
		||||
        //          from each other, performance suffers. Three loads
 | 
			
		||||
        //          in a row is the best tradeoff.
 | 
			
		||||
        pld     [r1, #(64*16)]
 | 
			
		||||
        strd    r4, r5, [r0, #40]
 | 
			
		||||
        strd    r6, r7, [r0, #48]
 | 
			
		||||
        strd    r8, r9, [r0, #56]
 | 
			
		||||
 | 
			
		||||
        add     r0, r0, #64
 | 
			
		||||
        add     r1, r1, #64
 | 
			
		||||
        subs    r2, r2, #64
 | 
			
		||||
        bge     2b
 | 
			
		||||
 | 
			
		||||
        // Fix-up the remaining count and make sure we have >= 32 bytes left.
 | 
			
		||||
        adds    r2, r2, #32
 | 
			
		||||
        blo     4f
 | 
			
		||||
 | 
			
		||||
        // Copy 32 bytes. These cache lines were already preloaded.
 | 
			
		||||
        .irp    offset, #0, #8, #16, #24
 | 
			
		||||
        ldrd    r4, r5, [r1, \offset]
 | 
			
		||||
        strd    r4, r5, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
        add     r1, r1, #32
 | 
			
		||||
        add     r0, r0, #32
 | 
			
		||||
        sub     r2, r2, #32
 | 
			
		||||
4:      // Less than 32 left.
 | 
			
		||||
        add     r2, r2, #32
 | 
			
		||||
        tst     r2, #0x10
 | 
			
		||||
        beq     5f
 | 
			
		||||
        // Copy 16 bytes.
 | 
			
		||||
        .irp    offset, #0, #8
 | 
			
		||||
        ldrd    r4, r5, [r1, \offset]
 | 
			
		||||
        strd    r4, r5, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
        add     r1, r1, #16
 | 
			
		||||
        add     r0, r0, #16
 | 
			
		||||
 | 
			
		||||
5:      // Copy up to 15 bytes (count in r2).
 | 
			
		||||
        movs    ip, r2, lsl #29
 | 
			
		||||
        bcc     1f
 | 
			
		||||
        // Copy 8 bytes.
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        strd    r4, r5, [r0], #8
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        // Copy 4 bytes.
 | 
			
		||||
        ldr     r4, [r1], #4
 | 
			
		||||
        str     r4, [r0], #4
 | 
			
		||||
2:      // Copy 0 to 4 bytes.
 | 
			
		||||
        lsls    r2, r2, #31
 | 
			
		||||
        itt     ne
 | 
			
		||||
        ldrbne  lr, [r1], #1
 | 
			
		||||
        strbne  lr, [r0], #1
 | 
			
		||||
        itttt   cs
 | 
			
		||||
        ldrbcs  ip, [r1], #1
 | 
			
		||||
        ldrbcs  lr, [r1]
 | 
			
		||||
        strbcs  ip, [r0], #1
 | 
			
		||||
        strbcs  lr, [r0]
 | 
			
		||||
 | 
			
		||||
        // Restore registers: optimized pop {r0, pc}
 | 
			
		||||
        ldrd    r8, r9, [sp], #8
 | 
			
		||||
        ldrd    r6, r7, [sp], #8
 | 
			
		||||
        ldrd    r4, r5, [sp], #8
 | 
			
		||||
        pop     {r0, pc}
 | 
			
		||||
 | 
			
		||||
.L_dst_not_word_aligned:
 | 
			
		||||
        // Align dst to word.
 | 
			
		||||
        rsb     ip, ip, #4
 | 
			
		||||
        cmp     ip, #2
 | 
			
		||||
 | 
			
		||||
        itt     gt
 | 
			
		||||
        ldrbgt  lr, [r1], #1
 | 
			
		||||
        strbgt  lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        itt     ge
 | 
			
		||||
        ldrbge  lr, [r1], #1
 | 
			
		||||
        strbge  lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        ldrb    lr, [r1], #1
 | 
			
		||||
        strb    lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        sub     r2, r2, ip
 | 
			
		||||
 | 
			
		||||
        // Src is guaranteed to be at least word aligned by this point.
 | 
			
		||||
        b       .L_word_aligned
 | 
			
		||||
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(MEMCPY_BASE_ALIGNED)
 | 
			
		||||
@@ -28,30 +28,61 @@
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * Optimized memset() for ARM.
 | 
			
		||||
        /*
 | 
			
		||||
         * Optimized memset() for ARM.
 | 
			
		||||
         *
 | 
			
		||||
         * memset() returns its first argument.
 | 
			
		||||
		 */
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
        .fpu        neon
 | 
			
		||||
        .syntax     unified
 | 
			
		||||
 | 
			
		||||
ENTRY(__memset_chk)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        cmp         r2, r3
 | 
			
		||||
        bls         .L_done
 | 
			
		||||
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        .save       {lr}
 | 
			
		||||
        push        {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
 | 
			
		||||
        ldr         r0, error_message
 | 
			
		||||
        ldr         r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
        add         r0, pc
 | 
			
		||||
        bl          __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
        .word       BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
        .word       error_string-(1b+8)
 | 
			
		||||
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(__memset_chk)
 | 
			
		||||
 | 
			
		||||
ENTRY(bzero)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        mov         r2, r1
 | 
			
		||||
        mov         r1, #0
 | 
			
		||||
.L_done:
 | 
			
		||||
        // Fall through to memset...
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(bzero)
 | 
			
		||||
 | 
			
		||||
ENTRY(memset)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        .save       {r0}
 | 
			
		||||
        stmfd       sp!, {r0}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
 | 
			
		||||
        // The new algorithm is slower for copies < 16 so use the old
 | 
			
		||||
        // neon code in that case.
 | 
			
		||||
        cmp         r2, #16
 | 
			
		||||
        blo         set_less_than_16_unknown_align
 | 
			
		||||
        blo         .L_set_less_than_16_unknown_align
 | 
			
		||||
 | 
			
		||||
        // Use strd which requires an even and odd register so move the
 | 
			
		||||
        // values so that:
 | 
			
		||||
@@ -65,17 +96,17 @@ ENTRY(memset)
 | 
			
		||||
        orr         r1, r1, r1, lsr #8
 | 
			
		||||
        orr         r1, r1, r1, lsr #16
 | 
			
		||||
 | 
			
		||||
check_alignment:
 | 
			
		||||
.L_check_alignment:
 | 
			
		||||
        // Align destination to a double word to avoid the strd crossing
 | 
			
		||||
        // a cache line boundary.
 | 
			
		||||
        ands        ip, r3, #7
 | 
			
		||||
        bne         do_double_word_align
 | 
			
		||||
        bne         .L_do_double_word_align
 | 
			
		||||
 | 
			
		||||
double_word_aligned:
 | 
			
		||||
.L_double_word_aligned:
 | 
			
		||||
        mov         r0, r1
 | 
			
		||||
 | 
			
		||||
        subs        r2, #64
 | 
			
		||||
        blo         set_less_than_64
 | 
			
		||||
        blo         .L_set_less_than_64
 | 
			
		||||
 | 
			
		||||
1:      // Main loop sets 64 bytes at a time.
 | 
			
		||||
        .irp        offset, #0, #8, #16, #24, #32, #40, #48, #56
 | 
			
		||||
@@ -86,39 +117,39 @@ double_word_aligned:
 | 
			
		||||
        subs        r2, #64
 | 
			
		||||
        bge         1b
 | 
			
		||||
 | 
			
		||||
set_less_than_64:
 | 
			
		||||
.L_set_less_than_64:
 | 
			
		||||
        // Restore r2 to the count of bytes left to set.
 | 
			
		||||
        add         r2, #64
 | 
			
		||||
        lsls        ip, r2, #27
 | 
			
		||||
        bcc         set_less_than_32
 | 
			
		||||
        bcc         .L_set_less_than_32
 | 
			
		||||
        // Set 32 bytes.
 | 
			
		||||
        .irp        offset, #0, #8, #16, #24
 | 
			
		||||
        strd        r0, r1, [r3, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
        add         r3, #32
 | 
			
		||||
 | 
			
		||||
set_less_than_32:
 | 
			
		||||
        bpl         set_less_than_16
 | 
			
		||||
.L_set_less_than_32:
 | 
			
		||||
        bpl         .L_set_less_than_16
 | 
			
		||||
        // Set 16 bytes.
 | 
			
		||||
        .irp        offset, #0, #8
 | 
			
		||||
        strd        r0, r1, [r3, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
        add         r3, #16
 | 
			
		||||
 | 
			
		||||
set_less_than_16:
 | 
			
		||||
.L_set_less_than_16:
 | 
			
		||||
        // Less than 16 bytes to set.
 | 
			
		||||
        lsls        ip, r2, #29
 | 
			
		||||
        bcc         set_less_than_8
 | 
			
		||||
        bcc         .L_set_less_than_8
 | 
			
		||||
 | 
			
		||||
        // Set 8 bytes.
 | 
			
		||||
        strd        r0, r1, [r3], #8
 | 
			
		||||
 | 
			
		||||
set_less_than_8:
 | 
			
		||||
        bpl         set_less_than_4
 | 
			
		||||
.L_set_less_than_8:
 | 
			
		||||
        bpl         .L_set_less_than_4
 | 
			
		||||
        // Set 4 bytes
 | 
			
		||||
        str         r1, [r3], #4
 | 
			
		||||
 | 
			
		||||
set_less_than_4:
 | 
			
		||||
.L_set_less_than_4:
 | 
			
		||||
        lsls        ip, r2, #31
 | 
			
		||||
        it          ne
 | 
			
		||||
        strbne      r1, [r3], #1
 | 
			
		||||
@@ -129,7 +160,7 @@ set_less_than_4:
 | 
			
		||||
        ldmfd       sp!, {r0}
 | 
			
		||||
        bx          lr
 | 
			
		||||
 | 
			
		||||
do_double_word_align:
 | 
			
		||||
.L_do_double_word_align:
 | 
			
		||||
        rsb         ip, ip, #8
 | 
			
		||||
        sub         r2, r2, ip
 | 
			
		||||
        movs        r0, ip, lsl #31
 | 
			
		||||
@@ -141,11 +172,11 @@ do_double_word_align:
 | 
			
		||||
 | 
			
		||||
        // Dst is at least word aligned by this point.
 | 
			
		||||
        cmp         ip, #4
 | 
			
		||||
        blo         double_word_aligned
 | 
			
		||||
        blo         .L_double_word_aligned
 | 
			
		||||
        str         r1, [r3], #4
 | 
			
		||||
        b           double_word_aligned
 | 
			
		||||
        b           .L_double_word_aligned
 | 
			
		||||
 | 
			
		||||
set_less_than_16_unknown_align:
 | 
			
		||||
.L_set_less_than_16_unknown_align:
 | 
			
		||||
        // Set up to 15 bytes.
 | 
			
		||||
        vdup.8      d0, r1
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
@@ -161,4 +192,9 @@ set_less_than_16_unknown_align:
 | 
			
		||||
        strbcs      r1, [r0], #1
 | 
			
		||||
        ldmfd       sp!, {r0}
 | 
			
		||||
        bx          lr
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(memset)
 | 
			
		||||
 | 
			
		||||
        .data
 | 
			
		||||
error_string:
 | 
			
		||||
        .string     "memset buffer overflow"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										568
									
								
								libc/arch-arm/cortex-a15/bionic/strcat.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										568
									
								
								libc/arch-arm/cortex-a15/bionic/strcat.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,568 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/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_scan_byte
 | 
			
		||||
    ldrb    r3, [r0]
 | 
			
		||||
    cbz     r3, strcat_r0_scan_done
 | 
			
		||||
    add     r0, #1
 | 
			
		||||
    .endm // m_scan_byte
 | 
			
		||||
 | 
			
		||||
    .macro m_copy_byte reg, cmd, label
 | 
			
		||||
    ldrb    \reg, [r1], #1
 | 
			
		||||
    strb    \reg, [r0], #1
 | 
			
		||||
    \cmd    \reg, \label
 | 
			
		||||
    .endm // m_copy_byte
 | 
			
		||||
 | 
			
		||||
ENTRY(strcat)
 | 
			
		||||
    // Quick check to see if src is empty.
 | 
			
		||||
    ldrb    r2, [r1]
 | 
			
		||||
    pld     [r1, #0]
 | 
			
		||||
    cbnz    r2, strcat_continue
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
strcat_continue:
 | 
			
		||||
    // To speed up really small dst strings, unroll checking the first 4 bytes.
 | 
			
		||||
    m_push
 | 
			
		||||
    m_scan_byte
 | 
			
		||||
    m_scan_byte
 | 
			
		||||
    m_scan_byte
 | 
			
		||||
    m_scan_byte
 | 
			
		||||
 | 
			
		||||
    ands    r3, r0, #7
 | 
			
		||||
    beq     strcat_mainloop
 | 
			
		||||
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     strcat_align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r5, [r0]
 | 
			
		||||
    cbz     r5, strcat_r0_scan_done
 | 
			
		||||
    add     r0, r0, #1
 | 
			
		||||
 | 
			
		||||
strcat_align_to_32:
 | 
			
		||||
    bcc     strcat_align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r0]
 | 
			
		||||
    cbz     r2, strcat_r0_scan_done
 | 
			
		||||
    add     r0, r0, #1
 | 
			
		||||
    ldrb    r4, [r0]
 | 
			
		||||
    cbz     r4, strcat_r0_scan_done
 | 
			
		||||
    add     r0, r0, #1
 | 
			
		||||
 | 
			
		||||
strcat_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     strcat_mainloop
 | 
			
		||||
    ldr     r3, [r0], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcat_zero_in_second_register
 | 
			
		||||
    b       strcat_mainloop
 | 
			
		||||
 | 
			
		||||
strcat_r0_scan_done:
 | 
			
		||||
    // For short copies, hard-code checking the first 8 bytes since this
 | 
			
		||||
    // new code doesn't win until after about 8 bytes.
 | 
			
		||||
    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:
 | 
			
		||||
    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
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
strcat_mainloop:
 | 
			
		||||
    ldrd    r2, r3, [r0], #8
 | 
			
		||||
 | 
			
		||||
    pld     [r0, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcat_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcat_zero_in_second_register
 | 
			
		||||
    b       strcat_mainloop
 | 
			
		||||
 | 
			
		||||
strcat_zero_in_first_register:
 | 
			
		||||
    // Prefetch the src now, it's going to be used soon.
 | 
			
		||||
    pld     [r1, #0]
 | 
			
		||||
    lsls    lr, ip, #17
 | 
			
		||||
    bne     strcat_sub8
 | 
			
		||||
    bcs     strcat_sub7
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     strcat_sub6
 | 
			
		||||
 | 
			
		||||
    sub     r0, r0, #5
 | 
			
		||||
    b       strcat_r0_scan_done
 | 
			
		||||
 | 
			
		||||
strcat_sub8:
 | 
			
		||||
    sub     r0, r0, #8
 | 
			
		||||
    b       strcat_r0_scan_done
 | 
			
		||||
 | 
			
		||||
strcat_sub7:
 | 
			
		||||
    sub     r0, r0, #7
 | 
			
		||||
    b       strcat_r0_scan_done
 | 
			
		||||
 | 
			
		||||
strcat_sub6:
 | 
			
		||||
    sub     r0, r0, #6
 | 
			
		||||
    b       strcat_r0_scan_done
 | 
			
		||||
 | 
			
		||||
strcat_zero_in_second_register:
 | 
			
		||||
    // Prefetch the src now, it's going to be used soon.
 | 
			
		||||
    pld     [r1, #0]
 | 
			
		||||
    lsls    lr, ip, #17
 | 
			
		||||
    bne     strcat_sub4
 | 
			
		||||
    bcs     strcat_sub3
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     strcat_sub2
 | 
			
		||||
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
    b       strcat_r0_scan_done
 | 
			
		||||
 | 
			
		||||
strcat_sub4:
 | 
			
		||||
    sub     r0, r0, #4
 | 
			
		||||
    b       strcat_r0_scan_done
 | 
			
		||||
 | 
			
		||||
strcat_sub3:
 | 
			
		||||
    sub     r0, r0, #3
 | 
			
		||||
    b       strcat_r0_scan_done
 | 
			
		||||
 | 
			
		||||
strcat_sub2:
 | 
			
		||||
    sub     r0, r0, #2
 | 
			
		||||
    b       strcat_r0_scan_done
 | 
			
		||||
END(strcat)
 | 
			
		||||
@@ -123,8 +123,13 @@ ENTRY(strcmp)
 | 
			
		||||
        .macro  init
 | 
			
		||||
        /* Macro to save temporary registers and prepare magic values.  */
 | 
			
		||||
        subs    sp, sp, #16
 | 
			
		||||
        .cfi_def_cfa_offset 16
 | 
			
		||||
        strd    r4, r5, [sp, #8]
 | 
			
		||||
        .cfi_rel_offset r4, 0
 | 
			
		||||
        .cfi_rel_offset r5, 4
 | 
			
		||||
        strd    r6, r7, [sp]
 | 
			
		||||
        .cfi_rel_offset r6, 8
 | 
			
		||||
        .cfi_rel_offset r7, 12
 | 
			
		||||
        mvn     r6, #0  /* all F */
 | 
			
		||||
        mov     r7, #0  /* all 0 */
 | 
			
		||||
        .endm   /* init */
 | 
			
		||||
@@ -165,18 +170,20 @@ ENTRY(strcmp)
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
        .endm /* setup_return */
 | 
			
		||||
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        pld [r0, #0]
 | 
			
		||||
        pld [r1, #0]
 | 
			
		||||
 | 
			
		||||
        /* Are both strings double-word aligned?  */
 | 
			
		||||
        orr     ip, r0, r1
 | 
			
		||||
        tst     ip, #7
 | 
			
		||||
        bne     do_align
 | 
			
		||||
        bne     .L_do_align
 | 
			
		||||
 | 
			
		||||
        /* Fast path.  */
 | 
			
		||||
        .save   {r4-r7}
 | 
			
		||||
        init
 | 
			
		||||
 | 
			
		||||
doubleword_aligned:
 | 
			
		||||
.L_doubleword_aligned:
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are double-word aligned.  */
 | 
			
		||||
        /* Compare two words in every iteration.  */
 | 
			
		||||
@@ -189,14 +196,14 @@ doubleword_aligned:
 | 
			
		||||
        ldrd    r2, r3, [r0], #8
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
 | 
			
		||||
        magic_compare_and_branch w1=r2, w2=r4, label=return_24
 | 
			
		||||
        magic_compare_and_branch w1=r3, w2=r5, label=return_35
 | 
			
		||||
        magic_compare_and_branch w1=r2, w2=r4, label=.L_return_24
 | 
			
		||||
        magic_compare_and_branch w1=r3, w2=r5, label=.L_return_35
 | 
			
		||||
        b       2b
 | 
			
		||||
 | 
			
		||||
do_align:
 | 
			
		||||
.L_do_align:
 | 
			
		||||
        /* Is the first string word-aligned?  */
 | 
			
		||||
        ands    ip, r0, #3
 | 
			
		||||
        beq     word_aligned_r0
 | 
			
		||||
        beq     .L_word_aligned_r0
 | 
			
		||||
 | 
			
		||||
        /* Fast compare byte by byte until the first string is word-aligned.  */
 | 
			
		||||
        /* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
 | 
			
		||||
@@ -204,58 +211,58 @@ do_align:
 | 
			
		||||
        bic     r0, r0, #3
 | 
			
		||||
        ldr     r2, [r0], #4
 | 
			
		||||
        lsls    ip, ip, #31
 | 
			
		||||
        beq     byte2
 | 
			
		||||
        bcs     byte3
 | 
			
		||||
        beq     .L_byte2
 | 
			
		||||
        bcs     .L_byte3
 | 
			
		||||
 | 
			
		||||
byte1:
 | 
			
		||||
.L_byte1:
 | 
			
		||||
        ldrb    ip, [r1], #1
 | 
			
		||||
        uxtb    r3, r2, ror #BYTE1_OFFSET
 | 
			
		||||
        subs    ip, r3, ip
 | 
			
		||||
        bne     fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=fast_return
 | 
			
		||||
        bne     .L_fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=.L_fast_return
 | 
			
		||||
 | 
			
		||||
byte2:
 | 
			
		||||
.L_byte2:
 | 
			
		||||
        ldrb    ip, [r1], #1
 | 
			
		||||
        uxtb    r3, r2, ror #BYTE2_OFFSET
 | 
			
		||||
        subs    ip, r3, ip
 | 
			
		||||
        bne     fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=fast_return
 | 
			
		||||
        bne     .L_fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=.L_fast_return
 | 
			
		||||
 | 
			
		||||
byte3:
 | 
			
		||||
.L_byte3:
 | 
			
		||||
        ldrb    ip, [r1], #1
 | 
			
		||||
        uxtb    r3, r2, ror #BYTE3_OFFSET
 | 
			
		||||
        subs    ip, r3, ip
 | 
			
		||||
        bne     fast_return
 | 
			
		||||
        m_cbnz  reg=r3, label=word_aligned_r0
 | 
			
		||||
        bne     .L_fast_return
 | 
			
		||||
        m_cbnz  reg=r3, label=.L_word_aligned_r0
 | 
			
		||||
 | 
			
		||||
fast_return:
 | 
			
		||||
.L_fast_return:
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
        bx      lr
 | 
			
		||||
 | 
			
		||||
word_aligned_r0:
 | 
			
		||||
.L_word_aligned_r0:
 | 
			
		||||
        init
 | 
			
		||||
        /* The first string is word-aligned.  */
 | 
			
		||||
        /* Is the second string word-aligned?  */
 | 
			
		||||
        ands    ip, r1, #3
 | 
			
		||||
        bne     strcmp_unaligned
 | 
			
		||||
        bne     .L_strcmp_unaligned
 | 
			
		||||
 | 
			
		||||
word_aligned:
 | 
			
		||||
.L_word_aligned:
 | 
			
		||||
        /* The strings are word-aligned. */
 | 
			
		||||
        /* Is the first string double-word aligned?  */
 | 
			
		||||
        tst     r0, #4
 | 
			
		||||
        beq     doubleword_aligned_r0
 | 
			
		||||
        beq     .L_doubleword_aligned_r0
 | 
			
		||||
 | 
			
		||||
        /* If r0 is not double-word aligned yet, align it by loading
 | 
			
		||||
        and comparing the next word from each string.  */
 | 
			
		||||
        ldr     r2, [r0], #4
 | 
			
		||||
        ldr     r4, [r1], #4
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r4 label=return_24
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r4 label=.L_return_24
 | 
			
		||||
 | 
			
		||||
doubleword_aligned_r0:
 | 
			
		||||
.L_doubleword_aligned_r0:
 | 
			
		||||
        /* Get here when r0 is double-word aligned.  */
 | 
			
		||||
        /* Is r1 doubleword_aligned?  */
 | 
			
		||||
        tst     r1, #4
 | 
			
		||||
        beq     doubleword_aligned
 | 
			
		||||
        beq     .L_doubleword_aligned
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are word-aligned,
 | 
			
		||||
        r0 is double-word aligned, but r1 is not double-word aligned.  */
 | 
			
		||||
@@ -271,9 +278,9 @@ doubleword_aligned_r0:
 | 
			
		||||
 | 
			
		||||
        /* Load the next double-word from each string and compare.  */
 | 
			
		||||
        ldrd    r2, r3, [r0], #8
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r5 label=return_25
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r5 label=.L_return_25
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        magic_compare_and_branch w1=r3 w2=r4 label=return_34
 | 
			
		||||
        magic_compare_and_branch w1=r3 w2=r4 label=.L_return_34
 | 
			
		||||
        b       3b
 | 
			
		||||
 | 
			
		||||
        .macro miscmp_word offsetlo offsethi
 | 
			
		||||
@@ -297,47 +304,47 @@ doubleword_aligned_r0:
 | 
			
		||||
        and     r2, r3, r6, S2LOMEM #\offsetlo
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   r2, r5
 | 
			
		||||
        bne     return_25
 | 
			
		||||
        bne     .L_return_25
 | 
			
		||||
        ldr     r5, [r1], #4
 | 
			
		||||
        cmp     ip, #0
 | 
			
		||||
        eor r3, r2, r3
 | 
			
		||||
        S2HIMEM r2, r5, #\offsethi
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   r3, r2
 | 
			
		||||
        bne     return_32
 | 
			
		||||
        bne     .L_return_32
 | 
			
		||||
        b       7b
 | 
			
		||||
        .endm /* miscmp_word */
 | 
			
		||||
 | 
			
		||||
strcmp_unaligned:
 | 
			
		||||
.L_strcmp_unaligned:
 | 
			
		||||
        /* r0 is word-aligned, r1 is at offset ip from a word.  */
 | 
			
		||||
        /* Align r1 to the (previous) word-boundary.  */
 | 
			
		||||
        bic     r1, r1, #3
 | 
			
		||||
 | 
			
		||||
        /* Unaligned comparison word by word using LDRs. */
 | 
			
		||||
        cmp     ip, #2
 | 
			
		||||
        beq     miscmp_word_16                    /* If ip == 2.  */
 | 
			
		||||
        bge     miscmp_word_24                    /* If ip == 3.  */
 | 
			
		||||
        beq     .L_miscmp_word_16                 /* If ip == 2.  */
 | 
			
		||||
        bge     .L_miscmp_word_24                 /* If ip == 3.  */
 | 
			
		||||
        miscmp_word offsetlo=8 offsethi=24        /* If ip == 1.  */
 | 
			
		||||
miscmp_word_16:  miscmp_word offsetlo=16 offsethi=16
 | 
			
		||||
miscmp_word_24:  miscmp_word offsetlo=24 offsethi=8
 | 
			
		||||
.L_miscmp_word_16:  miscmp_word offsetlo=16 offsethi=16
 | 
			
		||||
.L_miscmp_word_24:  miscmp_word offsetlo=24 offsethi=8
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
return_32:
 | 
			
		||||
.L_return_32:
 | 
			
		||||
        setup_return w1=r3, w2=r2
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_34:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_34:
 | 
			
		||||
        setup_return w1=r3, w2=r4
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_25:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_25:
 | 
			
		||||
        setup_return w1=r2, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_35:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_35:
 | 
			
		||||
        setup_return w1=r3, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_24:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_24:
 | 
			
		||||
        setup_return w1=r2, w2=r4
 | 
			
		||||
 | 
			
		||||
do_return:
 | 
			
		||||
.L_do_return:
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
@@ -349,11 +356,16 @@ do_return:
 | 
			
		||||
        ldrd    r6, r7, [sp]
 | 
			
		||||
        ldrd    r4, r5, [sp, #8]
 | 
			
		||||
        adds    sp, sp, #16
 | 
			
		||||
        .cfi_def_cfa_offset 0
 | 
			
		||||
        .cfi_restore r4
 | 
			
		||||
        .cfi_restore r5
 | 
			
		||||
        .cfi_restore r6
 | 
			
		||||
        .cfi_restore r7
 | 
			
		||||
 | 
			
		||||
        /* There is a zero or a different byte between r1 and r2.  */
 | 
			
		||||
        /* r0 contains a mask of all-zero bytes in r1.  */
 | 
			
		||||
        /* Using r0 and not ip here because cbz requires low register.  */
 | 
			
		||||
        m_cbz   reg=r0, label=compute_return_value
 | 
			
		||||
        m_cbz   reg=r0, label=.L_compute_return_value
 | 
			
		||||
        clz     r0, r0
 | 
			
		||||
        /* r0 contains the number of bits on the left of the first all-zero byte in r1.  */
 | 
			
		||||
        rsb     r0, r0, #24
 | 
			
		||||
@@ -361,7 +373,7 @@ do_return:
 | 
			
		||||
        lsr     r1, r1, r0
 | 
			
		||||
        lsr     r2, r2, r0
 | 
			
		||||
 | 
			
		||||
compute_return_value:
 | 
			
		||||
.L_compute_return_value:
 | 
			
		||||
        movs    r0, #1
 | 
			
		||||
        cmp     r1, r2
 | 
			
		||||
        /* The return value is computed as follows.
 | 
			
		||||
@@ -374,4 +386,5 @@ compute_return_value:
 | 
			
		||||
        it      ls
 | 
			
		||||
        sbcls   r0, r0, r0
 | 
			
		||||
        bx      lr
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(strcmp)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										451
									
								
								libc/arch-arm/cortex-a15/bionic/strcpy.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										451
									
								
								libc/arch-arm/cortex-a15/bionic/strcpy.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,451 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/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)
 | 
			
		||||
@@ -61,34 +61,32 @@
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
ENTRY(strlen)
 | 
			
		||||
    pld [r1, #128]
 | 
			
		||||
    mov r1, r0
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    mov     r1, r0
 | 
			
		||||
 | 
			
		||||
    rsb     r3, r0, #0
 | 
			
		||||
    ands    r3, r3, #7
 | 
			
		||||
    ands    r3, r0, #7
 | 
			
		||||
    beq     mainloop
 | 
			
		||||
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    ands    ip, r3, #1
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cmp     r2, #0
 | 
			
		||||
    beq     update_count_and_return
 | 
			
		||||
    cbz     r2, update_count_and_return
 | 
			
		||||
 | 
			
		||||
align_to_32:
 | 
			
		||||
    bcc     align_to_64
 | 
			
		||||
    ands    ip, r3, #2
 | 
			
		||||
    beq     align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cmp     r2, #0
 | 
			
		||||
    beq     update_count_and_return
 | 
			
		||||
    cbz     r2, update_count_and_return
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cmp     r2, #0
 | 
			
		||||
    beq     update_count_and_return
 | 
			
		||||
    cbz     r2, update_count_and_return
 | 
			
		||||
 | 
			
		||||
align_to_64:
 | 
			
		||||
    ands    ip, r3, #4
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     mainloop
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
@@ -97,6 +95,7 @@ align_to_64:
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
mainloop:
 | 
			
		||||
    ldrd    r2, r3, [r1], #8
 | 
			
		||||
 | 
			
		||||
@@ -113,39 +112,54 @@ mainloop:
 | 
			
		||||
    bne     zero_in_second_register
 | 
			
		||||
    b       mainloop
 | 
			
		||||
 | 
			
		||||
update_count_and_return:
 | 
			
		||||
    sub     r0, r1, r0
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
zero_in_first_register:
 | 
			
		||||
    sub     r1, r1, #4
 | 
			
		||||
    sub     r0, r1, r0
 | 
			
		||||
    lsls    r3, ip, #17
 | 
			
		||||
    bne     sub8_and_return
 | 
			
		||||
    bcs     sub7_and_return
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     sub6_and_return
 | 
			
		||||
 | 
			
		||||
    sub     r0, r0, #5
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
sub8_and_return:
 | 
			
		||||
    sub     r0, r0, #8
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
sub7_and_return:
 | 
			
		||||
    sub     r0, r0, #7
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
sub6_and_return:
 | 
			
		||||
    sub     r0, r0, #6
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
zero_in_second_register:
 | 
			
		||||
    sub     r0, r1, r0
 | 
			
		||||
    lsls    r3, ip, #17
 | 
			
		||||
    bne     sub4_and_return
 | 
			
		||||
    bcs     sub3_and_return
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     sub2_and_return
 | 
			
		||||
 | 
			
		||||
    // Check for zero in byte 0.
 | 
			
		||||
    ands    r1, ip, #0x80
 | 
			
		||||
    beq     check_byte1
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
sub4_and_return:
 | 
			
		||||
    sub     r0, r0, #4
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
check_byte1:
 | 
			
		||||
    // Check for zero in byte 1.
 | 
			
		||||
    ands    r1, ip, #0x8000
 | 
			
		||||
    beq     check_byte2
 | 
			
		||||
 | 
			
		||||
sub3_and_return:
 | 
			
		||||
    sub     r0, r0, #3
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
check_byte2:
 | 
			
		||||
    // Check for zero in byte 2.
 | 
			
		||||
    ands    r1, ip, #0x800000
 | 
			
		||||
    beq     return
 | 
			
		||||
 | 
			
		||||
sub2_and_return:
 | 
			
		||||
    sub     r0, r0, #2
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
update_count_and_return:
 | 
			
		||||
    sub     r0, r1, r0
 | 
			
		||||
 | 
			
		||||
return:
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
    bx      lr
 | 
			
		||||
END(strlen)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,10 @@
 | 
			
		||||
$(call libc-add-cpu-variant-src,MEMCPY,arch-arm/cortex-a15/bionic/memcpy.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,MEMSET,arch-arm/cortex-a15/bionic/memset.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCAT,arch-arm/cortex-a15/bionic/strcat.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCMP,arch-arm/cortex-a15/bionic/strcmp.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCPY,arch-arm/cortex-a15/bionic/strcpy.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRLEN,arch-arm/cortex-a15/bionic/strlen.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,__STRCAT_CHK,arch-arm/cortex-a15/bionic/__strcat_chk.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,__STRCPY_CHK,arch-arm/cortex-a15/bionic/__strcpy_chk.S)
 | 
			
		||||
 | 
			
		||||
include bionic/libc/arch-arm/generic/generic.mk
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								libc/arch-arm/cortex-a7/cortex-a7.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								libc/arch-arm/cortex-a7/cortex-a7.mk
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
include bionic/libc/arch-arm/cortex-a15/cortex-a15.mk
 | 
			
		||||
							
								
								
									
										230
									
								
								libc/arch-arm/cortex-a9/bionic/__strcat_chk.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										230
									
								
								libc/arch-arm/cortex-a9/bionic/__strcat_chk.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,230 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
    .fpu    neon
 | 
			
		||||
    .thumb
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
// Get the length of src string, then get the source of the dst string.
 | 
			
		||||
// Check that the two lengths together don't exceed the threshold, then
 | 
			
		||||
// do a memcpy of the data.
 | 
			
		||||
ENTRY(__strcat_chk)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
    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
 | 
			
		||||
 | 
			
		||||
    mov     lr, r2
 | 
			
		||||
 | 
			
		||||
    // Save the dst register to r5
 | 
			
		||||
    mov     r5, r0
 | 
			
		||||
 | 
			
		||||
    // Zero out r4
 | 
			
		||||
    eor     r4, r4, r4
 | 
			
		||||
 | 
			
		||||
    // r1 contains the address of the string to count.
 | 
			
		||||
.L_strlen_start:
 | 
			
		||||
    mov     r0, r1
 | 
			
		||||
 | 
			
		||||
    ands    r3, r0, #7
 | 
			
		||||
    bne     .L_align_src
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
.L_mainloop:
 | 
			
		||||
    ldmia   r1!, {r2, r3}
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
    b       .L_mainloop
 | 
			
		||||
 | 
			
		||||
.L_zero_in_first_register:
 | 
			
		||||
    sub     r3, r1, r0
 | 
			
		||||
    // Check for zero in byte 0.
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    beq     .L_check_byte1_reg1
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #8
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_check_byte1_reg1:
 | 
			
		||||
    bcc     .L_check_byte2_reg1
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #7
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_check_byte2_reg1:
 | 
			
		||||
    // Check for zero in byte 2.
 | 
			
		||||
    tst     ip, #0x800000
 | 
			
		||||
    it      ne
 | 
			
		||||
    subne   r3, r3, #6
 | 
			
		||||
    bne     .L_finish
 | 
			
		||||
    sub     r3, r3, #5
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_zero_in_second_register:
 | 
			
		||||
    sub     r3, r1, r0
 | 
			
		||||
    // Check for zero in byte 0.
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    beq     .L_check_byte1_reg2
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #4
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_check_byte1_reg2:
 | 
			
		||||
    bcc     .L_check_byte2_reg2
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #3
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_check_byte2_reg2:
 | 
			
		||||
    // Check for zero in byte 2.
 | 
			
		||||
    tst     ip, #0x800000
 | 
			
		||||
    it      ne
 | 
			
		||||
    subne   r3, r3, #2
 | 
			
		||||
    bne     .L_finish
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_align_src:
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     .L_align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, .L_done
 | 
			
		||||
 | 
			
		||||
.L_align_to_32:
 | 
			
		||||
    bcc     .L_align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, .L_done
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, .L_done
 | 
			
		||||
 | 
			
		||||
.L_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     .L_mainloop
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
    b       .L_mainloop
 | 
			
		||||
 | 
			
		||||
.L_done:
 | 
			
		||||
    sub     r3, r1, r0
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
 | 
			
		||||
.L_finish:
 | 
			
		||||
    cmp     r4, #0
 | 
			
		||||
    bne     .L_strlen_done
 | 
			
		||||
 | 
			
		||||
    // Time to get the dst string length.
 | 
			
		||||
    mov     r1, r5
 | 
			
		||||
 | 
			
		||||
    // Save the original source address to r5.
 | 
			
		||||
    mov     r5, r0
 | 
			
		||||
 | 
			
		||||
    // Save the current length (adding 1 for the terminator).
 | 
			
		||||
    add     r4, r3, #1
 | 
			
		||||
    b       .L_strlen_start
 | 
			
		||||
 | 
			
		||||
    // r0 holds the pointer to the dst string.
 | 
			
		||||
    // r3 holds the dst string length.
 | 
			
		||||
    // r4 holds the src string length + 1.
 | 
			
		||||
.L_strlen_done:
 | 
			
		||||
    add     r2, r3, r4
 | 
			
		||||
    cmp     r2, lr
 | 
			
		||||
    bhi     __strcat_chk_fail
 | 
			
		||||
 | 
			
		||||
    // Set up the registers for the memcpy code.
 | 
			
		||||
    mov     r1, r5
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
    mov     r2, r4
 | 
			
		||||
    add     r0, r0, r3
 | 
			
		||||
    pop     {r4, r5}
 | 
			
		||||
 | 
			
		||||
    // Fall through into the memcpy_base function.
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(__strcat_chk)
 | 
			
		||||
 | 
			
		||||
#define MEMCPY_BASE         __strcat_chk_memcpy_base
 | 
			
		||||
#define MEMCPY_BASE_ALIGNED __strcat_chk_memcpy_base_aligned
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY(__strcat_chk_fail)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .save   {r4, r5}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
    .cfi_adjust_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r4, 0
 | 
			
		||||
    .cfi_rel_offset r5, 4
 | 
			
		||||
 | 
			
		||||
    ldr     r0, error_message
 | 
			
		||||
    ldr     r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
    add     r0, pc
 | 
			
		||||
    bl      __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
    .word   BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
    .word   error_string-(1b+4)
 | 
			
		||||
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(__strcat_chk_fail)
 | 
			
		||||
 | 
			
		||||
    .data
 | 
			
		||||
error_string:
 | 
			
		||||
    .string "strcat buffer overflow"
 | 
			
		||||
							
								
								
									
										194
									
								
								libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										194
									
								
								libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,194 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
    .fpu    neon
 | 
			
		||||
    .thumb
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
// Get the length of the source string first, then do a memcpy of the data
 | 
			
		||||
// instead of a strcpy.
 | 
			
		||||
ENTRY(__strcpy_chk)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    push    {r0, lr}
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
    mov     lr, r2
 | 
			
		||||
    mov     r0, r1
 | 
			
		||||
 | 
			
		||||
    ands    r3, r0, #7
 | 
			
		||||
    bne     .L_align_src
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
.L_mainloop:
 | 
			
		||||
    ldmia   r0!, {r2, r3}
 | 
			
		||||
 | 
			
		||||
    pld     [r0, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
    b       .L_mainloop
 | 
			
		||||
 | 
			
		||||
.L_zero_in_first_register:
 | 
			
		||||
    sub     r3, r0, r1
 | 
			
		||||
    // Check for zero in byte 0.
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    beq     .L_check_byte1_reg1
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #8
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_check_byte1_reg1:
 | 
			
		||||
    bcc     .L_check_byte2_reg1
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #7
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_check_byte2_reg1:
 | 
			
		||||
    // Check for zero in byte 2.
 | 
			
		||||
    tst     ip, #0x800000
 | 
			
		||||
    it      ne
 | 
			
		||||
    subne   r3, r3, #6
 | 
			
		||||
    bne     .L_check_size
 | 
			
		||||
    sub     r3, r3, #5
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_zero_in_second_register:
 | 
			
		||||
    sub     r3, r0, r1
 | 
			
		||||
    // Check for zero in byte 0.
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    beq     .L_check_byte1_reg2
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #4
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_check_byte1_reg2:
 | 
			
		||||
    bcc     .L_check_byte2_reg2
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #3
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_check_byte2_reg2:
 | 
			
		||||
    // Check for zero in byte 2.
 | 
			
		||||
    tst     ip, #0x800000
 | 
			
		||||
    it      ne
 | 
			
		||||
    subne   r3, r3, #2
 | 
			
		||||
    bne     .L_check_size
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_align_src:
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     .L_align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .L_done
 | 
			
		||||
 | 
			
		||||
.L_align_to_32:
 | 
			
		||||
    bcc     .L_align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .L_done
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .L_done
 | 
			
		||||
 | 
			
		||||
.L_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     .L_mainloop
 | 
			
		||||
    ldr     r2, [r0], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
    b       .L_mainloop
 | 
			
		||||
 | 
			
		||||
.L_done:
 | 
			
		||||
    sub     r3, r0, r1
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
 | 
			
		||||
.L_check_size:
 | 
			
		||||
    pld     [r1, #0]
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
    ldr     r0, [sp]
 | 
			
		||||
    cmp     r3, lr
 | 
			
		||||
    bhs     __strcpy_chk_fail
 | 
			
		||||
 | 
			
		||||
    // Add 1 for copy length to get the string terminator.
 | 
			
		||||
    add     r2, r3, #1
 | 
			
		||||
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
 | 
			
		||||
    // Fall through into the memcpy_base function.
 | 
			
		||||
END(__strcpy_chk)
 | 
			
		||||
 | 
			
		||||
#define MEMCPY_BASE         __strcpy_chk_memcpy_base
 | 
			
		||||
#define MEMCPY_BASE_ALIGNED __strcpy_chk_memcpy_base_aligned
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY(__strcpy_chk_fail)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
    ldr     r0, error_message
 | 
			
		||||
    ldr     r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
    add     r0, pc
 | 
			
		||||
    bl      __fortify_chk_fail
 | 
			
		||||
 | 
			
		||||
error_code:
 | 
			
		||||
    .word   BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
    .word   error_string-(1b+4)
 | 
			
		||||
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(__strcpy_chk_fail)
 | 
			
		||||
 | 
			
		||||
    .data
 | 
			
		||||
error_string:
 | 
			
		||||
    .string "strcpy buffer overflow"
 | 
			
		||||
@@ -26,8 +26,8 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This code assumes it is running on a processor that supports all arm v7
 | 
			
		||||
@@ -35,177 +35,58 @@
 | 
			
		||||
 * cache line.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
        .text
 | 
			
		||||
        .syntax unified
 | 
			
		||||
        .fpu    neon
 | 
			
		||||
        .thumb
 | 
			
		||||
        .thumb_func
 | 
			
		||||
 | 
			
		||||
#define CACHE_LINE_SIZE     32
 | 
			
		||||
ENTRY(__memcpy_chk)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        cmp         r2, r3
 | 
			
		||||
        bhi         __memcpy_chk_fail
 | 
			
		||||
 | 
			
		||||
        // Fall through to memcpy...
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(__memcpy_chk)
 | 
			
		||||
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
        .save       {r0, lr}
 | 
			
		||||
        /* start preloading as early as possible */
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE * 0)]
 | 
			
		||||
        stmfd       sp!, {r0, lr}
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE * 2)]
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
 | 
			
		||||
        // Check so divider is at least 16 bytes, needed for alignment code.
 | 
			
		||||
        cmp         r2, #16
 | 
			
		||||
        blo         5f
 | 
			
		||||
        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
 | 
			
		||||
        pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /* check if buffers are aligned. If so, run arm-only version */
 | 
			
		||||
        eor         r3, r0, r1
 | 
			
		||||
        ands        r3, r3, #0x3
 | 
			
		||||
        beq         11f
 | 
			
		||||
 | 
			
		||||
        /* Check the upper size limit for Neon unaligned memory access in memcpy */
 | 
			
		||||
        cmp         r2, #224
 | 
			
		||||
        blo         3f
 | 
			
		||||
 | 
			
		||||
        /* align destination to 16 bytes for the write-buffer */
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #0xF
 | 
			
		||||
        beq         3f
 | 
			
		||||
 | 
			
		||||
        /* copy up to 15-bytes (count in r3) */
 | 
			
		||||
        sub         r2, r2, r3
 | 
			
		||||
        movs        ip, r3, lsl #31
 | 
			
		||||
        ldrmib      lr, [r1], #1
 | 
			
		||||
        strmib      lr, [r0], #1
 | 
			
		||||
        ldrcsb      ip, [r1], #1
 | 
			
		||||
        ldrcsb      lr, [r1], #1
 | 
			
		||||
        strcsb      ip, [r0], #1
 | 
			
		||||
        strcsb      lr, [r0], #1
 | 
			
		||||
        movs        ip, r3, lsl #29
 | 
			
		||||
        bge         1f
 | 
			
		||||
        // copies 4 bytes, destination 32-bits aligned
 | 
			
		||||
        vld1.32     {d0[0]}, [r1]!
 | 
			
		||||
        vst1.32     {d0[0]}, [r0, :32]!
 | 
			
		||||
1:      bcc         2f
 | 
			
		||||
        // copies 8 bytes, destination 64-bits aligned
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0, :64]!
 | 
			
		||||
2:
 | 
			
		||||
        /* preload immediately the next cache line, which we may need */
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE * 0)]
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE * 2)]
 | 
			
		||||
3:
 | 
			
		||||
        /* make sure we have at least 64 bytes to copy */
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        blo         2f
 | 
			
		||||
 | 
			
		||||
        /* preload all the cache lines we need */
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE * 4)]
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE * 6)]
 | 
			
		||||
 | 
			
		||||
1:      /* The main loop copies 64 bytes at a time */
 | 
			
		||||
        vld1.8      {d0 - d3}, [r1]!
 | 
			
		||||
        vld1.8      {d4 - d7}, [r1]!
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE * 6)]
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        vst1.8      {d0 - d3}, [r0]!
 | 
			
		||||
        vst1.8      {d4 - d7}, [r0]!
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
2:      /* fix-up the remaining count and make sure we have >= 32 bytes left */
 | 
			
		||||
        add         r2, r2, #64
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        blo         4f
 | 
			
		||||
 | 
			
		||||
3:      /* 32 bytes at a time. These cache lines were already preloaded */
 | 
			
		||||
        vld1.8      {d0 - d3}, [r1]!
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        vst1.8      {d0 - d3}, [r0]!
 | 
			
		||||
        bhs         3b
 | 
			
		||||
 | 
			
		||||
4:      /* less than 32 left */
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
        tst         r2, #0x10
 | 
			
		||||
        beq         5f
 | 
			
		||||
        // copies 16 bytes, 128-bits aligned
 | 
			
		||||
        vld1.8      {d0, d1}, [r1]!
 | 
			
		||||
        vst1.8      {d0, d1}, [r0]!
 | 
			
		||||
5:      /* copy up to 15-bytes (count in r2) */
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
        bcc         1f
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0]!
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        vld1.32     {d0[0]}, [r1]!
 | 
			
		||||
        vst1.32     {d0[0]}, [r0]!
 | 
			
		||||
2:      movs        ip, r2, lsl #31
 | 
			
		||||
        ldrmib      r3, [r1], #1
 | 
			
		||||
        ldrcsb      ip, [r1], #1
 | 
			
		||||
        ldrcsb      lr, [r1], #1
 | 
			
		||||
        strmib      r3, [r0], #1
 | 
			
		||||
        strcsb      ip, [r0], #1
 | 
			
		||||
        strcsb      lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        ldmfd       sp!, {r0, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
11:
 | 
			
		||||
        /* Simple arm-only copy loop to handle aligned copy operations */
 | 
			
		||||
        stmfd       sp!, {r4, r5, r6, r7, r8}
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE * 4)]
 | 
			
		||||
 | 
			
		||||
        /* Check alignment */
 | 
			
		||||
        rsb         r3, r1, #0
 | 
			
		||||
        ands        r3, #3
 | 
			
		||||
        beq         2f
 | 
			
		||||
 | 
			
		||||
        /* align source to 32 bits. We need to insert 2 instructions between
 | 
			
		||||
         * a ldr[b|h] and str[b|h] because byte and half-word instructions
 | 
			
		||||
         * stall 2 cycles.
 | 
			
		||||
         */
 | 
			
		||||
        movs        r12, r3, lsl #31
 | 
			
		||||
        sub         r2, r2, r3      /* we know that r3 <= r2 because r2 >= 4 */
 | 
			
		||||
        ldrmib      r3, [r1], #1
 | 
			
		||||
        ldrcsb      r4, [r1], #1
 | 
			
		||||
        ldrcsb      r5, [r1], #1
 | 
			
		||||
        strmib      r3, [r0], #1
 | 
			
		||||
        strcsb      r4, [r0], #1
 | 
			
		||||
        strcsb      r5, [r0], #1
 | 
			
		||||
 | 
			
		||||
2:
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        blt         4f
 | 
			
		||||
 | 
			
		||||
3:      /* Main copy loop, copying 64 bytes at a time */
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE * 8)]
 | 
			
		||||
        ldmia       r1!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        stmia       r0!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        ldmia       r1!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        stmia       r0!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        bge         3b
 | 
			
		||||
 | 
			
		||||
4:      /* Check if there are > 32 bytes left */
 | 
			
		||||
        adds        r2, r2, #64
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        blt         5f
 | 
			
		||||
 | 
			
		||||
        /* Copy 32 bytes */
 | 
			
		||||
        ldmia       r1!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        stmia       r0!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        subs        r2, #32
 | 
			
		||||
 | 
			
		||||
5:      /* Handle any remaining bytes */
 | 
			
		||||
        adds        r2, #32
 | 
			
		||||
        beq         6f
 | 
			
		||||
 | 
			
		||||
        movs        r12, r2, lsl #28
 | 
			
		||||
        ldmcsia     r1!, {r3, r4, r5, r6}   /* 16 bytes */
 | 
			
		||||
        ldmmiia     r1!, {r7, r8}           /*  8 bytes */
 | 
			
		||||
        stmcsia     r0!, {r3, r4, r5, r6}
 | 
			
		||||
        stmmiia     r0!, {r7, r8}
 | 
			
		||||
        movs        r12, r2, lsl #30
 | 
			
		||||
        ldrcs       r3, [r1], #4            /*  4 bytes */
 | 
			
		||||
        ldrmih      r4, [r1], #2            /*  2 bytes */
 | 
			
		||||
        strcs       r3, [r0], #4
 | 
			
		||||
        strmih      r4, [r0], #2
 | 
			
		||||
        tst         r2, #0x1
 | 
			
		||||
        ldrneb      r3, [r1]                /*  last byte  */
 | 
			
		||||
        strneb      r3, [r0]
 | 
			
		||||
6:
 | 
			
		||||
        ldmfd       sp!, {r4, r5, r6, r7, r8}
 | 
			
		||||
        ldmfd       sp!, {r0, pc}
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(memcpy)
 | 
			
		||||
 | 
			
		||||
#define MEMCPY_BASE         __memcpy_base
 | 
			
		||||
#define MEMCPY_BASE_ALIGNED __memcpy_base_aligned
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY(__memcpy_chk_fail)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        push    {lr}
 | 
			
		||||
        .save   {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
 | 
			
		||||
        ldr     r0, error_message
 | 
			
		||||
        ldr     r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
        add     r0, pc
 | 
			
		||||
        bl      __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
        .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
        .word   error_string-(1b+4)
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(__memcpy_chk_fail)
 | 
			
		||||
 | 
			
		||||
        .data
 | 
			
		||||
error_string:
 | 
			
		||||
        .string     "memcpy buffer overflow"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										233
									
								
								libc/arch-arm/cortex-a9/bionic/memcpy_base.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										233
									
								
								libc/arch-arm/cortex-a9/bionic/memcpy_base.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,233 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *  * Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 *  * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 | 
			
		||||
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 | 
			
		||||
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 | 
			
		||||
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 | 
			
		||||
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 | 
			
		||||
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This code assumes it is running on a processor that supports all arm v7
 | 
			
		||||
 * instructions, that supports neon instructions, and that has a 32 byte
 | 
			
		||||
 * cache line.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
ENTRY(MEMCPY_BASE)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        .save       {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
        // Check so divider is at least 16 bytes, needed for alignment code.
 | 
			
		||||
        cmp         r2, #16
 | 
			
		||||
        blo         5f
 | 
			
		||||
 | 
			
		||||
        /* check if buffers are aligned. If so, run arm-only version */
 | 
			
		||||
        eor         r3, r0, r1
 | 
			
		||||
        ands        r3, r3, #0x3
 | 
			
		||||
        beq         __memcpy_base_aligned
 | 
			
		||||
 | 
			
		||||
        /* Check the upper size limit for Neon unaligned memory access in memcpy */
 | 
			
		||||
        cmp         r2, #224
 | 
			
		||||
        blo         3f
 | 
			
		||||
 | 
			
		||||
        /* align destination to 16 bytes for the write-buffer */
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #0xF
 | 
			
		||||
        beq         3f
 | 
			
		||||
 | 
			
		||||
        /* copy up to 15-bytes (count in r3) */
 | 
			
		||||
        sub         r2, r2, r3
 | 
			
		||||
        movs        ip, r3, lsl #31
 | 
			
		||||
        itt         mi
 | 
			
		||||
        ldrbmi      lr, [r1], #1
 | 
			
		||||
        strbmi      lr, [r0], #1
 | 
			
		||||
        itttt       cs
 | 
			
		||||
        ldrbcs      ip, [r1], #1
 | 
			
		||||
        ldrbcs      lr, [r1], #1
 | 
			
		||||
        strbcs      ip, [r0], #1
 | 
			
		||||
        strbcs      lr, [r0], #1
 | 
			
		||||
        movs        ip, r3, lsl #29
 | 
			
		||||
        bge         1f
 | 
			
		||||
        // copies 4 bytes, destination 32-bits aligned
 | 
			
		||||
        vld1.32     {d0[0]}, [r1]!
 | 
			
		||||
        vst1.32     {d0[0]}, [r0, :32]!
 | 
			
		||||
1:      bcc         2f
 | 
			
		||||
        // copies 8 bytes, destination 64-bits aligned
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0, :64]!
 | 
			
		||||
2:
 | 
			
		||||
        /* preload immediately the next cache line, which we may need */
 | 
			
		||||
        pld         [r1, #0]
 | 
			
		||||
        pld         [r1, #(32 * 2)]
 | 
			
		||||
3:
 | 
			
		||||
        /* make sure we have at least 64 bytes to copy */
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        blo         2f
 | 
			
		||||
 | 
			
		||||
        /* preload all the cache lines we need */
 | 
			
		||||
        pld         [r1, #(32 * 4)]
 | 
			
		||||
        pld         [r1, #(32 * 6)]
 | 
			
		||||
 | 
			
		||||
1:      /* The main loop copies 64 bytes at a time */
 | 
			
		||||
        vld1.8      {d0 - d3}, [r1]!
 | 
			
		||||
        vld1.8      {d4 - d7}, [r1]!
 | 
			
		||||
        pld         [r1, #(32 * 6)]
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        vst1.8      {d0 - d3}, [r0]!
 | 
			
		||||
        vst1.8      {d4 - d7}, [r0]!
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
2:      /* fix-up the remaining count and make sure we have >= 32 bytes left */
 | 
			
		||||
        add         r2, r2, #64
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        blo         4f
 | 
			
		||||
 | 
			
		||||
3:      /* 32 bytes at a time. These cache lines were already preloaded */
 | 
			
		||||
        vld1.8      {d0 - d3}, [r1]!
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        vst1.8      {d0 - d3}, [r0]!
 | 
			
		||||
        bhs         3b
 | 
			
		||||
 | 
			
		||||
4:      /* less than 32 left */
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
        tst         r2, #0x10
 | 
			
		||||
        beq         5f
 | 
			
		||||
        // copies 16 bytes, 128-bits aligned
 | 
			
		||||
        vld1.8      {d0, d1}, [r1]!
 | 
			
		||||
        vst1.8      {d0, d1}, [r0]!
 | 
			
		||||
5:      /* copy up to 15-bytes (count in r2) */
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
        bcc         1f
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0]!
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        vld1.32     {d0[0]}, [r1]!
 | 
			
		||||
        vst1.32     {d0[0]}, [r0]!
 | 
			
		||||
2:      movs        ip, r2, lsl #31
 | 
			
		||||
        itt         mi
 | 
			
		||||
        ldrbmi      r3, [r1], #1
 | 
			
		||||
        strbmi      r3, [r0], #1
 | 
			
		||||
        itttt       cs
 | 
			
		||||
        ldrbcs      ip, [r1], #1
 | 
			
		||||
        ldrbcs      lr, [r1], #1
 | 
			
		||||
        strbcs      ip, [r0], #1
 | 
			
		||||
        strbcs      lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        ldmfd       sp!, {r0, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(MEMCPY_BASE)
 | 
			
		||||
 | 
			
		||||
ENTRY(MEMCPY_BASE_ALIGNED)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
 | 
			
		||||
        .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
 | 
			
		||||
        .cfi_rel_offset r6, 8
 | 
			
		||||
        .cfi_rel_offset r7, 12
 | 
			
		||||
        .cfi_rel_offset r8, 16
 | 
			
		||||
        pld         [r1, #(32 * 4)]
 | 
			
		||||
 | 
			
		||||
        /* Check alignment */
 | 
			
		||||
        rsb         r3, r1, #0
 | 
			
		||||
        ands        r3, #3
 | 
			
		||||
        beq         2f
 | 
			
		||||
 | 
			
		||||
        /* align source to 32 bits. We need to insert 2 instructions between
 | 
			
		||||
         * a ldr[b|h] and str[b|h] because byte and half-word instructions
 | 
			
		||||
         * stall 2 cycles.
 | 
			
		||||
         */
 | 
			
		||||
        movs        r12, r3, lsl #31
 | 
			
		||||
        sub         r2, r2, r3      /* we know that r3 <= r2 because r2 >= 4 */
 | 
			
		||||
        itt         mi
 | 
			
		||||
        ldrbmi      r3, [r1], #1
 | 
			
		||||
        strbmi      r3, [r0], #1
 | 
			
		||||
        itttt       cs
 | 
			
		||||
        ldrbcs      r4, [r1], #1
 | 
			
		||||
        ldrbcs      r5, [r1], #1
 | 
			
		||||
        strbcs      r4, [r0], #1
 | 
			
		||||
        strbcs      r5, [r0], #1
 | 
			
		||||
 | 
			
		||||
2:
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        blt         4f
 | 
			
		||||
 | 
			
		||||
3:      /* Main copy loop, copying 64 bytes at a time */
 | 
			
		||||
        pld         [r1, #(32 * 8)]
 | 
			
		||||
        ldmia       r1!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        stmia       r0!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        ldmia       r1!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        stmia       r0!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        bge         3b
 | 
			
		||||
 | 
			
		||||
4:      /* Check if there are > 32 bytes left */
 | 
			
		||||
        adds        r2, r2, #64
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        blt         5f
 | 
			
		||||
 | 
			
		||||
        /* Copy 32 bytes */
 | 
			
		||||
        ldmia       r1!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        stmia       r0!, {r3, r4, r5, r6, r7, r8, r12, lr}
 | 
			
		||||
        subs        r2, #32
 | 
			
		||||
 | 
			
		||||
5:      /* Handle any remaining bytes */
 | 
			
		||||
        adds        r2, #32
 | 
			
		||||
        beq         6f
 | 
			
		||||
 | 
			
		||||
        movs        r12, r2, lsl #28
 | 
			
		||||
        itt         cs
 | 
			
		||||
        ldmiacs     r1!, {r3, r4, r5, r6}   /* 16 bytes */
 | 
			
		||||
        stmiacs     r0!, {r3, r4, r5, r6}
 | 
			
		||||
        itt         mi
 | 
			
		||||
        ldmiami     r1!, {r7, r8}           /*  8 bytes */
 | 
			
		||||
        stmiami     r0!, {r7, r8}
 | 
			
		||||
        movs        r12, r2, lsl #30
 | 
			
		||||
        itt         cs
 | 
			
		||||
        ldrcs       r3, [r1], #4            /*  4 bytes */
 | 
			
		||||
        strcs       r3, [r0], #4
 | 
			
		||||
        itt         mi
 | 
			
		||||
        ldrhmi      r4, [r1], #2            /*  2 bytes */
 | 
			
		||||
        strhmi      r4, [r0], #2
 | 
			
		||||
        tst         r2, #0x1
 | 
			
		||||
        itt         ne
 | 
			
		||||
        ldrbne      r3, [r1]                /*  last byte  */
 | 
			
		||||
        strbne      r3, [r0]
 | 
			
		||||
6:
 | 
			
		||||
        ldmfd       sp!, {r4-r8}
 | 
			
		||||
        ldmfd       sp!, {r0, pc}
 | 
			
		||||
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(MEMCPY_BASE_ALIGNED)
 | 
			
		||||
@@ -28,6 +28,7 @@
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This code assumes it is running on a processor that supports all arm v7
 | 
			
		||||
@@ -36,19 +37,52 @@
 | 
			
		||||
 | 
			
		||||
    .fpu    neon
 | 
			
		||||
 | 
			
		||||
ENTRY(__memset_chk)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        cmp         r2, r3
 | 
			
		||||
        bls         .L_done
 | 
			
		||||
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        push        {lr}
 | 
			
		||||
        .save       {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
 | 
			
		||||
        ldr         r0, error_message
 | 
			
		||||
        ldr         r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
        add         r0, pc
 | 
			
		||||
        bl          __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
        .word       BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
        .word       error_string-(1b+8)
 | 
			
		||||
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(__memset_chk)
 | 
			
		||||
 | 
			
		||||
ENTRY(bzero)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        mov     r2, r1
 | 
			
		||||
        mov     r1, #0
 | 
			
		||||
 | 
			
		||||
.L_done:
 | 
			
		||||
        // Fall through to memset...
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(bzero)
 | 
			
		||||
 | 
			
		||||
/* memset() returns its first argument.  */
 | 
			
		||||
ENTRY(memset)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
 | 
			
		||||
        # The neon memset only wins for less than 132.
 | 
			
		||||
        cmp         r2, #132
 | 
			
		||||
        bhi         11f
 | 
			
		||||
        bhi         __memset_large_copy
 | 
			
		||||
 | 
			
		||||
        .save       {r0}
 | 
			
		||||
        stmfd       sp!, {r0}
 | 
			
		||||
        .save       {r0}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
 | 
			
		||||
        vdup.8      q0, r1
 | 
			
		||||
 | 
			
		||||
@@ -81,13 +115,26 @@ ENTRY(memset)
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        ldmfd       sp!, {r0}
 | 
			
		||||
        bx          lr
 | 
			
		||||
11:
 | 
			
		||||
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(memset)
 | 
			
		||||
 | 
			
		||||
ENTRY(__memset_large_copy)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
 | 
			
		||||
        /* compute the offset to align the destination
 | 
			
		||||
         * offset = (4-(src&3))&3 = -src & 3
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
        .save       {r0, r4-r7, lr}
 | 
			
		||||
        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
 | 
			
		||||
        .cfi_rel_offset r5, 8
 | 
			
		||||
        .cfi_rel_offset r6, 12
 | 
			
		||||
        .cfi_rel_offset r7, 16
 | 
			
		||||
        .cfi_rel_offset lr, 20
 | 
			
		||||
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #3
 | 
			
		||||
        cmp         r3, r2
 | 
			
		||||
@@ -149,4 +196,9 @@ ENTRY(memset)
 | 
			
		||||
        strcsb      r1, [r0]
 | 
			
		||||
        ldmfd       sp!, {r0, r4-r7, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
END(memset)
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(__memset_large_copy)
 | 
			
		||||
 | 
			
		||||
        .data
 | 
			
		||||
error_string:
 | 
			
		||||
        .string     "memset buffer overflow"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										548
									
								
								libc/arch-arm/cortex-a9/bionic/strcat.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										548
									
								
								libc/arch-arm/cortex-a9/bionic/strcat.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,548 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/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_scan_byte
 | 
			
		||||
    ldrb    r3, [r0]
 | 
			
		||||
    cbz     r3, strcat_r0_scan_done
 | 
			
		||||
    add     r0, #1
 | 
			
		||||
    .endm // m_scan_byte
 | 
			
		||||
 | 
			
		||||
    .macro m_copy_byte reg, cmd, label
 | 
			
		||||
    ldrb    \reg, [r1], #1
 | 
			
		||||
    strb    \reg, [r0], #1
 | 
			
		||||
    \cmd    \reg, \label
 | 
			
		||||
    .endm // m_copy_byte
 | 
			
		||||
 | 
			
		||||
ENTRY(strcat)
 | 
			
		||||
    // Quick check to see if src is empty.
 | 
			
		||||
    ldrb        r2, [r1]
 | 
			
		||||
    pld         [r1, #0]
 | 
			
		||||
    cbnz        r2, strcat_continue
 | 
			
		||||
    bx          lr
 | 
			
		||||
 | 
			
		||||
strcat_continue:
 | 
			
		||||
    // To speed up really small dst strings, unroll checking the first 4 bytes.
 | 
			
		||||
    m_push
 | 
			
		||||
    m_scan_byte
 | 
			
		||||
    m_scan_byte
 | 
			
		||||
    m_scan_byte
 | 
			
		||||
    m_scan_byte
 | 
			
		||||
 | 
			
		||||
    ands    r3, r0, #7
 | 
			
		||||
    bne     strcat_align_src
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
strcat_mainloop:
 | 
			
		||||
    ldmia   r0!, {r2, r3}
 | 
			
		||||
 | 
			
		||||
    pld     [r0, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcat_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcat_zero_in_second_register
 | 
			
		||||
    b       strcat_mainloop
 | 
			
		||||
 | 
			
		||||
strcat_zero_in_first_register:
 | 
			
		||||
    sub     r0, r0, #4
 | 
			
		||||
 | 
			
		||||
strcat_zero_in_second_register:
 | 
			
		||||
    // Check for zero in byte 0.
 | 
			
		||||
    tst     ip, #0x80
 | 
			
		||||
    it      ne
 | 
			
		||||
    subne   r0, r0, #4
 | 
			
		||||
    bne     strcat_r0_scan_done
 | 
			
		||||
    // Check for zero in byte 1.
 | 
			
		||||
    tst     ip, #0x8000
 | 
			
		||||
    it      ne
 | 
			
		||||
    subne   r0, r0, #3
 | 
			
		||||
    bne     strcat_r0_scan_done
 | 
			
		||||
    // Check for zero in byte 2.
 | 
			
		||||
    tst     ip, #0x800000
 | 
			
		||||
    it      ne
 | 
			
		||||
    subne   r0, r0, #2
 | 
			
		||||
    it      eq
 | 
			
		||||
    // Zero is in byte 3.
 | 
			
		||||
    subeq   r0, r0, #1
 | 
			
		||||
 | 
			
		||||
strcat_r0_scan_done:
 | 
			
		||||
    // Unroll the first 8 bytes that will be copied.
 | 
			
		||||
    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
 | 
			
		||||
 | 
			
		||||
strcat_align_src:
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     strcat_align_to_32
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, strcat_r0_update
 | 
			
		||||
 | 
			
		||||
strcat_align_to_32:
 | 
			
		||||
    bcc     strcat_align_to_64
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, strcat_r0_update
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, strcat_r0_update
 | 
			
		||||
 | 
			
		||||
strcat_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     strcat_mainloop
 | 
			
		||||
    ldr     r3, [r0], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     strcat_zero_in_second_register
 | 
			
		||||
    b       strcat_mainloop
 | 
			
		||||
 | 
			
		||||
strcat_r0_update:
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
    b strcat_r0_scan_done
 | 
			
		||||
END(strcat)
 | 
			
		||||
@@ -123,8 +123,13 @@ ENTRY(strcmp)
 | 
			
		||||
        .macro  init
 | 
			
		||||
        /* Macro to save temporary registers and prepare magic values.  */
 | 
			
		||||
        subs    sp, sp, #16
 | 
			
		||||
        .cfi_def_cfa_offset 16
 | 
			
		||||
        strd    r4, r5, [sp, #8]
 | 
			
		||||
        .cfi_rel_offset r4, 0
 | 
			
		||||
        .cfi_rel_offset r5, 4
 | 
			
		||||
        strd    r6, r7, [sp]
 | 
			
		||||
        .cfi_rel_offset r6, 8
 | 
			
		||||
        .cfi_rel_offset r7, 12
 | 
			
		||||
        mvn     r6, #0  /* all F */
 | 
			
		||||
        mov     r7, #0  /* all 0 */
 | 
			
		||||
        .endm   /* init */
 | 
			
		||||
@@ -165,18 +170,20 @@ ENTRY(strcmp)
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
        .endm /* setup_return */
 | 
			
		||||
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        pld [r0, #0]
 | 
			
		||||
        pld [r1, #0]
 | 
			
		||||
 | 
			
		||||
        /* Are both strings double-word aligned?  */
 | 
			
		||||
        orr     ip, r0, r1
 | 
			
		||||
        tst     ip, #7
 | 
			
		||||
        bne     do_align
 | 
			
		||||
        bne     .L_do_align
 | 
			
		||||
 | 
			
		||||
        /* Fast path.  */
 | 
			
		||||
        .save   {r4-r7}
 | 
			
		||||
        init
 | 
			
		||||
 | 
			
		||||
doubleword_aligned:
 | 
			
		||||
.L_doubleword_aligned:
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are double-word aligned.  */
 | 
			
		||||
        /* Compare two words in every iteration.  */
 | 
			
		||||
@@ -189,14 +196,14 @@ doubleword_aligned:
 | 
			
		||||
        ldrd    r2, r3, [r0], #8
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
 | 
			
		||||
        magic_compare_and_branch w1=r2, w2=r4, label=return_24
 | 
			
		||||
        magic_compare_and_branch w1=r3, w2=r5, label=return_35
 | 
			
		||||
        magic_compare_and_branch w1=r2, w2=r4, label=.L_return_24
 | 
			
		||||
        magic_compare_and_branch w1=r3, w2=r5, label=.L_return_35
 | 
			
		||||
        b       2b
 | 
			
		||||
 | 
			
		||||
do_align:
 | 
			
		||||
.L_do_align:
 | 
			
		||||
        /* Is the first string word-aligned?  */
 | 
			
		||||
        ands    ip, r0, #3
 | 
			
		||||
        beq     word_aligned_r0
 | 
			
		||||
        beq     .L_word_aligned_r0
 | 
			
		||||
 | 
			
		||||
        /* Fast compare byte by byte until the first string is word-aligned.  */
 | 
			
		||||
        /* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
 | 
			
		||||
@@ -204,58 +211,58 @@ do_align:
 | 
			
		||||
        bic     r0, r0, #3
 | 
			
		||||
        ldr     r2, [r0], #4
 | 
			
		||||
        lsls    ip, ip, #31
 | 
			
		||||
        beq     byte2
 | 
			
		||||
        bcs     byte3
 | 
			
		||||
        beq     .L_byte2
 | 
			
		||||
        bcs     .L_byte3
 | 
			
		||||
 | 
			
		||||
byte1:
 | 
			
		||||
.L_byte1:
 | 
			
		||||
        ldrb    ip, [r1], #1
 | 
			
		||||
        uxtb    r3, r2, ror #BYTE1_OFFSET
 | 
			
		||||
        subs    ip, r3, ip
 | 
			
		||||
        bne     fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=fast_return
 | 
			
		||||
        bne     .L_fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=.L_fast_return
 | 
			
		||||
 | 
			
		||||
byte2:
 | 
			
		||||
.L_byte2:
 | 
			
		||||
        ldrb    ip, [r1], #1
 | 
			
		||||
        uxtb    r3, r2, ror #BYTE2_OFFSET
 | 
			
		||||
        subs    ip, r3, ip
 | 
			
		||||
        bne     fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=fast_return
 | 
			
		||||
        bne     .L_fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=.L_fast_return
 | 
			
		||||
 | 
			
		||||
byte3:
 | 
			
		||||
.L_byte3:
 | 
			
		||||
        ldrb    ip, [r1], #1
 | 
			
		||||
        uxtb    r3, r2, ror #BYTE3_OFFSET
 | 
			
		||||
        subs    ip, r3, ip
 | 
			
		||||
        bne     fast_return
 | 
			
		||||
        m_cbnz  reg=r3, label=word_aligned_r0
 | 
			
		||||
        bne     .L_fast_return
 | 
			
		||||
        m_cbnz  reg=r3, label=.L_word_aligned_r0
 | 
			
		||||
 | 
			
		||||
fast_return:
 | 
			
		||||
.L_fast_return:
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
        bx      lr
 | 
			
		||||
 | 
			
		||||
word_aligned_r0:
 | 
			
		||||
.L_word_aligned_r0:
 | 
			
		||||
        init
 | 
			
		||||
        /* The first string is word-aligned.  */
 | 
			
		||||
        /* Is the second string word-aligned?  */
 | 
			
		||||
        ands    ip, r1, #3
 | 
			
		||||
        bne     strcmp_unaligned
 | 
			
		||||
        bne     .L_strcmp_unaligned
 | 
			
		||||
 | 
			
		||||
word_aligned:
 | 
			
		||||
.L_word_aligned:
 | 
			
		||||
        /* The strings are word-aligned. */
 | 
			
		||||
        /* Is the first string double-word aligned?  */
 | 
			
		||||
        tst     r0, #4
 | 
			
		||||
        beq     doubleword_aligned_r0
 | 
			
		||||
        beq     .L_doubleword_aligned_r0
 | 
			
		||||
 | 
			
		||||
        /* If r0 is not double-word aligned yet, align it by loading
 | 
			
		||||
        and comparing the next word from each string.  */
 | 
			
		||||
        ldr     r2, [r0], #4
 | 
			
		||||
        ldr     r4, [r1], #4
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r4 label=return_24
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r4 label=.L_return_24
 | 
			
		||||
 | 
			
		||||
doubleword_aligned_r0:
 | 
			
		||||
.L_doubleword_aligned_r0:
 | 
			
		||||
        /* Get here when r0 is double-word aligned.  */
 | 
			
		||||
        /* Is r1 doubleword_aligned?  */
 | 
			
		||||
        tst     r1, #4
 | 
			
		||||
        beq     doubleword_aligned
 | 
			
		||||
        beq     .L_doubleword_aligned
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are word-aligned,
 | 
			
		||||
        r0 is double-word aligned, but r1 is not double-word aligned.  */
 | 
			
		||||
@@ -271,9 +278,9 @@ doubleword_aligned_r0:
 | 
			
		||||
 | 
			
		||||
        /* Load the next double-word from each string and compare.  */
 | 
			
		||||
        ldrd    r2, r3, [r0], #8
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r5 label=return_25
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r5 label=.L_return_25
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        magic_compare_and_branch w1=r3 w2=r4 label=return_34
 | 
			
		||||
        magic_compare_and_branch w1=r3 w2=r4 label=.L_return_34
 | 
			
		||||
        b       3b
 | 
			
		||||
 | 
			
		||||
        .macro miscmp_word offsetlo offsethi
 | 
			
		||||
@@ -297,33 +304,33 @@ doubleword_aligned_r0:
 | 
			
		||||
        and     r2, r3, r6, S2LOMEM #\offsetlo
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   r2, r5
 | 
			
		||||
        bne     return_25
 | 
			
		||||
        bne     .L_return_25
 | 
			
		||||
        ldr     r5, [r1], #4
 | 
			
		||||
        cmp     ip, #0
 | 
			
		||||
        eor r3, r2, r3
 | 
			
		||||
        S2HIMEM r2, r5, #\offsethi
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   r3, r2
 | 
			
		||||
        bne     return_32
 | 
			
		||||
        bne     .L_return_32
 | 
			
		||||
        b       7b
 | 
			
		||||
        .endm /* miscmp_word */
 | 
			
		||||
 | 
			
		||||
return_32:
 | 
			
		||||
.L_return_32:
 | 
			
		||||
        setup_return w1=r3, w2=r2
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_34:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_34:
 | 
			
		||||
        setup_return w1=r3, w2=r4
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_25:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_25:
 | 
			
		||||
        setup_return w1=r2, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_35:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_35:
 | 
			
		||||
        setup_return w1=r3, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_24:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_24:
 | 
			
		||||
        setup_return w1=r2, w2=r4
 | 
			
		||||
 | 
			
		||||
do_return:
 | 
			
		||||
.L_do_return:
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
@@ -335,11 +342,16 @@ do_return:
 | 
			
		||||
        ldrd    r6, r7, [sp]
 | 
			
		||||
        ldrd    r4, r5, [sp, #8]
 | 
			
		||||
        adds    sp, sp, #16
 | 
			
		||||
        .cfi_def_cfa_offset 0
 | 
			
		||||
        .cfi_restore r4
 | 
			
		||||
        .cfi_restore r5
 | 
			
		||||
        .cfi_restore r6
 | 
			
		||||
        .cfi_restore r7
 | 
			
		||||
 | 
			
		||||
        /* There is a zero or a different byte between r1 and r2.  */
 | 
			
		||||
        /* r0 contains a mask of all-zero bytes in r1.  */
 | 
			
		||||
        /* Using r0 and not ip here because cbz requires low register.  */
 | 
			
		||||
        m_cbz   reg=r0, label=compute_return_value
 | 
			
		||||
        m_cbz   reg=r0, label=.L_compute_return_value
 | 
			
		||||
        clz     r0, r0
 | 
			
		||||
        /* r0 contains the number of bits on the left of the first all-zero byte in r1.  */
 | 
			
		||||
        rsb     r0, r0, #24
 | 
			
		||||
@@ -347,7 +359,7 @@ do_return:
 | 
			
		||||
        lsr     r1, r1, r0
 | 
			
		||||
        lsr     r2, r2, r0
 | 
			
		||||
 | 
			
		||||
compute_return_value:
 | 
			
		||||
.L_compute_return_value:
 | 
			
		||||
        movs    r0, #1
 | 
			
		||||
        cmp     r1, r2
 | 
			
		||||
        /* The return value is computed as follows.
 | 
			
		||||
@@ -367,7 +379,7 @@ compute_return_value:
 | 
			
		||||
     * bionic/libc/arch-arm/cortex-a15/bionic/strcmp.S for the unedited
 | 
			
		||||
     * version of the code.
 | 
			
		||||
     */
 | 
			
		||||
strcmp_unaligned:
 | 
			
		||||
.L_strcmp_unaligned:
 | 
			
		||||
	wp1 .req r0
 | 
			
		||||
	wp2 .req r1
 | 
			
		||||
	b1  .req r2
 | 
			
		||||
@@ -520,6 +532,11 @@ strcmp_unaligned:
 | 
			
		||||
    ldrd    r6, r7, [sp]
 | 
			
		||||
    ldrd    r4, r5, [sp, #8]
 | 
			
		||||
    adds    sp, sp, #16
 | 
			
		||||
    .cfi_def_cfa_offset 0
 | 
			
		||||
    .cfi_restore r4
 | 
			
		||||
    .cfi_restore r5
 | 
			
		||||
    .cfi_restore r6
 | 
			
		||||
    .cfi_restore r7
 | 
			
		||||
 | 
			
		||||
	bx	lr
 | 
			
		||||
 | 
			
		||||
@@ -541,4 +558,5 @@ strcmp_unaligned:
 | 
			
		||||
    adds    sp, sp, #16
 | 
			
		||||
 | 
			
		||||
	bx	lr
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(strcmp)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										456
									
								
								libc/arch-arm/cortex-a9/bionic/strcpy.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										456
									
								
								libc/arch-arm/cortex-a9/bionic/strcpy.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,456 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/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)
 | 
			
		||||
							
								
								
									
										167
									
								
								libc/arch-arm/cortex-a9/bionic/strlen.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										167
									
								
								libc/arch-arm/cortex-a9/bionic/strlen.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,167 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
 | 
			
		||||
    .thumb
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
ENTRY(strlen)
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    mov     r1, r0
 | 
			
		||||
 | 
			
		||||
    ands    r3, r0, #7
 | 
			
		||||
    bne     align_src
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
mainloop:
 | 
			
		||||
    ldmia   r1!, {r2, r3}
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     zero_in_second_register
 | 
			
		||||
    b       mainloop
 | 
			
		||||
 | 
			
		||||
zero_in_first_register:
 | 
			
		||||
    sub     r0, r1, r0
 | 
			
		||||
    // Check for zero in byte 0.
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    beq     check_byte1_reg1
 | 
			
		||||
 | 
			
		||||
    sub     r0, r0, #8
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
check_byte1_reg1:
 | 
			
		||||
    bcc     check_byte2_reg1
 | 
			
		||||
 | 
			
		||||
    sub     r0, r0, #7
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
check_byte2_reg1:
 | 
			
		||||
    // Check for zero in byte 2.
 | 
			
		||||
    tst     ip, #0x800000
 | 
			
		||||
    itt     ne
 | 
			
		||||
    subne   r0, r0, #6
 | 
			
		||||
    bxne    lr
 | 
			
		||||
    sub     r0, r0, #5
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
zero_in_second_register:
 | 
			
		||||
    sub     r0, r1, r0
 | 
			
		||||
    // Check for zero in byte 0.
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    beq     check_byte1_reg2
 | 
			
		||||
 | 
			
		||||
    sub     r0, r0, #4
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
check_byte1_reg2:
 | 
			
		||||
    bcc     check_byte2_reg2
 | 
			
		||||
 | 
			
		||||
    sub     r0, r0, #3
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
check_byte2_reg2:
 | 
			
		||||
    // Check for zero in byte 2.
 | 
			
		||||
    tst     ip, #0x800000
 | 
			
		||||
    itt     ne
 | 
			
		||||
    subne   r0, r0, #2
 | 
			
		||||
    bxne    lr
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
align_src:
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, done
 | 
			
		||||
 | 
			
		||||
align_to_32:
 | 
			
		||||
    bcc     align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, done
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, done
 | 
			
		||||
 | 
			
		||||
align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     mainloop
 | 
			
		||||
    ldr     r2, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     zero_in_second_register
 | 
			
		||||
    b       mainloop
 | 
			
		||||
 | 
			
		||||
done:
 | 
			
		||||
    sub     r0, r1, r0
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
    bx      lr
 | 
			
		||||
END(strlen)
 | 
			
		||||
@@ -1,7 +1,10 @@
 | 
			
		||||
$(call libc-add-cpu-variant-src,MEMCPY,arch-arm/cortex-a9/bionic/memcpy.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,MEMSET,arch-arm/cortex-a9/bionic/memset.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCAT,arch-arm/cortex-a9/bionic/strcat.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCMP,arch-arm/cortex-a9/bionic/strcmp.S)
 | 
			
		||||
# Use cortex-a15 version of strlen.
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRLEN,arch-arm/cortex-a15/bionic/strlen.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCPY,arch-arm/cortex-a9/bionic/strcpy.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRLEN,arch-arm/cortex-a9/bionic/strlen.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,__STRCAT_CHK,arch-arm/cortex-a9/bionic/__strcat_chk.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,__STRCPY_CHK,arch-arm/cortex-a9/bionic/__strcpy_chk.S)
 | 
			
		||||
 | 
			
		||||
include bionic/libc/arch-arm/generic/generic.mk
 | 
			
		||||
 
 | 
			
		||||
@@ -28,6 +28,7 @@
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Optimized memcpy() for ARM.
 | 
			
		||||
@@ -36,6 +37,13 @@
 | 
			
		||||
         * so we have to preserve R0.
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
ENTRY(__memcpy_chk)
 | 
			
		||||
        cmp         r2, r3
 | 
			
		||||
        bgt         fortify_check_failed
 | 
			
		||||
 | 
			
		||||
        // Fall through to memcpy...
 | 
			
		||||
END(__memcpy_chk)
 | 
			
		||||
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
        /* The stack must always be 64-bits aligned to be compliant with the
 | 
			
		||||
         * ARM ABI. Since we have to save R0, we might as well save R4
 | 
			
		||||
@@ -377,4 +385,20 @@ copy_last_3_and_return:
 | 
			
		||||
        add         sp,  sp, #28
 | 
			
		||||
        ldmfd       sp!, {r0, r4, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
 | 
			
		||||
        // Only reached when the __memcpy_chk check fails.
 | 
			
		||||
fortify_check_failed:
 | 
			
		||||
        ldr     r0, error_message
 | 
			
		||||
        ldr     r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
        add     r0, pc
 | 
			
		||||
        bl      __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
        .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
        .word   error_string-(1b+8)
 | 
			
		||||
END(memcpy)
 | 
			
		||||
 | 
			
		||||
        .data
 | 
			
		||||
error_string:
 | 
			
		||||
        .string     "memcpy buffer overflow"
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Optimized memset() for ARM.
 | 
			
		||||
@@ -34,9 +35,28 @@
 | 
			
		||||
         * memset() returns its first argument.
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
ENTRY(__memset_chk)
 | 
			
		||||
        cmp         r2, r3
 | 
			
		||||
        bls         done
 | 
			
		||||
 | 
			
		||||
        ldr         r0, error_message
 | 
			
		||||
        ldr         r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
        add         r0, pc
 | 
			
		||||
        bl          __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
        .word       BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
        .word       error_string-(1b+8)
 | 
			
		||||
 | 
			
		||||
END(__memset_chk)
 | 
			
		||||
 | 
			
		||||
ENTRY(bzero)
 | 
			
		||||
        mov     r2, r1
 | 
			
		||||
        mov     r1, #0
 | 
			
		||||
 | 
			
		||||
done:
 | 
			
		||||
        // Fall through to memset...
 | 
			
		||||
END(bzero)
 | 
			
		||||
 | 
			
		||||
ENTRY(memset)
 | 
			
		||||
@@ -107,3 +127,7 @@ ENTRY(memset)
 | 
			
		||||
        ldmfd       sp!, {r0, r4-r7, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
END(memset)
 | 
			
		||||
 | 
			
		||||
        .data
 | 
			
		||||
error_string:
 | 
			
		||||
        .string     "memset buffer overflow"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,8 @@
 | 
			
		||||
$(call libc-add-cpu-variant-src,MEMCPY,arch-arm/generic/bionic/memcpy.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,MEMSET,arch-arm/generic/bionic/memset.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCAT,string/strcat.c)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCMP,arch-arm/generic/bionic/strcmp.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCPY,arch-arm/generic/bionic/strcpy.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRLEN,arch-arm/generic/bionic/strlen.c)
 | 
			
		||||
$(call libc-add-cpu-variant-src,__STRCAT_CHK,bionic/__strcat_chk.cpp)
 | 
			
		||||
$(call libc-add-cpu-variant-src,__STRCPY_CHK,bionic/__strcpy_chk.cpp)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										225
									
								
								libc/arch-arm/krait/bionic/__strcat_chk.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										225
									
								
								libc/arch-arm/krait/bionic/__strcat_chk.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,225 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
 | 
			
		||||
    .thumb
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
// Get the length of src string, then get the source of the dst string.
 | 
			
		||||
// Check that the two lengths together don't exceed the threshold, then
 | 
			
		||||
// do a memcpy of the data.
 | 
			
		||||
ENTRY(__strcat_chk)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
    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
 | 
			
		||||
 | 
			
		||||
    mov     lr, r2
 | 
			
		||||
 | 
			
		||||
    // Save the dst register to r5
 | 
			
		||||
    mov     r5, r0
 | 
			
		||||
 | 
			
		||||
    // Zero out r4
 | 
			
		||||
    eor     r4, r4, r4
 | 
			
		||||
 | 
			
		||||
    // r1 contains the address of the string to count.
 | 
			
		||||
.L_strlen_start:
 | 
			
		||||
    mov     r0, r1
 | 
			
		||||
    ands    r3, r1, #7
 | 
			
		||||
    beq     .L_mainloop
 | 
			
		||||
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     .L_align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
 | 
			
		||||
.L_align_to_32:
 | 
			
		||||
    bcc     .L_align_to_64
 | 
			
		||||
    ands    ip, r3, #2
 | 
			
		||||
    beq     .L_align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
 | 
			
		||||
.L_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     .L_mainloop
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
.L_mainloop:
 | 
			
		||||
    ldrd    r2, r3, [r1], #8
 | 
			
		||||
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
    b       .L_mainloop
 | 
			
		||||
 | 
			
		||||
.L_update_count_and_finish:
 | 
			
		||||
    sub     r3, r1, r0
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_zero_in_first_register:
 | 
			
		||||
    sub     r3, r1, r0
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    bne     .L_sub8_and_finish
 | 
			
		||||
    bcs     .L_sub7_and_finish
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     .L_sub6_and_finish
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #5
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub8_and_finish:
 | 
			
		||||
    sub     r3, r3, #8
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub7_and_finish:
 | 
			
		||||
    sub     r3, r3, #7
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub6_and_finish:
 | 
			
		||||
    sub     r3, r3, #6
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_zero_in_second_register:
 | 
			
		||||
    sub     r3, r1, r0
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    bne     .L_sub4_and_finish
 | 
			
		||||
    bcs     .L_sub3_and_finish
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     .L_sub2_and_finish
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub4_and_finish:
 | 
			
		||||
    sub     r3, r3, #4
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub3_and_finish:
 | 
			
		||||
    sub     r3, r3, #3
 | 
			
		||||
    b       .L_finish
 | 
			
		||||
 | 
			
		||||
.L_sub2_and_finish:
 | 
			
		||||
    sub     r3, r3, #2
 | 
			
		||||
 | 
			
		||||
.L_finish:
 | 
			
		||||
    cmp     r4, #0
 | 
			
		||||
    bne     .L_strlen_done
 | 
			
		||||
 | 
			
		||||
    // Time to get the dst string length.
 | 
			
		||||
    mov     r1, r5
 | 
			
		||||
 | 
			
		||||
    // Save the original source address to r5.
 | 
			
		||||
    mov     r5, r0
 | 
			
		||||
 | 
			
		||||
    // Save the current length (adding 1 for the terminator).
 | 
			
		||||
    add     r4, r3, #1
 | 
			
		||||
    b       .L_strlen_start
 | 
			
		||||
 | 
			
		||||
    // r0 holds the pointer to the dst string.
 | 
			
		||||
    // r3 holds the dst string length.
 | 
			
		||||
    // r4 holds the src string length + 1.
 | 
			
		||||
.L_strlen_done:
 | 
			
		||||
    add     r2, r3, r4
 | 
			
		||||
    cmp     r2, lr
 | 
			
		||||
    bhi     __strcat_chk_failed
 | 
			
		||||
 | 
			
		||||
    // Set up the registers for the memcpy code.
 | 
			
		||||
    mov     r1, r5
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
    mov     r2, r4
 | 
			
		||||
    add     r0, r0, r3
 | 
			
		||||
    pop     {r4, r5}
 | 
			
		||||
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(__strcat_chk)
 | 
			
		||||
 | 
			
		||||
#define MEMCPY_BASE         __strcat_chk_memcpy_base
 | 
			
		||||
#define MEMCPY_BASE_ALIGNED __strcat_chk_memcpy_base_aligned
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY(__strcat_chk_failed)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .save   {r4, r5}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
    .cfi_adjust_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r4, 0
 | 
			
		||||
    .cfi_rel_offset r5, 4
 | 
			
		||||
 | 
			
		||||
    ldr     r0, error_message
 | 
			
		||||
    ldr     r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
    add     r0, pc
 | 
			
		||||
    bl      __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
    .word   BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
    .word   error_string-(1b+4)
 | 
			
		||||
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(__strcat_chk_failed)
 | 
			
		||||
 | 
			
		||||
    .data
 | 
			
		||||
error_string:
 | 
			
		||||
    .string "strcat buffer overflow"
 | 
			
		||||
							
								
								
									
										187
									
								
								libc/arch-arm/krait/bionic/__strcpy_chk.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										187
									
								
								libc/arch-arm/krait/bionic/__strcpy_chk.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,187 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
 | 
			
		||||
    .thumb
 | 
			
		||||
    .thumb_func
 | 
			
		||||
 | 
			
		||||
// Get the length of the source string first, then do a memcpy of the data
 | 
			
		||||
// instead of a strcpy.
 | 
			
		||||
ENTRY(__strcpy_chk)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
    pld     [r0, #0]
 | 
			
		||||
    push    {r0, lr}
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
    mov     lr, r2
 | 
			
		||||
    mov     r0, r1
 | 
			
		||||
 | 
			
		||||
    ands    r3, r1, #7
 | 
			
		||||
    beq     .L_mainloop
 | 
			
		||||
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    rsb     r3, r3, #8
 | 
			
		||||
    lsls    ip, r3, #31
 | 
			
		||||
    beq     .L_align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
 | 
			
		||||
.L_align_to_32:
 | 
			
		||||
    bcc     .L_align_to_64
 | 
			
		||||
    ands    ip, r3, #2
 | 
			
		||||
    beq     .L_align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
    ldrb    r2, [r0], #1
 | 
			
		||||
    cbz     r2, .L_update_count_and_finish
 | 
			
		||||
 | 
			
		||||
.L_align_to_64:
 | 
			
		||||
    tst     r3, #4
 | 
			
		||||
    beq     .L_mainloop
 | 
			
		||||
    ldr     r3, [r0], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
 | 
			
		||||
    .p2align 2
 | 
			
		||||
.L_mainloop:
 | 
			
		||||
    ldrd    r2, r3, [r0], #8
 | 
			
		||||
 | 
			
		||||
    pld     [r0, #64]
 | 
			
		||||
 | 
			
		||||
    sub     ip, r2, #0x01010101
 | 
			
		||||
    bic     ip, ip, r2
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_first_register
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     .L_zero_in_second_register
 | 
			
		||||
    b       .L_mainloop
 | 
			
		||||
 | 
			
		||||
.L_update_count_and_finish:
 | 
			
		||||
    sub     r3, r0, r1
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_zero_in_first_register:
 | 
			
		||||
    sub     r3, r0, r1
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    bne     .L_sub8_and_finish
 | 
			
		||||
    bcs     .L_sub7_and_finish
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     .L_sub6_and_finish
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #5
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub8_and_finish:
 | 
			
		||||
    sub     r3, r3, #8
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub7_and_finish:
 | 
			
		||||
    sub     r3, r3, #7
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub6_and_finish:
 | 
			
		||||
    sub     r3, r3, #6
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_zero_in_second_register:
 | 
			
		||||
    sub     r3, r0, r1
 | 
			
		||||
    lsls    r2, ip, #17
 | 
			
		||||
    bne     .L_sub4_and_finish
 | 
			
		||||
    bcs     .L_sub3_and_finish
 | 
			
		||||
    lsls    ip, ip, #1
 | 
			
		||||
    bne     .L_sub2_and_finish
 | 
			
		||||
 | 
			
		||||
    sub     r3, r3, #1
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub4_and_finish:
 | 
			
		||||
    sub     r3, r3, #4
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub3_and_finish:
 | 
			
		||||
    sub     r3, r3, #3
 | 
			
		||||
    b       .L_check_size
 | 
			
		||||
 | 
			
		||||
.L_sub2_and_finish:
 | 
			
		||||
    sub     r3, r3, #2
 | 
			
		||||
 | 
			
		||||
.L_check_size:
 | 
			
		||||
    pld     [r1, #0]
 | 
			
		||||
    pld     [r1, #64]
 | 
			
		||||
    ldr     r0, [sp]
 | 
			
		||||
    cmp     r3, lr
 | 
			
		||||
    bhs     __strcpy_chk_failed
 | 
			
		||||
 | 
			
		||||
    // Add 1 for copy length to get the string terminator.
 | 
			
		||||
    add     r2, r3, #1
 | 
			
		||||
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(__strcpy_chk)
 | 
			
		||||
 | 
			
		||||
#define MEMCPY_BASE         __strcpy_chk_memcpy_base
 | 
			
		||||
#define MEMCPY_BASE_ALIGNED __strcpy_chk_memcpy_base_aligned
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY(__strcpy_chk_failed)
 | 
			
		||||
    .cfi_startproc
 | 
			
		||||
    .save   {r0, lr}
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset r0, 0
 | 
			
		||||
    .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
    ldr     r0, error_message
 | 
			
		||||
    ldr     r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
    add     r0, pc
 | 
			
		||||
    bl      __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
    .word   BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
    .word   error_string-(1b+4)
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(__strcpy_chk_failed)
 | 
			
		||||
 | 
			
		||||
    .data
 | 
			
		||||
error_string:
 | 
			
		||||
    .string "strcpy buffer overflow"
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * Copyright (C) 2013 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
@@ -28,8 +28,8 @@
 | 
			
		||||
 | 
			
		||||
/* Assumes neon instructions and a cache line size of 32 bytes. */
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This code assumes it is running on a processor that supports all arm v7
 | 
			
		||||
@@ -38,109 +38,55 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
        .text
 | 
			
		||||
        .syntax unified
 | 
			
		||||
        .fpu    neon
 | 
			
		||||
        .thumb
 | 
			
		||||
        .thumb_func
 | 
			
		||||
 | 
			
		||||
#define CACHE_LINE_SIZE     32
 | 
			
		||||
ENTRY(__memcpy_chk)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        cmp         r2, r3
 | 
			
		||||
        bhi         __memcpy_chk_fail
 | 
			
		||||
 | 
			
		||||
        // Fall through to memcpy...
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(__memcpy_chk)
 | 
			
		||||
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
        .save       {r0, lr}
 | 
			
		||||
        /* start preloading as early as possible */
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*0)]
 | 
			
		||||
        stmfd       sp!, {r0, lr}
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*2)]
 | 
			
		||||
 | 
			
		||||
        /* do we have at least 16-bytes to copy (needed for alignment below) */
 | 
			
		||||
        cmp         r2, #16
 | 
			
		||||
        blo         5f
 | 
			
		||||
 | 
			
		||||
        /* align destination to cache-line for the write-buffer */
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #0xF
 | 
			
		||||
        beq         0f
 | 
			
		||||
 | 
			
		||||
        /* copy up to 15-bytes (count in r3) */
 | 
			
		||||
        sub         r2, r2, r3
 | 
			
		||||
        movs        ip, r3, lsl #31
 | 
			
		||||
        ldrmib      lr, [r1], #1
 | 
			
		||||
        strmib      lr, [r0], #1
 | 
			
		||||
        ldrcsb      ip, [r1], #1
 | 
			
		||||
        ldrcsb      lr, [r1], #1
 | 
			
		||||
        strcsb      ip, [r0], #1
 | 
			
		||||
        strcsb      lr, [r0], #1
 | 
			
		||||
        movs        ip, r3, lsl #29
 | 
			
		||||
        bge         1f
 | 
			
		||||
        // copies 4 bytes, destination 32-bits aligned
 | 
			
		||||
        vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
 | 
			
		||||
        vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]!
 | 
			
		||||
1:      bcc         2f
 | 
			
		||||
        // copies 8 bytes, destination 64-bits aligned
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0, :64]!
 | 
			
		||||
2:
 | 
			
		||||
 | 
			
		||||
0:      /* preload immediately the next cache line, which we may need */
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*0)]
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*2)]
 | 
			
		||||
 | 
			
		||||
        /* make sure we have at least 64 bytes to copy */
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        blo         2f
 | 
			
		||||
 | 
			
		||||
        /* Preload all the cache lines we need.
 | 
			
		||||
         * NOTE: The number of pld below depends on CACHE_LINE_SIZE,
 | 
			
		||||
         * ideally we would increase the distance in the main loop to
 | 
			
		||||
         * avoid the goofy code below. In practice this doesn't seem to make
 | 
			
		||||
         * a big difference.
 | 
			
		||||
         * NOTE: The value CACHE_LINE_SIZE * 8 was chosen through
 | 
			
		||||
         * experimentation.
 | 
			
		||||
         */
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*4)]
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*6)]
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*8)]
 | 
			
		||||
 | 
			
		||||
1:      /* The main loop copies 64 bytes at a time */
 | 
			
		||||
        vld1.8      {d0  - d3},   [r1]!
 | 
			
		||||
        vld1.8      {d4  - d7},   [r1]!
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE*8)]
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        vst1.8      {d0  - d3},   [r0, :128]!
 | 
			
		||||
        vst1.8      {d4  - d7},   [r0, :128]!
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
2:      /* fix-up the remaining count and make sure we have >= 32 bytes left */
 | 
			
		||||
        add         r2, r2, #64
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        blo         4f
 | 
			
		||||
 | 
			
		||||
3:      /* 32 bytes at a time. These cache lines were already preloaded */
 | 
			
		||||
        vld1.8      {d0 - d3},  [r1]!
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        vst1.8      {d0 - d3},  [r0, :128]!
 | 
			
		||||
        bhs         3b
 | 
			
		||||
4:      /* less than 32 left */
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
        tst         r2, #0x10
 | 
			
		||||
        beq         5f
 | 
			
		||||
        // copies 16 bytes, 128-bits aligned
 | 
			
		||||
        vld1.8      {d0, d1}, [r1]!
 | 
			
		||||
        vst1.8      {d0, d1}, [r0, :128]!
 | 
			
		||||
 | 
			
		||||
5:      /* copy up to 15-bytes (count in r2) */
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
        bcc         1f
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0]!
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
 | 
			
		||||
        vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0]!
 | 
			
		||||
2:      movs        ip, r2, lsl #31
 | 
			
		||||
        ldrmib      r3, [r1], #1
 | 
			
		||||
        ldrcsb      ip, [r1], #1
 | 
			
		||||
        ldrcsb      lr, [r1], #1
 | 
			
		||||
        strmib      r3, [r0], #1
 | 
			
		||||
        strcsb      ip, [r0], #1
 | 
			
		||||
        strcsb      lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        ldmfd       sp!, {r0, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        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
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(memcpy)
 | 
			
		||||
 | 
			
		||||
#define MEMCPY_BASE         __memcpy_base
 | 
			
		||||
#define MEMCPY_BASE_ALIGNED __memcpy_base_aligned
 | 
			
		||||
#include "memcpy_base.S"
 | 
			
		||||
 | 
			
		||||
ENTRY(__memcpy_chk_fail)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        push    {lr}
 | 
			
		||||
        .save   {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
 | 
			
		||||
        ldr     r0, error_message
 | 
			
		||||
        ldr     r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
        add     r0, pc
 | 
			
		||||
        bl      __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
        .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
        .word   error_string-(1b+4)
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(__memcpy_chk_fail)
 | 
			
		||||
 | 
			
		||||
        .data
 | 
			
		||||
error_string:
 | 
			
		||||
        .string     "memcpy buffer overflow"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										127
									
								
								libc/arch-arm/krait/bionic/memcpy_base.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								libc/arch-arm/krait/bionic/memcpy_base.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,127 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This code assumes it is running on a processor that supports all arm v7
 | 
			
		||||
 * instructions, that supports neon instructions, and that has a 32 byte
 | 
			
		||||
 * cache line.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// Assumes neon instructions and a cache line size of 32 bytes.
 | 
			
		||||
 | 
			
		||||
ENTRY(MEMCPY_BASE)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        .save {r0, lr}
 | 
			
		||||
        .cfi_def_cfa_offset 8
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
        .cfi_rel_offset lr, 4
 | 
			
		||||
 | 
			
		||||
        /* do we have at least 16-bytes to copy (needed for alignment below) */
 | 
			
		||||
        cmp         r2, #16
 | 
			
		||||
        blo         5f
 | 
			
		||||
 | 
			
		||||
        /* align destination to cache-line for the write-buffer */
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #0xF
 | 
			
		||||
        beq         2f
 | 
			
		||||
 | 
			
		||||
        /* copy up to 15-bytes (count in r3) */
 | 
			
		||||
        sub         r2, r2, r3
 | 
			
		||||
        movs        ip, r3, lsl #31
 | 
			
		||||
        itt         mi
 | 
			
		||||
        ldrbmi      lr, [r1], #1
 | 
			
		||||
        strbmi      lr, [r0], #1
 | 
			
		||||
        itttt       cs
 | 
			
		||||
        ldrbcs      ip, [r1], #1
 | 
			
		||||
        ldrbcs      lr, [r1], #1
 | 
			
		||||
        strbcs      ip, [r0], #1
 | 
			
		||||
        strbcs      lr, [r0], #1
 | 
			
		||||
        movs        ip, r3, lsl #29
 | 
			
		||||
        bge         1f
 | 
			
		||||
        // copies 4 bytes, destination 32-bits aligned
 | 
			
		||||
        vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
 | 
			
		||||
        vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]!
 | 
			
		||||
1:      bcc         2f
 | 
			
		||||
        // copies 8 bytes, destination 64-bits aligned
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0, :64]!
 | 
			
		||||
 | 
			
		||||
2:      /* make sure we have at least 64 bytes to copy */
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        blo         2f
 | 
			
		||||
 | 
			
		||||
1:      /* The main loop copies 64 bytes at a time */
 | 
			
		||||
        vld1.8      {d0  - d3},   [r1]!
 | 
			
		||||
        vld1.8      {d4  - d7},   [r1]!
 | 
			
		||||
        pld         [r1, #(32*8)]
 | 
			
		||||
        subs        r2, r2, #64
 | 
			
		||||
        vst1.8      {d0  - d3},   [r0, :128]!
 | 
			
		||||
        vst1.8      {d4  - d7},   [r0, :128]!
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
2:      /* fix-up the remaining count and make sure we have >= 32 bytes left */
 | 
			
		||||
        adds        r2, r2, #32
 | 
			
		||||
        blo         4f
 | 
			
		||||
 | 
			
		||||
        /* Copy 32 bytes. These cache lines were already preloaded */
 | 
			
		||||
        vld1.8      {d0 - d3},  [r1]!
 | 
			
		||||
        sub         r2, r2, #32
 | 
			
		||||
        vst1.8      {d0 - d3},  [r0, :128]!
 | 
			
		||||
 | 
			
		||||
4:      /* less than 32 left */
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
        tst         r2, #0x10
 | 
			
		||||
        beq         5f
 | 
			
		||||
        // copies 16 bytes, 128-bits aligned
 | 
			
		||||
        vld1.8      {d0, d1}, [r1]!
 | 
			
		||||
        vst1.8      {d0, d1}, [r0, :128]!
 | 
			
		||||
 | 
			
		||||
5:      /* copy up to 15-bytes (count in r2) */
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
        bcc         1f
 | 
			
		||||
        vld1.8      {d0}, [r1]!
 | 
			
		||||
        vst1.8      {d0}, [r0]!
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
 | 
			
		||||
        vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0]!
 | 
			
		||||
2:      movs        ip, r2, lsl #31
 | 
			
		||||
        itt         mi
 | 
			
		||||
        ldrbmi      r3, [r1], #1
 | 
			
		||||
        strbmi      r3, [r0], #1
 | 
			
		||||
        itttt       cs
 | 
			
		||||
        ldrbcs      ip, [r1], #1
 | 
			
		||||
        ldrbcs      lr, [r1], #1
 | 
			
		||||
        strbcs      ip, [r0], #1
 | 
			
		||||
        strbcs      lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
        ldmfd       sp!, {r0, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(MEMCPY_BASE)
 | 
			
		||||
@@ -28,6 +28,7 @@
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This code assumes it is running on a processor that supports all arm v7
 | 
			
		||||
@@ -37,15 +38,47 @@
 | 
			
		||||
 | 
			
		||||
    .fpu    neon
 | 
			
		||||
 | 
			
		||||
ENTRY(__memset_chk)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        cmp         r2, r3
 | 
			
		||||
        bls         .L_done
 | 
			
		||||
 | 
			
		||||
        // Preserve lr for backtrace.
 | 
			
		||||
        .save       {lr}
 | 
			
		||||
        push        {lr}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset lr, 0
 | 
			
		||||
 | 
			
		||||
        ldr         r0, error_message
 | 
			
		||||
        ldr         r1, error_code
 | 
			
		||||
1:
 | 
			
		||||
        add         r0, pc
 | 
			
		||||
        bl          __fortify_chk_fail
 | 
			
		||||
error_code:
 | 
			
		||||
        .word       BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW
 | 
			
		||||
error_message:
 | 
			
		||||
        .word       error_string-(1b+8)
 | 
			
		||||
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(__memset_chk)
 | 
			
		||||
 | 
			
		||||
ENTRY(bzero)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        mov     r2, r1
 | 
			
		||||
        mov     r1, #0
 | 
			
		||||
 | 
			
		||||
.L_done:
 | 
			
		||||
        // Fall through to memset...
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(bzero)
 | 
			
		||||
 | 
			
		||||
/* memset() returns its first argument.  */
 | 
			
		||||
ENTRY(memset)
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        .save       {r0}
 | 
			
		||||
        stmfd       sp!, {r0}
 | 
			
		||||
        .cfi_def_cfa_offset 4
 | 
			
		||||
        .cfi_rel_offset r0, 0
 | 
			
		||||
 | 
			
		||||
        vdup.8      q0, r1
 | 
			
		||||
 | 
			
		||||
@@ -78,4 +111,9 @@ ENTRY(memset)
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        ldmfd       sp!, {r0}
 | 
			
		||||
        bx          lr
 | 
			
		||||
        .cfi_endproc
 | 
			
		||||
END(memset)
 | 
			
		||||
 | 
			
		||||
        .data
 | 
			
		||||
error_string:
 | 
			
		||||
        .string     "memset buffer overflow"
 | 
			
		||||
 
 | 
			
		||||
@@ -123,8 +123,13 @@ ENTRY(strcmp)
 | 
			
		||||
        .macro  init
 | 
			
		||||
        /* Macro to save temporary registers and prepare magic values.  */
 | 
			
		||||
        subs    sp, sp, #16
 | 
			
		||||
        .cfi_def_cfa_offset 16
 | 
			
		||||
        strd    r4, r5, [sp, #8]
 | 
			
		||||
        .cfi_rel_offset r4, 0
 | 
			
		||||
        .cfi_rel_offset r5, 4
 | 
			
		||||
        strd    r6, r7, [sp]
 | 
			
		||||
        .cfi_rel_offset r6, 8
 | 
			
		||||
        .cfi_rel_offset r7, 12
 | 
			
		||||
        mvn     r6, #0  /* all F */
 | 
			
		||||
        mov     r7, #0  /* all 0 */
 | 
			
		||||
        .endm   /* init */
 | 
			
		||||
@@ -165,18 +170,20 @@ ENTRY(strcmp)
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
        .endm /* setup_return */
 | 
			
		||||
 | 
			
		||||
        .cfi_startproc
 | 
			
		||||
        pld [r0, #0]
 | 
			
		||||
        pld [r1, #0]
 | 
			
		||||
 | 
			
		||||
        /* Are both strings double-word aligned?  */
 | 
			
		||||
        orr     ip, r0, r1
 | 
			
		||||
        tst     ip, #7
 | 
			
		||||
        bne     do_align
 | 
			
		||||
        bne     .L_do_align
 | 
			
		||||
 | 
			
		||||
        /* Fast path.  */
 | 
			
		||||
        .save   {r4-r7}
 | 
			
		||||
        init
 | 
			
		||||
 | 
			
		||||
doubleword_aligned:
 | 
			
		||||
.L_doubleword_aligned:
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are double-word aligned.  */
 | 
			
		||||
        /* Compare two words in every iteration.  */
 | 
			
		||||
@@ -189,14 +196,14 @@ doubleword_aligned:
 | 
			
		||||
        ldrd    r2, r3, [r0], #8
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
 | 
			
		||||
        magic_compare_and_branch w1=r2, w2=r4, label=return_24
 | 
			
		||||
        magic_compare_and_branch w1=r3, w2=r5, label=return_35
 | 
			
		||||
        magic_compare_and_branch w1=r2, w2=r4, label=.L_return_24
 | 
			
		||||
        magic_compare_and_branch w1=r3, w2=r5, label=.L_return_35
 | 
			
		||||
        b       2b
 | 
			
		||||
 | 
			
		||||
do_align:
 | 
			
		||||
.L_do_align:
 | 
			
		||||
        /* Is the first string word-aligned?  */
 | 
			
		||||
        ands    ip, r0, #3
 | 
			
		||||
        beq     word_aligned_r0
 | 
			
		||||
        beq     .L_word_aligned_r0
 | 
			
		||||
 | 
			
		||||
        /* Fast compare byte by byte until the first string is word-aligned.  */
 | 
			
		||||
        /* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
 | 
			
		||||
@@ -204,58 +211,58 @@ do_align:
 | 
			
		||||
        bic     r0, r0, #3
 | 
			
		||||
        ldr     r2, [r0], #4
 | 
			
		||||
        lsls    ip, ip, #31
 | 
			
		||||
        beq     byte2
 | 
			
		||||
        bcs     byte3
 | 
			
		||||
        beq     .L_byte2
 | 
			
		||||
        bcs     .L_byte3
 | 
			
		||||
 | 
			
		||||
byte1:
 | 
			
		||||
.L_byte1:
 | 
			
		||||
        ldrb    ip, [r1], #1
 | 
			
		||||
        uxtb    r3, r2, ror #BYTE1_OFFSET
 | 
			
		||||
        subs    ip, r3, ip
 | 
			
		||||
        bne     fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=fast_return
 | 
			
		||||
        bne     .L_fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=.L_fast_return
 | 
			
		||||
 | 
			
		||||
byte2:
 | 
			
		||||
.L_byte2:
 | 
			
		||||
        ldrb    ip, [r1], #1
 | 
			
		||||
        uxtb    r3, r2, ror #BYTE2_OFFSET
 | 
			
		||||
        subs    ip, r3, ip
 | 
			
		||||
        bne     fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=fast_return
 | 
			
		||||
        bne     .L_fast_return
 | 
			
		||||
        m_cbz   reg=r3, label=.L_fast_return
 | 
			
		||||
 | 
			
		||||
byte3:
 | 
			
		||||
.L_byte3:
 | 
			
		||||
        ldrb    ip, [r1], #1
 | 
			
		||||
        uxtb    r3, r2, ror #BYTE3_OFFSET
 | 
			
		||||
        subs    ip, r3, ip
 | 
			
		||||
        bne     fast_return
 | 
			
		||||
        m_cbnz  reg=r3, label=word_aligned_r0
 | 
			
		||||
        bne     .L_fast_return
 | 
			
		||||
        m_cbnz  reg=r3, label=.L_word_aligned_r0
 | 
			
		||||
 | 
			
		||||
fast_return:
 | 
			
		||||
.L_fast_return:
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
        bx      lr
 | 
			
		||||
 | 
			
		||||
word_aligned_r0:
 | 
			
		||||
.L_word_aligned_r0:
 | 
			
		||||
        init
 | 
			
		||||
        /* The first string is word-aligned.  */
 | 
			
		||||
        /* Is the second string word-aligned?  */
 | 
			
		||||
        ands    ip, r1, #3
 | 
			
		||||
        bne     strcmp_unaligned
 | 
			
		||||
        bne     .L_strcmp_unaligned
 | 
			
		||||
 | 
			
		||||
word_aligned:
 | 
			
		||||
.L_word_aligned:
 | 
			
		||||
        /* The strings are word-aligned. */
 | 
			
		||||
        /* Is the first string double-word aligned?  */
 | 
			
		||||
        tst     r0, #4
 | 
			
		||||
        beq     doubleword_aligned_r0
 | 
			
		||||
        beq     .L_doubleword_aligned_r0
 | 
			
		||||
 | 
			
		||||
        /* If r0 is not double-word aligned yet, align it by loading
 | 
			
		||||
        and comparing the next word from each string.  */
 | 
			
		||||
        ldr     r2, [r0], #4
 | 
			
		||||
        ldr     r4, [r1], #4
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r4 label=return_24
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r4 label=.L_return_24
 | 
			
		||||
 | 
			
		||||
doubleword_aligned_r0:
 | 
			
		||||
.L_doubleword_aligned_r0:
 | 
			
		||||
        /* Get here when r0 is double-word aligned.  */
 | 
			
		||||
        /* Is r1 doubleword_aligned?  */
 | 
			
		||||
        tst     r1, #4
 | 
			
		||||
        beq     doubleword_aligned
 | 
			
		||||
        beq     .L_doubleword_aligned
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are word-aligned,
 | 
			
		||||
        r0 is double-word aligned, but r1 is not double-word aligned.  */
 | 
			
		||||
@@ -271,9 +278,9 @@ doubleword_aligned_r0:
 | 
			
		||||
 | 
			
		||||
        /* Load the next double-word from each string and compare.  */
 | 
			
		||||
        ldrd    r2, r3, [r0], #8
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r5 label=return_25
 | 
			
		||||
        magic_compare_and_branch w1=r2 w2=r5 label=.L_return_25
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        magic_compare_and_branch w1=r3 w2=r4 label=return_34
 | 
			
		||||
        magic_compare_and_branch w1=r3 w2=r4 label=.L_return_34
 | 
			
		||||
        b       3b
 | 
			
		||||
 | 
			
		||||
        .macro miscmp_word offsetlo offsethi
 | 
			
		||||
@@ -297,46 +304,46 @@ doubleword_aligned_r0:
 | 
			
		||||
        and     r2, r3, r6, S2LOMEM #\offsetlo
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   r2, r5
 | 
			
		||||
        bne     return_25
 | 
			
		||||
        bne     .L_return_25
 | 
			
		||||
        ldr     r5, [r1], #4
 | 
			
		||||
        cmp     ip, #0
 | 
			
		||||
        eor r3, r2, r3
 | 
			
		||||
        S2HIMEM r2, r5, #\offsethi
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   r3, r2
 | 
			
		||||
        bne     return_32
 | 
			
		||||
        bne     .L_return_32
 | 
			
		||||
        b       7b
 | 
			
		||||
        .endm /* miscmp_word */
 | 
			
		||||
 | 
			
		||||
strcmp_unaligned:
 | 
			
		||||
.L_strcmp_unaligned:
 | 
			
		||||
        /* r0 is word-aligned, r1 is at offset ip from a word.  */
 | 
			
		||||
        /* Align r1 to the (previous) word-boundary.  */
 | 
			
		||||
        bic     r1, r1, #3
 | 
			
		||||
 | 
			
		||||
        /* Unaligned comparison word by word using LDRs. */
 | 
			
		||||
        cmp     ip, #2
 | 
			
		||||
        beq     miscmp_word_16                    /* If ip == 2.  */
 | 
			
		||||
        bge     miscmp_word_24                    /* If ip == 3.  */
 | 
			
		||||
        beq     .L_miscmp_word_16                 /* If ip == 2.  */
 | 
			
		||||
        bge     .L_miscmp_word_24                 /* If ip == 3.  */
 | 
			
		||||
        miscmp_word offsetlo=8 offsethi=24        /* If ip == 1.  */
 | 
			
		||||
miscmp_word_24:  miscmp_word offsetlo=24 offsethi=8
 | 
			
		||||
.L_miscmp_word_24:  miscmp_word offsetlo=24 offsethi=8
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
return_32:
 | 
			
		||||
.L_return_32:
 | 
			
		||||
        setup_return w1=r3, w2=r2
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_34:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_34:
 | 
			
		||||
        setup_return w1=r3, w2=r4
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_25:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_25:
 | 
			
		||||
        setup_return w1=r2, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_35:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_35:
 | 
			
		||||
        setup_return w1=r3, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_24:
 | 
			
		||||
        b       .L_do_return
 | 
			
		||||
.L_return_24:
 | 
			
		||||
        setup_return w1=r2, w2=r4
 | 
			
		||||
 | 
			
		||||
do_return:
 | 
			
		||||
.L_do_return:
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
@@ -348,11 +355,16 @@ do_return:
 | 
			
		||||
        ldrd    r6, r7, [sp]
 | 
			
		||||
        ldrd    r4, r5, [sp, #8]
 | 
			
		||||
        adds    sp, sp, #16
 | 
			
		||||
        .cfi_def_cfa_offset 0
 | 
			
		||||
        .cfi_restore r4
 | 
			
		||||
        .cfi_restore r5
 | 
			
		||||
        .cfi_restore r6
 | 
			
		||||
        .cfi_restore r7
 | 
			
		||||
 | 
			
		||||
        /* There is a zero or a different byte between r1 and r2.  */
 | 
			
		||||
        /* r0 contains a mask of all-zero bytes in r1.  */
 | 
			
		||||
        /* Using r0 and not ip here because cbz requires low register.  */
 | 
			
		||||
        m_cbz   reg=r0, label=compute_return_value
 | 
			
		||||
        m_cbz   reg=r0, label=.L_compute_return_value
 | 
			
		||||
        clz     r0, r0
 | 
			
		||||
        /* r0 contains the number of bits on the left of the first all-zero byte in r1.  */
 | 
			
		||||
        rsb     r0, r0, #24
 | 
			
		||||
@@ -360,7 +372,7 @@ do_return:
 | 
			
		||||
        lsr     r1, r1, r0
 | 
			
		||||
        lsr     r2, r2, r0
 | 
			
		||||
 | 
			
		||||
compute_return_value:
 | 
			
		||||
.L_compute_return_value:
 | 
			
		||||
        movs    r0, #1
 | 
			
		||||
        cmp     r1, r2
 | 
			
		||||
        /* The return value is computed as follows.
 | 
			
		||||
@@ -380,7 +392,7 @@ compute_return_value:
 | 
			
		||||
     * previous version. See bionic/libc/arch-arm/cortex-a15/bionic/strcmp.S
 | 
			
		||||
     * for the unedited version of this code.
 | 
			
		||||
     */
 | 
			
		||||
miscmp_word_16:
 | 
			
		||||
.L_miscmp_word_16:
 | 
			
		||||
	wp1 .req r0
 | 
			
		||||
	wp2 .req r1
 | 
			
		||||
	b1  .req r2
 | 
			
		||||
@@ -453,6 +465,11 @@ miscmp_word_16:
 | 
			
		||||
    ldrd    r6, r7, [sp]
 | 
			
		||||
    ldrd    r4, r5, [sp, #8]
 | 
			
		||||
    adds    sp, sp, #16
 | 
			
		||||
    .cfi_def_cfa_offset 0
 | 
			
		||||
    .cfi_restore r4
 | 
			
		||||
    .cfi_restore r5
 | 
			
		||||
    .cfi_restore r6
 | 
			
		||||
    .cfi_restore r7
 | 
			
		||||
 | 
			
		||||
	bx	lr
 | 
			
		||||
 | 
			
		||||
@@ -472,6 +489,12 @@ miscmp_word_16:
 | 
			
		||||
    ldrd    r6, r7, [sp]
 | 
			
		||||
    ldrd    r4, r5, [sp, #8]
 | 
			
		||||
    adds    sp, sp, #16
 | 
			
		||||
    .cfi_def_cfa_offset 0
 | 
			
		||||
    .cfi_restore r4
 | 
			
		||||
    .cfi_restore r5
 | 
			
		||||
    .cfi_restore r6
 | 
			
		||||
    .cfi_restore r7
 | 
			
		||||
 | 
			
		||||
	bx	lr
 | 
			
		||||
    .cfi_endproc
 | 
			
		||||
END(strcmp)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,11 @@
 | 
			
		||||
$(call libc-add-cpu-variant-src,MEMCPY,arch-arm/krait/bionic/memcpy.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,MEMSET,arch-arm/krait/bionic/memset.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCMP,arch-arm/krait/bionic/strcmp.S)
 | 
			
		||||
# Use cortex-a15 version of strlen.
 | 
			
		||||
$(call libc-add-cpu-variant-src,__STRCAT_CHK,arch-arm/krait/bionic/__strcat_chk.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,__STRCPY_CHK,arch-arm/krait/bionic/__strcpy_chk.S)
 | 
			
		||||
# Use cortex-a15 versions of strcat/strcpy/strlen.
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCAT,arch-arm/cortex-a15/bionic/strcat.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRCPY,arch-arm/cortex-a15/bionic/strcpy.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRLEN,arch-arm/cortex-a15/bionic/strlen.S)
 | 
			
		||||
 | 
			
		||||
include bionic/libc/arch-arm/generic/generic.mk
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright (c) 2010, 2011 Intel Corporation
 | 
			
		||||
Copyright (c) 2010, 2011, 2012, 2013 Intel Corporation
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
Redistribution and use in source and binary forms, with or without
 | 
			
		||||
@@ -106,9 +106,12 @@ name:                            \
 | 
			
		||||
ENTRY (MEMCMP)
 | 
			
		||||
	movl	LEN(%esp), %ecx
 | 
			
		||||
 | 
			
		||||
#ifdef USE_AS_WMEMCMP
 | 
			
		||||
#ifdef USE_WCHAR
 | 
			
		||||
	shl	$2, %ecx
 | 
			
		||||
	jz	L(zero)
 | 
			
		||||
#elif defined USE_UTF16
 | 
			
		||||
	shl	$1, %ecx
 | 
			
		||||
	jz	L(zero)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	movl	BLK1(%esp), %eax
 | 
			
		||||
@@ -116,7 +119,7 @@ ENTRY (MEMCMP)
 | 
			
		||||
	movl	BLK2(%esp), %edx
 | 
			
		||||
	jae	L(48bytesormore)
 | 
			
		||||
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cmp	$1, %ecx
 | 
			
		||||
	jbe	L(less1bytes)
 | 
			
		||||
#endif
 | 
			
		||||
@@ -128,7 +131,7 @@ ENTRY (MEMCMP)
 | 
			
		||||
 | 
			
		||||
	CFI_POP	(%ebx)
 | 
			
		||||
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(less1bytes):
 | 
			
		||||
	jb	L(zero)
 | 
			
		||||
@@ -174,7 +177,7 @@ L(48bytesormore):
 | 
			
		||||
	jz	L(shr_0)
 | 
			
		||||
	xor	%edx, %esi
 | 
			
		||||
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cmp	$8, %edx
 | 
			
		||||
	jae	L(next_unaligned_table)
 | 
			
		||||
	cmp	$0, %edx
 | 
			
		||||
@@ -210,7 +213,7 @@ L(next_unaligned_table):
 | 
			
		||||
	cmp	$14, %edx
 | 
			
		||||
	je	L(shr_14)
 | 
			
		||||
	jmp	L(shr_15)
 | 
			
		||||
#else
 | 
			
		||||
#elif defined(USE_WCHAR)
 | 
			
		||||
	cmp	$0, %edx
 | 
			
		||||
	je	L(shr_0)
 | 
			
		||||
	cmp	$4, %edx
 | 
			
		||||
@@ -218,6 +221,22 @@ L(next_unaligned_table):
 | 
			
		||||
	cmp	$8, %edx
 | 
			
		||||
	je	L(shr_8)
 | 
			
		||||
	jmp	L(shr_12)
 | 
			
		||||
#elif defined(USE_UTF16)
 | 
			
		||||
	cmp	$0, %edx
 | 
			
		||||
	je	L(shr_0)
 | 
			
		||||
	cmp	$2, %edx
 | 
			
		||||
	je	L(shr_2)
 | 
			
		||||
	cmp	$4, %edx
 | 
			
		||||
	je	L(shr_4)
 | 
			
		||||
	cmp	$6, %edx
 | 
			
		||||
	je	L(shr_6)
 | 
			
		||||
	cmp	$8, %edx
 | 
			
		||||
	je	L(shr_8)
 | 
			
		||||
	cmp	$10, %edx
 | 
			
		||||
	je	L(shr_10)
 | 
			
		||||
	cmp	$12, %edx
 | 
			
		||||
	je	L(shr_12)
 | 
			
		||||
	jmp	L(shr_14)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -289,7 +308,7 @@ L(shr_0_gobble_loop_next):
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -372,8 +391,10 @@ L(shr_1_gobble_next):
 | 
			
		||||
	POP	(%edi)
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if !defined(USE_WCHAR)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -456,7 +477,9 @@ L(shr_2_gobble_next):
 | 
			
		||||
	POP	(%edi)
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -624,7 +647,7 @@ L(shr_4_gobble_next):
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -707,7 +730,9 @@ L(shr_5_gobble_next):
 | 
			
		||||
	POP	(%edi)
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(USE_WCHAR)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -790,7 +815,9 @@ L(shr_6_gobble_next):
 | 
			
		||||
	POP	(%edi)
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -958,7 +985,7 @@ L(shr_8_gobble_next):
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -1041,7 +1068,9 @@ L(shr_9_gobble_next):
 | 
			
		||||
	POP	(%edi)
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(USE_WCHAR)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -1124,7 +1153,9 @@ L(shr_10_gobble_next):
 | 
			
		||||
	POP	(%edi)
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -1292,7 +1323,7 @@ L(shr_12_gobble_next):
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -1375,7 +1406,9 @@ L(shr_13_gobble_next):
 | 
			
		||||
	POP	(%edi)
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(USE_WCHAR)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -1458,7 +1491,9 @@ L(shr_14_gobble_next):
 | 
			
		||||
	POP	(%edi)
 | 
			
		||||
	POP	(%esi)
 | 
			
		||||
	jmp	L(less48bytes)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cfi_restore_state
 | 
			
		||||
	cfi_remember_state
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -1558,7 +1593,7 @@ L(first16bytes):
 | 
			
		||||
	add	%eax, %esi
 | 
			
		||||
L(less16bytes):
 | 
			
		||||
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	test	%dl, %dl
 | 
			
		||||
	jz	L(next_24_bytes)
 | 
			
		||||
 | 
			
		||||
@@ -1668,7 +1703,7 @@ L(Byte31):
 | 
			
		||||
	movzbl	-9(%esi), %edx
 | 
			
		||||
	sub	%edx, %eax
 | 
			
		||||
	RETURN_END
 | 
			
		||||
#else
 | 
			
		||||
#elif defined(USE_AS_WMEMCMP)
 | 
			
		||||
 | 
			
		||||
/* special for wmemcmp */
 | 
			
		||||
	test	%dl, %dl
 | 
			
		||||
@@ -1682,7 +1717,6 @@ L(Byte31):
 | 
			
		||||
	neg	%eax
 | 
			
		||||
	RETURN
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(second_double_word):
 | 
			
		||||
	mov	-12(%edi), %ecx
 | 
			
		||||
@@ -1691,7 +1725,7 @@ L(second_double_word):
 | 
			
		||||
	jg	L(nequal_bigger)
 | 
			
		||||
	neg	%eax
 | 
			
		||||
	RETURN
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(next_two_double_words):
 | 
			
		||||
	and	$15, %dh
 | 
			
		||||
@@ -1715,6 +1749,79 @@ L(fourth_double_word):
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(nequal_bigger):
 | 
			
		||||
	RETURN_END
 | 
			
		||||
 | 
			
		||||
#elif defined(USE_AS_MEMCMP16)
 | 
			
		||||
 | 
			
		||||
/* special for __memcmp16 */
 | 
			
		||||
	test	%dl, %dl
 | 
			
		||||
	jz	L(next_four_words)
 | 
			
		||||
	test	$15, %dl
 | 
			
		||||
	jz	L(second_two_words)
 | 
			
		||||
	test	$3, %dl
 | 
			
		||||
	jz	L(second_word)
 | 
			
		||||
	movzwl	-16(%edi), %eax
 | 
			
		||||
	movzwl	-16(%esi), %ebx
 | 
			
		||||
	subl	%ebx, %eax
 | 
			
		||||
	RETURN
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(second_word):
 | 
			
		||||
	movzwl	-14(%edi), %eax
 | 
			
		||||
	movzwl	-14(%esi), %ebx
 | 
			
		||||
	subl	%ebx, %eax
 | 
			
		||||
	RETURN
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(second_two_words):
 | 
			
		||||
	test	$63, %dl
 | 
			
		||||
	jz	L(fourth_word)
 | 
			
		||||
	movzwl	-12(%edi), %eax
 | 
			
		||||
	movzwl	-12(%esi), %ebx
 | 
			
		||||
	subl	%ebx, %eax
 | 
			
		||||
	RETURN
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(fourth_word):
 | 
			
		||||
	movzwl	-10(%edi), %eax
 | 
			
		||||
	movzwl	-10(%esi), %ebx
 | 
			
		||||
	subl	%ebx, %eax
 | 
			
		||||
	RETURN
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(next_four_words):
 | 
			
		||||
	test	$15, %dh
 | 
			
		||||
	jz	L(fourth_two_words)
 | 
			
		||||
	test	$3, %dh
 | 
			
		||||
	jz	L(sixth_word)
 | 
			
		||||
	movzwl	-8(%edi), %eax
 | 
			
		||||
	movzwl	-8(%esi), %ebx
 | 
			
		||||
	subl	%ebx, %eax
 | 
			
		||||
	RETURN
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(sixth_word):
 | 
			
		||||
	movzwl	-6(%edi), %eax
 | 
			
		||||
	movzwl	-6(%esi), %ebx
 | 
			
		||||
	subl	%ebx, %eax
 | 
			
		||||
	RETURN
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(fourth_two_words):
 | 
			
		||||
	test	$63, %dh
 | 
			
		||||
	jz	L(eighth_word)
 | 
			
		||||
	movzwl	-4(%edi), %eax
 | 
			
		||||
	movzwl	-4(%esi), %ebx
 | 
			
		||||
	subl	%ebx, %eax
 | 
			
		||||
	RETURN
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(eighth_word):
 | 
			
		||||
	movzwl	-2(%edi), %eax
 | 
			
		||||
	movzwl	-2(%esi), %ebx
 | 
			
		||||
	subl	%ebx, %eax
 | 
			
		||||
	RETURN
 | 
			
		||||
#else
 | 
			
		||||
# error Unreachable preprocessor case
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	CFI_PUSH (%ebx)
 | 
			
		||||
@@ -1725,7 +1832,7 @@ L(more8bytes):
 | 
			
		||||
	jae	L(more16bytes)
 | 
			
		||||
	cmp	$8, %ecx
 | 
			
		||||
	je	L(8bytes)
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cmp	$9, %ecx
 | 
			
		||||
	je	L(9bytes)
 | 
			
		||||
	cmp	$10, %ecx
 | 
			
		||||
@@ -1739,8 +1846,16 @@ L(more8bytes):
 | 
			
		||||
	cmp	$14, %ecx
 | 
			
		||||
	je	L(14bytes)
 | 
			
		||||
	jmp	L(15bytes)
 | 
			
		||||
#else
 | 
			
		||||
#elif defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	jmp	L(12bytes)
 | 
			
		||||
#elif defined(USE_UTF16) && !defined(USE_WCHAR)
 | 
			
		||||
	cmp	$10, %ecx
 | 
			
		||||
	je	L(10bytes)
 | 
			
		||||
	cmp	$12, %ecx
 | 
			
		||||
	je	L(12bytes)
 | 
			
		||||
	jmp	L(14bytes)
 | 
			
		||||
#else
 | 
			
		||||
# error Unreachable preprocessor case
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -1749,7 +1864,7 @@ L(more16bytes):
 | 
			
		||||
	jae	L(more24bytes)
 | 
			
		||||
	cmp	$16, %ecx
 | 
			
		||||
	je	L(16bytes)
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cmp	$17, %ecx
 | 
			
		||||
	je	L(17bytes)
 | 
			
		||||
	cmp	$18, %ecx
 | 
			
		||||
@@ -1763,8 +1878,16 @@ L(more16bytes):
 | 
			
		||||
	cmp	$22, %ecx
 | 
			
		||||
	je	L(22bytes)
 | 
			
		||||
	jmp	L(23bytes)
 | 
			
		||||
#else
 | 
			
		||||
#elif defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	jmp	L(20bytes)
 | 
			
		||||
#elif defined(USE_UTF16) && !defined(USE_WCHAR)
 | 
			
		||||
	cmp	$18, %ecx
 | 
			
		||||
	je	L(18bytes)
 | 
			
		||||
	cmp	$20, %ecx
 | 
			
		||||
	je	L(20bytes)
 | 
			
		||||
	jmp	L(22bytes)
 | 
			
		||||
#else
 | 
			
		||||
# error Unreachable preprocessor case
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -1773,7 +1896,7 @@ L(more24bytes):
 | 
			
		||||
	jae	L(more32bytes)
 | 
			
		||||
	cmp	$24, %ecx
 | 
			
		||||
	je	L(24bytes)
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cmp	$25, %ecx
 | 
			
		||||
	je	L(25bytes)
 | 
			
		||||
	cmp	$26, %ecx
 | 
			
		||||
@@ -1787,8 +1910,16 @@ L(more24bytes):
 | 
			
		||||
	cmp	$30, %ecx
 | 
			
		||||
	je	L(30bytes)
 | 
			
		||||
	jmp	L(31bytes)
 | 
			
		||||
#else
 | 
			
		||||
#elif defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	jmp	L(28bytes)
 | 
			
		||||
#elif defined(USE_UTF16) && !defined(USE_WCHAR)
 | 
			
		||||
	cmp	$26, %ecx
 | 
			
		||||
	je	L(26bytes)
 | 
			
		||||
	cmp	$28, %ecx
 | 
			
		||||
	je	L(28bytes)
 | 
			
		||||
	jmp	L(30bytes)
 | 
			
		||||
#else
 | 
			
		||||
# error Unreachable preprocessor case
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
@@ -1797,7 +1928,7 @@ L(more32bytes):
 | 
			
		||||
	jae	L(more40bytes)
 | 
			
		||||
	cmp	$32, %ecx
 | 
			
		||||
	je	L(32bytes)
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cmp	$33, %ecx
 | 
			
		||||
	je	L(33bytes)
 | 
			
		||||
	cmp	$34, %ecx
 | 
			
		||||
@@ -1811,15 +1942,23 @@ L(more32bytes):
 | 
			
		||||
	cmp	$38, %ecx
 | 
			
		||||
	je	L(38bytes)
 | 
			
		||||
	jmp	L(39bytes)
 | 
			
		||||
#else
 | 
			
		||||
#elif defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	jmp	L(36bytes)
 | 
			
		||||
#elif defined(USE_UTF16) && !defined(USE_WCHAR)
 | 
			
		||||
	cmp	$34, %ecx
 | 
			
		||||
	je	L(34bytes)
 | 
			
		||||
	cmp	$36, %ecx
 | 
			
		||||
	je	L(36bytes)
 | 
			
		||||
	jmp	L(38bytes)
 | 
			
		||||
#else
 | 
			
		||||
# error Unreachable preprocessor case
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(less48bytes):
 | 
			
		||||
	cmp	$8, %ecx
 | 
			
		||||
	jae	L(more8bytes)
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cmp	$2, %ecx
 | 
			
		||||
	je	L(2bytes)
 | 
			
		||||
	cmp	$3, %ecx
 | 
			
		||||
@@ -1831,15 +1970,23 @@ L(less48bytes):
 | 
			
		||||
	cmp	$6, %ecx
 | 
			
		||||
	je	L(6bytes)
 | 
			
		||||
	jmp	L(7bytes)
 | 
			
		||||
#else
 | 
			
		||||
#elif defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	jmp	L(4bytes)
 | 
			
		||||
#elif defined(USE_UTF16) && !defined(USE_WCHAR)
 | 
			
		||||
	cmp	$2, %ecx
 | 
			
		||||
	je	L(2bytes)
 | 
			
		||||
	cmp	$4, %ecx
 | 
			
		||||
	je	L(4bytes)
 | 
			
		||||
	jmp	L(6bytes)
 | 
			
		||||
#else
 | 
			
		||||
# error Unreachable preprocessor case
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(more40bytes):
 | 
			
		||||
	cmp	$40, %ecx
 | 
			
		||||
	je	L(40bytes)
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_WCHAR) && !defined(USE_UTF16)
 | 
			
		||||
	cmp	$41, %ecx
 | 
			
		||||
	je	L(41bytes)
 | 
			
		||||
	cmp	$42, %ecx
 | 
			
		||||
@@ -1853,7 +2000,15 @@ L(more40bytes):
 | 
			
		||||
	cmp	$46, %ecx
 | 
			
		||||
	je	L(46bytes)
 | 
			
		||||
	jmp	L(47bytes)
 | 
			
		||||
#elif defined(USE_UTF16) && !defined(USE_WCHAR)
 | 
			
		||||
	cmp	$42, %ecx
 | 
			
		||||
	je	L(42bytes)
 | 
			
		||||
	cmp	$44, %ecx
 | 
			
		||||
	je	L(44bytes)
 | 
			
		||||
	jmp	L(46bytes)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(USE_AS_WMEMCMP) && !defined(USE_AS_MEMCMP16)
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(44bytes):
 | 
			
		||||
	mov	-44(%eax), %ecx
 | 
			
		||||
@@ -1914,7 +2069,8 @@ L(4bytes):
 | 
			
		||||
	POP	(%ebx)
 | 
			
		||||
	ret
 | 
			
		||||
	CFI_PUSH (%ebx)
 | 
			
		||||
#else
 | 
			
		||||
#elif defined(USE_AS_WMEMCMP)
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(44bytes):
 | 
			
		||||
	mov	-44(%eax), %ecx
 | 
			
		||||
@@ -1964,9 +2120,131 @@ L(4bytes):
 | 
			
		||||
	POP	(%ebx)
 | 
			
		||||
	ret
 | 
			
		||||
	CFI_PUSH (%ebx)
 | 
			
		||||
#elif defined USE_AS_MEMCMP16
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(46bytes):
 | 
			
		||||
	movzwl	-46(%eax), %ecx
 | 
			
		||||
	movzwl	-46(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(44bytes):
 | 
			
		||||
	movzwl	-44(%eax), %ecx
 | 
			
		||||
	movzwl	-44(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(42bytes):
 | 
			
		||||
	movzwl	-42(%eax), %ecx
 | 
			
		||||
	movzwl	-42(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(40bytes):
 | 
			
		||||
	movzwl	-40(%eax), %ecx
 | 
			
		||||
	movzwl	-40(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(38bytes):
 | 
			
		||||
	movzwl	-38(%eax), %ecx
 | 
			
		||||
	movzwl	-38(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(36bytes):
 | 
			
		||||
	movzwl	-36(%eax), %ecx
 | 
			
		||||
	movzwl	-36(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(34bytes):
 | 
			
		||||
	movzwl	-34(%eax), %ecx
 | 
			
		||||
	movzwl	-34(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(32bytes):
 | 
			
		||||
	movzwl	-32(%eax), %ecx
 | 
			
		||||
	movzwl	-32(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(30bytes):
 | 
			
		||||
	movzwl	-30(%eax), %ecx
 | 
			
		||||
	movzwl	-30(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(28bytes):
 | 
			
		||||
	movzwl	-28(%eax), %ecx
 | 
			
		||||
	movzwl	-28(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(26bytes):
 | 
			
		||||
	movzwl	-26(%eax), %ecx
 | 
			
		||||
	movzwl	-26(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(24bytes):
 | 
			
		||||
	movzwl	-24(%eax), %ecx
 | 
			
		||||
	movzwl	-24(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(22bytes):
 | 
			
		||||
	movzwl	-22(%eax), %ecx
 | 
			
		||||
	movzwl	-22(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(20bytes):
 | 
			
		||||
	movzwl	-20(%eax), %ecx
 | 
			
		||||
	movzwl	-20(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(18bytes):
 | 
			
		||||
	movzwl	-18(%eax), %ecx
 | 
			
		||||
	movzwl	-18(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(16bytes):
 | 
			
		||||
	movzwl	-16(%eax), %ecx
 | 
			
		||||
	movzwl	-16(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(14bytes):
 | 
			
		||||
	movzwl	-14(%eax), %ecx
 | 
			
		||||
	movzwl	-14(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(12bytes):
 | 
			
		||||
	movzwl	-12(%eax), %ecx
 | 
			
		||||
	movzwl	-12(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(10bytes):
 | 
			
		||||
	movzwl	-10(%eax), %ecx
 | 
			
		||||
	movzwl	-10(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(8bytes):
 | 
			
		||||
	movzwl	-8(%eax), %ecx
 | 
			
		||||
	movzwl	-8(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(6bytes):
 | 
			
		||||
	movzwl	-6(%eax), %ecx
 | 
			
		||||
	movzwl	-6(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(4bytes):
 | 
			
		||||
	movzwl	-4(%eax), %ecx
 | 
			
		||||
	movzwl	-4(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %ecx
 | 
			
		||||
	jne	L(memcmp16_exit)
 | 
			
		||||
L(2bytes):
 | 
			
		||||
	movzwl	-2(%eax), %eax
 | 
			
		||||
	movzwl	-2(%edx), %ebx
 | 
			
		||||
	subl	%ebx, %eax
 | 
			
		||||
	POP	(%ebx)
 | 
			
		||||
	ret
 | 
			
		||||
	CFI_PUSH (%ebx)
 | 
			
		||||
#else
 | 
			
		||||
# error Unreachable preprocessor case
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef USE_AS_WMEMCMP
 | 
			
		||||
#if !defined(USE_AS_WMEMCMP) && !defined(USE_AS_MEMCMP16)
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(45bytes):
 | 
			
		||||
@@ -2191,9 +2469,8 @@ L(end):
 | 
			
		||||
	neg	%eax
 | 
			
		||||
L(bigger):
 | 
			
		||||
	ret
 | 
			
		||||
#else
 | 
			
		||||
#elif defined(USE_AS_WMEMCMP)
 | 
			
		||||
 | 
			
		||||
/* for wmemcmp */
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(find_diff):
 | 
			
		||||
	POP	(%ebx)
 | 
			
		||||
@@ -2206,5 +2483,14 @@ L(find_diff):
 | 
			
		||||
L(find_diff_bigger):
 | 
			
		||||
	ret
 | 
			
		||||
 | 
			
		||||
#elif defined(USE_AS_MEMCMP16)
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(memcmp16_exit):
 | 
			
		||||
	POP	(%ebx)
 | 
			
		||||
	mov	%ecx, %eax
 | 
			
		||||
	ret
 | 
			
		||||
#else
 | 
			
		||||
# error Unreachable preprocessor case
 | 
			
		||||
#endif
 | 
			
		||||
END (MEMCMP)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										37
									
								
								libc/arch-x86/string/ssse3-memcmp16-atom.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								libc/arch-x86/string/ssse3-memcmp16-atom.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright (c) 2013, Intel 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 Intel Corporation nor the names of its contributors
 | 
			
		||||
    * may be used to endorse or promote products derived from this software
 | 
			
		||||
    * without specific prior written permission.
 | 
			
		||||
 | 
			
		||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 | 
			
		||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 | 
			
		||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 | 
			
		||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 | 
			
		||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 | 
			
		||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
			
		||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 | 
			
		||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 | 
			
		||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 | 
			
		||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#define MEMCMP  __memcmp16
 | 
			
		||||
 | 
			
		||||
/* int __memcmp16(const unsigned short *ptr1, const unsigned short *ptr2, size_t n); */
 | 
			
		||||
 | 
			
		||||
#define USE_UTF16
 | 
			
		||||
#define USE_AS_MEMCMP16 1
 | 
			
		||||
#include "ssse3-memcmp-atom.S"
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright (c) 2011, Intel Corporation
 | 
			
		||||
Copyright (c) 2011, 2012, 2013 Intel Corporation
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
Redistribution and use in source and binary forms, with or without
 | 
			
		||||
@@ -29,5 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#define MEMCMP  wmemcmp
 | 
			
		||||
 | 
			
		||||
#define USE_WCHAR
 | 
			
		||||
#define USE_AS_WMEMCMP 1
 | 
			
		||||
#include "ssse3-memcmp-atom.S"
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,7 @@ _LIBC_ARCH_COMMON_SRC_FILES += \
 | 
			
		||||
	arch-x86/string/ssse3-strcpy-atom.S \
 | 
			
		||||
	arch-x86/string/ssse3-memcmp-atom.S \
 | 
			
		||||
	arch-x86/string/ssse3-wmemcmp-atom.S \
 | 
			
		||||
	arch-x86/string/ssse3-memcmp16-atom.S \
 | 
			
		||||
	arch-x86/string/ssse3-wcscat-atom.S \
 | 
			
		||||
	arch-x86/string/ssse3-wcscpy-atom.S
 | 
			
		||||
else
 | 
			
		||||
@@ -38,6 +39,7 @@ _LIBC_ARCH_COMMON_SRC_FILES += \
 | 
			
		||||
	arch-x86/string/strncmp.S \
 | 
			
		||||
	arch-x86/string/strcat.S \
 | 
			
		||||
	arch-x86/string/memcmp.S \
 | 
			
		||||
	string/memcmp16.c \
 | 
			
		||||
	string/strcpy.c \
 | 
			
		||||
	string/strncat.c \
 | 
			
		||||
	string/strncpy.c \
 | 
			
		||||
 
 | 
			
		||||
@@ -31,18 +31,17 @@
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include "libc_logging.h"
 | 
			
		||||
 | 
			
		||||
char *
 | 
			
		||||
__strrchr_chk(const char *p, int ch, size_t s_len)
 | 
			
		||||
extern "C" char* __strrchr_chk(const char *p, int ch, size_t s_len)
 | 
			
		||||
{
 | 
			
		||||
	char *save;
 | 
			
		||||
    char *save;
 | 
			
		||||
 | 
			
		||||
	for (save = NULL;; ++p, s_len--) {
 | 
			
		||||
		if (s_len == 0)
 | 
			
		||||
			__fortify_chk_fail("strrchr read beyond buffer", 0);
 | 
			
		||||
		if (*p == (char) ch)
 | 
			
		||||
			save = (char *)p;
 | 
			
		||||
		if (!*p)
 | 
			
		||||
			return(save);
 | 
			
		||||
	}
 | 
			
		||||
	/* NOTREACHED */
 | 
			
		||||
    for (save = NULL;; ++p, s_len--) {
 | 
			
		||||
        if (s_len == 0)
 | 
			
		||||
            __fortify_chk_fail("strrchr read beyond buffer", 0);
 | 
			
		||||
        if (*p == (char) ch)
 | 
			
		||||
            save = (char *)p;
 | 
			
		||||
        if (!*p)
 | 
			
		||||
            return(save);
 | 
			
		||||
    }
 | 
			
		||||
    /* NOTREACHED */
 | 
			
		||||
}
 | 
			
		||||
@@ -16,6 +16,7 @@
 | 
			
		||||
 | 
			
		||||
#include "dlmalloc.h"
 | 
			
		||||
 | 
			
		||||
#include "private/bionic_name_mem.h"
 | 
			
		||||
#include "private/libc_logging.h"
 | 
			
		||||
 | 
			
		||||
// Send dlmalloc errors to the log.
 | 
			
		||||
@@ -25,6 +26,11 @@ static void __bionic_heap_usage_error(const char* function, void* address);
 | 
			
		||||
#define CORRUPTION_ERROR_ACTION(m) __bionic_heap_corruption_error(__FUNCTION__)
 | 
			
		||||
#define USAGE_ERROR_ACTION(m,p) __bionic_heap_usage_error(__FUNCTION__, p)
 | 
			
		||||
 | 
			
		||||
/* Bionic named anonymous memory declarations */
 | 
			
		||||
static void* named_anonymous_mmap(size_t length);
 | 
			
		||||
#define MMAP(s) named_anonymous_mmap(s)
 | 
			
		||||
#define DIRECT_MMAP(s) named_anonymous_mmap(s)
 | 
			
		||||
 | 
			
		||||
// Ugly inclusion of C file so that bionic specific #defines configure dlmalloc.
 | 
			
		||||
#include "../upstream-dlmalloc/malloc.c"
 | 
			
		||||
 | 
			
		||||
@@ -42,3 +48,15 @@ static void __bionic_heap_usage_error(const char* function, void* address) {
 | 
			
		||||
  // TODO: improve the debuggerd protocol so we can tell it to dump an address when we abort.
 | 
			
		||||
  *((int**) 0xdeadbaad) = (int*) address;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void* named_anonymous_mmap(size_t length)
 | 
			
		||||
{
 | 
			
		||||
    void* ret;
 | 
			
		||||
    ret = mmap(NULL, length, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
 | 
			
		||||
    if (ret == MAP_FAILED)
 | 
			
		||||
        return ret;
 | 
			
		||||
 | 
			
		||||
    __bionic_name_mem(ret, length, "libc_malloc");
 | 
			
		||||
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								libc/bionic/futimens.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								libc/bionic/futimens.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 <errno.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
 | 
			
		||||
int futimens(int fd, const struct timespec times[2]) {
 | 
			
		||||
  return utimensat(fd, NULL, times, 0);
 | 
			
		||||
}
 | 
			
		||||
@@ -37,6 +37,8 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <sys/auxv.h>
 | 
			
		||||
#include <sys/time.h>
 | 
			
		||||
#include <sys/resource.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
#include "atexit.h"
 | 
			
		||||
@@ -62,6 +64,21 @@ uintptr_t __stack_chk_guard = 0;
 | 
			
		||||
unsigned int __page_size = PAGE_SIZE;
 | 
			
		||||
unsigned int __page_shift = PAGE_SHIFT;
 | 
			
		||||
 | 
			
		||||
static size_t get_stack_size() {
 | 
			
		||||
  const size_t minimal_stack_size = 128 * 1024;
 | 
			
		||||
  size_t stack_size = minimal_stack_size;
 | 
			
		||||
  struct rlimit stack_limit;
 | 
			
		||||
  int rlimit_result = getrlimit(RLIMIT_STACK, &stack_limit);
 | 
			
		||||
  if ((rlimit_result == 0) && (stack_limit.rlim_cur != RLIM_INFINITY)) {
 | 
			
		||||
    stack_size = stack_limit.rlim_cur;
 | 
			
		||||
    stack_size = (stack_size & ~(PAGE_SIZE - 1));
 | 
			
		||||
    if (stack_size < minimal_stack_size) {
 | 
			
		||||
      stack_size = minimal_stack_size;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return stack_size;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Init TLS for the initial thread. Called by the linker _before_ libc is mapped
 | 
			
		||||
 * in memory. Beware: all writes to libc globals from this function will
 | 
			
		||||
 * apply to linker-private copies and will not be visible from libc later on.
 | 
			
		||||
@@ -76,9 +93,9 @@ unsigned int __page_shift = PAGE_SHIFT;
 | 
			
		||||
void __libc_init_tls(KernelArgumentBlock& args) {
 | 
			
		||||
  __libc_auxv = args.auxv;
 | 
			
		||||
 | 
			
		||||
  unsigned stack_top = (__get_sp() & ~(PAGE_SIZE - 1)) + PAGE_SIZE;
 | 
			
		||||
  unsigned stack_size = 128 * 1024;
 | 
			
		||||
  unsigned stack_bottom = stack_top - stack_size;
 | 
			
		||||
  uintptr_t stack_top = (__get_sp() & ~(PAGE_SIZE - 1)) + PAGE_SIZE;
 | 
			
		||||
  size_t stack_size = get_stack_size();
 | 
			
		||||
  uintptr_t stack_bottom = stack_top - stack_size;
 | 
			
		||||
 | 
			
		||||
  static void* tls[BIONIC_TLS_SLOTS];
 | 
			
		||||
  static pthread_internal_t thread;
 | 
			
		||||
 
 | 
			
		||||
@@ -37,13 +37,14 @@ extern "C" void*  __mmap2(void*, size_t, int, int, int, size_t);
 | 
			
		||||
 | 
			
		||||
#define MMAP2_SHIFT 12 // 2**12 == 4096
 | 
			
		||||
 | 
			
		||||
void* mmap(void* addr, size_t size, int prot, int flags, int fd, long offset) {
 | 
			
		||||
void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset) {
 | 
			
		||||
  if (offset & ((1UL << MMAP2_SHIFT)-1)) {
 | 
			
		||||
    errno = EINVAL;
 | 
			
		||||
    return MAP_FAILED;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void* result = __mmap2(addr, size, prot, flags, fd, offset >> MMAP2_SHIFT);
 | 
			
		||||
  size_t unsigned_offset = static_cast<size_t>(offset); // To avoid sign extension.
 | 
			
		||||
  void* result = __mmap2(addr, size, prot, flags, fd, unsigned_offset >> MMAP2_SHIFT);
 | 
			
		||||
 | 
			
		||||
  if (result != MAP_FAILED && (flags & (MAP_PRIVATE | MAP_ANONYMOUS)) != 0) {
 | 
			
		||||
    ErrnoRestorer errno_restorer;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										53
									
								
								libc/bionic/name_mem.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								libc/bionic/name_mem.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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_name_mem.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Local definitions of custom prctl arguments to set a vma name in some kernels
 | 
			
		||||
 */
 | 
			
		||||
#define BIONIC_PR_SET_VMA               0x53564d41
 | 
			
		||||
#define BIONIC_PR_SET_VMA_ANON_NAME     0
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Names a region of memory.  The name is expected to show up in /proc/pid/maps
 | 
			
		||||
 * and /proc/pid/smaps.  There is no guarantee that it will work, and it if it
 | 
			
		||||
 * does work it is likely to only work on memory that was allocated with
 | 
			
		||||
 * mmap(MAP_ANONYMOUS), and only on regions that are page aligned.  name should
 | 
			
		||||
 * be a pointer to a string that is valid for as long as the memory is mapped,
 | 
			
		||||
 * preferably a compile-time constant string.
 | 
			
		||||
 *
 | 
			
		||||
 * Returns -1 on error and sets errno.  If it returns an error naming page
 | 
			
		||||
 * aligned anonymous memory the kernel doesn't support naming, and an alternate
 | 
			
		||||
 * method of naming memory should be used (like ashmem).
 | 
			
		||||
 */
 | 
			
		||||
int __bionic_name_mem(void *addr, size_t len, const char *name)
 | 
			
		||||
{
 | 
			
		||||
    return prctl(BIONIC_PR_SET_VMA, BIONIC_PR_SET_VMA_ANON_NAME,
 | 
			
		||||
                 addr, len, name);
 | 
			
		||||
}
 | 
			
		||||
@@ -36,7 +36,13 @@ int pthread_getcpuclockid(pthread_t t, clockid_t* clockid) {
 | 
			
		||||
    return ESRCH;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  enum { CLOCK_IDTYPE_BITS = 3 };
 | 
			
		||||
  *clockid = CLOCK_THREAD_CPUTIME_ID | (thread->tid << CLOCK_IDTYPE_BITS);
 | 
			
		||||
  // The tid is stored in the top bits, but negated.
 | 
			
		||||
  clockid_t result = ~static_cast<clockid_t>(thread->tid) << 3;
 | 
			
		||||
  // Bits 0 and 1: clock type (0 = CPUCLOCK_PROF, 1 = CPUCLOCK_VIRT, 2 = CPUCLOCK_SCHED).
 | 
			
		||||
  result |= 2;
 | 
			
		||||
  // Bit 2: thread (set) or process (clear)?
 | 
			
		||||
  result |= (1 << 2);
 | 
			
		||||
 | 
			
		||||
  *clockid = result;
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -33,6 +33,7 @@
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include <pthread.h>
 | 
			
		||||
#include <stdio.h>  // For FOPEN_MAX.
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <sys/sysconf.h>
 | 
			
		||||
@@ -57,7 +58,6 @@
 | 
			
		||||
 | 
			
		||||
/* the following depends on our implementation */
 | 
			
		||||
#define  SYSTEM_ATEXIT_MAX          65536    /* our implementation is unlimited */
 | 
			
		||||
#define  SYSTEM_THREAD_STACK_MIN    32768    /* lower values may be possible, but be conservative */
 | 
			
		||||
#define  SYSTEM_THREAD_THREADS_MAX  2048     /* really unlimited */
 | 
			
		||||
 | 
			
		||||
#define  SYSTEM_2_C_BIND     _POSIX_VERSION  /* Posix C binding version */
 | 
			
		||||
@@ -309,7 +309,7 @@ int sysconf(int name) {
 | 
			
		||||
    case _SC_THREAD_KEYS_MAX:
 | 
			
		||||
      return (BIONIC_TLS_SLOTS - TLS_SLOT_FIRST_USER_SLOT - GLOBAL_INIT_THREAD_LOCAL_BUFFER_COUNT);
 | 
			
		||||
 | 
			
		||||
    case _SC_THREAD_STACK_MIN:    return SYSTEM_THREAD_STACK_MIN;
 | 
			
		||||
    case _SC_THREAD_STACK_MIN:    return PTHREAD_STACK_MIN;
 | 
			
		||||
    case _SC_THREAD_THREADS_MAX:  return SYSTEM_THREAD_THREADS_MAX;
 | 
			
		||||
    case _SC_TTY_NAME_MAX:        return SYSTEM_TTY_NAME_MAX;
 | 
			
		||||
#ifdef _POSIX_THREADS
 | 
			
		||||
 
 | 
			
		||||
@@ -42,14 +42,14 @@
 | 
			
		||||
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
 | 
			
		||||
#define	_U	0x01
 | 
			
		||||
#define	_L	0x02
 | 
			
		||||
#define	_N	0x04
 | 
			
		||||
#define	_S	0x08
 | 
			
		||||
#define	_P	0x10
 | 
			
		||||
#define	_C	0x20
 | 
			
		||||
#define	_X	0x40
 | 
			
		||||
#define	_B	0x80
 | 
			
		||||
#define	_CTYPE_U	0x01
 | 
			
		||||
#define	_CTYPE_L	0x02
 | 
			
		||||
#define	_CTYPE_N	0x04
 | 
			
		||||
#define	_CTYPE_S	0x08
 | 
			
		||||
#define	_CTYPE_P	0x10
 | 
			
		||||
#define	_CTYPE_C	0x20
 | 
			
		||||
#define	_CTYPE_X	0x40
 | 
			
		||||
#define	_CTYPE_B	0x80
 | 
			
		||||
 | 
			
		||||
__BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
@@ -101,57 +101,57 @@ int	_toupper(int);
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isalnum(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L|_N)));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_CTYPE_U|_CTYPE_L|_CTYPE_N)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isalpha(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L)));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_CTYPE_U|_CTYPE_L)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int iscntrl(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _C));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_C));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isdigit(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _N));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_N));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isgraph(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N)));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int islower(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _L));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_L));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isprint(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N|_B)));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int ispunct(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _P));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_P));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isspace(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _S));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_S));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isupper(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _U));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_U));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int isxdigit(int c)
 | 
			
		||||
{
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_N|_X)));
 | 
			
		||||
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_CTYPE_N|_CTYPE_X)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__CTYPE_INLINE int tolower(int c)
 | 
			
		||||
 
 | 
			
		||||
@@ -249,13 +249,16 @@ typedef struct {
 | 
			
		||||
} imaxdiv_t;
 | 
			
		||||
 | 
			
		||||
__BEGIN_DECLS
 | 
			
		||||
intmax_t	imaxabs(intmax_t);
 | 
			
		||||
imaxdiv_t	imaxdiv(intmax_t, intmax_t);
 | 
			
		||||
 | 
			
		||||
intmax_t	imaxabs(intmax_t) __pure2;
 | 
			
		||||
imaxdiv_t	imaxdiv(intmax_t, intmax_t) __pure2;
 | 
			
		||||
 | 
			
		||||
intmax_t	strtoimax(const char *, char **, int);
 | 
			
		||||
uintmax_t	strtoumax(const char *, char **, int);
 | 
			
		||||
 | 
			
		||||
intmax_t	strntoimax(const char *nptr, char **endptr, int base, size_t n);
 | 
			
		||||
uintmax_t	strntoumax(const char *nptr, char **endptr, int base, size_t n);
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* _INTTYPES_H_ */
 | 
			
		||||
 
 | 
			
		||||
@@ -207,11 +207,13 @@ void endprotoent(void);
 | 
			
		||||
void endservent(void);
 | 
			
		||||
void freehostent(struct hostent *);
 | 
			
		||||
struct hostent	*gethostbyaddr(const void *, socklen_t, int);
 | 
			
		||||
struct hostent	*android_gethostbyaddrforiface(const void *, socklen_t, int, const char*, int);
 | 
			
		||||
int gethostbyaddr_r(const void *, int, int, struct hostent *, char *, size_t, struct hostent **, int *);
 | 
			
		||||
struct hostent	*gethostbyname(const char *);
 | 
			
		||||
int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
 | 
			
		||||
struct hostent	*gethostbyname2(const char *, int);
 | 
			
		||||
int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
 | 
			
		||||
struct hostent	*android_gethostbynameforiface(const char *, int, const char *, int);
 | 
			
		||||
struct hostent	*gethostent(void);
 | 
			
		||||
int gethostent_r(struct hostent *, char *, size_t, struct hostent **, int *);
 | 
			
		||||
struct hostent	*getipnodebyaddr(const void *, size_t, int, int *);
 | 
			
		||||
@@ -239,7 +241,9 @@ void sethostent(int);
 | 
			
		||||
void setnetent(int);
 | 
			
		||||
void setprotoent(int);
 | 
			
		||||
int getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **);
 | 
			
		||||
int android_getaddrinfoforiface(const char *, const char *, const struct addrinfo *, const char *, int, struct addrinfo **);
 | 
			
		||||
int getnameinfo(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int);
 | 
			
		||||
int android_getnameinfoforiface(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int, const char *, int);
 | 
			
		||||
void freeaddrinfo(struct addrinfo *);
 | 
			
		||||
const char	*gai_strerror(int);
 | 
			
		||||
void setnetgrent(const char *);
 | 
			
		||||
 
 | 
			
		||||
@@ -191,8 +191,13 @@ typedef uint64_t      uint_fast64_t;
 | 
			
		||||
 * intptr_t & uintptr_t
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifdef __LP64__
 | 
			
		||||
typedef long           intptr_t;
 | 
			
		||||
typedef unsigned long  uintptr_t;
 | 
			
		||||
#else
 | 
			
		||||
typedef int           intptr_t;
 | 
			
		||||
typedef unsigned int  uintptr_t;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __STDINT_LIMITS
 | 
			
		||||
#  define INTPTR_MIN    INT32_MIN
 | 
			
		||||
 
 | 
			
		||||
@@ -77,17 +77,9 @@ static __inline__ double atof(const char *nptr)
 | 
			
		||||
    return (strtod(nptr, NULL));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static __inline__ int abs(int __n) {
 | 
			
		||||
    return (__n < 0) ? -__n : __n;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static __inline__ long labs(long __n) {
 | 
			
		||||
    return (__n < 0L) ? -__n : __n;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static __inline__ long long llabs(long long __n) {
 | 
			
		||||
    return (__n < 0LL) ? -__n : __n;
 | 
			
		||||
}
 | 
			
		||||
extern int abs(int) __pure2;
 | 
			
		||||
extern long labs(long) __pure2;
 | 
			
		||||
extern long long llabs(long long) __pure2;
 | 
			
		||||
 | 
			
		||||
extern char * realpath(const char *path, char *resolved);
 | 
			
		||||
extern int system(const char * string);
 | 
			
		||||
 
 | 
			
		||||
@@ -176,9 +176,9 @@
 | 
			
		||||
#define  _POSIX_JOB_CONTROL         1    /* job control is a Linux feature */
 | 
			
		||||
 | 
			
		||||
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 /* the minimum mandated by POSIX */
 | 
			
		||||
#define PTHREAD_DESTRUCTOR_ITERATIONS 4
 | 
			
		||||
#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
 | 
			
		||||
#define _POSIX_THREAD_KEYS_MAX 128            /* the minimum mandated by POSIX */
 | 
			
		||||
/* TODO: our PTHREAD_KEYS_MAX is currently too low to be posix compliant! */
 | 
			
		||||
#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
 | 
			
		||||
#define _POSIX_THREAD_THREADS_MAX 64          /* the minimum mandated by POSIX */
 | 
			
		||||
#define PTHREAD_THREADS_MAX                   /* bionic has no specific limit */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -168,7 +168,8 @@ extern int renameat(int olddirfd, const char *oldpath, int newdirfd, const char
 | 
			
		||||
 | 
			
		||||
# define UTIME_NOW      ((1l << 30) - 1l)
 | 
			
		||||
# define UTIME_OMIT     ((1l << 30) - 2l)
 | 
			
		||||
extern int utimensat (int fd, const char *path, const struct timespec times[2], int flags);
 | 
			
		||||
extern int utimensat(int fd, const char *path, const struct timespec times[2], int flags);
 | 
			
		||||
extern int futimens(int fd, const struct timespec times[2]);
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -98,7 +98,7 @@ struct syslog_data {
 | 
			
		||||
 | 
			
		||||
#define SYSLOG_DATA_INIT {-1, 0, 0, 0, (const char *)0, LOG_USER, 0xff}
 | 
			
		||||
 | 
			
		||||
#define _PATH_LOG  "/dev/kmsg"
 | 
			
		||||
#define _PATH_LOG  "/dev/syslog"
 | 
			
		||||
 | 
			
		||||
extern void	closelog(void);
 | 
			
		||||
extern void	openlog(const char *, int, int);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,24 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef LINUX_KEXEC_H
 | 
			
		||||
#define LINUX_KEXEC_H
 | 
			
		||||
struct pt_regs;
 | 
			
		||||
struct task_struct;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,109 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MFD_MSM_ADIE_CODEC_H
 | 
			
		||||
#define __LINUX_MFD_MSM_ADIE_CODEC_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#define ADIE_CODEC_ACTION_ENTRY 0x1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADIE_CODEC_ACTION_DELAY_WAIT 0x2
 | 
			
		||||
#define ADIE_CODEC_ACTION_STAGE_REACHED 0x3
 | 
			
		||||
#define ADIE_CODEC_PATH_OFF 0x0050
 | 
			
		||||
#define ADIE_CODEC_DIGITAL_READY 0x0100
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADIE_CODEC_DIGITAL_ANALOG_READY 0x1000
 | 
			
		||||
#define ADIE_CODEC_ANALOG_OFF 0x0750
 | 
			
		||||
#define ADIE_CODEC_DIGITAL_OFF 0x0600
 | 
			
		||||
#define ADIE_CODEC_FLASH_IMAGE 0x0001
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADIE_CODEC_RX 0
 | 
			
		||||
#define ADIE_CODEC_TX 1
 | 
			
		||||
#define ADIE_CODEC_LB 3
 | 
			
		||||
#define ADIE_CODEC_MAX 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADIE_CODEC_PACK_ENTRY(reg, mask, val) ((val)|(mask << 8)|(reg << 16))
 | 
			
		||||
#define ADIE_CODEC_UNPACK_ENTRY(packed, reg, mask, val)   do {   ((reg) = ((packed >> 16) & (0xff)));   ((mask) = ((packed >> 8) & (0xff)));   ((val) = ((packed) & (0xff)));   } while (0);
 | 
			
		||||
struct adie_codec_action_unit {
 | 
			
		||||
 u32 type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 action;
 | 
			
		||||
};
 | 
			
		||||
struct adie_codec_hwsetting_entry{
 | 
			
		||||
 struct adie_codec_action_unit *actions;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 action_sz;
 | 
			
		||||
 u32 freq_plan;
 | 
			
		||||
 u32 osr;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct adie_codec_dev_profile {
 | 
			
		||||
 u32 path_type;
 | 
			
		||||
 u32 setting_sz;
 | 
			
		||||
 struct adie_codec_hwsetting_entry *settings;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct adie_codec_register {
 | 
			
		||||
 u8 reg;
 | 
			
		||||
 u8 mask;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u8 val;
 | 
			
		||||
};
 | 
			
		||||
struct adie_codec_register_image {
 | 
			
		||||
 struct adie_codec_register *regs;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 img_sz;
 | 
			
		||||
};
 | 
			
		||||
struct adie_codec_path;
 | 
			
		||||
struct adie_codec_anc_data {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 size;
 | 
			
		||||
 u32 writes[];
 | 
			
		||||
};
 | 
			
		||||
struct adie_codec_operations {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int codec_id;
 | 
			
		||||
 int (*codec_open) (struct adie_codec_dev_profile *profile,
 | 
			
		||||
 struct adie_codec_path **path_pptr);
 | 
			
		||||
 int (*codec_close) (struct adie_codec_path *path_ptr);
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int (*codec_setpath) (struct adie_codec_path *path_ptr,
 | 
			
		||||
 u32 freq_plan, u32 osr);
 | 
			
		||||
 int (*codec_proceed_stage) (struct adie_codec_path *path_ptr,
 | 
			
		||||
 u32 state);
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 (*codec_freq_supported) (struct adie_codec_dev_profile *profile,
 | 
			
		||||
 u32 requested_freq);
 | 
			
		||||
 int (*codec_enable_sidetone) (struct adie_codec_path *rx_path_ptr,
 | 
			
		||||
 u32 enable);
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int (*codec_enable_anc) (struct adie_codec_path *rx_path_ptr,
 | 
			
		||||
 u32 enable, struct adie_codec_anc_data *calibration_writes);
 | 
			
		||||
 int (*codec_set_device_digital_volume) (
 | 
			
		||||
 struct adie_codec_path *path_ptr,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 num_channels,
 | 
			
		||||
 u32 vol_percentage);
 | 
			
		||||
 int (*codec_set_device_analog_volume) (struct adie_codec_path *path_ptr,
 | 
			
		||||
 u32 num_channels,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 volume);
 | 
			
		||||
 int (*codec_set_master_mode) (struct adie_codec_path *path_ptr,
 | 
			
		||||
 u8 master);
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,60 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_ADSP_H
 | 
			
		||||
#define __LINUX_MSM_ADSP_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADSP_IOCTL_MAGIC 'q'
 | 
			
		||||
struct adsp_command_t {
 | 
			
		||||
 uint16_t queue;
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint8_t *data;
 | 
			
		||||
};
 | 
			
		||||
struct adsp_event_t {
 | 
			
		||||
 uint16_t type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t timeout_ms;
 | 
			
		||||
 uint16_t msg_id;
 | 
			
		||||
 uint16_t flags;
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint8_t *data;
 | 
			
		||||
};
 | 
			
		||||
#define ADSP_IOCTL_ENABLE _IOR(ADSP_IOCTL_MAGIC, 1, unsigned)
 | 
			
		||||
#define ADSP_IOCTL_DISABLE _IOR(ADSP_IOCTL_MAGIC, 2, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADSP_IOCTL_DISABLE_ACK _IOR(ADSP_IOCTL_MAGIC, 3, unsigned)
 | 
			
		||||
#define ADSP_IOCTL_WRITE_COMMAND _IOR(ADSP_IOCTL_MAGIC, 4, struct adsp_command_t *)
 | 
			
		||||
#define ADSP_IOCTL_GET_EVENT _IOWR(ADSP_IOCTL_MAGIC, 5, struct adsp_event_data_t *)
 | 
			
		||||
#define ADSP_IOCTL_SET_CLKRATE _IOR(ADSP_IOCTL_MAGIC, 6, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADSP_IOCTL_DISABLE_EVENT_RSP _IOR(ADSP_IOCTL_MAGIC, 10, unsigned)
 | 
			
		||||
struct adsp_pmem_info {
 | 
			
		||||
 int fd;
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define ADSP_IOCTL_REGISTER_PMEM _IOW(ADSP_IOCTL_MAGIC, 13, unsigned)
 | 
			
		||||
#define ADSP_IOCTL_UNREGISTER_PMEM _IOW(ADSP_IOCTL_MAGIC, 14, unsigned)
 | 
			
		||||
#define ADSP_IOCTL_ABORT_EVENT_READ _IOW(ADSP_IOCTL_MAGIC, 15, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADSP_IOCTL_LINK_TASK _IOW(ADSP_IOCTL_MAGIC, 16, unsigned)
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,345 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_AUDIO_H
 | 
			
		||||
#define __LINUX_MSM_AUDIO_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_IOCTL_MAGIC 'a'
 | 
			
		||||
#define AUDIO_START _IOW(AUDIO_IOCTL_MAGIC, 0, unsigned)
 | 
			
		||||
#define AUDIO_STOP _IOW(AUDIO_IOCTL_MAGIC, 1, unsigned)
 | 
			
		||||
#define AUDIO_FLUSH _IOW(AUDIO_IOCTL_MAGIC, 2, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_CONFIG _IOR(AUDIO_IOCTL_MAGIC, 3, unsigned)
 | 
			
		||||
#define AUDIO_SET_CONFIG _IOW(AUDIO_IOCTL_MAGIC, 4, unsigned)
 | 
			
		||||
#define AUDIO_GET_STATS _IOR(AUDIO_IOCTL_MAGIC, 5, unsigned)
 | 
			
		||||
#define AUDIO_ENABLE_AUDPP _IOW(AUDIO_IOCTL_MAGIC, 6, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_ADRC _IOW(AUDIO_IOCTL_MAGIC, 7, unsigned)
 | 
			
		||||
#define AUDIO_SET_EQ _IOW(AUDIO_IOCTL_MAGIC, 8, unsigned)
 | 
			
		||||
#define AUDIO_SET_RX_IIR _IOW(AUDIO_IOCTL_MAGIC, 9, unsigned)
 | 
			
		||||
#define AUDIO_SET_VOLUME _IOW(AUDIO_IOCTL_MAGIC, 10, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_PAUSE _IOW(AUDIO_IOCTL_MAGIC, 11, unsigned)
 | 
			
		||||
#define AUDIO_PLAY_DTMF _IOW(AUDIO_IOCTL_MAGIC, 12, unsigned)
 | 
			
		||||
#define AUDIO_GET_EVENT _IOR(AUDIO_IOCTL_MAGIC, 13, unsigned)
 | 
			
		||||
#define AUDIO_ABORT_GET_EVENT _IOW(AUDIO_IOCTL_MAGIC, 14, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_REGISTER_PMEM _IOW(AUDIO_IOCTL_MAGIC, 15, unsigned)
 | 
			
		||||
#define AUDIO_DEREGISTER_PMEM _IOW(AUDIO_IOCTL_MAGIC, 16, unsigned)
 | 
			
		||||
#define AUDIO_ASYNC_WRITE _IOW(AUDIO_IOCTL_MAGIC, 17, unsigned)
 | 
			
		||||
#define AUDIO_ASYNC_READ _IOW(AUDIO_IOCTL_MAGIC, 18, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_INCALL _IOW(AUDIO_IOCTL_MAGIC, 19, struct msm_voicerec_mode)
 | 
			
		||||
#define AUDIO_GET_NUM_SND_DEVICE _IOR(AUDIO_IOCTL_MAGIC, 20, unsigned)
 | 
			
		||||
#define AUDIO_GET_SND_DEVICES _IOWR(AUDIO_IOCTL_MAGIC, 21,   struct msm_snd_device_list)
 | 
			
		||||
#define AUDIO_ENABLE_SND_DEVICE _IOW(AUDIO_IOCTL_MAGIC, 22, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_DISABLE_SND_DEVICE _IOW(AUDIO_IOCTL_MAGIC, 23, unsigned)
 | 
			
		||||
#define AUDIO_ROUTE_STREAM _IOW(AUDIO_IOCTL_MAGIC, 24,   struct msm_audio_route_config)
 | 
			
		||||
#define AUDIO_GET_PCM_CONFIG _IOR(AUDIO_IOCTL_MAGIC, 30, unsigned)
 | 
			
		||||
#define AUDIO_SET_PCM_CONFIG _IOW(AUDIO_IOCTL_MAGIC, 31, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SWITCH_DEVICE _IOW(AUDIO_IOCTL_MAGIC, 32, unsigned)
 | 
			
		||||
#define AUDIO_SET_MUTE _IOW(AUDIO_IOCTL_MAGIC, 33, unsigned)
 | 
			
		||||
#define AUDIO_UPDATE_ACDB _IOW(AUDIO_IOCTL_MAGIC, 34, unsigned)
 | 
			
		||||
#define AUDIO_START_VOICE _IOW(AUDIO_IOCTL_MAGIC, 35, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_STOP_VOICE _IOW(AUDIO_IOCTL_MAGIC, 36, unsigned)
 | 
			
		||||
#define AUDIO_REINIT_ACDB _IOW(AUDIO_IOCTL_MAGIC, 39, unsigned)
 | 
			
		||||
#define AUDIO_OUTPORT_FLUSH _IOW(AUDIO_IOCTL_MAGIC, 40, unsigned short)
 | 
			
		||||
#define AUDIO_SET_ERR_THRESHOLD_VALUE _IOW(AUDIO_IOCTL_MAGIC, 41,   unsigned short)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_BITSTREAM_ERROR_INFO _IOR(AUDIO_IOCTL_MAGIC, 42,   struct msm_audio_bitstream_error_info)
 | 
			
		||||
#define AUDIO_SET_SRS_TRUMEDIA_PARAM _IOW(AUDIO_IOCTL_MAGIC, 43, unsigned)
 | 
			
		||||
#define AUDIO_SET_STREAM_CONFIG _IOW(AUDIO_IOCTL_MAGIC, 80,   struct msm_audio_stream_config)
 | 
			
		||||
#define AUDIO_GET_STREAM_CONFIG _IOR(AUDIO_IOCTL_MAGIC, 81,   struct msm_audio_stream_config)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_SESSION_ID _IOR(AUDIO_IOCTL_MAGIC, 82, unsigned short)
 | 
			
		||||
#define AUDIO_GET_STREAM_INFO _IOR(AUDIO_IOCTL_MAGIC, 83,   struct msm_audio_bitstream_info)
 | 
			
		||||
#define AUDIO_SET_PAN _IOW(AUDIO_IOCTL_MAGIC, 84, unsigned)
 | 
			
		||||
#define AUDIO_SET_QCONCERT_PLUS _IOW(AUDIO_IOCTL_MAGIC, 85, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_MBADRC _IOW(AUDIO_IOCTL_MAGIC, 86, unsigned)
 | 
			
		||||
#define AUDIO_SET_VOLUME_PATH _IOW(AUDIO_IOCTL_MAGIC, 87,   struct msm_vol_info)
 | 
			
		||||
#define AUDIO_SET_MAX_VOL_ALL _IOW(AUDIO_IOCTL_MAGIC, 88, unsigned)
 | 
			
		||||
#define AUDIO_ENABLE_AUDPRE _IOW(AUDIO_IOCTL_MAGIC, 89, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_AGC _IOW(AUDIO_IOCTL_MAGIC, 90, unsigned)
 | 
			
		||||
#define AUDIO_SET_NS _IOW(AUDIO_IOCTL_MAGIC, 91, unsigned)
 | 
			
		||||
#define AUDIO_SET_TX_IIR _IOW(AUDIO_IOCTL_MAGIC, 92, unsigned)
 | 
			
		||||
#define AUDIO_GET_BUF_CFG _IOW(AUDIO_IOCTL_MAGIC, 93,   struct msm_audio_buf_cfg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_BUF_CFG _IOW(AUDIO_IOCTL_MAGIC, 94,   struct msm_audio_buf_cfg)
 | 
			
		||||
#define AUDIO_SET_ACDB_BLK _IOW(AUDIO_IOCTL_MAGIC, 95,   struct msm_acdb_cmd_device)
 | 
			
		||||
#define AUDIO_GET_ACDB_BLK _IOW(AUDIO_IOCTL_MAGIC, 96,   struct msm_acdb_cmd_device)
 | 
			
		||||
#define AUDIO_REGISTER_ION _IOW(AUDIO_IOCTL_MAGIC, 97, unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_DEREGISTER_ION _IOW(AUDIO_IOCTL_MAGIC, 98, unsigned)
 | 
			
		||||
#define AUDIO_MAX_COMMON_IOCTL_NUM 100
 | 
			
		||||
#define HANDSET_MIC 0x01
 | 
			
		||||
#define HANDSET_SPKR 0x02
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define HEADSET_MIC 0x03
 | 
			
		||||
#define HEADSET_SPKR_MONO 0x04
 | 
			
		||||
#define HEADSET_SPKR_STEREO 0x05
 | 
			
		||||
#define SPKR_PHONE_MIC 0x06
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SPKR_PHONE_MONO 0x07
 | 
			
		||||
#define SPKR_PHONE_STEREO 0x08
 | 
			
		||||
#define BT_SCO_MIC 0x09
 | 
			
		||||
#define BT_SCO_SPKR 0x0A
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define BT_A2DP_SPKR 0x0B
 | 
			
		||||
#define TTY_HEADSET_MIC 0x0C
 | 
			
		||||
#define TTY_HEADSET_SPKR 0x0D
 | 
			
		||||
#define DEFAULT_TX 0x0E
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define DEFAULT_RX 0x0F
 | 
			
		||||
#define BT_A2DP_TX 0x10
 | 
			
		||||
#define HEADSET_MONO_PLUS_SPKR_MONO_RX 0x11
 | 
			
		||||
#define HEADSET_MONO_PLUS_SPKR_STEREO_RX 0x12
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define HEADSET_STEREO_PLUS_SPKR_MONO_RX 0x13
 | 
			
		||||
#define HEADSET_STEREO_PLUS_SPKR_STEREO_RX 0x14
 | 
			
		||||
#define I2S_RX 0x20
 | 
			
		||||
#define I2S_TX 0x21
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ADRC_ENABLE 0x0001
 | 
			
		||||
#define EQ_ENABLE 0x0002
 | 
			
		||||
#define IIR_ENABLE 0x0004
 | 
			
		||||
#define QCONCERT_PLUS_ENABLE 0x0008
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MBADRC_ENABLE 0x0010
 | 
			
		||||
#define SRS_ENABLE 0x0020
 | 
			
		||||
#define SRS_DISABLE 0x0040
 | 
			
		||||
#define AGC_ENABLE 0x0001
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define NS_ENABLE 0x0002
 | 
			
		||||
#define TX_IIR_ENABLE 0x0004
 | 
			
		||||
#define FLUENCE_ENABLE 0x0008
 | 
			
		||||
#define VOC_REC_UPLINK 0x00
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VOC_REC_DOWNLINK 0x01
 | 
			
		||||
#define VOC_REC_BOTH 0x02
 | 
			
		||||
struct msm_audio_config {
 | 
			
		||||
 uint32_t buffer_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t buffer_count;
 | 
			
		||||
 uint32_t channel_count;
 | 
			
		||||
 uint32_t sample_rate;
 | 
			
		||||
 uint32_t type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t meta_field;
 | 
			
		||||
 uint32_t bits;
 | 
			
		||||
 uint32_t unused[3];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_stream_config {
 | 
			
		||||
 uint32_t buffer_size;
 | 
			
		||||
 uint32_t buffer_count;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_buf_cfg{
 | 
			
		||||
 uint32_t meta_info_enable;
 | 
			
		||||
 uint32_t frames_per_buf;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_stats {
 | 
			
		||||
 uint32_t byte_count;
 | 
			
		||||
 uint32_t sample_count;
 | 
			
		||||
 uint32_t unused[2];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_ion_info {
 | 
			
		||||
 int fd;
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_pmem_info {
 | 
			
		||||
 int fd;
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_aio_buf {
 | 
			
		||||
 void *buf_addr;
 | 
			
		||||
 uint32_t buf_len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t data_len;
 | 
			
		||||
 void *private_data;
 | 
			
		||||
 unsigned short mfield_sz;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_IOCTL_MAGIC 's'
 | 
			
		||||
#define SND_MUTE_UNMUTED 0
 | 
			
		||||
#define SND_MUTE_MUTED 1
 | 
			
		||||
struct msm_mute_info {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t mute;
 | 
			
		||||
 uint32_t path;
 | 
			
		||||
};
 | 
			
		||||
struct msm_vol_info {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t vol;
 | 
			
		||||
 uint32_t path;
 | 
			
		||||
};
 | 
			
		||||
struct msm_voicerec_mode {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t rec_mode;
 | 
			
		||||
};
 | 
			
		||||
struct msm_snd_device_config {
 | 
			
		||||
 uint32_t device;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t ear_mute;
 | 
			
		||||
 uint32_t mic_mute;
 | 
			
		||||
};
 | 
			
		||||
#define SND_SET_DEVICE _IOW(SND_IOCTL_MAGIC, 2, struct msm_device_config *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_METHOD_VOICE 0
 | 
			
		||||
struct msm_snd_volume_config {
 | 
			
		||||
 uint32_t device;
 | 
			
		||||
 uint32_t method;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t volume;
 | 
			
		||||
};
 | 
			
		||||
#define SND_SET_VOLUME _IOW(SND_IOCTL_MAGIC, 3, struct msm_snd_volume_config *)
 | 
			
		||||
#define SND_GET_NUM_ENDPOINTS _IOR(SND_IOCTL_MAGIC, 4, unsigned *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_snd_endpoint {
 | 
			
		||||
 int id;
 | 
			
		||||
 char name[64];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_GET_ENDPOINT _IOWR(SND_IOCTL_MAGIC, 5, struct msm_snd_endpoint *)
 | 
			
		||||
#define SND_AVC_CTL _IOW(SND_IOCTL_MAGIC, 6, unsigned *)
 | 
			
		||||
#define SND_AGC_CTL _IOW(SND_IOCTL_MAGIC, 7, unsigned *)
 | 
			
		||||
struct msm_audio_pcm_config {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t pcm_feedback;
 | 
			
		||||
 uint32_t buffer_count;
 | 
			
		||||
 uint32_t buffer_size;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_EVENT_SUSPEND 0
 | 
			
		||||
#define AUDIO_EVENT_RESUME 1
 | 
			
		||||
#define AUDIO_EVENT_WRITE_DONE 2
 | 
			
		||||
#define AUDIO_EVENT_READ_DONE 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_EVENT_STREAM_INFO 4
 | 
			
		||||
#define AUDIO_EVENT_BITSTREAM_ERROR_INFO 5
 | 
			
		||||
#define AUDIO_CODEC_TYPE_MP3 0
 | 
			
		||||
#define AUDIO_CODEC_TYPE_AAC 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_bitstream_info {
 | 
			
		||||
 uint32_t codec_type;
 | 
			
		||||
 uint32_t chan_info;
 | 
			
		||||
 uint32_t sample_rate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t bit_stream_info;
 | 
			
		||||
 uint32_t bit_rate;
 | 
			
		||||
 uint32_t unused[3];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_bitstream_error_info {
 | 
			
		||||
 uint32_t dec_id;
 | 
			
		||||
 uint32_t err_msg_indicator;
 | 
			
		||||
 uint32_t err_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
union msm_audio_event_payload {
 | 
			
		||||
 struct msm_audio_aio_buf aio_buf;
 | 
			
		||||
 struct msm_audio_bitstream_info stream_info;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msm_audio_bitstream_error_info error_info;
 | 
			
		||||
 int reserved;
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_event {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int event_type;
 | 
			
		||||
 int timeout_ms;
 | 
			
		||||
 union msm_audio_event_payload event_payload;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_SNDDEV_CAP_RX 0x1
 | 
			
		||||
#define MSM_SNDDEV_CAP_TX 0x2
 | 
			
		||||
#define MSM_SNDDEV_CAP_VOICE 0x4
 | 
			
		||||
struct msm_snd_device_info {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t dev_id;
 | 
			
		||||
 uint32_t dev_cap;
 | 
			
		||||
 char dev_name[64];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_snd_device_list {
 | 
			
		||||
 uint32_t num_dev;
 | 
			
		||||
 struct msm_snd_device_info *list;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_dtmf_config {
 | 
			
		||||
 uint16_t path;
 | 
			
		||||
 uint16_t dtmf_hi;
 | 
			
		||||
 uint16_t dtmf_low;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint16_t duration;
 | 
			
		||||
 uint16_t tx_gain;
 | 
			
		||||
 uint16_t rx_gain;
 | 
			
		||||
 uint16_t mixing;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define AUDIO_ROUTE_STREAM_VOICE_RX 0
 | 
			
		||||
#define AUDIO_ROUTE_STREAM_VOICE_TX 1
 | 
			
		||||
#define AUDIO_ROUTE_STREAM_PLAYBACK 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_ROUTE_STREAM_REC 3
 | 
			
		||||
struct msm_audio_route_config {
 | 
			
		||||
 uint32_t stream_type;
 | 
			
		||||
 uint32_t stream_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t dev_id;
 | 
			
		||||
};
 | 
			
		||||
#define AUDIO_MAX_EQ_BANDS 12
 | 
			
		||||
struct msm_audio_eq_band {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint16_t band_idx;
 | 
			
		||||
 uint32_t filter_type;
 | 
			
		||||
 uint32_t center_freq_hz;
 | 
			
		||||
 uint32_t filter_gain;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t q_factor;
 | 
			
		||||
} __attribute__ ((packed));
 | 
			
		||||
struct msm_audio_eq_stream_config {
 | 
			
		||||
 uint32_t enable;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t num_bands;
 | 
			
		||||
 struct msm_audio_eq_band eq_bands[AUDIO_MAX_EQ_BANDS];
 | 
			
		||||
} __attribute__ ((packed));
 | 
			
		||||
struct msm_acdb_cmd_device {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t command_id;
 | 
			
		||||
 uint32_t device_id;
 | 
			
		||||
 uint32_t network_id;
 | 
			
		||||
 uint32_t sample_rate_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t interface_id;
 | 
			
		||||
 uint32_t algorithm_block_id;
 | 
			
		||||
 uint32_t total_bytes;
 | 
			
		||||
 uint32_t *phys_buf;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,79 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_AUDIO_AAC_H
 | 
			
		||||
#define __MSM_AUDIO_AAC_H
 | 
			
		||||
#include <linux/msm_audio.h>
 | 
			
		||||
#define AUDIO_SET_AAC_CONFIG _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_AAC_CONFIG _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned)
 | 
			
		||||
#define AUDIO_SET_AAC_ENC_CONFIG _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+3), struct msm_audio_aac_enc_config)
 | 
			
		||||
#define AUDIO_GET_AAC_ENC_CONFIG _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+4), struct msm_audio_aac_enc_config)
 | 
			
		||||
#define AUDIO_AAC_FORMAT_ADTS -1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_FORMAT_RAW 0x0000
 | 
			
		||||
#define AUDIO_AAC_FORMAT_PSUEDO_RAW 0x0001
 | 
			
		||||
#define AUDIO_AAC_FORMAT_LOAS 0x0002
 | 
			
		||||
#define AUDIO_AAC_FORMAT_ADIF 0x0003
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_OBJECT_LC 0x0002
 | 
			
		||||
#define AUDIO_AAC_OBJECT_LTP 0x0004
 | 
			
		||||
#define AUDIO_AAC_OBJECT_ERLC 0x0011
 | 
			
		||||
#define AUDIO_AAC_OBJECT_BSAC 0x0016
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_SEC_DATA_RES_ON 0x0001
 | 
			
		||||
#define AUDIO_AAC_SEC_DATA_RES_OFF 0x0000
 | 
			
		||||
#define AUDIO_AAC_SCA_DATA_RES_ON 0x0001
 | 
			
		||||
#define AUDIO_AAC_SCA_DATA_RES_OFF 0x0000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_SPEC_DATA_RES_ON 0x0001
 | 
			
		||||
#define AUDIO_AAC_SPEC_DATA_RES_OFF 0x0000
 | 
			
		||||
#define AUDIO_AAC_SBR_ON_FLAG_ON 0x0001
 | 
			
		||||
#define AUDIO_AAC_SBR_ON_FLAG_OFF 0x0000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_SBR_PS_ON_FLAG_ON 0x0001
 | 
			
		||||
#define AUDIO_AAC_SBR_PS_ON_FLAG_OFF 0x0000
 | 
			
		||||
#define AUDIO_AAC_DUAL_MONO_PL_PR 0
 | 
			
		||||
#define AUDIO_AAC_DUAL_MONO_SL_SR 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_AAC_DUAL_MONO_SL_PR 2
 | 
			
		||||
#define AUDIO_AAC_DUAL_MONO_PL_SR 3
 | 
			
		||||
struct msm_audio_aac_config {
 | 
			
		||||
 signed short format;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short audio_object;
 | 
			
		||||
 unsigned short ep_config;
 | 
			
		||||
 unsigned short aac_section_data_resilience_flag;
 | 
			
		||||
 unsigned short aac_scalefactor_data_resilience_flag;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short aac_spectral_data_resilience_flag;
 | 
			
		||||
 unsigned short sbr_on_flag;
 | 
			
		||||
 unsigned short sbr_ps_on_flag;
 | 
			
		||||
 unsigned short dual_mono_mode;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short channel_configuration;
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_aac_enc_config {
 | 
			
		||||
 uint32_t channels;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t sample_rate;
 | 
			
		||||
 uint32_t bit_rate;
 | 
			
		||||
 uint32_t stream_format;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,70 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_AUDIO_ACDB_H
 | 
			
		||||
#define __MSM_AUDIO_ACDB_H
 | 
			
		||||
#include <linux/msm_audio.h>
 | 
			
		||||
#define AUDIO_SET_VOCPROC_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_VOCPROC_STREAM_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned)
 | 
			
		||||
#define AUDIO_SET_VOCPROC_VOL_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+2), unsigned)
 | 
			
		||||
#define AUDIO_SET_AUDPROC_RX_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+3), unsigned)
 | 
			
		||||
#define AUDIO_SET_AUDPROC_RX_STREAM_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+4), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_AUDPROC_RX_VOL_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+5), unsigned)
 | 
			
		||||
#define AUDIO_SET_AUDPROC_TX_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+6), unsigned)
 | 
			
		||||
#define AUDIO_SET_AUDPROC_TX_STREAM_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+7), unsigned)
 | 
			
		||||
#define AUDIO_SET_AUDPROC_TX_VOL_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+8), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_SIDETONE_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+9), unsigned)
 | 
			
		||||
#define AUDIO_SET_ANC_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+10), unsigned)
 | 
			
		||||
#define AUDIO_SET_VOICE_RX_TOPOLOGY _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+11), unsigned)
 | 
			
		||||
#define AUDIO_SET_VOICE_TX_TOPOLOGY _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+12), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_ADM_RX_TOPOLOGY _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+13), unsigned)
 | 
			
		||||
#define AUDIO_SET_ADM_TX_TOPOLOGY _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+14), unsigned)
 | 
			
		||||
#define AUDIO_SET_ASM_TOPOLOGY _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+15), unsigned)
 | 
			
		||||
#define AUDIO_SET_AFE_TX_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+16), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_SET_AFE_RX_CAL _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+17), unsigned)
 | 
			
		||||
#define AUDIO_MAX_ACDB_IOCTL (AUDIO_MAX_COMMON_IOCTL_NUM+30)
 | 
			
		||||
struct cal_block {
 | 
			
		||||
 uint32_t cal_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t cal_offset;
 | 
			
		||||
};
 | 
			
		||||
struct sidetone_cal {
 | 
			
		||||
 uint16_t enable;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint16_t gain;
 | 
			
		||||
};
 | 
			
		||||
#define AUDIO_GET_RTAC_ADM_INFO _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+1), unsigned)
 | 
			
		||||
#define AUDIO_GET_RTAC_VOICE_INFO _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+2), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_RTAC_ADM_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+3), unsigned)
 | 
			
		||||
#define AUDIO_SET_RTAC_ADM_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+4), unsigned)
 | 
			
		||||
#define AUDIO_GET_RTAC_ASM_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+5), unsigned)
 | 
			
		||||
#define AUDIO_SET_RTAC_ASM_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+6), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_RTAC_CVS_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+7), unsigned)
 | 
			
		||||
#define AUDIO_SET_RTAC_CVS_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+8), unsigned)
 | 
			
		||||
#define AUDIO_GET_RTAC_CVP_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+9), unsigned)
 | 
			
		||||
#define AUDIO_SET_RTAC_CVP_CAL _IOWR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_ACDB_IOCTL+10), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_MAX_RTAC_IOCTL (AUDIO_MAX_ACDB_IOCTL+20)
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,48 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_AUDIO_WMA_H
 | 
			
		||||
#define __MSM_AUDIO_WMA_H
 | 
			
		||||
#define AUDIO_GET_WMA_CONFIG _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned)
 | 
			
		||||
#define AUDIO_SET_WMA_CONFIG _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define AUDIO_GET_WMA_CONFIG_V2 _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+2), struct msm_audio_wma_config_v2)
 | 
			
		||||
#define AUDIO_SET_WMA_CONFIG_V2 _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+3), struct msm_audio_wma_config_v2)
 | 
			
		||||
struct msm_audio_wma_config {
 | 
			
		||||
 unsigned short armdatareqthr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short channelsdecoded;
 | 
			
		||||
 unsigned short wmabytespersec;
 | 
			
		||||
 unsigned short wmasamplingfreq;
 | 
			
		||||
 unsigned short wmaencoderopts;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_audio_wma_config_v2 {
 | 
			
		||||
 unsigned short format_tag;
 | 
			
		||||
 unsigned short numchannels;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t samplingrate;
 | 
			
		||||
 uint32_t avgbytespersecond;
 | 
			
		||||
 unsigned short block_align;
 | 
			
		||||
 unsigned short validbitspersample;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t channelmask;
 | 
			
		||||
 unsigned short encodeopt;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
@@ -1,40 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_AUDIO_WMAPRO_H
 | 
			
		||||
#define __MSM_AUDIO_WMAPRO_H
 | 
			
		||||
#define AUDIO_GET_WMAPRO_CONFIG _IOR(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned)
 | 
			
		||||
#define AUDIO_SET_WMAPRO_CONFIG _IOW(AUDIO_IOCTL_MAGIC,   (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_audio_wmapro_config {
 | 
			
		||||
 unsigned short armdatareqthr;
 | 
			
		||||
 uint8_t validbitspersample;
 | 
			
		||||
 uint8_t numchannels;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short formattag;
 | 
			
		||||
 unsigned short samplingrate;
 | 
			
		||||
 unsigned short avgbytespersecond;
 | 
			
		||||
 unsigned short asfpacketlength;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned short channelmask;
 | 
			
		||||
 unsigned short encodeopt;
 | 
			
		||||
 unsigned short advancedencodeopt;
 | 
			
		||||
 uint32_t advancedencodeopt2;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,38 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _ARCH_ARM_MACH_MSM_MDM_IOCTLS_H
 | 
			
		||||
#define _ARXH_ARM_MACH_MSM_MDM_IOCTLS_H
 | 
			
		||||
#define CHARM_CODE 0xCC
 | 
			
		||||
#define WAKE_CHARM _IO(CHARM_CODE, 1)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define RESET_CHARM _IO(CHARM_CODE, 2)
 | 
			
		||||
#define CHECK_FOR_BOOT _IOR(CHARM_CODE, 3, int)
 | 
			
		||||
#define WAIT_FOR_BOOT _IO(CHARM_CODE, 4)
 | 
			
		||||
#define NORMAL_BOOT_DONE _IOW(CHARM_CODE, 5, int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define RAM_DUMP_DONE _IOW(CHARM_CODE, 6, int)
 | 
			
		||||
#define WAIT_FOR_RESTART _IOR(CHARM_CODE, 7, int)
 | 
			
		||||
#define GET_DLOAD_STATUS _IOR(CHARM_CODE, 8, int)
 | 
			
		||||
enum charm_boot_type {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 CHARM_NORMAL_BOOT = 0,
 | 
			
		||||
 CHARM_RAM_DUMPS,
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
@@ -1,30 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _DSPS_H_
 | 
			
		||||
#define _DSPS_H_
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
#define DSPS_IOCTL_MAGIC 'd'
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define DSPS_IOCTL_ON _IO(DSPS_IOCTL_MAGIC, 1)
 | 
			
		||||
#define DSPS_IOCTL_OFF _IO(DSPS_IOCTL_MAGIC, 2)
 | 
			
		||||
#define DSPS_IOCTL_READ_SLOW_TIMER _IOR(DSPS_IOCTL_MAGIC, 3, unsigned int*)
 | 
			
		||||
#define DSPS_IOCTL_READ_FAST_TIMER _IOR(DSPS_IOCTL_MAGIC, 4, unsigned int*)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define DSPS_IOCTL_RESET _IO(DSPS_IOCTL_MAGIC, 5)
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,105 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_ION_H__
 | 
			
		||||
#define __LINUX_MSM_ION_H__
 | 
			
		||||
#include <linux/ion.h>
 | 
			
		||||
enum msm_ion_heap_types {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 ION_HEAP_TYPE_IOMMU = ION_HEAP_TYPE_CUSTOM + 1,
 | 
			
		||||
 ION_HEAP_TYPE_CP = ION_HEAP_TYPE_CUSTOM + 2,
 | 
			
		||||
};
 | 
			
		||||
enum ion_heap_ids {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 INVALID_HEAP_ID = -1,
 | 
			
		||||
 ION_CP_MM_HEAP_ID = 8,
 | 
			
		||||
 ION_CP_MFC_HEAP_ID = 12,
 | 
			
		||||
 ION_CP_WB_HEAP_ID = 16,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 ION_CAMERA_HEAP_ID = 20,
 | 
			
		||||
 ION_SF_HEAP_ID = 24,
 | 
			
		||||
 ION_IOMMU_HEAP_ID = 25,
 | 
			
		||||
 ION_QSECOM_HEAP_ID = 27,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 ION_AUDIO_HEAP_ID = 28,
 | 
			
		||||
 ION_MM_FIRMWARE_HEAP_ID = 29,
 | 
			
		||||
 ION_SYSTEM_HEAP_ID = 30,
 | 
			
		||||
 ION_HEAP_ID_RESERVED = 31
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum ion_fixed_position {
 | 
			
		||||
 NOT_FIXED,
 | 
			
		||||
 FIXED_LOW,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 FIXED_MIDDLE,
 | 
			
		||||
 FIXED_HIGH,
 | 
			
		||||
};
 | 
			
		||||
enum cp_mem_usage {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VIDEO_BITSTREAM = 0x1,
 | 
			
		||||
 VIDEO_PIXEL = 0x2,
 | 
			
		||||
 VIDEO_NONPIXEL = 0x3,
 | 
			
		||||
 MAX_USAGE = 0x4,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 UNKNOWN = 0x7FFFFFFF,
 | 
			
		||||
};
 | 
			
		||||
#define ION_HEAP_CP_MASK (1 << ION_HEAP_TYPE_CP)
 | 
			
		||||
#define ION_SECURE (1 << ION_HEAP_ID_RESERVED)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ION_HEAP(bit) (1 << (bit))
 | 
			
		||||
#define ION_VMALLOC_HEAP_NAME "vmalloc"
 | 
			
		||||
#define ION_AUDIO_HEAP_NAME "audio"
 | 
			
		||||
#define ION_SF_HEAP_NAME "sf"
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ION_MM_HEAP_NAME "mm"
 | 
			
		||||
#define ION_CAMERA_HEAP_NAME "camera_preview"
 | 
			
		||||
#define ION_IOMMU_HEAP_NAME "iommu"
 | 
			
		||||
#define ION_MFC_HEAP_NAME "mfc"
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ION_WB_HEAP_NAME "wb"
 | 
			
		||||
#define ION_MM_FIRMWARE_HEAP_NAME "mm_fw"
 | 
			
		||||
#define ION_QSECOM_HEAP_NAME "qsecom"
 | 
			
		||||
#define ION_FMEM_HEAP_NAME "fmem"
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define CACHED 1
 | 
			
		||||
#define UNCACHED 0
 | 
			
		||||
#define ION_CACHE_SHIFT 0
 | 
			
		||||
#define ION_SET_CACHE(__cache) ((__cache) << ION_CACHE_SHIFT)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ION_IS_CACHED(__flags) ((__flags) & (1 << ION_CACHE_SHIFT))
 | 
			
		||||
struct ion_flush_data {
 | 
			
		||||
 struct ion_handle *handle;
 | 
			
		||||
 int fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
 unsigned int length;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct ion_flag_data {
 | 
			
		||||
 struct ion_handle *handle;
 | 
			
		||||
 unsigned long flags;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ION_IOC_CLEAN_CACHES _IOWR(ION_IOC_MAGIC, 20,   struct ion_flush_data)
 | 
			
		||||
#define ION_IOC_INV_CACHES _IOWR(ION_IOC_MAGIC, 21,   struct ion_flush_data)
 | 
			
		||||
#define ION_IOC_CLEAN_INV_CACHES _IOWR(ION_IOC_MAGIC, 22,   struct ion_flush_data)
 | 
			
		||||
#define ION_IOC_GET_FLAGS _IOWR(ION_IOC_MAGIC, 23,   struct ion_flag_data)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -1,365 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_KGSL_H
 | 
			
		||||
#define _MSM_KGSL_H
 | 
			
		||||
#define KGSL_VERSION_MAJOR 3
 | 
			
		||||
#define KGSL_VERSION_MINOR 12
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_CONTEXT_SAVE_GMEM 0x00000001
 | 
			
		||||
#define KGSL_CONTEXT_NO_GMEM_ALLOC 0x00000002
 | 
			
		||||
#define KGSL_CONTEXT_SUBMIT_IB_LIST 0x00000004
 | 
			
		||||
#define KGSL_CONTEXT_CTX_SWITCH 0x00000008
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_CONTEXT_PREAMBLE 0x00000010
 | 
			
		||||
#define KGSL_CONTEXT_TRASH_STATE 0x00000020
 | 
			
		||||
#define KGSL_CONTEXT_PER_CONTEXT_TS 0x00000040
 | 
			
		||||
#define KGSL_CONTEXT_INVALID 0xffffffff
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_MEMFLAGS_GPUREADONLY 0x01000000
 | 
			
		||||
#define KGSL_FLAGS_NORMALMODE 0x00000000
 | 
			
		||||
#define KGSL_FLAGS_SAFEMODE 0x00000001
 | 
			
		||||
#define KGSL_FLAGS_INITIALIZED0 0x00000002
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_FLAGS_INITIALIZED 0x00000004
 | 
			
		||||
#define KGSL_FLAGS_STARTED 0x00000008
 | 
			
		||||
#define KGSL_FLAGS_ACTIVE 0x00000010
 | 
			
		||||
#define KGSL_FLAGS_RESERVED0 0x00000020
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_FLAGS_RESERVED1 0x00000040
 | 
			
		||||
#define KGSL_FLAGS_RESERVED2 0x00000080
 | 
			
		||||
#define KGSL_FLAGS_SOFT_RESET 0x00000100
 | 
			
		||||
#define KGSL_FLAGS_PER_CONTEXT_TIMESTAMPS 0x00000200
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_CLK_SRC 0x00000001
 | 
			
		||||
#define KGSL_CLK_CORE 0x00000002
 | 
			
		||||
#define KGSL_CLK_IFACE 0x00000004
 | 
			
		||||
#define KGSL_CLK_MEM 0x00000008
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_CLK_MEM_IFACE 0x00000010
 | 
			
		||||
#define KGSL_CLK_AXI 0x00000020
 | 
			
		||||
enum kgsl_ctx_reset_stat {
 | 
			
		||||
 KGSL_CTX_STAT_NO_ERROR = 0x00000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_CTX_STAT_GUILTY_CONTEXT_RESET_EXT = 0x00000001,
 | 
			
		||||
 KGSL_CTX_STAT_INNOCENT_CONTEXT_RESET_EXT = 0x00000002,
 | 
			
		||||
 KGSL_CTX_STAT_UNKNOWN_CONTEXT_RESET_EXT = 0x00000003
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define KGSL_CONVERT_TO_MBPS(val)   (val*1000*1000U)
 | 
			
		||||
enum kgsl_deviceid {
 | 
			
		||||
 KGSL_DEVICE_3D0 = 0x00000000,
 | 
			
		||||
 KGSL_DEVICE_2D0 = 0x00000001,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_DEVICE_2D1 = 0x00000002,
 | 
			
		||||
 KGSL_DEVICE_MAX = 0x00000003
 | 
			
		||||
};
 | 
			
		||||
enum kgsl_user_mem_type {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_USER_MEM_TYPE_PMEM = 0x00000000,
 | 
			
		||||
 KGSL_USER_MEM_TYPE_ASHMEM = 0x00000001,
 | 
			
		||||
 KGSL_USER_MEM_TYPE_ADDR = 0x00000002,
 | 
			
		||||
 KGSL_USER_MEM_TYPE_ION = 0x00000003,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_USER_MEM_TYPE_MAX = 0x00000004,
 | 
			
		||||
};
 | 
			
		||||
struct kgsl_devinfo {
 | 
			
		||||
 unsigned int device_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int chip_id;
 | 
			
		||||
 unsigned int mmu_enabled;
 | 
			
		||||
 unsigned int gmem_gpubaseaddr;
 | 
			
		||||
 unsigned int gpu_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int gmem_sizebytes;
 | 
			
		||||
};
 | 
			
		||||
struct kgsl_devmemstore {
 | 
			
		||||
 volatile unsigned int soptimestamp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int sbz;
 | 
			
		||||
 volatile unsigned int eoptimestamp;
 | 
			
		||||
 unsigned int sbz2;
 | 
			
		||||
 volatile unsigned int ts_cmp_enable;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int sbz3;
 | 
			
		||||
 volatile unsigned int ref_wait_ts;
 | 
			
		||||
 unsigned int sbz4;
 | 
			
		||||
 unsigned int current_context;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int sbz5;
 | 
			
		||||
};
 | 
			
		||||
#define KGSL_MEMSTORE_OFFSET(ctxt_id, field)   ((ctxt_id)*sizeof(struct kgsl_devmemstore) +   offsetof(struct kgsl_devmemstore, field))
 | 
			
		||||
enum kgsl_timestamp_type {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_TIMESTAMP_CONSUMED = 0x00000001,
 | 
			
		||||
 KGSL_TIMESTAMP_RETIRED = 0x00000002,
 | 
			
		||||
 KGSL_TIMESTAMP_QUEUED = 0x00000003,
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum kgsl_property_type {
 | 
			
		||||
 KGSL_PROP_DEVICE_INFO = 0x00000001,
 | 
			
		||||
 KGSL_PROP_DEVICE_SHADOW = 0x00000002,
 | 
			
		||||
 KGSL_PROP_DEVICE_POWER = 0x00000003,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_PROP_SHMEM = 0x00000004,
 | 
			
		||||
 KGSL_PROP_SHMEM_APERTURES = 0x00000005,
 | 
			
		||||
 KGSL_PROP_MMU_ENABLE = 0x00000006,
 | 
			
		||||
 KGSL_PROP_INTERRUPT_WAITS = 0x00000007,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_PROP_VERSION = 0x00000008,
 | 
			
		||||
 KGSL_PROP_GPU_RESET_STAT = 0x00000009,
 | 
			
		||||
 KGSL_PROP_PWRCTRL = 0x0000000E,
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_shadowprop {
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 unsigned int size;
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct kgsl_version {
 | 
			
		||||
 unsigned int drv_major;
 | 
			
		||||
 unsigned int drv_minor;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int dev_major;
 | 
			
		||||
 unsigned int dev_minor;
 | 
			
		||||
};
 | 
			
		||||
struct kgsl_ibdesc {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 void *hostptr;
 | 
			
		||||
 unsigned int sizedwords;
 | 
			
		||||
 unsigned int ctrl;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define KGSL_IOC_TYPE 0x09
 | 
			
		||||
struct kgsl_device_getproperty {
 | 
			
		||||
 unsigned int type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *value;
 | 
			
		||||
 unsigned int sizebytes;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_DEVICE_GETPROPERTY   _IOWR(KGSL_IOC_TYPE, 0x2, struct kgsl_device_getproperty)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_device_waittimestamp {
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
 unsigned int timeout;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_DEVICE_WAITTIMESTAMP   _IOW(KGSL_IOC_TYPE, 0x6, struct kgsl_device_waittimestamp)
 | 
			
		||||
struct kgsl_device_waittimestamp_ctxtid {
 | 
			
		||||
 unsigned int context_id;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int timeout;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID   _IOW(KGSL_IOC_TYPE, 0x7, struct kgsl_device_waittimestamp_ctxtid)
 | 
			
		||||
struct kgsl_ringbuffer_issueibcmds {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int drawctxt_id;
 | 
			
		||||
 unsigned int ibdesc_addr;
 | 
			
		||||
 unsigned int numibs;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS   _IOWR(KGSL_IOC_TYPE, 0x10, struct kgsl_ringbuffer_issueibcmds)
 | 
			
		||||
struct kgsl_cmdstream_readtimestamp {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int type;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_OLD   _IOR(KGSL_IOC_TYPE, 0x11, struct kgsl_cmdstream_readtimestamp)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP   _IOWR(KGSL_IOC_TYPE, 0x11, struct kgsl_cmdstream_readtimestamp)
 | 
			
		||||
struct kgsl_cmdstream_freememontimestamp {
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 unsigned int type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP   _IOW(KGSL_IOC_TYPE, 0x12, struct kgsl_cmdstream_freememontimestamp)
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_OLD   _IOR(KGSL_IOC_TYPE, 0x12, struct kgsl_cmdstream_freememontimestamp)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_drawctxt_create {
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
 unsigned int drawctxt_id;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_DRAWCTXT_CREATE   _IOWR(KGSL_IOC_TYPE, 0x13, struct kgsl_drawctxt_create)
 | 
			
		||||
struct kgsl_drawctxt_destroy {
 | 
			
		||||
 unsigned int drawctxt_id;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_DRAWCTXT_DESTROY   _IOW(KGSL_IOC_TYPE, 0x14, struct kgsl_drawctxt_destroy)
 | 
			
		||||
struct kgsl_map_user_mem {
 | 
			
		||||
 int fd;
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int len;
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
 unsigned int hostptr;
 | 
			
		||||
 enum kgsl_user_mem_type memtype;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int reserved;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_MAP_USER_MEM   _IOWR(KGSL_IOC_TYPE, 0x15, struct kgsl_map_user_mem)
 | 
			
		||||
struct kgsl_cmdstream_readtimestamp_ctxtid {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int context_id;
 | 
			
		||||
 unsigned int type;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID   _IOWR(KGSL_IOC_TYPE, 0x16, struct kgsl_cmdstream_readtimestamp_ctxtid)
 | 
			
		||||
struct kgsl_cmdstream_freememontimestamp_ctxtid {
 | 
			
		||||
 unsigned int context_id;
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int type;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP_CTXTID   _IOW(KGSL_IOC_TYPE, 0x17,   struct kgsl_cmdstream_freememontimestamp_ctxtid)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_sharedmem_from_pmem {
 | 
			
		||||
 int pmem_fd;
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 unsigned int len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_SHAREDMEM_FROM_PMEM   _IOWR(KGSL_IOC_TYPE, 0x20, struct kgsl_sharedmem_from_pmem)
 | 
			
		||||
struct kgsl_sharedmem_free {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_SHAREDMEM_FREE   _IOW(KGSL_IOC_TYPE, 0x21, struct kgsl_sharedmem_free)
 | 
			
		||||
struct kgsl_cff_user_event {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned char cff_opcode;
 | 
			
		||||
 unsigned int op1;
 | 
			
		||||
 unsigned int op2;
 | 
			
		||||
 unsigned int op3;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int op4;
 | 
			
		||||
 unsigned int op5;
 | 
			
		||||
 unsigned int __pad[2];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_CFF_USER_EVENT   _IOW(KGSL_IOC_TYPE, 0x31, struct kgsl_cff_user_event)
 | 
			
		||||
struct kgsl_gmem_desc {
 | 
			
		||||
 unsigned int x;
 | 
			
		||||
 unsigned int y;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int width;
 | 
			
		||||
 unsigned int height;
 | 
			
		||||
 unsigned int pitch;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_buffer_desc {
 | 
			
		||||
 void *hostptr;
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 int size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int format;
 | 
			
		||||
 unsigned int pitch;
 | 
			
		||||
 unsigned int enabled;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_bind_gmem_shadow {
 | 
			
		||||
 unsigned int drawctxt_id;
 | 
			
		||||
 struct kgsl_gmem_desc gmem_desc;
 | 
			
		||||
 unsigned int shadow_x;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int shadow_y;
 | 
			
		||||
 struct kgsl_buffer_desc shadow_buffer;
 | 
			
		||||
 unsigned int buffer_id;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_DRAWCTXT_BIND_GMEM_SHADOW   _IOW(KGSL_IOC_TYPE, 0x22, struct kgsl_bind_gmem_shadow)
 | 
			
		||||
struct kgsl_sharedmem_from_vmalloc {
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 unsigned int hostptr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_SHAREDMEM_FROM_VMALLOC   _IOWR(KGSL_IOC_TYPE, 0x23, struct kgsl_sharedmem_from_vmalloc)
 | 
			
		||||
#define IOCTL_KGSL_SHAREDMEM_FLUSH_CACHE   _IOW(KGSL_IOC_TYPE, 0x24, struct kgsl_sharedmem_free)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_drawctxt_set_bin_base_offset {
 | 
			
		||||
 unsigned int drawctxt_id;
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_DRAWCTXT_SET_BIN_BASE_OFFSET   _IOW(KGSL_IOC_TYPE, 0x25, struct kgsl_drawctxt_set_bin_base_offset)
 | 
			
		||||
enum kgsl_cmdwindow_type {
 | 
			
		||||
 KGSL_CMDWINDOW_MIN = 0x00000000,
 | 
			
		||||
 KGSL_CMDWINDOW_2D = 0x00000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 KGSL_CMDWINDOW_3D = 0x00000001,
 | 
			
		||||
 KGSL_CMDWINDOW_MMU = 0x00000002,
 | 
			
		||||
 KGSL_CMDWINDOW_ARBITER = 0x000000FF,
 | 
			
		||||
 KGSL_CMDWINDOW_MAX = 0x000000FF,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct kgsl_cmdwindow_write {
 | 
			
		||||
 enum kgsl_cmdwindow_type target;
 | 
			
		||||
 unsigned int addr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int data;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_CMDWINDOW_WRITE   _IOW(KGSL_IOC_TYPE, 0x2e, struct kgsl_cmdwindow_write)
 | 
			
		||||
struct kgsl_gpumem_alloc {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long gpuaddr;
 | 
			
		||||
 size_t size;
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_GPUMEM_ALLOC   _IOWR(KGSL_IOC_TYPE, 0x2f, struct kgsl_gpumem_alloc)
 | 
			
		||||
struct kgsl_cff_syncmem {
 | 
			
		||||
 unsigned int gpuaddr;
 | 
			
		||||
 unsigned int len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int __pad[2];
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_CFF_SYNCMEM   _IOW(KGSL_IOC_TYPE, 0x30, struct kgsl_cff_syncmem)
 | 
			
		||||
struct kgsl_timestamp_event {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int type;
 | 
			
		||||
 unsigned int timestamp;
 | 
			
		||||
 unsigned int context_id;
 | 
			
		||||
 void *priv;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t len;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_TIMESTAMP_EVENT_OLD   _IOW(KGSL_IOC_TYPE, 0x31, struct kgsl_timestamp_event)
 | 
			
		||||
#define KGSL_TIMESTAMP_EVENT_GENLOCK 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_timestamp_event_genlock {
 | 
			
		||||
 int handle;
 | 
			
		||||
};
 | 
			
		||||
#define KGSL_TIMESTAMP_EVENT_FENCE 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct kgsl_timestamp_event_fence {
 | 
			
		||||
 int fence_fd;
 | 
			
		||||
};
 | 
			
		||||
#define IOCTL_KGSL_SETPROPERTY   _IOW(KGSL_IOC_TYPE, 0x32, struct kgsl_device_getproperty)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IOCTL_KGSL_TIMESTAMP_EVENT   _IOWR(KGSL_IOC_TYPE, 0x33, struct kgsl_timestamp_event)
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,530 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_MDP_H_
 | 
			
		||||
#define _MSM_MDP_H_
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/fb.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_IOCTL_MAGIC 'm'
 | 
			
		||||
#define MSMFB_GRP_DISP _IOW(MSMFB_IOCTL_MAGIC, 1, unsigned int)
 | 
			
		||||
#define MSMFB_BLIT _IOW(MSMFB_IOCTL_MAGIC, 2, unsigned int)
 | 
			
		||||
#define MSMFB_SUSPEND_SW_REFRESHER _IOW(MSMFB_IOCTL_MAGIC, 128, unsigned int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_RESUME_SW_REFRESHER _IOW(MSMFB_IOCTL_MAGIC, 129, unsigned int)
 | 
			
		||||
#define MSMFB_CURSOR _IOW(MSMFB_IOCTL_MAGIC, 130, struct fb_cursor)
 | 
			
		||||
#define MSMFB_SET_LUT _IOW(MSMFB_IOCTL_MAGIC, 131, struct fb_cmap)
 | 
			
		||||
#define MSMFB_HISTOGRAM _IOWR(MSMFB_IOCTL_MAGIC, 132, struct mdp_histogram_data)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_GET_CCS_MATRIX _IOWR(MSMFB_IOCTL_MAGIC, 133, struct mdp_ccs)
 | 
			
		||||
#define MSMFB_SET_CCS_MATRIX _IOW(MSMFB_IOCTL_MAGIC, 134, struct mdp_ccs)
 | 
			
		||||
#define MSMFB_OVERLAY_SET _IOWR(MSMFB_IOCTL_MAGIC, 135,   struct mdp_overlay)
 | 
			
		||||
#define MSMFB_OVERLAY_UNSET _IOW(MSMFB_IOCTL_MAGIC, 136, unsigned int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_OVERLAY_PLAY _IOW(MSMFB_IOCTL_MAGIC, 137,   struct msmfb_overlay_data)
 | 
			
		||||
#define MSMFB_OVERLAY_QUEUE MSMFB_OVERLAY_PLAY
 | 
			
		||||
#define MSMFB_GET_PAGE_PROTECTION _IOR(MSMFB_IOCTL_MAGIC, 138,   struct mdp_page_protection)
 | 
			
		||||
#define MSMFB_SET_PAGE_PROTECTION _IOW(MSMFB_IOCTL_MAGIC, 139,   struct mdp_page_protection)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_OVERLAY_GET _IOR(MSMFB_IOCTL_MAGIC, 140,   struct mdp_overlay)
 | 
			
		||||
#define MSMFB_OVERLAY_PLAY_ENABLE _IOW(MSMFB_IOCTL_MAGIC, 141, unsigned int)
 | 
			
		||||
#define MSMFB_OVERLAY_BLT _IOWR(MSMFB_IOCTL_MAGIC, 142,   struct msmfb_overlay_blt)
 | 
			
		||||
#define MSMFB_OVERLAY_BLT_OFFSET _IOW(MSMFB_IOCTL_MAGIC, 143, unsigned int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_HISTOGRAM_START _IOR(MSMFB_IOCTL_MAGIC, 144,   struct mdp_histogram_start_req)
 | 
			
		||||
#define MSMFB_HISTOGRAM_STOP _IOR(MSMFB_IOCTL_MAGIC, 145, unsigned int)
 | 
			
		||||
#define MSMFB_NOTIFY_UPDATE _IOW(MSMFB_IOCTL_MAGIC, 146, unsigned int)
 | 
			
		||||
#define MSMFB_OVERLAY_3D _IOWR(MSMFB_IOCTL_MAGIC, 147,   struct msmfb_overlay_3d)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_MIXER_INFO _IOWR(MSMFB_IOCTL_MAGIC, 148,   struct msmfb_mixer_info_req)
 | 
			
		||||
#define MSMFB_OVERLAY_PLAY_WAIT _IOWR(MSMFB_IOCTL_MAGIC, 149,   struct msmfb_overlay_data)
 | 
			
		||||
#define MSMFB_WRITEBACK_INIT _IO(MSMFB_IOCTL_MAGIC, 150)
 | 
			
		||||
#define MSMFB_WRITEBACK_START _IO(MSMFB_IOCTL_MAGIC, 151)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_WRITEBACK_STOP _IO(MSMFB_IOCTL_MAGIC, 152)
 | 
			
		||||
#define MSMFB_WRITEBACK_QUEUE_BUFFER _IOW(MSMFB_IOCTL_MAGIC, 153,   struct msmfb_data)
 | 
			
		||||
#define MSMFB_WRITEBACK_DEQUEUE_BUFFER _IOW(MSMFB_IOCTL_MAGIC, 154,   struct msmfb_data)
 | 
			
		||||
#define MSMFB_WRITEBACK_TERMINATE _IO(MSMFB_IOCTL_MAGIC, 155)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_MDP_PP _IOWR(MSMFB_IOCTL_MAGIC, 156, struct msmfb_mdp_pp)
 | 
			
		||||
#define MSMFB_OVERLAY_VSYNC_CTRL _IOW(MSMFB_IOCTL_MAGIC, 160, unsigned int)
 | 
			
		||||
#define MSMFB_VSYNC_CTRL _IOW(MSMFB_IOCTL_MAGIC, 161, unsigned int)
 | 
			
		||||
#define MSMFB_BUFFER_SYNC _IOW(MSMFB_IOCTL_MAGIC, 162, struct mdp_buf_sync)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_DISPLAY_COMMIT _IOW(MSMFB_IOCTL_MAGIC, 164,   struct mdp_display_commit)
 | 
			
		||||
#define FB_TYPE_3D_PANEL 0x10101010
 | 
			
		||||
#define MDP_IMGTYPE2_START 0x10000
 | 
			
		||||
#define MSMFB_DRIVER_VERSION 0xF9E8D701
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum {
 | 
			
		||||
 NOTIFY_UPDATE_START,
 | 
			
		||||
 NOTIFY_UPDATE_STOP,
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum {
 | 
			
		||||
 MDP_RGB_565,
 | 
			
		||||
 MDP_XRGB_8888,
 | 
			
		||||
 MDP_Y_CBCR_H2V2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_Y_CBCR_H2V2_ADRENO,
 | 
			
		||||
 MDP_ARGB_8888,
 | 
			
		||||
 MDP_RGB_888,
 | 
			
		||||
 MDP_Y_CRCB_H2V2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_YCRYCB_H2V1,
 | 
			
		||||
 MDP_Y_CRCB_H2V1,
 | 
			
		||||
 MDP_Y_CBCR_H2V1,
 | 
			
		||||
 MDP_Y_CRCB_H1V2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_Y_CBCR_H1V2,
 | 
			
		||||
 MDP_RGBA_8888,
 | 
			
		||||
 MDP_BGRA_8888,
 | 
			
		||||
 MDP_RGBX_8888,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_Y_CRCB_H2V2_TILE,
 | 
			
		||||
 MDP_Y_CBCR_H2V2_TILE,
 | 
			
		||||
 MDP_Y_CR_CB_H2V2,
 | 
			
		||||
 MDP_Y_CR_CB_GH2V2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_Y_CB_CR_H2V2,
 | 
			
		||||
 MDP_Y_CRCB_H1V1,
 | 
			
		||||
 MDP_Y_CBCR_H1V1,
 | 
			
		||||
 MDP_YCRCB_H1V1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_YCBCR_H1V1,
 | 
			
		||||
 MDP_BGR_565,
 | 
			
		||||
 MDP_IMGTYPE_LIMIT,
 | 
			
		||||
 MDP_RGB_BORDERFILL,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_FB_FORMAT = MDP_IMGTYPE2_START,
 | 
			
		||||
 MDP_IMGTYPE_LIMIT2
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 PMEM_IMG,
 | 
			
		||||
 FB_IMG,
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 HSIC_HUE = 0,
 | 
			
		||||
 HSIC_SAT,
 | 
			
		||||
 HSIC_INT,
 | 
			
		||||
 HSIC_CON,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 NUM_HSIC_PARAM,
 | 
			
		||||
};
 | 
			
		||||
#define MDSS_MDP_ROT_ONLY 0x80
 | 
			
		||||
#define MDSS_MDP_RIGHT_MIXER 0x100
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_ROT_NOP 0
 | 
			
		||||
#define MDP_FLIP_LR 0x1
 | 
			
		||||
#define MDP_FLIP_UD 0x2
 | 
			
		||||
#define MDP_ROT_90 0x4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_ROT_180 (MDP_FLIP_UD|MDP_FLIP_LR)
 | 
			
		||||
#define MDP_ROT_270 (MDP_ROT_90|MDP_FLIP_UD|MDP_FLIP_LR)
 | 
			
		||||
#define MDP_DITHER 0x8
 | 
			
		||||
#define MDP_BLUR 0x10
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_BLEND_FG_PREMULT 0x20000
 | 
			
		||||
#define MDP_DEINTERLACE 0x80000000
 | 
			
		||||
#define MDP_SHARPENING 0x40000000
 | 
			
		||||
#define MDP_NO_DMA_BARRIER_START 0x20000000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_NO_DMA_BARRIER_END 0x10000000
 | 
			
		||||
#define MDP_NO_BLIT 0x08000000
 | 
			
		||||
#define MDP_BLIT_WITH_DMA_BARRIERS 0x000
 | 
			
		||||
#define MDP_BLIT_WITH_NO_DMA_BARRIERS   (MDP_NO_DMA_BARRIER_START | MDP_NO_DMA_BARRIER_END)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_BLIT_SRC_GEM 0x04000000
 | 
			
		||||
#define MDP_BLIT_DST_GEM 0x02000000
 | 
			
		||||
#define MDP_BLIT_NON_CACHED 0x01000000
 | 
			
		||||
#define MDP_OV_PIPE_SHARE 0x00800000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_DEINTERLACE_ODD 0x00400000
 | 
			
		||||
#define MDP_OV_PLAY_NOWAIT 0x00200000
 | 
			
		||||
#define MDP_SOURCE_ROTATED_90 0x00100000
 | 
			
		||||
#define MDP_OVERLAY_PP_CFG_EN 0x00080000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_BACKEND_COMPOSITION 0x00040000
 | 
			
		||||
#define MDP_BORDERFILL_SUPPORTED 0x00010000
 | 
			
		||||
#define MDP_SECURE_OVERLAY_SESSION 0x00008000
 | 
			
		||||
#define MDP_MEMORY_ID_TYPE_FB 0x00001000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_TRANSP_NOP 0xffffffff
 | 
			
		||||
#define MDP_ALPHA_NOP 0xff
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_NONCACHED (0)
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_WRITECOMBINE (1)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_WRITETHROUGHCACHE (2)
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_WRITEBACKCACHE (3)
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_WRITEBACKWACACHE (4)
 | 
			
		||||
#define MDP_FB_PAGE_PROTECTION_INVALID (5)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_NUM_FB_PAGE_PROTECTION_VALUES (5)
 | 
			
		||||
struct mdp_rect {
 | 
			
		||||
 uint32_t x;
 | 
			
		||||
 uint32_t y;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t w;
 | 
			
		||||
 uint32_t h;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_img {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t width;
 | 
			
		||||
 uint32_t height;
 | 
			
		||||
 uint32_t format;
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int memory_id;
 | 
			
		||||
 uint32_t priv;
 | 
			
		||||
};
 | 
			
		||||
#define MDP_CCS_RGB2YUV 0
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_CCS_YUV2RGB 1
 | 
			
		||||
#define MDP_CCS_SIZE 9
 | 
			
		||||
#define MDP_BV_SIZE 3
 | 
			
		||||
struct mdp_ccs {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int direction;
 | 
			
		||||
 uint16_t ccs[MDP_CCS_SIZE];
 | 
			
		||||
 uint16_t bv[MDP_BV_SIZE];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_csc {
 | 
			
		||||
 int id;
 | 
			
		||||
 uint32_t csc_mv[9];
 | 
			
		||||
 uint32_t csc_pre_bv[3];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t csc_post_bv[3];
 | 
			
		||||
 uint32_t csc_pre_lv[6];
 | 
			
		||||
 uint32_t csc_post_lv[6];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_BLIT_REQ_VERSION 2
 | 
			
		||||
struct mdp_blit_req {
 | 
			
		||||
 struct mdp_img src;
 | 
			
		||||
 struct mdp_img dst;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct mdp_rect src_rect;
 | 
			
		||||
 struct mdp_rect dst_rect;
 | 
			
		||||
 uint32_t alpha;
 | 
			
		||||
 uint32_t transp_mask;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 int sharpening_strength;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_blit_req_list {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t count;
 | 
			
		||||
 struct mdp_blit_req req[];
 | 
			
		||||
};
 | 
			
		||||
#define MSMFB_DATA_VERSION 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msmfb_data {
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
 int memory_id;
 | 
			
		||||
 int id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint32_t priv;
 | 
			
		||||
 uint32_t iova;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSMFB_NEW_REQUEST -1
 | 
			
		||||
struct msmfb_overlay_data {
 | 
			
		||||
 uint32_t id;
 | 
			
		||||
 struct msmfb_data data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t version_key;
 | 
			
		||||
 struct msmfb_data plane1_data;
 | 
			
		||||
 struct msmfb_data plane2_data;
 | 
			
		||||
 struct msmfb_data dst_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msmfb_img {
 | 
			
		||||
 uint32_t width;
 | 
			
		||||
 uint32_t height;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t format;
 | 
			
		||||
};
 | 
			
		||||
#define MSMFB_WRITEBACK_DEQUEUE_BLOCKING 0x1
 | 
			
		||||
struct msmfb_writeback_data {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msmfb_data buf_info;
 | 
			
		||||
 struct msmfb_img img;
 | 
			
		||||
};
 | 
			
		||||
#define MDP_PP_OPS_READ 0x2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_PP_OPS_WRITE 0x4
 | 
			
		||||
struct mdp_qseed_cfg {
 | 
			
		||||
 uint32_t table_num;
 | 
			
		||||
 uint32_t ops;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
 uint32_t *data;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_qseed_cfg_data {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 struct mdp_qseed_cfg qseed_data;
 | 
			
		||||
};
 | 
			
		||||
#define MDP_OVERLAY_PP_CSC_CFG 0x1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_OVERLAY_PP_QSEED_CFG 0x2
 | 
			
		||||
#define MDP_CSC_FLAG_ENABLE 0x1
 | 
			
		||||
#define MDP_CSC_FLAG_YUV_IN 0x2
 | 
			
		||||
#define MDP_CSC_FLAG_YUV_OUT 0x4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_csc_cfg {
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint32_t csc_mv[9];
 | 
			
		||||
 uint32_t csc_pre_bv[3];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t csc_post_bv[3];
 | 
			
		||||
 uint32_t csc_pre_lv[6];
 | 
			
		||||
 uint32_t csc_post_lv[6];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_csc_cfg_data {
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 struct mdp_csc_cfg csc_data;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_overlay_pp_params {
 | 
			
		||||
 uint32_t config_ops;
 | 
			
		||||
 struct mdp_csc_cfg csc_cfg;
 | 
			
		||||
 struct mdp_qseed_cfg qseed_cfg[2];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct mdp_overlay {
 | 
			
		||||
 struct msmfb_img src;
 | 
			
		||||
 struct mdp_rect src_rect;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct mdp_rect dst_rect;
 | 
			
		||||
 uint32_t z_order;
 | 
			
		||||
 uint32_t is_fg;
 | 
			
		||||
 uint32_t alpha;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t transp_mask;
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint32_t id;
 | 
			
		||||
 uint32_t user_data[8];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct mdp_overlay_pp_params overlay_pp_cfg;
 | 
			
		||||
};
 | 
			
		||||
struct msmfb_overlay_3d {
 | 
			
		||||
 uint32_t is_3d;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t width;
 | 
			
		||||
 uint32_t height;
 | 
			
		||||
};
 | 
			
		||||
struct msmfb_overlay_blt {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t enable;
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
 uint32_t width;
 | 
			
		||||
 uint32_t height;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t bpp;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_histogram {
 | 
			
		||||
 uint32_t frame_cnt;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t bin_cnt;
 | 
			
		||||
 uint32_t *r;
 | 
			
		||||
 uint32_t *g;
 | 
			
		||||
 uint32_t *b;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 MDP_BLOCK_RESERVED = 0,
 | 
			
		||||
 MDP_BLOCK_OVERLAY_0,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_BLOCK_OVERLAY_1,
 | 
			
		||||
 MDP_BLOCK_VG_1,
 | 
			
		||||
 MDP_BLOCK_VG_2,
 | 
			
		||||
 MDP_BLOCK_RGB_1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_BLOCK_RGB_2,
 | 
			
		||||
 MDP_BLOCK_DMA_P,
 | 
			
		||||
 MDP_BLOCK_DMA_S,
 | 
			
		||||
 MDP_BLOCK_DMA_E,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 MDP_BLOCK_OVERLAY_2,
 | 
			
		||||
 MDP_BLOCK_MAX,
 | 
			
		||||
};
 | 
			
		||||
struct mdp_histogram_start_req {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 uint8_t frame_cnt;
 | 
			
		||||
 uint8_t bit_mask;
 | 
			
		||||
 uint8_t num_bins;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct mdp_histogram_data {
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 uint8_t bin_cnt;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t *c0;
 | 
			
		||||
 uint32_t *c1;
 | 
			
		||||
 uint32_t *c2;
 | 
			
		||||
 uint32_t *extra_info;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct mdp_pcc_coeff {
 | 
			
		||||
 uint32_t c, r, g, b, rr, gg, bb, rg, gb, rb, rgb_0, rgb_1;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_pcc_cfg_data {
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 uint32_t ops;
 | 
			
		||||
 struct mdp_pcc_coeff r, g, b;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 mdp_lut_igc,
 | 
			
		||||
 mdp_lut_pgc,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 mdp_lut_hist,
 | 
			
		||||
 mdp_lut_max,
 | 
			
		||||
};
 | 
			
		||||
struct mdp_igc_lut_data {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 uint32_t len, ops;
 | 
			
		||||
 uint32_t *c0_c1_data;
 | 
			
		||||
 uint32_t *c2_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct mdp_ar_gc_lut_data {
 | 
			
		||||
 uint32_t x_start;
 | 
			
		||||
 uint32_t slope;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_pgc_lut_data {
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint8_t num_r_stages;
 | 
			
		||||
 uint8_t num_g_stages;
 | 
			
		||||
 uint8_t num_b_stages;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct mdp_ar_gc_lut_data *r_data;
 | 
			
		||||
 struct mdp_ar_gc_lut_data *g_data;
 | 
			
		||||
 struct mdp_ar_gc_lut_data *b_data;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_hist_lut_data {
 | 
			
		||||
 uint32_t block;
 | 
			
		||||
 uint32_t ops;
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t *data;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_lut_cfg_data {
 | 
			
		||||
 uint32_t lut_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 union {
 | 
			
		||||
 struct mdp_igc_lut_data igc_lut_data;
 | 
			
		||||
 struct mdp_pgc_lut_data pgc_lut_data;
 | 
			
		||||
 struct mdp_hist_lut_data hist_lut_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 } data;
 | 
			
		||||
};
 | 
			
		||||
struct mdp_bl_scale_data {
 | 
			
		||||
 uint32_t min_lvl;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t scale;
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 mdp_op_pcc_cfg,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 mdp_op_csc_cfg,
 | 
			
		||||
 mdp_op_lut_cfg,
 | 
			
		||||
 mdp_op_qseed_cfg,
 | 
			
		||||
 mdp_bl_scale_cfg,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 mdp_op_max,
 | 
			
		||||
};
 | 
			
		||||
struct msmfb_mdp_pp {
 | 
			
		||||
 uint32_t op;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 union {
 | 
			
		||||
 struct mdp_pcc_cfg_data pcc_cfg_data;
 | 
			
		||||
 struct mdp_csc_cfg_data csc_cfg_data;
 | 
			
		||||
 struct mdp_lut_cfg_data lut_cfg_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct mdp_qseed_cfg_data qseed_cfg_data;
 | 
			
		||||
 struct mdp_bl_scale_data bl_scale_data;
 | 
			
		||||
 } data;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MDP_MAX_FENCE_FD 10
 | 
			
		||||
#define MDP_BUF_SYNC_FLAG_WAIT 1
 | 
			
		||||
struct mdp_buf_sync {
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t acq_fen_fd_cnt;
 | 
			
		||||
 int *acq_fen_fd;
 | 
			
		||||
 int *rel_fen_fd;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_buf_fence {
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint32_t acq_fen_fd_cnt;
 | 
			
		||||
 int acq_fen_fd[MDP_MAX_FENCE_FD];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int rel_fen_fd[MDP_MAX_FENCE_FD];
 | 
			
		||||
};
 | 
			
		||||
#define MDP_DISPLAY_COMMIT_OVERLAY 0x00000001
 | 
			
		||||
struct mdp_display_commit {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 uint32_t wait_for_finish;
 | 
			
		||||
 struct fb_var_screeninfo var;
 | 
			
		||||
 struct mdp_buf_fence buf_fence;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct mdp_page_protection {
 | 
			
		||||
 uint32_t page_protection;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct mdp_mixer_info {
 | 
			
		||||
 int pndx;
 | 
			
		||||
 int pnum;
 | 
			
		||||
 int ptype;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int mixer_num;
 | 
			
		||||
 int z_order;
 | 
			
		||||
};
 | 
			
		||||
#define MAX_PIPE_PER_MIXER 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msmfb_mixer_info_req {
 | 
			
		||||
 int mixer_num;
 | 
			
		||||
 int cnt;
 | 
			
		||||
 struct mdp_mixer_info info[MAX_PIPE_PER_MIXER];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 DISPLAY_SUBSYSTEM_ID,
 | 
			
		||||
 ROTATOR_SUBSYSTEM_ID,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,231 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_VDEC_H_
 | 
			
		||||
#define _MSM_VDEC_H_
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#define VDEC_IOCTL_MAGIC 'v'
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_INITIALIZE _IOWR(VDEC_IOCTL_MAGIC, 1, struct vdec_init)
 | 
			
		||||
#define VDEC_IOCTL_SETBUFFERS _IOW(VDEC_IOCTL_MAGIC, 2, struct vdec_buffer)
 | 
			
		||||
#define VDEC_IOCTL_QUEUE _IOWR(VDEC_IOCTL_MAGIC, 3,   struct vdec_input_buf)
 | 
			
		||||
#define VDEC_IOCTL_REUSEFRAMEBUFFER _IOW(VDEC_IOCTL_MAGIC, 4, unsigned int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_FLUSH _IOW(VDEC_IOCTL_MAGIC, 5, unsigned int)
 | 
			
		||||
#define VDEC_IOCTL_EOS _IO(VDEC_IOCTL_MAGIC, 6)
 | 
			
		||||
#define VDEC_IOCTL_GETMSG _IOR(VDEC_IOCTL_MAGIC, 7, struct vdec_msg)
 | 
			
		||||
#define VDEC_IOCTL_CLOSE _IO(VDEC_IOCTL_MAGIC, 8)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_FREEBUFFERS _IOW(VDEC_IOCTL_MAGIC, 9, struct vdec_buf_info)
 | 
			
		||||
#define VDEC_IOCTL_GETDECATTRIBUTES _IOR(VDEC_IOCTL_MAGIC, 10,   struct vdec_dec_attributes)
 | 
			
		||||
enum {
 | 
			
		||||
 VDEC_FRAME_DECODE_OK,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_FRAME_DECODE_ERR,
 | 
			
		||||
 VDEC_FATAL_ERR,
 | 
			
		||||
 VDEC_FLUSH_FINISH,
 | 
			
		||||
 VDEC_EOS,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_FRAME_FLUSH,
 | 
			
		||||
 VDEC_STREAM_SWITCH,
 | 
			
		||||
 VDEC_SUSPEND_FINISH,
 | 
			
		||||
 VDEC_BUFFER_CONSUMED
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 VDEC_FLUSH_INPUT,
 | 
			
		||||
 VDEC_FLUSH_OUTPUT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_FLUSH_ALL
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 VDEC_BUFFER_TYPE_INPUT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_BUFFER_TYPE_OUTPUT,
 | 
			
		||||
 VDEC_BUFFER_TYPE_INTERNAL1,
 | 
			
		||||
 VDEC_BUFFER_TYPE_INTERNAL2,
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum {
 | 
			
		||||
 VDEC_QUEUE_SUCCESS,
 | 
			
		||||
 VDEC_QUEUE_FAILED,
 | 
			
		||||
 VDEC_QUEUE_BADSTATE,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct vdec_input_buf_info {
 | 
			
		||||
 u32 offset;
 | 
			
		||||
 u32 data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 size;
 | 
			
		||||
 int timestamp_lo;
 | 
			
		||||
 int timestamp_hi;
 | 
			
		||||
 int avsync_state;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 flags;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_buf_desc {
 | 
			
		||||
 u32 bufsize;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 num_min_buffers;
 | 
			
		||||
 u32 num_max_buffers;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_buf_req {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 max_input_queue_size;
 | 
			
		||||
 struct vdec_buf_desc input;
 | 
			
		||||
 struct vdec_buf_desc output;
 | 
			
		||||
 struct vdec_buf_desc dec_req1;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_buf_desc dec_req2;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_region_info {
 | 
			
		||||
 u32 src_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 offset;
 | 
			
		||||
 u32 size;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_config {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 fourcc;
 | 
			
		||||
 u32 width;
 | 
			
		||||
 u32 height;
 | 
			
		||||
 u32 order;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 notify_enable;
 | 
			
		||||
 u32 vc1_rowbase;
 | 
			
		||||
 u32 h264_startcode_detect;
 | 
			
		||||
 u32 h264_nal_len_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 postproc_flag;
 | 
			
		||||
 u32 fruc_enable;
 | 
			
		||||
 u32 reserved;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_vc1_panscan_regions {
 | 
			
		||||
 int num;
 | 
			
		||||
 int width[4];
 | 
			
		||||
 int height[4];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int xoffset[4];
 | 
			
		||||
 int yoffset[4];
 | 
			
		||||
};
 | 
			
		||||
struct vdec_cropping_window {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 x1;
 | 
			
		||||
 u32 y1;
 | 
			
		||||
 u32 x2;
 | 
			
		||||
 u32 y2;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct vdec_frame_info {
 | 
			
		||||
 u32 status;
 | 
			
		||||
 u32 offset;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 data1;
 | 
			
		||||
 u32 data2;
 | 
			
		||||
 int timestamp_lo;
 | 
			
		||||
 int timestamp_hi;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int cal_timestamp_lo;
 | 
			
		||||
 int cal_timestamp_hi;
 | 
			
		||||
 u32 dec_width;
 | 
			
		||||
 u32 dec_height;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_cropping_window cwin;
 | 
			
		||||
 u32 picture_type[2];
 | 
			
		||||
 u32 picture_format;
 | 
			
		||||
 u32 vc1_rangeY;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 vc1_rangeUV;
 | 
			
		||||
 u32 picture_resolution;
 | 
			
		||||
 u32 frame_disp_repeat;
 | 
			
		||||
 u32 repeat_first_field;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 top_field_first;
 | 
			
		||||
 u32 interframe_interp;
 | 
			
		||||
 struct vdec_vc1_panscan_regions panscan;
 | 
			
		||||
 u32 concealed_macblk_num;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 flags;
 | 
			
		||||
 u32 performance_stats;
 | 
			
		||||
 u32 data3;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_buf_info {
 | 
			
		||||
 u32 buf_type;
 | 
			
		||||
 struct vdec_region_info region;
 | 
			
		||||
 u32 num_buf;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 islast;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_buffer {
 | 
			
		||||
 u32 pmem_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_buf_info buf;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_sequence {
 | 
			
		||||
 u8 *header;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 len;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_config_sps {
 | 
			
		||||
 struct vdec_config cfg;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_sequence seq;
 | 
			
		||||
};
 | 
			
		||||
#define VDEC_MSG_REUSEINPUTBUFFER 1
 | 
			
		||||
#define VDEC_MSG_FRAMEDONE 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_msg {
 | 
			
		||||
 u32 id;
 | 
			
		||||
 union {
 | 
			
		||||
 u32 buf_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_frame_info vfr_info;
 | 
			
		||||
 };
 | 
			
		||||
};
 | 
			
		||||
struct vdec_init {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_config_sps sps_cfg;
 | 
			
		||||
 struct vdec_buf_req *buf_req;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_input_buf {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 pmem_id;
 | 
			
		||||
 struct vdec_input_buf_info buffer;
 | 
			
		||||
 struct vdec_queue_status *queue_status;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_queue_status {
 | 
			
		||||
 u32 status;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_dec_attributes {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 fourcc;
 | 
			
		||||
 u32 profile;
 | 
			
		||||
 u32 level;
 | 
			
		||||
 u32 dec_pic_width;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 u32 dec_pic_height;
 | 
			
		||||
 struct vdec_buf_desc input;
 | 
			
		||||
 struct vdec_buf_desc output;
 | 
			
		||||
 struct vdec_buf_desc dec_req1;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_buf_desc dec_req2;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,305 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_VENC_H_
 | 
			
		||||
#define _MSM_VENC_H_
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#define VENC_MAX_RECON_BUFFERS 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_FLAG_EOS 0x00000001
 | 
			
		||||
#define VENC_FLAG_END_OF_FRAME 0x00000010
 | 
			
		||||
#define VENC_FLAG_SYNC_FRAME 0x00000020
 | 
			
		||||
#define VENC_FLAG_EXTRA_DATA 0x00000040
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_FLAG_CODEC_CONFIG 0x00000080
 | 
			
		||||
enum venc_flush_type {
 | 
			
		||||
 VENC_FLUSH_INPUT,
 | 
			
		||||
 VENC_FLUSH_OUTPUT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_FLUSH_ALL
 | 
			
		||||
};
 | 
			
		||||
enum venc_state_type {
 | 
			
		||||
 VENC_STATE_PAUSE = 0x1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_STATE_START = 0x2,
 | 
			
		||||
 VENC_STATE_STOP = 0x4
 | 
			
		||||
};
 | 
			
		||||
enum venc_event_type_enum {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_EVENT_START_STATUS,
 | 
			
		||||
 VENC_EVENT_STOP_STATUS,
 | 
			
		||||
 VENC_EVENT_SUSPEND_STATUS,
 | 
			
		||||
 VENC_EVENT_RESUME_STATUS,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_EVENT_FLUSH_STATUS,
 | 
			
		||||
 VENC_EVENT_RELEASE_INPUT,
 | 
			
		||||
 VENC_EVENT_DELIVER_OUTPUT,
 | 
			
		||||
 VENC_EVENT_UNKNOWN_STATUS
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum venc_status_code {
 | 
			
		||||
 VENC_STATUS_SUCCESS,
 | 
			
		||||
 VENC_STATUS_ERROR,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_STATUS_INVALID_STATE,
 | 
			
		||||
 VENC_STATUS_FLUSHING,
 | 
			
		||||
 VENC_STATUS_INVALID_PARAM,
 | 
			
		||||
 VENC_STATUS_CMD_QUEUE_FULL,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_STATUS_CRITICAL,
 | 
			
		||||
 VENC_STATUS_INSUFFICIENT_RESOURCES,
 | 
			
		||||
 VENC_STATUS_TIMEOUT
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum venc_msg_code {
 | 
			
		||||
 VENC_MSG_INDICATION,
 | 
			
		||||
 VENC_MSG_INPUT_BUFFER_DONE,
 | 
			
		||||
 VENC_MSG_OUTPUT_BUFFER_DONE,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_MSG_NEED_OUTPUT_BUFFER,
 | 
			
		||||
 VENC_MSG_FLUSH,
 | 
			
		||||
 VENC_MSG_START,
 | 
			
		||||
 VENC_MSG_STOP,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_MSG_PAUSE,
 | 
			
		||||
 VENC_MSG_RESUME,
 | 
			
		||||
 VENC_MSG_STOP_READING_MSG
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum venc_error_code {
 | 
			
		||||
 VENC_S_SUCCESS,
 | 
			
		||||
 VENC_S_EFAIL,
 | 
			
		||||
 VENC_S_EFATAL,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_S_EBADPARAM,
 | 
			
		||||
 VENC_S_EINVALSTATE,
 | 
			
		||||
 VENC_S_ENOSWRES,
 | 
			
		||||
 VENC_S_ENOHWRES,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_S_EBUFFREQ,
 | 
			
		||||
 VENC_S_EINVALCMD,
 | 
			
		||||
 VENC_S_ETIMEOUT,
 | 
			
		||||
 VENC_S_ENOREATMPT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_S_ENOPREREQ,
 | 
			
		||||
 VENC_S_ECMDQFULL,
 | 
			
		||||
 VENC_S_ENOTSUPP,
 | 
			
		||||
 VENC_S_ENOTIMPL,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_S_ENOTPMEM,
 | 
			
		||||
 VENC_S_EFLUSHED,
 | 
			
		||||
 VENC_S_EINSUFBUF,
 | 
			
		||||
 VENC_S_ESAMESTATE,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_S_EINVALTRANS
 | 
			
		||||
};
 | 
			
		||||
enum venc_mem_region_enum {
 | 
			
		||||
 VENC_PMEM_EBI1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VENC_PMEM_SMI
 | 
			
		||||
};
 | 
			
		||||
struct venc_buf_type {
 | 
			
		||||
 unsigned int region;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int phys;
 | 
			
		||||
 unsigned int size;
 | 
			
		||||
 int offset;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_qp_range {
 | 
			
		||||
 unsigned int min_qp;
 | 
			
		||||
 unsigned int max_qp;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_frame_rate {
 | 
			
		||||
 unsigned int frame_rate_num;
 | 
			
		||||
 unsigned int frame_rate_den;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_slice_info {
 | 
			
		||||
 unsigned int slice_mode;
 | 
			
		||||
 unsigned int units_per_slice;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_extra_data {
 | 
			
		||||
 unsigned int slice_extra_data_flag;
 | 
			
		||||
 unsigned int slice_client_data1;
 | 
			
		||||
 unsigned int slice_client_data2;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int slice_client_data3;
 | 
			
		||||
 unsigned int none_extra_data_flag;
 | 
			
		||||
 unsigned int none_client_data1;
 | 
			
		||||
 unsigned int none_client_data2;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int none_client_data3;
 | 
			
		||||
};
 | 
			
		||||
struct venc_common_config {
 | 
			
		||||
 unsigned int standard;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int input_frame_height;
 | 
			
		||||
 unsigned int input_frame_width;
 | 
			
		||||
 unsigned int output_frame_height;
 | 
			
		||||
 unsigned int output_frame_width;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int rotation_angle;
 | 
			
		||||
 unsigned int intra_period;
 | 
			
		||||
 unsigned int rate_control;
 | 
			
		||||
 struct venc_frame_rate frame_rate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int bitrate;
 | 
			
		||||
 struct venc_qp_range qp_range;
 | 
			
		||||
 unsigned int iframe_qp;
 | 
			
		||||
 unsigned int pframe_qp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_slice_info slice_config;
 | 
			
		||||
 struct venc_extra_data extra_data;
 | 
			
		||||
};
 | 
			
		||||
struct venc_nonio_buf_config {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_buf_type recon_buf1;
 | 
			
		||||
 struct venc_buf_type recon_buf2;
 | 
			
		||||
 struct venc_buf_type wb_buf;
 | 
			
		||||
 struct venc_buf_type cmd_buf;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_buf_type vlc_buf;
 | 
			
		||||
};
 | 
			
		||||
struct venc_mpeg4_config {
 | 
			
		||||
 unsigned int profile;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int level;
 | 
			
		||||
 unsigned int time_resolution;
 | 
			
		||||
 unsigned int ac_prediction;
 | 
			
		||||
 unsigned int hec_interval;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int data_partition;
 | 
			
		||||
 unsigned int short_header;
 | 
			
		||||
 unsigned int rvlc_enable;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_h263_config {
 | 
			
		||||
 unsigned int profile;
 | 
			
		||||
 unsigned int level;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_h264_config {
 | 
			
		||||
 unsigned int profile;
 | 
			
		||||
 unsigned int level;
 | 
			
		||||
 unsigned int max_nal;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int idr_period;
 | 
			
		||||
};
 | 
			
		||||
struct venc_pmem {
 | 
			
		||||
 int src;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int fd;
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
 void *virt;
 | 
			
		||||
 void *phys;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int size;
 | 
			
		||||
};
 | 
			
		||||
struct venc_buffer {
 | 
			
		||||
 unsigned char *ptr_buffer;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int size;
 | 
			
		||||
 unsigned int len;
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
 long long time_stamp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int flags;
 | 
			
		||||
 unsigned int client_data;
 | 
			
		||||
};
 | 
			
		||||
struct venc_buffers {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_pmem recon_buf[VENC_MAX_RECON_BUFFERS];
 | 
			
		||||
 struct venc_pmem wb_buf;
 | 
			
		||||
 struct venc_pmem cmd_buf;
 | 
			
		||||
 struct venc_pmem vlc_buf;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_buffer_flush {
 | 
			
		||||
 unsigned int flush_mode;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
union venc_msg_data {
 | 
			
		||||
 struct venc_buffer buf;
 | 
			
		||||
 struct venc_buffer_flush flush_ret;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_msg {
 | 
			
		||||
 unsigned int status_code;
 | 
			
		||||
 unsigned int msg_code;
 | 
			
		||||
 union venc_msg_data msg_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int msg_data_size;
 | 
			
		||||
};
 | 
			
		||||
union venc_codec_config {
 | 
			
		||||
 struct venc_mpeg4_config mpeg4_params;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_h263_config h263_params;
 | 
			
		||||
 struct venc_h264_config h264_params;
 | 
			
		||||
};
 | 
			
		||||
struct venc_q6_config {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_common_config config_params;
 | 
			
		||||
 union venc_codec_config codec_params;
 | 
			
		||||
 struct venc_nonio_buf_config buf_params;
 | 
			
		||||
 void *callback_event;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_hdr_config {
 | 
			
		||||
 struct venc_common_config config_params;
 | 
			
		||||
 union venc_codec_config codec_params;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_init_config {
 | 
			
		||||
 struct venc_q6_config q6_config;
 | 
			
		||||
 struct venc_buffers q6_bufs;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_seq_config {
 | 
			
		||||
 int size;
 | 
			
		||||
 struct venc_pmem buf;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct venc_q6_config q6_config;
 | 
			
		||||
};
 | 
			
		||||
#define VENC_IOCTL_MAGIC 'V'
 | 
			
		||||
#define VENC_IOCTL_CMD_READ_NEXT_MSG   _IOWR(VENC_IOCTL_MAGIC, 1, struct venc_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_IOCTL_CMD_STOP_READ_MSG _IO(VENC_IOCTL_MAGIC, 2)
 | 
			
		||||
#define VENC_IOCTL_SET_INPUT_BUFFER   _IOW(VENC_IOCTL_MAGIC, 3, struct venc_pmem)
 | 
			
		||||
#define VENC_IOCTL_SET_OUTPUT_BUFFER   _IOW(VENC_IOCTL_MAGIC, 4, struct venc_pmem)
 | 
			
		||||
#define VENC_IOCTL_CMD_START _IOW(VENC_IOCTL_MAGIC, 5, struct venc_init_config)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_IOCTL_CMD_ENCODE_FRAME   _IOW(VENC_IOCTL_MAGIC, 6, struct venc_buffer)
 | 
			
		||||
#define VENC_IOCTL_CMD_FILL_OUTPUT_BUFFER   _IOW(VENC_IOCTL_MAGIC, 7, struct venc_buffer)
 | 
			
		||||
#define VENC_IOCTL_CMD_FLUSH   _IOW(VENC_IOCTL_MAGIC, 8, struct venc_buffer_flush)
 | 
			
		||||
#define VENC_IOCTL_CMD_PAUSE _IO(VENC_IOCTL_MAGIC, 9)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_IOCTL_CMD_RESUME _IO(VENC_IOCTL_MAGIC, 10)
 | 
			
		||||
#define VENC_IOCTL_CMD_STOP _IO(VENC_IOCTL_MAGIC, 11)
 | 
			
		||||
#define VENC_IOCTL_SET_INTRA_PERIOD   _IOW(VENC_IOCTL_MAGIC, 12, int)
 | 
			
		||||
#define VENC_IOCTL_CMD_REQUEST_IFRAME _IO(VENC_IOCTL_MAGIC, 13)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_IOCTL_GET_SEQUENCE_HDR   _IOWR(VENC_IOCTL_MAGIC, 14, struct venc_seq_config)
 | 
			
		||||
#define VENC_IOCTL_SET_INTRA_REFRESH   _IOW(VENC_IOCTL_MAGIC, 15, int)
 | 
			
		||||
#define VENC_IOCTL_SET_FRAME_RATE   _IOW(VENC_IOCTL_MAGIC, 16, struct venc_frame_rate)
 | 
			
		||||
#define VENC_IOCTL_SET_TARGET_BITRATE   _IOW(VENC_IOCTL_MAGIC, 17, int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VENC_IOCTL_SET_QP_RANGE   _IOW(VENC_IOCTL_MAGIC, 18, struct venc_qp_range)
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,53 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_RMNET_H_
 | 
			
		||||
#define _MSM_RMNET_H_
 | 
			
		||||
#define RMNET_MODE_NONE (0x00)
 | 
			
		||||
#define RMNET_MODE_LLP_ETH (0x01)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define RMNET_MODE_LLP_IP (0x02)
 | 
			
		||||
#define RMNET_MODE_QOS (0x04)
 | 
			
		||||
#define RMNET_MODE_MASK (RMNET_MODE_LLP_ETH |   RMNET_MODE_LLP_IP |   RMNET_MODE_QOS)
 | 
			
		||||
#define RMNET_IS_MODE_QOS(mode)   ((mode & RMNET_MODE_QOS) == RMNET_MODE_QOS)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define RMNET_IS_MODE_IP(mode)   ((mode & RMNET_MODE_LLP_IP) == RMNET_MODE_LLP_IP)
 | 
			
		||||
enum rmnet_ioctl_cmds_e {
 | 
			
		||||
 RMNET_IOCTL_SET_LLP_ETHERNET = 0x000089F1,
 | 
			
		||||
 RMNET_IOCTL_SET_LLP_IP = 0x000089F2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 RMNET_IOCTL_GET_LLP = 0x000089F3,
 | 
			
		||||
 RMNET_IOCTL_SET_QOS_ENABLE = 0x000089F4,
 | 
			
		||||
 RMNET_IOCTL_SET_QOS_DISABLE = 0x000089F5,
 | 
			
		||||
 RMNET_IOCTL_GET_QOS = 0x000089F6,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 RMNET_IOCTL_GET_OPMODE = 0x000089F7,
 | 
			
		||||
 RMNET_IOCTL_OPEN = 0x000089F8,
 | 
			
		||||
 RMNET_IOCTL_CLOSE = 0x000089F9,
 | 
			
		||||
 RMNET_IOCTL_MAX
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define QMI_QOS_HDR_S __attribute((__packed__)) qmi_qos_hdr_s
 | 
			
		||||
struct QMI_QOS_HDR_S {
 | 
			
		||||
 unsigned char version;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned char flags;
 | 
			
		||||
 unsigned long flow_id;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
@@ -1,75 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_ROTATOR_H__
 | 
			
		||||
#define __MSM_ROTATOR_H__
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/msm_mdp.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_ROTATOR_IOCTL_MAGIC 'R'
 | 
			
		||||
#define MSM_ROTATOR_IOCTL_START   _IOWR(MSM_ROTATOR_IOCTL_MAGIC, 1, struct msm_rotator_img_info)
 | 
			
		||||
#define MSM_ROTATOR_IOCTL_ROTATE   _IOW(MSM_ROTATOR_IOCTL_MAGIC, 2, struct msm_rotator_data_info)
 | 
			
		||||
#define MSM_ROTATOR_IOCTL_FINISH   _IOW(MSM_ROTATOR_IOCTL_MAGIC, 3, int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define ROTATOR_VERSION_01 0xA5B4C301
 | 
			
		||||
enum rotator_clk_type {
 | 
			
		||||
 ROTATOR_CORE_CLK,
 | 
			
		||||
 ROTATOR_PCLK,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 ROTATOR_IMEM_CLK
 | 
			
		||||
};
 | 
			
		||||
struct msm_rotator_img_info {
 | 
			
		||||
 unsigned int session_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msmfb_img src;
 | 
			
		||||
 struct msmfb_img dst;
 | 
			
		||||
 struct mdp_rect src_rect;
 | 
			
		||||
 unsigned int dst_x;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int dst_y;
 | 
			
		||||
 unsigned char rotations;
 | 
			
		||||
 int enable;
 | 
			
		||||
 unsigned int downscale_ratio;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int secure;
 | 
			
		||||
};
 | 
			
		||||
struct msm_rotator_data_info {
 | 
			
		||||
 int session_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msmfb_data src;
 | 
			
		||||
 struct msmfb_data dst;
 | 
			
		||||
 unsigned int version_key;
 | 
			
		||||
 struct msmfb_data src_chroma;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msmfb_data dst_chroma;
 | 
			
		||||
};
 | 
			
		||||
struct msm_rot_clocks {
 | 
			
		||||
 const char *clk_name;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 enum rotator_clk_type clk_type;
 | 
			
		||||
 unsigned int clk_rate;
 | 
			
		||||
};
 | 
			
		||||
struct msm_rotator_platform_data {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int number_of_clocks;
 | 
			
		||||
 unsigned int hardware_version_number;
 | 
			
		||||
 struct msm_rot_clocks *rotator_clks;
 | 
			
		||||
 char rot_iommu_split_domain;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,539 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_VIDC_DEC_H_
 | 
			
		||||
#define _MSM_VIDC_DEC_H_
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_S_BASE 0x40000000
 | 
			
		||||
#define VDEC_S_SUCCESS (VDEC_S_BASE)
 | 
			
		||||
#define VDEC_S_EFAIL (VDEC_S_BASE + 1)
 | 
			
		||||
#define VDEC_S_EFATAL (VDEC_S_BASE + 2)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_S_EBADPARAM (VDEC_S_BASE + 3)
 | 
			
		||||
#define VDEC_S_EINVALSTATE (VDEC_S_BASE + 4)
 | 
			
		||||
#define VDEC_S_ENOSWRES (VDEC_S_BASE + 5)
 | 
			
		||||
#define VDEC_S_ENOHWRES (VDEC_S_BASE + 6)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_S_EINVALCMD (VDEC_S_BASE + 7)
 | 
			
		||||
#define VDEC_S_ETIMEOUT (VDEC_S_BASE + 8)
 | 
			
		||||
#define VDEC_S_ENOPREREQ (VDEC_S_BASE + 9)
 | 
			
		||||
#define VDEC_S_ECMDQFULL (VDEC_S_BASE + 10)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_S_ENOTSUPP (VDEC_S_BASE + 11)
 | 
			
		||||
#define VDEC_S_ENOTIMPL (VDEC_S_BASE + 12)
 | 
			
		||||
#define VDEC_S_BUSY (VDEC_S_BASE + 13)
 | 
			
		||||
#define VDEC_S_INPUT_BITSTREAM_ERR (VDEC_S_BASE + 14)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_INTF_VER 1
 | 
			
		||||
#define VDEC_MSG_BASE 0x0000000
 | 
			
		||||
#define VDEC_MSG_INVALID (VDEC_MSG_BASE + 0)
 | 
			
		||||
#define VDEC_MSG_RESP_INPUT_BUFFER_DONE (VDEC_MSG_BASE + 1)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_MSG_RESP_OUTPUT_BUFFER_DONE (VDEC_MSG_BASE + 2)
 | 
			
		||||
#define VDEC_MSG_RESP_INPUT_FLUSHED (VDEC_MSG_BASE + 3)
 | 
			
		||||
#define VDEC_MSG_RESP_OUTPUT_FLUSHED (VDEC_MSG_BASE + 4)
 | 
			
		||||
#define VDEC_MSG_RESP_FLUSH_INPUT_DONE (VDEC_MSG_BASE + 5)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_MSG_RESP_FLUSH_OUTPUT_DONE (VDEC_MSG_BASE + 6)
 | 
			
		||||
#define VDEC_MSG_RESP_START_DONE (VDEC_MSG_BASE + 7)
 | 
			
		||||
#define VDEC_MSG_RESP_STOP_DONE (VDEC_MSG_BASE + 8)
 | 
			
		||||
#define VDEC_MSG_RESP_PAUSE_DONE (VDEC_MSG_BASE + 9)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_MSG_RESP_RESUME_DONE (VDEC_MSG_BASE + 10)
 | 
			
		||||
#define VDEC_MSG_RESP_RESOURCE_LOADED (VDEC_MSG_BASE + 11)
 | 
			
		||||
#define VDEC_EVT_RESOURCES_LOST (VDEC_MSG_BASE + 12)
 | 
			
		||||
#define VDEC_MSG_EVT_CONFIG_CHANGED (VDEC_MSG_BASE + 13)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_MSG_EVT_HW_ERROR (VDEC_MSG_BASE + 14)
 | 
			
		||||
#define VDEC_MSG_EVT_INFO_CONFIG_CHANGED (VDEC_MSG_BASE + 15)
 | 
			
		||||
#define VDEC_MSG_EVT_INFO_FIELD_DROPPED (VDEC_MSG_BASE + 16)
 | 
			
		||||
#define VDEC_BUFFERFLAG_EOS 0x00000001
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_BUFFERFLAG_DECODEONLY 0x00000004
 | 
			
		||||
#define VDEC_BUFFERFLAG_DATACORRUPT 0x00000008
 | 
			
		||||
#define VDEC_BUFFERFLAG_ENDOFFRAME 0x00000010
 | 
			
		||||
#define VDEC_BUFFERFLAG_SYNCFRAME 0x00000020
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_BUFFERFLAG_EXTRADATA 0x00000040
 | 
			
		||||
#define VDEC_BUFFERFLAG_CODECCONFIG 0x00000080
 | 
			
		||||
#define VDEC_EXTRADATA_NONE 0x001
 | 
			
		||||
#define VDEC_EXTRADATA_QP 0x004
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_EXTRADATA_MB_ERROR_MAP 0x008
 | 
			
		||||
#define VDEC_EXTRADATA_SEI 0x010
 | 
			
		||||
#define VDEC_EXTRADATA_VUI 0x020
 | 
			
		||||
#define VDEC_EXTRADATA_VC1 0x040
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_CMDBASE 0x800
 | 
			
		||||
#define VDEC_CMD_SET_INTF_VERSION (VDEC_CMDBASE)
 | 
			
		||||
#define VDEC_IOCTL_MAGIC 'v'
 | 
			
		||||
struct vdec_ioctl_msg {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void __user *in;
 | 
			
		||||
 void __user *out;
 | 
			
		||||
};
 | 
			
		||||
#define VDEC_IOCTL_GET_PROFILE_LEVEL_SUPPORTED   _IOWR(VDEC_IOCTL_MAGIC, 0, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_GET_INTERLACE_FORMAT   _IOR(VDEC_IOCTL_MAGIC, 1, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_CURRENT_PROFILE_LEVEL   _IOWR(VDEC_IOCTL_MAGIC, 2, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_OUTPUT_FORMAT   _IOWR(VDEC_IOCTL_MAGIC, 3, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_OUTPUT_FORMAT   _IOWR(VDEC_IOCTL_MAGIC, 4, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_SET_CODEC   _IOW(VDEC_IOCTL_MAGIC, 5, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_CODEC   _IOR(VDEC_IOCTL_MAGIC, 6, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_PICRES   _IOW(VDEC_IOCTL_MAGIC, 7, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_PICRES   _IOR(VDEC_IOCTL_MAGIC, 8, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_SET_EXTRADATA   _IOW(VDEC_IOCTL_MAGIC, 9, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_EXTRADATA   _IOR(VDEC_IOCTL_MAGIC, 10, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_SEQUENCE_HEADER   _IOW(VDEC_IOCTL_MAGIC, 11, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_BUFFER_REQ   _IOW(VDEC_IOCTL_MAGIC, 12, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_GET_BUFFER_REQ   _IOR(VDEC_IOCTL_MAGIC, 13, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_ALLOCATE_BUFFER   _IOWR(VDEC_IOCTL_MAGIC, 14, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_FREE_BUFFER   _IOW(VDEC_IOCTL_MAGIC, 15, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_BUFFER   _IOW(VDEC_IOCTL_MAGIC, 16, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_FILL_OUTPUT_BUFFER   _IOW(VDEC_IOCTL_MAGIC, 17, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_DECODE_FRAME   _IOW(VDEC_IOCTL_MAGIC, 18, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_LOAD_RESOURCES _IO(VDEC_IOCTL_MAGIC, 19)
 | 
			
		||||
#define VDEC_IOCTL_CMD_START _IO(VDEC_IOCTL_MAGIC, 20)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_CMD_STOP _IO(VDEC_IOCTL_MAGIC, 21)
 | 
			
		||||
#define VDEC_IOCTL_CMD_PAUSE _IO(VDEC_IOCTL_MAGIC, 22)
 | 
			
		||||
#define VDEC_IOCTL_CMD_RESUME _IO(VDEC_IOCTL_MAGIC, 23)
 | 
			
		||||
#define VDEC_IOCTL_CMD_FLUSH _IOW(VDEC_IOCTL_MAGIC, 24, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_GET_NEXT_MSG   _IOR(VDEC_IOCTL_MAGIC, 25, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_STOP_NEXT_MSG _IO(VDEC_IOCTL_MAGIC, 26)
 | 
			
		||||
#define VDEC_IOCTL_GET_NUMBER_INSTANCES   _IOR(VDEC_IOCTL_MAGIC, 27, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_PICTURE_ORDER   _IOW(VDEC_IOCTL_MAGIC, 28, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_SET_FRAME_RATE   _IOW(VDEC_IOCTL_MAGIC, 29, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_SET_H264_MV_BUFFER   _IOW(VDEC_IOCTL_MAGIC, 30, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_FREE_H264_MV_BUFFER   _IOW(VDEC_IOCTL_MAGIC, 31, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_MV_BUFFER_SIZE   _IOR(VDEC_IOCTL_MAGIC, 32, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_SET_IDR_ONLY_DECODING   _IO(VDEC_IOCTL_MAGIC, 33)
 | 
			
		||||
#define VDEC_IOCTL_SET_CONT_ON_RECONFIG   _IO(VDEC_IOCTL_MAGIC, 34)
 | 
			
		||||
#define VDEC_IOCTL_SET_DISABLE_DMX   _IOW(VDEC_IOCTL_MAGIC, 35, struct vdec_ioctl_msg)
 | 
			
		||||
#define VDEC_IOCTL_GET_DISABLE_DMX   _IOR(VDEC_IOCTL_MAGIC, 36, struct vdec_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VDEC_IOCTL_GET_DISABLE_DMX_SUPPORT   _IOR(VDEC_IOCTL_MAGIC, 37, struct vdec_ioctl_msg)
 | 
			
		||||
enum vdec_picture {
 | 
			
		||||
 PICTURE_TYPE_I,
 | 
			
		||||
 PICTURE_TYPE_P,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 PICTURE_TYPE_B,
 | 
			
		||||
 PICTURE_TYPE_BI,
 | 
			
		||||
 PICTURE_TYPE_SKIP,
 | 
			
		||||
 PICTURE_TYPE_IDR,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 PICTURE_TYPE_UNKNOWN
 | 
			
		||||
};
 | 
			
		||||
enum vdec_buffer {
 | 
			
		||||
 VDEC_BUFFER_TYPE_INPUT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_BUFFER_TYPE_OUTPUT
 | 
			
		||||
};
 | 
			
		||||
struct vdec_allocatorproperty {
 | 
			
		||||
 enum vdec_buffer buffer_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t mincount;
 | 
			
		||||
 uint32_t maxcount;
 | 
			
		||||
 uint32_t actualcount;
 | 
			
		||||
 size_t buffer_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t alignment;
 | 
			
		||||
 uint32_t buf_poolid;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_bufferpayload {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void __user *bufferaddr;
 | 
			
		||||
 size_t buffer_len;
 | 
			
		||||
 int pmem_fd;
 | 
			
		||||
 size_t offset;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t mmaped_size;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_setbuffer_cmd {
 | 
			
		||||
 enum vdec_buffer buffer_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_bufferpayload buffer;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_fillbuffer_cmd {
 | 
			
		||||
 struct vdec_bufferpayload buffer;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *client_data;
 | 
			
		||||
};
 | 
			
		||||
enum vdec_bufferflush {
 | 
			
		||||
 VDEC_FLUSH_TYPE_INPUT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_FLUSH_TYPE_OUTPUT,
 | 
			
		||||
 VDEC_FLUSH_TYPE_ALL
 | 
			
		||||
};
 | 
			
		||||
enum vdec_codec {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_CODECTYPE_H264 = 0x1,
 | 
			
		||||
 VDEC_CODECTYPE_H263 = 0x2,
 | 
			
		||||
 VDEC_CODECTYPE_MPEG4 = 0x3,
 | 
			
		||||
 VDEC_CODECTYPE_DIVX_3 = 0x4,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_CODECTYPE_DIVX_4 = 0x5,
 | 
			
		||||
 VDEC_CODECTYPE_DIVX_5 = 0x6,
 | 
			
		||||
 VDEC_CODECTYPE_DIVX_6 = 0x7,
 | 
			
		||||
 VDEC_CODECTYPE_XVID = 0x8,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_CODECTYPE_MPEG1 = 0x9,
 | 
			
		||||
 VDEC_CODECTYPE_MPEG2 = 0xa,
 | 
			
		||||
 VDEC_CODECTYPE_VC1 = 0xb,
 | 
			
		||||
 VDEC_CODECTYPE_VC1_RCV = 0xc
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum vdec_mpeg2_profile {
 | 
			
		||||
 VDEC_MPEG2ProfileSimple = 0x1,
 | 
			
		||||
 VDEC_MPEG2ProfileMain = 0x2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG2Profile422 = 0x4,
 | 
			
		||||
 VDEC_MPEG2ProfileSNR = 0x8,
 | 
			
		||||
 VDEC_MPEG2ProfileSpatial = 0x10,
 | 
			
		||||
 VDEC_MPEG2ProfileHigh = 0x20,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG2ProfileKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_MPEG2ProfileVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_MPEG2ProfileMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum vdec_mpeg2_level {
 | 
			
		||||
 VDEC_MPEG2LevelLL = 0x1,
 | 
			
		||||
 VDEC_MPEG2LevelML = 0x2,
 | 
			
		||||
 VDEC_MPEG2LevelH14 = 0x4,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG2LevelHL = 0x8,
 | 
			
		||||
 VDEC_MPEG2LevelKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_MPEG2LevelVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_MPEG2LevelMax = 0x7FFFFFFF
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum vdec_mpeg4_profile {
 | 
			
		||||
 VDEC_MPEG4ProfileSimple = 0x01,
 | 
			
		||||
 VDEC_MPEG4ProfileSimpleScalable = 0x02,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4ProfileCore = 0x04,
 | 
			
		||||
 VDEC_MPEG4ProfileMain = 0x08,
 | 
			
		||||
 VDEC_MPEG4ProfileNbit = 0x10,
 | 
			
		||||
 VDEC_MPEG4ProfileScalableTexture = 0x20,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4ProfileSimpleFace = 0x40,
 | 
			
		||||
 VDEC_MPEG4ProfileSimpleFBA = 0x80,
 | 
			
		||||
 VDEC_MPEG4ProfileBasicAnimated = 0x100,
 | 
			
		||||
 VDEC_MPEG4ProfileHybrid = 0x200,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4ProfileAdvancedRealTime = 0x400,
 | 
			
		||||
 VDEC_MPEG4ProfileCoreScalable = 0x800,
 | 
			
		||||
 VDEC_MPEG4ProfileAdvancedCoding = 0x1000,
 | 
			
		||||
 VDEC_MPEG4ProfileAdvancedCore = 0x2000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4ProfileAdvancedScalable = 0x4000,
 | 
			
		||||
 VDEC_MPEG4ProfileAdvancedSimple = 0x8000,
 | 
			
		||||
 VDEC_MPEG4ProfileKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_MPEG4ProfileVendorStartUnused = 0x7F000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4ProfileMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
enum vdec_mpeg4_level {
 | 
			
		||||
 VDEC_MPEG4Level0 = 0x01,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4Level0b = 0x02,
 | 
			
		||||
 VDEC_MPEG4Level1 = 0x04,
 | 
			
		||||
 VDEC_MPEG4Level2 = 0x08,
 | 
			
		||||
 VDEC_MPEG4Level3 = 0x10,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4Level4 = 0x20,
 | 
			
		||||
 VDEC_MPEG4Level4a = 0x40,
 | 
			
		||||
 VDEC_MPEG4Level5 = 0x80,
 | 
			
		||||
 VDEC_MPEG4LevelKhronosExtensions = 0x6F000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_MPEG4LevelVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_MPEG4LevelMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
enum vdec_avc_profile {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCProfileBaseline = 0x01,
 | 
			
		||||
 VDEC_AVCProfileMain = 0x02,
 | 
			
		||||
 VDEC_AVCProfileExtended = 0x04,
 | 
			
		||||
 VDEC_AVCProfileHigh = 0x08,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCProfileHigh10 = 0x10,
 | 
			
		||||
 VDEC_AVCProfileHigh422 = 0x20,
 | 
			
		||||
 VDEC_AVCProfileHigh444 = 0x40,
 | 
			
		||||
 VDEC_AVCProfileKhronosExtensions = 0x6F000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCProfileVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_AVCProfileMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
enum vdec_avc_level {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCLevel1 = 0x01,
 | 
			
		||||
 VDEC_AVCLevel1b = 0x02,
 | 
			
		||||
 VDEC_AVCLevel11 = 0x04,
 | 
			
		||||
 VDEC_AVCLevel12 = 0x08,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCLevel13 = 0x10,
 | 
			
		||||
 VDEC_AVCLevel2 = 0x20,
 | 
			
		||||
 VDEC_AVCLevel21 = 0x40,
 | 
			
		||||
 VDEC_AVCLevel22 = 0x80,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCLevel3 = 0x100,
 | 
			
		||||
 VDEC_AVCLevel31 = 0x200,
 | 
			
		||||
 VDEC_AVCLevel32 = 0x400,
 | 
			
		||||
 VDEC_AVCLevel4 = 0x800,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCLevel41 = 0x1000,
 | 
			
		||||
 VDEC_AVCLevel42 = 0x2000,
 | 
			
		||||
 VDEC_AVCLevel5 = 0x4000,
 | 
			
		||||
 VDEC_AVCLevel51 = 0x8000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_AVCLevelKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_AVCLevelVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_AVCLevelMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum vdec_divx_profile {
 | 
			
		||||
 VDEC_DIVXProfile_qMobile = 0x01,
 | 
			
		||||
 VDEC_DIVXProfile_Mobile = 0x02,
 | 
			
		||||
 VDEC_DIVXProfile_HD = 0x04,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_DIVXProfile_Handheld = 0x08,
 | 
			
		||||
 VDEC_DIVXProfile_Portable = 0x10,
 | 
			
		||||
 VDEC_DIVXProfile_HomeTheater = 0x20
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum vdec_xvid_profile {
 | 
			
		||||
 VDEC_XVIDProfile_Simple = 0x1,
 | 
			
		||||
 VDEC_XVIDProfile_Advanced_Realtime_Simple = 0x2,
 | 
			
		||||
 VDEC_XVIDProfile_Advanced_Simple = 0x4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum vdec_xvid_level {
 | 
			
		||||
 VDEC_XVID_LEVEL_S_L0 = 0x1,
 | 
			
		||||
 VDEC_XVID_LEVEL_S_L1 = 0x2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_XVID_LEVEL_S_L2 = 0x4,
 | 
			
		||||
 VDEC_XVID_LEVEL_S_L3 = 0x8,
 | 
			
		||||
 VDEC_XVID_LEVEL_ARTS_L1 = 0x10,
 | 
			
		||||
 VDEC_XVID_LEVEL_ARTS_L2 = 0x20,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_XVID_LEVEL_ARTS_L3 = 0x40,
 | 
			
		||||
 VDEC_XVID_LEVEL_ARTS_L4 = 0x80,
 | 
			
		||||
 VDEC_XVID_LEVEL_AS_L0 = 0x100,
 | 
			
		||||
 VDEC_XVID_LEVEL_AS_L1 = 0x200,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_XVID_LEVEL_AS_L2 = 0x400,
 | 
			
		||||
 VDEC_XVID_LEVEL_AS_L3 = 0x800,
 | 
			
		||||
 VDEC_XVID_LEVEL_AS_L4 = 0x1000
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum vdec_h263profile {
 | 
			
		||||
 VDEC_H263ProfileBaseline = 0x01,
 | 
			
		||||
 VDEC_H263ProfileH320Coding = 0x02,
 | 
			
		||||
 VDEC_H263ProfileBackwardCompatible = 0x04,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263ProfileISWV2 = 0x08,
 | 
			
		||||
 VDEC_H263ProfileISWV3 = 0x10,
 | 
			
		||||
 VDEC_H263ProfileHighCompression = 0x20,
 | 
			
		||||
 VDEC_H263ProfileInternet = 0x40,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263ProfileInterlace = 0x80,
 | 
			
		||||
 VDEC_H263ProfileHighLatency = 0x100,
 | 
			
		||||
 VDEC_H263ProfileKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_H263ProfileVendorStartUnused = 0x7F000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263ProfileMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
enum vdec_h263level {
 | 
			
		||||
 VDEC_H263Level10 = 0x01,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263Level20 = 0x02,
 | 
			
		||||
 VDEC_H263Level30 = 0x04,
 | 
			
		||||
 VDEC_H263Level40 = 0x08,
 | 
			
		||||
 VDEC_H263Level45 = 0x10,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263Level50 = 0x20,
 | 
			
		||||
 VDEC_H263Level60 = 0x40,
 | 
			
		||||
 VDEC_H263Level70 = 0x80,
 | 
			
		||||
 VDEC_H263LevelKhronosExtensions = 0x6F000000,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_H263LevelVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_H263LevelMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
enum vdec_wmv_format {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_WMVFormatUnused = 0x01,
 | 
			
		||||
 VDEC_WMVFormat7 = 0x02,
 | 
			
		||||
 VDEC_WMVFormat8 = 0x04,
 | 
			
		||||
 VDEC_WMVFormat9 = 0x08,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_WMFFormatKhronosExtensions = 0x6F000000,
 | 
			
		||||
 VDEC_WMFFormatVendorStartUnused = 0x7F000000,
 | 
			
		||||
 VDEC_WMVFormatMax = 0x7FFFFFFF
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum vdec_vc1_profile {
 | 
			
		||||
 VDEC_VC1ProfileSimple = 0x1,
 | 
			
		||||
 VDEC_VC1ProfileMain = 0x2,
 | 
			
		||||
 VDEC_VC1ProfileAdvanced = 0x4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum vdec_vc1_level {
 | 
			
		||||
 VDEC_VC1_LEVEL_S_Low = 0x1,
 | 
			
		||||
 VDEC_VC1_LEVEL_S_Medium = 0x2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_VC1_LEVEL_M_Low = 0x4,
 | 
			
		||||
 VDEC_VC1_LEVEL_M_Medium = 0x8,
 | 
			
		||||
 VDEC_VC1_LEVEL_M_High = 0x10,
 | 
			
		||||
 VDEC_VC1_LEVEL_A_L0 = 0x20,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_VC1_LEVEL_A_L1 = 0x40,
 | 
			
		||||
 VDEC_VC1_LEVEL_A_L2 = 0x80,
 | 
			
		||||
 VDEC_VC1_LEVEL_A_L3 = 0x100,
 | 
			
		||||
 VDEC_VC1_LEVEL_A_L4 = 0x200
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct vdec_profile_level {
 | 
			
		||||
 uint32_t profiles;
 | 
			
		||||
 uint32_t levels;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
enum vdec_interlaced_format {
 | 
			
		||||
 VDEC_InterlaceFrameProgressive = 0x1,
 | 
			
		||||
 VDEC_InterlaceInterleaveFrameTopFieldFirst = 0x2,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_InterlaceInterleaveFrameBottomFieldFirst = 0x4
 | 
			
		||||
};
 | 
			
		||||
enum vdec_output_fromat {
 | 
			
		||||
 VDEC_YUV_FORMAT_NV12 = 0x1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_YUV_FORMAT_TILE_4x2 = 0x2
 | 
			
		||||
};
 | 
			
		||||
enum vdec_output_order {
 | 
			
		||||
 VDEC_ORDER_DISPLAY = 0x1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 VDEC_ORDER_DECODE = 0x2
 | 
			
		||||
};
 | 
			
		||||
struct vdec_picsize {
 | 
			
		||||
 uint32_t frame_width;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t frame_height;
 | 
			
		||||
 uint32_t stride;
 | 
			
		||||
 uint32_t scan_lines;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_seqheader {
 | 
			
		||||
 void __user *ptr_seqheader;
 | 
			
		||||
 size_t seq_header_len;
 | 
			
		||||
 int pmem_fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t pmem_offset;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_mberror {
 | 
			
		||||
 void __user *ptr_errormap;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t err_mapsize;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_input_frameinfo {
 | 
			
		||||
 void __user *bufferaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t offset;
 | 
			
		||||
 size_t datalen;
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 int64_t timestamp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *client_data;
 | 
			
		||||
 int pmem_fd;
 | 
			
		||||
 size_t pmem_offset;
 | 
			
		||||
 void __user *desc_addr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t desc_size;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_framesize {
 | 
			
		||||
 uint32_t left;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t top;
 | 
			
		||||
 uint32_t right;
 | 
			
		||||
 uint32_t bottom;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_aspectratioinfo {
 | 
			
		||||
 uint32_t aspect_ratio;
 | 
			
		||||
 uint32_t par_width;
 | 
			
		||||
 uint32_t par_height;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct vdec_output_frameinfo {
 | 
			
		||||
 void __user *bufferaddr;
 | 
			
		||||
 size_t offset;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t len;
 | 
			
		||||
 uint32_t flags;
 | 
			
		||||
 int64_t time_stamp;
 | 
			
		||||
 enum vdec_picture pic_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *client_data;
 | 
			
		||||
 void *input_frame_clientdata;
 | 
			
		||||
 struct vdec_framesize framesize;
 | 
			
		||||
 enum vdec_interlaced_format interlaced_format;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct vdec_aspectratioinfo aspect_ratio_info;
 | 
			
		||||
};
 | 
			
		||||
union vdec_msgdata {
 | 
			
		||||
 struct vdec_output_frameinfo output_frame;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void *input_frame_clientdata;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_msginfo {
 | 
			
		||||
 uint32_t status_code;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t msgcode;
 | 
			
		||||
 union vdec_msgdata msgdata;
 | 
			
		||||
 size_t msgdatasize;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_framerate {
 | 
			
		||||
 unsigned long fps_denominator;
 | 
			
		||||
 unsigned long fps_numerator;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct vdec_h264_mv{
 | 
			
		||||
 size_t size;
 | 
			
		||||
 int count;
 | 
			
		||||
 int pmem_fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int offset;
 | 
			
		||||
};
 | 
			
		||||
struct vdec_mv_buff_size{
 | 
			
		||||
 int width;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int height;
 | 
			
		||||
 int size;
 | 
			
		||||
 int alignment;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,429 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_VIDC_ENC_H_
 | 
			
		||||
#define _MSM_VIDC_ENC_H_
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_BASE 0x00000000
 | 
			
		||||
#define VEN_S_SUCCESS (VEN_S_BASE)
 | 
			
		||||
#define VEN_S_EFAIL (VEN_S_BASE+1)
 | 
			
		||||
#define VEN_S_EFATAL (VEN_S_BASE+2)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_EBADPARAM (VEN_S_BASE+3)
 | 
			
		||||
#define VEN_S_EINVALSTATE (VEN_S_BASE+4)
 | 
			
		||||
#define VEN_S_ENOSWRES (VEN_S_BASE+5)
 | 
			
		||||
#define VEN_S_ENOHWRES (VEN_S_BASE+6)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_EBUFFREQ (VEN_S_BASE+7)
 | 
			
		||||
#define VEN_S_EINVALCMD (VEN_S_BASE+8)
 | 
			
		||||
#define VEN_S_ETIMEOUT (VEN_S_BASE+9)
 | 
			
		||||
#define VEN_S_ENOREATMPT (VEN_S_BASE+10)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_ENOPREREQ (VEN_S_BASE+11)
 | 
			
		||||
#define VEN_S_ECMDQFULL (VEN_S_BASE+12)
 | 
			
		||||
#define VEN_S_ENOTSUPP (VEN_S_BASE+13)
 | 
			
		||||
#define VEN_S_ENOTIMPL (VEN_S_BASE+14)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_ENOTPMEM (VEN_S_BASE+15)
 | 
			
		||||
#define VEN_S_EFLUSHED (VEN_S_BASE+16)
 | 
			
		||||
#define VEN_S_EINSUFBUF (VEN_S_BASE+17)
 | 
			
		||||
#define VEN_S_ESAMESTATE (VEN_S_BASE+18)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_S_EINVALTRANS (VEN_S_BASE+19)
 | 
			
		||||
#define VEN_INTF_VER 1
 | 
			
		||||
#define VEN_MSG_INDICATION 0
 | 
			
		||||
#define VEN_MSG_INPUT_BUFFER_DONE 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_MSG_OUTPUT_BUFFER_DONE 2
 | 
			
		||||
#define VEN_MSG_NEED_OUTPUT_BUFFER 3
 | 
			
		||||
#define VEN_MSG_FLUSH_INPUT_DONE 4
 | 
			
		||||
#define VEN_MSG_FLUSH_OUPUT_DONE 5
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_MSG_START 6
 | 
			
		||||
#define VEN_MSG_STOP 7
 | 
			
		||||
#define VEN_MSG_PAUSE 8
 | 
			
		||||
#define VEN_MSG_RESUME 9
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_MSG_STOP_READING_MSG 10
 | 
			
		||||
#define VEN_BUFFLAG_EOS 0x00000001
 | 
			
		||||
#define VEN_BUFFLAG_ENDOFFRAME 0x00000010
 | 
			
		||||
#define VEN_BUFFLAG_SYNCFRAME 0x00000020
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_BUFFLAG_EXTRADATA 0x00000040
 | 
			
		||||
#define VEN_BUFFLAG_CODECCONFIG 0x00000080
 | 
			
		||||
#define VEN_EXTRADATA_NONE 0x001
 | 
			
		||||
#define VEN_EXTRADATA_QCOMFILLER 0x002
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_EXTRADATA_SLICEINFO 0x100
 | 
			
		||||
#define VEN_FRAME_TYPE_I 1
 | 
			
		||||
#define VEN_FRAME_TYPE_P 2
 | 
			
		||||
#define VEN_FRAME_TYPE_B 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_CODEC_MPEG4 1
 | 
			
		||||
#define VEN_CODEC_H264 2
 | 
			
		||||
#define VEN_CODEC_H263 3
 | 
			
		||||
#define VEN_PROFILE_MPEG4_SP 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_PROFILE_MPEG4_ASP 2
 | 
			
		||||
#define VEN_PROFILE_H264_BASELINE 3
 | 
			
		||||
#define VEN_PROFILE_H264_MAIN 4
 | 
			
		||||
#define VEN_PROFILE_H264_HIGH 5
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_PROFILE_H263_BASELINE 6
 | 
			
		||||
#define VEN_LEVEL_MPEG4_0 0x1
 | 
			
		||||
#define VEN_LEVEL_MPEG4_1 0x2
 | 
			
		||||
#define VEN_LEVEL_MPEG4_2 0x3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_MPEG4_3 0x4
 | 
			
		||||
#define VEN_LEVEL_MPEG4_4 0x5
 | 
			
		||||
#define VEN_LEVEL_MPEG4_5 0x6
 | 
			
		||||
#define VEN_LEVEL_MPEG4_3b 0x7
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_MPEG4_6 0x8
 | 
			
		||||
#define VEN_LEVEL_H264_1 0x9
 | 
			
		||||
#define VEN_LEVEL_H264_1b 0xA
 | 
			
		||||
#define VEN_LEVEL_H264_1p1 0xB
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_H264_1p2 0xC
 | 
			
		||||
#define VEN_LEVEL_H264_1p3 0xD
 | 
			
		||||
#define VEN_LEVEL_H264_2 0xE
 | 
			
		||||
#define VEN_LEVEL_H264_2p1 0xF
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_H264_2p2 0x10
 | 
			
		||||
#define VEN_LEVEL_H264_3 0x11
 | 
			
		||||
#define VEN_LEVEL_H264_3p1 0x12
 | 
			
		||||
#define VEN_LEVEL_H264_3p2 0x13
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_H264_4 0x14
 | 
			
		||||
#define VEN_LEVEL_H263_10 0x15
 | 
			
		||||
#define VEN_LEVEL_H263_20 0x16
 | 
			
		||||
#define VEN_LEVEL_H263_30 0x17
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_H263_40 0x18
 | 
			
		||||
#define VEN_LEVEL_H263_45 0x19
 | 
			
		||||
#define VEN_LEVEL_H263_50 0x1A
 | 
			
		||||
#define VEN_LEVEL_H263_60 0x1B
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_LEVEL_H263_70 0x1C
 | 
			
		||||
#define VEN_ENTROPY_MODEL_CAVLC 1
 | 
			
		||||
#define VEN_ENTROPY_MODEL_CABAC 2
 | 
			
		||||
#define VEN_CABAC_MODEL_0 1
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_CABAC_MODEL_1 2
 | 
			
		||||
#define VEN_CABAC_MODEL_2 3
 | 
			
		||||
#define VEN_DB_DISABLE 1
 | 
			
		||||
#define VEN_DB_ALL_BLKG_BNDRY 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_DB_SKIP_SLICE_BNDRY 3
 | 
			
		||||
#define VEN_MSLICE_OFF 1
 | 
			
		||||
#define VEN_MSLICE_CNT_MB 2
 | 
			
		||||
#define VEN_MSLICE_CNT_BYTE 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_MSLICE_GOB 4
 | 
			
		||||
#define VEN_RC_OFF 1
 | 
			
		||||
#define VEN_RC_VBR_VFR 2
 | 
			
		||||
#define VEN_RC_VBR_CFR 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_RC_CBR_VFR 4
 | 
			
		||||
#define VEN_RC_CBR_CFR 5
 | 
			
		||||
#define VEN_FLUSH_INPUT 1
 | 
			
		||||
#define VEN_FLUSH_OUTPUT 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_FLUSH_ALL 3
 | 
			
		||||
#define VEN_INPUTFMT_NV12 1
 | 
			
		||||
#define VEN_INPUTFMT_NV21 2
 | 
			
		||||
#define VEN_INPUTFMT_NV12_16M2KA 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_ROTATION_0 1
 | 
			
		||||
#define VEN_ROTATION_90 2
 | 
			
		||||
#define VEN_ROTATION_180 3
 | 
			
		||||
#define VEN_ROTATION_270 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_TIMEOUT_INFINITE 0xffffffff
 | 
			
		||||
#define VEN_IR_OFF 1
 | 
			
		||||
#define VEN_IR_CYCLIC 2
 | 
			
		||||
#define VEN_IR_RANDOM 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTLBASE_NENC 0x800
 | 
			
		||||
#define VEN_IOCTLBASE_ENC 0x850
 | 
			
		||||
struct venc_ioctl_msg{
 | 
			
		||||
 void __user *in;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 void __user *out;
 | 
			
		||||
};
 | 
			
		||||
#define VEN_IOCTL_SET_INTF_VERSION   _IOW(VEN_IOCTLBASE_NENC, 0, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_READ_NEXT_MSG   _IOWR(VEN_IOCTLBASE_NENC, 1, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_CMD_STOP_READ_MSG _IO(VEN_IOCTLBASE_NENC, 2)
 | 
			
		||||
#define VEN_IOCTL_SET_INPUT_BUFFER_REQ   _IOW(VEN_IOCTLBASE_NENC, 3, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_INPUT_BUFFER_REQ   _IOR(VEN_IOCTLBASE_NENC, 4, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_ALLOC_INPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 5, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_INPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 6, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_FREE_INPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 7, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_OUTPUT_BUFFER_REQ   _IOW(VEN_IOCTLBASE_NENC, 8, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_OUTPUT_BUFFER_REQ   _IOR(VEN_IOCTLBASE_NENC, 9, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_CMD_ALLOC_OUTPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 10, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_OUTPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 11, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_FREE_OUTPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 12, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_START _IO(VEN_IOCTLBASE_NENC, 13)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_CMD_ENCODE_FRAME   _IOW(VEN_IOCTLBASE_NENC, 14, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_FILL_OUTPUT_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 15, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_FLUSH   _IOW(VEN_IOCTLBASE_NENC, 16, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_PAUSE _IO(VEN_IOCTLBASE_NENC, 17)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_CMD_RESUME _IO(VEN_IOCTLBASE_NENC, 18)
 | 
			
		||||
#define VEN_IOCTL_CMD_STOP _IO(VEN_IOCTLBASE_NENC, 19)
 | 
			
		||||
#define VEN_IOCTL_SET_RECON_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 20, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_FREE_RECON_BUFFER   _IOW(VEN_IOCTLBASE_NENC, 21, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_GET_RECON_BUFFER_SIZE   _IOW(VEN_IOCTLBASE_NENC, 22, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_BASE_CFG   _IOW(VEN_IOCTLBASE_ENC, 1, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_BASE_CFG   _IOR(VEN_IOCTLBASE_ENC, 2, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_LIVE_MODE   _IOW(VEN_IOCTLBASE_ENC, 3, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_GET_LIVE_MODE   _IOR(VEN_IOCTLBASE_ENC, 4, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_CODEC_PROFILE   _IOW(VEN_IOCTLBASE_ENC, 5, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_CODEC_PROFILE   _IOR(VEN_IOCTLBASE_ENC, 6, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_PROFILE_LEVEL   _IOW(VEN_IOCTLBASE_ENC, 7, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_GET_PROFILE_LEVEL   _IOR(VEN_IOCTLBASE_ENC, 8, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_SHORT_HDR   _IOW(VEN_IOCTLBASE_ENC, 9, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_SHORT_HDR   _IOR(VEN_IOCTLBASE_ENC, 10, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_SESSION_QP   _IOW(VEN_IOCTLBASE_ENC, 11, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_GET_SESSION_QP   _IOR(VEN_IOCTLBASE_ENC, 12, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_INTRA_PERIOD   _IOW(VEN_IOCTLBASE_ENC, 13, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_INTRA_PERIOD   _IOR(VEN_IOCTLBASE_ENC, 14, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_CMD_REQUEST_IFRAME _IO(VEN_IOCTLBASE_ENC, 15)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_GET_CAPABILITY   _IOR(VEN_IOCTLBASE_ENC, 16, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_SEQUENCE_HDR   _IOR(VEN_IOCTLBASE_ENC, 17, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_ENTROPY_CFG   _IOW(VEN_IOCTLBASE_ENC, 18, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_ENTROPY_CFG   _IOR(VEN_IOCTLBASE_ENC, 19, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_DEBLOCKING_CFG   _IOW(VEN_IOCTLBASE_ENC, 20, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_DEBLOCKING_CFG   _IOR(VEN_IOCTLBASE_ENC, 21, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_INTRA_REFRESH   _IOW(VEN_IOCTLBASE_ENC, 22, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_INTRA_REFRESH   _IOR(VEN_IOCTLBASE_ENC, 23, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_MULTI_SLICE_CFG   _IOW(VEN_IOCTLBASE_ENC, 24, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_MULTI_SLICE_CFG   _IOR(VEN_IOCTLBASE_ENC, 25, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_RATE_CTRL_CFG   _IOW(VEN_IOCTLBASE_ENC, 26, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_RATE_CTRL_CFG   _IOR(VEN_IOCTLBASE_ENC, 27, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_VOP_TIMING_CFG   _IOW(VEN_IOCTLBASE_ENC, 28, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_VOP_TIMING_CFG   _IOR(VEN_IOCTLBASE_ENC, 29, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_FRAME_RATE   _IOW(VEN_IOCTLBASE_ENC, 30, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_FRAME_RATE   _IOR(VEN_IOCTLBASE_ENC, 31, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_TARGET_BITRATE   _IOW(VEN_IOCTLBASE_ENC, 32, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_TARGET_BITRATE   _IOR(VEN_IOCTLBASE_ENC, 33, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_ROTATION   _IOW(VEN_IOCTLBASE_ENC, 34, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_ROTATION   _IOR(VEN_IOCTLBASE_ENC, 35, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_HEC   _IOW(VEN_IOCTLBASE_ENC, 36, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_HEC   _IOR(VEN_IOCTLBASE_ENC, 37, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_DATA_PARTITION   _IOW(VEN_IOCTLBASE_ENC, 38, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_DATA_PARTITION   _IOR(VEN_IOCTLBASE_ENC, 39, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_RVLC   _IOW(VEN_IOCTLBASE_ENC, 40, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_RVLC   _IOR(VEN_IOCTLBASE_ENC, 41, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_AC_PREDICTION   _IOW(VEN_IOCTLBASE_ENC, 42, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_AC_PREDICTION   _IOR(VEN_IOCTLBASE_ENC, 43, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_QP_RANGE   _IOW(VEN_IOCTLBASE_ENC, 44, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_QP_RANGE   _IOR(VEN_IOCTLBASE_ENC, 45, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_NUMBER_INSTANCES   _IOR(VEN_IOCTLBASE_ENC, 46, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_METABUFFER_MODE   _IOW(VEN_IOCTLBASE_ENC, 47, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VEN_IOCTL_SET_EXTRADATA   _IOW(VEN_IOCTLBASE_ENC, 48, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_GET_EXTRADATA   _IOR(VEN_IOCTLBASE_ENC, 49, struct venc_ioctl_msg)
 | 
			
		||||
#define VEN_IOCTL_SET_SLICE_DELIVERY_MODE   _IO(VEN_IOCTLBASE_ENC, 50)
 | 
			
		||||
#define VEN_IOCTL_SET_SPS_PPS_FOR_IDR   _IOW(VEN_IOCTLBASE_ENC, 51, struct venc_ioctl_msg)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_switch{
 | 
			
		||||
 unsigned char status;
 | 
			
		||||
};
 | 
			
		||||
struct venc_allocatorproperty{
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long mincount;
 | 
			
		||||
 unsigned long maxcount;
 | 
			
		||||
 unsigned long actualcount;
 | 
			
		||||
 unsigned long datasize;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long suffixsize;
 | 
			
		||||
 unsigned long alignment;
 | 
			
		||||
 unsigned long bufpoolid;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_bufferpayload{
 | 
			
		||||
 unsigned char *pbuffer;
 | 
			
		||||
 size_t sz;
 | 
			
		||||
 int fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned int offset;
 | 
			
		||||
 unsigned int maped_size;
 | 
			
		||||
 unsigned long filled_len;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_buffer{
 | 
			
		||||
 unsigned char *ptrbuffer;
 | 
			
		||||
 unsigned long sz;
 | 
			
		||||
 unsigned long len;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long offset;
 | 
			
		||||
 long long timestamp;
 | 
			
		||||
 unsigned long flags;
 | 
			
		||||
 void *clientdata;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_basecfg{
 | 
			
		||||
 unsigned long input_width;
 | 
			
		||||
 unsigned long input_height;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long dvs_width;
 | 
			
		||||
 unsigned long dvs_height;
 | 
			
		||||
 unsigned long codectype;
 | 
			
		||||
 unsigned long fps_num;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long fps_den;
 | 
			
		||||
 unsigned long targetbitrate;
 | 
			
		||||
 unsigned long inputformat;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_profile{
 | 
			
		||||
 unsigned long profile;
 | 
			
		||||
};
 | 
			
		||||
struct ven_profilelevel{
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long level;
 | 
			
		||||
};
 | 
			
		||||
struct venc_sessionqp{
 | 
			
		||||
 unsigned long iframeqp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long pframqp;
 | 
			
		||||
};
 | 
			
		||||
struct venc_qprange{
 | 
			
		||||
 unsigned long maxqp;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long minqp;
 | 
			
		||||
};
 | 
			
		||||
struct venc_intraperiod{
 | 
			
		||||
 unsigned long num_pframes;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long num_bframes;
 | 
			
		||||
};
 | 
			
		||||
struct venc_seqheader{
 | 
			
		||||
 unsigned char *hdrbufptr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long bufsize;
 | 
			
		||||
 unsigned long hdrlen;
 | 
			
		||||
};
 | 
			
		||||
struct venc_capability{
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long codec_types;
 | 
			
		||||
 unsigned long maxframe_width;
 | 
			
		||||
 unsigned long maxframe_height;
 | 
			
		||||
 unsigned long maxtarget_bitrate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long maxframe_rate;
 | 
			
		||||
 unsigned long input_formats;
 | 
			
		||||
 unsigned char dvs;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_entropycfg{
 | 
			
		||||
 unsigned longentropysel;
 | 
			
		||||
 unsigned long cabacmodel;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_dbcfg{
 | 
			
		||||
 unsigned long db_mode;
 | 
			
		||||
 unsigned long slicealpha_offset;
 | 
			
		||||
 unsigned long slicebeta_offset;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_intrarefresh{
 | 
			
		||||
 unsigned long irmode;
 | 
			
		||||
 unsigned long mbcount;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_multiclicecfg{
 | 
			
		||||
 unsigned long mslice_mode;
 | 
			
		||||
 unsigned long mslice_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_bufferflush{
 | 
			
		||||
 unsigned long flush_mode;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_ratectrlcfg{
 | 
			
		||||
 unsigned long rcmode;
 | 
			
		||||
};
 | 
			
		||||
struct venc_voptimingcfg{
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long voptime_resolution;
 | 
			
		||||
};
 | 
			
		||||
struct venc_framerate{
 | 
			
		||||
 unsigned long fps_denominator;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long fps_numerator;
 | 
			
		||||
};
 | 
			
		||||
struct venc_targetbitrate{
 | 
			
		||||
 unsigned long target_bitrate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct venc_rotation{
 | 
			
		||||
 unsigned long rotation;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_timeout{
 | 
			
		||||
 unsigned long millisec;
 | 
			
		||||
};
 | 
			
		||||
struct venc_headerextension{
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long header_extension;
 | 
			
		||||
};
 | 
			
		||||
struct venc_msg{
 | 
			
		||||
 unsigned long statuscode;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long msgcode;
 | 
			
		||||
 struct venc_buffer buf;
 | 
			
		||||
 unsigned long msgdata_size;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct venc_recon_addr{
 | 
			
		||||
 unsigned char *pbuffer;
 | 
			
		||||
 unsigned long buffer_size;
 | 
			
		||||
 unsigned long pmem_fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long offset;
 | 
			
		||||
};
 | 
			
		||||
struct venc_recon_buff_size{
 | 
			
		||||
 int width;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int height;
 | 
			
		||||
 int size;
 | 
			
		||||
 int alignment;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,100 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_GEMINI_H
 | 
			
		||||
#define __LINUX_MSM_GEMINI_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GMN_IOCTL_MAGIC 'g'
 | 
			
		||||
#define MSM_GMN_IOCTL_GET_HW_VERSION   _IOW(MSM_GMN_IOCTL_MAGIC, 1, struct msm_gemini_hw_cmd *)
 | 
			
		||||
#define MSM_GMN_IOCTL_RESET   _IOW(MSM_GMN_IOCTL_MAGIC, 2, struct msm_gemini_ctrl_cmd *)
 | 
			
		||||
#define MSM_GMN_IOCTL_STOP   _IOW(MSM_GMN_IOCTL_MAGIC, 3, struct msm_gemini_hw_cmds *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GMN_IOCTL_START   _IOW(MSM_GMN_IOCTL_MAGIC, 4, struct msm_gemini_hw_cmds *)
 | 
			
		||||
#define MSM_GMN_IOCTL_INPUT_BUF_ENQUEUE   _IOW(MSM_GMN_IOCTL_MAGIC, 5, struct msm_gemini_buf *)
 | 
			
		||||
#define MSM_GMN_IOCTL_INPUT_GET   _IOW(MSM_GMN_IOCTL_MAGIC, 6, struct msm_gemini_buf *)
 | 
			
		||||
#define MSM_GMN_IOCTL_INPUT_GET_UNBLOCK   _IOW(MSM_GMN_IOCTL_MAGIC, 7, int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GMN_IOCTL_OUTPUT_BUF_ENQUEUE   _IOW(MSM_GMN_IOCTL_MAGIC, 8, struct msm_gemini_buf *)
 | 
			
		||||
#define MSM_GMN_IOCTL_OUTPUT_GET   _IOW(MSM_GMN_IOCTL_MAGIC, 9, struct msm_gemini_buf *)
 | 
			
		||||
#define MSM_GMN_IOCTL_OUTPUT_GET_UNBLOCK   _IOW(MSM_GMN_IOCTL_MAGIC, 10, int)
 | 
			
		||||
#define MSM_GMN_IOCTL_EVT_GET   _IOW(MSM_GMN_IOCTL_MAGIC, 11, struct msm_gemini_ctrl_cmd *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GMN_IOCTL_EVT_GET_UNBLOCK   _IOW(MSM_GMN_IOCTL_MAGIC, 12, int)
 | 
			
		||||
#define MSM_GMN_IOCTL_HW_CMD   _IOW(MSM_GMN_IOCTL_MAGIC, 13, struct msm_gemini_hw_cmd *)
 | 
			
		||||
#define MSM_GMN_IOCTL_HW_CMDS   _IOW(MSM_GMN_IOCTL_MAGIC, 14, struct msm_gemini_hw_cmds *)
 | 
			
		||||
#define MSM_GMN_IOCTL_TEST_DUMP_REGION   _IOW(MSM_GMN_IOCTL_MAGIC, 15, unsigned long)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GEMINI_MODE_REALTIME_ENCODE 0
 | 
			
		||||
#define MSM_GEMINI_MODE_OFFLINE_ENCODE 1
 | 
			
		||||
#define MSM_GEMINI_MODE_REALTIME_ROTATION 2
 | 
			
		||||
#define MSM_GEMINI_MODE_OFFLINE_ROTATION 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_gemini_ctrl_cmd {
 | 
			
		||||
 uint32_t type;
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
 void *value;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define MSM_GEMINI_EVT_RESET 0
 | 
			
		||||
#define MSM_GEMINI_EVT_FRAMEDONE 1
 | 
			
		||||
#define MSM_GEMINI_EVT_ERR 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_gemini_buf {
 | 
			
		||||
 uint32_t type;
 | 
			
		||||
 int fd;
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t y_off;
 | 
			
		||||
 uint32_t y_len;
 | 
			
		||||
 uint32_t framedone_len;
 | 
			
		||||
 uint32_t cbcr_off;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t cbcr_len;
 | 
			
		||||
 uint32_t num_of_mcu_rows;
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_READ 0
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_WRITE 1
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_WRITE_OR 2
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_UWAIT 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_MWAIT 4
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_MDELAY 5
 | 
			
		||||
#define MSM_GEMINI_HW_CMD_TYPE_UDELAY 6
 | 
			
		||||
struct msm_gemini_hw_cmd {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t type:4;
 | 
			
		||||
 uint32_t n:12;
 | 
			
		||||
 uint32_t offset:16;
 | 
			
		||||
 uint32_t mask;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 union {
 | 
			
		||||
 uint32_t data;
 | 
			
		||||
 uint32_t *pdata;
 | 
			
		||||
 };
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_gemini_hw_cmds {
 | 
			
		||||
 uint32_t m;
 | 
			
		||||
 struct msm_gemini_hw_cmd hw_cmd[1];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,61 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_GESTURES_H
 | 
			
		||||
#define __LINUX_MSM_GESTURES_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#include <media/msm_camera.h>
 | 
			
		||||
#define MSM_GES_IOCTL_CTRL_COMMAND   _IOW('V', BASE_VIDIOC_PRIVATE + 20, struct v4l2_control)
 | 
			
		||||
#define VIDIOC_MSM_GESTURE_EVT   _IOWR('V', BASE_VIDIOC_PRIVATE + 21, struct v4l2_event)
 | 
			
		||||
#define MSM_GES_GET_EVT_PAYLOAD   _IOW('V', BASE_VIDIOC_PRIVATE + 22, struct msm_ges_evt)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VIDIOC_MSM_GESTURE_CAM_EVT   _IOWR('V', BASE_VIDIOC_PRIVATE + 23, int)
 | 
			
		||||
#define MSM_GES_RESP_V4L2 MSM_CAM_RESP_MAX
 | 
			
		||||
#define MSM_GES_RESP_MAX (MSM_GES_RESP_V4L2 + 1)
 | 
			
		||||
#define MSM_SVR_RESP_MAX MSM_GES_RESP_MAX
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_V4L2_GES_BASE 100
 | 
			
		||||
#define MSM_V4L2_GES_OPEN (MSM_V4L2_GES_BASE + 0)
 | 
			
		||||
#define MSM_V4L2_GES_CLOSE (MSM_V4L2_GES_BASE + 1)
 | 
			
		||||
#define MSM_V4L2_GES_CAM_OPEN (MSM_V4L2_GES_BASE + 2)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_V4L2_GES_CAM_CLOSE (MSM_V4L2_GES_BASE + 3)
 | 
			
		||||
#define MSM_GES_APP_EVT_MIN (V4L2_EVENT_PRIVATE_START + 0x14)
 | 
			
		||||
#define MSM_GES_APP_NOTIFY_EVENT (MSM_GES_APP_EVT_MIN + 0)
 | 
			
		||||
#define MSM_GES_APP_NOTIFY_ERROR_EVENT (MSM_GES_APP_EVT_MIN + 1)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_GES_APP_EVT_MAX (MSM_GES_APP_EVT_MIN + 2)
 | 
			
		||||
#define MSM_GESTURE_CID_CTRL_CMD V4L2_CID_BRIGHTNESS
 | 
			
		||||
#define MAX_GES_EVENTS 25
 | 
			
		||||
struct msm_ges_ctrl_cmd {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int type;
 | 
			
		||||
 void *value;
 | 
			
		||||
 int len;
 | 
			
		||||
 int fd;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t cookie;
 | 
			
		||||
};
 | 
			
		||||
struct msm_ges_evt {
 | 
			
		||||
 void *evt_data;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int evt_len;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,429 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __MSM_ISP_H__
 | 
			
		||||
#define __MSM_ISP_H__
 | 
			
		||||
#define BIT(nr) (1UL << (nr))
 | 
			
		||||
#define MSG_ID_RESET_ACK 0
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_START_ACK 1
 | 
			
		||||
#define MSG_ID_STOP_ACK 2
 | 
			
		||||
#define MSG_ID_UPDATE_ACK 3
 | 
			
		||||
#define MSG_ID_OUTPUT_P 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_OUTPUT_T 5
 | 
			
		||||
#define MSG_ID_OUTPUT_S 6
 | 
			
		||||
#define MSG_ID_OUTPUT_V 7
 | 
			
		||||
#define MSG_ID_SNAPSHOT_DONE 8
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_STATS_AEC 9
 | 
			
		||||
#define MSG_ID_STATS_AF 10
 | 
			
		||||
#define MSG_ID_STATS_AWB 11
 | 
			
		||||
#define MSG_ID_STATS_RS 12
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_STATS_CS 13
 | 
			
		||||
#define MSG_ID_STATS_IHIST 14
 | 
			
		||||
#define MSG_ID_STATS_SKIN 15
 | 
			
		||||
#define MSG_ID_EPOCH1 16
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_EPOCH2 17
 | 
			
		||||
#define MSG_ID_SYNC_TIMER0_DONE 18
 | 
			
		||||
#define MSG_ID_SYNC_TIMER1_DONE 19
 | 
			
		||||
#define MSG_ID_SYNC_TIMER2_DONE 20
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_ASYNC_TIMER0_DONE 21
 | 
			
		||||
#define MSG_ID_ASYNC_TIMER1_DONE 22
 | 
			
		||||
#define MSG_ID_ASYNC_TIMER2_DONE 23
 | 
			
		||||
#define MSG_ID_ASYNC_TIMER3_DONE 24
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_AE_OVERFLOW 25
 | 
			
		||||
#define MSG_ID_AF_OVERFLOW 26
 | 
			
		||||
#define MSG_ID_AWB_OVERFLOW 27
 | 
			
		||||
#define MSG_ID_RS_OVERFLOW 28
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_CS_OVERFLOW 29
 | 
			
		||||
#define MSG_ID_IHIST_OVERFLOW 30
 | 
			
		||||
#define MSG_ID_SKIN_OVERFLOW 31
 | 
			
		||||
#define MSG_ID_AXI_ERROR 32
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_CAMIF_OVERFLOW 33
 | 
			
		||||
#define MSG_ID_VIOLATION 34
 | 
			
		||||
#define MSG_ID_CAMIF_ERROR 35
 | 
			
		||||
#define MSG_ID_BUS_OVERFLOW 36
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_SOF_ACK 37
 | 
			
		||||
#define MSG_ID_STOP_REC_ACK 38
 | 
			
		||||
#define MSG_ID_STATS_AWB_AEC 39
 | 
			
		||||
#define MSG_ID_OUTPUT_PRIMARY 40
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_OUTPUT_SECONDARY 41
 | 
			
		||||
#define MSG_ID_STATS_COMPOSITE 42
 | 
			
		||||
#define MSG_ID_OUTPUT_TERTIARY1 43
 | 
			
		||||
#define MSG_ID_STOP_LS_ACK 44
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_OUTPUT_TERTIARY2 45
 | 
			
		||||
#define MSG_ID_STATS_BG 46
 | 
			
		||||
#define MSG_ID_STATS_BF 47
 | 
			
		||||
#define MSG_ID_STATS_BHIST 48
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSG_ID_RDI0_UPDATE_ACK 49
 | 
			
		||||
#define MSG_ID_RDI1_UPDATE_ACK 50
 | 
			
		||||
#define MSG_ID_RDI2_UPDATE_ACK 51
 | 
			
		||||
#define VFE_CMD_DUMMY_0 0
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_SET_CLK 1
 | 
			
		||||
#define VFE_CMD_RESET 2
 | 
			
		||||
#define VFE_CMD_START 3
 | 
			
		||||
#define VFE_CMD_TEST_GEN_START 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_OPERATION_CFG 5
 | 
			
		||||
#define VFE_CMD_AXI_OUT_CFG 6
 | 
			
		||||
#define VFE_CMD_CAMIF_CFG 7
 | 
			
		||||
#define VFE_CMD_AXI_INPUT_CFG 8
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_BLACK_LEVEL_CFG 9
 | 
			
		||||
#define VFE_CMD_MESH_ROLL_OFF_CFG 10
 | 
			
		||||
#define VFE_CMD_DEMUX_CFG 11
 | 
			
		||||
#define VFE_CMD_FOV_CFG 12
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_MAIN_SCALER_CFG 13
 | 
			
		||||
#define VFE_CMD_WB_CFG 14
 | 
			
		||||
#define VFE_CMD_COLOR_COR_CFG 15
 | 
			
		||||
#define VFE_CMD_RGB_G_CFG 16
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_LA_CFG 17
 | 
			
		||||
#define VFE_CMD_CHROMA_EN_CFG 18
 | 
			
		||||
#define VFE_CMD_CHROMA_SUP_CFG 19
 | 
			
		||||
#define VFE_CMD_MCE_CFG 20
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_SK_ENHAN_CFG 21
 | 
			
		||||
#define VFE_CMD_ASF_CFG 22
 | 
			
		||||
#define VFE_CMD_S2Y_CFG 23
 | 
			
		||||
#define VFE_CMD_S2CbCr_CFG 24
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_CHROMA_SUBS_CFG 25
 | 
			
		||||
#define VFE_CMD_OUT_CLAMP_CFG 26
 | 
			
		||||
#define VFE_CMD_FRAME_SKIP_CFG 27
 | 
			
		||||
#define VFE_CMD_DUMMY_1 28
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DUMMY_2 29
 | 
			
		||||
#define VFE_CMD_DUMMY_3 30
 | 
			
		||||
#define VFE_CMD_UPDATE 31
 | 
			
		||||
#define VFE_CMD_BL_LVL_UPDATE 32
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DEMUX_UPDATE 33
 | 
			
		||||
#define VFE_CMD_FOV_UPDATE 34
 | 
			
		||||
#define VFE_CMD_MAIN_SCALER_UPDATE 35
 | 
			
		||||
#define VFE_CMD_WB_UPDATE 36
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_COLOR_COR_UPDATE 37
 | 
			
		||||
#define VFE_CMD_RGB_G_UPDATE 38
 | 
			
		||||
#define VFE_CMD_LA_UPDATE 39
 | 
			
		||||
#define VFE_CMD_CHROMA_EN_UPDATE 40
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_CHROMA_SUP_UPDATE 41
 | 
			
		||||
#define VFE_CMD_MCE_UPDATE 42
 | 
			
		||||
#define VFE_CMD_SK_ENHAN_UPDATE 43
 | 
			
		||||
#define VFE_CMD_S2CbCr_UPDATE 44
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_S2Y_UPDATE 45
 | 
			
		||||
#define VFE_CMD_ASF_UPDATE 46
 | 
			
		||||
#define VFE_CMD_FRAME_SKIP_UPDATE 47
 | 
			
		||||
#define VFE_CMD_CAMIF_FRAME_UPDATE 48
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_AF_UPDATE 49
 | 
			
		||||
#define VFE_CMD_STATS_AE_UPDATE 50
 | 
			
		||||
#define VFE_CMD_STATS_AWB_UPDATE 51
 | 
			
		||||
#define VFE_CMD_STATS_RS_UPDATE 52
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_CS_UPDATE 53
 | 
			
		||||
#define VFE_CMD_STATS_SKIN_UPDATE 54
 | 
			
		||||
#define VFE_CMD_STATS_IHIST_UPDATE 55
 | 
			
		||||
#define VFE_CMD_DUMMY_4 56
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_EPOCH1_ACK 57
 | 
			
		||||
#define VFE_CMD_EPOCH2_ACK 58
 | 
			
		||||
#define VFE_CMD_START_RECORDING 59
 | 
			
		||||
#define VFE_CMD_STOP_RECORDING 60
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DUMMY_5 61
 | 
			
		||||
#define VFE_CMD_DUMMY_6 62
 | 
			
		||||
#define VFE_CMD_CAPTURE 63
 | 
			
		||||
#define VFE_CMD_DUMMY_7 64
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STOP 65
 | 
			
		||||
#define VFE_CMD_GET_HW_VERSION 66
 | 
			
		||||
#define VFE_CMD_GET_FRAME_SKIP_COUNTS 67
 | 
			
		||||
#define VFE_CMD_OUTPUT1_BUFFER_ENQ 68
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_OUTPUT2_BUFFER_ENQ 69
 | 
			
		||||
#define VFE_CMD_OUTPUT3_BUFFER_ENQ 70
 | 
			
		||||
#define VFE_CMD_JPEG_OUT_BUF_ENQ 71
 | 
			
		||||
#define VFE_CMD_RAW_OUT_BUF_ENQ 72
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_RAW_IN_BUF_ENQ 73
 | 
			
		||||
#define VFE_CMD_STATS_AF_ENQ 74
 | 
			
		||||
#define VFE_CMD_STATS_AE_ENQ 75
 | 
			
		||||
#define VFE_CMD_STATS_AWB_ENQ 76
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_RS_ENQ 77
 | 
			
		||||
#define VFE_CMD_STATS_CS_ENQ 78
 | 
			
		||||
#define VFE_CMD_STATS_SKIN_ENQ 79
 | 
			
		||||
#define VFE_CMD_STATS_IHIST_ENQ 80
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DUMMY_8 81
 | 
			
		||||
#define VFE_CMD_JPEG_ENC_CFG 82
 | 
			
		||||
#define VFE_CMD_DUMMY_9 83
 | 
			
		||||
#define VFE_CMD_STATS_AF_START 84
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_AF_STOP 85
 | 
			
		||||
#define VFE_CMD_STATS_AE_START 86
 | 
			
		||||
#define VFE_CMD_STATS_AE_STOP 87
 | 
			
		||||
#define VFE_CMD_STATS_AWB_START 88
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_AWB_STOP 89
 | 
			
		||||
#define VFE_CMD_STATS_RS_START 90
 | 
			
		||||
#define VFE_CMD_STATS_RS_STOP 91
 | 
			
		||||
#define VFE_CMD_STATS_CS_START 92
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_CS_STOP 93
 | 
			
		||||
#define VFE_CMD_STATS_SKIN_START 94
 | 
			
		||||
#define VFE_CMD_STATS_SKIN_STOP 95
 | 
			
		||||
#define VFE_CMD_STATS_IHIST_START 96
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_IHIST_STOP 97
 | 
			
		||||
#define VFE_CMD_DUMMY_10 98
 | 
			
		||||
#define VFE_CMD_SYNC_TIMER_SETTING 99
 | 
			
		||||
#define VFE_CMD_ASYNC_TIMER_SETTING 100
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_LIVESHOT 101
 | 
			
		||||
#define VFE_CMD_LA_SETUP 102
 | 
			
		||||
#define VFE_CMD_LINEARIZATION_CFG 103
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3 104
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_ABCC_CFG 105
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_DBCC_CFG 106
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_DBPC_CFG 107
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_ABF_CFG 108
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_ABCC_UPDATE 109
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_DBCC_UPDATE 110
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_DBPC_UPDATE 111
 | 
			
		||||
#define VFE_CMD_XBAR_CFG 112
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_MODULE_CFG 113
 | 
			
		||||
#define VFE_CMD_ZSL 114
 | 
			
		||||
#define VFE_CMD_LINEARIZATION_UPDATE 115
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_ABF_UPDATE 116
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_CLF_CFG 117
 | 
			
		||||
#define VFE_CMD_CLF_LUMA_UPDATE 118
 | 
			
		||||
#define VFE_CMD_CLF_CHROMA_UPDATE 119
 | 
			
		||||
#define VFE_CMD_PCA_ROLL_OFF_CFG 120
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_PCA_ROLL_OFF_UPDATE 121
 | 
			
		||||
#define VFE_CMD_GET_REG_DUMP 122
 | 
			
		||||
#define VFE_CMD_GET_LINEARIZATON_TABLE 123
 | 
			
		||||
#define VFE_CMD_GET_MESH_ROLLOFF_TABLE 124
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_GET_PCA_ROLLOFF_TABLE 125
 | 
			
		||||
#define VFE_CMD_GET_RGB_G_TABLE 126
 | 
			
		||||
#define VFE_CMD_GET_LA_TABLE 127
 | 
			
		||||
#define VFE_CMD_DEMOSAICV3_UPDATE 128
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_ACTIVE_REGION_CFG 129
 | 
			
		||||
#define VFE_CMD_COLOR_PROCESSING_CONFIG 130
 | 
			
		||||
#define VFE_CMD_STATS_WB_AEC_CONFIG 131
 | 
			
		||||
#define VFE_CMD_STATS_WB_AEC_UPDATE 132
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_Y_GAMMA_CONFIG 133
 | 
			
		||||
#define VFE_CMD_SCALE_OUTPUT1_CONFIG 134
 | 
			
		||||
#define VFE_CMD_SCALE_OUTPUT2_CONFIG 135
 | 
			
		||||
#define VFE_CMD_CAPTURE_RAW 136
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STOP_LIVESHOT 137
 | 
			
		||||
#define VFE_CMD_RECONFIG_VFE 138
 | 
			
		||||
#define VFE_CMD_STATS_REQBUF 139
 | 
			
		||||
#define VFE_CMD_STATS_ENQUEUEBUF 140
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_FLUSH_BUFQ 141
 | 
			
		||||
#define VFE_CMD_STATS_UNREGBUF 142
 | 
			
		||||
#define VFE_CMD_STATS_BG_START 143
 | 
			
		||||
#define VFE_CMD_STATS_BG_STOP 144
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_STATS_BF_START 145
 | 
			
		||||
#define VFE_CMD_STATS_BF_STOP 146
 | 
			
		||||
#define VFE_CMD_STATS_BHIST_START 147
 | 
			
		||||
#define VFE_CMD_STATS_BHIST_STOP 148
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_RESET_2 149
 | 
			
		||||
#define VFE_CMD_FOV_ENC_CFG 150
 | 
			
		||||
#define VFE_CMD_FOV_VIEW_CFG 151
 | 
			
		||||
#define VFE_CMD_FOV_ENC_UPDATE 152
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_FOV_VIEW_UPDATE 153
 | 
			
		||||
#define VFE_CMD_SCALER_ENC_CFG 154
 | 
			
		||||
#define VFE_CMD_SCALER_VIEW_CFG 155
 | 
			
		||||
#define VFE_CMD_SCALER_ENC_UPDATE 156
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_SCALER_VIEW_UPDATE 157
 | 
			
		||||
#define VFE_CMD_COLORXFORM_ENC_CFG 158
 | 
			
		||||
#define VFE_CMD_COLORXFORM_VIEW_CFG 159
 | 
			
		||||
#define VFE_CMD_COLORXFORM_ENC_UPDATE 160
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_CMD_COLORXFORM_VIEW_UPDATE 161
 | 
			
		||||
#define VFE_CMD_TEST_GEN_CFG 162
 | 
			
		||||
struct msm_isp_cmd {
 | 
			
		||||
 int32_t id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint16_t length;
 | 
			
		||||
 void *value;
 | 
			
		||||
};
 | 
			
		||||
#define VPE_CMD_DUMMY_0 0
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VPE_CMD_INIT 1
 | 
			
		||||
#define VPE_CMD_DEINIT 2
 | 
			
		||||
#define VPE_CMD_ENABLE 3
 | 
			
		||||
#define VPE_CMD_DISABLE 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VPE_CMD_RESET 5
 | 
			
		||||
#define VPE_CMD_FLUSH 6
 | 
			
		||||
#define VPE_CMD_OPERATION_MODE_CFG 7
 | 
			
		||||
#define VPE_CMD_INPUT_PLANE_CFG 8
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VPE_CMD_OUTPUT_PLANE_CFG 9
 | 
			
		||||
#define VPE_CMD_INPUT_PLANE_UPDATE 10
 | 
			
		||||
#define VPE_CMD_SCALE_CFG_TYPE 11
 | 
			
		||||
#define VPE_CMD_ZOOM 13
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VPE_CMD_MAX 14
 | 
			
		||||
#define MSM_PP_CMD_TYPE_NOT_USED 0
 | 
			
		||||
#define MSM_PP_CMD_TYPE_VPE 1
 | 
			
		||||
#define MSM_PP_CMD_TYPE_MCTL 2
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MCTL_CMD_DUMMY_0 0
 | 
			
		||||
#define MCTL_CMD_GET_FRAME_BUFFER 1
 | 
			
		||||
#define MCTL_CMD_PUT_FRAME_BUFFER 2
 | 
			
		||||
#define MCTL_CMD_DIVERT_FRAME_PP_PATH 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MCTL_PP_EVENT_NOTUSED 0
 | 
			
		||||
#define MCTL_PP_EVENT_CMD_ACK 1
 | 
			
		||||
#define VPE_OPERATION_MODE_CFG_LEN 4
 | 
			
		||||
#define VPE_INPUT_PLANE_CFG_LEN 24
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VPE_OUTPUT_PLANE_CFG_LEN 20
 | 
			
		||||
#define VPE_INPUT_PLANE_UPDATE_LEN 12
 | 
			
		||||
#define VPE_SCALER_CONFIG_LEN 260
 | 
			
		||||
#define VPE_DIS_OFFSET_CFG_LEN 12
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define CAPTURE_WIDTH 1280
 | 
			
		||||
#define IMEM_Y_SIZE (CAPTURE_WIDTH*16)
 | 
			
		||||
#define IMEM_CBCR_SIZE (CAPTURE_WIDTH*8)
 | 
			
		||||
#define IMEM_Y_PING_OFFSET 0x2E000000
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define IMEM_CBCR_PING_OFFSET (IMEM_Y_PING_OFFSET + IMEM_Y_SIZE)
 | 
			
		||||
#define IMEM_Y_PONG_OFFSET (IMEM_CBCR_PING_OFFSET + IMEM_CBCR_SIZE)
 | 
			
		||||
#define IMEM_CBCR_PONG_OFFSET (IMEM_Y_PONG_OFFSET + IMEM_Y_SIZE)
 | 
			
		||||
struct msm_vpe_op_mode_cfg {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint8_t op_mode_cfg[VPE_OPERATION_MODE_CFG_LEN];
 | 
			
		||||
};
 | 
			
		||||
struct msm_vpe_input_plane_cfg {
 | 
			
		||||
 uint8_t input_plane_cfg[VPE_INPUT_PLANE_CFG_LEN];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct msm_vpe_output_plane_cfg {
 | 
			
		||||
 uint8_t output_plane_cfg[VPE_OUTPUT_PLANE_CFG_LEN];
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_vpe_input_plane_update_cfg {
 | 
			
		||||
 uint8_t input_plane_update_cfg[VPE_INPUT_PLANE_UPDATE_LEN];
 | 
			
		||||
};
 | 
			
		||||
struct msm_vpe_scaler_cfg {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint8_t scaler_cfg[VPE_SCALER_CONFIG_LEN];
 | 
			
		||||
};
 | 
			
		||||
struct msm_vpe_flush_frame_buffer {
 | 
			
		||||
 uint32_t src_buf_handle;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t dest_buf_handle;
 | 
			
		||||
 int path;
 | 
			
		||||
};
 | 
			
		||||
struct msm_mctl_pp_frame_buffer {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t buf_handle;
 | 
			
		||||
 int path;
 | 
			
		||||
};
 | 
			
		||||
struct msm_mctl_pp_divert_pp {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 int path;
 | 
			
		||||
 int enable;
 | 
			
		||||
};
 | 
			
		||||
struct msm_vpe_clock_rate {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t rate;
 | 
			
		||||
};
 | 
			
		||||
struct msm_pp_crop {
 | 
			
		||||
 uint32_t src_x;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t src_y;
 | 
			
		||||
 uint32_t src_w;
 | 
			
		||||
 uint32_t src_h;
 | 
			
		||||
 uint32_t dst_x;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t dst_y;
 | 
			
		||||
 uint32_t dst_w;
 | 
			
		||||
 uint32_t dst_h;
 | 
			
		||||
 uint8_t update_flag;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#define MSM_MCTL_PP_VPE_FRAME_ACK (1<<0)
 | 
			
		||||
#define MSM_MCTL_PP_VPE_FRAME_TO_APP (1<<1)
 | 
			
		||||
struct msm_mctl_pp_frame_cmd {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t cookie;
 | 
			
		||||
 uint8_t vpe_output_action;
 | 
			
		||||
 uint32_t src_buf_handle;
 | 
			
		||||
 uint32_t dest_buf_handle;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msm_pp_crop crop;
 | 
			
		||||
 int path;
 | 
			
		||||
};
 | 
			
		||||
#define VFE_OUTPUTS_MAIN_AND_PREVIEW BIT(0)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_OUTPUTS_MAIN_AND_VIDEO BIT(1)
 | 
			
		||||
#define VFE_OUTPUTS_MAIN_AND_THUMB BIT(2)
 | 
			
		||||
#define VFE_OUTPUTS_THUMB_AND_MAIN BIT(3)
 | 
			
		||||
#define VFE_OUTPUTS_PREVIEW_AND_VIDEO BIT(4)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_OUTPUTS_VIDEO_AND_PREVIEW BIT(5)
 | 
			
		||||
#define VFE_OUTPUTS_PREVIEW BIT(6)
 | 
			
		||||
#define VFE_OUTPUTS_VIDEO BIT(7)
 | 
			
		||||
#define VFE_OUTPUTS_RAW BIT(8)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define VFE_OUTPUTS_JPEG_AND_THUMB BIT(9)
 | 
			
		||||
#define VFE_OUTPUTS_THUMB_AND_JPEG BIT(10)
 | 
			
		||||
#define VFE_OUTPUTS_RDI0 BIT(11)
 | 
			
		||||
#define VFE_OUTPUTS_RDI1 BIT(12)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_frame_info {
 | 
			
		||||
 uint32_t inst_handle;
 | 
			
		||||
 uint32_t path;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1,106 +0,0 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __LINUX_MSM_MERCURY_H
 | 
			
		||||
#define __LINUX_MSM_MERCURY_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MERCURY_HW_VERSION_REG 0x0004
 | 
			
		||||
#define OUTPUT_H2V1 0
 | 
			
		||||
#define OUTPUT_H2V2 1
 | 
			
		||||
#define OUTPUT_BYTE 6
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MERCURY_MODE_REALTIME_ENCODE 0
 | 
			
		||||
#define MSM_MERCURY_MODE_OFFLINE_ENCODE 1
 | 
			
		||||
#define MSM_MERCURY_MODE_REALTIME_ROTATION 2
 | 
			
		||||
#define MSM_MERCURY_MODE_OFFLINE_ROTATION 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MERCURY_EVT_RESET 1
 | 
			
		||||
#define MSM_MERCURY_EVT_FRAMEDONE 2
 | 
			
		||||
#define MSM_MERCURY_EVT_ERR 3
 | 
			
		||||
#define MSM_MERCURY_EVT_UNBLOCK 4
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_READ 0
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_WRITE 1
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_WRITE_OR 2
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_UWAIT 3
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_MWAIT 4
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_MDELAY 5
 | 
			
		||||
#define MSM_MERCURY_HW_CMD_TYPE_UDELAY 6
 | 
			
		||||
#define MSM_MCR_IOCTL_MAGIC 'g'
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MCR_IOCTL_GET_HW_VERSION   _IOW(MSM_MCR_IOCTL_MAGIC, 1, struct msm_mercury_hw_cmd *)
 | 
			
		||||
#define MSM_MCR_IOCTL_RESET   _IOW(MSM_MCR_IOCTL_MAGIC, 2, struct msm_mercury_ctrl_cmd *)
 | 
			
		||||
#define MSM_MCR_IOCTL_STOP   _IOW(MSM_MCR_IOCTL_MAGIC, 3, struct msm_mercury_hw_cmds *)
 | 
			
		||||
#define MSM_MCR_IOCTL_START   _IOW(MSM_MCR_IOCTL_MAGIC, 4, struct msm_mercury_hw_cmds *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MCR_IOCTL_INPUT_BUF_CFG   _IOW(MSM_MCR_IOCTL_MAGIC, 5, struct msm_mercury_buf *)
 | 
			
		||||
#define MSM_MCR_IOCTL_INPUT_GET   _IOW(MSM_MCR_IOCTL_MAGIC, 6, struct msm_mercury_buf *)
 | 
			
		||||
#define MSM_MCR_IOCTL_INPUT_GET_UNBLOCK   _IOW(MSM_MCR_IOCTL_MAGIC, 7, int)
 | 
			
		||||
#define MSM_MCR_IOCTL_OUTPUT_BUF_CFG   _IOW(MSM_MCR_IOCTL_MAGIC, 8, struct msm_mercury_buf *)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MCR_IOCTL_OUTPUT_GET   _IOW(MSM_MCR_IOCTL_MAGIC, 9, struct msm_mercury_buf *)
 | 
			
		||||
#define MSM_MCR_IOCTL_OUTPUT_GET_UNBLOCK   _IOW(MSM_MCR_IOCTL_MAGIC, 10, int)
 | 
			
		||||
#define MSM_MCR_IOCTL_EVT_GET   _IOW(MSM_MCR_IOCTL_MAGIC, 11, struct msm_mercury_ctrl_cmd *)
 | 
			
		||||
#define MSM_MCR_IOCTL_EVT_GET_UNBLOCK   _IOW(MSM_MCR_IOCTL_MAGIC, 12, int)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MSM_MCR_IOCTL_HW_CMD   _IOW(MSM_MCR_IOCTL_MAGIC, 13, struct msm_mercury_hw_cmd *)
 | 
			
		||||
#define MSM_MCR_IOCTL_HW_CMDS   _IOW(MSM_MCR_IOCTL_MAGIC, 14, struct msm_mercury_hw_cmds *)
 | 
			
		||||
#define MSM_MCR_IOCTL_TEST_DUMP_REGION   _IOW(MSM_MCR_IOCTL_MAGIC, 15, unsigned long)
 | 
			
		||||
struct msm_mercury_ctrl_cmd {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t type;
 | 
			
		||||
 uint32_t len;
 | 
			
		||||
 void *value;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_mercury_buf {
 | 
			
		||||
 uint32_t type;
 | 
			
		||||
 int fd;
 | 
			
		||||
 void *vaddr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t y_off;
 | 
			
		||||
 uint32_t y_len;
 | 
			
		||||
 uint32_t framedone_len;
 | 
			
		||||
 uint32_t cbcr_off;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t cbcr_len;
 | 
			
		||||
 uint32_t num_of_mcu_rows;
 | 
			
		||||
 uint32_t offset;
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct msm_mercury_hw_cmd {
 | 
			
		||||
 uint32_t type:4;
 | 
			
		||||
 uint32_t n:12;
 | 
			
		||||
 uint32_t offset:16;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t mask;
 | 
			
		||||
 union {
 | 
			
		||||
 uint32_t data;
 | 
			
		||||
 uint32_t *pdata;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 };
 | 
			
		||||
};
 | 
			
		||||
struct msm_mercury_hw_cmds {
 | 
			
		||||
 uint32_t m;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct msm_mercury_hw_cmd hw_cmd[1];
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										115
									
								
								libc/kernel/common/sound/compress_offload.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								libc/kernel/common/sound/compress_offload.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,115 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __COMPRESS_OFFLOAD_H
 | 
			
		||||
#define __COMPRESS_OFFLOAD_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#include <sound/asound.h>
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#include <sound/compress_params.h>
 | 
			
		||||
#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 1)
 | 
			
		||||
struct snd_compressed_buffer {
 | 
			
		||||
 __u32 fragment_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 fragments;
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_params {
 | 
			
		||||
 struct snd_compressed_buffer buffer;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct snd_codec codec;
 | 
			
		||||
 __u8 no_wake_mode;
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_tstamp {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 byte_offset;
 | 
			
		||||
 __u32 copied_total;
 | 
			
		||||
 snd_pcm_uframes_t pcm_frames;
 | 
			
		||||
 snd_pcm_uframes_t pcm_io_frames;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 sampling_rate;
 | 
			
		||||
 uint64_t timestamp;
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_avail {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u64 avail;
 | 
			
		||||
 struct snd_compr_tstamp tstamp;
 | 
			
		||||
};
 | 
			
		||||
enum snd_compr_direction {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 SND_COMPRESS_PLAYBACK = 0,
 | 
			
		||||
 SND_COMPRESS_CAPTURE
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_caps {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 num_codecs;
 | 
			
		||||
 __u32 direction;
 | 
			
		||||
 __u32 min_fragment_size;
 | 
			
		||||
 __u32 max_fragment_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 min_fragments;
 | 
			
		||||
 __u32 max_fragments;
 | 
			
		||||
 __u32 codecs[MAX_NUM_CODECS];
 | 
			
		||||
 __u32 reserved[11];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_codec_caps {
 | 
			
		||||
 __u32 codec;
 | 
			
		||||
 __u32 num_descriptors;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS];
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
 SNDRV_COMPRESS_ENCODER_PADDING = 1,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 SNDRV_COMPRESS_ENCODER_DELAY = 2,
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_metadata {
 | 
			
		||||
 __u32 key;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 value[8];
 | 
			
		||||
};
 | 
			
		||||
struct snd_compr_audio_info {
 | 
			
		||||
 uint32_t frame_size;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 uint32_t reserved[15];
 | 
			
		||||
};
 | 
			
		||||
#define SNDRV_COMPRESS_IOCTL_VERSION _IOR('C', 0x00, int)
 | 
			
		||||
#define SNDRV_COMPRESS_GET_CAPS _IOWR('C', 0x10, struct snd_compr_caps)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SNDRV_COMPRESS_GET_CODEC_CAPS _IOWR('C', 0x11,  struct snd_compr_codec_caps)
 | 
			
		||||
#define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params)
 | 
			
		||||
#define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec)
 | 
			
		||||
#define SNDRV_COMPRESS_SET_METADATA _IOW('C', 0x14,  struct snd_compr_metadata)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SNDRV_COMPRESS_GET_METADATA _IOWR('C', 0x15,  struct snd_compr_metadata)
 | 
			
		||||
#define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp)
 | 
			
		||||
#define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail)
 | 
			
		||||
#define SNDRV_COMPRESS_PAUSE _IO('C', 0x30)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SNDRV_COMPRESS_RESUME _IO('C', 0x31)
 | 
			
		||||
#define SNDRV_COMPRESS_START _IO('C', 0x32)
 | 
			
		||||
#define SNDRV_COMPRESS_STOP _IO('C', 0x33)
 | 
			
		||||
#define SNDRV_COMPRESS_DRAIN _IO('C', 0x34)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SNDRV_COMPRESS_NEXT_TRACK _IO('C', 0x35)
 | 
			
		||||
#define SNDRV_COMPRESS_PARTIAL_DRAIN _IO('C', 0x36)
 | 
			
		||||
#define SND_COMPR_TRIGGER_DRAIN 7
 | 
			
		||||
#define SND_COMPR_TRIGGER_NEXT_TRACK 8
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_COMPR_TRIGGER_PARTIAL_DRAIN 9
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										265
									
								
								libc/kernel/common/sound/compress_params.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										265
									
								
								libc/kernel/common/sound/compress_params.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,265 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ***
 | 
			
		||||
 ***   This header was automatically generated from a Linux kernel header
 | 
			
		||||
 ***   of the same name, to make information necessary for userspace to
 | 
			
		||||
 ***   call into the kernel available to libc.  It contains only constants,
 | 
			
		||||
 ***   structures, and macros generated from the original header, and thus,
 | 
			
		||||
 ***   contains no copyrightable information.
 | 
			
		||||
 ***
 | 
			
		||||
 ***   To edit the content of this header, modify the corresponding
 | 
			
		||||
 ***   source file (e.g. under external/kernel-headers/original/) then
 | 
			
		||||
 ***   run bionic/libc/kernel/tools/update_all.py
 | 
			
		||||
 ***
 | 
			
		||||
 ***   Any manual change here will be lost the next time this script will
 | 
			
		||||
 ***   be run. You've been warned!
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef __SND_COMPRESS_PARAMS_H
 | 
			
		||||
#define __SND_COMPRESS_PARAMS_H
 | 
			
		||||
#define MAX_NUM_CODECS 32
 | 
			
		||||
#define MAX_NUM_CODEC_DESCRIPTORS 32
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define MAX_NUM_BITRATES 32
 | 
			
		||||
#define MAX_NUM_FRAMES_PER_BUFFER 1
 | 
			
		||||
#define COMPRESSED_META_DATA_MODE 0x10
 | 
			
		||||
#define META_DATA_LEN_BYTES 36
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define Q6_AC3_DECODER 0x00010BF6
 | 
			
		||||
#define Q6_EAC3_DECODER 0x00010C3C
 | 
			
		||||
#define Q6_DTS 0x00010D88
 | 
			
		||||
#define Q6_DTS_LBR 0x00010DBB
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_PCM ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOCODEC_AMR ((__u32) 0x00000003)
 | 
			
		||||
#define SND_AUDIOCODEC_AMRWB ((__u32) 0x00000004)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_AMRWBPLUS ((__u32) 0x00000005)
 | 
			
		||||
#define SND_AUDIOCODEC_AAC ((__u32) 0x00000006)
 | 
			
		||||
#define SND_AUDIOCODEC_WMA ((__u32) 0x00000007)
 | 
			
		||||
#define SND_AUDIOCODEC_REAL ((__u32) 0x00000008)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_VORBIS ((__u32) 0x00000009)
 | 
			
		||||
#define SND_AUDIOCODEC_FLAC ((__u32) 0x0000000A)
 | 
			
		||||
#define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B)
 | 
			
		||||
#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D)
 | 
			
		||||
#define SND_AUDIOCODEC_AC3 ((__u32) 0x0000000E)
 | 
			
		||||
#define SND_AUDIOCODEC_DTS ((__u32) 0x0000000F)
 | 
			
		||||
#define SND_AUDIOCODEC_AC3_PASS_THROUGH ((__u32) 0x00000010)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_WMA_PRO ((__u32) 0x00000011)
 | 
			
		||||
#define SND_AUDIOCODEC_DTS_PASS_THROUGH ((__u32) 0x00000012)
 | 
			
		||||
#define SND_AUDIOCODEC_DTS_LBR ((__u32) 0x00000013)
 | 
			
		||||
#define SND_AUDIOCODEC_DTS_TRANSCODE_LOOPBACK ((__u32) 0x00000014)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_DTS_TRANSCODE_LOOPBACK
 | 
			
		||||
#define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOCHANMODE_MP3_DUAL ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOPROFILE_AMR ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_AMR_DTX_OFF ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_AMR_VAD1 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_AMR_VAD2 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_UNDEFINED ((__u32) 0x00000000)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_IF1 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_IF2 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_FSF ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((__u32) 0x00000010)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_ITU ((__u32) 0x00000020)
 | 
			
		||||
#define SND_AUDIOPROFILE_AMRWB ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_AMRWB_DTX_OFF ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_AMRWB_VAD1 ((__u32) 0x00000002)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_AMRWB_VAD2 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOPROFILE_AMRWBPLUS ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOPROFILE_AAC ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_MAIN ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_AAC_LC ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_SSR ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_LTP ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_HE ((__u32) 0x00000010)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_AAC_SCALABLE ((__u32) 0x00000020)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_ERLC ((__u32) 0x00000040)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_LD ((__u32) 0x00000080)
 | 
			
		||||
#define SND_AUDIOMODE_AAC_HE_PS ((__u32) 0x00000100)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_AAC_HE_MPS ((__u32) 0x00000200)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_MP2ADTS ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_MP4ADTS ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_MP4LOAS ((__u32) 0x00000004)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_MP4LATM ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_ADIF ((__u32) 0x00000010)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_MP4FF ((__u32) 0x00000020)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_RAW ((__u32) 0x00000040)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOPROFILE_WMA7 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOMODE_WMA_LEVEL4 ((__u32) 0x00000008)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_WMAPRO_LEVELM0 ((__u32) 0x00000010)
 | 
			
		||||
#define SND_AUDIOMODE_WMAPRO_LEVELM1 ((__u32) 0x00000020)
 | 
			
		||||
#define SND_AUDIOMODE_WMAPRO_LEVELM2 ((__u32) 0x00000040)
 | 
			
		||||
#define SND_AUDIOMODE_WMAPRO_LEVELM3 ((__u32) 0x00000080)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_WMA_ASF ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOPROFILE_REALAUDIO ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_REALAUDIO_G2 ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_REALAUDIO_8 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_REALAUDIO_10 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOMODE_REALAUDIO_SURROUND ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOPROFILE_VORBIS ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_VORBIS ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOPROFILE_FLAC ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL0 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL1 ((__u32) 0x00000002)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL2 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL3 ((__u32) 0x00000008)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL4 ((__u32) 0x00000010)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL5 ((__u32) 0x00000020)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL6 ((__u32) 0x00000040)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL7 ((__u32) 0x00000080)
 | 
			
		||||
#define SND_AUDIOMODE_FLAC_LEVEL8 ((__u32) 0x00000100)
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_FLAC ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOPROFILE_IEC61937 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOPROFILE_IEC61937_SPDIF ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_REF_STREAM_HEADER ((__u32) 0x00000000)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_IEC_LPCM ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_AC3 ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_MPEG1 ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_MP3 ((__u32) 0x00000008)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_IEC_MPEG2 ((__u32) 0x00000010)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_AACLC ((__u32) 0x00000020)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_DTS ((__u32) 0x00000040)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_ATRAC ((__u32) 0x00000080)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_IEC_SACD ((__u32) 0x00000100)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_EAC3 ((__u32) 0x00000200)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_DTS_HD ((__u32) 0x00000400)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_MLP ((__u32) 0x00000800)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_IEC_DST ((__u32) 0x00001000)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_WMAPRO ((__u32) 0x00002000)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_REF_CXT ((__u32) 0x00004000)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_HE_AAC ((__u32) 0x00008000)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_IEC_HE_AAC2 ((__u32) 0x00010000)
 | 
			
		||||
#define SND_AUDIOMODE_IEC_MPEG_SURROUND ((__u32) 0x00020000)
 | 
			
		||||
#define SND_AUDIOPROFILE_G723_1 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_G723_1_ANNEX_A ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_G723_1_ANNEX_B ((__u32) 0x00000002)
 | 
			
		||||
#define SND_AUDIOMODE_G723_1_ANNEX_C ((__u32) 0x00000004)
 | 
			
		||||
#define SND_AUDIOPROFILE_G729 ((__u32) 0x00000001)
 | 
			
		||||
#define SND_AUDIOMODE_G729_ANNEX_A ((__u32) 0x00000001)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define SND_AUDIOMODE_G729_ANNEX_B ((__u32) 0x00000002)
 | 
			
		||||
#define SND_RATECONTROLMODE_CONSTANTBITRATE ((__u32) 0x00000001)
 | 
			
		||||
#define SND_RATECONTROLMODE_VARIABLEBITRATE ((__u32) 0x00000002)
 | 
			
		||||
struct snd_enc_wma {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 super_block_align;
 | 
			
		||||
 __u32 bits_per_sample;
 | 
			
		||||
 __u32 channelmask;
 | 
			
		||||
 __u32 encodeopt;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 encodeopt1;
 | 
			
		||||
 __u32 encodeopt2;
 | 
			
		||||
};
 | 
			
		||||
struct snd_enc_vorbis {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __s32 quality;
 | 
			
		||||
 __u32 managed;
 | 
			
		||||
 __u32 max_bit_rate;
 | 
			
		||||
 __u32 min_bit_rate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 downmix;
 | 
			
		||||
};
 | 
			
		||||
struct snd_enc_real {
 | 
			
		||||
 __u32 quant_bits;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 start_region;
 | 
			
		||||
 __u32 num_regions;
 | 
			
		||||
};
 | 
			
		||||
struct snd_enc_flac {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 num;
 | 
			
		||||
 __u32 gain;
 | 
			
		||||
};
 | 
			
		||||
struct snd_enc_generic {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 bw;
 | 
			
		||||
 __s32 reserved[15];
 | 
			
		||||
};
 | 
			
		||||
union snd_codec_options {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct snd_enc_wma wma;
 | 
			
		||||
 struct snd_enc_vorbis vorbis;
 | 
			
		||||
 struct snd_enc_real real;
 | 
			
		||||
 struct snd_enc_flac flac;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct snd_enc_generic generic;
 | 
			
		||||
};
 | 
			
		||||
struct snd_codec_desc {
 | 
			
		||||
 __u32 max_ch;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 sample_rates;
 | 
			
		||||
 __u32 bit_rate[MAX_NUM_BITRATES];
 | 
			
		||||
 __u32 num_bitrates;
 | 
			
		||||
 __u32 rate_control;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 profiles;
 | 
			
		||||
 __u32 modes;
 | 
			
		||||
 __u32 formats;
 | 
			
		||||
 __u32 min_buffer;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 reserved[15];
 | 
			
		||||
};
 | 
			
		||||
struct snd_codec {
 | 
			
		||||
 __u32 id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 ch_in;
 | 
			
		||||
 __u32 ch_out;
 | 
			
		||||
 __u32 sample_rate;
 | 
			
		||||
 __u32 bit_rate;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 rate_control;
 | 
			
		||||
 __u32 profile;
 | 
			
		||||
 __u32 level;
 | 
			
		||||
 __u32 ch_mode;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 format;
 | 
			
		||||
 __u32 align;
 | 
			
		||||
 union snd_codec_options options;
 | 
			
		||||
 __u32 reserved[3];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
@@ -16,33 +16,34 @@
 | 
			
		||||
 ***
 | 
			
		||||
 ****************************************************************************
 | 
			
		||||
 ****************************************************************************/
 | 
			
		||||
#ifndef _MSM_HW3D_H_
 | 
			
		||||
#define _MSM_HW3D_H_
 | 
			
		||||
#include <linux/fs.h>
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
#ifndef _UAPILINUX_KEXEC_H
 | 
			
		||||
#define _UAPILINUX_KEXEC_H
 | 
			
		||||
#include <linux/types.h>
 | 
			
		||||
#define KEXEC_ON_CRASH 0x00000001
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct hw3d_region;
 | 
			
		||||
#define HW3D_IOCTL_MAGIC 'h'
 | 
			
		||||
#define HW3D_WAIT_FOR_REVOKE _IO(HW3D_IOCTL_MAGIC, 0x80)
 | 
			
		||||
#define HW3D_WAIT_FOR_INTERRUPT _IO(HW3D_IOCTL_MAGIC, 0x81)
 | 
			
		||||
#define KEXEC_PRESERVE_CONTEXT 0x00000002
 | 
			
		||||
#define KEXEC_ARCH_MASK 0xffff0000
 | 
			
		||||
#define KEXEC_ARCH_DEFAULT ( 0 << 16)
 | 
			
		||||
#define KEXEC_ARCH_386 ( 3 << 16)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define HW3D_GET_REGIONS   _IOR(HW3D_IOCTL_MAGIC, 0x82, struct hw3d_region *)
 | 
			
		||||
#define HW3D_REGION_OFFSET(id) ((((uint32_t)(id)) & 0xf) << 28)
 | 
			
		||||
#define HW3D_REGION_ID(addr) (((uint32_t)(addr) >> 28) & 0xf)
 | 
			
		||||
#define HW3D_OFFSET_IN_REGION(addr) ((uint32_t)(addr) & ~(0xfUL << 28))
 | 
			
		||||
#define KEXEC_ARCH_X86_64 (62 << 16)
 | 
			
		||||
#define KEXEC_ARCH_PPC (20 << 16)
 | 
			
		||||
#define KEXEC_ARCH_PPC64 (21 << 16)
 | 
			
		||||
#define KEXEC_ARCH_IA_64 (50 << 16)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
enum {
 | 
			
		||||
 HW3D_EBI = 0,
 | 
			
		||||
 HW3D_SMI = 1,
 | 
			
		||||
 HW3D_REGS = 2,
 | 
			
		||||
#define KEXEC_ARCH_ARM (40 << 16)
 | 
			
		||||
#define KEXEC_ARCH_S390 (22 << 16)
 | 
			
		||||
#define KEXEC_ARCH_SH (42 << 16)
 | 
			
		||||
#define KEXEC_ARCH_MIPS_LE (10 << 16)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 HW3D_NUM_REGIONS = HW3D_REGS + 1,
 | 
			
		||||
#define KEXEC_ARCH_MIPS ( 8 << 16)
 | 
			
		||||
#define KEXEC_SEGMENT_MAX 16
 | 
			
		||||
struct kexec_segment {
 | 
			
		||||
 const void *buf;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 size_t bufsz;
 | 
			
		||||
 const void *mem;
 | 
			
		||||
 size_t memsz;
 | 
			
		||||
};
 | 
			
		||||
struct hw3d_region {
 | 
			
		||||
 unsigned long phys;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 unsigned long map_offset;
 | 
			
		||||
 unsigned long len;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
@@ -56,6 +56,7 @@
 | 
			
		||||
 | 
			
		||||
#include <sys/param.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <sys/un.h>
 | 
			
		||||
#include <netinet/in.h>
 | 
			
		||||
#include <arpa/inet.h>
 | 
			
		||||
#include "arpa_nameser.h"
 | 
			
		||||
@@ -69,6 +70,7 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <strings.h>
 | 
			
		||||
#include <syslog.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
#ifndef LOG_AUTH
 | 
			
		||||
# define LOG_AUTH 0
 | 
			
		||||
@@ -80,6 +82,9 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
// This should be synchronized to ResponseCode.h
 | 
			
		||||
static const int DnsProxyQueryResult = 222;
 | 
			
		||||
 | 
			
		||||
static const char const AskedForGot[] =
 | 
			
		||||
			  "gethostby*.getanswer: asked for \"%s\", got \"%s\"";
 | 
			
		||||
 | 
			
		||||
@@ -121,7 +126,7 @@ static struct hostent *_gethtbyname2(const char *, int);
 | 
			
		||||
static int _dns_gethtbyaddr(void *, void *, va_list);
 | 
			
		||||
static int _dns_gethtbyname(void *, void *, va_list);
 | 
			
		||||
 | 
			
		||||
static struct hostent *gethostbyname_internal(const char *, int, res_state);
 | 
			
		||||
static struct hostent *gethostbyname_internal(const char *, int, res_state, const char *, int);
 | 
			
		||||
 | 
			
		||||
static const ns_src default_dns_files[] = {
 | 
			
		||||
	{ NSSRC_FILES, 	NS_SUCCESS },
 | 
			
		||||
@@ -490,40 +495,136 @@ gethostbyname(const char *name)
 | 
			
		||||
 | 
			
		||||
	assert(name != NULL);
 | 
			
		||||
 | 
			
		||||
	/* try IPv6 first - if that fails do IPv4 */
 | 
			
		||||
	if (res->options & RES_USE_INET6) {
 | 
			
		||||
		hp = gethostbyname_internal(name, AF_INET6, res);
 | 
			
		||||
		hp = gethostbyname_internal(name, AF_INET6, res, NULL, 0);
 | 
			
		||||
		if (hp) {
 | 
			
		||||
			__res_put_state(res);
 | 
			
		||||
			return hp;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hp = gethostbyname_internal(name, AF_INET, res);
 | 
			
		||||
	hp = gethostbyname_internal(name, AF_INET, res, NULL, 0);
 | 
			
		||||
	__res_put_state(res);
 | 
			
		||||
	return hp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
gethostbyname2(const char *name, int af)
 | 
			
		||||
{
 | 
			
		||||
	return android_gethostbynameforiface(name, af, NULL, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
android_gethostbynameforiface(const char *name, int af, const char *iface, int mark)
 | 
			
		||||
{
 | 
			
		||||
	struct hostent *hp;
 | 
			
		||||
	res_state res = __res_get_state();
 | 
			
		||||
 | 
			
		||||
	if (res == NULL)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	hp = gethostbyname_internal(name, af, res);
 | 
			
		||||
	hp = gethostbyname_internal(name, af, res, iface, mark);
 | 
			
		||||
	__res_put_state(res);
 | 
			
		||||
	return hp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static FILE* android_open_proxy()
 | 
			
		||||
{
 | 
			
		||||
	int sock;
 | 
			
		||||
	const int one = 1;
 | 
			
		||||
	struct sockaddr_un proxy_addr;
 | 
			
		||||
 | 
			
		||||
	sock = socket(AF_UNIX, SOCK_STREAM, 0);
 | 
			
		||||
	if (sock < 0) {
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
 | 
			
		||||
	memset(&proxy_addr, 0, sizeof(proxy_addr));
 | 
			
		||||
	proxy_addr.sun_family = AF_UNIX;
 | 
			
		||||
	strlcpy(proxy_addr.sun_path, "/dev/socket/dnsproxyd", sizeof(proxy_addr.sun_path));
 | 
			
		||||
	if (TEMP_FAILURE_RETRY(connect(sock,
 | 
			
		||||
			(const struct sockaddr*) &proxy_addr,
 | 
			
		||||
			sizeof(proxy_addr))) != 0) {
 | 
			
		||||
		close(sock);
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return fdopen(sock, "r+");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static struct hostent *
 | 
			
		||||
gethostbyname_internal(const char *name, int af, res_state res)
 | 
			
		||||
android_read_hostent(FILE* proxy)
 | 
			
		||||
{
 | 
			
		||||
	uint32_t size;
 | 
			
		||||
	char buf[4];
 | 
			
		||||
	if (fread(buf, 1, sizeof(buf), proxy) != sizeof(buf)) return NULL;
 | 
			
		||||
 | 
			
		||||
	/* This is reading serialized data from system/netd/DnsProxyListener.cpp
 | 
			
		||||
	 * and changes here need to be matched there */
 | 
			
		||||
	int result_code = strtol(buf, NULL, 10);
 | 
			
		||||
	if (result_code != DnsProxyQueryResult) {
 | 
			
		||||
		fread(&size, 1, sizeof(size), proxy);
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (fread(&size, 1, sizeof(size), proxy) != sizeof(size)) return NULL;
 | 
			
		||||
	size = ntohl(size);
 | 
			
		||||
	res_static rs = __res_get_static();
 | 
			
		||||
	memset(&rs->host, 0, sizeof(rs->host));
 | 
			
		||||
	char *ptr = rs->hostbuf;
 | 
			
		||||
 | 
			
		||||
	if (fread(ptr, 1, size, proxy) != size) return NULL;
 | 
			
		||||
	ptr += size;
 | 
			
		||||
	rs->host.h_name = rs->hostbuf;
 | 
			
		||||
 | 
			
		||||
	char **aliases = rs->host_aliases;
 | 
			
		||||
	rs->host.h_aliases = rs->host_aliases;
 | 
			
		||||
	while (1) {
 | 
			
		||||
		if (fread(&size, 1, sizeof(size), proxy) != sizeof(size)) return NULL;
 | 
			
		||||
		size = ntohl(size);
 | 
			
		||||
 | 
			
		||||
		if (size == 0) {
 | 
			
		||||
			*aliases = NULL;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		if (fread(ptr, 1, size, proxy) != size) return NULL;
 | 
			
		||||
		*aliases++ = ptr;
 | 
			
		||||
		ptr += size;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (fread(&size, 1, sizeof(size), proxy) != sizeof(size)) return NULL;
 | 
			
		||||
	rs->host.h_addrtype = ntohl(size);
 | 
			
		||||
 | 
			
		||||
	if (fread(&size, 1, sizeof(size), proxy) != sizeof(size)) return NULL;
 | 
			
		||||
	rs->host.h_length = ntohl(size);
 | 
			
		||||
 | 
			
		||||
	char **addrs = rs->h_addr_ptrs;
 | 
			
		||||
	rs->host.h_addr_list = rs->h_addr_ptrs;
 | 
			
		||||
	while (1) {
 | 
			
		||||
		if (fread(&size, 1, sizeof(size), proxy) != sizeof(size)) return NULL;
 | 
			
		||||
		size = ntohl(size);
 | 
			
		||||
		if (size == 0) {
 | 
			
		||||
			*addrs = NULL;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		if (fread(ptr, 1, size, proxy) != size) return NULL;
 | 
			
		||||
		*addrs++ = ptr;
 | 
			
		||||
		ptr += size;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &rs->host;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static struct hostent *
 | 
			
		||||
gethostbyname_internal_real(const char *name, int af, res_state res)
 | 
			
		||||
{
 | 
			
		||||
	const char *cp;
 | 
			
		||||
	char *bp, *ep;
 | 
			
		||||
	int size;
 | 
			
		||||
	struct hostent *hp;
 | 
			
		||||
        struct resolv_cache*  cache;
 | 
			
		||||
        res_static  rs = __res_get_static();
 | 
			
		||||
	res_static rs = __res_get_static();
 | 
			
		||||
 | 
			
		||||
	static const ns_dtab dtab[] = {
 | 
			
		||||
		NS_FILES_CB(_gethtbyname, NULL)
 | 
			
		||||
@@ -632,14 +733,85 @@ gethostbyname_internal(const char *name, int af, res_state res)
 | 
			
		||||
	if (nsdispatch(&hp, dtab, NSDB_HOSTS, "gethostbyname",
 | 
			
		||||
	    default_dns_files, name, strlen(name), af) != NS_SUCCESS) {
 | 
			
		||||
		return NULL;
 | 
			
		||||
        }
 | 
			
		||||
	}
 | 
			
		||||
	h_errno = NETDB_SUCCESS;
 | 
			
		||||
	return hp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// very similar in proxy-ness to android_getaddrinfo_proxy
 | 
			
		||||
static struct hostent *
 | 
			
		||||
gethostbyname_internal(const char *name, int af, res_state res, const char *iface, int mark)
 | 
			
		||||
{
 | 
			
		||||
	const char *cache_mode = getenv("ANDROID_DNS_MODE");
 | 
			
		||||
	FILE* proxy = NULL;
 | 
			
		||||
	struct hostent *result = NULL;
 | 
			
		||||
 | 
			
		||||
	if (cache_mode != NULL && strcmp(cache_mode, "local") == 0) {
 | 
			
		||||
		res_setiface(res, iface);
 | 
			
		||||
		res_setmark(res, mark);
 | 
			
		||||
		return gethostbyname_internal_real(name, af, res);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	proxy = android_open_proxy();
 | 
			
		||||
	if (proxy == NULL) goto exit;
 | 
			
		||||
 | 
			
		||||
	/* This is writing to system/netd/DnsProxyListener.cpp and changes
 | 
			
		||||
	 * here need to be matched there */
 | 
			
		||||
	if (fprintf(proxy, "gethostbyname %s %s %d",
 | 
			
		||||
			iface == NULL ? "^" : iface,
 | 
			
		||||
			name == NULL ? "^" : name,
 | 
			
		||||
			af) < 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (fputc(0, proxy) == EOF || fflush(proxy) != 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result = android_read_hostent(proxy);
 | 
			
		||||
 | 
			
		||||
exit:
 | 
			
		||||
	if (proxy != NULL) {
 | 
			
		||||
		fclose(proxy);
 | 
			
		||||
	}
 | 
			
		||||
	return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
gethostbyaddr(const void *addr,
 | 
			
		||||
    socklen_t len, int af)
 | 
			
		||||
android_gethostbyaddrforiface_proxy(const void *addr,
 | 
			
		||||
    socklen_t len, int af, const char* iface, int mark)
 | 
			
		||||
{
 | 
			
		||||
	struct hostent *result = NULL;
 | 
			
		||||
	FILE* proxy = android_open_proxy();
 | 
			
		||||
 | 
			
		||||
	if (proxy == NULL) goto exit;
 | 
			
		||||
 | 
			
		||||
	char buf[INET6_ADDRSTRLEN];  //big enough for IPv4 and IPv6
 | 
			
		||||
	const char * addrStr = inet_ntop(af, addr, buf, sizeof(buf));
 | 
			
		||||
	if (addrStr == NULL) goto exit;
 | 
			
		||||
 | 
			
		||||
	if (fprintf(proxy, "gethostbyaddr %s %d %d %s",
 | 
			
		||||
			addrStr, len, af, iface == NULL ? "^" : iface) < 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (fputc(0, proxy) == EOF || fflush(proxy) != 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result = android_read_hostent(proxy);
 | 
			
		||||
exit:
 | 
			
		||||
	if (proxy != NULL) {
 | 
			
		||||
		fclose(proxy);
 | 
			
		||||
	}
 | 
			
		||||
	return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
android_gethostbyaddrforiface_real(const void *addr,
 | 
			
		||||
    socklen_t len, int af, const char* iface, int mark)
 | 
			
		||||
{
 | 
			
		||||
	const u_char *uaddr = (const u_char *)addr;
 | 
			
		||||
	socklen_t size;
 | 
			
		||||
@@ -687,12 +859,31 @@ gethostbyaddr(const void *addr,
 | 
			
		||||
	hp = NULL;
 | 
			
		||||
	h_errno = NETDB_INTERNAL;
 | 
			
		||||
	if (nsdispatch(&hp, dtab, NSDB_HOSTS, "gethostbyaddr",
 | 
			
		||||
	    default_dns_files, uaddr, len, af) != NS_SUCCESS)
 | 
			
		||||
		default_dns_files, uaddr, len, af, iface, mark) != NS_SUCCESS)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	h_errno = NETDB_SUCCESS;
 | 
			
		||||
	return hp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
android_gethostbyaddrforiface(const void *addr, socklen_t len, int af, const char* iface, int mark)
 | 
			
		||||
{
 | 
			
		||||
	const char *cache_mode = getenv("ANDROID_DNS_MODE");
 | 
			
		||||
 | 
			
		||||
	if (cache_mode == NULL || strcmp(cache_mode, "local") != 0) {
 | 
			
		||||
		return android_gethostbyaddrforiface_proxy(addr, len, af, iface, mark);
 | 
			
		||||
	} else {
 | 
			
		||||
		return android_gethostbyaddrforiface_real(addr,len, af, iface, mark);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct hostent *
 | 
			
		||||
gethostbyaddr(const void *addr, socklen_t len, int af)
 | 
			
		||||
{
 | 
			
		||||
	return android_gethostbyaddrforiface(addr, len, af, NULL, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
_sethtent(int f)
 | 
			
		||||
{
 | 
			
		||||
@@ -1124,6 +1315,8 @@ _dns_gethtbyaddr(void *rv, void	*cb_data, va_list ap)
 | 
			
		||||
	const unsigned char *uaddr;
 | 
			
		||||
	int len, af, advance;
 | 
			
		||||
	res_state res;
 | 
			
		||||
	const char* iface;
 | 
			
		||||
	int mark;
 | 
			
		||||
	res_static rs = __res_get_static();
 | 
			
		||||
 | 
			
		||||
	assert(rv != NULL);
 | 
			
		||||
@@ -1131,6 +1324,8 @@ _dns_gethtbyaddr(void *rv, void	*cb_data, va_list ap)
 | 
			
		||||
	uaddr = va_arg(ap, unsigned char *);
 | 
			
		||||
	len = va_arg(ap, int);
 | 
			
		||||
	af = va_arg(ap, int);
 | 
			
		||||
	iface = va_arg(ap, char *);
 | 
			
		||||
	mark = va_arg(ap, int);
 | 
			
		||||
 | 
			
		||||
	switch (af) {
 | 
			
		||||
	case AF_INET:
 | 
			
		||||
@@ -1172,6 +1367,8 @@ _dns_gethtbyaddr(void *rv, void	*cb_data, va_list ap)
 | 
			
		||||
		free(buf);
 | 
			
		||||
		return NS_NOTFOUND;
 | 
			
		||||
	}
 | 
			
		||||
	res_setiface(res, iface);
 | 
			
		||||
	res_setmark(res, mark);
 | 
			
		||||
	n = res_nquery(res, qbuf, C_IN, T_PTR, buf->buf, sizeof(buf->buf));
 | 
			
		||||
	if (n < 0) {
 | 
			
		||||
		free(buf);
 | 
			
		||||
 
 | 
			
		||||
@@ -93,6 +93,7 @@
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <netdb.h>
 | 
			
		||||
#include "resolv_private.h"
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
@@ -214,7 +215,7 @@ struct res_target {
 | 
			
		||||
 | 
			
		||||
static int str2number(const char *);
 | 
			
		||||
static int explore_fqdn(const struct addrinfo *, const char *,
 | 
			
		||||
	const char *, struct addrinfo **);
 | 
			
		||||
	const char *, struct addrinfo **, const char *iface, int mark);
 | 
			
		||||
static int explore_null(const struct addrinfo *,
 | 
			
		||||
	const char *, struct addrinfo **);
 | 
			
		||||
static int explore_numeric(const struct addrinfo *, const char *,
 | 
			
		||||
@@ -402,17 +403,15 @@ _have_ipv4() {
 | 
			
		||||
        return _test_connect(PF_INET, &addr.generic, sizeof(addr.in));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Returns 0 on success, else returns non-zero on error (in which case
 | 
			
		||||
// getaddrinfo should continue as normal)
 | 
			
		||||
// Returns 0 on success, else returns on error.
 | 
			
		||||
static int
 | 
			
		||||
android_getaddrinfo_proxy(
 | 
			
		||||
    const char *hostname, const char *servname,
 | 
			
		||||
    const struct addrinfo *hints, struct addrinfo **res)
 | 
			
		||||
    const struct addrinfo *hints, struct addrinfo **res, const char *iface)
 | 
			
		||||
{
 | 
			
		||||
	int sock;
 | 
			
		||||
	const int one = 1;
 | 
			
		||||
	struct sockaddr_un proxy_addr;
 | 
			
		||||
	const char* cache_mode = getenv("ANDROID_DNS_MODE");
 | 
			
		||||
	FILE* proxy = NULL;
 | 
			
		||||
	int success = 0;
 | 
			
		||||
 | 
			
		||||
@@ -421,33 +420,17 @@ android_getaddrinfo_proxy(
 | 
			
		||||
	// allocated in the process (before failing).
 | 
			
		||||
	*res = NULL;
 | 
			
		||||
 | 
			
		||||
	if (cache_mode != NULL && strcmp(cache_mode, "local") == 0) {
 | 
			
		||||
		// Don't use the proxy in local mode.  This is used by the
 | 
			
		||||
		// proxy itself.
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Temporary cautious hack to disable the DNS proxy for processes
 | 
			
		||||
	// requesting special treatment.  Ideally the DNS proxy should
 | 
			
		||||
	// accomodate these apps, though.
 | 
			
		||||
	char propname[PROP_NAME_MAX];
 | 
			
		||||
	char propvalue[PROP_VALUE_MAX];
 | 
			
		||||
	snprintf(propname, sizeof(propname), "net.dns1.%d", getpid());
 | 
			
		||||
	if (__system_property_get(propname, propvalue) > 0) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Bogus things we can't serialize.  Don't use the proxy.
 | 
			
		||||
	// Bogus things we can't serialize.  Don't use the proxy.  These will fail - let them.
 | 
			
		||||
	if ((hostname != NULL &&
 | 
			
		||||
	     strcspn(hostname, " \n\r\t^'\"") != strlen(hostname)) ||
 | 
			
		||||
	    (servname != NULL &&
 | 
			
		||||
	     strcspn(servname, " \n\r\t^'\"") != strlen(servname))) {
 | 
			
		||||
		return -1;
 | 
			
		||||
		return EAI_NODATA;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sock = socket(AF_UNIX, SOCK_STREAM, 0);
 | 
			
		||||
	if (sock < 0) {
 | 
			
		||||
		return -1;
 | 
			
		||||
		return EAI_NODATA;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
 | 
			
		||||
@@ -459,18 +442,19 @@ android_getaddrinfo_proxy(
 | 
			
		||||
				       (const struct sockaddr*) &proxy_addr,
 | 
			
		||||
				       sizeof(proxy_addr))) != 0) {
 | 
			
		||||
		close(sock);
 | 
			
		||||
		return -1;
 | 
			
		||||
		return EAI_NODATA;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Send the request.
 | 
			
		||||
	proxy = fdopen(sock, "r+");
 | 
			
		||||
	if (fprintf(proxy, "getaddrinfo %s %s %d %d %d %d",
 | 
			
		||||
	if (fprintf(proxy, "getaddrinfo %s %s %d %d %d %d %s",
 | 
			
		||||
		    hostname == NULL ? "^" : hostname,
 | 
			
		||||
		    servname == NULL ? "^" : servname,
 | 
			
		||||
		    hints == NULL ? -1 : hints->ai_flags,
 | 
			
		||||
		    hints == NULL ? -1 : hints->ai_family,
 | 
			
		||||
		    hints == NULL ? -1 : hints->ai_socktype,
 | 
			
		||||
		    hints == NULL ? -1 : hints->ai_protocol) < 0) {
 | 
			
		||||
		    hints == NULL ? -1 : hints->ai_protocol,
 | 
			
		||||
		    iface == NULL ? "^" : iface) < 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
	// literal NULL byte at end, required by FrameworkListener
 | 
			
		||||
@@ -488,6 +472,7 @@ android_getaddrinfo_proxy(
 | 
			
		||||
	int result_code = (int)strtol(buf, NULL, 10);
 | 
			
		||||
	// verify the code itself
 | 
			
		||||
	if (result_code != DnsProxyQueryResult ) {
 | 
			
		||||
		fread(buf, 1, sizeof(buf), proxy);
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -580,19 +565,25 @@ exit:
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Proxy failed; fall through to local
 | 
			
		||||
	// resolver case.  But first clean up any
 | 
			
		||||
	// memory we might've allocated.
 | 
			
		||||
	// Proxy failed;
 | 
			
		||||
	// clean up memory we might've allocated.
 | 
			
		||||
	if (*res) {
 | 
			
		||||
		freeaddrinfo(*res);
 | 
			
		||||
		*res = NULL;
 | 
			
		||||
	}
 | 
			
		||||
	return -1;
 | 
			
		||||
	return EAI_NODATA;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
getaddrinfo(const char *hostname, const char *servname,
 | 
			
		||||
    const struct addrinfo *hints, struct addrinfo **res)
 | 
			
		||||
{
 | 
			
		||||
	return android_getaddrinfoforiface(hostname, servname, hints, NULL, 0, res);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
android_getaddrinfoforiface(const char *hostname, const char *servname,
 | 
			
		||||
    const struct addrinfo *hints, const char *iface, int mark, struct addrinfo **res)
 | 
			
		||||
{
 | 
			
		||||
	struct addrinfo sentinel;
 | 
			
		||||
	struct addrinfo *cur;
 | 
			
		||||
@@ -601,12 +592,12 @@ getaddrinfo(const char *hostname, const char *servname,
 | 
			
		||||
	struct addrinfo ai0;
 | 
			
		||||
	struct addrinfo *pai;
 | 
			
		||||
	const struct explore *ex;
 | 
			
		||||
	const char* cache_mode = getenv("ANDROID_DNS_MODE");
 | 
			
		||||
 | 
			
		||||
	/* hostname is allowed to be NULL */
 | 
			
		||||
	/* servname is allowed to be NULL */
 | 
			
		||||
	/* hints is allowed to be NULL */
 | 
			
		||||
	assert(res != NULL);
 | 
			
		||||
 | 
			
		||||
	memset(&sentinel, 0, sizeof(sentinel));
 | 
			
		||||
	cur = &sentinel;
 | 
			
		||||
	pai = &ai;
 | 
			
		||||
@@ -739,9 +730,10 @@ getaddrinfo(const char *hostname, const char *servname,
 | 
			
		||||
        /*
 | 
			
		||||
         * BEGIN ANDROID CHANGES; proxying to the cache
 | 
			
		||||
         */
 | 
			
		||||
        if (android_getaddrinfo_proxy(hostname, servname, hints, res) == 0) {
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
	if (cache_mode == NULL || strcmp(cache_mode, "local") != 0) {
 | 
			
		||||
		// we're not the proxy - pass the request to them
 | 
			
		||||
		return android_getaddrinfo_proxy(hostname, servname, hints, res, iface);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * hostname as alphabetical name.
 | 
			
		||||
@@ -770,7 +762,7 @@ getaddrinfo(const char *hostname, const char *servname,
 | 
			
		||||
			pai->ai_protocol = ex->e_protocol;
 | 
			
		||||
 | 
			
		||||
		error = explore_fqdn(pai, hostname, servname,
 | 
			
		||||
			&cur->ai_next);
 | 
			
		||||
			&cur->ai_next, iface, mark);
 | 
			
		||||
 | 
			
		||||
		while (cur && cur->ai_next)
 | 
			
		||||
			cur = cur->ai_next;
 | 
			
		||||
@@ -803,7 +795,7 @@ getaddrinfo(const char *hostname, const char *servname,
 | 
			
		||||
 */
 | 
			
		||||
static int
 | 
			
		||||
explore_fqdn(const struct addrinfo *pai, const char *hostname,
 | 
			
		||||
    const char *servname, struct addrinfo **res)
 | 
			
		||||
    const char *servname, struct addrinfo **res, const char *iface, int mark)
 | 
			
		||||
{
 | 
			
		||||
	struct addrinfo *result;
 | 
			
		||||
	struct addrinfo *cur;
 | 
			
		||||
@@ -829,7 +821,7 @@ explore_fqdn(const struct addrinfo *pai, const char *hostname,
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	switch (nsdispatch(&result, dtab, NSDB_HOSTS, "getaddrinfo",
 | 
			
		||||
			default_dns_files, hostname, pai)) {
 | 
			
		||||
			default_dns_files, hostname, pai, iface, mark)) {
 | 
			
		||||
	case NS_TRYAGAIN:
 | 
			
		||||
		error = EAI_AGAIN;
 | 
			
		||||
		goto free;
 | 
			
		||||
@@ -1873,17 +1865,19 @@ error:
 | 
			
		||||
	free(elems);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _using_alt_dns()
 | 
			
		||||
static bool _using_default_dns(const char *iface)
 | 
			
		||||
{
 | 
			
		||||
	char propname[PROP_NAME_MAX];
 | 
			
		||||
	char propvalue[PROP_VALUE_MAX];
 | 
			
		||||
	char buf[IF_NAMESIZE+1];
 | 
			
		||||
	size_t if_len;
 | 
			
		||||
 | 
			
		||||
	propvalue[0] = 0;
 | 
			
		||||
	snprintf(propname, sizeof(propname), "net.dns1.%d", getpid());
 | 
			
		||||
	if (__system_property_get(propname, propvalue) > 0 ) {
 | 
			
		||||
		return 1;
 | 
			
		||||
	// common case
 | 
			
		||||
	if (iface == NULL || *iface == '\0') return true;
 | 
			
		||||
 | 
			
		||||
	if_len = _resolv_get_default_iface(buf, sizeof(buf));
 | 
			
		||||
	if (if_len != 0 && if_len + 1 <= sizeof(buf)) {
 | 
			
		||||
		if (strcmp(buf, iface) == 0) return true;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*ARGSUSED*/
 | 
			
		||||
@@ -1897,9 +1891,13 @@ _dns_getaddrinfo(void *rv, void	*cb_data, va_list ap)
 | 
			
		||||
	struct addrinfo sentinel, *cur;
 | 
			
		||||
	struct res_target q, q2;
 | 
			
		||||
	res_state res;
 | 
			
		||||
	const char* iface;
 | 
			
		||||
	int mark;
 | 
			
		||||
 | 
			
		||||
	name = va_arg(ap, char *);
 | 
			
		||||
	pai = va_arg(ap, const struct addrinfo *);
 | 
			
		||||
	iface = va_arg(ap, char *);
 | 
			
		||||
	mark = va_arg(ap, int);
 | 
			
		||||
	//fprintf(stderr, "_dns_getaddrinfo() name = '%s'\n", name);
 | 
			
		||||
 | 
			
		||||
	memset(&q, 0, sizeof(q));
 | 
			
		||||
@@ -1931,7 +1929,7 @@ _dns_getaddrinfo(void *rv, void	*cb_data, va_list ap)
 | 
			
		||||
			// Only implement AI_ADDRCONFIG if the application is not
 | 
			
		||||
			// using its own DNS servers, since our implementation
 | 
			
		||||
			// only works on the default connection.
 | 
			
		||||
			if (!_using_alt_dns()) {
 | 
			
		||||
			if (_using_default_dns(iface)) {
 | 
			
		||||
				query_ipv6 = _have_ipv6();
 | 
			
		||||
				query_ipv4 = _have_ipv4();
 | 
			
		||||
			}
 | 
			
		||||
@@ -1981,6 +1979,13 @@ _dns_getaddrinfo(void *rv, void	*cb_data, va_list ap)
 | 
			
		||||
		return NS_NOTFOUND;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* this just sets our iface val in the thread private data so we don't have to
 | 
			
		||||
	 * modify the api's all the way down to res_send.c's res_nsend.  We could
 | 
			
		||||
	 * fully populate the thread private data here, but if we get down there
 | 
			
		||||
	 * and have a cache hit that would be wasted, so we do the rest there on miss
 | 
			
		||||
	 */
 | 
			
		||||
	res_setiface(res, iface);
 | 
			
		||||
	res_setmark(res, mark);
 | 
			
		||||
	if (res_searchN(name, &q, res) < 0) {
 | 
			
		||||
		__res_put_state(res);
 | 
			
		||||
		free(buf);
 | 
			
		||||
@@ -2311,6 +2316,12 @@ res_searchN(const char *name, struct res_target *target, res_state res)
 | 
			
		||||
	    (dots && !trailing_dot && (res->options & RES_DNSRCH))) {
 | 
			
		||||
		int done = 0;
 | 
			
		||||
 | 
			
		||||
		/* Unfortunately we need to set stuff up before
 | 
			
		||||
		 * the domain stuff is tried.  Will have a better
 | 
			
		||||
		 * fix after thread pools are used.
 | 
			
		||||
		 */
 | 
			
		||||
		_resolv_populate_res_for_iface(res);
 | 
			
		||||
 | 
			
		||||
		for (domain = (const char * const *)res->dnsrch;
 | 
			
		||||
		   *domain && !done;
 | 
			
		||||
		   domain++) {
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,6 @@ __RCSID("$NetBSD: getnameinfo.c,v 1.53 2012/09/26 23:13:00 christos Exp $");
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include <netdb.h>
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
#include "arpa_nameser.h"
 | 
			
		||||
#include "resolv_private.h"
 | 
			
		||||
#include <sys/system_properties.h>
 | 
			
		||||
@@ -69,9 +68,6 @@ __RCSID("$NetBSD: getnameinfo.c,v 1.53 2012/09/26 23:13:00 christos Exp $");
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
 | 
			
		||||
#else
 | 
			
		||||
#include <resolv.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
@@ -97,7 +93,7 @@ struct sockinet {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int getnameinfo_inet(const struct sockaddr *, socklen_t, char *,
 | 
			
		||||
    socklen_t, char *, socklen_t, int);
 | 
			
		||||
    socklen_t, char *, socklen_t, int, const char*, int);
 | 
			
		||||
#ifdef INET6
 | 
			
		||||
static int ip6_parsenumeric(const struct sockaddr *, const char *, char *,
 | 
			
		||||
				 socklen_t, int);
 | 
			
		||||
@@ -111,12 +107,17 @@ static int getnameinfo_local(const struct sockaddr *, socklen_t, char *,
 | 
			
		||||
 * appropriate function to call.
 | 
			
		||||
 */
 | 
			
		||||
int getnameinfo(const struct sockaddr* sa, socklen_t salen, char* host, size_t hostlen, char* serv, size_t servlen, int flags)
 | 
			
		||||
{
 | 
			
		||||
	return android_getnameinfoforiface(sa, salen, host, hostlen, serv, servlen, flags, NULL, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int android_getnameinfoforiface(const struct sockaddr* sa, socklen_t salen, char* host, size_t hostlen, char* serv, size_t servlen, int flags, const char* iface, int mark)
 | 
			
		||||
{
 | 
			
		||||
	switch (sa->sa_family) {
 | 
			
		||||
	case AF_INET:
 | 
			
		||||
	case AF_INET6:
 | 
			
		||||
		return getnameinfo_inet(sa, salen, host, hostlen,
 | 
			
		||||
		    serv, servlen, flags);
 | 
			
		||||
				serv, servlen, flags, iface, mark);
 | 
			
		||||
	case AF_LOCAL:
 | 
			
		||||
		return getnameinfo_local(sa, salen, host, hostlen,
 | 
			
		||||
		    serv, servlen, flags);
 | 
			
		||||
@@ -152,112 +153,23 @@ getnameinfo_local(const struct sockaddr *sa, socklen_t salen,
 | 
			
		||||
       return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
/* On success length of the host name is returned. A return
 | 
			
		||||
 * value of 0 means there's no host name associated with
 | 
			
		||||
 * the address. On failure -1 is returned in which case
 | 
			
		||||
 * normal execution flow shall continue. */
 | 
			
		||||
static int
 | 
			
		||||
android_gethostbyaddr_proxy(char* nameBuf, size_t nameBufLen, const void *addr, socklen_t addrLen, int addrFamily) {
 | 
			
		||||
android_gethostbyaddr_proxy(char* nameBuf, size_t nameBufLen, const void *addr, socklen_t addrLen, int addrFamily, const char* iface, int mark)
 | 
			
		||||
{
 | 
			
		||||
	struct hostent *hostResult =
 | 
			
		||||
			android_gethostbyaddrforiface_proxy(addr, addrLen, addrFamily, iface, mark);
 | 
			
		||||
 | 
			
		||||
	int sock;
 | 
			
		||||
	const int one = 1;
 | 
			
		||||
	struct sockaddr_un proxy_addr;
 | 
			
		||||
	const char* cache_mode = getenv("ANDROID_DNS_MODE");
 | 
			
		||||
	FILE* proxy = NULL;
 | 
			
		||||
	int result = -1;
 | 
			
		||||
	if (hostResult == NULL) return 0;
 | 
			
		||||
 | 
			
		||||
	if (cache_mode != NULL && strcmp(cache_mode, "local") == 0) {
 | 
			
		||||
		// Don't use the proxy in local mode.  This is used by the
 | 
			
		||||
		// proxy itself.
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	int lengthResult = strlen(hostResult->h_name);
 | 
			
		||||
 | 
			
		||||
	// Temporary cautious hack to disable the DNS proxy for processes
 | 
			
		||||
	// requesting special treatment.  Ideally the DNS proxy should
 | 
			
		||||
	// accomodate these apps, though.
 | 
			
		||||
	char propname[PROP_NAME_MAX];
 | 
			
		||||
	char propvalue[PROP_VALUE_MAX];
 | 
			
		||||
	snprintf(propname, sizeof(propname), "net.dns1.%d", getpid());
 | 
			
		||||
	if (__system_property_get(propname, propvalue) > 0) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	// create socket
 | 
			
		||||
	sock = socket(AF_UNIX, SOCK_STREAM, 0);
 | 
			
		||||
	if (sock < 0) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
 | 
			
		||||
	memset(&proxy_addr, 0, sizeof(proxy_addr));
 | 
			
		||||
	proxy_addr.sun_family = AF_UNIX;
 | 
			
		||||
	strlcpy(proxy_addr.sun_path, "/dev/socket/dnsproxyd",
 | 
			
		||||
			sizeof(proxy_addr.sun_path));
 | 
			
		||||
	if (TEMP_FAILURE_RETRY(connect(sock, (const struct sockaddr*) (void*) &proxy_addr,
 | 
			
		||||
							sizeof(proxy_addr))) != 0) {
 | 
			
		||||
		close(sock);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// send request to DnsProxyListener
 | 
			
		||||
	proxy = fdopen(sock,"r+");
 | 
			
		||||
	if (proxy == NULL) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	char buf[INET6_ADDRSTRLEN]; // big enough for IPv4 and IPv6
 | 
			
		||||
	const char* addrStr = inet_ntop(addrFamily, addr, buf, sizeof(buf));
 | 
			
		||||
	if (addrStr == NULL) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
	if (fprintf(proxy, "gethostbyaddr %s %d %d", addrStr, addrLen, addrFamily) < 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// literal NULL byte at end, required by FrameworkListener
 | 
			
		||||
	if (fputc(0, proxy) == EOF || fflush(proxy) != 0) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result = 0;
 | 
			
		||||
	char msg_buf[4];
 | 
			
		||||
	// read result code for gethostbyaddr
 | 
			
		||||
	if (fread(msg_buf, 1, sizeof(msg_buf), proxy) != sizeof(msg_buf)) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	int result_code = (int)strtol(msg_buf, NULL, 10);
 | 
			
		||||
	// verify the code itself
 | 
			
		||||
        // This should be synchronized to ResponseCode.h
 | 
			
		||||
        static const int DnsProxyQueryResult = 222;
 | 
			
		||||
	if (result_code != DnsProxyQueryResult) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	uint32_t name_len;
 | 
			
		||||
	if (fread(&name_len, sizeof(name_len), 1, proxy) != 1) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	name_len = ntohl(name_len);
 | 
			
		||||
	if (name_len <= 0 || name_len >= nameBufLen) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (fread(nameBuf, name_len, 1, proxy) != 1) {
 | 
			
		||||
		goto exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result = name_len;
 | 
			
		||||
 | 
			
		||||
 exit:
 | 
			
		||||
	if (proxy != NULL) {
 | 
			
		||||
		fclose(proxy);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return result;
 | 
			
		||||
	if (nameBuf) strncpy(nameBuf, hostResult->h_name, nameBufLen);
 | 
			
		||||
	return lengthResult;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * getnameinfo_inet():
 | 
			
		||||
@@ -267,7 +179,7 @@ static int
 | 
			
		||||
getnameinfo_inet(const struct sockaddr* sa, socklen_t salen,
 | 
			
		||||
       char *host, socklen_t hostlen,
 | 
			
		||||
       char *serv, socklen_t servlen,
 | 
			
		||||
       int flags)
 | 
			
		||||
       int flags, const char* iface, int mark)
 | 
			
		||||
{
 | 
			
		||||
	const struct afd *afd;
 | 
			
		||||
	struct servent *sp;
 | 
			
		||||
@@ -405,23 +317,20 @@ getnameinfo_inet(const struct sockaddr* sa, socklen_t salen,
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
		struct hostent android_proxy_hostent;
 | 
			
		||||
		char android_proxy_buf[MAXDNAME];
 | 
			
		||||
 | 
			
		||||
		int hostnamelen = android_gethostbyaddr_proxy(android_proxy_buf,
 | 
			
		||||
				MAXDNAME, addr, afd->a_addrlen, afd->a_af);
 | 
			
		||||
				MAXDNAME, addr, afd->a_addrlen, afd->a_af, iface, mark);
 | 
			
		||||
		if (hostnamelen > 0) {
 | 
			
		||||
			hp = &android_proxy_hostent;
 | 
			
		||||
			hp->h_name = android_proxy_buf;
 | 
			
		||||
		} else if (!hostnamelen) {
 | 
			
		||||
			hp = NULL;
 | 
			
		||||
		} else {
 | 
			
		||||
			hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
 | 
			
		||||
			hp = android_gethostbyaddrforiface(addr, afd->a_addrlen, afd->a_af,
 | 
			
		||||
					iface, mark);
 | 
			
		||||
		}
 | 
			
		||||
#else
 | 
			
		||||
		hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		if (hp) {
 | 
			
		||||
#if 0
 | 
			
		||||
 
 | 
			
		||||
@@ -43,6 +43,7 @@
 | 
			
		||||
#include <arpa/inet.h>
 | 
			
		||||
#include "resolv_private.h"
 | 
			
		||||
#include "resolv_iface.h"
 | 
			
		||||
#include "res_private.h"
 | 
			
		||||
 | 
			
		||||
/* This code implements a small and *simple* DNS resolver cache.
 | 
			
		||||
 *
 | 
			
		||||
@@ -571,8 +572,6 @@ _dnsPacket_checkQName( DnsPacket*  packet )
 | 
			
		||||
static int
 | 
			
		||||
_dnsPacket_checkQR( DnsPacket*  packet )
 | 
			
		||||
{
 | 
			
		||||
    int  len;
 | 
			
		||||
 | 
			
		||||
    if (!_dnsPacket_checkQName(packet))
 | 
			
		||||
        return 0;
 | 
			
		||||
 | 
			
		||||
@@ -831,8 +830,6 @@ _dnsPacket_hashQName( DnsPacket*  packet, unsigned  hash )
 | 
			
		||||
static unsigned
 | 
			
		||||
_dnsPacket_hashQR( DnsPacket*  packet, unsigned  hash )
 | 
			
		||||
{
 | 
			
		||||
    int   len;
 | 
			
		||||
 | 
			
		||||
    hash = _dnsPacket_hashQName(packet, hash);
 | 
			
		||||
    hash = _dnsPacket_hashBytes(packet, 4, hash); /* TYPE and CLASS */
 | 
			
		||||
    return hash;
 | 
			
		||||
@@ -1019,8 +1016,58 @@ typedef struct Entry {
 | 
			
		||||
} Entry;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Parse the answer records and find the smallest
 | 
			
		||||
 * TTL among the answer records.
 | 
			
		||||
 * Find the TTL for a negative DNS result.  This is defined as the minimum
 | 
			
		||||
 * of the SOA records TTL and the MINIMUM-TTL field (RFC-2308).
 | 
			
		||||
 *
 | 
			
		||||
 * Return 0 if not found.
 | 
			
		||||
 */
 | 
			
		||||
static u_long
 | 
			
		||||
answer_getNegativeTTL(ns_msg handle) {
 | 
			
		||||
    int n, nscount;
 | 
			
		||||
    u_long result = 0;
 | 
			
		||||
    ns_rr rr;
 | 
			
		||||
 | 
			
		||||
    nscount = ns_msg_count(handle, ns_s_ns);
 | 
			
		||||
    for (n = 0; n < nscount; n++) {
 | 
			
		||||
        if ((ns_parserr(&handle, ns_s_ns, n, &rr) == 0) && (ns_rr_type(rr) == ns_t_soa)) {
 | 
			
		||||
            const u_char *rdata = ns_rr_rdata(rr); // find the data
 | 
			
		||||
            const u_char *edata = rdata + ns_rr_rdlen(rr); // add the len to find the end
 | 
			
		||||
            int len;
 | 
			
		||||
            u_long ttl, rec_result = ns_rr_ttl(rr);
 | 
			
		||||
 | 
			
		||||
            // find the MINIMUM-TTL field from the blob of binary data for this record
 | 
			
		||||
            // skip the server name
 | 
			
		||||
            len = dn_skipname(rdata, edata);
 | 
			
		||||
            if (len == -1) continue; // error skipping
 | 
			
		||||
            rdata += len;
 | 
			
		||||
 | 
			
		||||
            // skip the admin name
 | 
			
		||||
            len = dn_skipname(rdata, edata);
 | 
			
		||||
            if (len == -1) continue; // error skipping
 | 
			
		||||
            rdata += len;
 | 
			
		||||
 | 
			
		||||
            if (edata - rdata != 5*NS_INT32SZ) continue;
 | 
			
		||||
            // skip: serial number + refresh interval + retry interval + expiry
 | 
			
		||||
            rdata += NS_INT32SZ * 4;
 | 
			
		||||
            // finally read the MINIMUM TTL
 | 
			
		||||
            ttl = ns_get32(rdata);
 | 
			
		||||
            if (ttl < rec_result) {
 | 
			
		||||
                rec_result = ttl;
 | 
			
		||||
            }
 | 
			
		||||
            // Now that the record is read successfully, apply the new min TTL
 | 
			
		||||
            if (n == 0 || rec_result < result) {
 | 
			
		||||
                result = rec_result;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Parse the answer records and find the appropriate
 | 
			
		||||
 * smallest TTL among the records.  This might be from
 | 
			
		||||
 * the answer records if found or from the SOA record
 | 
			
		||||
 * if it's a negative result.
 | 
			
		||||
 *
 | 
			
		||||
 * The returned TTL is the number of seconds to
 | 
			
		||||
 * keep the answer in the cache.
 | 
			
		||||
@@ -1040,14 +1087,20 @@ answer_getTTL(const void* answer, int answerlen)
 | 
			
		||||
    if (ns_initparse(answer, answerlen, &handle) >= 0) {
 | 
			
		||||
        // get number of answer records
 | 
			
		||||
        ancount = ns_msg_count(handle, ns_s_an);
 | 
			
		||||
        for (n = 0; n < ancount; n++) {
 | 
			
		||||
            if (ns_parserr(&handle, ns_s_an, n, &rr) == 0) {
 | 
			
		||||
                ttl = ns_rr_ttl(rr);
 | 
			
		||||
                if (n == 0 || ttl < result) {
 | 
			
		||||
                    result = ttl;
 | 
			
		||||
 | 
			
		||||
        if (ancount == 0) {
 | 
			
		||||
            // a response with no answers?  Cache this negative result.
 | 
			
		||||
            result = answer_getNegativeTTL(handle);
 | 
			
		||||
        } else {
 | 
			
		||||
            for (n = 0; n < ancount; n++) {
 | 
			
		||||
                if (ns_parserr(&handle, ns_s_an, n, &rr) == 0) {
 | 
			
		||||
                    ttl = ns_rr_ttl(rr);
 | 
			
		||||
                    if (n == 0 || ttl < result) {
 | 
			
		||||
                        result = ttl;
 | 
			
		||||
                    }
 | 
			
		||||
                } else {
 | 
			
		||||
                    XLOG("ns_parserr failed ancount no = %d. errno = %s\n", n, strerror(errno));
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                XLOG("ns_parserr failed ancount no = %d. errno = %s\n", n, strerror(errno));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
@@ -1196,8 +1249,22 @@ typedef struct resolv_cache_info {
 | 
			
		||||
    struct resolv_cache_info*   next;
 | 
			
		||||
    char*                       nameservers[MAXNS +1];
 | 
			
		||||
    struct addrinfo*            nsaddrinfo[MAXNS + 1];
 | 
			
		||||
    char                        defdname[256];
 | 
			
		||||
    int                         dnsrch_offset[MAXDNSRCH+1];  // offsets into defdname
 | 
			
		||||
} CacheInfo;
 | 
			
		||||
 | 
			
		||||
typedef struct resolv_pidiface_info {
 | 
			
		||||
    int                             pid;
 | 
			
		||||
    char                            ifname[IF_NAMESIZE + 1];
 | 
			
		||||
    struct resolv_pidiface_info*    next;
 | 
			
		||||
} PidIfaceInfo;
 | 
			
		||||
typedef struct resolv_uidiface_info {
 | 
			
		||||
    int                             uid_start;
 | 
			
		||||
    int                             uid_end;
 | 
			
		||||
    char                            ifname[IF_NAMESIZE + 1];
 | 
			
		||||
    struct resolv_uidiface_info*    next;
 | 
			
		||||
} UidIfaceInfo;
 | 
			
		||||
 | 
			
		||||
#define  HTABLE_VALID(x)  ((x) != NULL && (x) != HTABLE_DELETED)
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@@ -1250,8 +1317,9 @@ _cache_check_pending_request_locked( struct resolv_cache* cache, Entry* key )
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            struct timespec ts = {0,0};
 | 
			
		||||
            XLOG("Waiting for previous request");
 | 
			
		||||
            ts.tv_sec = _time_now() + PENDING_REQUEST_TIMEOUT;
 | 
			
		||||
            int rv = pthread_cond_timedwait(&ri->cond, &cache->lock, &ts);
 | 
			
		||||
            pthread_cond_timedwait(&ri->cond, &cache->lock, &ts);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -1305,7 +1373,6 @@ static void
 | 
			
		||||
_cache_flush_locked( Cache*  cache )
 | 
			
		||||
{
 | 
			
		||||
    int     nn;
 | 
			
		||||
    time_t  now = _time_now();
 | 
			
		||||
 | 
			
		||||
    for (nn = 0; nn < cache->max_entries; nn++)
 | 
			
		||||
    {
 | 
			
		||||
@@ -1346,9 +1413,8 @@ _res_cache_get_max_entries( void )
 | 
			
		||||
    if (cache_mode == NULL || strcmp(cache_mode, "local") != 0) {
 | 
			
		||||
        // Don't use the cache in local mode.  This is used by the
 | 
			
		||||
        // proxy itself.
 | 
			
		||||
        // TODO - change this to 0 when all dns stuff uses proxy (5918973)
 | 
			
		||||
        XLOG("setup cache for non-cache process. size=1");
 | 
			
		||||
        return 1;
 | 
			
		||||
        XLOG("setup cache for non-cache process. size=0, %s", cache_mode);
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (__system_property_get(DNS_CACHE_SIZE_PROP_NAME, cache_size) > 0) {
 | 
			
		||||
@@ -1441,6 +1507,7 @@ _dump_answer(const void* answer, int answerlen)
 | 
			
		||||
        remove("/data/reslog.txt");
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        errno = 0; // else debug is introducing error signals
 | 
			
		||||
        XLOG("_dump_answer: can't open file\n");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1576,9 +1643,7 @@ _resolv_cache_lookup( struct resolv_cache*  cache,
 | 
			
		||||
                      int                   answersize,
 | 
			
		||||
                      int                  *answerlen )
 | 
			
		||||
{
 | 
			
		||||
    DnsPacket  pack[1];
 | 
			
		||||
    Entry      key[1];
 | 
			
		||||
    int        index;
 | 
			
		||||
    Entry**    lookup;
 | 
			
		||||
    Entry*     e;
 | 
			
		||||
    time_t     now;
 | 
			
		||||
@@ -1729,20 +1794,34 @@ Exit:
 | 
			
		||||
/****************************************************************************/
 | 
			
		||||
/****************************************************************************/
 | 
			
		||||
 | 
			
		||||
static pthread_once_t        _res_cache_once;
 | 
			
		||||
static pthread_once_t        _res_cache_once = PTHREAD_ONCE_INIT;
 | 
			
		||||
 | 
			
		||||
// Head of the list of caches.  Protected by _res_cache_list_lock.
 | 
			
		||||
static struct resolv_cache_info _res_cache_list;
 | 
			
		||||
 | 
			
		||||
// List of pid iface pairs
 | 
			
		||||
static struct resolv_pidiface_info _res_pidiface_list;
 | 
			
		||||
 | 
			
		||||
// List of uid iface pairs
 | 
			
		||||
static struct resolv_uidiface_info _res_uidiface_list;
 | 
			
		||||
 | 
			
		||||
// name of the current default inteface
 | 
			
		||||
static char            _res_default_ifname[IF_NAMESIZE + 1];
 | 
			
		||||
 | 
			
		||||
// lock protecting everything in the _resolve_cache_info structs (next ptr, etc)
 | 
			
		||||
static pthread_mutex_t _res_cache_list_lock;
 | 
			
		||||
 | 
			
		||||
// lock protecting the _res_pid_iface_list
 | 
			
		||||
static pthread_mutex_t _res_pidiface_list_lock;
 | 
			
		||||
 | 
			
		||||
// lock protecting the _res_uidiface_list
 | 
			
		||||
static pthread_mutex_t _res_uidiface_list_lock;
 | 
			
		||||
 | 
			
		||||
/* lookup the default interface name */
 | 
			
		||||
static char *_get_default_iface_locked();
 | 
			
		||||
/* find the first cache that has an associated interface and return the name of the interface */
 | 
			
		||||
static char* _find_any_iface_name_locked( void );
 | 
			
		||||
 | 
			
		||||
/* insert resolv_cache_info into the list of resolv_cache_infos */
 | 
			
		||||
static void _insert_cache_info_locked(struct resolv_cache_info* cache_info);
 | 
			
		||||
/* creates a resolv_cache_info */
 | 
			
		||||
@@ -1751,8 +1830,6 @@ static struct resolv_cache_info* _create_cache_info( void );
 | 
			
		||||
static struct resolv_cache* _find_named_cache_locked(const char* ifname);
 | 
			
		||||
/* gets a resolv_cache_info associated with an interface name, or NULL if not found */
 | 
			
		||||
static struct resolv_cache_info* _find_cache_info_locked(const char* ifname);
 | 
			
		||||
/* free dns name server list of a resolv_cache_info structure */
 | 
			
		||||
static void _free_nameservers(struct resolv_cache_info* cache_info);
 | 
			
		||||
/* look up the named cache, and creates one if needed */
 | 
			
		||||
static struct resolv_cache* _get_res_cache_for_iface_locked(const char* ifname);
 | 
			
		||||
/* empty the named cache */
 | 
			
		||||
@@ -1765,8 +1842,19 @@ static int _get_nameserver_locked(const char* ifname, int n, char* addr, int add
 | 
			
		||||
static struct addrinfo* _get_nameserver_addr_locked(const char* ifname, int n);
 | 
			
		||||
/* lookup the inteface's address */
 | 
			
		||||
static struct in_addr* _get_addr_locked(const char * ifname);
 | 
			
		||||
/* return 1 if the provided list of name servers differs from the list of name servers
 | 
			
		||||
 * currently attached to the provided cache_info */
 | 
			
		||||
static int _resolv_is_nameservers_equal_locked(struct resolv_cache_info* cache_info,
 | 
			
		||||
        const char** servers, int numservers);
 | 
			
		||||
/* remove a resolv_pidiface_info structure from _res_pidiface_list */
 | 
			
		||||
static void _remove_pidiface_info_locked(int pid);
 | 
			
		||||
/* get a resolv_pidiface_info structure from _res_pidiface_list with a certain pid */
 | 
			
		||||
static struct resolv_pidiface_info* _get_pid_iface_info_locked(int pid);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* remove a resolv_pidiface_info structure from _res_uidiface_list */
 | 
			
		||||
static int _remove_uidiface_info_locked(const char* iface, int uid_start, int uid_end);
 | 
			
		||||
/* get a resolv_uidiface_info structure from _res_uidiface_list with a certain uid */
 | 
			
		||||
static struct resolv_uidiface_info* _get_uid_iface_info_locked(int uid);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
_res_cache_init(void)
 | 
			
		||||
@@ -1780,37 +1868,38 @@ _res_cache_init(void)
 | 
			
		||||
 | 
			
		||||
    memset(&_res_default_ifname, 0, sizeof(_res_default_ifname));
 | 
			
		||||
    memset(&_res_cache_list, 0, sizeof(_res_cache_list));
 | 
			
		||||
    memset(&_res_pidiface_list, 0, sizeof(_res_pidiface_list));
 | 
			
		||||
    memset(&_res_uidiface_list, 0, sizeof(_res_uidiface_list));
 | 
			
		||||
    pthread_mutex_init(&_res_cache_list_lock, NULL);
 | 
			
		||||
    pthread_mutex_init(&_res_pidiface_list_lock, NULL);
 | 
			
		||||
    pthread_mutex_init(&_res_uidiface_list_lock, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct resolv_cache*
 | 
			
		||||
__get_res_cache(void)
 | 
			
		||||
__get_res_cache(const char* ifname)
 | 
			
		||||
{
 | 
			
		||||
    struct resolv_cache *cache;
 | 
			
		||||
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_lock(&_res_cache_list_lock);
 | 
			
		||||
 | 
			
		||||
    char* ifname = _get_default_iface_locked();
 | 
			
		||||
 | 
			
		||||
    // if default interface not set then use the first cache
 | 
			
		||||
    // associated with an interface as the default one.
 | 
			
		||||
    if (ifname[0] == '\0') {
 | 
			
		||||
        struct resolv_cache_info* cache_info = _res_cache_list.next;
 | 
			
		||||
        while (cache_info) {
 | 
			
		||||
            if (cache_info->ifname[0] != '\0') {
 | 
			
		||||
                ifname = cache_info->ifname;
 | 
			
		||||
                break;
 | 
			
		||||
    char* iface;
 | 
			
		||||
    if (ifname == NULL || ifname[0] == '\0') {
 | 
			
		||||
        iface = _get_default_iface_locked();
 | 
			
		||||
        if (iface[0] == '\0') {
 | 
			
		||||
            char* tmp = _find_any_iface_name_locked();
 | 
			
		||||
            if (tmp) {
 | 
			
		||||
                iface = tmp;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            cache_info = cache_info->next;
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        iface = (char *) ifname;
 | 
			
		||||
    }
 | 
			
		||||
    cache = _get_res_cache_for_iface_locked(ifname);
 | 
			
		||||
 | 
			
		||||
    cache = _get_res_cache_for_iface_locked(iface);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_cache_list_lock);
 | 
			
		||||
    XLOG("_get_res_cache. default_ifname = %s\n", ifname);
 | 
			
		||||
    XLOG("_get_res_cache: iface = %s, cache=%p\n", iface, cache);
 | 
			
		||||
    return cache;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1966,11 +2055,29 @@ _find_cache_info_locked(const char* ifname)
 | 
			
		||||
static char*
 | 
			
		||||
_get_default_iface_locked(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    char* iface = _res_default_ifname;
 | 
			
		||||
 | 
			
		||||
    return iface;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static char*
 | 
			
		||||
_find_any_iface_name_locked( void ) {
 | 
			
		||||
    char* ifname = NULL;
 | 
			
		||||
 | 
			
		||||
    struct resolv_cache_info* cache_info = _res_cache_list.next;
 | 
			
		||||
    while (cache_info) {
 | 
			
		||||
        if (cache_info->ifname[0] != '\0') {
 | 
			
		||||
            ifname = cache_info->ifname;
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        cache_info = cache_info->next;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return ifname;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_resolv_set_default_iface(const char* ifname)
 | 
			
		||||
{
 | 
			
		||||
@@ -1988,21 +2095,25 @@ _resolv_set_default_iface(const char* ifname)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers)
 | 
			
		||||
_resolv_set_nameservers_for_iface(const char* ifname, const char** servers, int numservers,
 | 
			
		||||
        const char *domains)
 | 
			
		||||
{
 | 
			
		||||
    int i, rt, index;
 | 
			
		||||
    struct addrinfo hints;
 | 
			
		||||
    char sbuf[NI_MAXSERV];
 | 
			
		||||
    register char *cp;
 | 
			
		||||
    int *offset;
 | 
			
		||||
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_lock(&_res_cache_list_lock);
 | 
			
		||||
 | 
			
		||||
    // creates the cache if not created
 | 
			
		||||
    _get_res_cache_for_iface_locked(ifname);
 | 
			
		||||
 | 
			
		||||
    struct resolv_cache_info* cache_info = _find_cache_info_locked(ifname);
 | 
			
		||||
 | 
			
		||||
    if (cache_info != NULL) {
 | 
			
		||||
    if (cache_info != NULL &&
 | 
			
		||||
            !_resolv_is_nameservers_equal_locked(cache_info, servers, numservers)) {
 | 
			
		||||
        // free current before adding new
 | 
			
		||||
        _free_nameservers_locked(cache_info);
 | 
			
		||||
 | 
			
		||||
@@ -2018,14 +2129,68 @@ _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numser
 | 
			
		||||
            if (rt == 0) {
 | 
			
		||||
                cache_info->nameservers[index] = strdup(servers[i]);
 | 
			
		||||
                index++;
 | 
			
		||||
                XLOG("_resolv_set_nameservers_for_iface: iface = %s, addr = %s\n",
 | 
			
		||||
                        ifname, servers[i]);
 | 
			
		||||
            } else {
 | 
			
		||||
                cache_info->nsaddrinfo[index] = NULL;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // code moved from res_init.c, load_domain_search_list
 | 
			
		||||
        strlcpy(cache_info->defdname, domains, sizeof(cache_info->defdname));
 | 
			
		||||
        if ((cp = strchr(cache_info->defdname, '\n')) != NULL)
 | 
			
		||||
            *cp = '\0';
 | 
			
		||||
        cp = cache_info->defdname;
 | 
			
		||||
        offset = cache_info->dnsrch_offset;
 | 
			
		||||
        while (offset < cache_info->dnsrch_offset + MAXDNSRCH) {
 | 
			
		||||
            while (*cp == ' ' || *cp == '\t') /* skip leading white space */
 | 
			
		||||
                cp++;
 | 
			
		||||
            if (*cp == '\0') /* stop if nothing more to do */
 | 
			
		||||
                break;
 | 
			
		||||
            *offset++ = cp - cache_info->defdname; /* record this search domain */
 | 
			
		||||
            while (*cp) { /* zero-terminate it */
 | 
			
		||||
                if (*cp == ' '|| *cp == '\t') {
 | 
			
		||||
                    *cp++ = '\0';
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                cp++;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        *offset = -1; /* cache_info->dnsrch_offset has MAXDNSRCH+1 items */
 | 
			
		||||
 | 
			
		||||
        // flush cache since new settings
 | 
			
		||||
        _flush_cache_for_iface_locked(ifname);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_cache_list_lock);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
_resolv_is_nameservers_equal_locked(struct resolv_cache_info* cache_info,
 | 
			
		||||
        const char** servers, int numservers)
 | 
			
		||||
{
 | 
			
		||||
    int i;
 | 
			
		||||
    char** ns;
 | 
			
		||||
    int equal = 1;
 | 
			
		||||
 | 
			
		||||
    // compare each name server against current name servers
 | 
			
		||||
    if (numservers > MAXNS) numservers = MAXNS;
 | 
			
		||||
    for (i = 0; i < numservers && equal; i++) {
 | 
			
		||||
        ns = cache_info->nameservers;
 | 
			
		||||
        equal = 0;
 | 
			
		||||
        while(*ns) {
 | 
			
		||||
            if (strcmp(*ns, servers[i]) == 0) {
 | 
			
		||||
                equal = 1;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            ns++;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return equal;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
_free_nameservers_locked(struct resolv_cache_info* cache_info)
 | 
			
		||||
{
 | 
			
		||||
@@ -2125,8 +2290,8 @@ _resolv_set_addr_of_iface(const char* ifname, struct in_addr* addr)
 | 
			
		||||
        memcpy(&cache_info->ifaddr, addr, sizeof(*addr));
 | 
			
		||||
 | 
			
		||||
        if (DEBUG) {
 | 
			
		||||
            char* addr_s = inet_ntoa(cache_info->ifaddr);
 | 
			
		||||
            XLOG("address of interface %s is %s\n", ifname, addr_s);
 | 
			
		||||
            XLOG("address of interface %s is %s\n",
 | 
			
		||||
                    ifname, inet_ntoa(cache_info->ifaddr));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    pthread_mutex_unlock(&_res_cache_list_lock);
 | 
			
		||||
@@ -2168,3 +2333,333 @@ _get_addr_locked(const char * ifname)
 | 
			
		||||
    }
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
_remove_pidiface_info_locked(int pid) {
 | 
			
		||||
    struct resolv_pidiface_info* result = &_res_pidiface_list;
 | 
			
		||||
    struct resolv_pidiface_info* prev = NULL;
 | 
			
		||||
 | 
			
		||||
    while (result != NULL && result->pid != pid) {
 | 
			
		||||
        prev = result;
 | 
			
		||||
        result = result->next;
 | 
			
		||||
    }
 | 
			
		||||
    if (prev != NULL && result != NULL) {
 | 
			
		||||
        prev->next = result->next;
 | 
			
		||||
        free(result);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static struct resolv_pidiface_info*
 | 
			
		||||
_get_pid_iface_info_locked(int pid)
 | 
			
		||||
{
 | 
			
		||||
    struct resolv_pidiface_info* result = &_res_pidiface_list;
 | 
			
		||||
    while (result != NULL && result->pid != pid) {
 | 
			
		||||
        result = result->next;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_resolv_set_iface_for_pid(const char* ifname, int pid)
 | 
			
		||||
{
 | 
			
		||||
    // make sure the pid iface list is created
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_pidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    struct resolv_pidiface_info* pidiface_info = _get_pid_iface_info_locked(pid);
 | 
			
		||||
    if (!pidiface_info) {
 | 
			
		||||
        pidiface_info = calloc(sizeof(*pidiface_info), 1);
 | 
			
		||||
        if (pidiface_info) {
 | 
			
		||||
            pidiface_info->pid = pid;
 | 
			
		||||
            int len = sizeof(pidiface_info->ifname);
 | 
			
		||||
            strncpy(pidiface_info->ifname, ifname, len - 1);
 | 
			
		||||
            pidiface_info->ifname[len - 1] = '\0';
 | 
			
		||||
 | 
			
		||||
            pidiface_info->next = _res_pidiface_list.next;
 | 
			
		||||
            _res_pidiface_list.next = pidiface_info;
 | 
			
		||||
 | 
			
		||||
            XLOG("_resolv_set_iface_for_pid: pid %d , iface %s\n", pid, ifname);
 | 
			
		||||
        } else {
 | 
			
		||||
            XLOG("_resolv_set_iface_for_pid failing calloc");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_pidiface_list_lock);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_resolv_clear_iface_for_pid(int pid)
 | 
			
		||||
{
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_pidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    _remove_pidiface_info_locked(pid);
 | 
			
		||||
 | 
			
		||||
    XLOG("_resolv_clear_iface_for_pid: pid %d\n", pid);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_pidiface_list_lock);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
_resolv_get_pids_associated_interface(int pid, char* buff, int buffLen)
 | 
			
		||||
{
 | 
			
		||||
    int len = 0;
 | 
			
		||||
 | 
			
		||||
    if (!buff) {
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_pidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    struct resolv_pidiface_info* pidiface_info = _get_pid_iface_info_locked(pid);
 | 
			
		||||
    buff[0] = '\0';
 | 
			
		||||
    if (pidiface_info) {
 | 
			
		||||
        len = strlen(pidiface_info->ifname);
 | 
			
		||||
        if (len < buffLen) {
 | 
			
		||||
            strncpy(buff, pidiface_info->ifname, len);
 | 
			
		||||
            buff[len] = '\0';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    XLOG("_resolv_get_pids_associated_interface buff: %s\n", buff);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_pidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    return len;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
_remove_uidiface_info_locked(const char* ifname, int uid_start, int uid_end) {
 | 
			
		||||
    struct resolv_uidiface_info* result = _res_uidiface_list.next;
 | 
			
		||||
    struct resolv_uidiface_info* prev = &_res_uidiface_list;
 | 
			
		||||
    while (result != NULL && !(result->uid_start == uid_start && result->uid_end == uid_end &&
 | 
			
		||||
            !strcmp(result->ifname, ifname))) {
 | 
			
		||||
        prev = result;
 | 
			
		||||
        result = result->next;
 | 
			
		||||
    }
 | 
			
		||||
    if (prev != NULL && result != NULL) {
 | 
			
		||||
        prev->next = result->next;
 | 
			
		||||
        free(result);
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    errno = EINVAL;
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static struct resolv_uidiface_info*
 | 
			
		||||
_get_uid_iface_info_locked(int uid)
 | 
			
		||||
{
 | 
			
		||||
    struct resolv_uidiface_info* result = _res_uidiface_list.next;
 | 
			
		||||
    while (result != NULL && !(result->uid_start <= uid && result->uid_end >= uid)) {
 | 
			
		||||
        result = result->next;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_resolv_clear_iface_uid_range_mapping()
 | 
			
		||||
{
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_uidiface_list_lock);
 | 
			
		||||
    struct resolv_uidiface_info *current = _res_uidiface_list.next;
 | 
			
		||||
    struct resolv_uidiface_info *next;
 | 
			
		||||
    while (current != NULL) {
 | 
			
		||||
        next = current->next;
 | 
			
		||||
        free(current);
 | 
			
		||||
        current = next;
 | 
			
		||||
    }
 | 
			
		||||
    _res_uidiface_list.next = NULL;
 | 
			
		||||
    pthread_mutex_unlock(&_res_uidiface_list_lock);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_resolv_clear_iface_pid_mapping()
 | 
			
		||||
{
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_pidiface_list_lock);
 | 
			
		||||
    struct resolv_pidiface_info *current = _res_pidiface_list.next;
 | 
			
		||||
    struct resolv_pidiface_info *next;
 | 
			
		||||
    while (current != NULL) {
 | 
			
		||||
        next = current->next;
 | 
			
		||||
        free(current);
 | 
			
		||||
        current = next;
 | 
			
		||||
    }
 | 
			
		||||
    _res_pidiface_list.next = NULL;
 | 
			
		||||
    pthread_mutex_unlock(&_res_pidiface_list_lock);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
_resolv_set_iface_for_uid_range(const char* ifname, int uid_start, int uid_end)
 | 
			
		||||
{
 | 
			
		||||
    int rv = 0;
 | 
			
		||||
    struct resolv_uidiface_info* uidiface_info;
 | 
			
		||||
    // make sure the uid iface list is created
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    if (uid_start > uid_end) {
 | 
			
		||||
        errno = EINVAL;
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
    pthread_mutex_lock(&_res_uidiface_list_lock);
 | 
			
		||||
    uidiface_info = calloc(sizeof(*uidiface_info), 1);
 | 
			
		||||
    if (uidiface_info) {
 | 
			
		||||
        uidiface_info->uid_start = uid_start;
 | 
			
		||||
        uidiface_info->uid_end = uid_end;
 | 
			
		||||
        int len = sizeof(uidiface_info->ifname);
 | 
			
		||||
        strncpy(uidiface_info->ifname, ifname, len - 1);
 | 
			
		||||
        uidiface_info->ifname[len - 1] = '\0';
 | 
			
		||||
 | 
			
		||||
        uidiface_info->next = _res_uidiface_list.next;
 | 
			
		||||
        _res_uidiface_list.next = uidiface_info;
 | 
			
		||||
 | 
			
		||||
        XLOG("_resolv_set_iface_for_uid_range: [%d,%d], iface %s\n", uid_start, uid_end,
 | 
			
		||||
                ifname);
 | 
			
		||||
    } else {
 | 
			
		||||
        XLOG("_resolv_set_iface_for_uid_range failing calloc\n");
 | 
			
		||||
        rv = -1;
 | 
			
		||||
        errno = EINVAL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_uidiface_list_lock);
 | 
			
		||||
    return rv;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
_resolv_clear_iface_for_uid_range(const char* ifname, int uid_start, int uid_end)
 | 
			
		||||
{
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_uidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    int rv = _remove_uidiface_info_locked(ifname, uid_start, uid_end);
 | 
			
		||||
 | 
			
		||||
    XLOG("_resolv_clear_iface_for_uid_range: [%d,%d] iface %s\n", uid_start, uid_end, ifname);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_uidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    return rv;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
_resolv_get_uids_associated_interface(int uid, char* buff, int buffLen)
 | 
			
		||||
{
 | 
			
		||||
    int len = 0;
 | 
			
		||||
 | 
			
		||||
    if (!buff) {
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_uidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    struct resolv_uidiface_info* uidiface_info = _get_uid_iface_info_locked(uid);
 | 
			
		||||
    buff[0] = '\0';
 | 
			
		||||
    if (uidiface_info) {
 | 
			
		||||
        len = strlen(uidiface_info->ifname);
 | 
			
		||||
        if (len < buffLen) {
 | 
			
		||||
            strncpy(buff, uidiface_info->ifname, len);
 | 
			
		||||
            buff[len] = '\0';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    XLOG("_resolv_get_uids_associated_interface buff: %s\n", buff);
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_uidiface_list_lock);
 | 
			
		||||
 | 
			
		||||
    return len;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
size_t
 | 
			
		||||
_resolv_get_default_iface(char* buff, size_t buffLen)
 | 
			
		||||
{
 | 
			
		||||
    if (!buff || buffLen == 0) {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_cache_list_lock);
 | 
			
		||||
 | 
			
		||||
    char* ifname = _get_default_iface_locked(); // never null, but may be empty
 | 
			
		||||
 | 
			
		||||
    // if default interface not set give up.
 | 
			
		||||
    if (ifname[0] == '\0') {
 | 
			
		||||
        pthread_mutex_unlock(&_res_cache_list_lock);
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    size_t len = strlen(ifname);
 | 
			
		||||
    if (len < buffLen) {
 | 
			
		||||
        strncpy(buff, ifname, len);
 | 
			
		||||
        buff[len] = '\0';
 | 
			
		||||
    } else {
 | 
			
		||||
        buff[0] = '\0';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_mutex_unlock(&_res_cache_list_lock);
 | 
			
		||||
 | 
			
		||||
    return len;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
_resolv_populate_res_for_iface(res_state statp)
 | 
			
		||||
{
 | 
			
		||||
    if (statp == NULL) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (statp->iface[0] == '\0') { // no interface set assign default
 | 
			
		||||
        size_t if_len = _resolv_get_default_iface(statp->iface, sizeof(statp->iface));
 | 
			
		||||
        if (if_len + 1 > sizeof(statp->iface)) {
 | 
			
		||||
            XLOG("%s: INTERNAL_ERROR: can't fit interface name into statp->iface.\n", __FUNCTION__);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (if_len == 0) {
 | 
			
		||||
            XLOG("%s: INTERNAL_ERROR: can't find any suitable interfaces.\n", __FUNCTION__);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pthread_once(&_res_cache_once, _res_cache_init);
 | 
			
		||||
    pthread_mutex_lock(&_res_cache_list_lock);
 | 
			
		||||
 | 
			
		||||
    struct resolv_cache_info* info = _find_cache_info_locked(statp->iface);
 | 
			
		||||
    if (info != NULL) {
 | 
			
		||||
        int nserv;
 | 
			
		||||
        struct addrinfo* ai;
 | 
			
		||||
        XLOG("_resolv_populate_res_for_iface: %s\n", statp->iface);
 | 
			
		||||
        for (nserv = 0; nserv < MAXNS; nserv++) {
 | 
			
		||||
            ai = info->nsaddrinfo[nserv];
 | 
			
		||||
            if (ai == NULL) {
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ((size_t) ai->ai_addrlen <= sizeof(statp->_u._ext.ext->nsaddrs[0])) {
 | 
			
		||||
                if (statp->_u._ext.ext != NULL) {
 | 
			
		||||
                    memcpy(&statp->_u._ext.ext->nsaddrs[nserv], ai->ai_addr, ai->ai_addrlen);
 | 
			
		||||
                    statp->nsaddr_list[nserv].sin_family = AF_UNSPEC;
 | 
			
		||||
                } else {
 | 
			
		||||
                    if ((size_t) ai->ai_addrlen
 | 
			
		||||
                            <= sizeof(statp->nsaddr_list[0])) {
 | 
			
		||||
                        memcpy(&statp->nsaddr_list[nserv], ai->ai_addr,
 | 
			
		||||
                                ai->ai_addrlen);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        statp->nsaddr_list[nserv].sin_family = AF_UNSPEC;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                XLOG("_resolv_populate_res_for_iface found too long addrlen");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        statp->nscount = nserv;
 | 
			
		||||
        // now do search domains.  Note that we cache the offsets as this code runs alot
 | 
			
		||||
        // but the setting/offset-computer only runs when set/changed
 | 
			
		||||
        strlcpy(statp->defdname, info->defdname, sizeof(statp->defdname));
 | 
			
		||||
        register char **pp = statp->dnsrch;
 | 
			
		||||
        register int *p = info->dnsrch_offset;
 | 
			
		||||
        while (pp < statp->dnsrch + MAXDNSRCH && *p != -1) {
 | 
			
		||||
            *pp++ = &statp->defdname + *p++;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    pthread_mutex_unlock(&_res_cache_list_lock);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -82,13 +82,7 @@ extern struct __res_state _nres;
 | 
			
		||||
 | 
			
		||||
int  res_ourserver_p(const res_state, const struct sockaddr *);
 | 
			
		||||
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
static int res_need_init() {
 | 
			
		||||
	return ((_nres.options & RES_INIT) == 0U) || res_get_dns_changed();
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
#define res_need_init()   ((_nres.options & RES_INIT) == 0U)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
res_init(void) {
 | 
			
		||||
 
 | 
			
		||||
@@ -111,13 +111,6 @@ __RCSID("$NetBSD: res_init.c,v 1.8 2006/03/19 03:10:08 christos Exp $");
 | 
			
		||||
/* ensure that sockaddr_in6 and IN6ADDR_ANY_INIT are declared / defined */
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
#include "resolv_private.h"
 | 
			
		||||
#define MAX_DNS_PROPERTIES 8
 | 
			
		||||
#define DNS_PROP_NAME_PREFIX "net.dns"
 | 
			
		||||
#define DNS_CHANGE_PROP_NAME "net.dnschange"
 | 
			
		||||
#define DNS_SEARCH_PROP_NAME "net.dns.search"
 | 
			
		||||
static const prop_info *dns_change_prop;
 | 
			
		||||
static int dns_last_change_counter;
 | 
			
		||||
static int _get_dns_change_count();
 | 
			
		||||
#else
 | 
			
		||||
#include <resolv.h>
 | 
			
		||||
#endif
 | 
			
		||||
@@ -171,41 +164,6 @@ res_ninit(res_state statp) {
 | 
			
		||||
	return (__res_vinit(statp, 0));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
static int load_domain_search_list(res_state statp) {
 | 
			
		||||
	char propvalue[PROP_VALUE_MAX];
 | 
			
		||||
	register char *cp, **pp;
 | 
			
		||||
 | 
			
		||||
	if(__system_property_get(DNS_SEARCH_PROP_NAME, propvalue) >= 1) {
 | 
			
		||||
		strlcpy(statp->defdname, propvalue, sizeof(statp->defdname));
 | 
			
		||||
		if ((cp = strchr(statp->defdname, '\n')) != NULL)
 | 
			
		||||
			*cp = '\0';
 | 
			
		||||
		cp = statp->defdname;
 | 
			
		||||
		pp = statp->dnsrch;
 | 
			
		||||
		while ( pp < statp->dnsrch + MAXDNSRCH ) {
 | 
			
		||||
			while (*cp == ' ' || *cp == '\t') /* skip leading white space */
 | 
			
		||||
				cp++;
 | 
			
		||||
			if (*cp == '\0')  /* stop if nothing more */
 | 
			
		||||
				break;
 | 
			
		||||
			*pp++ = cp;  /* record this search domain */
 | 
			
		||||
			while (*cp) { /* zero-terminate it */
 | 
			
		||||
				if (*cp == ' ' || *cp == '\t') {
 | 
			
		||||
					*cp++ = '\0';
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
				cp++;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		*pp = NULL; /* statp->dnsrch has MAXDNSRCH+1 items */
 | 
			
		||||
		if (pp > statp->dnsrch)
 | 
			
		||||
			return 1;
 | 
			
		||||
	}
 | 
			
		||||
	statp->defdname[0] = '\0';  /* no default domain name on Android */
 | 
			
		||||
	statp->dnsrch[0] = NULL;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* This function has to be reachable by res_data.c but not publicly. */
 | 
			
		||||
int
 | 
			
		||||
__res_vinit(res_state statp, int preinit) {
 | 
			
		||||
@@ -220,12 +178,6 @@ __res_vinit(res_state statp, int preinit) {
 | 
			
		||||
	char *net;
 | 
			
		||||
	int dots;
 | 
			
		||||
	union res_sockaddr_union u[2];
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
        pid_t mypid = getpid();
 | 
			
		||||
        int use_proc_props = 0;
 | 
			
		||||
        int found_prop;
 | 
			
		||||
	char dnsProperty[PROP_VALUE_MAX];
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        if ((statp->options & RES_INIT) != 0U)
 | 
			
		||||
                res_ndestroy(statp);
 | 
			
		||||
@@ -318,74 +270,8 @@ __res_vinit(res_state statp, int preinit) {
 | 
			
		||||
	if (nserv > 0)
 | 
			
		||||
		statp->nscount = nserv;
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef ANDROID_CHANGES /* READ FROM SYSTEM PROPERTIES */
 | 
			
		||||
	dns_last_change_counter = _get_dns_change_count();
 | 
			
		||||
 | 
			
		||||
	nserv = 0;
 | 
			
		||||
	for(n = 1; n <= MAX_DNS_PROPERTIES && nserv < MAXNS; n++) {
 | 
			
		||||
		char propname[PROP_NAME_MAX];
 | 
			
		||||
		char propvalue[PROP_VALUE_MAX];
 | 
			
		||||
 | 
			
		||||
		struct addrinfo hints, *ai;
 | 
			
		||||
		char sbuf[NI_MAXSERV];
 | 
			
		||||
		const size_t minsiz = sizeof(statp->_u._ext.ext->nsaddrs[0]);
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * Check first for process-specific properties, and if those don't
 | 
			
		||||
		 * exist, try the generic properties.
 | 
			
		||||
		 */
 | 
			
		||||
		found_prop = 0;
 | 
			
		||||
		if (n == 1 || use_proc_props) {
 | 
			
		||||
			snprintf(propname, sizeof(propname), "%s%d.%d", DNS_PROP_NAME_PREFIX, n, mypid);
 | 
			
		||||
			if(__system_property_get(propname, propvalue) < 1) {
 | 
			
		||||
				if (use_proc_props) {
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				found_prop = 1;
 | 
			
		||||
				use_proc_props = 1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (!found_prop) {
 | 
			
		||||
			snprintf(propname, sizeof(propname), "%s%d", DNS_PROP_NAME_PREFIX, n);
 | 
			
		||||
			if(__system_property_get(propname, propvalue) < 1) {
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		cp = propvalue;
 | 
			
		||||
 | 
			
		||||
		while (*cp == ' ' || *cp == '\t')
 | 
			
		||||
			cp++;
 | 
			
		||||
		cp[strcspn(cp, ";# \t\n")] = '\0';
 | 
			
		||||
		if ((*cp != '\0') && (*cp != '\n')) {
 | 
			
		||||
			memset(&hints, 0, sizeof(hints));
 | 
			
		||||
			hints.ai_family = PF_UNSPEC;
 | 
			
		||||
			hints.ai_socktype = SOCK_DGRAM;	/*dummy*/
 | 
			
		||||
			hints.ai_flags = AI_NUMERICHOST;
 | 
			
		||||
			sprintf(sbuf, "%u", NAMESERVER_PORT);
 | 
			
		||||
			if (getaddrinfo(cp, sbuf, &hints, &ai) == 0 &&
 | 
			
		||||
			    (size_t)ai->ai_addrlen <= minsiz) {
 | 
			
		||||
				if (statp->_u._ext.ext != NULL) {
 | 
			
		||||
					memcpy(&statp->_u._ext.ext->nsaddrs[nserv],
 | 
			
		||||
					       ai->ai_addr, ai->ai_addrlen);
 | 
			
		||||
				}
 | 
			
		||||
				if ((size_t)ai->ai_addrlen <=
 | 
			
		||||
				    sizeof(statp->nsaddr_list[nserv])) {
 | 
			
		||||
					memcpy(&statp->nsaddr_list[nserv],
 | 
			
		||||
					       ai->ai_addr, ai->ai_addrlen);
 | 
			
		||||
				} else {
 | 
			
		||||
					statp->nsaddr_list[nserv].sin_family = 0;
 | 
			
		||||
				}
 | 
			
		||||
				freeaddrinfo(ai);
 | 
			
		||||
				nserv++;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Add the domain search list */
 | 
			
		||||
	havesearch = load_domain_search_list(statp);
 | 
			
		||||
#else /* !ANDROID_CHANGES - IGNORE resolv.conf in Android */
 | 
			
		||||
#ifndef ANDROID_CHANGES /* !ANDROID_CHANGES - IGNORE resolv.conf in Android */
 | 
			
		||||
#define	MATCH(line, name) \
 | 
			
		||||
	(!strncmp(line, name, sizeof(name) - 1) && \
 | 
			
		||||
	(line[sizeof(name) - 1] == ' ' || \
 | 
			
		||||
@@ -907,32 +793,24 @@ res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
static int _get_dns_change_count()
 | 
			
		||||
void res_setiface(res_state statp, const char* iface)
 | 
			
		||||
{
 | 
			
		||||
	if (dns_change_prop == NULL) {
 | 
			
		||||
		dns_change_prop = __system_property_find(DNS_CHANGE_PROP_NAME);
 | 
			
		||||
	}
 | 
			
		||||
	if (dns_change_prop != NULL) {
 | 
			
		||||
		char propvalue[PROP_VALUE_MAX];
 | 
			
		||||
		if (__system_property_read(dns_change_prop, NULL, propvalue) >= 1) {
 | 
			
		||||
			return atoi(propvalue);
 | 
			
		||||
	if (statp != NULL) {
 | 
			
		||||
		// set interface
 | 
			
		||||
		if (iface && iface[0] != '\0') {
 | 
			
		||||
			int len = sizeof(statp->iface);
 | 
			
		||||
			strncpy(statp->iface, iface, len - 1);
 | 
			
		||||
			statp->iface[len - 1] = '\0';
 | 
			
		||||
		} else {
 | 
			
		||||
			statp->iface[0] = '\0';
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int res_get_dns_changed()
 | 
			
		||||
void res_setmark(res_state statp, int mark)
 | 
			
		||||
{
 | 
			
		||||
	int change_count;
 | 
			
		||||
 | 
			
		||||
	change_count = _get_dns_change_count();
 | 
			
		||||
	if (change_count != dns_last_change_counter) {
 | 
			
		||||
		if (change_count != -1) {
 | 
			
		||||
			dns_last_change_counter = change_count;
 | 
			
		||||
		}
 | 
			
		||||
		return 1;
 | 
			
		||||
	} else {
 | 
			
		||||
		return 0;
 | 
			
		||||
	if (statp != NULL) {
 | 
			
		||||
		statp->_mark = mark;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
#endif /* ANDROID_CHANGES */
 | 
			
		||||
 
 | 
			
		||||
@@ -272,6 +272,15 @@ res_nsearch(res_state statp,
 | 
			
		||||
	    (dots && !trailing_dot && (statp->options & RES_DNSRCH) != 0U)) {
 | 
			
		||||
		int done = 0;
 | 
			
		||||
 | 
			
		||||
		/* Unfortunately we need to load interface info
 | 
			
		||||
		 * (dns servers, search domains) before
 | 
			
		||||
		 * the domain stuff is tried.  Will have a better
 | 
			
		||||
		 * fix after thread pools are used as this will
 | 
			
		||||
		 * be loaded once for the thread instead of each
 | 
			
		||||
		 * time a query is tried.
 | 
			
		||||
		 */
 | 
			
		||||
		_resolv_populate_res_for_iface(statp);
 | 
			
		||||
 | 
			
		||||
		for (domain = (const char * const *)statp->dnsrch;
 | 
			
		||||
		     *domain && !done;
 | 
			
		||||
		     domain++) {
 | 
			
		||||
 
 | 
			
		||||
@@ -370,10 +370,13 @@ res_nsend(res_state statp,
 | 
			
		||||
        ResolvCacheStatus     cache_status = RESOLV_CACHE_UNSUPPORTED;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !USE_RESOLV_CACHE
 | 
			
		||||
	if (statp->nscount == 0) {
 | 
			
		||||
		errno = ESRCH;
 | 
			
		||||
		return (-1);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (anssiz < HFIXEDSZ) {
 | 
			
		||||
		errno = EINVAL;
 | 
			
		||||
		return (-1);
 | 
			
		||||
@@ -385,17 +388,27 @@ res_nsend(res_state statp,
 | 
			
		||||
	terrno = ETIMEDOUT;
 | 
			
		||||
 | 
			
		||||
#if USE_RESOLV_CACHE
 | 
			
		||||
        cache = __get_res_cache();
 | 
			
		||||
        if (cache != NULL) {
 | 
			
		||||
            int  anslen = 0;
 | 
			
		||||
            cache_status = _resolv_cache_lookup(
 | 
			
		||||
                                cache, buf, buflen,
 | 
			
		||||
                                ans, anssiz, &anslen);
 | 
			
		||||
	// get the cache associated with the interface
 | 
			
		||||
	cache = __get_res_cache(statp->iface);
 | 
			
		||||
	if (cache != NULL) {
 | 
			
		||||
		int  anslen = 0;
 | 
			
		||||
		cache_status = _resolv_cache_lookup(
 | 
			
		||||
				cache, buf, buflen,
 | 
			
		||||
				ans, anssiz, &anslen);
 | 
			
		||||
 | 
			
		||||
            if (cache_status == RESOLV_CACHE_FOUND) {
 | 
			
		||||
                return anslen;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
		if (cache_status == RESOLV_CACHE_FOUND) {
 | 
			
		||||
			return anslen;
 | 
			
		||||
		} else {
 | 
			
		||||
			// had a cache miss for a known interface, so populate the thread private
 | 
			
		||||
			// data so the normal resolve path can do its thing
 | 
			
		||||
			_resolv_populate_res_for_iface(statp);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (statp->nscount == 0) {
 | 
			
		||||
		errno = ESRCH;
 | 
			
		||||
		return (-1);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
@@ -749,10 +762,13 @@ send_vc(res_state statp,
 | 
			
		||||
	if (statp->_vcsock >= 0 && (statp->_flags & RES_F_VC) != 0) {
 | 
			
		||||
		struct sockaddr_storage peer;
 | 
			
		||||
		socklen_t size = sizeof peer;
 | 
			
		||||
 | 
			
		||||
		int old_mark;
 | 
			
		||||
		int mark_size = sizeof(old_mark);
 | 
			
		||||
		if (getpeername(statp->_vcsock,
 | 
			
		||||
				(struct sockaddr *)(void *)&peer, &size) < 0 ||
 | 
			
		||||
		    !sock_eq((struct sockaddr *)(void *)&peer, nsap)) {
 | 
			
		||||
		    !sock_eq((struct sockaddr *)(void *)&peer, nsap) ||
 | 
			
		||||
			getsockopt(statp->_vcsock, SOL_SOCKET, SO_MARK, &old_mark, &mark_size) < 0 ||
 | 
			
		||||
			old_mark != statp->_mark) {
 | 
			
		||||
			res_nclose(statp);
 | 
			
		||||
			statp->_flags &= ~RES_F_VC;
 | 
			
		||||
		}
 | 
			
		||||
@@ -782,6 +798,14 @@ send_vc(res_state statp,
 | 
			
		||||
				return (-1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (statp->_mark != 0) {
 | 
			
		||||
			if (setsockopt(statp->_vcsock, SOL_SOCKET,
 | 
			
		||||
				        SO_MARK, &statp->_mark, sizeof(statp->_mark)) < 0) {
 | 
			
		||||
				*terrno = errno;
 | 
			
		||||
				Perror(statp, stderr, "setsockopt", errno);
 | 
			
		||||
				return -1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		errno = 0;
 | 
			
		||||
		if (random_bind(statp->_vcsock,nsap->sa_family) < 0) {
 | 
			
		||||
			*terrno = errno;
 | 
			
		||||
@@ -1057,6 +1081,14 @@ send_dg(res_state statp,
 | 
			
		||||
				return (-1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (statp->_mark != 0) {
 | 
			
		||||
			if (setsockopt(EXT(statp).nssocks[ns], SOL_SOCKET,
 | 
			
		||||
					SO_MARK, &(statp->_mark), sizeof(statp->_mark)) < 0) {
 | 
			
		||||
				res_nclose(statp);
 | 
			
		||||
				return -1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#ifndef CANNOT_CONNECT_DGRAM
 | 
			
		||||
		/*
 | 
			
		||||
		 * On a 4.3BSD+ machine (client and server,
 | 
			
		||||
@@ -1084,6 +1116,7 @@ send_dg(res_state statp,
 | 
			
		||||
#endif /* !CANNOT_CONNECT_DGRAM */
 | 
			
		||||
		Dprint(statp->options & RES_DEBUG,
 | 
			
		||||
		       (stdout, ";; new DG socket\n"))
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	s = EXT(statp).nssocks[ns];
 | 
			
		||||
#ifndef CANNOT_CONNECT_DGRAM
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static pthread_key_t   _res_key;
 | 
			
		||||
static pthread_once_t  _res_once;
 | 
			
		||||
static pthread_once_t  _res_once = PTHREAD_ONCE_INIT;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    int                  _h_errno;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										40
									
								
								libc/private/bionic_name_mem.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								libc/private/bionic_name_mem.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _BIONIC_NAME_MEM_H
 | 
			
		||||
#define _BIONIC_NAME_MEM_H
 | 
			
		||||
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
 | 
			
		||||
__BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
int __bionic_name_mem(void *addr, size_t len, const char *name);
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -76,7 +76,12 @@ enum {
 | 
			
		||||
 * maintain that second number, but pthread_test will fail if we forget.
 | 
			
		||||
 */
 | 
			
		||||
#define GLOBAL_INIT_THREAD_LOCAL_BUFFER_COUNT 4
 | 
			
		||||
#define BIONIC_TLS_SLOTS 64
 | 
			
		||||
/*
 | 
			
		||||
 * This is PTHREAD_KEYS_MAX + TLS_SLOT_FIRST_USER_SLOT + GLOBAL_INIT_THREAD_LOCAL_BUFFER_COUNT
 | 
			
		||||
 * rounded up to maintain stack alignment.
 | 
			
		||||
 */
 | 
			
		||||
#define BIONIC_ALIGN(x, a) (((x) + (a - 1)) & ~(a - 1))
 | 
			
		||||
#define BIONIC_TLS_SLOTS BIONIC_ALIGN(128 + TLS_SLOT_FIRST_USER_SLOT + GLOBAL_INIT_THREAD_LOCAL_BUFFER_COUNT, 4)
 | 
			
		||||
 | 
			
		||||
/* syscall only, do not call directly */
 | 
			
		||||
extern int __set_tls(void* ptr);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										48
									
								
								libc/private/libc_events.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								libc/private/libc_events.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _LIBC_EVENTS_H
 | 
			
		||||
#define _LIBC_EVENTS_H
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// This is going to be included in assembler code so only allow #define
 | 
			
		||||
// values instead of defining an enum.
 | 
			
		||||
 | 
			
		||||
#define BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW   80100
 | 
			
		||||
#define BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW   80105
 | 
			
		||||
#define BIONIC_EVENT_MEMMOVE_BUFFER_OVERFLOW  80110
 | 
			
		||||
#define BIONIC_EVENT_STRNCAT_BUFFER_OVERFLOW  80115
 | 
			
		||||
#define BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW  80120
 | 
			
		||||
#define BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW   80125
 | 
			
		||||
#define BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW   80130
 | 
			
		||||
 | 
			
		||||
#define BIONIC_EVENT_RESOLVER_OLD_RESPONSE    80300
 | 
			
		||||
#define BIONIC_EVENT_RESOLVER_WRONG_SERVER    80305
 | 
			
		||||
#define BIONIC_EVENT_RESOLVER_WRONG_QUERY     80310
 | 
			
		||||
 | 
			
		||||
#endif // _LIBC_EVENTS_H
 | 
			
		||||
@@ -36,19 +36,7 @@
 | 
			
		||||
 | 
			
		||||
__BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
  BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW = 80100,
 | 
			
		||||
  BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW = 80105,
 | 
			
		||||
  BIONIC_EVENT_MEMMOVE_BUFFER_OVERFLOW = 80110,
 | 
			
		||||
  BIONIC_EVENT_STRNCAT_BUFFER_OVERFLOW = 80115,
 | 
			
		||||
  BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW = 80120,
 | 
			
		||||
  BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW = 80125,
 | 
			
		||||
  BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW = 80130,
 | 
			
		||||
 | 
			
		||||
  BIONIC_EVENT_RESOLVER_OLD_RESPONSE = 80300,
 | 
			
		||||
  BIONIC_EVENT_RESOLVER_WRONG_SERVER = 80305,
 | 
			
		||||
  BIONIC_EVENT_RESOLVER_WRONG_QUERY = 80310,
 | 
			
		||||
};
 | 
			
		||||
#include "libc_events.h"
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
  ANDROID_LOG_UNKNOWN = 0,
 | 
			
		||||
 
 | 
			
		||||
@@ -28,47 +28,67 @@
 | 
			
		||||
#ifndef _RESOLV_CACHE_H_
 | 
			
		||||
#define _RESOLV_CACHE_H_
 | 
			
		||||
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
 | 
			
		||||
struct __res_state;
 | 
			
		||||
struct resolv_cache;  /* forward */
 | 
			
		||||
 | 
			
		||||
/* gets the cache for the default interface. Might be NULL*/
 | 
			
		||||
extern struct resolv_cache*  __get_res_cache(void);
 | 
			
		||||
 | 
			
		||||
/* get the cache for a specified interface. Can be NULL*/
 | 
			
		||||
extern struct resolv_cache* __get_res_cache_for_iface(const char* ifname);
 | 
			
		||||
/* gets the cache for an interface. Set ifname argument to NULL or
 | 
			
		||||
 * empty buffer ('\0') to get cache for default interface.
 | 
			
		||||
 * returned cache might be NULL*/
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern struct resolv_cache*  __get_res_cache(const char* ifname);
 | 
			
		||||
 | 
			
		||||
/* this gets called everytime we detect some changes in the DNS configuration
 | 
			
		||||
 * and will flush the cache */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern void  _resolv_cache_reset( unsigned  generation );
 | 
			
		||||
 | 
			
		||||
/* Gets the address of the n:th name server for the default interface
 | 
			
		||||
 * Return length of address on success else 0.
 | 
			
		||||
 * Note: The first name server is at n = 1 */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern int _resolv_cache_get_nameserver(int n, char* addr, int addrLen);
 | 
			
		||||
 | 
			
		||||
/* Gets the address of the n:th name server for a certain interface
 | 
			
		||||
 * Return length of address on success else 0.
 | 
			
		||||
 * Note: The first name server is at n = 1 */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern int _resolv_cache_get_nameserver_for_iface(const char* ifname, int n,
 | 
			
		||||
        char* addr, int addrLen);
 | 
			
		||||
 | 
			
		||||
/* Gets addrinfo of the n:th name server associated with an interface.
 | 
			
		||||
 * NULL is returned if no address if found.
 | 
			
		||||
 * Note: The first name server is at n = 1. */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern struct addrinfo* _resolv_cache_get_nameserver_addr_for_iface(const char* ifname, int n);
 | 
			
		||||
 | 
			
		||||
/* Gets addrinfo of the n:th name server associated with the default interface
 | 
			
		||||
 * NULL is returned if no address if found.
 | 
			
		||||
 * Note: The first name server is at n = 1. */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern struct addrinfo* _resolv_cache_get_nameserver_addr(int n);
 | 
			
		||||
 | 
			
		||||
/* gets the address associated with the default interface */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern struct in_addr* _resolv_get_addr_of_default_iface();
 | 
			
		||||
 | 
			
		||||
/* gets the address associated with the specified interface */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern struct in_addr* _resolv_get_addr_of_iface(const char* ifname);
 | 
			
		||||
 | 
			
		||||
/* Get name of default interface */
 | 
			
		||||
extern char* _resolv_get_default_iface();
 | 
			
		||||
/* Copy the name of the default interface to the provided buffer.
 | 
			
		||||
 * Returns the string length of the default interface,
 | 
			
		||||
 * be that less or more than the buffLen, or 0 if nothing had been written */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
 extern size_t _resolv_get_default_iface(char* buff, size_t buffLen);
 | 
			
		||||
 | 
			
		||||
/* sets the name server addresses to the provided res_state structure. The
 | 
			
		||||
 * name servers are retrieved from the cache which is associated
 | 
			
		||||
 * with the interface to which the res_state structure is associated */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern void _resolv_populate_res_for_iface(struct __res_state* statp);
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
    RESOLV_CACHE_UNSUPPORTED,  /* the cache can't handle that kind of queries */
 | 
			
		||||
@@ -77,6 +97,7 @@ typedef enum {
 | 
			
		||||
    RESOLV_CACHE_FOUND         /* the cache found the answer */
 | 
			
		||||
} ResolvCacheStatus;
 | 
			
		||||
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern ResolvCacheStatus
 | 
			
		||||
_resolv_cache_lookup( struct resolv_cache*  cache,
 | 
			
		||||
                      const void*           query,
 | 
			
		||||
@@ -88,6 +109,7 @@ _resolv_cache_lookup( struct resolv_cache*  cache,
 | 
			
		||||
/* add a (query,answer) to the cache, only call if _resolv_cache_lookup
 | 
			
		||||
 * did return RESOLV_CACHE_NOTFOUND
 | 
			
		||||
 */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern void
 | 
			
		||||
_resolv_cache_add( struct resolv_cache*  cache,
 | 
			
		||||
                   const void*           query,
 | 
			
		||||
@@ -96,6 +118,7 @@ _resolv_cache_add( struct resolv_cache*  cache,
 | 
			
		||||
                   int                   answerlen );
 | 
			
		||||
 | 
			
		||||
/* Notify the cache a request failed */
 | 
			
		||||
__LIBC_HIDDEN__
 | 
			
		||||
extern void
 | 
			
		||||
_resolv_cache_query_failed( struct resolv_cache* cache,
 | 
			
		||||
                   const void* query,
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,8 @@ __BEGIN_DECLS
 | 
			
		||||
extern void _resolv_set_default_iface(const char* ifname);
 | 
			
		||||
 | 
			
		||||
/* set name servers for an interface */
 | 
			
		||||
extern void _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers);
 | 
			
		||||
extern void _resolv_set_nameservers_for_iface(const char* ifname, const char** servers, int numservers,
 | 
			
		||||
        const char *domains);
 | 
			
		||||
 | 
			
		||||
/* tell resolver of the address of an interface */
 | 
			
		||||
extern void _resolv_set_addr_of_iface(const char* ifname, struct in_addr* addr);
 | 
			
		||||
@@ -59,6 +60,45 @@ extern void _resolv_flush_cache_for_default_iface();
 | 
			
		||||
/* flush the cache associated with a certain interface */
 | 
			
		||||
extern void _resolv_flush_cache_for_iface(const char* ifname);
 | 
			
		||||
 | 
			
		||||
/* set a pid to use the name servers of the specified interface */
 | 
			
		||||
extern void _resolv_set_iface_for_pid(const char* ifname, int pid);
 | 
			
		||||
 | 
			
		||||
/* clear pid from being associated with an interface */
 | 
			
		||||
extern void _resolv_clear_iface_for_pid(int pid);
 | 
			
		||||
 | 
			
		||||
/* clear the entire mapping of pids to interfaces. */
 | 
			
		||||
extern void _resolv_clear_iface_pid_mapping();
 | 
			
		||||
 | 
			
		||||
/** Gets the name of the interface to which the pid is attached.
 | 
			
		||||
 *  On error, -1 is returned.
 | 
			
		||||
 *  If no interface is found, 0 is returned and buff is set to empty ('\0').
 | 
			
		||||
 *  If an interface is found, the name is copied to buff and the length of the name is returned.
 | 
			
		||||
 *  Arguments:   pid The pid to find an interface for
 | 
			
		||||
 *               buff A buffer to copy the result to
 | 
			
		||||
 *               buffLen Length of buff. An interface is at most IF_NAMESIZE in length */
 | 
			
		||||
extern int _resolv_get_pids_associated_interface(int pid, char* buff, int buffLen);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/** set a uid range to use the name servers of the specified interface */
 | 
			
		||||
extern int _resolv_set_iface_for_uid_range(const char* ifname, int uid_start, int uid_end);
 | 
			
		||||
 | 
			
		||||
/** Remove a mapping added by _resolv_set_iface_for_uid_range.
 | 
			
		||||
 *  If no such rule exists -1 is returned. */
 | 
			
		||||
extern int _resolv_clear_iface_for_uid_range(const char* ifname, int uid_start, int uid_end);
 | 
			
		||||
 | 
			
		||||
/* clear the entire mapping of uid ranges to interfaces. */
 | 
			
		||||
extern void _resolv_clear_iface_uid_range_mapping();
 | 
			
		||||
 | 
			
		||||
/** Gets the name of the interface to which the uid is attached.
 | 
			
		||||
 *  On error, -1 is returned.
 | 
			
		||||
 *  If no interface is found, 0 is returned and buff is set to empty ('\0').
 | 
			
		||||
 *  If an interface is found, the name is copied to buff and the length of the name is returned.
 | 
			
		||||
 *  If there are multiple rules covering uid the most recently added rule will be returned.
 | 
			
		||||
 *  Arguments:   uid The uid to find an interface for
 | 
			
		||||
 *               buff A buffer to copy the result to
 | 
			
		||||
 *               buffLen Length of buff. An interface is at most IF_NAMESIZE in length */
 | 
			
		||||
extern int _resolv_get_uids_associated_interface(int uid, char* buff, int buffLen);
 | 
			
		||||
 | 
			
		||||
#endif /* _BIONIC_RESOLV_IFACE_FUNCTIONS_DECLARED */
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,7 @@
 | 
			
		||||
 | 
			
		||||
#include <resolv.h>
 | 
			
		||||
#include "resolv_static.h"
 | 
			
		||||
#include <net/if.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Revision information.  This is the release date in YYYYMMDD format.
 | 
			
		||||
@@ -141,6 +142,7 @@ struct res_sym {
 | 
			
		||||
struct __res_state_ext;
 | 
			
		||||
 | 
			
		||||
struct __res_state {
 | 
			
		||||
	char	iface[IF_NAMESIZE+1];
 | 
			
		||||
	int	retrans;	 	/* retransmission time interval */
 | 
			
		||||
	int	retry;			/* number of times to retransmit */
 | 
			
		||||
#ifdef sun
 | 
			
		||||
@@ -173,6 +175,7 @@ struct __res_state {
 | 
			
		||||
	res_send_qhook qhook;		/* query hook */
 | 
			
		||||
	res_send_rhook rhook;		/* response hook */
 | 
			
		||||
	int	res_h_errno;		/* last one set for this context */
 | 
			
		||||
	int _mark;          /* If non-0 SET_MARK to _mark on all request sockets */
 | 
			
		||||
	int	_vcsock;		/* PRIVATE: for res_send VC i/o */
 | 
			
		||||
	u_int	_flags;			/* PRIVATE: see below */
 | 
			
		||||
	u_int	_pad;			/* make _u 64 bit aligned */
 | 
			
		||||
@@ -487,7 +490,8 @@ void		res_setservers(res_state,
 | 
			
		||||
int		res_getservers(res_state,
 | 
			
		||||
				    union res_sockaddr_union *, int);
 | 
			
		||||
 | 
			
		||||
int res_get_dns_changed();
 | 
			
		||||
void res_setiface();
 | 
			
		||||
void res_setmark();
 | 
			
		||||
u_int  res_randomid(void);
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,15 @@
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#include "ctype_private.h"
 | 
			
		||||
 | 
			
		||||
#define _U _CTYPE_U
 | 
			
		||||
#define _L _CTYPE_L
 | 
			
		||||
#define _N _CTYPE_N
 | 
			
		||||
#define _S _CTYPE_S
 | 
			
		||||
#define _P _CTYPE_P
 | 
			
		||||
#define _C _CTYPE_C
 | 
			
		||||
#define _X _CTYPE_X
 | 
			
		||||
#define _B _CTYPE_B
 | 
			
		||||
 | 
			
		||||
const char _C_ctype_[1 + CTYPE_NUM_CHARS] = {
 | 
			
		||||
	0,
 | 
			
		||||
	_C,	_C,	_C,	_C,	_C,	_C,	_C,	_C,
 | 
			
		||||
@@ -77,6 +86,8 @@ const char _C_ctype_[1 + CTYPE_NUM_CHARS] = {
 | 
			
		||||
const char *_ctype_ = _C_ctype_;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// TODO: fix the header file so we don't have to duplicate all this inlined stuff.
 | 
			
		||||
 | 
			
		||||
#if 1 /* ndef NDEBUG */
 | 
			
		||||
int isalnum(int c)
 | 
			
		||||
{
 | 
			
		||||
@@ -155,4 +166,3 @@ int toascii(int c)
 | 
			
		||||
#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
 | 
			
		||||
 | 
			
		||||
#endif /* !NDBEUG */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								libc/string/memcmp16.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								libc/string/memcmp16.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright (c) 2013 Intel 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 Intel Corporation nor the names of its contributors
 | 
			
		||||
    * may be used to endorse or promote products derived from this software
 | 
			
		||||
    * without specific prior written permission.
 | 
			
		||||
 | 
			
		||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 | 
			
		||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 | 
			
		||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 | 
			
		||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 | 
			
		||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 | 
			
		||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
			
		||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 | 
			
		||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 | 
			
		||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 | 
			
		||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
 | 
			
		||||
/* Unoptimised version of __memcmp16 */
 | 
			
		||||
int __memcmp16(const unsigned short *ptr1, const unsigned short *ptr2, size_t n)
 | 
			
		||||
{
 | 
			
		||||
  size_t i;
 | 
			
		||||
 | 
			
		||||
  for (i = 0; i < n; i++) {
 | 
			
		||||
    if (*ptr1 != *ptr2)
 | 
			
		||||
      return *ptr1 - *ptr2;
 | 
			
		||||
    ptr1++;
 | 
			
		||||
    ptr2++;
 | 
			
		||||
  }
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user