Compare commits
	
		
			602 Commits
		
	
	
		
			jb-mr1-dev
			...
			jb-mr1.1-d
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					a8d06766c7 | ||
| 
						 | 
					061246b600 | ||
| 
						 | 
					d0f2a6014c | ||
| 
						 | 
					0995a7b322 | ||
| 
						 | 
					6fe4a58f84 | ||
| 
						 | 
					4cf1395217 | ||
| 
						 | 
					e8bd8c2ed9 | ||
| 
						 | 
					284f788032 | ||
| 
						 | 
					f8a66bb312 | ||
| 
						 | 
					4c6b925bac | ||
| 
						 | 
					8fa9081f48 | ||
| 
						 | 
					368860124c | ||
| 
						 | 
					2be511d405 | ||
| 
						 | 
					84114c8dd5 | ||
| 
						 | 
					40e7a87864 | ||
| 
						 | 
					107cdd406b | ||
| 
						 | 
					b7b36b819e | ||
| 
						 | 
					e459bba398 | ||
| 
						 | 
					2cf5a6f662 | ||
| 
						 | 
					d14dc3b87f | ||
| 
						 | 
					8c1b96681a | ||
| 
						 | 
					eb1b07469f | ||
| 
						 | 
					f63c28f033 | ||
| 
						 | 
					6f4fed74cb | ||
| 
						 | 
					9ad2a73ed6 | ||
| 
						 | 
					0aa9b52efa | ||
| 
						 | 
					f35e0c149f | ||
| 
						 | 
					5cf87951ab | ||
| 
						 | 
					026867c7dc | ||
| 
						 | 
					aa754dca90 | ||
| 
						 | 
					9562d38df1 | ||
| 
						 | 
					d4e753fea9 | ||
| 
						 | 
					f152e386fc | ||
| 
						 | 
					da4a3e6515 | ||
| 
						 | 
					67750c8515 | ||
| 
						 | 
					b95cf0d23a | ||
| 
						 | 
					59ed029b28 | ||
| 
						 | 
					ce4783ce76 | ||
| 
						 | 
					3db1f359e9 | ||
| 
						 | 
					ee178bfb79 | ||
| 
						 | 
					8a363692be | ||
| 
						 | 
					0dff43cab4 | ||
| 
						 | 
					d30877ae28 | ||
| 
						 | 
					6b1dd1797e | ||
| 
						 | 
					b7f4923752 | ||
| 
						 | 
					6184c1feaa | ||
| 
						 | 
					9d476716c2 | ||
| 
						 | 
					06040fd75c | ||
| 
						 | 
					4fc8a0c116 | ||
| 
						 | 
					c2cd33efc4 | ||
| 
						 | 
					ff145277da | ||
| 
						 | 
					5149de09ad | ||
| 
						 | 
					e31c45c9fa | ||
| 
						 | 
					3a040d8379 | ||
| 
						 | 
					6b33f31b09 | ||
| 
						 | 
					bfc6a59556 | ||
| 
						 | 
					e63ea6aca7 | ||
| 
						 | 
					e42e51d563 | ||
| 
						 | 
					84983592ad | ||
| 
						 | 
					e91f71783b | ||
| 
						 | 
					de2781d906 | ||
| 
						 | 
					f936ef1a9f | ||
| 
						 | 
					d7b0d6e1e1 | ||
| 
						 | 
					ebc8ce1de6 | ||
| 
						 | 
					2753e12af5 | ||
| 
						 | 
					87b4286f09 | ||
| 
						 | 
					b8e435c1d5 | ||
| 
						 | 
					feec97a7c7 | ||
| 
						 | 
					74f0833df6 | ||
| 
						 | 
					1ba3a2c269 | ||
| 
						 | 
					ce7c404dc7 | ||
| 
						 | 
					7c14d67bc1 | ||
| 
						 | 
					413eef716f | ||
| 
						 | 
					b61103dff4 | ||
| 
						 | 
					a6cde39276 | ||
| 
						 | 
					227b47a461 | ||
| 
						 | 
					ca43d73d23 | ||
| 
						 | 
					394df35e64 | ||
| 
						 | 
					5bcf39842e | ||
| 
						 | 
					78a7bf998d | ||
| 
						 | 
					c8ae8bd941 | ||
| 
						 | 
					fbec57d46c | ||
| 
						 | 
					5e9a086145 | ||
| 
						 | 
					1ec20a086c | ||
| 
						 | 
					b116bf7628 | ||
| 
						 | 
					995f17e6a9 | ||
| 
						 | 
					d278b828fe | ||
| 
						 | 
					c76550b337 | ||
| 
						 | 
					64a4f6adf7 | ||
| 
						 | 
					d206b560e7 | ||
| 
						 | 
					7d624e9aff | ||
| 
						 | 
					c45087bffa | ||
| 
						 | 
					bfacb603e4 | ||
| 
						 | 
					621b19dddb | ||
| 
						 | 
					1642edb520 | ||
| 
						 | 
					836dbf65e4 | ||
| 
						 | 
					1d36ee1a6e | ||
| 
						 | 
					1540f601be | ||
| 
						 | 
					996cdc4b1a | ||
| 
						 | 
					f7511e3bc9 | ||
| 
						 | 
					cb215a7e9e | ||
| 
						 | 
					0ea1d5c0ae | ||
| 
						 | 
					c6eb985454 | ||
| 
						 | 
					53ddcc9070 | ||
| 
						 | 
					c9084427aa | ||
| 
						 | 
					6819773103 | ||
| 
						 | 
					17fc25d20f | ||
| 
						 | 
					0ce28d20ea | ||
| 
						 | 
					8bafa7452e | ||
| 
						 | 
					4eed65090b | ||
| 
						 | 
					02ca0e3142 | ||
| 
						 | 
					3225f49848 | ||
| 
						 | 
					3cd4cac2ce | ||
| 
						 | 
					dc5d3426d8 | ||
| 
						 | 
					c6ff844d75 | ||
| 
						 | 
					c656d732c7 | ||
| 
						 | 
					a33dc57c7c | ||
| 
						 | 
					0846109c96 | ||
| 
						 | 
					dd0880fec3 | ||
| 
						 | 
					6807af773f | ||
| 
						 | 
					02002443d4 | ||
| 
						 | 
					e2fb05b45b | ||
| 
						 | 
					7e5a8cc523 | ||
| 
						 | 
					7d06813d93 | ||
| 
						 | 
					a641c18f0c | ||
| 
						 | 
					0005b3544b | ||
| 
						 | 
					7d90cfa6b5 | ||
| 
						 | 
					16d1af167f | ||
| 
						 | 
					b24c0637d0 | ||
| 
						 | 
					977a33137d | ||
| 
						 | 
					b27e200ad6 | ||
| 
						 | 
					5cf32de7a0 | ||
| 
						 | 
					5995bf880e | ||
| 
						 | 
					b6e340080a | ||
| 
						 | 
					657d0da751 | ||
| 
						 | 
					18bc975bfe | ||
| 
						 | 
					560e9f7e7a | ||
| 
						 | 
					7c89506e3a | ||
| 
						 | 
					c843a3e7b2 | ||
| 
						 | 
					4eeec44e29 | ||
| 
						 | 
					c843d7667a | ||
| 
						 | 
					0f020d18b1 | ||
| 
						 | 
					92e841d0aa | ||
| 
						 | 
					78419467a2 | ||
| 
						 | 
					6a44d2271f | ||
| 
						 | 
					2815b1dd45 | ||
| 
						 | 
					55189a0fbd | ||
| 
						 | 
					677ee56477 | ||
| 
						 | 
					f1867d47cb | ||
| 
						 | 
					9248d3a58c | ||
| 
						 | 
					55c5ec64bd | ||
| 
						 | 
					d8627af159 | ||
| 
						 | 
					944ea1a320 | ||
| 
						 | 
					61e699a133 | ||
| 
						 | 
					5cde15eb17 | ||
| 
						 | 
					2c157aec9b | ||
| 
						 | 
					b6e880200d | ||
| 
						 | 
					fd0325bd98 | ||
| 
						 | 
					fc104f899d | ||
| 
						 | 
					7e6ce1a3c5 | ||
| 
						 | 
					8252b8e4b7 | ||
| 
						 | 
					2fbc9dda34 | ||
| 
						 | 
					157c42997b | ||
| 
						 | 
					06708df6fb | ||
| 
						 | 
					9647f797d5 | ||
| 
						 | 
					885f3b9cad | ||
| 
						 | 
					e7dffe150b | ||
| 
						 | 
					b7b4f5b838 | ||
| 
						 | 
					156ccf42ff | ||
| 
						 | 
					18af450393 | ||
| 
						 | 
					36fa67bcdd | ||
| 
						 | 
					c5bfb62433 | ||
| 
						 | 
					8d36050ac2 | ||
| 
						 | 
					328223230b | ||
| 
						 | 
					94d0daa2dd | ||
| 
						 | 
					4c001859fe | ||
| 
						 | 
					a24e81efd3 | ||
| 
						 | 
					13476deec4 | ||
| 
						 | 
					0671393072 | ||
| 
						 | 
					6bec5b792a | ||
| 
						 | 
					404d491eb6 | ||
| 
						 | 
					a123b5d319 | ||
| 
						 | 
					8539961ff2 | ||
| 
						 | 
					cf870199d5 | ||
| 
						 | 
					0a490665a3 | ||
| 
						 | 
					72f59c84fd | ||
| 
						 | 
					8cc145edf4 | ||
| 
						 | 
					d515f46888 | ||
| 
						 | 
					4fe461b3a6 | ||
| 
						 | 
					8d79fd1c94 | ||
| 
						 | 
					e4c4ada580 | ||
| 
						 | 
					2317275f85 | ||
| 
						 | 
					615684c256 | ||
| 
						 | 
					25a87f7641 | ||
| 
						 | 
					f5f29de6ae | ||
| 
						 | 
					82dcc7910d | ||
| 
						 | 
					2e317075b0 | ||
| 
						 | 
					22bda4bd67 | ||
| 
						 | 
					5217fb528c | ||
| 
						 | 
					d35106fd55 | ||
| 
						 | 
					6f502bc743 | ||
| 
						 | 
					d04c183979 | ||
| 
						 | 
					349ef893e8 | ||
| 
						 | 
					b2e1abda05 | ||
| 
						 | 
					5b7b2809a2 | ||
| 
						 | 
					b0a2fc35d6 | ||
| 
						 | 
					f0f4fa3fb1 | ||
| 
						 | 
					4200e6203a | ||
| 
						 | 
					e1c58ab5bb | ||
| 
						 | 
					5c4340b2ab | ||
| 
						 | 
					7cb82791ca | ||
| 
						 | 
					23b9fd2c1d | ||
| 
						 | 
					d8a9cccb4d | ||
| 
						 | 
					bb0b09cad6 | ||
| 
						 | 
					98f7659d7e | ||
| 
						 | 
					8147d3c284 | ||
| 
						 | 
					ff220f7003 | ||
| 
						 | 
					63dd03cced | ||
| 
						 | 
					b9256adab3 | ||
| 
						 | 
					52171b9bdc | ||
| 
						 | 
					d541ba1719 | ||
| 
						 | 
					1c462b7a04 | ||
| 
						 | 
					b01f7afd5f | ||
| 
						 | 
					532d6f09b1 | ||
| 
						 | 
					e4ac8feb58 | ||
| 
						 | 
					4f40e511b0 | ||
| 
						 | 
					5e3b502b6b | ||
| 
						 | 
					277226bf43 | ||
| 
						 | 
					8c00c91aa0 | ||
| 
						 | 
					80541922e3 | ||
| 
						 | 
					bee0ab16e4 | ||
| 
						 | 
					3b2e6bc9ac | ||
| 
						 | 
					c46871302e | ||
| 
						 | 
					9020fd503c | ||
| 
						 | 
					b94b2851d7 | ||
| 
						 | 
					78d6d9888c | ||
| 
						 | 
					382a775378 | ||
| 
						 | 
					1aae9bd170 | ||
| 
						 | 
					c6dc62f09c | ||
| 
						 | 
					e66ad7809e | ||
| 
						 | 
					f7153fd13f | ||
| 
						 | 
					9ff1ffd805 | ||
| 
						 | 
					e7aaad8b83 | ||
| 
						 | 
					5f28fde8ae | ||
| 
						 | 
					8d3e91d4f8 | ||
| 
						 | 
					e8f46e8edd | ||
| 
						 | 
					87efcd2e63 | ||
| 
						 | 
					85aeb49144 | ||
| 
						 | 
					c705daa0a2 | ||
| 
						 | 
					21da42ea91 | ||
| 
						 | 
					2c60c18c50 | ||
| 
						 | 
					bda2fb5efa | ||
| 
						 | 
					676e66db25 | ||
| 
						 | 
					2379088a90 | ||
| 
						 | 
					70e0bd3a44 | ||
| 
						 | 
					f8dff7d449 | ||
| 
						 | 
					8c181aa8fe | ||
| 
						 | 
					516a897053 | ||
| 
						 | 
					b3c8c4d865 | ||
| 
						 | 
					796cbe249b | ||
| 
						 | 
					ea489745dc | ||
| 
						 | 
					0b25f633a2 | ||
| 
						 | 
					ed36d95fac | ||
| 
						 | 
					6b05c8e280 | ||
| 
						 | 
					b632857a50 | ||
| 
						 | 
					4ca685e36e | ||
| 
						 | 
					fc76c7d394 | ||
| 
						 | 
					bf0d1ad72b | ||
| 
						 | 
					68fd78efa0 | ||
| 
						 | 
					185ce72d00 | ||
| 
						 | 
					240fb8623b | ||
| 
						 | 
					0d787c1fa1 | ||
| 
						 | 
					014c75c78b | ||
| 
						 | 
					8baa929d5d | ||
| 
						 | 
					14c840df90 | ||
| 
						 | 
					a51916b58b | ||
| 
						 | 
					162b4411fc | ||
| 
						 | 
					4ace92c62a | ||
| 
						 | 
					7a29f404e1 | ||
| 
						 | 
					378b0e1ea2 | ||
| 
						 | 
					6bb17dfad3 | ||
| 
						 | 
					cfa089df23 | ||
| 
						 | 
					74b324ac09 | ||
| 
						 | 
					ce636ca088 | ||
| 
						 | 
					bd014c2e42 | ||
| 
						 | 
					e6ddfc55c8 | ||
| 
						 | 
					e51d75a9ac | ||
| 
						 | 
					65a8eb606f | ||
| 
						 | 
					48f25cef45 | ||
| 
						 | 
					a40751185f | ||
| 
						 | 
					3198850ea1 | ||
| 
						 | 
					1b91c6c11f | ||
| 
						 | 
					c019345a3a | ||
| 
						 | 
					cda62094ef | ||
| 
						 | 
					c37dd59956 | ||
| 
						 | 
					890c8ed6ef | ||
| 
						 | 
					34895c1bdf | ||
| 
						 | 
					5c5f303e4c | ||
| 
						 | 
					e7cb795cb6 | ||
| 
						 | 
					8794ece296 | ||
| 
						 | 
					56d161bb62 | ||
| 
						 | 
					4cdde5f123 | ||
| 
						 | 
					3323628d63 | ||
| 
						 | 
					5c2772f59d | ||
| 
						 | 
					babb72dc29 | ||
| 
						 | 
					a41ba2f0bf | ||
| 
						 | 
					26c815c489 | ||
| 
						 | 
					612333f671 | ||
| 
						 | 
					9724ce3a09 | ||
| 
						 | 
					4453c51c82 | ||
| 
						 | 
					8f7120bbac | ||
| 
						 | 
					a6cc67c9b5 | ||
| 
						 | 
					800ad8249a | ||
| 
						 | 
					8ecf225827 | ||
| 
						 | 
					6eb978c9bf | ||
| 
						 | 
					17a8b0db63 | ||
| 
						 | 
					86c3184972 | ||
| 
						 | 
					31dea25b8b | ||
| 
						 | 
					adeec09629 | ||
| 
						 | 
					ce532721aa | ||
| 
						 | 
					c14166477e | ||
| 
						 | 
					8f2a5a0b40 | ||
| 
						 | 
					e23ed8c644 | ||
| 
						 | 
					2eb44c5aa4 | ||
| 
						 | 
					4d696eb49d | ||
| 
						 | 
					af7f2f2fcf | ||
| 
						 | 
					d30b9f0912 | ||
| 
						 | 
					306a353825 | ||
| 
						 | 
					f861bc5cc3 | ||
| 
						 | 
					e0175ca7e4 | ||
| 
						 | 
					ec706c24ac | ||
| 
						 | 
					9aceab5015 | ||
| 
						 | 
					980508b0ea | ||
| 
						 | 
					04954a43b3 | ||
| 
						 | 
					94a34010c1 | ||
| 
						 | 
					cb2069bf69 | ||
| 
						 | 
					f21aa3b61e | ||
| 
						 | 
					ca0c11bd82 | ||
| 
						 | 
					6b4c77f854 | ||
| 
						 | 
					fa8c05dc00 | ||
| 
						 | 
					53630c0e5b | ||
| 
						 | 
					4a05bef4c0 | ||
| 
						 | 
					4b032ee9b9 | ||
| 
						 | 
					62c5cd0781 | ||
| 
						 | 
					cdb27f239b | ||
| 
						 | 
					b6e22482d4 | ||
| 
						 | 
					809eed1ded | ||
| 
						 | 
					0493a6f7be | ||
| 
						 | 
					c9f8081425 | ||
| 
						 | 
					6b3f49a537 | ||
| 
						 | 
					33031fed84 | ||
| 
						 | 
					2d4b9b7cff | ||
| 
						 | 
					db794197cc | ||
| 
						 | 
					642331b5dd | ||
| 
						 | 
					0b4a85bf1e | ||
| 
						 | 
					5e2492eb89 | ||
| 
						 | 
					20958207d5 | ||
| 
						 | 
					43cc7f795b | ||
| 
						 | 
					c41dcad040 | ||
| 
						 | 
					650be4e584 | ||
| 
						 | 
					036f909720 | ||
| 
						 | 
					d4ee82dfa3 | ||
| 
						 | 
					be21fe7a59 | ||
| 
						 | 
					69af6e61e1 | ||
| 
						 | 
					133d97e4b0 | ||
| 
						 | 
					cf9a9604ad | ||
| 
						 | 
					eb93ebffba | ||
| 
						 | 
					d392e044c7 | ||
| 
						 | 
					f0777843c0 | ||
| 
						 | 
					14283004f5 | ||
| 
						 | 
					c5c6cb3f13 | ||
| 
						 | 
					8f149da08d | ||
| 
						 | 
					305a999589 | ||
| 
						 | 
					66273ac2b6 | ||
| 
						 | 
					b3b1ab6213 | ||
| 
						 | 
					8fa924e5df | ||
| 
						 | 
					6524d3cad7 | ||
| 
						 | 
					eb149e954e | ||
| 
						 | 
					5b349fc22e | ||
| 
						 | 
					7fe8229b49 | ||
| 
						 | 
					9c1912c4bf | ||
| 
						 | 
					e255642dc1 | ||
| 
						 | 
					58b997c812 | ||
| 
						 | 
					f5f906c184 | ||
| 
						 | 
					7c0dd555c0 | ||
| 
						 | 
					406968b244 | ||
| 
						 | 
					c0e9ddd002 | ||
| 
						 | 
					701bec2af3 | ||
| 
						 | 
					7b8bf68133 | ||
| 
						 | 
					f6bb5bf498 | ||
| 
						 | 
					440bc83d92 | ||
| 
						 | 
					cadc858329 | ||
| 
						 | 
					7b2c6385ef | ||
| 
						 | 
					bc0e7ee181 | ||
| 
						 | 
					6f1b7a6407 | ||
| 
						 | 
					cf820d7e96 | ||
| 
						 | 
					b22a684990 | ||
| 
						 | 
					2a5b57db8c | ||
| 
						 | 
					580a707376 | ||
| 
						 | 
					538f6fc202 | ||
| 
						 | 
					398f46dd92 | ||
| 
						 | 
					a0259b42eb | ||
| 
						 | 
					11ebbc8437 | ||
| 
						 | 
					719d46f8ac | ||
| 
						 | 
					a9ff09d1fc | ||
| 
						 | 
					fae89fc404 | ||
| 
						 | 
					818b1423d2 | ||
| 
						 | 
					ccd403161c | ||
| 
						 | 
					c641cafbc3 | ||
| 
						 | 
					593abb7b59 | ||
| 
						 | 
					eeecff7293 | ||
| 
						 | 
					9d23e04c43 | ||
| 
						 | 
					b5862d4d8a | ||
| 
						 | 
					aa772a33ba | ||
| 
						 | 
					61ba9b526b | ||
| 
						 | 
					7f67f78ad5 | ||
| 
						 | 
					081318e355 | ||
| 
						 | 
					39804dcde6 | ||
| 
						 | 
					40eabe24e4 | ||
| 
						 | 
					3e3b239d2b | ||
| 
						 | 
					7fd803cdfa | ||
| 
						 | 
					0a2cb81597 | ||
| 
						 | 
					b128f49fd5 | ||
| 
						 | 
					fb7eb5e07f | ||
| 
						 | 
					0276656daa | ||
| 
						 | 
					c2d26ce745 | ||
| 
						 | 
					dc5ec07158 | ||
| 
						 | 
					fe33fc790a | ||
| 
						 | 
					a261afb7c9 | ||
| 
						 | 
					6b97c7dc03 | ||
| 
						 | 
					97f2ec50a7 | ||
| 
						 | 
					26a13bcfb8 | ||
| 
						 | 
					d2547040a1 | ||
| 
						 | 
					95b1ea1bb3 | ||
| 
						 | 
					6719500dbd | ||
| 
						 | 
					2fee0340a9 | ||
| 
						 | 
					73964c592c | ||
| 
						 | 
					627274292e | ||
| 
						 | 
					d8213bb573 | ||
| 
						 | 
					f659b3c90d | ||
| 
						 | 
					d3b9d11369 | ||
| 
						 | 
					3002d64bcd | ||
| 
						 | 
					9cbe1e63dd | ||
| 
						 | 
					b6032515a0 | ||
| 
						 | 
					91a9925998 | ||
| 
						 | 
					baf2c09f3f | ||
| 
						 | 
					5227663d2f | ||
| 
						 | 
					59aeff9417 | ||
| 
						 | 
					07f7e62a25 | ||
| 
						 | 
					899d65283d | ||
| 
						 | 
					9701d4b701 | ||
| 
						 | 
					4b4a882428 | ||
| 
						 | 
					991ee7d895 | ||
| 
						 | 
					6d33918207 | ||
| 
						 | 
					4912782c6a | ||
| 
						 | 
					9f878c2fca | ||
| 
						 | 
					558a8b1d3b | ||
| 
						 | 
					3e898476c7 | ||
| 
						 | 
					3fa6746536 | ||
| 
						 | 
					bfa199ab40 | ||
| 
						 | 
					a2a9817f4c | ||
| 
						 | 
					605cc29358 | ||
| 
						 | 
					8e2b28cb6c | ||
| 
						 | 
					bdff26df27 | ||
| 
						 | 
					c440d24423 | ||
| 
						 | 
					03798dd23c | ||
| 
						 | 
					6b73d13fa4 | ||
| 
						 | 
					e4b08318c1 | ||
| 
						 | 
					024246ec27 | ||
| 
						 | 
					8f509e8be1 | ||
| 
						 | 
					636d21f32b | ||
| 
						 | 
					f156b901b1 | ||
| 
						 | 
					86e4e23408 | ||
| 
						 | 
					5bb67760f0 | ||
| 
						 | 
					8ddef40dad | ||
| 
						 | 
					6f67cd224e | ||
| 
						 | 
					4e9d9e4df8 | ||
| 
						 | 
					09559dd046 | ||
| 
						 | 
					d2a6d8d77d | ||
| 
						 | 
					5fe286618f | ||
| 
						 | 
					0e51a86124 | ||
| 
						 | 
					df8c72e510 | ||
| 
						 | 
					3cbcb87bd1 | ||
| 
						 | 
					384bdb3776 | ||
| 
						 | 
					ada6de673b | ||
| 
						 | 
					16444e0f85 | ||
| 
						 | 
					33e4365d87 | ||
| 
						 | 
					422c400dd3 | ||
| 
						 | 
					704d9c5b45 | ||
| 
						 | 
					ff26e25b51 | ||
| 
						 | 
					9743d7fb60 | ||
| 
						 | 
					fb55511e71 | ||
| 
						 | 
					9d43c07987 | ||
| 
						 | 
					4e8825038e | ||
| 
						 | 
					5821e11d0b | ||
| 
						 | 
					7bc49fcfc0 | ||
| 
						 | 
					9d995d6721 | ||
| 
						 | 
					0a383883fa | ||
| 
						 | 
					a7f44b5afe | ||
| 
						 | 
					1cc09402e8 | ||
| 
						 | 
					be11de2b52 | ||
| 
						 | 
					172e038f9e | ||
| 
						 | 
					f5d6238c4b | ||
| 
						 | 
					3f20ecc204 | ||
| 
						 | 
					2218b89ca7 | ||
| 
						 | 
					d383ac1570 | ||
| 
						 | 
					d265d36749 | ||
| 
						 | 
					f07db75443 | ||
| 
						 | 
					88af723267 | ||
| 
						 | 
					2ebcd19cbc | ||
| 
						 | 
					7ae998456c | ||
| 
						 | 
					27818d2a16 | ||
| 
						 | 
					151e91e66c | ||
| 
						 | 
					da2d2c618c | ||
| 
						 | 
					b8726037ee | ||
| 
						 | 
					e7d937b52f | ||
| 
						 | 
					c08ab018ad | ||
| 
						 | 
					ce8732b188 | ||
| 
						 | 
					40107623b0 | ||
| 
						 | 
					552e02fa9c | ||
| 
						 | 
					a8e0f2b956 | ||
| 
						 | 
					b16ec16288 | ||
| 
						 | 
					5f79f75ba6 | ||
| 
						 | 
					57edf36c5f | ||
| 
						 | 
					ad551eaa04 | ||
| 
						 | 
					5f7b6b8301 | ||
| 
						 | 
					1029364ec5 | ||
| 
						 | 
					e8e1f34a33 | ||
| 
						 | 
					0dfb2ecaab | ||
| 
						 | 
					0609c0fe8d | ||
| 
						 | 
					98ae1a85b0 | ||
| 
						 | 
					e652ed3051 | ||
| 
						 | 
					04afcd25a3 | ||
| 
						 | 
					8ef83bc46e | ||
| 
						 | 
					4cd5703b9e | ||
| 
						 | 
					75b64a1b64 | ||
| 
						 | 
					9468ee53ac | ||
| 
						 | 
					f246ae984b | ||
| 
						 | 
					8e833972c2 | ||
| 
						 | 
					0a0c232167 | ||
| 
						 | 
					a4723742c1 | ||
| 
						 | 
					261e9d08db | ||
| 
						 | 
					36c4eb188c | ||
| 
						 | 
					3a72fe587f | ||
| 
						 | 
					91bc5865a3 | ||
| 
						 | 
					8d01c0557b | ||
| 
						 | 
					27ff1ae414 | ||
| 
						 | 
					079e435655 | ||
| 
						 | 
					de666485b8 | ||
| 
						 | 
					30894bdfd6 | ||
| 
						 | 
					b989c9ceda | ||
| 
						 | 
					e05709b1df | ||
| 
						 | 
					e611fad0d0 | ||
| 
						 | 
					04aa0fdda6 | ||
| 
						 | 
					42c5847d65 | ||
| 
						 | 
					d29c9fc188 | ||
| 
						 | 
					4130af46bf | ||
| 
						 | 
					1519690cfb | ||
| 
						 | 
					763d4bb345 | ||
| 
						 | 
					13bd37160e | ||
| 
						 | 
					375db86aea | ||
| 
						 | 
					bc3c718346 | ||
| 
						 | 
					fdd6dfa863 | ||
| 
						 | 
					07564f2d3a | ||
| 
						 | 
					d0f81466e4 | ||
| 
						 | 
					801aeefe2d | ||
| 
						 | 
					0f9be1eaee | ||
| 
						 | 
					34c7a3c2b0 | ||
| 
						 | 
					4ff6fa97e7 | ||
| 
						 | 
					5c5fe07e43 | ||
| 
						 | 
					79cecbd421 | ||
| 
						 | 
					2458d06fc1 | ||
| 
						 | 
					ec1370191e | ||
| 
						 | 
					81508de3d2 | ||
| 
						 | 
					c654f4fda8 | ||
| 
						 | 
					1287d106ed | ||
| 
						 | 
					c0c05ff8ec | ||
| 
						 | 
					df5c77c91a | ||
| 
						 | 
					5fd31f6891 | ||
| 
						 | 
					a0edecf343 | ||
| 
						 | 
					607bd47707 | ||
| 
						 | 
					f822e7f68e | ||
| 
						 | 
					28996f8006 | ||
| 
						 | 
					080210c16a | ||
| 
						 | 
					79e1a01e9e | ||
| 
						 | 
					8717c3db2f | ||
| 
						 | 
					ded6e3bfca | ||
| 
						 | 
					3960fb602c | ||
| 
						 | 
					43701d68a9 | ||
| 
						 | 
					4140d90c60 | ||
| 
						 | 
					7beaa5024f | ||
| 
						 | 
					4835e6ef51 | ||
| 
						 | 
					55210f74c7 | ||
| 
						 | 
					c5861c09d5 | ||
| 
						 | 
					d6d5cbb02a | ||
| 
						 | 
					9ea86011a2 | ||
| 
						 | 
					852935b68f | ||
| 
						 | 
					56eb0bfedb | ||
| 
						 | 
					ef7eea5538 | ||
| 
						 | 
					5115d4348e | ||
| 
						 | 
					940e4c9d92 | ||
| 
						 | 
					f61e50201b | 
							
								
								
									
										15
									
								
								ABI-bugs.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								ABI-bugs.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
KNOWN ABI BUGS
 | 
			
		||||
--------------
 | 
			
		||||
 | 
			
		||||
  time_t is 32-bit. http://b/5819737
 | 
			
		||||
 | 
			
		||||
  off_t is 32-bit. There is off64_t, but no _FILE_OFFSET_BITS support.
 | 
			
		||||
 | 
			
		||||
  sigset_t is too small on ARM and x86 (but correct on MIPS), so support
 | 
			
		||||
  for real-time signals is broken. http://b/5828899
 | 
			
		||||
 | 
			
		||||
  Too few TLS slots mean we can't allocate 128 pthread_key_t instances,
 | 
			
		||||
  which POSIX says should be the minimum.
 | 
			
		||||
 | 
			
		||||
  atexit(3) handlers registered by a shared library aren't called on
 | 
			
		||||
  dlclose(3); this only affects ARM. http://b/4998315
 | 
			
		||||
							
								
								
									
										465
									
								
								libc/Android.mk
									
									
									
									
									
								
							
							
						
						
									
										465
									
								
								libc/Android.mk
									
									
									
									
									
								
							@@ -6,68 +6,33 @@ include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk
 | 
			
		||||
# =========================================================
 | 
			
		||||
libc_common_src_files := \
 | 
			
		||||
	$(syscall_src) \
 | 
			
		||||
	unistd/abort.c \
 | 
			
		||||
	unistd/alarm.c \
 | 
			
		||||
	unistd/exec.c \
 | 
			
		||||
	unistd/fnmatch.c \
 | 
			
		||||
	unistd/getopt_long.c \
 | 
			
		||||
	unistd/popen.c \
 | 
			
		||||
	unistd/syslog.c \
 | 
			
		||||
	unistd/system.c \
 | 
			
		||||
	unistd/time.c \
 | 
			
		||||
	stdio/asprintf.c \
 | 
			
		||||
	stdio/clrerr.c \
 | 
			
		||||
	stdio/fclose.c \
 | 
			
		||||
	stdio/fdopen.c \
 | 
			
		||||
	stdio/feof.c \
 | 
			
		||||
	stdio/ferror.c \
 | 
			
		||||
	stdio/fflush.c \
 | 
			
		||||
	stdio/fgetc.c \
 | 
			
		||||
	stdio/fgetln.c \
 | 
			
		||||
	stdio/fgetpos.c \
 | 
			
		||||
	stdio/fgets.c \
 | 
			
		||||
	stdio/fileno.c \
 | 
			
		||||
	stdio/findfp.c \
 | 
			
		||||
	stdio/flags.c \
 | 
			
		||||
	stdio/fopen.c \
 | 
			
		||||
	stdio/fprintf.c \
 | 
			
		||||
	stdio/fpurge.c \
 | 
			
		||||
	stdio/fputc.c \
 | 
			
		||||
	stdio/fputs.c \
 | 
			
		||||
	stdio/fread.c \
 | 
			
		||||
	stdio/freopen.c \
 | 
			
		||||
	stdio/fscanf.c \
 | 
			
		||||
	stdio/fseek.c \
 | 
			
		||||
	stdio/fsetpos.c \
 | 
			
		||||
	stdio/ftell.c \
 | 
			
		||||
	stdio/funopen.c \
 | 
			
		||||
	stdio/fvwrite.c \
 | 
			
		||||
	stdio/fwalk.c \
 | 
			
		||||
	stdio/fwrite.c \
 | 
			
		||||
	stdio/getc.c \
 | 
			
		||||
	stdio/getchar.c \
 | 
			
		||||
	stdio/gets.c \
 | 
			
		||||
	stdio/makebuf.c \
 | 
			
		||||
	stdio/mktemp.c \
 | 
			
		||||
	stdio/printf.c \
 | 
			
		||||
	stdio/putc.c \
 | 
			
		||||
	stdio/putchar.c \
 | 
			
		||||
	stdio/puts.c \
 | 
			
		||||
	stdio/putw.c \
 | 
			
		||||
	stdio/refill.c \
 | 
			
		||||
	stdio/remove.c \
 | 
			
		||||
	stdio/rewind.c \
 | 
			
		||||
	stdio/rget.c \
 | 
			
		||||
	stdio/scanf.c \
 | 
			
		||||
	stdio/setbuf.c \
 | 
			
		||||
	stdio/setbuffer.c \
 | 
			
		||||
	stdio/setvbuf.c \
 | 
			
		||||
	stdio/snprintf.c\
 | 
			
		||||
	stdio/sprintf.c \
 | 
			
		||||
	stdio/sscanf.c \
 | 
			
		||||
	stdio/stdio.c \
 | 
			
		||||
	stdio/tempnam.c \
 | 
			
		||||
	stdio/tmpnam.c \
 | 
			
		||||
	stdio/ungetc.c \
 | 
			
		||||
	stdio/vasprintf.c \
 | 
			
		||||
	stdio/vfprintf.c \
 | 
			
		||||
@@ -78,13 +43,11 @@ libc_common_src_files := \
 | 
			
		||||
	stdio/vscanf.c \
 | 
			
		||||
	stdio/vsscanf.c \
 | 
			
		||||
	stdio/wbuf.c \
 | 
			
		||||
	stdio/wsetup.c \
 | 
			
		||||
	stdlib/atexit.c \
 | 
			
		||||
	stdlib/ctype_.c \
 | 
			
		||||
	stdlib/exit.c \
 | 
			
		||||
	stdlib/getenv.c \
 | 
			
		||||
	stdlib/putenv.c \
 | 
			
		||||
	stdlib/qsort.c \
 | 
			
		||||
	stdlib/setenv.c \
 | 
			
		||||
	stdlib/strtod.c \
 | 
			
		||||
	stdlib/strtoimax.c \
 | 
			
		||||
@@ -95,56 +58,17 @@ libc_common_src_files := \
 | 
			
		||||
	stdlib/strtoumax.c \
 | 
			
		||||
	stdlib/tolower_.c \
 | 
			
		||||
	stdlib/toupper_.c \
 | 
			
		||||
	string/index.c \
 | 
			
		||||
	string/strcasecmp.c \
 | 
			
		||||
	string/strcat.c \
 | 
			
		||||
	string/strchr.c \
 | 
			
		||||
	string/strcspn.c \
 | 
			
		||||
	string/strdup.c \
 | 
			
		||||
	string/strlcat.c \
 | 
			
		||||
	string/strlcpy.c \
 | 
			
		||||
	string/strncat.c \
 | 
			
		||||
	string/strncpy.c \
 | 
			
		||||
	string/strpbrk.c \
 | 
			
		||||
	string/strrchr.c \
 | 
			
		||||
	string/__strrchr_chk.c \
 | 
			
		||||
	string/strsep.c \
 | 
			
		||||
	string/strspn.c \
 | 
			
		||||
	string/strstr.c \
 | 
			
		||||
	string/strtok.c \
 | 
			
		||||
	wchar/wcpcpy.c \
 | 
			
		||||
	wchar/wcpncpy.c \
 | 
			
		||||
	wchar/wcscasecmp.c \
 | 
			
		||||
	wchar/wcscat.c \
 | 
			
		||||
	wchar/wcschr.c \
 | 
			
		||||
	wchar/wcscmp.c \
 | 
			
		||||
	wchar/wcscpy.c \
 | 
			
		||||
	wchar/wcscspn.c \
 | 
			
		||||
	wchar/wcsdup.c \
 | 
			
		||||
	wchar/wcslcat.c \
 | 
			
		||||
	wchar/wcslcpy.c \
 | 
			
		||||
	wchar/wcslen.c \
 | 
			
		||||
	wchar/wcsncasecmp.c \
 | 
			
		||||
	wchar/wcsncat.c \
 | 
			
		||||
	wchar/wcsncmp.c \
 | 
			
		||||
	wchar/wcsncpy.c \
 | 
			
		||||
	wchar/wcsnlen.c \
 | 
			
		||||
	wchar/wcspbrk.c \
 | 
			
		||||
	wchar/wcsrchr.c \
 | 
			
		||||
	wchar/wcsspn.c \
 | 
			
		||||
	wchar/wcsstr.c \
 | 
			
		||||
	wchar/wcstok.c \
 | 
			
		||||
	wchar/wcswidth.c \
 | 
			
		||||
	wchar/wcsxfrm.c \
 | 
			
		||||
	wchar/wmemchr.c \
 | 
			
		||||
	wchar/wmemcmp.c \
 | 
			
		||||
	wchar/wmemcpy.c \
 | 
			
		||||
	wchar/wmemmove.c \
 | 
			
		||||
	wchar/wmemset.c \
 | 
			
		||||
	tzcode/asctime.c \
 | 
			
		||||
	tzcode/difftime.c \
 | 
			
		||||
	tzcode/localtime.c \
 | 
			
		||||
	tzcode/strftime.c \
 | 
			
		||||
	tzcode/strptime.c \
 | 
			
		||||
	bionic/arc4random.c \
 | 
			
		||||
	bionic/atoi.c \
 | 
			
		||||
	bionic/atol.c \
 | 
			
		||||
@@ -177,15 +101,10 @@ libc_common_src_files := \
 | 
			
		||||
	bionic/isatty.c \
 | 
			
		||||
	bionic/issetugid.c \
 | 
			
		||||
	bionic/ldexp.c \
 | 
			
		||||
	bionic/logd_write.c \
 | 
			
		||||
	bionic/lseek64.c \
 | 
			
		||||
	bionic/md5.c \
 | 
			
		||||
	bionic/memchr.c \
 | 
			
		||||
	bionic/memmem.c \
 | 
			
		||||
	bionic/memmove_words.c \
 | 
			
		||||
	bionic/memrchr.c \
 | 
			
		||||
	bionic/memswap.c \
 | 
			
		||||
	bionic/mmap.c \
 | 
			
		||||
	bionic/openat.c \
 | 
			
		||||
	bionic/open.c \
 | 
			
		||||
	bionic/pathconf.c \
 | 
			
		||||
@@ -196,12 +115,10 @@ libc_common_src_files := \
 | 
			
		||||
	bionic/ptsname_r.c \
 | 
			
		||||
	bionic/pututline.c \
 | 
			
		||||
	bionic/pwrite.c \
 | 
			
		||||
	bionic/realpath.c \
 | 
			
		||||
	bionic/reboot.c \
 | 
			
		||||
	bionic/recv.c \
 | 
			
		||||
	bionic/sched_cpualloc.c \
 | 
			
		||||
	bionic/sched_cpucount.c \
 | 
			
		||||
	bionic/sched_getaffinity.c \
 | 
			
		||||
	bionic/sched_getcpu.c \
 | 
			
		||||
	bionic/semaphore.c \
 | 
			
		||||
	bionic/send.c \
 | 
			
		||||
@@ -221,11 +138,11 @@ libc_common_src_files := \
 | 
			
		||||
	bionic/sleep.c \
 | 
			
		||||
	bionic/statfs.c \
 | 
			
		||||
	bionic/strndup.c \
 | 
			
		||||
	bionic/strnlen.c \
 | 
			
		||||
	bionic/strntoimax.c \
 | 
			
		||||
	bionic/strntoumax.c \
 | 
			
		||||
	bionic/strtotimeval.c \
 | 
			
		||||
	bionic/system_properties.c \
 | 
			
		||||
	bionic/system_properties_compat.c \
 | 
			
		||||
	bionic/tcgetpgrp.c \
 | 
			
		||||
	bionic/tcsetpgrp.c \
 | 
			
		||||
	bionic/thread_atexit.c \
 | 
			
		||||
@@ -234,7 +151,6 @@ libc_common_src_files := \
 | 
			
		||||
	bionic/unlockpt.c \
 | 
			
		||||
	bionic/usleep.c \
 | 
			
		||||
	bionic/utmp.c \
 | 
			
		||||
	bionic/wait.c \
 | 
			
		||||
	bionic/wcscoll.c \
 | 
			
		||||
	netbsd/gethnamaddr.c \
 | 
			
		||||
	netbsd/inet/nsap_addr.c \
 | 
			
		||||
@@ -266,27 +182,46 @@ libc_common_src_files := \
 | 
			
		||||
	netbsd/nameser/ns_samedomain.c \
 | 
			
		||||
 | 
			
		||||
libc_bionic_src_files := \
 | 
			
		||||
    bionic/abort.cpp \
 | 
			
		||||
    bionic/assert.cpp \
 | 
			
		||||
    bionic/brk.cpp \
 | 
			
		||||
    bionic/debug_format.cpp \
 | 
			
		||||
    bionic/dirent.cpp \
 | 
			
		||||
    bionic/eventfd.cpp \
 | 
			
		||||
    bionic/__errno.c \
 | 
			
		||||
    bionic/eventfd_read.cpp \
 | 
			
		||||
    bionic/eventfd_write.cpp \
 | 
			
		||||
    bionic/__fgets_chk.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 \
 | 
			
		||||
    bionic/pthread_equal.cpp \
 | 
			
		||||
    bionic/pthread_getcpuclockid.cpp \
 | 
			
		||||
    bionic/pthread_getschedparam.cpp \
 | 
			
		||||
    bionic/pthread_internals.cpp \
 | 
			
		||||
    bionic/pthread_join.cpp \
 | 
			
		||||
    bionic/pthread_kill.cpp \
 | 
			
		||||
    bionic/pthread_self.cpp \
 | 
			
		||||
    bionic/pthread_setname_np.cpp \
 | 
			
		||||
    bionic/pthread_setschedparam.cpp \
 | 
			
		||||
    bionic/pthread_sigmask.cpp \
 | 
			
		||||
    bionic/raise.cpp \
 | 
			
		||||
    bionic/sbrk.cpp \
 | 
			
		||||
    bionic/scandir.cpp \
 | 
			
		||||
    bionic/sched_getaffinity.cpp \
 | 
			
		||||
    bionic/__set_errno.cpp \
 | 
			
		||||
    bionic/setlocale.cpp \
 | 
			
		||||
    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 \
 | 
			
		||||
@@ -297,13 +232,80 @@ libc_bionic_src_files := \
 | 
			
		||||
    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 \
 | 
			
		||||
 | 
			
		||||
libc_tzcode_src_files := \
 | 
			
		||||
    tzcode/asctime.c \
 | 
			
		||||
    tzcode/difftime.c \
 | 
			
		||||
    tzcode/localtime.c \
 | 
			
		||||
    tzcode/strftime.c \
 | 
			
		||||
    tzcode/strptime.c \
 | 
			
		||||
 | 
			
		||||
libc_upstream_freebsd_src_files := \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/clrerr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fclose.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fdopen.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/feof.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/ferror.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fgetln.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fgetpos.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fgets.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fileno.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/flags.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fopen.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fpurge.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fputs.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fsetpos.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/funopen.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fwalk.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/fwrite.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/getc.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/getchar.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/makebuf.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/mktemp.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/putc.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/putchar.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/puts.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/putw.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/remove.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/rget.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/setbuf.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/setbuffer.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdio/setvbuf.c \
 | 
			
		||||
    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/getopt_long.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/qsort.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/stdlib/realpath.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcpcpy.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcpncpy.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscasecmp.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcscspn.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsdup.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcslcat.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcslcpy.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsncasecmp.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsncat.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsncmp.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsncpy.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsnlen.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcspbrk.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsspn.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsstr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcstok.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemchr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemcpy.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemmove.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemset.c \
 | 
			
		||||
 | 
			
		||||
libc_upstream_netbsd_src_files := \
 | 
			
		||||
    upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
 | 
			
		||||
    upstream-netbsd/common/lib/libc/inet/inet_addr.c \
 | 
			
		||||
@@ -311,6 +313,7 @@ libc_upstream_netbsd_src_files := \
 | 
			
		||||
    upstream-netbsd/libc/gen/ftw.c \
 | 
			
		||||
    upstream-netbsd/libc/gen/nftw.c \
 | 
			
		||||
    upstream-netbsd/libc/gen/nice.c \
 | 
			
		||||
    upstream-netbsd/libc/gen/popen.c \
 | 
			
		||||
    upstream-netbsd/libc/gen/psignal.c \
 | 
			
		||||
    upstream-netbsd/libc/gen/setjmperr.c \
 | 
			
		||||
    upstream-netbsd/libc/gen/utime.c \
 | 
			
		||||
@@ -347,54 +350,31 @@ libc_upstream_netbsd_src_files := \
 | 
			
		||||
    upstream-netbsd/libc/string/strxfrm.c \
 | 
			
		||||
    upstream-netbsd/libc/unistd/killpg.c \
 | 
			
		||||
 | 
			
		||||
# The following files are common, but must be compiled
 | 
			
		||||
# with different C flags when building a static C library.
 | 
			
		||||
#
 | 
			
		||||
# The reason for this is the implementation of __get_tls()
 | 
			
		||||
# that will differ between the shared and static versions
 | 
			
		||||
# of the library.
 | 
			
		||||
#
 | 
			
		||||
# See comments in private/bionic_tls.h for more details.
 | 
			
		||||
#
 | 
			
		||||
# NOTE: bionic/pthread.c is added later to this list
 | 
			
		||||
#       because it needs special handling on ARM, see
 | 
			
		||||
#       below.
 | 
			
		||||
#
 | 
			
		||||
libc_static_common_src_files := \
 | 
			
		||||
        bionic/__errno.c \
 | 
			
		||||
        bionic/sysconf.cpp \
 | 
			
		||||
 | 
			
		||||
# Architecture specific source files go here
 | 
			
		||||
# =========================================================
 | 
			
		||||
ifeq ($(TARGET_ARCH),arm)
 | 
			
		||||
libc_common_src_files += \
 | 
			
		||||
	arch-arm/bionic/abort_arm.S \
 | 
			
		||||
	arch-arm/bionic/atomics_arm.c \
 | 
			
		||||
	arch-arm/bionic/clone.S \
 | 
			
		||||
	arch-arm/bionic/eabi.c \
 | 
			
		||||
	arch-arm/bionic/_exit_with_stack_teardown.S \
 | 
			
		||||
	arch-arm/bionic/ffs.S \
 | 
			
		||||
	arch-arm/bionic/futex_arm.S \
 | 
			
		||||
	arch-arm/bionic/__get_sp.S \
 | 
			
		||||
	arch-arm/bionic/kill.S \
 | 
			
		||||
	arch-arm/bionic/libgcc_compat.c \
 | 
			
		||||
	arch-arm/bionic/memcmp16.S \
 | 
			
		||||
	arch-arm/bionic/memcmp.S \
 | 
			
		||||
	arch-arm/bionic/memcpy.S \
 | 
			
		||||
	arch-arm/bionic/memset.S \
 | 
			
		||||
	arch-arm/bionic/_setjmp.S \
 | 
			
		||||
	arch-arm/bionic/setjmp.S \
 | 
			
		||||
	arch-arm/bionic/sigsetjmp.S \
 | 
			
		||||
	arch-arm/bionic/strcmp.S \
 | 
			
		||||
	arch-arm/bionic/strcpy.S \
 | 
			
		||||
	arch-arm/bionic/strlen.c.arm \
 | 
			
		||||
	arch-arm/bionic/syscall.S \
 | 
			
		||||
	arch-arm/bionic/tgkill.S \
 | 
			
		||||
	arch-arm/bionic/tkill.S \
 | 
			
		||||
	bionic/memmove.c.arm \
 | 
			
		||||
	bionic/socketcalls.c \
 | 
			
		||||
	string/bcopy.c \
 | 
			
		||||
	string/strncmp.c \
 | 
			
		||||
	string/strcat.c \
 | 
			
		||||
	string/strncat.c \
 | 
			
		||||
	string/strncpy.c \
 | 
			
		||||
	bionic/strchr.cpp \
 | 
			
		||||
	string/strrchr.c \
 | 
			
		||||
	bionic/memchr.c \
 | 
			
		||||
	bionic/memrchr.c \
 | 
			
		||||
	string/index.c \
 | 
			
		||||
	bionic/strnlen.c \
 | 
			
		||||
	string/strlcat.c \
 | 
			
		||||
	string/strlcpy.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcschr.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcsrchr.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcscmp.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcscpy.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wmemcmp.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcslen.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcscat.c
 | 
			
		||||
 | 
			
		||||
# These files need to be arm so that gdbserver
 | 
			
		||||
# can set breakpoints in them without messing
 | 
			
		||||
@@ -407,85 +387,50 @@ libc_common_src_files += \
 | 
			
		||||
 | 
			
		||||
libc_static_common_src_files += \
 | 
			
		||||
    bionic/pthread.c.arm \
 | 
			
		||||
    bionic/pthread_create.cpp.arm \
 | 
			
		||||
    bionic/pthread_key.cpp.arm \
 | 
			
		||||
 | 
			
		||||
# these are used by the static and dynamic versions of the libc
 | 
			
		||||
# respectively
 | 
			
		||||
libc_arch_static_src_files := \
 | 
			
		||||
	arch-arm/bionic/exidx_static.c
 | 
			
		||||
 | 
			
		||||
libc_arch_dynamic_src_files := \
 | 
			
		||||
	arch-arm/bionic/exidx_dynamic.c
 | 
			
		||||
endif # arm
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_ARCH),x86)
 | 
			
		||||
libc_common_src_files += \
 | 
			
		||||
	arch-x86/bionic/__get_sp.S \
 | 
			
		||||
	arch-x86/bionic/__get_tls.c \
 | 
			
		||||
	arch-x86/bionic/__set_tls.c \
 | 
			
		||||
	arch-x86/bionic/clone.S \
 | 
			
		||||
	arch-x86/bionic/_exit_with_stack_teardown.S \
 | 
			
		||||
	arch-x86/bionic/futex_x86.S \
 | 
			
		||||
	arch-x86/bionic/setjmp.S \
 | 
			
		||||
	arch-x86/bionic/_setjmp.S \
 | 
			
		||||
	arch-x86/bionic/sigsetjmp.S \
 | 
			
		||||
	arch-x86/bionic/vfork.S \
 | 
			
		||||
	arch-x86/bionic/syscall.S \
 | 
			
		||||
	arch-x86/string/bcopy_wrapper.S \
 | 
			
		||||
	arch-x86/string/memcpy_wrapper.S \
 | 
			
		||||
	arch-x86/string/memmove_wrapper.S \
 | 
			
		||||
	arch-x86/string/bzero_wrapper.S \
 | 
			
		||||
	arch-x86/string/memcmp_wrapper.S \
 | 
			
		||||
	arch-x86/string/memset_wrapper.S \
 | 
			
		||||
	arch-x86/string/strcmp_wrapper.S \
 | 
			
		||||
	arch-x86/string/strncmp_wrapper.S \
 | 
			
		||||
	arch-x86/string/strlen_wrapper.S \
 | 
			
		||||
	string/strcpy.c \
 | 
			
		||||
	bionic/pthread-atfork.c \
 | 
			
		||||
	bionic/pthread-rwlocks.c \
 | 
			
		||||
	bionic/pthread-timers.c \
 | 
			
		||||
	bionic/ptrace.c
 | 
			
		||||
    bionic/pthread-atfork.c \
 | 
			
		||||
    bionic/pthread-rwlocks.c \
 | 
			
		||||
    bionic/pthread-timers.c \
 | 
			
		||||
    bionic/ptrace.c \
 | 
			
		||||
 | 
			
		||||
libc_static_common_src_files += \
 | 
			
		||||
    bionic/pthread.c \
 | 
			
		||||
    bionic/pthread_create.cpp \
 | 
			
		||||
    bionic/pthread_key.cpp \
 | 
			
		||||
 | 
			
		||||
libc_arch_static_src_files := \
 | 
			
		||||
	bionic/dl_iterate_phdr_static.c
 | 
			
		||||
 | 
			
		||||
libc_arch_dynamic_src_files :=
 | 
			
		||||
endif # x86
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_ARCH),mips)
 | 
			
		||||
libc_common_src_files += \
 | 
			
		||||
	arch-mips/bionic/__get_sp.S \
 | 
			
		||||
	arch-mips/bionic/__get_tls.c \
 | 
			
		||||
	arch-mips/bionic/__set_tls.c \
 | 
			
		||||
	arch-mips/bionic/_exit_with_stack_teardown.S \
 | 
			
		||||
	arch-mips/bionic/_setjmp.S \
 | 
			
		||||
	arch-mips/bionic/futex_mips.S \
 | 
			
		||||
	arch-mips/bionic/bzero.S \
 | 
			
		||||
	arch-mips/bionic/cacheflush.c \
 | 
			
		||||
	arch-mips/bionic/clone.S \
 | 
			
		||||
	arch-mips/bionic/ffs.S \
 | 
			
		||||
	arch-mips/bionic/memcmp16.S \
 | 
			
		||||
	arch-mips/bionic/memmove.c \
 | 
			
		||||
	arch-mips/bionic/pipe.S \
 | 
			
		||||
	arch-mips/bionic/setjmp.S \
 | 
			
		||||
	arch-mips/bionic/sigsetjmp.S \
 | 
			
		||||
	arch-mips/bionic/vfork.S
 | 
			
		||||
 | 
			
		||||
libc_common_src_files += \
 | 
			
		||||
	arch-mips/string/memset.S \
 | 
			
		||||
	arch-mips/string/memcpy.S \
 | 
			
		||||
	arch-mips/string/mips_strlen.c
 | 
			
		||||
 | 
			
		||||
libc_common_src_files += \
 | 
			
		||||
	bionic/memcmp.c \
 | 
			
		||||
	string/bcopy.c \
 | 
			
		||||
	string/strcmp.c \
 | 
			
		||||
	string/strcpy.c \
 | 
			
		||||
	string/strncmp.c
 | 
			
		||||
	string/strncmp.c \
 | 
			
		||||
	string/strcat.c \
 | 
			
		||||
	string/strncat.c \
 | 
			
		||||
	string/strncpy.c \
 | 
			
		||||
	bionic/strchr.cpp \
 | 
			
		||||
	string/strrchr.c \
 | 
			
		||||
	bionic/memchr.c \
 | 
			
		||||
	bionic/memrchr.c \
 | 
			
		||||
	string/index.c \
 | 
			
		||||
	bionic/strnlen.c \
 | 
			
		||||
	string/strlcat.c \
 | 
			
		||||
	string/strlcpy.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcschr.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcsrchr.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcscmp.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcscpy.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wmemcmp.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcslen.c \
 | 
			
		||||
	upstream-freebsd/lib/libc/string/wcscat.c
 | 
			
		||||
 | 
			
		||||
libc_common_src_files += \
 | 
			
		||||
	bionic/pthread-atfork.c \
 | 
			
		||||
@@ -495,14 +440,45 @@ libc_common_src_files += \
 | 
			
		||||
 | 
			
		||||
libc_static_common_src_files += \
 | 
			
		||||
    bionic/pthread.c \
 | 
			
		||||
    bionic/pthread_create.cpp \
 | 
			
		||||
    bionic/pthread_key.cpp \
 | 
			
		||||
 | 
			
		||||
libc_arch_static_src_files := \
 | 
			
		||||
	bionic/dl_iterate_phdr_static.c
 | 
			
		||||
 | 
			
		||||
libc_arch_dynamic_src_files :=
 | 
			
		||||
endif # mips
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(TARGET_CPU_VARIANT)),)
 | 
			
		||||
$(warning TARGET_CPU_VARIANT is not defined)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
###########################################################
 | 
			
		||||
## Add cpu specific source files.
 | 
			
		||||
##
 | 
			
		||||
## This can be called multiple times, but it will only add
 | 
			
		||||
## the first source file for each unique $(1).
 | 
			
		||||
## $(1): Unique identifier to identify the cpu variant
 | 
			
		||||
##       implementation.
 | 
			
		||||
## $(2): Cpu specific source file.
 | 
			
		||||
###########################################################
 | 
			
		||||
 | 
			
		||||
define libc-add-cpu-variant-src
 | 
			
		||||
$(if $(filter true,$(_LIBC_ARCH_CPU_VARIANT_HAS_$(1))), \
 | 
			
		||||
	, \
 | 
			
		||||
     $(eval _LIBC_ARCH_CPU_VARIANT_HAS_$(1) := true) \
 | 
			
		||||
     $(eval _LIBC_ARCH_CPU_VARIANT_SRC_FILE.$(1) := $(2)) \
 | 
			
		||||
     $(eval _LIBC_ARCH_CPU_VARIANT_SRC_FILES += $(2)) \
 | 
			
		||||
)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
_LIBC_ARCH_COMMON_SRC_FILES :=
 | 
			
		||||
_LIBC_ARCH_CPU_VARIANT_SRC_FILES :=
 | 
			
		||||
_LIBC_ARCH_STATIC_SRC_FILES :=
 | 
			
		||||
_LIBC_ARCH_DYNAMIC_SRC_FILES :=
 | 
			
		||||
include bionic/libc/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
 | 
			
		||||
 | 
			
		||||
libc_common_src_files += $(_LIBC_ARCH_COMMON_SRC_FILES)
 | 
			
		||||
libc_common_src_files += $(_LIBC_ARCH_CPU_VARIANT_SRC_FILES)
 | 
			
		||||
libc_arch_static_src_files := $(_LIBC_ARCH_STATIC_SRC_FILES)
 | 
			
		||||
libc_arch_dynamic_src_files := $(_LIBC_ARCH_DYNAMIC_SRC_FILES)
 | 
			
		||||
 | 
			
		||||
# Define some common cflags
 | 
			
		||||
# ========================================================
 | 
			
		||||
libc_common_cflags := \
 | 
			
		||||
@@ -516,14 +492,6 @@ libc_common_cflags := \
 | 
			
		||||
    -DLOG_ON_HEAP_ERROR \
 | 
			
		||||
    -Wall -Wextra
 | 
			
		||||
 | 
			
		||||
# these macro definitions are required to implement the
 | 
			
		||||
# 'timezone' and 'daylight' global variables, as well as
 | 
			
		||||
# properly update the 'tm_gmtoff' field in 'struct tm'.
 | 
			
		||||
#
 | 
			
		||||
libc_common_cflags += \
 | 
			
		||||
    -DTM_GMTOFF=tm_gmtoff \
 | 
			
		||||
    -DUSG_COMPAT=1
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
 | 
			
		||||
  libc_common_cflags += -DDEBUG
 | 
			
		||||
endif
 | 
			
		||||
@@ -539,27 +507,6 @@ ifeq ($(TARGET_ARCH),arm)
 | 
			
		||||
  libc_common_cflags += -DSOFTFLOAT
 | 
			
		||||
  libc_common_cflags += -fstrict-aliasing
 | 
			
		||||
  libc_crt_target_cflags := -mthumb-interwork
 | 
			
		||||
  #
 | 
			
		||||
  # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
 | 
			
		||||
  # that it should access the hardware TLS register directly in
 | 
			
		||||
  # private/bionic_tls.h
 | 
			
		||||
  #
 | 
			
		||||
  # The value must match your kernel configuration
 | 
			
		||||
  #
 | 
			
		||||
  ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
 | 
			
		||||
    libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
 | 
			
		||||
  endif
 | 
			
		||||
  #
 | 
			
		||||
  # Define HAVE_32_BYTE_CACHE_LINES to indicate to C
 | 
			
		||||
  # library it should use to 32-byte version of memcpy, and not
 | 
			
		||||
  # the 64-byte version.
 | 
			
		||||
  #
 | 
			
		||||
  ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
 | 
			
		||||
    libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
 | 
			
		||||
  endif
 | 
			
		||||
  ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
 | 
			
		||||
    libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
 | 
			
		||||
  endif
 | 
			
		||||
endif # !arm
 | 
			
		||||
 | 
			
		||||
ifeq ($(TARGET_ARCH),x86)
 | 
			
		||||
@@ -622,23 +569,17 @@ libc_crt_target_cflags += \
 | 
			
		||||
# static C++ destructors are properly called on dlclose().
 | 
			
		||||
#
 | 
			
		||||
ifeq ($(TARGET_ARCH),arm)
 | 
			
		||||
    libc_crtbegin_extension := c
 | 
			
		||||
    libc_crt_target_so_cflags :=
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(TARGET_ARCH),mips)
 | 
			
		||||
    libc_crtbegin_extension := S
 | 
			
		||||
    libc_crt_target_so_cflags := -fPIC
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(TARGET_ARCH),x86)
 | 
			
		||||
    libc_crtbegin_extension := c
 | 
			
		||||
    libc_crt_target_so_cflags := -fPIC
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(libc_crtbegin_extension),)
 | 
			
		||||
    $(error $(TARGET_ARCH) not supported)
 | 
			
		||||
endif
 | 
			
		||||
libc_crt_target_so_cflags += $(libc_crt_target_cflags)
 | 
			
		||||
libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.$(libc_crtbegin_extension)
 | 
			
		||||
libc_crt_target_crtbegin_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.$(libc_crtbegin_extension)
 | 
			
		||||
libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.c
 | 
			
		||||
libc_crt_target_crtbegin_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.c
 | 
			
		||||
 | 
			
		||||
# See the comment in crtbrand.c for the reason why we need to generate
 | 
			
		||||
# crtbrand.s before generating crtbrand.o.
 | 
			
		||||
@@ -744,8 +685,8 @@ WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
 | 
			
		||||
 | 
			
		||||
include $(CLEAR_VARS)
 | 
			
		||||
 | 
			
		||||
LOCAL_SRC_FILES := bionic/ssp.cpp
 | 
			
		||||
LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
 | 
			
		||||
LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
 | 
			
		||||
LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector -Werror
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_MODULE := libbionic_ssp
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
			
		||||
@@ -754,6 +695,51 @@ LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# ========================================================
 | 
			
		||||
# libc_tzcode.a - upstream 'tzcode' code
 | 
			
		||||
# ========================================================
 | 
			
		||||
 | 
			
		||||
include $(CLEAR_VARS)
 | 
			
		||||
 | 
			
		||||
LOCAL_SRC_FILES := $(libc_tzcode_src_files)
 | 
			
		||||
LOCAL_CFLAGS := \
 | 
			
		||||
    $(libc_common_cflags) \
 | 
			
		||||
    -std=gnu99 \
 | 
			
		||||
    -DSTD_INSPIRED=1 \
 | 
			
		||||
    -DTZDIR=\"/system/usr/share/zoneinfo\" \
 | 
			
		||||
    -DTM_GMTOFF=tm_gmtoff \
 | 
			
		||||
    -DUSG_COMPAT=1
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_MODULE := libc_tzcode
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# ========================================================
 | 
			
		||||
# libc_freebsd.a - upstream FreeBSD C library code
 | 
			
		||||
# ========================================================
 | 
			
		||||
#
 | 
			
		||||
# These files are built with the freebsd-compat.h header file
 | 
			
		||||
# automatically included.
 | 
			
		||||
 | 
			
		||||
include $(CLEAR_VARS)
 | 
			
		||||
 | 
			
		||||
LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
 | 
			
		||||
LOCAL_CFLAGS := \
 | 
			
		||||
    $(libc_common_cflags) \
 | 
			
		||||
    -I$(LOCAL_PATH)/upstream-freebsd \
 | 
			
		||||
    -I$(LOCAL_PATH)/upstream-freebsd/libc/include \
 | 
			
		||||
    -include upstream-freebsd/freebsd-compat.h
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_MODULE := libc_freebsd
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# ========================================================
 | 
			
		||||
# libc_netbsd.a - upstream NetBSD C library code
 | 
			
		||||
# ========================================================
 | 
			
		||||
@@ -806,7 +792,12 @@ LOCAL_CFLAGS := $(libc_common_cflags) \
 | 
			
		||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
			
		||||
LOCAL_MODULE := libc_common
 | 
			
		||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
			
		||||
LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_bionic libc_netbsd
 | 
			
		||||
LOCAL_WHOLE_STATIC_LIBRARIES := \
 | 
			
		||||
    libbionic_ssp \
 | 
			
		||||
    libc_bionic \
 | 
			
		||||
    libc_freebsd \
 | 
			
		||||
    libc_netbsd \
 | 
			
		||||
    libc_tzcode
 | 
			
		||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
 | 
			
		||||
 | 
			
		||||
include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
@@ -817,10 +808,10 @@ include $(BUILD_STATIC_LIBRARY)
 | 
			
		||||
# ========================================================
 | 
			
		||||
#
 | 
			
		||||
# This is a version of the static C library that does not
 | 
			
		||||
# include malloc. It's useful in situations when calling
 | 
			
		||||
# the user wants to provide their own malloc implementation,
 | 
			
		||||
# or wants to explicitly disallow the use of the use of malloc,
 | 
			
		||||
# like the dynamic loader.
 | 
			
		||||
# include malloc. It's useful in situations when the user wants
 | 
			
		||||
# to provide their own malloc implementation, or wants to
 | 
			
		||||
# explicitly disallow the use of the use of malloc,
 | 
			
		||||
# such as in the dynamic loader.
 | 
			
		||||
 | 
			
		||||
include $(CLEAR_VARS)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										191
									
								
								libc/NOTICE
									
									
									
									
									
								
							
							
						
						
									
										191
									
								
								libc/NOTICE
									
									
									
									
									
								
							@@ -1673,38 +1673,6 @@ SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 1990, 1993
 | 
			
		||||
   The Regents of the University of California.  All rights reserved.
 | 
			
		||||
 | 
			
		||||
This code is derived from software contributed to Berkeley by
 | 
			
		||||
Chris Torek.
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
   may be used to endorse or promote products derived from this software
 | 
			
		||||
   without specific prior written permission.
 | 
			
		||||
 | 
			
		||||
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 | 
			
		||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 | 
			
		||||
ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 | 
			
		||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 | 
			
		||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 | 
			
		||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
			
		||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 | 
			
		||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 | 
			
		||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 1990, 1993
 | 
			
		||||
   The Regents of the University of California.  All rights reserved.
 | 
			
		||||
 | 
			
		||||
@@ -2852,7 +2820,7 @@ are met:
 | 
			
		||||
2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
   notices, this list of conditions and the following disclaimer in the
 | 
			
		||||
   documentation and/or other materials provided with the distribution.
 | 
			
		||||
4. Neither the name of the University nor the names of its contributors
 | 
			
		||||
3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
   may be used to endorse or promote products derived from this software
 | 
			
		||||
   without specific prior written permission.
 | 
			
		||||
 | 
			
		||||
@@ -3092,13 +3060,6 @@ are met:
 | 
			
		||||
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. All advertising materials mentioning features or use of this software
 | 
			
		||||
   must display the following acknowledgement:
 | 
			
		||||
       This product includes software developed by the NetBSD
 | 
			
		||||
       Foundation, Inc. and its contributors.
 | 
			
		||||
4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 | 
			
		||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 | 
			
		||||
@@ -3916,6 +3877,36 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2010, 2011 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.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2010, Intel Corporation
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
@@ -3946,6 +3937,36 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2011 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.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2011 The Android Open Source Project
 | 
			
		||||
Copyright (c) 2008 ARM Ltd
 | 
			
		||||
All rights reserved.
 | 
			
		||||
@@ -3975,6 +3996,36 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2011, 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.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2011, VMware, Inc.
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
@@ -4030,6 +4081,66 @@ 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.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2013, Linaro Limited
 | 
			
		||||
   All rights reserved.
 | 
			
		||||
 | 
			
		||||
   Redistribution and use in source and binary forms, with or without
 | 
			
		||||
   modification, are permitted provided that the following conditions
 | 
			
		||||
   are met:
 | 
			
		||||
 | 
			
		||||
     Redistributions of source code must retain the above copyright
 | 
			
		||||
      notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 | 
			
		||||
     Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
      notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
      documentation and/or other materials provided with the distribution.
 | 
			
		||||
 | 
			
		||||
     Neither the name of Linaro Limited nor the names of its
 | 
			
		||||
      contributors may be used to endorse or promote products derived
 | 
			
		||||
      from this software without specific prior written permission.
 | 
			
		||||
 | 
			
		||||
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 | 
			
		||||
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 | 
			
		||||
   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
			
		||||
   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 | 
			
		||||
   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 | 
			
		||||
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 | 
			
		||||
   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 | 
			
		||||
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | 
			
		||||
   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
Copyright (c)1999 Citrus Project,
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										54
									
								
								libc/README
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								libc/README
									
									
									
									
									
								
							@@ -1,54 +0,0 @@
 | 
			
		||||
Welcome to Bionic, Android's small and custom C library for the Android
 | 
			
		||||
platform.
 | 
			
		||||
 | 
			
		||||
Bionic is mainly a port of the BSD C library to our Linux kernel with the
 | 
			
		||||
following additions/changes:
 | 
			
		||||
 | 
			
		||||
- no support for locales
 | 
			
		||||
- no support for wide chars (i.e. multi-byte characters)
 | 
			
		||||
- its own smallish implementation of pthreads based on Linux futexes
 | 
			
		||||
- support for x86, ARM and ARM thumb CPU instruction sets and kernel interfaces
 | 
			
		||||
 | 
			
		||||
Bionic is released under the standard 3-clause BSD License
 | 
			
		||||
 | 
			
		||||
Bionic doesn't want to implement all features of a traditional C library, we only
 | 
			
		||||
add features to it as we need them, and we try to keep things as simple and small
 | 
			
		||||
as possible. Our goal is not to support scaling to thousands of concurrent threads
 | 
			
		||||
on multi-processors machines; we're running this on cell-phones, damnit !!
 | 
			
		||||
 | 
			
		||||
Note that Bionic doesn't provide a libthread_db or a libm implementation.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Adding new syscalls:
 | 
			
		||||
====================
 | 
			
		||||
 | 
			
		||||
Bionic provides the gensyscalls.py Python script to automatically generate syscall
 | 
			
		||||
stubs from the list defined in the file SYSCALLS.TXT. You can thus add a new syscall
 | 
			
		||||
by doing the following:
 | 
			
		||||
 | 
			
		||||
- edit SYSCALLS.TXT
 | 
			
		||||
- add a new line describing your syscall, it should look like:
 | 
			
		||||
 | 
			
		||||
   return_type  syscall_name(parameters)    syscall_number
 | 
			
		||||
 | 
			
		||||
- in the event where you want to differentiate the syscall function from its entry name,
 | 
			
		||||
  use the alternate:
 | 
			
		||||
 | 
			
		||||
   return_type  funcname:syscall_name(parameters)  syscall_number
 | 
			
		||||
 | 
			
		||||
- additionally, if the syscall number is different between ARM and x86, use:
 | 
			
		||||
 | 
			
		||||
   return_type  funcname[:syscall_name](parameters)   arm_number,x86_number
 | 
			
		||||
 | 
			
		||||
- a syscall number can be -1 to indicate that the syscall is not implemented on
 | 
			
		||||
  a given platform, for example:
 | 
			
		||||
 | 
			
		||||
   void   __set_tls(void*)   arm_number,-1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
the comments in SYSCALLS.TXT contain more information about the line format
 | 
			
		||||
 | 
			
		||||
You can also use the 'checksyscalls.py' script to check that all the syscall
 | 
			
		||||
numbers you entered are correct. It does so by looking at the values defined in
 | 
			
		||||
your Linux kernel headers. The script indicates where the values are incorrect
 | 
			
		||||
and what is expected instead.
 | 
			
		||||
@@ -1,13 +1,11 @@
 | 
			
		||||
# this file is used to list all the syscalls that will be supported by
 | 
			
		||||
# the Bionic C library. It is used to automatically generate the syscall
 | 
			
		||||
# stubs, the list of syscall constants (__NR_xxxx) and the content of <linux/_unistd.h>
 | 
			
		||||
# This file is used to automatically generate bionic's the system calls stubs.
 | 
			
		||||
#
 | 
			
		||||
# each non comment line has the following format:
 | 
			
		||||
# Each non comment line has the following format:
 | 
			
		||||
#
 | 
			
		||||
# return_type    func_name[:syscall_name[:call_id]]([parameter_list])  (syscall_number|"stub")
 | 
			
		||||
# return_type    func_name[:syscall_name[:call_id]]([parameter_list])  (1|-1|"stub")
 | 
			
		||||
#
 | 
			
		||||
# note that:
 | 
			
		||||
#      - syscall_name correspond to the name of the syscall, which may differ from
 | 
			
		||||
# Note that:
 | 
			
		||||
#      - syscall_name corresponds to the name of the syscall, which may differ from
 | 
			
		||||
#        the exported function name (example: the exit syscall is implemented by the _exit()
 | 
			
		||||
#        function, which is not the same as the standard C exit() function which calls it)
 | 
			
		||||
#        The call_id parameter, given that func_name and syscall_name have
 | 
			
		||||
@@ -18,299 +16,311 @@
 | 
			
		||||
#      - each parameter type is assumed to be stored on 32 bits, there is no plan to support
 | 
			
		||||
#        64-bit architectures at the moment
 | 
			
		||||
#
 | 
			
		||||
#      - it there is "stub" instead of a syscall number, the tool will not generate any
 | 
			
		||||
#        assembler template for the syscall; it's up to the bionic implementation to provide
 | 
			
		||||
#        a relevant C stub
 | 
			
		||||
#      - the final field can be "1", meaning: generate a stub for each architecture,
 | 
			
		||||
#        taking the constants from the kernel header files.
 | 
			
		||||
#
 | 
			
		||||
#      - additionally, if the syscall number is different amoung ARM, and x86, MIPS use:
 | 
			
		||||
#        return_type funcname[:syscall_name](parameters) arm_number,x86_number,mips_number
 | 
			
		||||
#      - the final field can be "stub" meaning: do not generate any stubs ---
 | 
			
		||||
#        in this case, a hand-written custom stub must be provided.
 | 
			
		||||
#        TODO: replace this with something like "custom" or "none", or remove
 | 
			
		||||
#        it entirely.
 | 
			
		||||
#
 | 
			
		||||
# the file is processed by a python script named gensyscalls.py
 | 
			
		||||
#      - the final field can be a three-element list of 1s and -1 meaning:
 | 
			
		||||
#        this system call is only available on some of the architectures (1),
 | 
			
		||||
#        and no stub should be generated for those architectures marked with -1.
 | 
			
		||||
#        the order is arm,x86,mips.
 | 
			
		||||
#        TODO: replace this with something more readable like "-arm,-mips" (meaning x86 only).
 | 
			
		||||
#
 | 
			
		||||
# This file is processed by a python script named gensyscalls.py.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# process management
 | 
			
		||||
void    _exit:exit_group (int)      248,252,246
 | 
			
		||||
void    _exit:exit_group (int)      1
 | 
			
		||||
void    _exit_thread:exit (int)     1
 | 
			
		||||
pid_t   __fork:fork (void)           2
 | 
			
		||||
pid_t   _waitpid:waitpid (pid_t, int*, int, struct rusage*)   -1,7,7
 | 
			
		||||
int     __waitid:waitid(int, pid_t, struct siginfo_t*, int,void*)          280,284,278
 | 
			
		||||
pid_t   __fork:fork (void)           1
 | 
			
		||||
pid_t   _waitpid:waitpid (pid_t, int*, int, struct rusage*)   -1,1,1
 | 
			
		||||
int     __waitid:waitid(int, pid_t, struct siginfo_t*, int,void*)          1
 | 
			
		||||
pid_t   wait4(pid_t pid, int *status, int options, struct rusage *rusage)   1
 | 
			
		||||
 | 
			
		||||
# NOTE: this system call is never called directly, but we list it there
 | 
			
		||||
#       to have __NR_clone properly defined.
 | 
			
		||||
#
 | 
			
		||||
pid_t   __sys_clone:clone (int, void*, int*, void*, int*) 120
 | 
			
		||||
pid_t   __sys_clone:clone (int, void*, int*, void*, int*) 1
 | 
			
		||||
 | 
			
		||||
int     execve (const char*, char* const*, char* const*)  11
 | 
			
		||||
int     execve (const char*, char* const*, char* const*)  1
 | 
			
		||||
 | 
			
		||||
int     __setuid:setuid32 (uid_t)    213,213,-1
 | 
			
		||||
int     __setuid:setuid (uid_t)   -1,-1,23
 | 
			
		||||
uid_t   getuid:getuid32 ()         199,199,-1
 | 
			
		||||
uid_t   getuid:getuid ()           -1,-1,24
 | 
			
		||||
gid_t   getgid:getgid32 ()         200,200,-1
 | 
			
		||||
gid_t   getgid:getgid ()           -1,-1,47
 | 
			
		||||
uid_t   geteuid:geteuid32 ()       201,201,-1
 | 
			
		||||
uid_t   geteuid:geteuid ()         -1,-1,49
 | 
			
		||||
gid_t   getegid:getegid32 ()       202,202,-1
 | 
			
		||||
gid_t   getegid:getegid ()         -1,-1,50
 | 
			
		||||
uid_t   getresuid:getresuid32 (uid_t *ruid, uid_t *euid, uid_t *suid)   209,209,-1
 | 
			
		||||
uid_t   getresuid:getresuid (uid_t *ruid, uid_t *euid, uid_t *suid)     -1,-1,186
 | 
			
		||||
gid_t   getresgid:getresgid32 (gid_t *rgid, gid_t *egid, gid_t *sgid)   211,211,-1
 | 
			
		||||
gid_t   getresgid:getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid)     -1,-1,191
 | 
			
		||||
pid_t   gettid()                   224,224,222
 | 
			
		||||
ssize_t readahead(int, off64_t, size_t)     225,225,223
 | 
			
		||||
int     getgroups:getgroups32(int, gid_t *)    205,205,-1
 | 
			
		||||
int     getgroups:getgroups(int, gid_t *)      -1,-1,80
 | 
			
		||||
pid_t   getpgid(pid_t)             132
 | 
			
		||||
pid_t   getppid()                  64
 | 
			
		||||
pid_t   getsid(pid_t)              147,147,151
 | 
			
		||||
pid_t   setsid()                   66
 | 
			
		||||
int     setgid:setgid32(gid_t)     214,214,-1
 | 
			
		||||
int     setgid:setgid(gid_t)       -1,-1,46
 | 
			
		||||
int     __setuid:setuid32 (uid_t)    1,1,-1
 | 
			
		||||
int     __setuid:setuid (uid_t)   -1,-1,1
 | 
			
		||||
uid_t   getuid:getuid32 ()         1,1,-1
 | 
			
		||||
uid_t   getuid:getuid ()           -1,-1,1
 | 
			
		||||
gid_t   getgid:getgid32 ()         1,1,-1
 | 
			
		||||
gid_t   getgid:getgid ()           -1,-1,1
 | 
			
		||||
uid_t   geteuid:geteuid32 ()       1,1,-1
 | 
			
		||||
uid_t   geteuid:geteuid ()         -1,-1,1
 | 
			
		||||
gid_t   getegid:getegid32 ()       1,1,-1
 | 
			
		||||
gid_t   getegid:getegid ()         -1,-1,1
 | 
			
		||||
uid_t   getresuid:getresuid32 (uid_t *ruid, uid_t *euid, uid_t *suid)   1,1,-1
 | 
			
		||||
uid_t   getresuid:getresuid (uid_t *ruid, uid_t *euid, uid_t *suid)     -1,-1,1
 | 
			
		||||
gid_t   getresgid:getresgid32 (gid_t *rgid, gid_t *egid, gid_t *sgid)   1,1,-1
 | 
			
		||||
gid_t   getresgid:getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid)     -1,-1,1
 | 
			
		||||
pid_t   gettid()                   1
 | 
			
		||||
ssize_t readahead(int, off64_t, size_t)     1
 | 
			
		||||
int     getgroups:getgroups32(int, gid_t *)    1,1,-1
 | 
			
		||||
int     getgroups:getgroups(int, gid_t *)      -1,-1,1
 | 
			
		||||
pid_t   getpgid(pid_t)             1
 | 
			
		||||
pid_t   getppid()                  1
 | 
			
		||||
pid_t   getsid(pid_t)              1
 | 
			
		||||
pid_t   setsid()                   1
 | 
			
		||||
int     setgid:setgid32(gid_t)     1,1,-1
 | 
			
		||||
int     setgid:setgid(gid_t)       -1,-1,1
 | 
			
		||||
int     seteuid:seteuid32(uid_t)   stub
 | 
			
		||||
int     __setreuid:setreuid32(uid_t, uid_t)   203,203,-1
 | 
			
		||||
int     __setreuid:setreuid(uid_t, uid_t)     -1,-1,70
 | 
			
		||||
int     __setresuid:setresuid32(uid_t, uid_t, uid_t)   208,208,-1
 | 
			
		||||
int     __setresuid:setresuid(uid_t, uid_t, uid_t)     -1,-1,185
 | 
			
		||||
int     setresgid:setresgid32(gid_t, gid_t, gid_t)   210,210,-1
 | 
			
		||||
int     setresgid:setresgid(gid_t, gid_t, gid_t)     -1,-1,190
 | 
			
		||||
void*   __brk:brk(void*)           45
 | 
			
		||||
int     __setreuid:setreuid32(uid_t, uid_t)   1,1,-1
 | 
			
		||||
int     __setreuid:setreuid(uid_t, uid_t)     -1,-1,1
 | 
			
		||||
int     __setresuid:setresuid32(uid_t, uid_t, uid_t)   1,1,-1
 | 
			
		||||
int     __setresuid:setresuid(uid_t, uid_t, uid_t)     -1,-1,1
 | 
			
		||||
int     setresgid:setresgid32(gid_t, gid_t, gid_t)   1,1,-1
 | 
			
		||||
int     setresgid:setresgid(gid_t, gid_t, gid_t)     -1,-1,1
 | 
			
		||||
void*   __brk:brk(void*)           1
 | 
			
		||||
# see comments in arch-arm/bionic/kill.S to understand why we don't generate an ARM stub for kill/tkill
 | 
			
		||||
int     kill(pid_t, int)           -1,37,37
 | 
			
		||||
int     tkill(pid_t tid, int sig)  -1,238,236
 | 
			
		||||
int     tgkill(pid_t tgid, pid_t tid, int sig)  -1,270,266
 | 
			
		||||
int     __ptrace:ptrace(int request, int pid, void* addr, void* data)  26
 | 
			
		||||
int     __set_thread_area:set_thread_area(void*  user_desc)  -1,243,283
 | 
			
		||||
int     __getpriority:getpriority(int, int)  96
 | 
			
		||||
int     setpriority(int, int, int)   97
 | 
			
		||||
int     setrlimit(int resource, const struct rlimit *rlp)  75
 | 
			
		||||
int     getrlimit:ugetrlimit(int resource, struct rlimit *rlp)  191,191,-1
 | 
			
		||||
int     getrlimit:getrlimit(int resource, struct rlimit *rlp)  -1,-1,76
 | 
			
		||||
int     getrusage(int who, struct rusage*  r_usage)  77
 | 
			
		||||
int     setgroups:setgroups32(int, const gid_t *)   206,206,-1
 | 
			
		||||
int     setgroups:setgroups(int, const gid_t *)     -1,-1,81
 | 
			
		||||
int     kill(pid_t, int)           -1,1,1
 | 
			
		||||
int     tkill(pid_t tid, int sig)  -1,1,1
 | 
			
		||||
int     tgkill(pid_t tgid, pid_t tid, int sig)  -1,1,1
 | 
			
		||||
int     __ptrace:ptrace(int request, int pid, void* addr, void* data)  1
 | 
			
		||||
int     __set_thread_area:set_thread_area(void*  user_desc)  -1,1,1
 | 
			
		||||
int     __getpriority:getpriority(int, int)  1
 | 
			
		||||
int     setpriority(int, int, int)   1
 | 
			
		||||
int     setrlimit(int resource, const struct rlimit *rlp)  1
 | 
			
		||||
int     getrlimit:ugetrlimit(int resource, struct rlimit *rlp)  1,1,-1
 | 
			
		||||
int     getrlimit:getrlimit(int resource, struct rlimit *rlp)  -1,-1,1
 | 
			
		||||
int     getrusage(int who, struct rusage*  r_usage)  1
 | 
			
		||||
int     setgroups:setgroups32(int, const gid_t *)   1,1,-1
 | 
			
		||||
int     setgroups:setgroups(int, const gid_t *)     -1,-1,1
 | 
			
		||||
pid_t   getpgrp(void)  stub
 | 
			
		||||
int     setpgid(pid_t, pid_t)  57
 | 
			
		||||
pid_t   vfork(void)  190,-1,-1
 | 
			
		||||
int     setregid:setregid32(gid_t, gid_t)  204,204,-1
 | 
			
		||||
int     setregid:setregid(gid_t, gid_t)    -1,-1,71
 | 
			
		||||
int     chroot(const char *)  61
 | 
			
		||||
int     setpgid(pid_t, pid_t)  1
 | 
			
		||||
pid_t   vfork(void)  1,-1,-1
 | 
			
		||||
int     setregid:setregid32(gid_t, gid_t)  1,1,-1
 | 
			
		||||
int     setregid:setregid(gid_t, gid_t)    -1,-1,1
 | 
			
		||||
int     chroot(const char *)  1
 | 
			
		||||
# IMPORTANT: Even though <sys/prctl.h> declares prctl(int,...), the syscall stub must take 6 arguments
 | 
			
		||||
#            to match the kernel implementation.
 | 
			
		||||
int     prctl(int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5)  172,172,192
 | 
			
		||||
int     capget(cap_user_header_t header, cap_user_data_t data) 184,184,204
 | 
			
		||||
int     capset(cap_user_header_t header, const cap_user_data_t data) 185,185,205
 | 
			
		||||
int     sigaltstack(const stack_t*, stack_t*) 186,186,206
 | 
			
		||||
int     acct(const char*  filepath)  51
 | 
			
		||||
int     prctl(int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5) 1
 | 
			
		||||
int     capget(cap_user_header_t header, cap_user_data_t data) 1
 | 
			
		||||
int     capset(cap_user_header_t header, const cap_user_data_t data) 1
 | 
			
		||||
int     sigaltstack(const stack_t*, stack_t*) 1
 | 
			
		||||
int     acct(const char*  filepath)  1
 | 
			
		||||
 | 
			
		||||
# file descriptors
 | 
			
		||||
ssize_t     read (int, void*, size_t)        3
 | 
			
		||||
ssize_t     write (int, const void*, size_t)       4
 | 
			
		||||
ssize_t     pread64 (int, void *, size_t, off64_t) 180,180,200
 | 
			
		||||
ssize_t     pwrite64 (int, void *, size_t, off64_t) 181,181,201
 | 
			
		||||
int         __open:open (const char*, int, mode_t)  5
 | 
			
		||||
int         __openat:openat (int, const char*, int, mode_t)  322,295,288
 | 
			
		||||
int         close (int)                      6
 | 
			
		||||
ssize_t     read (int, void*, size_t)        1
 | 
			
		||||
ssize_t     write (int, const void*, size_t)       1
 | 
			
		||||
ssize_t     pread64 (int, void *, size_t, off64_t) 1
 | 
			
		||||
ssize_t     pwrite64 (int, void *, size_t, off64_t) 1
 | 
			
		||||
int         __open:open (const char*, int, mode_t)  1
 | 
			
		||||
int         __openat:openat (int, const char*, int, mode_t) 1
 | 
			
		||||
int         close (int)                      1
 | 
			
		||||
int         creat(const char*, mode_t)       stub
 | 
			
		||||
off_t       lseek(int, off_t, int)           19
 | 
			
		||||
int         __llseek:_llseek (int, unsigned long, unsigned long, loff_t*, int)  140
 | 
			
		||||
pid_t       getpid ()    20
 | 
			
		||||
off_t       lseek(int, off_t, int)           1
 | 
			
		||||
int         __llseek:_llseek (int, unsigned long, unsigned long, loff_t*, int)  1
 | 
			
		||||
pid_t       getpid ()    1
 | 
			
		||||
void *      mmap(void *, size_t, int, int, int, long)  stub
 | 
			
		||||
void *      __mmap2:mmap2(void*, size_t, int, int, int, long)   192,192,210
 | 
			
		||||
int         munmap(void *, size_t)  91
 | 
			
		||||
void *      mremap(void *, size_t, size_t, unsigned long)  163,163,167
 | 
			
		||||
int         msync(const void *, size_t, int)    144
 | 
			
		||||
int         mprotect(const void *, size_t, int)  125
 | 
			
		||||
int         madvise(const void *, size_t, int)  220,219,218
 | 
			
		||||
int         mlock(const void *addr, size_t len)    150,150,154
 | 
			
		||||
int         munlock(const void *addr, size_t len)   151,151,155
 | 
			
		||||
int         mlockall(int flags)   152,152,156
 | 
			
		||||
int         munlockall()   153,153,157
 | 
			
		||||
int         mincore(void*  start, size_t  length, unsigned char*  vec)   219,218,217
 | 
			
		||||
int         __ioctl:ioctl(int, int, void *)  54
 | 
			
		||||
int         readv(int, const struct iovec *, int)   145
 | 
			
		||||
int         writev(int, const struct iovec *, int)  146
 | 
			
		||||
int         __fcntl:fcntl(int, int, void*)  55
 | 
			
		||||
int         flock(int, int)   143
 | 
			
		||||
int         fchmod(int, mode_t)  94
 | 
			
		||||
int         dup(int)  41
 | 
			
		||||
int         pipe(int *)  42,42,-1
 | 
			
		||||
int         pipe2(int *, int) 359,331,328
 | 
			
		||||
int         dup2(int, int)   63
 | 
			
		||||
int         select:_newselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *)  142
 | 
			
		||||
int         ftruncate(int, off_t)  93
 | 
			
		||||
int         ftruncate64(int, off64_t) 194,194,212
 | 
			
		||||
int         getdents:getdents64(unsigned int, struct dirent *, unsigned int)   217,220,219
 | 
			
		||||
int         fsync(int)  118
 | 
			
		||||
int         fdatasync(int) 148,148,152
 | 
			
		||||
int         fchown:fchown32(int, uid_t, gid_t)  207,207,-1
 | 
			
		||||
int         fchown:fchown(int, uid_t, gid_t)    -1,-1,95
 | 
			
		||||
void        sync(void)  36
 | 
			
		||||
int         __fcntl64:fcntl64(int, int, void *)  221,221,220
 | 
			
		||||
int         __fstatfs64:fstatfs64(int, size_t, struct statfs *)  267,269,256
 | 
			
		||||
ssize_t     sendfile(int out_fd, int in_fd, off_t *offset, size_t count)  187,187,207
 | 
			
		||||
int         fstatat:fstatat64(int dirfd, const char *path, struct stat *buf, int flags)   327,300,293
 | 
			
		||||
int         mkdirat(int dirfd, const char *pathname, mode_t mode)  323,296,289
 | 
			
		||||
int         fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags)  325,298,291
 | 
			
		||||
int         fchmodat(int dirfd, const char *path, mode_t mode, int flags)  333,306,299
 | 
			
		||||
int         renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath)  329,302,295
 | 
			
		||||
int         fsetxattr(int, const char *, const void *, size_t, int) 228,228,226
 | 
			
		||||
ssize_t     fgetxattr(int, const char *, void *, size_t) 231,231,229
 | 
			
		||||
ssize_t     flistxattr(int, char *, size_t) 234,234,232
 | 
			
		||||
int         fremovexattr(int, const char *) 237,237,235
 | 
			
		||||
void *      __mmap2:mmap2(void*, size_t, int, int, int, long)   1
 | 
			
		||||
int         munmap(void *, size_t)  1
 | 
			
		||||
void *      mremap(void *, size_t, size_t, unsigned long)  1
 | 
			
		||||
int         msync(const void *, size_t, int)    1
 | 
			
		||||
int         mprotect(const void *, size_t, int)  1
 | 
			
		||||
int         madvise(const void *, size_t, int)  1
 | 
			
		||||
int         mlock(const void *addr, size_t len)    1
 | 
			
		||||
int         munlock(const void *addr, size_t len)   1
 | 
			
		||||
int         mlockall(int flags)   1
 | 
			
		||||
int         munlockall()   1
 | 
			
		||||
int         mincore(void*  start, size_t  length, unsigned char*  vec)   1
 | 
			
		||||
int         __ioctl:ioctl(int, int, void *)  1
 | 
			
		||||
int         readv(int, const struct iovec *, int)   1
 | 
			
		||||
int         writev(int, const struct iovec *, int)  1
 | 
			
		||||
int         __fcntl:fcntl(int, int, void*)  1
 | 
			
		||||
int         flock(int, int)   1
 | 
			
		||||
int         fchmod(int, mode_t)  1
 | 
			
		||||
int         dup(int)  1
 | 
			
		||||
int         pipe(int *)  1,1,-1
 | 
			
		||||
int         pipe2(int *, int) 1
 | 
			
		||||
int         dup2(int, int)   1
 | 
			
		||||
int         select:_newselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *)  1
 | 
			
		||||
int         ftruncate(int, off_t)  1
 | 
			
		||||
int         ftruncate64(int, off64_t) 1
 | 
			
		||||
int         getdents:getdents64(unsigned int, struct dirent *, unsigned int)   1
 | 
			
		||||
int         fsync(int)  1
 | 
			
		||||
int         fdatasync(int) 1
 | 
			
		||||
int         fchown:fchown32(int, uid_t, gid_t)  1,1,-1
 | 
			
		||||
int         fchown:fchown(int, uid_t, gid_t)    -1,-1,1
 | 
			
		||||
void        sync(void)  1
 | 
			
		||||
int         __fcntl64:fcntl64(int, int, void *)  1
 | 
			
		||||
int         __fstatfs64:fstatfs64(int, size_t, struct statfs *)  1
 | 
			
		||||
ssize_t     sendfile(int out_fd, int in_fd, off_t *offset, size_t count)  1
 | 
			
		||||
int         fstatat:fstatat64(int dirfd, const char *path, struct stat *buf, int flags)   1
 | 
			
		||||
int         mkdirat(int dirfd, const char *pathname, mode_t mode)  1
 | 
			
		||||
int         fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags)  1
 | 
			
		||||
int         fchmodat(int dirfd, const char *path, mode_t mode, int flags)  1
 | 
			
		||||
int         renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath)  1
 | 
			
		||||
int         fsetxattr(int, const char *, const void *, size_t, int) 1
 | 
			
		||||
ssize_t     fgetxattr(int, const char *, void *, size_t) 1
 | 
			
		||||
ssize_t     flistxattr(int, char *, size_t) 1
 | 
			
		||||
int         fremovexattr(int, const char *) 1
 | 
			
		||||
 | 
			
		||||
# file system
 | 
			
		||||
int     link (const char*, const char*)  9
 | 
			
		||||
int     unlink (const char*)             10
 | 
			
		||||
int     unlinkat (int, const char *, int)   328,301,294
 | 
			
		||||
int     chdir (const char*)              12
 | 
			
		||||
int     mknod (const char*, mode_t, dev_t)  14
 | 
			
		||||
int     chmod (const char*,mode_t)          15
 | 
			
		||||
int     chown:chown32(const char *, uid_t, gid_t)  212,212,-1
 | 
			
		||||
int     chown:chown(const char *, uid_t, gid_t)    -1,-1,202
 | 
			
		||||
int     lchown:lchown32 (const char*, uid_t, gid_t)  198,198,-1
 | 
			
		||||
int     lchown:lchown (const char*, uid_t, gid_t)  -1,-1,16
 | 
			
		||||
int     mount (const char*, const char*, const char*, unsigned long, const void*)  21
 | 
			
		||||
int     link (const char*, const char*)  1
 | 
			
		||||
int     unlink (const char*)             1
 | 
			
		||||
int     unlinkat (int, const char *, int)   1
 | 
			
		||||
int     chdir (const char*)              1
 | 
			
		||||
int     mknod (const char*, mode_t, dev_t)  1
 | 
			
		||||
int     chmod (const char*,mode_t)          1
 | 
			
		||||
int     chown:chown32(const char *, uid_t, gid_t)  1,1,-1
 | 
			
		||||
int     chown:chown(const char *, uid_t, gid_t)    -1,-1,1
 | 
			
		||||
int     lchown:lchown32 (const char*, uid_t, gid_t)  1,1,-1
 | 
			
		||||
int     lchown:lchown (const char*, uid_t, gid_t)  -1,-1,1
 | 
			
		||||
int     mount (const char*, const char*, const char*, unsigned long, const void*)  1
 | 
			
		||||
int     umount(const char*)  stub
 | 
			
		||||
int     umount2 (const char*, int)  52
 | 
			
		||||
int     fstat:fstat64(int, struct stat*)    197,197,215
 | 
			
		||||
int     stat:stat64(const char *, struct stat *)  195,195,213
 | 
			
		||||
int     lstat:lstat64(const char *, struct stat *)  196,196,214
 | 
			
		||||
int     mkdir(const char *, mode_t) 39
 | 
			
		||||
int     readlink(const char *, char *, size_t)  85
 | 
			
		||||
int     rmdir(const char *)  40
 | 
			
		||||
int     rename(const char *, const char *)  38
 | 
			
		||||
int     __getcwd:getcwd(char * buf, size_t size)  183,183,203
 | 
			
		||||
int     access(const char *, int)  33
 | 
			
		||||
int     faccessat(int, const char *, int, int)  334,307,300
 | 
			
		||||
int     symlink(const char *, const char *)  83
 | 
			
		||||
int     fchdir(int)    133
 | 
			
		||||
int     truncate(const char*, off_t)    92
 | 
			
		||||
int     setxattr(const char *, const char *, const void *, size_t, int) 226,226,224
 | 
			
		||||
int     lsetxattr(const char *, const char *, const void *, size_t, int) 227,227,225
 | 
			
		||||
ssize_t getxattr(const char *, const char *, void *, size_t) 229,229,227
 | 
			
		||||
ssize_t lgetxattr(const char *, const char *, void *, size_t) 230,230,228
 | 
			
		||||
ssize_t listxattr(const char *, char *, size_t) 232,232,230
 | 
			
		||||
ssize_t llistxattr(const char *, char *, size_t) 233,233,231
 | 
			
		||||
int     removexattr(const char *, const char *) 235,235,233
 | 
			
		||||
int     lremovexattr(const char *, const char *) 236,236,234
 | 
			
		||||
int     __statfs64:statfs64(const char *, size_t, struct statfs *)  266,268,255
 | 
			
		||||
long    unshare(unsigned long)  337,310,303
 | 
			
		||||
int     umount2 (const char*, int)  1
 | 
			
		||||
int     fstat:fstat64(int, struct stat*)    1
 | 
			
		||||
int     stat:stat64(const char *, struct stat *)  1
 | 
			
		||||
int     lstat:lstat64(const char *, struct stat *)  1
 | 
			
		||||
int     mkdir(const char *, mode_t) 1
 | 
			
		||||
int     readlink(const char *, char *, size_t)  1
 | 
			
		||||
int     rmdir(const char *)  1
 | 
			
		||||
int     rename(const char *, const char *)  1
 | 
			
		||||
int     __getcwd:getcwd(char * buf, size_t size)  1
 | 
			
		||||
int     access(const char *, int)  1
 | 
			
		||||
int     faccessat(int, const char *, int, int)  1
 | 
			
		||||
int     symlink(const char *, const char *)  1
 | 
			
		||||
int     fchdir(int)    1
 | 
			
		||||
int     truncate(const char*, off_t)    1
 | 
			
		||||
int     setxattr(const char *, const char *, const void *, size_t, int) 1
 | 
			
		||||
int     lsetxattr(const char *, const char *, const void *, size_t, int) 1
 | 
			
		||||
ssize_t getxattr(const char *, const char *, void *, size_t) 1
 | 
			
		||||
ssize_t lgetxattr(const char *, const char *, void *, size_t) 1
 | 
			
		||||
ssize_t listxattr(const char *, char *, size_t) 1
 | 
			
		||||
ssize_t llistxattr(const char *, char *, size_t) 1
 | 
			
		||||
int     removexattr(const char *, const char *) 1
 | 
			
		||||
int     lremovexattr(const char *, const char *) 1
 | 
			
		||||
int     __statfs64:statfs64(const char *, size_t, struct statfs *)  1
 | 
			
		||||
long    unshare(unsigned long)  1
 | 
			
		||||
int     swapon(const char *, int) 1
 | 
			
		||||
int     swapoff(const char *) 1
 | 
			
		||||
 | 
			
		||||
# time
 | 
			
		||||
int           pause ()                       29
 | 
			
		||||
int           gettimeofday(struct timeval*, struct timezone*)       78
 | 
			
		||||
int           settimeofday(const struct timeval*, const struct timezone*)   79
 | 
			
		||||
clock_t       times(struct tms *)       43
 | 
			
		||||
int           nanosleep(const struct timespec *, struct timespec *)   162,162,166
 | 
			
		||||
int           clock_gettime(clockid_t clk_id, struct timespec *tp)    263,265,263
 | 
			
		||||
int           clock_settime(clockid_t clk_id, const struct timespec *tp)  262,264,262
 | 
			
		||||
int           clock_getres(clockid_t clk_id, struct timespec *res)   264,266,264
 | 
			
		||||
int           clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *req, struct timespec *rem)  265,267,265
 | 
			
		||||
int           getitimer(int, const struct itimerval *)   105
 | 
			
		||||
int           setitimer(int, const struct itimerval *, struct itimerval *)  104
 | 
			
		||||
int           __timer_create:timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid)    257,259,257
 | 
			
		||||
int           __timer_settime:timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*) 258,260,258
 | 
			
		||||
int           __timer_gettime:timer_gettime(timer_t, struct itimerspec*)                                259,261,259
 | 
			
		||||
int           __timer_getoverrun:timer_getoverrun(timer_t)                                              260,262,260
 | 
			
		||||
int           __timer_delete:timer_delete(timer_t)                                                      261,263,261
 | 
			
		||||
int           utimes(const char*, const struct timeval tvp[2])                          269,271,267
 | 
			
		||||
int           utimensat(int, const char *, const struct timespec times[2], int)         348,320,316
 | 
			
		||||
int           pause ()                       1
 | 
			
		||||
int           gettimeofday(struct timeval*, struct timezone*)       1
 | 
			
		||||
int           settimeofday(const struct timeval*, const struct timezone*)   1
 | 
			
		||||
clock_t       times(struct tms *)       1
 | 
			
		||||
int           nanosleep(const struct timespec *, struct timespec *)   1
 | 
			
		||||
int           clock_gettime(clockid_t clk_id, struct timespec *tp)    1
 | 
			
		||||
int           clock_settime(clockid_t clk_id, const struct timespec *tp)  1
 | 
			
		||||
int           clock_getres(clockid_t clk_id, struct timespec *res)   1
 | 
			
		||||
int           clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *req, struct timespec *rem)  1
 | 
			
		||||
int           getitimer(int, const struct itimerval *)   1
 | 
			
		||||
int           setitimer(int, const struct itimerval *, struct itimerval *)  1
 | 
			
		||||
int           __timer_create:timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid)    1
 | 
			
		||||
int           __timer_settime:timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*) 1
 | 
			
		||||
int           __timer_gettime:timer_gettime(timer_t, struct itimerspec*)                                1
 | 
			
		||||
int           __timer_getoverrun:timer_getoverrun(timer_t)                                              1
 | 
			
		||||
int           __timer_delete:timer_delete(timer_t)                                                      1
 | 
			
		||||
int           utimes(const char*, const struct timeval tvp[2])                          1
 | 
			
		||||
int           utimensat(int, const char *, const struct timespec times[2], int)         1
 | 
			
		||||
int           timerfd_create(clockid_t, int)   1
 | 
			
		||||
int           timerfd_settime(int, int, const struct itimerspec *, struct itimerspec *)   1
 | 
			
		||||
int           timerfd_gettime(int, struct itimerspec *)   1
 | 
			
		||||
 | 
			
		||||
# signals
 | 
			
		||||
int     sigaction(int, const struct sigaction *, struct sigaction *)  67
 | 
			
		||||
int     sigprocmask(int, const sigset_t *, sigset_t *)  126
 | 
			
		||||
int     __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask)  72,72,-1
 | 
			
		||||
int     __sigsuspend:sigsuspend(const sigset_t *mask)  -1,-1,72
 | 
			
		||||
int     __rt_sigaction:rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize)  174,174,194
 | 
			
		||||
int     __rt_sigprocmask:rt_sigprocmask (int  how, const sigset_t *set, sigset_t *oset, size_t sigsetsize)  175,175,195
 | 
			
		||||
int     __rt_sigtimedwait:rt_sigtimedwait(const sigset_t *set, struct siginfo_t  *info, struct timespec_t  *timeout, size_t  sigset_size)  177,177,197
 | 
			
		||||
int     sigpending(sigset_t *)  73
 | 
			
		||||
int     signalfd4(int fd, const sigset_t *mask, size_t sizemask, int flags)  355,327,324
 | 
			
		||||
int     sigaction(int, const struct sigaction *, struct sigaction *)  1
 | 
			
		||||
int     sigprocmask(int, const sigset_t *, sigset_t *)  1
 | 
			
		||||
int     __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask)  1,1,-1
 | 
			
		||||
int     __sigsuspend:sigsuspend(const sigset_t *mask)  -1,-1,1
 | 
			
		||||
int     __rt_sigaction:rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize)  1
 | 
			
		||||
int     __rt_sigprocmask:rt_sigprocmask (int  how, const sigset_t *set, sigset_t *oset, size_t sigsetsize)  1
 | 
			
		||||
int     __rt_sigtimedwait:rt_sigtimedwait(const sigset_t *set, struct siginfo_t  *info, struct timespec_t  *timeout, size_t  sigset_size)  1
 | 
			
		||||
int     sigpending(sigset_t *)  1
 | 
			
		||||
int     signalfd4(int fd, const sigset_t *mask, size_t sizemask, int flags)  1
 | 
			
		||||
 | 
			
		||||
# sockets
 | 
			
		||||
int           socket(int, int, int)              281,-1,183
 | 
			
		||||
int           socketpair(int, int, int, int*)    288,-1,184
 | 
			
		||||
int           bind(int, struct sockaddr *, int)  282,-1,169
 | 
			
		||||
int           connect(int, struct sockaddr *, socklen_t)   283,-1,170
 | 
			
		||||
int           listen(int, int)                   284,-1,174
 | 
			
		||||
int           accept(int, struct sockaddr *, socklen_t *)  285,-1,168
 | 
			
		||||
int           getsockname(int, struct sockaddr *, socklen_t *)  286,-1,172
 | 
			
		||||
int           getpeername(int, struct sockaddr *, socklen_t *)  287,-1,171
 | 
			
		||||
int           sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t)  290,-1,180
 | 
			
		||||
int           recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *)  292,-1,176
 | 
			
		||||
int           shutdown(int, int)  293,-1,182
 | 
			
		||||
int           setsockopt(int, int, int, const void *, socklen_t)  294,-1,181
 | 
			
		||||
int           getsockopt(int, int, int, void *, socklen_t *)    295,-1,173
 | 
			
		||||
int           sendmsg(int, const struct msghdr *, unsigned int)  296,-1,179
 | 
			
		||||
int           recvmsg(int, struct msghdr *, unsigned int)   297,-1,177
 | 
			
		||||
int           socket(int, int, int)              1,-1,1
 | 
			
		||||
int           socketpair(int, int, int, int*)    1,-1,1
 | 
			
		||||
int           bind(int, struct sockaddr *, int)  1,-1,1
 | 
			
		||||
int           connect(int, struct sockaddr *, socklen_t)   1,-1,1
 | 
			
		||||
int           listen(int, int)                   1,-1,1
 | 
			
		||||
int           accept(int, struct sockaddr *, socklen_t *)  1,-1,1
 | 
			
		||||
int           getsockname(int, struct sockaddr *, socklen_t *)  1,-1,1
 | 
			
		||||
int           getpeername(int, struct sockaddr *, socklen_t *)  1,-1,1
 | 
			
		||||
int           sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t)  1,-1,1
 | 
			
		||||
int           recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *)  1,-1,1
 | 
			
		||||
int           shutdown(int, int)  1,-1,1
 | 
			
		||||
int           setsockopt(int, int, int, const void *, socklen_t)  1,-1,1
 | 
			
		||||
int           getsockopt(int, int, int, void *, socklen_t *)    1,-1,1
 | 
			
		||||
int           sendmsg(int, const struct msghdr *, unsigned int)  1,-1,1
 | 
			
		||||
int           recvmsg(int, struct msghdr *, unsigned int)   1,-1,1
 | 
			
		||||
 | 
			
		||||
# sockets for x86. These are done as an "indexed" call to socketcall syscall.
 | 
			
		||||
int           socket:socketcall:1 (int, int, int) -1,102,-1
 | 
			
		||||
int           bind:socketcall:2 (int, struct sockaddr *, int)  -1,102,-1
 | 
			
		||||
int           connect:socketcall:3(int, struct sockaddr *, socklen_t)   -1,102,-1
 | 
			
		||||
int           listen:socketcall:4(int, int)                   -1,102,-1
 | 
			
		||||
int           accept:socketcall:5(int, struct sockaddr *, socklen_t *)  -1,102,-1
 | 
			
		||||
int           getsockname:socketcall:6(int, struct sockaddr *, socklen_t *)  -1,102,-1
 | 
			
		||||
int           getpeername:socketcall:7(int, struct sockaddr *, socklen_t *)  -1,102,-1
 | 
			
		||||
int           socketpair:socketcall:8(int, int, int, int*)    -1,102,-1
 | 
			
		||||
int           sendto:socketcall:11(int, const void *, size_t, int, const struct sockaddr *, socklen_t)  -1,102,-1
 | 
			
		||||
int           recvfrom:socketcall:12(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *)  -1,102,-1
 | 
			
		||||
int           shutdown:socketcall:13(int, int)  -1,102,-1
 | 
			
		||||
int           setsockopt:socketcall:14(int, int, int, const void *, socklen_t)  -1,102,-1
 | 
			
		||||
int           getsockopt:socketcall:15(int, int, int, void *, socklen_t *)    -1,102,-1
 | 
			
		||||
int           sendmsg:socketcall:16(int, const struct msghdr *, unsigned int)  -1,102,-1
 | 
			
		||||
int           recvmsg:socketcall:17(int, struct msghdr *, unsigned int)   -1,102,-1
 | 
			
		||||
int           socket:socketcall:1 (int, int, int) -1,1,-1
 | 
			
		||||
int           bind:socketcall:2 (int, struct sockaddr *, int)  -1,1,-1
 | 
			
		||||
int           connect:socketcall:3(int, struct sockaddr *, socklen_t)   -1,1,-1
 | 
			
		||||
int           listen:socketcall:4(int, int)                   -1,1,-1
 | 
			
		||||
int           accept:socketcall:5(int, struct sockaddr *, socklen_t *)  -1,1,-1
 | 
			
		||||
int           getsockname:socketcall:6(int, struct sockaddr *, socklen_t *)  -1,1,-1
 | 
			
		||||
int           getpeername:socketcall:7(int, struct sockaddr *, socklen_t *)  -1,1,-1
 | 
			
		||||
int           socketpair:socketcall:8(int, int, int, int*)    -1,1,-1
 | 
			
		||||
int           sendto:socketcall:11(int, const void *, size_t, int, const struct sockaddr *, socklen_t)  -1,1,-1
 | 
			
		||||
int           recvfrom:socketcall:12(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *)  -1,1,-1
 | 
			
		||||
int           shutdown:socketcall:13(int, int)  -1,1,-1
 | 
			
		||||
int           setsockopt:socketcall:14(int, int, int, const void *, socklen_t)  -1,1,-1
 | 
			
		||||
int           getsockopt:socketcall:15(int, int, int, void *, socklen_t *)    -1,1,-1
 | 
			
		||||
int           sendmsg:socketcall:16(int, const struct msghdr *, unsigned int)  -1,1,-1
 | 
			
		||||
int           recvmsg:socketcall:17(int, struct msghdr *, unsigned int)   -1,1,-1
 | 
			
		||||
 | 
			
		||||
# scheduler & real-time
 | 
			
		||||
int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param)  156,156,160
 | 
			
		||||
int sched_getscheduler(pid_t pid)  157,157,161
 | 
			
		||||
int sched_yield(void)  158,158,162
 | 
			
		||||
int sched_setparam(pid_t pid, const struct sched_param *param)  154,154,158
 | 
			
		||||
int sched_getparam(pid_t pid, struct sched_param *param)  155,155,159
 | 
			
		||||
int sched_get_priority_max(int policy)  159,159,163
 | 
			
		||||
int sched_get_priority_min(int policy)  160,160,164
 | 
			
		||||
int sched_rr_get_interval(pid_t pid, struct timespec *interval)  161,161,165
 | 
			
		||||
int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) 241,241,239
 | 
			
		||||
int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set)  242,242,240
 | 
			
		||||
int __getcpu:getcpu(unsigned *cpu, unsigned *node, void *unused) 345,318,312
 | 
			
		||||
int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param)  1
 | 
			
		||||
int sched_getscheduler(pid_t pid)  1
 | 
			
		||||
int sched_yield(void)  1
 | 
			
		||||
int sched_setparam(pid_t pid, const struct sched_param *param)  1
 | 
			
		||||
int sched_getparam(pid_t pid, struct sched_param *param)  1
 | 
			
		||||
int sched_get_priority_max(int policy)  1
 | 
			
		||||
int sched_get_priority_min(int policy)  1
 | 
			
		||||
int sched_rr_get_interval(pid_t pid, struct timespec *interval)  1
 | 
			
		||||
int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) 1
 | 
			
		||||
int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set)  1
 | 
			
		||||
int __getcpu:getcpu(unsigned *cpu, unsigned *node, void *unused) 1
 | 
			
		||||
 | 
			
		||||
# io priorities
 | 
			
		||||
int ioprio_set(int which, int who, int ioprio) 314,289,314
 | 
			
		||||
int ioprio_get(int which, int who) 315,290,315
 | 
			
		||||
int ioprio_set(int which, int who, int ioprio) 1
 | 
			
		||||
int ioprio_get(int which, int who) 1
 | 
			
		||||
 | 
			
		||||
# other
 | 
			
		||||
int     uname(struct utsname *)  122
 | 
			
		||||
pid_t   __wait4:wait4(pid_t pid, int *status, int options, struct rusage *rusage)   114
 | 
			
		||||
mode_t  umask(mode_t)  60
 | 
			
		||||
int      __reboot:reboot(int, int, int, void *)  88
 | 
			
		||||
int     __syslog:syslog(int, char *, int)  103
 | 
			
		||||
int     init_module(void *, unsigned long, const char *)  128
 | 
			
		||||
int     delete_module(const char*, unsigned int)   129
 | 
			
		||||
int     klogctl:syslog(int, char *, int)   103
 | 
			
		||||
int     sysinfo(struct sysinfo *)  116
 | 
			
		||||
int     personality(unsigned long)  136
 | 
			
		||||
long    perf_event_open(struct perf_event_attr *attr_uptr, pid_t pid, int cpu, int group_fd, unsigned long flags) 364,336,333
 | 
			
		||||
int     uname(struct utsname *)  1
 | 
			
		||||
mode_t  umask(mode_t)  1
 | 
			
		||||
int      __reboot:reboot(int, int, int, void *)  1
 | 
			
		||||
int     __syslog:syslog(int, char *, int)  1
 | 
			
		||||
int     init_module(void *, unsigned long, const char *)  1
 | 
			
		||||
int     delete_module(const char*, unsigned int)   1
 | 
			
		||||
int     klogctl:syslog(int, char *, int)   1
 | 
			
		||||
int     sysinfo(struct sysinfo *)  1
 | 
			
		||||
int     personality(unsigned long)  1
 | 
			
		||||
long    perf_event_open(struct perf_event_attr *attr_uptr, pid_t pid, int cpu, int group_fd, unsigned long flags) 1
 | 
			
		||||
 | 
			
		||||
# futex
 | 
			
		||||
int	futex(void *, int, int, void *, void *, int) 240,240,238
 | 
			
		||||
int	futex(void *, int, int, void *, void *, int) 1
 | 
			
		||||
 | 
			
		||||
# epoll
 | 
			
		||||
int     epoll_create(int size)     250,254,248
 | 
			
		||||
int     epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)    251,255,249
 | 
			
		||||
int     epoll_wait(int epfd, struct epoll_event *events, int max, int timeout)   252,256,250
 | 
			
		||||
int     epoll_create(int size)     1
 | 
			
		||||
int     epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)    1
 | 
			
		||||
int     epoll_wait(int epfd, struct epoll_event *events, int max, int timeout)   1
 | 
			
		||||
 | 
			
		||||
int     inotify_init(void)      316,291,284
 | 
			
		||||
int     inotify_add_watch(int, const char *, unsigned int)  317,292,285
 | 
			
		||||
int     inotify_rm_watch(int, unsigned int)  318,293,286
 | 
			
		||||
int     inotify_init(void)      1
 | 
			
		||||
int     inotify_add_watch(int, const char *, unsigned int)  1
 | 
			
		||||
int     inotify_rm_watch(int, unsigned int)  1
 | 
			
		||||
 | 
			
		||||
int     poll(struct pollfd *, unsigned int, long)  168,168,188
 | 
			
		||||
int     poll(struct pollfd *, unsigned int, long)  1
 | 
			
		||||
 | 
			
		||||
int     eventfd:eventfd2(unsigned int, int)  356,328,325
 | 
			
		||||
int     eventfd:eventfd2(unsigned int, int)  1
 | 
			
		||||
 | 
			
		||||
# ARM-specific ARM_NR_BASE == 0x0f0000 == 983040
 | 
			
		||||
int     __set_tls:ARM_set_tls(void*)                                 983045,-1,-1
 | 
			
		||||
int     cacheflush:ARM_cacheflush(long start, long end, long flags)  983042,-1,-1
 | 
			
		||||
int     __set_tls:__ARM_NR_set_tls(void*)                                 1,-1,-1
 | 
			
		||||
int     cacheflush:__ARM_NR_cacheflush(long start, long end, long flags)  1,-1,-1
 | 
			
		||||
 | 
			
		||||
# MIPS-specific
 | 
			
		||||
int	_flush_cache:cacheflush(char *addr, const int nbytes, const int op)	-1,-1,147
 | 
			
		||||
int	syscall(int number,...) -1,-1,0
 | 
			
		||||
int     _flush_cache:cacheflush(char *addr, const int nbytes, const int op) -1,-1,1
 | 
			
		||||
int     syscall(int number,...) -1,-1,1
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								libc/arch-arm/arm.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								libc/arch-arm/arm.mk
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
_LIBC_ARCH_COMMON_SRC_FILES := \
 | 
			
		||||
    arch-arm/bionic/abort_arm.S \
 | 
			
		||||
    arch-arm/bionic/atomics_arm.c \
 | 
			
		||||
    arch-arm/bionic/clone.S \
 | 
			
		||||
    arch-arm/bionic/eabi.c \
 | 
			
		||||
    arch-arm/bionic/_exit_with_stack_teardown.S \
 | 
			
		||||
    arch-arm/bionic/ffs.S \
 | 
			
		||||
    arch-arm/bionic/futex_arm.S \
 | 
			
		||||
    arch-arm/bionic/__get_sp.S \
 | 
			
		||||
    arch-arm/bionic/kill.S \
 | 
			
		||||
    arch-arm/bionic/libgcc_compat.c \
 | 
			
		||||
    arch-arm/bionic/memcmp16.S \
 | 
			
		||||
    arch-arm/bionic/memcmp.S \
 | 
			
		||||
    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 \
 | 
			
		||||
 | 
			
		||||
# These are used by the static and dynamic versions of the libc
 | 
			
		||||
# respectively.
 | 
			
		||||
_LIBC_ARCH_STATIC_SRC_FILES := \
 | 
			
		||||
    arch-arm/bionic/exidx_static.c
 | 
			
		||||
 | 
			
		||||
_LIBC_ARCH_DYNAMIC_SRC_FILES := \
 | 
			
		||||
    arch-arm/bionic/exidx_dynamic.c
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
include bionic/libc/arch-arm/$(TARGET_CPU_VARIANT)/$(TARGET_CPU_VARIANT).mk
 | 
			
		||||
@@ -27,7 +27,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
 | 
			
		||||
// void _exit_with_stack_teardown(void* stackBase, int stackSize, int retCode)
 | 
			
		||||
ENTRY(_exit_with_stack_teardown)
 | 
			
		||||
 
 | 
			
		||||
@@ -38,5 +38,5 @@
 | 
			
		||||
ENTRY(abort)
 | 
			
		||||
    .save   {r3, r14}
 | 
			
		||||
    stmfd   sp!, {r3, r14}
 | 
			
		||||
    blx     PIC_SYM(_C_LABEL(__libc_android_abort), PLT)
 | 
			
		||||
    bl      PIC_SYM(_C_LABEL(__libc_android_abort), PLT)
 | 
			
		||||
END(abort)
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <private/logd.h>
 | 
			
		||||
#include <private/libc_logging.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@@ -52,7 +52,7 @@ atexit(void (*func)(void))
 | 
			
		||||
     */
 | 
			
		||||
    static char const warning[] = "WARNING: generic atexit() called from legacy shared library\n";
 | 
			
		||||
 | 
			
		||||
    __libc_android_log_write(ANDROID_LOG_WARN, "libc", warning);
 | 
			
		||||
    __libc_format_log(ANDROID_LOG_WARN, "libc", warning);
 | 
			
		||||
    fprintf(stderr, warning);
 | 
			
		||||
 | 
			
		||||
    return (__cxa_atexit((void (*)(void *))func, NULL, NULL));
 | 
			
		||||
 
 | 
			
		||||
@@ -26,36 +26,39 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
 | 
			
		||||
// int  __pthread_clone(int (*fn)(void*), void* child_stack, int flags, void* arg);
 | 
			
		||||
// int  __pthread_clone(void* (*fn)(void*), void* child_stack, int flags, void* arg);
 | 
			
		||||
ENTRY(__pthread_clone)
 | 
			
		||||
    # Copy the args onto the new stack.
 | 
			
		||||
    stmdb r1!, {r0, r3}
 | 
			
		||||
    # Push 'fn' and 'arg' onto 'child_stack'.
 | 
			
		||||
    stmdb   r1!, {r0, r3}
 | 
			
		||||
 | 
			
		||||
    # The sys_clone system call only takes two arguments: 'flags' and 'child_stack'.
 | 
			
		||||
    # 'child_stack' is already in r1, but we need to move 'flags' into position.
 | 
			
		||||
    mov     r0, r2
 | 
			
		||||
    stmfd   sp!, {r4, r7}
 | 
			
		||||
 | 
			
		||||
    # System call.
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_clone
 | 
			
		||||
    swi     #0
 | 
			
		||||
 | 
			
		||||
    # Child?
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    beq     1f
 | 
			
		||||
 | 
			
		||||
    # In parent, reload saved registers then either exit or set errno.
 | 
			
		||||
    ldmfd   sp!, {r4, r7}
 | 
			
		||||
    bxne    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    # Parent.
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
 | 
			
		||||
1:  # The child.
 | 
			
		||||
    # pick the function arg and call address off the stack and jump
 | 
			
		||||
    # to the C __thread_entry function which does some setup and then
 | 
			
		||||
    # calls the thread's start function
 | 
			
		||||
1:  # Child.
 | 
			
		||||
    # Pop 'fn' and 'arg' back off the stack and call __thread_entry.
 | 
			
		||||
    pop     {r0, r1}
 | 
			
		||||
    # __thread_entry needs the TLS pointer
 | 
			
		||||
    # __thread_entry also needs our stack pointer.
 | 
			
		||||
    mov     r2, sp
 | 
			
		||||
    b       __thread_entry
 | 
			
		||||
END(__pthread_clone)
 | 
			
		||||
@@ -94,10 +97,12 @@ ENTRY(__bionic_clone)
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    beq     1f
 | 
			
		||||
 | 
			
		||||
    # In the parent, reload saved registers then either exit or set errno.
 | 
			
		||||
    # In the parent, reload saved registers then either return or set errno.
 | 
			
		||||
    ldmfd   sp!, {r4, r5, r6, r7}
 | 
			
		||||
    bxne    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
 | 
			
		||||
1:  # The child.
 | 
			
		||||
    ldr    r0, [sp, #-4]
 | 
			
		||||
 
 | 
			
		||||
@@ -31,55 +31,11 @@
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * ffs - find first set bit, this algorithm isolates the first set
 | 
			
		||||
 * bit, then multiplies the number by 0x0450fbaf which leaves the top
 | 
			
		||||
 * 6 bits as an index into the table.  This algorithm should be a win
 | 
			
		||||
 * over the checking each bit in turn as per the C compiled version.
 | 
			
		||||
 *
 | 
			
		||||
 * Some newer ARM architectures have an instruction named
 | 
			
		||||
 * CLZ (count leading Zero's) that is used
 | 
			
		||||
 *
 | 
			
		||||
 * This is the ffs algorithm devised by d.seal and posted to comp.sys.arm on
 | 
			
		||||
 * 16 Feb 1994.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
ENTRY(ffs)
 | 
			
		||||
	/* Standard trick to isolate bottom bit in r0 or 0 if r0 = 0 on entry */
 | 
			
		||||
 	rsb     r1, r0, #0
 | 
			
		||||
 	ands    r0, r0, r1
 | 
			
		||||
#ifndef __ARM_HAVE_CLZ
 | 
			
		||||
	/*
 | 
			
		||||
	 * now r0 has at most one set bit, call this X
 | 
			
		||||
	 * if X = 0, all further instructions are skipped
 | 
			
		||||
	 */
 | 
			
		||||
	adrne   r2, .L_ffs_table
 | 
			
		||||
	orrne   r0, r0, r0, lsl #4  /* r0 = X * 0x11 */ 
 | 
			
		||||
	orrne   r0, r0, r0, lsl #6  /* r0 = X * 0x451 */
 | 
			
		||||
	rsbne   r0, r0, r0, lsl #16 /* r0 = X * 0x0450fbaf */
 | 
			
		||||
              
 | 
			
		||||
	/* now lookup in table indexed on top 6 bits of r0 */
 | 
			
		||||
	ldrneb  r0, [ r2, r0, lsr #26 ]
 | 
			
		||||
 | 
			
		||||
	bx		lr
 | 
			
		||||
END(ffs)
 | 
			
		||||
 | 
			
		||||
.text;
 | 
			
		||||
.type .L_ffs_table, _ASM_TYPE_OBJECT;
 | 
			
		||||
.L_ffs_table:
 | 
			
		||||
/*               0   1   2   3   4   5   6   7           */
 | 
			
		||||
	.byte	 0,  1,  2, 13,  3,  7,  0, 14  /*  0- 7 */
 | 
			
		||||
	.byte	 4,  0,  8,  0,  0,  0,  0, 15  /*  8-15 */
 | 
			
		||||
	.byte	11,  5,  0,  0,  9,  0,  0, 26  /* 16-23 */
 | 
			
		||||
	.byte	 0,  0,  0,  0,  0, 22, 28, 16  /* 24-31 */
 | 
			
		||||
	.byte	32, 12,  6,  0,  0,  0,  0,  0	/* 32-39 */
 | 
			
		||||
	.byte	10,  0,  0, 25,  0,  0, 21, 27  /* 40-47 */
 | 
			
		||||
	.byte	31,  0,  0,  0,  0, 24,  0, 20  /* 48-55 */
 | 
			
		||||
	.byte   30,  0, 23, 19, 29, 18, 17,  0  /* 56-63 */
 | 
			
		||||
#else /* !defined(__ARM_HAVE_CLZ) */
 | 
			
		||||
	clzne	r0, r0
 | 
			
		||||
	rsbne	r0, r0, #32
 | 
			
		||||
	bx		lr
 | 
			
		||||
END(ffs)
 | 
			
		||||
#endif /* !defined(__ARM_HAVE_CLZ) */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
#define FUTEX_WAIT 0
 | 
			
		||||
@@ -34,11 +34,10 @@
 | 
			
		||||
 | 
			
		||||
// __futex_syscall3(*ftx, op, val)
 | 
			
		||||
ENTRY(__futex_syscall3)
 | 
			
		||||
    stmdb   sp!, {r4, r7}
 | 
			
		||||
    .save   {r4, r7}
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_futex
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmia   sp!, {r4, r7}
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    bx      lr
 | 
			
		||||
END(__futex_syscall3)
 | 
			
		||||
 | 
			
		||||
@@ -49,25 +48,23 @@ END(__futex_syscall4)
 | 
			
		||||
 | 
			
		||||
// __futex_wait(*ftx, val, *timespec)
 | 
			
		||||
ENTRY(__futex_wait)
 | 
			
		||||
    stmdb   sp!, {r4, r7}
 | 
			
		||||
    .save   {r4, r7}
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    mov     r3, r2
 | 
			
		||||
    mov     r2, r1
 | 
			
		||||
    mov     r1, #FUTEX_WAIT
 | 
			
		||||
    ldr     r7, =__NR_futex
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmia   sp!, {r4, r7}
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    bx      lr
 | 
			
		||||
END(__futex_wait)
 | 
			
		||||
 | 
			
		||||
// __futex_wake(*ftx, counter)
 | 
			
		||||
ENTRY(__futex_wake)
 | 
			
		||||
    .save   {r4, r7}
 | 
			
		||||
    stmdb   sp!, {r4, r7}
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    mov     r2, r1
 | 
			
		||||
    mov     r1, #FUTEX_WAKE
 | 
			
		||||
    ldr     r7, =__NR_futex
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmia   sp!, {r4, r7}
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    bx      lr
 | 
			
		||||
END(__futex_wake)
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,11 @@
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
/* unlike our auto-generated syscall stubs, this code saves lr
 | 
			
		||||
   on the stack, as well as a few other registers. this makes
 | 
			
		||||
   our stack unwinder happy, when we generate debug stack
 | 
			
		||||
@@ -32,19 +37,14 @@
 | 
			
		||||
   abort due to a fatal runtime error (e.g. detection
 | 
			
		||||
   of a corrupted malloc heap).
 | 
			
		||||
*/
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
#ifndef __NR_kill
 | 
			
		||||
#define __NR_kill   37
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ENTRY(kill)
 | 
			
		||||
    stmfd   sp!, {r4-r7, ip, lr}
 | 
			
		||||
    ldr     r7, =__NR_kill
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmfd   sp!, {r4-r7, ip, lr}
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(kill)
 | 
			
		||||
 
 | 
			
		||||
@@ -115,7 +115,7 @@ ENTRY(memcmp)
 | 
			
		||||
         * pointer somewhere else
 | 
			
		||||
         */
 | 
			
		||||
         mov        r4, r0
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        /* align first pointer to word boundary
 | 
			
		||||
         * offset = -src & 3
 | 
			
		||||
         */
 | 
			
		||||
@@ -151,7 +151,7 @@ ENTRY(memcmp)
 | 
			
		||||
        ldr         ip, [r1]
 | 
			
		||||
        subs        r2, r2, #(32 + 4)
 | 
			
		||||
        bmi         1f
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
0:      pld         [r4, #(CACHE_LINE_SIZE * 2)]
 | 
			
		||||
        pld         [r1, #(CACHE_LINE_SIZE * 2)]
 | 
			
		||||
        ldr         r0, [r4], #4
 | 
			
		||||
@@ -178,14 +178,14 @@ ENTRY(memcmp)
 | 
			
		||||
        ldreq       r0, [r4], #4
 | 
			
		||||
        ldreq       ip, [r1, #4]!
 | 
			
		||||
        eoreqs      r0, r0, lr
 | 
			
		||||
        bne         2f        
 | 
			
		||||
        bne         2f
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        bhs         0b
 | 
			
		||||
 | 
			
		||||
        /* do we have at least 4 bytes left? */
 | 
			
		||||
1:      adds        r2, r2, #(32 - 4 + 4)
 | 
			
		||||
        bmi         4f
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        /* finish off 4 bytes at a time */
 | 
			
		||||
3:      ldr         r0, [r4], #4
 | 
			
		||||
        ldr         ip, [r1], #4
 | 
			
		||||
@@ -233,17 +233,14 @@ ENTRY(memcmp)
 | 
			
		||||
        subs        r2, r2, #1
 | 
			
		||||
        bne         11b
 | 
			
		||||
        bx          lr
 | 
			
		||||
END(memcmp)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
5:      /*************** non-congruent case ***************/
 | 
			
		||||
        and         r0, r1, #3      
 | 
			
		||||
        and         r0, r1, #3
 | 
			
		||||
        cmp         r0, #2
 | 
			
		||||
        bne         4f
 | 
			
		||||
 | 
			
		||||
        /* here, offset is 2 (16-bits aligned, special cased) */
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        /* make sure we have at least 16 bytes to process */
 | 
			
		||||
        subs        r2, r2, #16
 | 
			
		||||
        addmi       r2, r2, #16
 | 
			
		||||
@@ -341,3 +338,4 @@ END(memcmp)
 | 
			
		||||
        mov         r2, #4
 | 
			
		||||
		ldmfd		sp!, {r5, r6, r7}
 | 
			
		||||
        b           8b
 | 
			
		||||
END(memcmp)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										406
									
								
								libc/arch-arm/bionic/memcpy.a15.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										406
									
								
								libc/arch-arm/bionic/memcpy.a15.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,406 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
    /* Prototype: void *memcpy (void *dst, const void *src, size_t count).  */
 | 
			
		||||
 | 
			
		||||
        /* Use the version of memcpy implemented using LDRD and STRD.
 | 
			
		||||
           This version is tuned for Cortex-A15.
 | 
			
		||||
           This might not be the best for other ARMv7-A CPUs,
 | 
			
		||||
           but there is no predefine to distinguish between
 | 
			
		||||
           different CPUs in the same architecture,
 | 
			
		||||
           and this version is better than the plain memcpy provided in newlib.
 | 
			
		||||
 | 
			
		||||
           Therefore, we use this version for all ARMv7-A CPUS.  */
 | 
			
		||||
 | 
			
		||||
        /* To make the same code compile for both ARM and Thumb instruction
 | 
			
		||||
       sets, switch to unified syntax at the beginning of this function.
 | 
			
		||||
           However, by using the same code, we may be missing optimization
 | 
			
		||||
       opportunities.  For instance, in LDRD/STRD instructions, the first
 | 
			
		||||
       destination register must be even and the second consecutive in
 | 
			
		||||
       ARM state, but not in Thumb state.  */
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
        .syntax         unified
 | 
			
		||||
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
 | 
			
		||||
       /* Assumes that n >= 0, and dst, src are valid pointers.
 | 
			
		||||
          If there is at least 8 bytes to copy, use LDRD/STRD.
 | 
			
		||||
          If src and dst are misaligned with different offsets,
 | 
			
		||||
          first copy byte by byte until dst is aligned,
 | 
			
		||||
          and then copy using LDRD/STRD and shift if needed.
 | 
			
		||||
          When less than 8 left, copy a word and then byte by byte.  */
 | 
			
		||||
 | 
			
		||||
       /* Save registers (r0 holds the return value):
 | 
			
		||||
          optimized push {r0, r4, r5, r6, r7, lr}.
 | 
			
		||||
          To try and improve performance, stack layout changed,
 | 
			
		||||
          i.e., not keeping the stack looking like users expect
 | 
			
		||||
          (highest numbered register at highest address).  */
 | 
			
		||||
        .save   {r0, lr}
 | 
			
		||||
        push    {r0, lr}
 | 
			
		||||
        .save   {r4, r5}
 | 
			
		||||
        strd    r4, r5, [sp, #-8]!
 | 
			
		||||
        .save   {r6, r7}
 | 
			
		||||
        strd    r6, r7, [sp, #-8]!
 | 
			
		||||
 | 
			
		||||
       /* 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.  */
 | 
			
		||||
 | 
			
		||||
        /* Get copying of tiny blocks out of the way first.  */
 | 
			
		||||
        /* Is there at least 4 bytes to copy?  */
 | 
			
		||||
        subs    r2, r2, #4
 | 
			
		||||
        blt     copy_less_than_4                 /* If n < 4.  */
 | 
			
		||||
 | 
			
		||||
        /* Check word alignment.  */
 | 
			
		||||
        ands    ip, r0, #3                       /* ip = last 2 bits of dst.  */
 | 
			
		||||
        bne     dst_not_word_aligned             /* If dst is not word-aligned.  */
 | 
			
		||||
 | 
			
		||||
        /* Get here if dst is word-aligned.  */
 | 
			
		||||
        ands    ip, r1, #3                      /* ip = last 2 bits of src.  */
 | 
			
		||||
        bne     src_not_word_aligned            /* If src is not word-aligned.  */
 | 
			
		||||
word_aligned:
 | 
			
		||||
        /* Get here if source and dst both are word-aligned.
 | 
			
		||||
           The number of bytes remaining to copy is r2+4.  */
 | 
			
		||||
 | 
			
		||||
        /* Is there is at least 64 bytes to copy?  */
 | 
			
		||||
        subs    r2, r2, #60
 | 
			
		||||
        blt     copy_less_than_64                /* If r2 + 4 < 64.  */
 | 
			
		||||
 | 
			
		||||
        /* First, align the destination buffer to 8-bytes,
 | 
			
		||||
           to make sure double loads and stores don't cross 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 cacheline boundary.
 | 
			
		||||
           This check and realignment are only worth doing
 | 
			
		||||
           if there is a lot to copy.  */
 | 
			
		||||
 | 
			
		||||
        /* Get here if dst is word aligned,
 | 
			
		||||
           i.e., the 2 least significant bits are 0.
 | 
			
		||||
           If dst is not 2w aligned (i.e., the 3rd bit is not set in dst),
 | 
			
		||||
           then copy 1 word (4 bytes).  */
 | 
			
		||||
        ands    r3, r0, #4
 | 
			
		||||
        beq     11f                  /* If dst already two-word aligned.  */
 | 
			
		||||
        ldr     r3, [r1], #4
 | 
			
		||||
        str     r3, [r0], #4
 | 
			
		||||
        subs    r2, r2, #4
 | 
			
		||||
        blt     copy_less_than_64
 | 
			
		||||
 | 
			
		||||
11:
 | 
			
		||||
        /* TODO: Align to cacheline (useful for PLD optimization).  */
 | 
			
		||||
 | 
			
		||||
        /* Every loop iteration copies 64 bytes.  */
 | 
			
		||||
1:
 | 
			
		||||
        .irp    offset, #0, #8, #16, #24, #32, #40, #48, #56
 | 
			
		||||
        ldrd    r4, r5, [r1, \offset]
 | 
			
		||||
        strd    r4, r5, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
 | 
			
		||||
        add     r0, r0, #64
 | 
			
		||||
        add     r1, r1, #64
 | 
			
		||||
        subs    r2, r2, #64
 | 
			
		||||
        bge     1b                            /* If there is more to copy.  */
 | 
			
		||||
 | 
			
		||||
copy_less_than_64:
 | 
			
		||||
 | 
			
		||||
        /* Get here if less than 64 bytes to copy, -64 <= r2 < 0.
 | 
			
		||||
           Restore the count if there is more than 7 bytes to copy.  */
 | 
			
		||||
        adds    r2, r2, #56
 | 
			
		||||
        blt     copy_less_than_8
 | 
			
		||||
 | 
			
		||||
        /* Copy 8 bytes at a time.  */
 | 
			
		||||
2:
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        strd    r4, r5, [r0], #8
 | 
			
		||||
        subs    r2, r2, #8
 | 
			
		||||
        bge     2b                            /* If there is more to copy.  */
 | 
			
		||||
 | 
			
		||||
copy_less_than_8:
 | 
			
		||||
 | 
			
		||||
        /* Get here if less than 8 bytes to copy, -8 <= r2 < 0.
 | 
			
		||||
           Check if there is more to copy.  */
 | 
			
		||||
        cmn     r2, #8
 | 
			
		||||
        beq     return                          /* If r2 + 8 == 0.  */
 | 
			
		||||
 | 
			
		||||
        /* Restore the count if there is more than 3 bytes to copy.  */
 | 
			
		||||
        adds    r2, r2, #4
 | 
			
		||||
        blt     copy_less_than_4
 | 
			
		||||
 | 
			
		||||
        /* Copy 4 bytes.  */
 | 
			
		||||
        ldr     r3, [r1], #4
 | 
			
		||||
        str     r3, [r0], #4
 | 
			
		||||
 | 
			
		||||
copy_less_than_4:
 | 
			
		||||
        /* Get here if less than 4 bytes to copy, -4 <= r2 < 0.  */
 | 
			
		||||
 | 
			
		||||
        /* Restore the count, check if there is more to copy.  */
 | 
			
		||||
        adds    r2, r2, #4
 | 
			
		||||
        beq     return                          /* If r2 == 0.  */
 | 
			
		||||
 | 
			
		||||
        /* Get here with r2 is in {1,2,3}={01,10,11}.  */
 | 
			
		||||
        /* Logical shift left r2, insert 0s, update flags.  */
 | 
			
		||||
        lsls    r2, r2, #31
 | 
			
		||||
 | 
			
		||||
        /* Copy byte by byte.
 | 
			
		||||
           Condition ne means the last bit of r2 is 0.
 | 
			
		||||
           Condition cs means the second to last bit of r2 is set,
 | 
			
		||||
           i.e., r2 is 1 or 3.  */
 | 
			
		||||
        itt     ne
 | 
			
		||||
        ldrbne  r3, [r1], #1
 | 
			
		||||
        strbne  r3, [r0], #1
 | 
			
		||||
 | 
			
		||||
        itttt   cs
 | 
			
		||||
        ldrbcs  r4, [r1], #1
 | 
			
		||||
        ldrbcs  r5, [r1]
 | 
			
		||||
        strbcs  r4, [r0], #1
 | 
			
		||||
        strbcs  r5, [r0]
 | 
			
		||||
 | 
			
		||||
return:
 | 
			
		||||
        /* Restore registers: optimized pop {r0, r4, r5, r6, r7, pc}   */
 | 
			
		||||
        /* This is the only return point of memcpy.  */
 | 
			
		||||
        ldrd r6, r7, [sp], #8
 | 
			
		||||
        ldrd r4, r5, [sp], #8
 | 
			
		||||
        pop {r0, pc}
 | 
			
		||||
 | 
			
		||||
#ifndef __ARM_FEATURE_UNALIGNED
 | 
			
		||||
 | 
			
		||||
       /* The following assembly macro implements misaligned copy in software.
 | 
			
		||||
          Assumes that dst is word aligned, src is at offset "pull" bits from
 | 
			
		||||
      word, push = 32 - pull, and the number of bytes that remain to copy
 | 
			
		||||
      is r2 + 4, r2 >= 0.  */
 | 
			
		||||
 | 
			
		||||
       /* In the code below, r2 is the number of bytes that remain to be
 | 
			
		||||
      written.  The number of bytes read is always larger, because we have
 | 
			
		||||
      partial words in the shift queue.  */
 | 
			
		||||
 | 
			
		||||
        .macro  miscopy pull push shiftleft shiftright
 | 
			
		||||
 | 
			
		||||
        /* Align src to the previous word boundary.  */
 | 
			
		||||
        bic     r1, r1, #3
 | 
			
		||||
 | 
			
		||||
        /* Initialize the shift queue.  */
 | 
			
		||||
        ldr     r5, [r1], #4                   /* Load a word from source.  */
 | 
			
		||||
 | 
			
		||||
        subs    r2, r2, #4
 | 
			
		||||
        blt     6f          /* Go to misaligned copy of less than 8 bytes.  */
 | 
			
		||||
 | 
			
		||||
       /* Get here if there is more than 8 bytes to copy.
 | 
			
		||||
          The number of bytes to copy is r2+8, r2 >= 0.  */
 | 
			
		||||
 | 
			
		||||
       subs     r2, r2, #56
 | 
			
		||||
       blt      4f         /* Go to misaligned copy of less than 64 bytes.  */
 | 
			
		||||
 | 
			
		||||
3:
 | 
			
		||||
       /* Get here if there is more than 64 bytes to copy.
 | 
			
		||||
          The number of bytes to copy is r2+64, r2 >= 0.  */
 | 
			
		||||
 | 
			
		||||
       /* Copy 64 bytes in every iteration.
 | 
			
		||||
          Use a partial word from the shift queue.  */
 | 
			
		||||
        .irp    offset, #0, #8, #16, #24, #32, #40, #48, #56
 | 
			
		||||
        mov     r6, r5, \shiftleft #\pull
 | 
			
		||||
        ldrd    r4, r5, [r1, \offset]
 | 
			
		||||
        orr     r6, r6, r4, \shiftright #\push
 | 
			
		||||
        mov     r7, r4, \shiftleft #\pull
 | 
			
		||||
        orr     r7, r7, r5, \shiftright #\push
 | 
			
		||||
        strd    r6, r7, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
 | 
			
		||||
        add     r1, r1, #64
 | 
			
		||||
        add     r0, r0, #64
 | 
			
		||||
        subs    r2, r2, #64
 | 
			
		||||
        bge     3b
 | 
			
		||||
 | 
			
		||||
4:
 | 
			
		||||
       /* Get here if there is less than 64 bytes to copy (-64 <= r2 < 0)
 | 
			
		||||
      and they are misaligned.  */
 | 
			
		||||
 | 
			
		||||
       /* Restore the count if there is more than 7 bytes to copy.  */
 | 
			
		||||
        adds    r2, r2, #56
 | 
			
		||||
 | 
			
		||||
        blt     6f          /* Go to misaligned copy of less than 8 bytes.  */
 | 
			
		||||
 | 
			
		||||
5:
 | 
			
		||||
        /* Copy 8 bytes at a time.
 | 
			
		||||
           Use a partial word from the shift queue.  */
 | 
			
		||||
        mov     r6, r5, \shiftleft #\pull
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        orr     r6, r6, r4, \shiftright #\push
 | 
			
		||||
        mov     r7, r4, \shiftleft #\pull
 | 
			
		||||
        orr     r7, r7, r5, \shiftright #\push
 | 
			
		||||
        strd    r6, r7, [r0], #8
 | 
			
		||||
 | 
			
		||||
        subs    r2, r2, #8
 | 
			
		||||
        bge     5b                        /* If there is more to copy.  */
 | 
			
		||||
 | 
			
		||||
6:
 | 
			
		||||
        /* Get here if there less than 8 bytes to copy (-8 <= r2 < 0)
 | 
			
		||||
           and they are misaligned.  */
 | 
			
		||||
 | 
			
		||||
        /* Check if there is more to copy.  */
 | 
			
		||||
        cmn     r2, #8
 | 
			
		||||
        beq     return
 | 
			
		||||
 | 
			
		||||
        /* Check if there is less than 4 bytes to copy.  */
 | 
			
		||||
        cmn     r2, #4
 | 
			
		||||
 | 
			
		||||
        itt     lt
 | 
			
		||||
        /* Restore src offset from word-align.  */
 | 
			
		||||
        sublt   r1, r1, #(\push / 8)
 | 
			
		||||
        blt     copy_less_than_4
 | 
			
		||||
 | 
			
		||||
        /* Use a partial word from the shift queue.  */
 | 
			
		||||
        mov     r3, r5, \shiftleft #\pull
 | 
			
		||||
        /* Load a word from src, but without writeback
 | 
			
		||||
           (this word is not fully written to dst).  */
 | 
			
		||||
        ldr     r5, [r1]
 | 
			
		||||
 | 
			
		||||
        /* Restore src offset from word-align.  */
 | 
			
		||||
        add     r1, r1, #(\pull / 8)
 | 
			
		||||
 | 
			
		||||
        /* Shift bytes to create one dst word and store it.  */
 | 
			
		||||
        orr     r3, r3, r5, \shiftright #\push
 | 
			
		||||
        str     r3, [r0], #4
 | 
			
		||||
 | 
			
		||||
        /* Use single byte copying of the remaining bytes.  */
 | 
			
		||||
        b       copy_less_than_4
 | 
			
		||||
 | 
			
		||||
        .endm
 | 
			
		||||
 | 
			
		||||
#endif /* not __ARM_FEATURE_UNALIGNED  */
 | 
			
		||||
 | 
			
		||||
dst_not_word_aligned:
 | 
			
		||||
 | 
			
		||||
       /* Get here when dst is not aligned and ip has the last 2 bits of dst,
 | 
			
		||||
          i.e., ip is the offset of dst from word.
 | 
			
		||||
          The number of bytes that remains to copy is r2 + 4,
 | 
			
		||||
          i.e., there are at least 4 bytes to copy.
 | 
			
		||||
          Write a partial word (0 to 3 bytes), such that dst becomes
 | 
			
		||||
      word-aligned.  */
 | 
			
		||||
 | 
			
		||||
       /* If dst is at ip bytes offset from a word (with 0 < ip < 4),
 | 
			
		||||
          then there are (4 - ip) bytes to fill up to align dst to the next
 | 
			
		||||
      word.  */
 | 
			
		||||
        rsb     ip, ip, #4                        /* ip = #4 - ip.  */
 | 
			
		||||
        cmp     ip, #2
 | 
			
		||||
 | 
			
		||||
       /* Copy byte by byte with conditionals.  */
 | 
			
		||||
        itt     gt
 | 
			
		||||
        ldrbgt  r3, [r1], #1
 | 
			
		||||
        strbgt  r3, [r0], #1
 | 
			
		||||
 | 
			
		||||
        itt     ge
 | 
			
		||||
        ldrbge  r4, [r1], #1
 | 
			
		||||
        strbge  r4, [r0], #1
 | 
			
		||||
 | 
			
		||||
        ldrb    lr, [r1], #1
 | 
			
		||||
        strb    lr, [r0], #1
 | 
			
		||||
 | 
			
		||||
       /* Update the count.
 | 
			
		||||
          ip holds the number of bytes we have just copied.  */
 | 
			
		||||
        subs    r2, r2, ip                        /* r2 = r2 - ip.  */
 | 
			
		||||
        blt     copy_less_than_4                  /* If r2 < ip.  */
 | 
			
		||||
 | 
			
		||||
       /* Get here if there are more than 4 bytes to copy.
 | 
			
		||||
          Check if src is aligned.  If beforehand src and dst were not word
 | 
			
		||||
      aligned but congruent (same offset), then now they are both
 | 
			
		||||
      word-aligned, and we can copy the rest efficiently (without
 | 
			
		||||
      shifting).  */
 | 
			
		||||
        ands    ip, r1, #3                    /* ip = last 2 bits of src.  */
 | 
			
		||||
        beq     word_aligned                  /* If r1 is word-aligned.  */
 | 
			
		||||
 | 
			
		||||
src_not_word_aligned:
 | 
			
		||||
       /* Get here when src is not word-aligned, but dst is word-aligned.
 | 
			
		||||
          The number of bytes that remains to copy is r2+4.  */
 | 
			
		||||
 | 
			
		||||
#ifdef __ARM_FEATURE_UNALIGNED
 | 
			
		||||
       /* Copy word by word using LDR when alignment can be done in hardware,
 | 
			
		||||
          i.e., SCTLR.A is set, supporting unaligned access in LDR and STR.  */
 | 
			
		||||
        subs    r2, r2, #60
 | 
			
		||||
        blt     8f
 | 
			
		||||
 | 
			
		||||
7:
 | 
			
		||||
        /* Copy 64 bytes in every loop iteration.  */
 | 
			
		||||
        .irp    offset, #0, #4, #8, #12, #16, #20, #24, #28, #32, #36, #40, #44, #48, #52, #56, #60
 | 
			
		||||
        ldr     r3, [r1, \offset]
 | 
			
		||||
        str     r3, [r0, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
 | 
			
		||||
        add     r0, r0, #64
 | 
			
		||||
        add     r1, r1, #64
 | 
			
		||||
        subs    r2, r2, #64
 | 
			
		||||
        bge     7b
 | 
			
		||||
 | 
			
		||||
8:
 | 
			
		||||
        /* Get here if less than 64 bytes to copy, -64 <= r2 < 0.
 | 
			
		||||
           Check if there is more than 3 bytes to copy.  */
 | 
			
		||||
        adds    r2, r2, #60
 | 
			
		||||
        blt     copy_less_than_4
 | 
			
		||||
 | 
			
		||||
9:
 | 
			
		||||
       /* Get here if there is less than 64 but at least 4 bytes to copy,
 | 
			
		||||
          where the number of bytes to copy is r2+4.  */
 | 
			
		||||
        ldr     r3, [r1], #4
 | 
			
		||||
        str     r3, [r0], #4
 | 
			
		||||
        subs    r2, r2, #4
 | 
			
		||||
        bge     9b
 | 
			
		||||
 | 
			
		||||
        b       copy_less_than_4
 | 
			
		||||
 | 
			
		||||
#else /* not __ARM_FEATURE_UNALIGNED  */
 | 
			
		||||
 | 
			
		||||
       /* ip has last 2 bits of src,
 | 
			
		||||
          i.e., ip is the offset of src from word, and ip > 0.
 | 
			
		||||
          Compute shifts needed to copy from src to dst.  */
 | 
			
		||||
        cmp     ip, #2
 | 
			
		||||
        beq     miscopy_16_16             /* If ip == 2.  */
 | 
			
		||||
        bge     miscopy_24_8              /* If ip == 3.  */
 | 
			
		||||
 | 
			
		||||
        /* Get here if ip == 1.  */
 | 
			
		||||
 | 
			
		||||
        /* Endian independent macros for shifting bytes within registers.  */
 | 
			
		||||
 | 
			
		||||
#ifndef __ARMEB__
 | 
			
		||||
miscopy_8_24:   miscopy pull=8 push=24 shiftleft=lsr shiftright=lsl
 | 
			
		||||
miscopy_16_16:  miscopy pull=16 push=16 shiftleft=lsr shiftright=lsl
 | 
			
		||||
miscopy_24_8:   miscopy pull=24 push=8 shiftleft=lsr shiftright=lsl
 | 
			
		||||
#else  /* not __ARMEB__ */
 | 
			
		||||
miscopy_8_24:   miscopy pull=8 push=24 shiftleft=lsl shiftright=lsr
 | 
			
		||||
miscopy_16_16:  miscopy pull=16 push=16 shiftleft=lsl shiftright=lsr
 | 
			
		||||
miscopy_24_8:   miscopy pull=24 push=8 shiftleft=lsl shiftright=lsr
 | 
			
		||||
#endif  /* not __ARMEB__ */
 | 
			
		||||
 | 
			
		||||
#endif  /* not __ARM_FEATURE_UNALIGNED  */
 | 
			
		||||
 | 
			
		||||
END(memcpy)
 | 
			
		||||
							
								
								
									
										614
									
								
								libc/arch-arm/bionic/memcpy.a9.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										614
									
								
								libc/arch-arm/bionic/memcpy.a9.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,614 @@
 | 
			
		||||
/* Copyright (c) 2013, Linaro Limited
 | 
			
		||||
   All rights reserved.
 | 
			
		||||
 | 
			
		||||
   Redistribution and use in source and binary forms, with or without
 | 
			
		||||
   modification, are permitted provided that the following conditions
 | 
			
		||||
   are met:
 | 
			
		||||
 | 
			
		||||
      * Redistributions of source code must retain the above copyright
 | 
			
		||||
      notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 | 
			
		||||
      * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
      notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
      documentation and/or other materials provided with the distribution.
 | 
			
		||||
 | 
			
		||||
      * Neither the name of Linaro Limited nor the names of its
 | 
			
		||||
      contributors may be used to endorse or promote products derived
 | 
			
		||||
      from this software without specific prior written permission.
 | 
			
		||||
 | 
			
		||||
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 | 
			
		||||
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 | 
			
		||||
   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
			
		||||
   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 | 
			
		||||
   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 | 
			
		||||
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 | 
			
		||||
   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 | 
			
		||||
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | 
			
		||||
   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
   This memcpy routine is optimised for Cortex-A15 cores and takes advantage
 | 
			
		||||
   of VFP or NEON when built with the appropriate flags.
 | 
			
		||||
 | 
			
		||||
   Assumptions:
 | 
			
		||||
 | 
			
		||||
    ARMv6 (ARMv7-a if using Neon)
 | 
			
		||||
    ARM state
 | 
			
		||||
    Unaligned accesses
 | 
			
		||||
    LDRD/STRD support unaligned word accesses
 | 
			
		||||
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
	.syntax unified
 | 
			
		||||
	/* This implementation requires ARM state.  */
 | 
			
		||||
	.arm
 | 
			
		||||
 | 
			
		||||
#ifdef __ARM_NEON__
 | 
			
		||||
 | 
			
		||||
	.fpu	neon
 | 
			
		||||
	.arch	armv7-a
 | 
			
		||||
# define FRAME_SIZE	4
 | 
			
		||||
# define USE_VFP
 | 
			
		||||
# define USE_NEON
 | 
			
		||||
 | 
			
		||||
#elif !defined (__SOFTFP__)
 | 
			
		||||
 | 
			
		||||
	.arch	armv6
 | 
			
		||||
	.fpu	vfpv2
 | 
			
		||||
# define FRAME_SIZE	32
 | 
			
		||||
# define USE_VFP
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
	.arch	armv6
 | 
			
		||||
# define FRAME_SIZE    32
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Old versions of GAS incorrectly implement the NEON align semantics.  */
 | 
			
		||||
#ifdef BROKEN_ASM_NEON_ALIGN
 | 
			
		||||
#define ALIGN(addr, align) addr,:align
 | 
			
		||||
#else
 | 
			
		||||
#define ALIGN(addr, align) addr:align
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define PC_OFFSET	8	/* PC pipeline compensation.  */
 | 
			
		||||
#define INSN_SIZE	4
 | 
			
		||||
 | 
			
		||||
/* Call parameters.  */
 | 
			
		||||
#define dstin	r0
 | 
			
		||||
#define src	r1
 | 
			
		||||
#define count	r2
 | 
			
		||||
 | 
			
		||||
/* Locals.  */
 | 
			
		||||
#define tmp1	r3
 | 
			
		||||
#define dst	ip
 | 
			
		||||
#define tmp2	r10
 | 
			
		||||
 | 
			
		||||
#ifndef USE_NEON
 | 
			
		||||
/* For bulk copies using GP registers.  */
 | 
			
		||||
#define	A_l	r2		/* Call-clobbered.  */
 | 
			
		||||
#define	A_h	r3		/* Call-clobbered.  */
 | 
			
		||||
#define	B_l	r4
 | 
			
		||||
#define	B_h	r5
 | 
			
		||||
#define	C_l	r6
 | 
			
		||||
#define	C_h	r7
 | 
			
		||||
#define	D_l	r8
 | 
			
		||||
#define	D_h	r9
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Number of lines ahead to pre-fetch data.  If you change this the code
 | 
			
		||||
   below will need adjustment to compensate.  */
 | 
			
		||||
 | 
			
		||||
#define prefetch_lines	5
 | 
			
		||||
 | 
			
		||||
#ifdef USE_VFP
 | 
			
		||||
	.macro	cpy_line_vfp vreg, base
 | 
			
		||||
	vstr	\vreg, [dst, #\base]
 | 
			
		||||
	vldr	\vreg, [src, #\base]
 | 
			
		||||
	vstr	d0, [dst, #\base + 8]
 | 
			
		||||
	vldr	d0, [src, #\base + 8]
 | 
			
		||||
	vstr	d1, [dst, #\base + 16]
 | 
			
		||||
	vldr	d1, [src, #\base + 16]
 | 
			
		||||
	vstr	d2, [dst, #\base + 24]
 | 
			
		||||
	vldr	d2, [src, #\base + 24]
 | 
			
		||||
	vstr	\vreg, [dst, #\base + 32]
 | 
			
		||||
	vldr	\vreg, [src, #\base + prefetch_lines * 64 - 32]
 | 
			
		||||
	vstr	d0, [dst, #\base + 40]
 | 
			
		||||
	vldr	d0, [src, #\base + 40]
 | 
			
		||||
	vstr	d1, [dst, #\base + 48]
 | 
			
		||||
	vldr	d1, [src, #\base + 48]
 | 
			
		||||
	vstr	d2, [dst, #\base + 56]
 | 
			
		||||
	vldr	d2, [src, #\base + 56]
 | 
			
		||||
	.endm
 | 
			
		||||
 | 
			
		||||
	.macro	cpy_tail_vfp vreg, base
 | 
			
		||||
	vstr	\vreg, [dst, #\base]
 | 
			
		||||
	vldr	\vreg, [src, #\base]
 | 
			
		||||
	vstr	d0, [dst, #\base + 8]
 | 
			
		||||
	vldr	d0, [src, #\base + 8]
 | 
			
		||||
	vstr	d1, [dst, #\base + 16]
 | 
			
		||||
	vldr	d1, [src, #\base + 16]
 | 
			
		||||
	vstr	d2, [dst, #\base + 24]
 | 
			
		||||
	vldr	d2, [src, #\base + 24]
 | 
			
		||||
	vstr	\vreg, [dst, #\base + 32]
 | 
			
		||||
	vstr	d0, [dst, #\base + 40]
 | 
			
		||||
	vldr	d0, [src, #\base + 40]
 | 
			
		||||
	vstr	d1, [dst, #\base + 48]
 | 
			
		||||
	vldr	d1, [src, #\base + 48]
 | 
			
		||||
	vstr	d2, [dst, #\base + 56]
 | 
			
		||||
	vldr	d2, [src, #\base + 56]
 | 
			
		||||
	.endm
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	.p2align 6
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
 | 
			
		||||
	mov	dst, dstin	/* Preserve dstin, we need to return it.  */
 | 
			
		||||
	cmp	count, #64
 | 
			
		||||
	bge	.Lcpy_not_short
 | 
			
		||||
	/* Deal with small copies quickly by dropping straight into the
 | 
			
		||||
	   exit block.  */
 | 
			
		||||
 | 
			
		||||
.Ltail63unaligned:
 | 
			
		||||
#ifdef USE_NEON
 | 
			
		||||
	and	tmp1, count, #0x38
 | 
			
		||||
	rsb	tmp1, tmp1, #(56 - PC_OFFSET + INSN_SIZE)
 | 
			
		||||
	add	pc, pc, tmp1
 | 
			
		||||
	vld1.8	{d0}, [src]!	/* 14 words to go.  */
 | 
			
		||||
	vst1.8	{d0}, [dst]!
 | 
			
		||||
	vld1.8	{d0}, [src]!	/* 12 words to go.  */
 | 
			
		||||
	vst1.8	{d0}, [dst]!
 | 
			
		||||
	vld1.8	{d0}, [src]!	/* 10 words to go.  */
 | 
			
		||||
	vst1.8	{d0}, [dst]!
 | 
			
		||||
	vld1.8	{d0}, [src]!	/* 8 words to go.  */
 | 
			
		||||
	vst1.8	{d0}, [dst]!
 | 
			
		||||
	vld1.8	{d0}, [src]!	/* 6 words to go.  */
 | 
			
		||||
	vst1.8	{d0}, [dst]!
 | 
			
		||||
	vld1.8	{d0}, [src]!	/* 4 words to go.  */
 | 
			
		||||
	vst1.8	{d0}, [dst]!
 | 
			
		||||
	vld1.8	{d0}, [src]!	/* 2 words to go.  */
 | 
			
		||||
	vst1.8	{d0}, [dst]!
 | 
			
		||||
 | 
			
		||||
	tst	count, #4
 | 
			
		||||
	ldrne	tmp1, [src], #4
 | 
			
		||||
	strne	tmp1, [dst], #4
 | 
			
		||||
#else
 | 
			
		||||
	/* Copy up to 15 full words of data.  May not be aligned.  */
 | 
			
		||||
	/* Cannot use VFP for unaligned data.  */
 | 
			
		||||
	and	tmp1, count, #0x3c
 | 
			
		||||
	add	dst, dst, tmp1
 | 
			
		||||
	add	src, src, tmp1
 | 
			
		||||
	rsb	tmp1, tmp1, #(60 - PC_OFFSET/2 + INSN_SIZE/2)
 | 
			
		||||
	/* Jump directly into the sequence below at the correct offset.  */
 | 
			
		||||
	add	pc, pc, tmp1, lsl #1
 | 
			
		||||
 | 
			
		||||
	ldr	tmp1, [src, #-60]	/* 15 words to go.  */
 | 
			
		||||
	str	tmp1, [dst, #-60]
 | 
			
		||||
 | 
			
		||||
	ldr	tmp1, [src, #-56]	/* 14 words to go.  */
 | 
			
		||||
	str	tmp1, [dst, #-56]
 | 
			
		||||
	ldr	tmp1, [src, #-52]
 | 
			
		||||
	str	tmp1, [dst, #-52]
 | 
			
		||||
 | 
			
		||||
	ldr	tmp1, [src, #-48]	/* 12 words to go.  */
 | 
			
		||||
	str	tmp1, [dst, #-48]
 | 
			
		||||
	ldr	tmp1, [src, #-44]
 | 
			
		||||
	str	tmp1, [dst, #-44]
 | 
			
		||||
 | 
			
		||||
	ldr	tmp1, [src, #-40]	/* 10 words to go.  */
 | 
			
		||||
	str	tmp1, [dst, #-40]
 | 
			
		||||
	ldr	tmp1, [src, #-36]
 | 
			
		||||
	str	tmp1, [dst, #-36]
 | 
			
		||||
 | 
			
		||||
	ldr	tmp1, [src, #-32]	/* 8 words to go.  */
 | 
			
		||||
	str	tmp1, [dst, #-32]
 | 
			
		||||
	ldr	tmp1, [src, #-28]
 | 
			
		||||
	str	tmp1, [dst, #-28]
 | 
			
		||||
 | 
			
		||||
	ldr	tmp1, [src, #-24]	/* 6 words to go.  */
 | 
			
		||||
	str	tmp1, [dst, #-24]
 | 
			
		||||
	ldr	tmp1, [src, #-20]
 | 
			
		||||
	str	tmp1, [dst, #-20]
 | 
			
		||||
 | 
			
		||||
	ldr	tmp1, [src, #-16]	/* 4 words to go.  */
 | 
			
		||||
	str	tmp1, [dst, #-16]
 | 
			
		||||
	ldr	tmp1, [src, #-12]
 | 
			
		||||
	str	tmp1, [dst, #-12]
 | 
			
		||||
 | 
			
		||||
	ldr	tmp1, [src, #-8]	/* 2 words to go.  */
 | 
			
		||||
	str	tmp1, [dst, #-8]
 | 
			
		||||
	ldr	tmp1, [src, #-4]
 | 
			
		||||
	str	tmp1, [dst, #-4]
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	lsls	count, count, #31
 | 
			
		||||
	ldrhcs	tmp1, [src], #2
 | 
			
		||||
	ldrbne	src, [src]		/* Src is dead, use as a scratch.  */
 | 
			
		||||
	strhcs	tmp1, [dst], #2
 | 
			
		||||
	strbne	src, [dst]
 | 
			
		||||
	bx	lr
 | 
			
		||||
 | 
			
		||||
.Lcpy_not_short:
 | 
			
		||||
	/* At least 64 bytes to copy, but don't know the alignment yet.  */
 | 
			
		||||
	str	tmp2, [sp, #-FRAME_SIZE]!
 | 
			
		||||
	and	tmp2, src, #7
 | 
			
		||||
	and	tmp1, dst, #7
 | 
			
		||||
	cmp	tmp1, tmp2
 | 
			
		||||
	bne	.Lcpy_notaligned
 | 
			
		||||
 | 
			
		||||
#ifdef USE_VFP
 | 
			
		||||
	/* Magic dust alert!  Force VFP on Cortex-A9.  Experiments show
 | 
			
		||||
	   that the FP pipeline is much better at streaming loads and
 | 
			
		||||
	   stores.  This is outside the critical loop.  */
 | 
			
		||||
	vmov.f32	s0, s0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/* SRC and DST have the same mutual 32-bit alignment, but we may
 | 
			
		||||
	   still need to pre-copy some bytes to get to natural alignment.
 | 
			
		||||
	   We bring DST into full 64-bit alignment.  */
 | 
			
		||||
	lsls	tmp2, dst, #29
 | 
			
		||||
	beq	1f
 | 
			
		||||
	rsbs	tmp2, tmp2, #0
 | 
			
		||||
	sub	count, count, tmp2, lsr #29
 | 
			
		||||
	ldrmi	tmp1, [src], #4
 | 
			
		||||
	strmi	tmp1, [dst], #4
 | 
			
		||||
	lsls	tmp2, tmp2, #2
 | 
			
		||||
	ldrhcs	tmp1, [src], #2
 | 
			
		||||
	ldrbne	tmp2, [src], #1
 | 
			
		||||
	strhcs	tmp1, [dst], #2
 | 
			
		||||
	strbne	tmp2, [dst], #1
 | 
			
		||||
 | 
			
		||||
1:
 | 
			
		||||
	subs	tmp2, count, #64	/* Use tmp2 for count.  */
 | 
			
		||||
	blt	.Ltail63aligned
 | 
			
		||||
 | 
			
		||||
	cmp	tmp2, #512
 | 
			
		||||
	bge	.Lcpy_body_long
 | 
			
		||||
 | 
			
		||||
.Lcpy_body_medium:			/* Count in tmp2.  */
 | 
			
		||||
#ifdef USE_VFP
 | 
			
		||||
1:
 | 
			
		||||
	vldr	d0, [src, #0]
 | 
			
		||||
	subs	tmp2, tmp2, #64
 | 
			
		||||
	vldr	d1, [src, #8]
 | 
			
		||||
	vstr	d0, [dst, #0]
 | 
			
		||||
	vldr	d0, [src, #16]
 | 
			
		||||
	vstr	d1, [dst, #8]
 | 
			
		||||
	vldr	d1, [src, #24]
 | 
			
		||||
	vstr	d0, [dst, #16]
 | 
			
		||||
	vldr	d0, [src, #32]
 | 
			
		||||
	vstr	d1, [dst, #24]
 | 
			
		||||
	vldr	d1, [src, #40]
 | 
			
		||||
	vstr	d0, [dst, #32]
 | 
			
		||||
	vldr	d0, [src, #48]
 | 
			
		||||
	vstr	d1, [dst, #40]
 | 
			
		||||
	vldr	d1, [src, #56]
 | 
			
		||||
	vstr	d0, [dst, #48]
 | 
			
		||||
	add	src, src, #64
 | 
			
		||||
	vstr	d1, [dst, #56]
 | 
			
		||||
	add	dst, dst, #64
 | 
			
		||||
	bge	1b
 | 
			
		||||
	tst	tmp2, #0x3f
 | 
			
		||||
	beq	.Ldone
 | 
			
		||||
 | 
			
		||||
.Ltail63aligned:			/* Count in tmp2.  */
 | 
			
		||||
	and	tmp1, tmp2, #0x38
 | 
			
		||||
	add	dst, dst, tmp1
 | 
			
		||||
	add	src, src, tmp1
 | 
			
		||||
	rsb	tmp1, tmp1, #(56 - PC_OFFSET + INSN_SIZE)
 | 
			
		||||
	add	pc, pc, tmp1
 | 
			
		||||
 | 
			
		||||
	vldr	d0, [src, #-56]	/* 14 words to go.  */
 | 
			
		||||
	vstr	d0, [dst, #-56]
 | 
			
		||||
	vldr	d0, [src, #-48]	/* 12 words to go.  */
 | 
			
		||||
	vstr	d0, [dst, #-48]
 | 
			
		||||
	vldr	d0, [src, #-40]	/* 10 words to go.  */
 | 
			
		||||
	vstr	d0, [dst, #-40]
 | 
			
		||||
	vldr	d0, [src, #-32]	/* 8 words to go.  */
 | 
			
		||||
	vstr	d0, [dst, #-32]
 | 
			
		||||
	vldr	d0, [src, #-24]	/* 6 words to go.  */
 | 
			
		||||
	vstr	d0, [dst, #-24]
 | 
			
		||||
	vldr	d0, [src, #-16]	/* 4 words to go.  */
 | 
			
		||||
	vstr	d0, [dst, #-16]
 | 
			
		||||
	vldr	d0, [src, #-8]	/* 2 words to go.  */
 | 
			
		||||
	vstr	d0, [dst, #-8]
 | 
			
		||||
#else
 | 
			
		||||
	sub	src, src, #8
 | 
			
		||||
	sub	dst, dst, #8
 | 
			
		||||
1:
 | 
			
		||||
	ldrd	A_l, A_h, [src, #8]
 | 
			
		||||
	strd	A_l, A_h, [dst, #8]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #16]
 | 
			
		||||
	strd	A_l, A_h, [dst, #16]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #24]
 | 
			
		||||
	strd	A_l, A_h, [dst, #24]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #32]
 | 
			
		||||
	strd	A_l, A_h, [dst, #32]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #40]
 | 
			
		||||
	strd	A_l, A_h, [dst, #40]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #48]
 | 
			
		||||
	strd	A_l, A_h, [dst, #48]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #56]
 | 
			
		||||
	strd	A_l, A_h, [dst, #56]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #64]!
 | 
			
		||||
	strd	A_l, A_h, [dst, #64]!
 | 
			
		||||
	subs	tmp2, tmp2, #64
 | 
			
		||||
	bge	1b
 | 
			
		||||
	tst	tmp2, #0x3f
 | 
			
		||||
	bne	1f
 | 
			
		||||
	ldr	tmp2,[sp], #FRAME_SIZE
 | 
			
		||||
	bx	lr
 | 
			
		||||
1:
 | 
			
		||||
	add	src, src, #8
 | 
			
		||||
	add	dst, dst, #8
 | 
			
		||||
 | 
			
		||||
.Ltail63aligned:			/* Count in tmp2.  */
 | 
			
		||||
	/* Copy up to 7 d-words of data.  Similar to Ltail63unaligned, but
 | 
			
		||||
	   we know that the src and dest are 32-bit aligned so we can use
 | 
			
		||||
	   LDRD/STRD to improve efficiency.  */
 | 
			
		||||
	/* TMP2 is now negative, but we don't care about that.  The bottom
 | 
			
		||||
	   six bits still tell us how many bytes are left to copy.  */
 | 
			
		||||
 | 
			
		||||
	and	tmp1, tmp2, #0x38
 | 
			
		||||
	add	dst, dst, tmp1
 | 
			
		||||
	add	src, src, tmp1
 | 
			
		||||
	rsb	tmp1, tmp1, #(56 - PC_OFFSET + INSN_SIZE)
 | 
			
		||||
	add	pc, pc, tmp1
 | 
			
		||||
	ldrd	A_l, A_h, [src, #-56]	/* 14 words to go.  */
 | 
			
		||||
	strd	A_l, A_h, [dst, #-56]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #-48]	/* 12 words to go.  */
 | 
			
		||||
	strd	A_l, A_h, [dst, #-48]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #-40]	/* 10 words to go.  */
 | 
			
		||||
	strd	A_l, A_h, [dst, #-40]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #-32]	/* 8 words to go.  */
 | 
			
		||||
	strd	A_l, A_h, [dst, #-32]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #-24]	/* 6 words to go.  */
 | 
			
		||||
	strd	A_l, A_h, [dst, #-24]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #-16]	/* 4 words to go.  */
 | 
			
		||||
	strd	A_l, A_h, [dst, #-16]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #-8]	/* 2 words to go.  */
 | 
			
		||||
	strd	A_l, A_h, [dst, #-8]
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
	tst	tmp2, #4
 | 
			
		||||
	ldrne	tmp1, [src], #4
 | 
			
		||||
	strne	tmp1, [dst], #4
 | 
			
		||||
	lsls	tmp2, tmp2, #31		/* Count (tmp2) now dead. */
 | 
			
		||||
	ldrhcs	tmp1, [src], #2
 | 
			
		||||
	ldrbne	tmp2, [src]
 | 
			
		||||
	strhcs	tmp1, [dst], #2
 | 
			
		||||
	strbne	tmp2, [dst]
 | 
			
		||||
 | 
			
		||||
.Ldone:
 | 
			
		||||
	ldr	tmp2, [sp], #FRAME_SIZE
 | 
			
		||||
	bx	lr
 | 
			
		||||
 | 
			
		||||
.Lcpy_body_long:			/* Count in tmp2.  */
 | 
			
		||||
 | 
			
		||||
	/* Long copy.  We know that there's at least (prefetch_lines * 64)
 | 
			
		||||
	   bytes to go.  */
 | 
			
		||||
#ifdef USE_VFP
 | 
			
		||||
	/* Don't use PLD.  Instead, read some data in advance of the current
 | 
			
		||||
	   copy position into a register.  This should act like a PLD
 | 
			
		||||
	   operation but we won't have to repeat the transfer.  */
 | 
			
		||||
 | 
			
		||||
	vldr	d3, [src, #0]
 | 
			
		||||
	vldr	d4, [src, #64]
 | 
			
		||||
	vldr	d5, [src, #128]
 | 
			
		||||
	vldr	d6, [src, #192]
 | 
			
		||||
	vldr	d7, [src, #256]
 | 
			
		||||
 | 
			
		||||
	vldr	d0, [src, #8]
 | 
			
		||||
	vldr	d1, [src, #16]
 | 
			
		||||
	vldr	d2, [src, #24]
 | 
			
		||||
	add	src, src, #32
 | 
			
		||||
 | 
			
		||||
	subs	tmp2, tmp2, #prefetch_lines * 64 * 2
 | 
			
		||||
	blt	2f
 | 
			
		||||
1:
 | 
			
		||||
	cpy_line_vfp	d3, 0
 | 
			
		||||
	cpy_line_vfp	d4, 64
 | 
			
		||||
	cpy_line_vfp	d5, 128
 | 
			
		||||
	add	dst, dst, #3 * 64
 | 
			
		||||
	add	src, src, #3 * 64
 | 
			
		||||
	cpy_line_vfp	d6, 0
 | 
			
		||||
	cpy_line_vfp	d7, 64
 | 
			
		||||
	add	dst, dst, #2 * 64
 | 
			
		||||
	add	src, src, #2 * 64
 | 
			
		||||
	subs	tmp2, tmp2, #prefetch_lines * 64
 | 
			
		||||
	bge	1b
 | 
			
		||||
 | 
			
		||||
2:
 | 
			
		||||
	cpy_tail_vfp	d3, 0
 | 
			
		||||
	cpy_tail_vfp	d4, 64
 | 
			
		||||
	cpy_tail_vfp	d5, 128
 | 
			
		||||
	add	src, src, #3 * 64
 | 
			
		||||
	add	dst, dst, #3 * 64
 | 
			
		||||
	cpy_tail_vfp	d6, 0
 | 
			
		||||
	vstr	d7, [dst, #64]
 | 
			
		||||
	vldr	d7, [src, #64]
 | 
			
		||||
	vstr	d0, [dst, #64 + 8]
 | 
			
		||||
	vldr	d0, [src, #64 + 8]
 | 
			
		||||
	vstr	d1, [dst, #64 + 16]
 | 
			
		||||
	vldr	d1, [src, #64 + 16]
 | 
			
		||||
	vstr	d2, [dst, #64 + 24]
 | 
			
		||||
	vldr	d2, [src, #64 + 24]
 | 
			
		||||
	vstr	d7, [dst, #64 + 32]
 | 
			
		||||
	add	src, src, #96
 | 
			
		||||
	vstr	d0, [dst, #64 + 40]
 | 
			
		||||
	vstr	d1, [dst, #64 + 48]
 | 
			
		||||
	vstr	d2, [dst, #64 + 56]
 | 
			
		||||
	add	dst, dst, #128
 | 
			
		||||
	add	tmp2, tmp2, #prefetch_lines * 64
 | 
			
		||||
	b	.Lcpy_body_medium
 | 
			
		||||
#else
 | 
			
		||||
	/* Long copy.  Use an SMS style loop to maximize the I/O
 | 
			
		||||
	   bandwidth of the core.  We don't have enough spare registers
 | 
			
		||||
	   to synthesise prefetching, so use PLD operations.  */
 | 
			
		||||
	/* Pre-bias src and dst.  */
 | 
			
		||||
	sub	src, src, #8
 | 
			
		||||
	sub	dst, dst, #8
 | 
			
		||||
	pld	[src, #8]
 | 
			
		||||
	pld	[src, #72]
 | 
			
		||||
	subs	tmp2, tmp2, #64
 | 
			
		||||
	pld	[src, #136]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #8]
 | 
			
		||||
	strd	B_l, B_h, [sp, #8]
 | 
			
		||||
	ldrd	B_l, B_h, [src, #16]
 | 
			
		||||
	strd	C_l, C_h, [sp, #16]
 | 
			
		||||
	ldrd	C_l, C_h, [src, #24]
 | 
			
		||||
	strd	D_l, D_h, [sp, #24]
 | 
			
		||||
	pld	[src, #200]
 | 
			
		||||
	ldrd	D_l, D_h, [src, #32]!
 | 
			
		||||
	b	1f
 | 
			
		||||
	.p2align	6
 | 
			
		||||
2:
 | 
			
		||||
	pld	[src, #232]
 | 
			
		||||
	strd	A_l, A_h, [dst, #40]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #40]
 | 
			
		||||
	strd	B_l, B_h, [dst, #48]
 | 
			
		||||
	ldrd	B_l, B_h, [src, #48]
 | 
			
		||||
	strd	C_l, C_h, [dst, #56]
 | 
			
		||||
	ldrd	C_l, C_h, [src, #56]
 | 
			
		||||
	strd	D_l, D_h, [dst, #64]!
 | 
			
		||||
	ldrd	D_l, D_h, [src, #64]!
 | 
			
		||||
	subs	tmp2, tmp2, #64
 | 
			
		||||
1:
 | 
			
		||||
	strd	A_l, A_h, [dst, #8]
 | 
			
		||||
	ldrd	A_l, A_h, [src, #8]
 | 
			
		||||
	strd	B_l, B_h, [dst, #16]
 | 
			
		||||
	ldrd	B_l, B_h, [src, #16]
 | 
			
		||||
	strd	C_l, C_h, [dst, #24]
 | 
			
		||||
	ldrd	C_l, C_h, [src, #24]
 | 
			
		||||
	strd	D_l, D_h, [dst, #32]
 | 
			
		||||
	ldrd	D_l, D_h, [src, #32]
 | 
			
		||||
	bcs	2b
 | 
			
		||||
	/* Save the remaining bytes and restore the callee-saved regs.  */
 | 
			
		||||
	strd	A_l, A_h, [dst, #40]
 | 
			
		||||
	add	src, src, #40
 | 
			
		||||
	strd	B_l, B_h, [dst, #48]
 | 
			
		||||
	ldrd	B_l, B_h, [sp, #8]
 | 
			
		||||
	strd	C_l, C_h, [dst, #56]
 | 
			
		||||
	ldrd	C_l, C_h, [sp, #16]
 | 
			
		||||
	strd	D_l, D_h, [dst, #64]
 | 
			
		||||
	ldrd	D_l, D_h, [sp, #24]
 | 
			
		||||
	add	dst, dst, #72
 | 
			
		||||
	tst	tmp2, #0x3f
 | 
			
		||||
	bne	.Ltail63aligned
 | 
			
		||||
	ldr	tmp2, [sp], #FRAME_SIZE
 | 
			
		||||
	bx	lr
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
.Lcpy_notaligned:
 | 
			
		||||
	pld	[src]
 | 
			
		||||
	pld	[src, #64]
 | 
			
		||||
	/* There's at least 64 bytes to copy, but there is no mutual
 | 
			
		||||
	   alignment.  */
 | 
			
		||||
	/* Bring DST to 64-bit alignment.  */
 | 
			
		||||
	lsls	tmp2, dst, #29
 | 
			
		||||
	pld	[src, #(2 * 64)]
 | 
			
		||||
	beq	1f
 | 
			
		||||
	rsbs	tmp2, tmp2, #0
 | 
			
		||||
	sub	count, count, tmp2, lsr #29
 | 
			
		||||
	ldrmi	tmp1, [src], #4
 | 
			
		||||
	strmi	tmp1, [dst], #4
 | 
			
		||||
	lsls	tmp2, tmp2, #2
 | 
			
		||||
	ldrbne	tmp1, [src], #1
 | 
			
		||||
	ldrhcs	tmp2, [src], #2
 | 
			
		||||
	strbne	tmp1, [dst], #1
 | 
			
		||||
	strhcs	tmp2, [dst], #2
 | 
			
		||||
1:
 | 
			
		||||
	pld	[src, #(3 * 64)]
 | 
			
		||||
	subs	count, count, #64
 | 
			
		||||
	ldrmi	tmp2, [sp], #FRAME_SIZE
 | 
			
		||||
	bmi	.Ltail63unaligned
 | 
			
		||||
	pld	[src, #(4 * 64)]
 | 
			
		||||
 | 
			
		||||
#ifdef USE_NEON
 | 
			
		||||
	vld1.8	{d0-d3}, [src]!
 | 
			
		||||
	vld1.8	{d4-d7}, [src]!
 | 
			
		||||
	subs	count, count, #64
 | 
			
		||||
	bmi	2f
 | 
			
		||||
1:
 | 
			
		||||
	pld	[src, #(4 * 64)]
 | 
			
		||||
	vst1.8	{d0-d3}, [ALIGN (dst, 64)]!
 | 
			
		||||
	vld1.8	{d0-d3}, [src]!
 | 
			
		||||
	vst1.8	{d4-d7}, [ALIGN (dst, 64)]!
 | 
			
		||||
	vld1.8	{d4-d7}, [src]!
 | 
			
		||||
	subs	count, count, #64
 | 
			
		||||
	bpl	1b
 | 
			
		||||
2:
 | 
			
		||||
	vst1.8	{d0-d3}, [ALIGN (dst, 64)]!
 | 
			
		||||
	vst1.8	{d4-d7}, [ALIGN (dst, 64)]!
 | 
			
		||||
	ands	count, count, #0x3f
 | 
			
		||||
#else
 | 
			
		||||
	/* Use an SMS style loop to maximize the I/O bandwidth.  */
 | 
			
		||||
	sub	src, src, #4
 | 
			
		||||
	sub	dst, dst, #8
 | 
			
		||||
	subs	tmp2, count, #64	/* Use tmp2 for count.  */
 | 
			
		||||
	ldr	A_l, [src, #4]
 | 
			
		||||
	ldr	A_h, [src, #8]
 | 
			
		||||
	strd	B_l, B_h, [sp, #8]
 | 
			
		||||
	ldr	B_l, [src, #12]
 | 
			
		||||
	ldr	B_h, [src, #16]
 | 
			
		||||
	strd	C_l, C_h, [sp, #16]
 | 
			
		||||
	ldr	C_l, [src, #20]
 | 
			
		||||
	ldr	C_h, [src, #24]
 | 
			
		||||
	strd	D_l, D_h, [sp, #24]
 | 
			
		||||
	ldr	D_l, [src, #28]
 | 
			
		||||
	ldr	D_h, [src, #32]!
 | 
			
		||||
	b	1f
 | 
			
		||||
	.p2align	6
 | 
			
		||||
2:
 | 
			
		||||
	pld	[src, #(5 * 64) - (32 - 4)]
 | 
			
		||||
	strd	A_l, A_h, [dst, #40]
 | 
			
		||||
	ldr	A_l, [src, #36]
 | 
			
		||||
	ldr	A_h, [src, #40]
 | 
			
		||||
	strd	B_l, B_h, [dst, #48]
 | 
			
		||||
	ldr	B_l, [src, #44]
 | 
			
		||||
	ldr	B_h, [src, #48]
 | 
			
		||||
	strd	C_l, C_h, [dst, #56]
 | 
			
		||||
	ldr	C_l, [src, #52]
 | 
			
		||||
	ldr	C_h, [src, #56]
 | 
			
		||||
	strd	D_l, D_h, [dst, #64]!
 | 
			
		||||
	ldr	D_l, [src, #60]
 | 
			
		||||
	ldr	D_h, [src, #64]!
 | 
			
		||||
	subs	tmp2, tmp2, #64
 | 
			
		||||
1:
 | 
			
		||||
	strd	A_l, A_h, [dst, #8]
 | 
			
		||||
	ldr	A_l, [src, #4]
 | 
			
		||||
	ldr	A_h, [src, #8]
 | 
			
		||||
	strd	B_l, B_h, [dst, #16]
 | 
			
		||||
	ldr	B_l, [src, #12]
 | 
			
		||||
	ldr	B_h, [src, #16]
 | 
			
		||||
	strd	C_l, C_h, [dst, #24]
 | 
			
		||||
	ldr	C_l, [src, #20]
 | 
			
		||||
	ldr	C_h, [src, #24]
 | 
			
		||||
	strd	D_l, D_h, [dst, #32]
 | 
			
		||||
	ldr	D_l, [src, #28]
 | 
			
		||||
	ldr	D_h, [src, #32]
 | 
			
		||||
	bcs	2b
 | 
			
		||||
 | 
			
		||||
	/* Save the remaining bytes and restore the callee-saved regs.  */
 | 
			
		||||
	strd	A_l, A_h, [dst, #40]
 | 
			
		||||
	add	src, src, #36
 | 
			
		||||
	strd	B_l, B_h, [dst, #48]
 | 
			
		||||
	ldrd	B_l, B_h, [sp, #8]
 | 
			
		||||
	strd	C_l, C_h, [dst, #56]
 | 
			
		||||
	ldrd	C_l, C_h, [sp, #16]
 | 
			
		||||
	strd	D_l, D_h, [dst, #64]
 | 
			
		||||
	ldrd	D_l, D_h, [sp, #24]
 | 
			
		||||
	add	dst, dst, #72
 | 
			
		||||
	ands	count, tmp2, #0x3f
 | 
			
		||||
#endif
 | 
			
		||||
	ldr	tmp2, [sp], #FRAME_SIZE
 | 
			
		||||
	bne	.Ltail63unaligned
 | 
			
		||||
	bx	lr
 | 
			
		||||
END(memcpy)
 | 
			
		||||
@@ -42,6 +42,7 @@
 | 
			
		||||
ENTRY(bzero)
 | 
			
		||||
        mov     r2, r1
 | 
			
		||||
        mov     r1, #0
 | 
			
		||||
        // Fall through to memset...
 | 
			
		||||
END(bzero)
 | 
			
		||||
 | 
			
		||||
ENTRY(memset)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										787
									
								
								libc/arch-arm/bionic/strcmp.a15.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										787
									
								
								libc/arch-arm/bionic/strcmp.a15.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,787 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 "arm_asm.h"
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
#define S2LOMEM lsl
 | 
			
		||||
#define S2LOMEMEQ lsleq
 | 
			
		||||
#define S2HIMEM lsr
 | 
			
		||||
#define MSB 0x000000ff
 | 
			
		||||
#define LSB 0xff000000
 | 
			
		||||
#define BYTE0_OFFSET 24
 | 
			
		||||
#define BYTE1_OFFSET 16
 | 
			
		||||
#define BYTE2_OFFSET 8
 | 
			
		||||
#define BYTE3_OFFSET 0
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
#define S2LOMEM lsr
 | 
			
		||||
#define S2LOMEMEQ lsreq
 | 
			
		||||
#define S2HIMEM lsl
 | 
			
		||||
#define BYTE0_OFFSET 0
 | 
			
		||||
#define BYTE1_OFFSET 8
 | 
			
		||||
#define BYTE2_OFFSET 16
 | 
			
		||||
#define BYTE3_OFFSET 24
 | 
			
		||||
#define MSB 0xff000000
 | 
			
		||||
#define LSB 0x000000ff
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
 | 
			
		||||
.syntax         unified
 | 
			
		||||
 | 
			
		||||
#if defined (__thumb__)
 | 
			
		||||
        .thumb
 | 
			
		||||
        .thumb_func
 | 
			
		||||
#endif
 | 
			
		||||
        .global strcmp
 | 
			
		||||
        .type   strcmp, %function
 | 
			
		||||
strcmp:
 | 
			
		||||
 | 
			
		||||
#if (defined (__thumb__) && !defined (__thumb2__))
 | 
			
		||||
1:
 | 
			
		||||
        ldrb    r2, [r0]
 | 
			
		||||
        ldrb    r3, [r1]
 | 
			
		||||
        adds    r0, r0, #1
 | 
			
		||||
        adds    r1, r1, #1
 | 
			
		||||
        cmp     r2, #0
 | 
			
		||||
        beq     2f
 | 
			
		||||
        cmp     r2, r3
 | 
			
		||||
        beq     1b
 | 
			
		||||
2:
 | 
			
		||||
        subs    r0, r2, r3
 | 
			
		||||
        bx      lr
 | 
			
		||||
#elif (defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED))
 | 
			
		||||
1:
 | 
			
		||||
        ldrb    r2, [r0], #1
 | 
			
		||||
        ldrb    r3, [r1], #1
 | 
			
		||||
        cmp     r2, #1
 | 
			
		||||
        it      cs
 | 
			
		||||
        cmpcs   r2, r3
 | 
			
		||||
        beq     1b
 | 
			
		||||
        subs    r0, r2, r3
 | 
			
		||||
        RETURN
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#elif (defined (_ISA_THUMB_2) || defined (_ISA_ARM_6))
 | 
			
		||||
      /* Use LDRD whenever possible.  */
 | 
			
		||||
 | 
			
		||||
/* The main thing to look out for when comparing large blocks is that
 | 
			
		||||
   the loads do not cross a page boundary when loading past the index
 | 
			
		||||
   of the byte with the first difference or the first string-terminator.
 | 
			
		||||
 | 
			
		||||
   For example, if the strings are identical and the string-terminator
 | 
			
		||||
   is at index k, byte by byte comparison will not load beyond address
 | 
			
		||||
   s1+k and s2+k; word by word comparison may load up to 3 bytes beyond
 | 
			
		||||
   k; double word - up to 7 bytes.  If the load of these bytes crosses
 | 
			
		||||
   a page boundary, it might cause a memory fault (if the page is not mapped)
 | 
			
		||||
   that would not have happened in byte by byte comparison.
 | 
			
		||||
 | 
			
		||||
   If an address is (double) word aligned, then a load of a (double) word
 | 
			
		||||
   from that address will not cross a page boundary.
 | 
			
		||||
   Therefore, the algorithm below considers word and double-word alignment
 | 
			
		||||
   of strings separately.  */
 | 
			
		||||
 | 
			
		||||
/* High-level description of the algorithm.
 | 
			
		||||
 | 
			
		||||
   * The fast path: if both strings are double-word aligned,
 | 
			
		||||
     use LDRD to load two words from each string in every loop iteration.
 | 
			
		||||
   * If the strings have the same offset from a word boundary,
 | 
			
		||||
     use LDRB to load and compare byte by byte until
 | 
			
		||||
     the first string is aligned to a word boundary (at most 3 bytes).
 | 
			
		||||
     This is optimized for quick return on short unaligned strings.
 | 
			
		||||
   * If the strings have the same offset from a double-word boundary,
 | 
			
		||||
     use LDRD to load two words from each string in every loop iteration, as in the fast path.
 | 
			
		||||
   * If the strings do not have the same offset from a double-word boundary,
 | 
			
		||||
     load a word from the second string before the loop to initialize the queue.
 | 
			
		||||
     Use LDRD to load two words from every string in every loop iteration.
 | 
			
		||||
     Inside the loop, load the second word from the second string only after comparing
 | 
			
		||||
     the first word, using the queued value, to guarantee safety across page boundaries.
 | 
			
		||||
   * If the strings do not have the same offset from a word boundary,
 | 
			
		||||
     use LDR and a shift queue. Order of loads and comparisons matters,
 | 
			
		||||
     similarly to the previous case.
 | 
			
		||||
 | 
			
		||||
   * Use UADD8 and SEL to compare words, and use REV and CLZ to compute the return value.
 | 
			
		||||
   * The only difference between ARM and Thumb modes is the use of CBZ instruction.
 | 
			
		||||
   * The only difference between big and little endian is the use of REV in little endian
 | 
			
		||||
     to compute the return value, instead of MOV.
 | 
			
		||||
   * No preload. [TODO.]
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
        .macro m_cbz reg label
 | 
			
		||||
#ifdef __thumb2__
 | 
			
		||||
        cbz     \reg, \label
 | 
			
		||||
#else   /* not defined __thumb2__ */
 | 
			
		||||
        cmp     \reg, #0
 | 
			
		||||
        beq     \label
 | 
			
		||||
#endif /* not defined __thumb2__ */
 | 
			
		||||
        .endm /* m_cbz */
 | 
			
		||||
 | 
			
		||||
        .macro m_cbnz reg label
 | 
			
		||||
#ifdef __thumb2__
 | 
			
		||||
        cbnz    \reg, \label
 | 
			
		||||
#else   /* not defined __thumb2__ */
 | 
			
		||||
        cmp     \reg, #0
 | 
			
		||||
        bne     \label
 | 
			
		||||
#endif /* not defined __thumb2__ */
 | 
			
		||||
        .endm /* m_cbnz */
 | 
			
		||||
 | 
			
		||||
        .macro  init
 | 
			
		||||
        /* Macro to save temporary registers and prepare magic values.  */
 | 
			
		||||
        subs    sp, sp, #16
 | 
			
		||||
        strd    r4, r5, [sp, #8]
 | 
			
		||||
        strd    r6, r7, [sp]
 | 
			
		||||
        mvn     r6, #0  /* all F */
 | 
			
		||||
        mov     r7, #0  /* all 0 */
 | 
			
		||||
        .endm   /* init */
 | 
			
		||||
 | 
			
		||||
        .macro  magic_compare_and_branch w1 w2 label
 | 
			
		||||
        /* Macro to compare registers w1 and w2 and conditionally branch to label.  */
 | 
			
		||||
        cmp     \w1, \w2        /* Are w1 and w2 the same?  */
 | 
			
		||||
        magic_find_zero_bytes \w1
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   ip, #0          /* Is there a zero byte in w1?  */
 | 
			
		||||
        bne     \label
 | 
			
		||||
        .endm /* magic_compare_and_branch */
 | 
			
		||||
 | 
			
		||||
        .macro  magic_find_zero_bytes w1
 | 
			
		||||
        /* Macro to find all-zero bytes in w1, result is in ip.  */
 | 
			
		||||
#if (defined (__ARM_FEATURE_DSP))
 | 
			
		||||
        uadd8   ip, \w1, r6
 | 
			
		||||
        sel     ip, r7, r6
 | 
			
		||||
#else /* not defined (__ARM_FEATURE_DSP) */
 | 
			
		||||
        /* __ARM_FEATURE_DSP is not defined for some Cortex-M processors.
 | 
			
		||||
        Coincidently, these processors only have Thumb-2 mode, where we can use the
 | 
			
		||||
        the (large) magic constant available directly as an immediate in instructions.
 | 
			
		||||
        Note that we cannot use the magic constant in ARM mode, where we need
 | 
			
		||||
        to create the constant in a register.  */
 | 
			
		||||
        sub     ip, \w1, #0x01010101
 | 
			
		||||
        bic     ip, ip, \w1
 | 
			
		||||
        and     ip, ip, #0x80808080
 | 
			
		||||
#endif /* not defined (__ARM_FEATURE_DSP) */
 | 
			
		||||
        .endm /* magic_find_zero_bytes */
 | 
			
		||||
 | 
			
		||||
        .macro  setup_return w1 w2
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        mov     r1, \w1
 | 
			
		||||
        mov     r2, \w2
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
        rev     r1, \w1
 | 
			
		||||
        rev     r2, \w2
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
        .endm /* setup_return */
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
        optpld r0, #0
 | 
			
		||||
        optpld r1, #0
 | 
			
		||||
        */
 | 
			
		||||
 | 
			
		||||
        /* Are both strings double-word aligned?  */
 | 
			
		||||
        orr     ip, r0, r1
 | 
			
		||||
        tst     ip, #7
 | 
			
		||||
        bne     do_align
 | 
			
		||||
 | 
			
		||||
        /* Fast path.  */
 | 
			
		||||
        init
 | 
			
		||||
 | 
			
		||||
doubleword_aligned:
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are double-word aligned.  */
 | 
			
		||||
        /* Compare two words in every iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
2:
 | 
			
		||||
        /*
 | 
			
		||||
        optpld r0, #16
 | 
			
		||||
        optpld r1, #16
 | 
			
		||||
        */
 | 
			
		||||
 | 
			
		||||
        /* Load the next double-word from each string.  */
 | 
			
		||||
        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
 | 
			
		||||
        b       2b
 | 
			
		||||
 | 
			
		||||
do_align:
 | 
			
		||||
        /* Is the first string word-aligned?  */
 | 
			
		||||
        ands    ip, r0, #3
 | 
			
		||||
        beq     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
 | 
			
		||||
        to read until the next word boudnary is 4-ip.  */
 | 
			
		||||
        bic     r0, r0, #3
 | 
			
		||||
        ldr     r2, [r0], #4
 | 
			
		||||
        lsls    ip, ip, #31
 | 
			
		||||
        beq     byte2
 | 
			
		||||
        bcs     byte3
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
fast_return:
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
        bx      lr
 | 
			
		||||
 | 
			
		||||
word_aligned_r0:
 | 
			
		||||
        init
 | 
			
		||||
        /* The first string is word-aligned.  */
 | 
			
		||||
        /* Is the second string word-aligned?  */
 | 
			
		||||
        ands    ip, r1, #3
 | 
			
		||||
        bne     strcmp_unaligned
 | 
			
		||||
 | 
			
		||||
word_aligned:
 | 
			
		||||
        /* The strings are word-aligned. */
 | 
			
		||||
        /* Is the first string double-word aligned?  */
 | 
			
		||||
        tst     r0, #4
 | 
			
		||||
        beq     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
 | 
			
		||||
 | 
			
		||||
doubleword_aligned_r0:
 | 
			
		||||
        /* Get here when r0 is double-word aligned.  */
 | 
			
		||||
        /* Is r1 doubleword_aligned?  */
 | 
			
		||||
        tst     r1, #4
 | 
			
		||||
        beq     doubleword_aligned
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are word-aligned,
 | 
			
		||||
        r0 is double-word aligned, but r1 is not double-word aligned.  */
 | 
			
		||||
 | 
			
		||||
        /* Initialize the queue.  */
 | 
			
		||||
        ldr     r5, [r1], #4
 | 
			
		||||
 | 
			
		||||
        /* Compare two words in every iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
3:
 | 
			
		||||
        /*
 | 
			
		||||
        optpld r0, #16
 | 
			
		||||
        optpld r1, #16
 | 
			
		||||
        */
 | 
			
		||||
 | 
			
		||||
        /* 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
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        magic_compare_and_branch w1=r3 w2=r4 label=return_34
 | 
			
		||||
        b       3b
 | 
			
		||||
 | 
			
		||||
        .macro miscmp_word offsetlo offsethi
 | 
			
		||||
        /* Macro to compare misaligned strings.  */
 | 
			
		||||
        /* r0, r1 are word-aligned, and at least one of the strings
 | 
			
		||||
        is not double-word aligned.  */
 | 
			
		||||
        /* Compare one word in every loop iteration.  */
 | 
			
		||||
        /* OFFSETLO is the original bit-offset of r1 from a word-boundary,
 | 
			
		||||
        OFFSETHI is 32 - OFFSETLO (i.e., offset from the next word).  */
 | 
			
		||||
 | 
			
		||||
        /* Initialize the shift queue.  */
 | 
			
		||||
        ldr     r5, [r1], #4
 | 
			
		||||
 | 
			
		||||
        /* Compare one word from each string in every loop iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
7:
 | 
			
		||||
        ldr     r3, [r0], #4
 | 
			
		||||
        S2LOMEM r5, r5, #\offsetlo
 | 
			
		||||
        magic_find_zero_bytes w1=r3
 | 
			
		||||
        cmp     r7, ip, S2HIMEM #\offsetlo
 | 
			
		||||
        and     r2, r3, r6, S2LOMEM #\offsetlo
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   r2, r5
 | 
			
		||||
        bne     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
 | 
			
		||||
        b       7b
 | 
			
		||||
        .endm /* miscmp_word */
 | 
			
		||||
 | 
			
		||||
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.  */
 | 
			
		||||
        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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
return_32:
 | 
			
		||||
        setup_return w1=r3, w2=r2
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_34:
 | 
			
		||||
        setup_return w1=r3, w2=r4
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_25:
 | 
			
		||||
        setup_return w1=r2, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_35:
 | 
			
		||||
        setup_return w1=r3, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_24:
 | 
			
		||||
        setup_return w1=r2, w2=r4
 | 
			
		||||
 | 
			
		||||
do_return:
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
        rev     r0, ip
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
 | 
			
		||||
        /* Restore temporaries early, before computing the return value.  */
 | 
			
		||||
        ldrd    r6, r7, [sp]
 | 
			
		||||
        ldrd    r4, r5, [sp, #8]
 | 
			
		||||
        adds    sp, sp, #16
 | 
			
		||||
 | 
			
		||||
        /* 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
 | 
			
		||||
        clz     r0, r0
 | 
			
		||||
        /* r0 contains the number of bits on the left of the first all-zero byte in r1.  */
 | 
			
		||||
        rsb     r0, r0, #24
 | 
			
		||||
        /* Here, r0 contains the number of bits on the right of the first all-zero byte in r1.  */
 | 
			
		||||
        lsr     r1, r1, r0
 | 
			
		||||
        lsr     r2, r2, r0
 | 
			
		||||
 | 
			
		||||
compute_return_value:
 | 
			
		||||
        movs    r0, #1
 | 
			
		||||
        cmp     r1, r2
 | 
			
		||||
        /* The return value is computed as follows.
 | 
			
		||||
        If r1>r2 then (C==1 and Z==0) and LS doesn't hold and r0 is #1 at return.
 | 
			
		||||
        If r1<r2 then (C==0 and Z==0) and we execute SBC with carry_in=0,
 | 
			
		||||
        which means r0:=r0-r0-1 and r0 is #-1 at return.
 | 
			
		||||
        If r1=r2 then (C==1 and Z==1) and we execute SBC with carry_in=1,
 | 
			
		||||
        which means r0:=r0-r0 and r0 is #0 at return.
 | 
			
		||||
        (C==0 and Z==1) cannot happen because the carry bit is "not borrow".  */
 | 
			
		||||
        it      ls
 | 
			
		||||
        sbcls   r0, r0, r0
 | 
			
		||||
        bx      lr
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#else   /* !(defined (_ISA_THUMB_2) || defined (_ISA_ARM_6)
 | 
			
		||||
             defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED) ||
 | 
			
		||||
             (defined (__thumb__) && !defined (__thumb2__))) */
 | 
			
		||||
 | 
			
		||||
        /* Use LDR whenever possible. */
 | 
			
		||||
 | 
			
		||||
#ifdef __thumb2__
 | 
			
		||||
#define magic1(REG) 0x01010101
 | 
			
		||||
#define magic2(REG) 0x80808080
 | 
			
		||||
#else
 | 
			
		||||
#define magic1(REG) REG
 | 
			
		||||
#define magic2(REG) REG, lsl #7
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        optpld  r0
 | 
			
		||||
        optpld  r1
 | 
			
		||||
        eor     r2, r0, r1
 | 
			
		||||
        tst     r2, #3
 | 
			
		||||
        /* Strings not at same byte offset from a word boundary.  */
 | 
			
		||||
        bne     strcmp_unaligned
 | 
			
		||||
        ands    r2, r0, #3
 | 
			
		||||
        bic     r0, r0, #3
 | 
			
		||||
        bic     r1, r1, #3
 | 
			
		||||
        ldr     ip, [r0], #4
 | 
			
		||||
        it      eq
 | 
			
		||||
        ldreq   r3, [r1], #4
 | 
			
		||||
        beq     1f
 | 
			
		||||
        /* Although s1 and s2 have identical initial alignment, they are
 | 
			
		||||
        not currently word aligned.  Rather than comparing bytes,
 | 
			
		||||
    make sure that any bytes fetched from before the addressed
 | 
			
		||||
    bytes are forced to 0xff.  Then they will always compare
 | 
			
		||||
    equal.  */
 | 
			
		||||
        eor     r2, r2, #3
 | 
			
		||||
        lsl     r2, r2, #3
 | 
			
		||||
        mvn     r3, MSB
 | 
			
		||||
        S2LOMEM        r2, r3, r2
 | 
			
		||||
        ldr     r3, [r1], #4
 | 
			
		||||
        orr     ip, ip, r2
 | 
			
		||||
        orr     r3, r3, r2
 | 
			
		||||
1:
 | 
			
		||||
#ifndef __thumb2__
 | 
			
		||||
              /* Load the 'magic' constant 0x01010101.  */
 | 
			
		||||
        str     r4, [sp, #-4]!
 | 
			
		||||
        mov     r4, #1
 | 
			
		||||
        orr     r4, r4, r4, lsl #8
 | 
			
		||||
        orr     r4, r4, r4, lsl #16
 | 
			
		||||
#endif
 | 
			
		||||
        .p2align        2
 | 
			
		||||
4:
 | 
			
		||||
        optpld  r0, #8
 | 
			
		||||
        optpld  r1, #8
 | 
			
		||||
        sub     r2, ip, magic1(r4)
 | 
			
		||||
        cmp     ip, r3
 | 
			
		||||
        itttt   eq
 | 
			
		||||
        /* check for any zero bytes in first word */
 | 
			
		||||
        biceq   r2, r2, ip
 | 
			
		||||
        tsteq   r2, magic2(r4)
 | 
			
		||||
        ldreq   ip, [r0], #4
 | 
			
		||||
        ldreq   r3, [r1], #4
 | 
			
		||||
        beq     4b
 | 
			
		||||
2:
 | 
			
		||||
        /* There's a zero or a different byte in the word */
 | 
			
		||||
        S2HIMEM  r0, ip, #24
 | 
			
		||||
        S2LOMEM  ip, ip, #8
 | 
			
		||||
        cmp     r0, #1
 | 
			
		||||
        it      cs
 | 
			
		||||
        cmpcs   r0, r3, S2HIMEM #24
 | 
			
		||||
        it      eq
 | 
			
		||||
        S2LOMEMEQ r3, r3, #8
 | 
			
		||||
        beq     2b
 | 
			
		||||
        /* On a big-endian machine, r0 contains the desired byte in bits
 | 
			
		||||
        0-7; on a little-endian machine they are in bits 24-31.  In
 | 
			
		||||
        both cases the other bits in r0 are all zero.  For r3 the
 | 
			
		||||
        interesting byte is at the other end of the word, but the
 | 
			
		||||
        other bits are not necessarily zero.  We need a signed result
 | 
			
		||||
        representing the differnece in the unsigned bytes, so for the
 | 
			
		||||
        little-endian case we can't just shift the interesting bits
 | 
			
		||||
        up.  */
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        sub     r0, r0, r3, lsr #24
 | 
			
		||||
#else
 | 
			
		||||
        and     r3, r3, #255
 | 
			
		||||
#ifdef __thumb2__
 | 
			
		||||
        /* No RSB instruction in Thumb2 */
 | 
			
		||||
        lsr     r0, r0, #24
 | 
			
		||||
        sub     r0, r0, r3
 | 
			
		||||
#else
 | 
			
		||||
        rsb     r0, r3, r0, lsr #24
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef __thumb2__
 | 
			
		||||
        ldr     r4, [sp], #4
 | 
			
		||||
#endif
 | 
			
		||||
        RETURN
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
strcmp_unaligned:
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
        /* The assembly code below is based on the following alogrithm.  */
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
#define RSHIFT <<
 | 
			
		||||
#define LSHIFT >>
 | 
			
		||||
#else
 | 
			
		||||
#define RSHIFT >>
 | 
			
		||||
#define LSHIFT <<
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define body(shift)                         \
 | 
			
		||||
  mask = 0xffffffffU RSHIFT shift;                  \
 | 
			
		||||
  w1 = *wp1++;                              \
 | 
			
		||||
  w2 = *wp2++;                              \
 | 
			
		||||
  do                                    \
 | 
			
		||||
    {                                   \
 | 
			
		||||
      t1 = w1 & mask;                           \
 | 
			
		||||
      if (__builtin_expect(t1 != w2 RSHIFT shift, 0))           \
 | 
			
		||||
    {                               \
 | 
			
		||||
      w2 RSHIFT= shift;                     \
 | 
			
		||||
      break;                            \
 | 
			
		||||
    }                               \
 | 
			
		||||
      if (__builtin_expect(((w1 - b1) & ~w1) & (b1 << 7), 0))       \
 | 
			
		||||
    {                               \
 | 
			
		||||
      /* See comment in assembler below re syndrome on big-endian */\
 | 
			
		||||
      if ((((w1 - b1) & ~w1) & (b1 << 7)) & mask)           \
 | 
			
		||||
        w2 RSHIFT= shift;                       \
 | 
			
		||||
      else                              \
 | 
			
		||||
        {                               \
 | 
			
		||||
          w2 = *wp2;                        \
 | 
			
		||||
          t1 = w1 RSHIFT (32 - shift);              \
 | 
			
		||||
          w2 = (w2 LSHIFT (32 - shift)) RSHIFT (32 - shift);    \
 | 
			
		||||
        }                               \
 | 
			
		||||
      break;                            \
 | 
			
		||||
    }                               \
 | 
			
		||||
      w2 = *wp2++;                          \
 | 
			
		||||
      t1 ^= w1;                             \
 | 
			
		||||
      if (__builtin_expect(t1 != w2 LSHIFT (32 - shift), 0))        \
 | 
			
		||||
    {                               \
 | 
			
		||||
      t1 = w1 >> (32 - shift);                  \
 | 
			
		||||
      w2 = (w2 << (32 - shift)) RSHIFT (32 - shift);        \
 | 
			
		||||
      break;                            \
 | 
			
		||||
    }                               \
 | 
			
		||||
      w1 = *wp1++;                          \
 | 
			
		||||
    } while (1)
 | 
			
		||||
 | 
			
		||||
  const unsigned* wp1;
 | 
			
		||||
  const unsigned* wp2;
 | 
			
		||||
  unsigned w1, w2;
 | 
			
		||||
  unsigned mask;
 | 
			
		||||
  unsigned shift;
 | 
			
		||||
  unsigned b1 = 0x01010101;
 | 
			
		||||
  char c1, c2;
 | 
			
		||||
  unsigned t1;
 | 
			
		||||
 | 
			
		||||
  while (((unsigned) s1) & 3)
 | 
			
		||||
    {
 | 
			
		||||
      c1 = *s1++;
 | 
			
		||||
      c2 = *s2++;
 | 
			
		||||
      if (c1 == 0 || c1 != c2)
 | 
			
		||||
    return c1 - (int)c2;
 | 
			
		||||
    }
 | 
			
		||||
  wp1 = (unsigned*) (((unsigned)s1) & ~3);
 | 
			
		||||
  wp2 = (unsigned*) (((unsigned)s2) & ~3);
 | 
			
		||||
  t1 = ((unsigned) s2) & 3;
 | 
			
		||||
  if (t1 == 1)
 | 
			
		||||
    {
 | 
			
		||||
      body(8);
 | 
			
		||||
    }
 | 
			
		||||
  else if (t1 == 2)
 | 
			
		||||
    {
 | 
			
		||||
      body(16);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      body (24);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  do
 | 
			
		||||
    {
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
      c1 = (char) t1 >> 24;
 | 
			
		||||
      c2 = (char) w2 >> 24;
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
      c1 = (char) t1;
 | 
			
		||||
      c2 = (char) w2;
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
      t1 RSHIFT= 8;
 | 
			
		||||
      w2 RSHIFT= 8;
 | 
			
		||||
    } while (c1 != 0 && c1 == c2);
 | 
			
		||||
  return c1 - c2;
 | 
			
		||||
#endif /* 0 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        wp1 .req r0
 | 
			
		||||
        wp2 .req r1
 | 
			
		||||
        b1  .req r2
 | 
			
		||||
        w1  .req r4
 | 
			
		||||
        w2  .req r5
 | 
			
		||||
        t1  .req ip
 | 
			
		||||
        @ r3 is scratch
 | 
			
		||||
 | 
			
		||||
        /* First of all, compare bytes until wp1(sp1) is word-aligned. */
 | 
			
		||||
1:
 | 
			
		||||
        tst     wp1, #3
 | 
			
		||||
        beq     2f
 | 
			
		||||
        ldrb    r2, [wp1], #1
 | 
			
		||||
        ldrb    r3, [wp2], #1
 | 
			
		||||
        cmp     r2, #1
 | 
			
		||||
        it      cs
 | 
			
		||||
        cmpcs   r2, r3
 | 
			
		||||
        beq     1b
 | 
			
		||||
        sub     r0, r2, r3
 | 
			
		||||
        RETURN
 | 
			
		||||
 | 
			
		||||
2:
 | 
			
		||||
        str     r5, [sp, #-4]!
 | 
			
		||||
        str     r4, [sp, #-4]!
 | 
			
		||||
        //stmfd   sp!, {r4, r5}
 | 
			
		||||
        mov     b1, #1
 | 
			
		||||
        orr     b1, b1, b1, lsl #8
 | 
			
		||||
        orr     b1, b1, b1, lsl #16
 | 
			
		||||
 | 
			
		||||
        and     t1, wp2, #3
 | 
			
		||||
        bic     wp2, wp2, #3
 | 
			
		||||
        ldr     w1, [wp1], #4
 | 
			
		||||
        ldr     w2, [wp2], #4
 | 
			
		||||
        cmp     t1, #2
 | 
			
		||||
        beq     2f
 | 
			
		||||
        bhi     3f
 | 
			
		||||
 | 
			
		||||
        /* Critical inner Loop: Block with 3 bytes initial overlap */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
1:
 | 
			
		||||
        bic     t1, w1, MSB
 | 
			
		||||
        cmp     t1, w2, S2LOMEM #8
 | 
			
		||||
        sub     r3, w1, b1
 | 
			
		||||
        bic     r3, r3, w1
 | 
			
		||||
        bne     4f
 | 
			
		||||
        ands    r3, r3, b1, lsl #7
 | 
			
		||||
        it      eq
 | 
			
		||||
        ldreq   w2, [wp2], #4
 | 
			
		||||
        bne     5f
 | 
			
		||||
        eor     t1, t1, w1
 | 
			
		||||
        cmp     t1, w2, S2HIMEM #24
 | 
			
		||||
        bne     6f
 | 
			
		||||
        ldr     w1, [wp1], #4
 | 
			
		||||
        b       1b
 | 
			
		||||
4:
 | 
			
		||||
        S2LOMEM        w2, w2, #8
 | 
			
		||||
        b       8f
 | 
			
		||||
 | 
			
		||||
5:
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        /* The syndrome value may contain false ones if the string ends
 | 
			
		||||
        with the bytes 0x01 0x00 */
 | 
			
		||||
        tst     w1, #0xff000000
 | 
			
		||||
        itt     ne
 | 
			
		||||
        tstne   w1, #0x00ff0000
 | 
			
		||||
        tstne   w1, #0x0000ff00
 | 
			
		||||
        beq     7f
 | 
			
		||||
#else
 | 
			
		||||
        bics    r3, r3, #0xff000000
 | 
			
		||||
        bne     7f
 | 
			
		||||
#endif
 | 
			
		||||
        ldrb    w2, [wp2]
 | 
			
		||||
        S2LOMEM  t1, w1, #24
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        lsl     w2, w2, #24
 | 
			
		||||
#endif
 | 
			
		||||
        b       8f
 | 
			
		||||
 | 
			
		||||
6:
 | 
			
		||||
        S2LOMEM  t1, w1, #24
 | 
			
		||||
        and     w2, w2, LSB
 | 
			
		||||
        b       8f
 | 
			
		||||
 | 
			
		||||
        /* Critical inner Loop: Block with 2 bytes initial overlap */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
2:
 | 
			
		||||
        S2HIMEM  t1, w1, #16
 | 
			
		||||
        sub     r3, w1, b1
 | 
			
		||||
        S2LOMEM  t1, t1, #16
 | 
			
		||||
        bic     r3, r3, w1
 | 
			
		||||
        cmp     t1, w2, S2LOMEM #16
 | 
			
		||||
        bne     4f
 | 
			
		||||
        ands    r3, r3, b1, lsl #7
 | 
			
		||||
        it      eq
 | 
			
		||||
        ldreq   w2, [wp2], #4
 | 
			
		||||
        bne     5f
 | 
			
		||||
        eor     t1, t1, w1
 | 
			
		||||
        cmp     t1, w2, S2HIMEM #16
 | 
			
		||||
        bne     6f
 | 
			
		||||
        ldr     w1, [wp1], #4
 | 
			
		||||
        b       2b
 | 
			
		||||
 | 
			
		||||
5:
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        /* The syndrome value may contain false ones if the string ends
 | 
			
		||||
        with the bytes 0x01 0x00 */
 | 
			
		||||
        tst     w1, #0xff000000
 | 
			
		||||
        it      ne
 | 
			
		||||
        tstne   w1, #0x00ff0000
 | 
			
		||||
        beq     7f
 | 
			
		||||
#else
 | 
			
		||||
        lsls    r3, r3, #16
 | 
			
		||||
        bne     7f
 | 
			
		||||
#endif
 | 
			
		||||
        ldrh    w2, [wp2]
 | 
			
		||||
        S2LOMEM  t1, w1, #16
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        lsl     w2, w2, #16
 | 
			
		||||
#endif
 | 
			
		||||
        b       8f
 | 
			
		||||
 | 
			
		||||
6:
 | 
			
		||||
        S2HIMEM  w2, w2, #16
 | 
			
		||||
        S2LOMEM  t1, w1, #16
 | 
			
		||||
4:
 | 
			
		||||
        S2LOMEM  w2, w2, #16
 | 
			
		||||
        b       8f
 | 
			
		||||
 | 
			
		||||
        /* Critical inner Loop: Block with 1 byte initial overlap */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
3:
 | 
			
		||||
        and     t1, w1, LSB
 | 
			
		||||
        cmp     t1, w2, S2LOMEM #24
 | 
			
		||||
        sub     r3, w1, b1
 | 
			
		||||
        bic     r3, r3, w1
 | 
			
		||||
        bne     4f
 | 
			
		||||
        ands    r3, r3, b1, lsl #7
 | 
			
		||||
        it      eq
 | 
			
		||||
        ldreq   w2, [wp2], #4
 | 
			
		||||
        bne     5f
 | 
			
		||||
        eor     t1, t1, w1
 | 
			
		||||
        cmp     t1, w2, S2HIMEM #8
 | 
			
		||||
        bne     6f
 | 
			
		||||
        ldr     w1, [wp1], #4
 | 
			
		||||
        b       3b
 | 
			
		||||
4:
 | 
			
		||||
        S2LOMEM  w2, w2, #24
 | 
			
		||||
        b       8f
 | 
			
		||||
5:
 | 
			
		||||
        /* The syndrome value may contain false ones if the string ends
 | 
			
		||||
        with the bytes 0x01 0x00 */
 | 
			
		||||
        tst     w1, LSB
 | 
			
		||||
        beq     7f
 | 
			
		||||
        ldr     w2, [wp2], #4
 | 
			
		||||
6:
 | 
			
		||||
        S2LOMEM  t1, w1, #8
 | 
			
		||||
        bic     w2, w2, MSB
 | 
			
		||||
        b       8f
 | 
			
		||||
7:
 | 
			
		||||
        mov     r0, #0
 | 
			
		||||
        //ldmfd   sp!, {r4, r5}
 | 
			
		||||
        ldr     r4, [sp], #4
 | 
			
		||||
        ldr     r5, [sp], #4
 | 
			
		||||
        RETURN
 | 
			
		||||
8:
 | 
			
		||||
        and     r2, t1, LSB
 | 
			
		||||
        and     r0, w2, LSB
 | 
			
		||||
        cmp     r0, #1
 | 
			
		||||
        it      cs
 | 
			
		||||
        cmpcs   r0, r2
 | 
			
		||||
        itt     eq
 | 
			
		||||
        S2LOMEMEQ        t1, t1, #8
 | 
			
		||||
        S2LOMEMEQ        w2, w2, #8
 | 
			
		||||
        beq     8b
 | 
			
		||||
        sub     r0, r2, r0
 | 
			
		||||
        //ldmfd   sp!, {r4, r5}
 | 
			
		||||
        ldr     r4, [sp], #4
 | 
			
		||||
        ldr     r5, [sp], #4
 | 
			
		||||
        RETURN
 | 
			
		||||
 | 
			
		||||
#endif /* !(defined (_ISA_THUMB_2) || defined (_ISA_ARM_6)
 | 
			
		||||
            defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED) ||
 | 
			
		||||
            (defined (__thumb__) && !defined (__thumb2__))) */
 | 
			
		||||
@@ -26,8 +26,8 @@
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(syscall)
 | 
			
		||||
    mov     ip, sp
 | 
			
		||||
@@ -39,7 +39,8 @@ ENTRY(syscall)
 | 
			
		||||
    ldmfd   ip, {r3, r4, r5, r6}
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmfd   sp!, {r4, r5, r6, r7}
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(syscall)
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,11 @@
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
/* unlike our auto-generated syscall stubs, this code saves lr
 | 
			
		||||
   on the stack, as well as a few other registers. this makes
 | 
			
		||||
   our stack unwinder happy, when we generate debug stack
 | 
			
		||||
@@ -33,19 +38,14 @@
 | 
			
		||||
   of a corrupted malloc heap).
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
#ifndef __NR_tgkill
 | 
			
		||||
#define __NR_tgkill  268
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ENTRY(tgkill)
 | 
			
		||||
    .save   {r4-r7, ip, lr}
 | 
			
		||||
    stmfd   sp!, {r4-r7, ip, lr}
 | 
			
		||||
    ldr     r7, =__NR_tgkill
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmfd   sp!, {r4-r7, ip, lr}
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(tgkill)
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,11 @@
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
/* unlike our auto-generated syscall stubs, this code saves lr
 | 
			
		||||
   on the stack, as well as a few other registers. this makes
 | 
			
		||||
   our stack unwinder happy, when we generate debug stack
 | 
			
		||||
@@ -33,19 +38,13 @@
 | 
			
		||||
   of a corrupted malloc heap).
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
#ifndef __NR_tkill
 | 
			
		||||
#define __NR_tkill  238
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ENTRY(tkill)
 | 
			
		||||
    stmfd   sp!, {r4-r7, ip, lr}
 | 
			
		||||
    ldr     r7, =__NR_tkill
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmfd   sp!, {r4-r7, ip, lr}
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(tkill)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										324
									
								
								libc/arch-arm/cortex-a15/bionic/memcpy.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										324
									
								
								libc/arch-arm/cortex-a15/bionic/memcpy.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,324 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
    /* 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>
 | 
			
		||||
 | 
			
		||||
        .text
 | 
			
		||||
        .syntax unified
 | 
			
		||||
        .fpu    neon
 | 
			
		||||
 | 
			
		||||
#define CACHE_LINE_SIZE 64
 | 
			
		||||
 | 
			
		||||
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)]
 | 
			
		||||
        push    {r0, lr}
 | 
			
		||||
 | 
			
		||||
        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
 | 
			
		||||
END(memcpy)
 | 
			
		||||
							
								
								
									
										164
									
								
								libc/arch-arm/cortex-a15/bionic/memset.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										164
									
								
								libc/arch-arm/cortex-a15/bionic/memset.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,164 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * Optimized memset() for ARM.
 | 
			
		||||
         *
 | 
			
		||||
         * memset() returns its first argument.
 | 
			
		||||
		 */
 | 
			
		||||
 | 
			
		||||
        .fpu        neon
 | 
			
		||||
        .syntax     unified
 | 
			
		||||
 | 
			
		||||
ENTRY(bzero)
 | 
			
		||||
        mov         r2, r1
 | 
			
		||||
        mov         r1, #0
 | 
			
		||||
        // Fall through to memset...
 | 
			
		||||
END(bzero)
 | 
			
		||||
 | 
			
		||||
ENTRY(memset)
 | 
			
		||||
        .save       {r0}
 | 
			
		||||
        stmfd       sp!, {r0}
 | 
			
		||||
 | 
			
		||||
        // 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
 | 
			
		||||
 | 
			
		||||
        // Use strd which requires an even and odd register so move the
 | 
			
		||||
        // values so that:
 | 
			
		||||
        //   r0 and r1 contain the memset value
 | 
			
		||||
        //   r2 is the number of bytes to set
 | 
			
		||||
        //   r3 is the destination pointer
 | 
			
		||||
        mov         r3, r0
 | 
			
		||||
 | 
			
		||||
        // Copy the byte value in every byte of r1.
 | 
			
		||||
        mov         r1, r1, lsl #24
 | 
			
		||||
        orr         r1, r1, r1, lsr #8
 | 
			
		||||
        orr         r1, r1, r1, lsr #16
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
double_word_aligned:
 | 
			
		||||
        mov         r0, r1
 | 
			
		||||
 | 
			
		||||
        subs        r2, #64
 | 
			
		||||
        blo         set_less_than_64
 | 
			
		||||
 | 
			
		||||
1:      // Main loop sets 64 bytes at a time.
 | 
			
		||||
        .irp        offset, #0, #8, #16, #24, #32, #40, #48, #56
 | 
			
		||||
        strd        r0, r1, [r3, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
 | 
			
		||||
        add         r3, #64
 | 
			
		||||
        subs        r2, #64
 | 
			
		||||
        bge         1b
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
        // 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
 | 
			
		||||
        // Set 16 bytes.
 | 
			
		||||
        .irp        offset, #0, #8
 | 
			
		||||
        strd        r0, r1, [r3, \offset]
 | 
			
		||||
        .endr
 | 
			
		||||
        add         r3, #16
 | 
			
		||||
 | 
			
		||||
set_less_than_16:
 | 
			
		||||
        // Less than 16 bytes to set.
 | 
			
		||||
        lsls        ip, r2, #29
 | 
			
		||||
        bcc         set_less_than_8
 | 
			
		||||
 | 
			
		||||
        // Set 8 bytes.
 | 
			
		||||
        strd        r0, r1, [r3], #8
 | 
			
		||||
 | 
			
		||||
set_less_than_8:
 | 
			
		||||
        bpl         set_less_than_4
 | 
			
		||||
        // Set 4 bytes
 | 
			
		||||
        str         r1, [r3], #4
 | 
			
		||||
 | 
			
		||||
set_less_than_4:
 | 
			
		||||
        lsls        ip, r2, #31
 | 
			
		||||
        it          ne
 | 
			
		||||
        strbne      r1, [r3], #1
 | 
			
		||||
        itt         cs
 | 
			
		||||
        strbcs      r1, [r3], #1
 | 
			
		||||
        strbcs      r1, [r3]
 | 
			
		||||
 | 
			
		||||
        ldmfd       sp!, {r0}
 | 
			
		||||
        bx          lr
 | 
			
		||||
 | 
			
		||||
do_double_word_align:
 | 
			
		||||
        rsb         ip, ip, #8
 | 
			
		||||
        sub         r2, r2, ip
 | 
			
		||||
        movs        r0, ip, lsl #31
 | 
			
		||||
        it          mi
 | 
			
		||||
        strbmi      r1, [r3], #1
 | 
			
		||||
        itt         cs
 | 
			
		||||
        strbcs      r1, [r3], #1
 | 
			
		||||
        strbcs      r1, [r3], #1
 | 
			
		||||
 | 
			
		||||
        // Dst is at least word aligned by this point.
 | 
			
		||||
        cmp         ip, #4
 | 
			
		||||
        blo         double_word_aligned
 | 
			
		||||
        str         r1, [r3], #4
 | 
			
		||||
        b           double_word_aligned
 | 
			
		||||
 | 
			
		||||
set_less_than_16_unknown_align:
 | 
			
		||||
        // Set up to 15 bytes.
 | 
			
		||||
        vdup.8      d0, r1
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
        bcc         1f
 | 
			
		||||
        vst1.8      {d0}, [r0]!
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        vst1.32     {d0[0]}, [r0]!
 | 
			
		||||
2:      movs        ip, r2, lsl #31
 | 
			
		||||
        it          mi
 | 
			
		||||
        strbmi      r1, [r0], #1
 | 
			
		||||
        itt         cs
 | 
			
		||||
        strbcs      r1, [r0], #1
 | 
			
		||||
        strbcs      r1, [r0], #1
 | 
			
		||||
        ldmfd       sp!, {r0}
 | 
			
		||||
        bx          lr
 | 
			
		||||
END(memset)
 | 
			
		||||
							
								
								
									
										377
									
								
								libc/arch-arm/cortex-a15/bionic/strcmp.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										377
									
								
								libc/arch-arm/cortex-a15/bionic/strcmp.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,377 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
#define S2LOMEM lsl
 | 
			
		||||
#define S2LOMEMEQ lsleq
 | 
			
		||||
#define S2HIMEM lsr
 | 
			
		||||
#define MSB 0x000000ff
 | 
			
		||||
#define LSB 0xff000000
 | 
			
		||||
#define BYTE0_OFFSET 24
 | 
			
		||||
#define BYTE1_OFFSET 16
 | 
			
		||||
#define BYTE2_OFFSET 8
 | 
			
		||||
#define BYTE3_OFFSET 0
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
#define S2LOMEM lsr
 | 
			
		||||
#define S2LOMEMEQ lsreq
 | 
			
		||||
#define S2HIMEM lsl
 | 
			
		||||
#define BYTE0_OFFSET 0
 | 
			
		||||
#define BYTE1_OFFSET 8
 | 
			
		||||
#define BYTE2_OFFSET 16
 | 
			
		||||
#define BYTE3_OFFSET 24
 | 
			
		||||
#define MSB 0xff000000
 | 
			
		||||
#define LSB 0x000000ff
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
 | 
			
		||||
.syntax         unified
 | 
			
		||||
 | 
			
		||||
#if defined (__thumb__)
 | 
			
		||||
        .thumb
 | 
			
		||||
        .thumb_func
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ENTRY(strcmp)
 | 
			
		||||
      /* Use LDRD whenever possible.  */
 | 
			
		||||
 | 
			
		||||
/* The main thing to look out for when comparing large blocks is that
 | 
			
		||||
   the loads do not cross a page boundary when loading past the index
 | 
			
		||||
   of the byte with the first difference or the first string-terminator.
 | 
			
		||||
 | 
			
		||||
   For example, if the strings are identical and the string-terminator
 | 
			
		||||
   is at index k, byte by byte comparison will not load beyond address
 | 
			
		||||
   s1+k and s2+k; word by word comparison may load up to 3 bytes beyond
 | 
			
		||||
   k; double word - up to 7 bytes.  If the load of these bytes crosses
 | 
			
		||||
   a page boundary, it might cause a memory fault (if the page is not mapped)
 | 
			
		||||
   that would not have happened in byte by byte comparison.
 | 
			
		||||
 | 
			
		||||
   If an address is (double) word aligned, then a load of a (double) word
 | 
			
		||||
   from that address will not cross a page boundary.
 | 
			
		||||
   Therefore, the algorithm below considers word and double-word alignment
 | 
			
		||||
   of strings separately.  */
 | 
			
		||||
 | 
			
		||||
/* High-level description of the algorithm.
 | 
			
		||||
 | 
			
		||||
   * The fast path: if both strings are double-word aligned,
 | 
			
		||||
     use LDRD to load two words from each string in every loop iteration.
 | 
			
		||||
   * If the strings have the same offset from a word boundary,
 | 
			
		||||
     use LDRB to load and compare byte by byte until
 | 
			
		||||
     the first string is aligned to a word boundary (at most 3 bytes).
 | 
			
		||||
     This is optimized for quick return on short unaligned strings.
 | 
			
		||||
   * If the strings have the same offset from a double-word boundary,
 | 
			
		||||
     use LDRD to load two words from each string in every loop iteration, as in the fast path.
 | 
			
		||||
   * If the strings do not have the same offset from a double-word boundary,
 | 
			
		||||
     load a word from the second string before the loop to initialize the queue.
 | 
			
		||||
     Use LDRD to load two words from every string in every loop iteration.
 | 
			
		||||
     Inside the loop, load the second word from the second string only after comparing
 | 
			
		||||
     the first word, using the queued value, to guarantee safety across page boundaries.
 | 
			
		||||
   * If the strings do not have the same offset from a word boundary,
 | 
			
		||||
     use LDR and a shift queue. Order of loads and comparisons matters,
 | 
			
		||||
     similarly to the previous case.
 | 
			
		||||
 | 
			
		||||
   * Use UADD8 and SEL to compare words, and use REV and CLZ to compute the return value.
 | 
			
		||||
   * The only difference between ARM and Thumb modes is the use of CBZ instruction.
 | 
			
		||||
   * The only difference between big and little endian is the use of REV in little endian
 | 
			
		||||
     to compute the return value, instead of MOV.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
        .macro m_cbz reg label
 | 
			
		||||
#ifdef __thumb2__
 | 
			
		||||
        cbz     \reg, \label
 | 
			
		||||
#else   /* not defined __thumb2__ */
 | 
			
		||||
        cmp     \reg, #0
 | 
			
		||||
        beq     \label
 | 
			
		||||
#endif /* not defined __thumb2__ */
 | 
			
		||||
        .endm /* m_cbz */
 | 
			
		||||
 | 
			
		||||
        .macro m_cbnz reg label
 | 
			
		||||
#ifdef __thumb2__
 | 
			
		||||
        cbnz    \reg, \label
 | 
			
		||||
#else   /* not defined __thumb2__ */
 | 
			
		||||
        cmp     \reg, #0
 | 
			
		||||
        bne     \label
 | 
			
		||||
#endif /* not defined __thumb2__ */
 | 
			
		||||
        .endm /* m_cbnz */
 | 
			
		||||
 | 
			
		||||
        .macro  init
 | 
			
		||||
        /* Macro to save temporary registers and prepare magic values.  */
 | 
			
		||||
        subs    sp, sp, #16
 | 
			
		||||
        strd    r4, r5, [sp, #8]
 | 
			
		||||
        strd    r6, r7, [sp]
 | 
			
		||||
        mvn     r6, #0  /* all F */
 | 
			
		||||
        mov     r7, #0  /* all 0 */
 | 
			
		||||
        .endm   /* init */
 | 
			
		||||
 | 
			
		||||
        .macro  magic_compare_and_branch w1 w2 label
 | 
			
		||||
        /* Macro to compare registers w1 and w2 and conditionally branch to label.  */
 | 
			
		||||
        cmp     \w1, \w2        /* Are w1 and w2 the same?  */
 | 
			
		||||
        magic_find_zero_bytes \w1
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   ip, #0          /* Is there a zero byte in w1?  */
 | 
			
		||||
        bne     \label
 | 
			
		||||
        .endm /* magic_compare_and_branch */
 | 
			
		||||
 | 
			
		||||
        .macro  magic_find_zero_bytes w1
 | 
			
		||||
        /* Macro to find all-zero bytes in w1, result is in ip.  */
 | 
			
		||||
#if (defined (__ARM_FEATURE_DSP))
 | 
			
		||||
        uadd8   ip, \w1, r6
 | 
			
		||||
        sel     ip, r7, r6
 | 
			
		||||
#else /* not defined (__ARM_FEATURE_DSP) */
 | 
			
		||||
        /* __ARM_FEATURE_DSP is not defined for some Cortex-M processors.
 | 
			
		||||
        Coincidently, these processors only have Thumb-2 mode, where we can use the
 | 
			
		||||
        the (large) magic constant available directly as an immediate in instructions.
 | 
			
		||||
        Note that we cannot use the magic constant in ARM mode, where we need
 | 
			
		||||
        to create the constant in a register.  */
 | 
			
		||||
        sub     ip, \w1, #0x01010101
 | 
			
		||||
        bic     ip, ip, \w1
 | 
			
		||||
        and     ip, ip, #0x80808080
 | 
			
		||||
#endif /* not defined (__ARM_FEATURE_DSP) */
 | 
			
		||||
        .endm /* magic_find_zero_bytes */
 | 
			
		||||
 | 
			
		||||
        .macro  setup_return w1 w2
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        mov     r1, \w1
 | 
			
		||||
        mov     r2, \w2
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
        rev     r1, \w1
 | 
			
		||||
        rev     r2, \w2
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
        .endm /* setup_return */
 | 
			
		||||
 | 
			
		||||
        pld [r0, #0]
 | 
			
		||||
        pld [r1, #0]
 | 
			
		||||
 | 
			
		||||
        /* Are both strings double-word aligned?  */
 | 
			
		||||
        orr     ip, r0, r1
 | 
			
		||||
        tst     ip, #7
 | 
			
		||||
        bne     do_align
 | 
			
		||||
 | 
			
		||||
        /* Fast path.  */
 | 
			
		||||
        init
 | 
			
		||||
 | 
			
		||||
doubleword_aligned:
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are double-word aligned.  */
 | 
			
		||||
        /* Compare two words in every iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
2:
 | 
			
		||||
        pld [r0, #16]
 | 
			
		||||
        pld [r1, #16]
 | 
			
		||||
 | 
			
		||||
        /* Load the next double-word from each string.  */
 | 
			
		||||
        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
 | 
			
		||||
        b       2b
 | 
			
		||||
 | 
			
		||||
do_align:
 | 
			
		||||
        /* Is the first string word-aligned?  */
 | 
			
		||||
        ands    ip, r0, #3
 | 
			
		||||
        beq     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
 | 
			
		||||
        to read until the next word boundary is 4-ip.  */
 | 
			
		||||
        bic     r0, r0, #3
 | 
			
		||||
        ldr     r2, [r0], #4
 | 
			
		||||
        lsls    ip, ip, #31
 | 
			
		||||
        beq     byte2
 | 
			
		||||
        bcs     byte3
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
fast_return:
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
        bx      lr
 | 
			
		||||
 | 
			
		||||
word_aligned_r0:
 | 
			
		||||
        init
 | 
			
		||||
        /* The first string is word-aligned.  */
 | 
			
		||||
        /* Is the second string word-aligned?  */
 | 
			
		||||
        ands    ip, r1, #3
 | 
			
		||||
        bne     strcmp_unaligned
 | 
			
		||||
 | 
			
		||||
word_aligned:
 | 
			
		||||
        /* The strings are word-aligned. */
 | 
			
		||||
        /* Is the first string double-word aligned?  */
 | 
			
		||||
        tst     r0, #4
 | 
			
		||||
        beq     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
 | 
			
		||||
 | 
			
		||||
doubleword_aligned_r0:
 | 
			
		||||
        /* Get here when r0 is double-word aligned.  */
 | 
			
		||||
        /* Is r1 doubleword_aligned?  */
 | 
			
		||||
        tst     r1, #4
 | 
			
		||||
        beq     doubleword_aligned
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are word-aligned,
 | 
			
		||||
        r0 is double-word aligned, but r1 is not double-word aligned.  */
 | 
			
		||||
 | 
			
		||||
        /* Initialize the queue.  */
 | 
			
		||||
        ldr     r5, [r1], #4
 | 
			
		||||
 | 
			
		||||
        /* Compare two words in every iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
3:
 | 
			
		||||
        pld [r0, #16]
 | 
			
		||||
        pld [r1, #16]
 | 
			
		||||
 | 
			
		||||
        /* 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
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        magic_compare_and_branch w1=r3 w2=r4 label=return_34
 | 
			
		||||
        b       3b
 | 
			
		||||
 | 
			
		||||
        .macro miscmp_word offsetlo offsethi
 | 
			
		||||
        /* Macro to compare misaligned strings.  */
 | 
			
		||||
        /* r0, r1 are word-aligned, and at least one of the strings
 | 
			
		||||
        is not double-word aligned.  */
 | 
			
		||||
        /* Compare one word in every loop iteration.  */
 | 
			
		||||
        /* OFFSETLO is the original bit-offset of r1 from a word-boundary,
 | 
			
		||||
        OFFSETHI is 32 - OFFSETLO (i.e., offset from the next word).  */
 | 
			
		||||
 | 
			
		||||
        /* Initialize the shift queue.  */
 | 
			
		||||
        ldr     r5, [r1], #4
 | 
			
		||||
 | 
			
		||||
        /* Compare one word from each string in every loop iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
7:
 | 
			
		||||
        ldr     r3, [r0], #4
 | 
			
		||||
        S2LOMEM r5, r5, #\offsetlo
 | 
			
		||||
        magic_find_zero_bytes w1=r3
 | 
			
		||||
        cmp     r7, ip, S2HIMEM #\offsetlo
 | 
			
		||||
        and     r2, r3, r6, S2LOMEM #\offsetlo
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   r2, r5
 | 
			
		||||
        bne     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
 | 
			
		||||
        b       7b
 | 
			
		||||
        .endm /* miscmp_word */
 | 
			
		||||
 | 
			
		||||
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.  */
 | 
			
		||||
        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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
return_32:
 | 
			
		||||
        setup_return w1=r3, w2=r2
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_34:
 | 
			
		||||
        setup_return w1=r3, w2=r4
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_25:
 | 
			
		||||
        setup_return w1=r2, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_35:
 | 
			
		||||
        setup_return w1=r3, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_24:
 | 
			
		||||
        setup_return w1=r2, w2=r4
 | 
			
		||||
 | 
			
		||||
do_return:
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
        rev     r0, ip
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
 | 
			
		||||
        /* Restore temporaries early, before computing the return value.  */
 | 
			
		||||
        ldrd    r6, r7, [sp]
 | 
			
		||||
        ldrd    r4, r5, [sp, #8]
 | 
			
		||||
        adds    sp, sp, #16
 | 
			
		||||
 | 
			
		||||
        /* 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
 | 
			
		||||
        clz     r0, r0
 | 
			
		||||
        /* r0 contains the number of bits on the left of the first all-zero byte in r1.  */
 | 
			
		||||
        rsb     r0, r0, #24
 | 
			
		||||
        /* Here, r0 contains the number of bits on the right of the first all-zero byte in r1.  */
 | 
			
		||||
        lsr     r1, r1, r0
 | 
			
		||||
        lsr     r2, r2, r0
 | 
			
		||||
 | 
			
		||||
compute_return_value:
 | 
			
		||||
        movs    r0, #1
 | 
			
		||||
        cmp     r1, r2
 | 
			
		||||
        /* The return value is computed as follows.
 | 
			
		||||
        If r1>r2 then (C==1 and Z==0) and LS doesn't hold and r0 is #1 at return.
 | 
			
		||||
        If r1<r2 then (C==0 and Z==0) and we execute SBC with carry_in=0,
 | 
			
		||||
        which means r0:=r0-r0-1 and r0 is #-1 at return.
 | 
			
		||||
        If r1=r2 then (C==1 and Z==1) and we execute SBC with carry_in=1,
 | 
			
		||||
        which means r0:=r0-r0 and r0 is #0 at return.
 | 
			
		||||
        (C==0 and Z==1) cannot happen because the carry bit is "not borrow".  */
 | 
			
		||||
        it      ls
 | 
			
		||||
        sbcls   r0, r0, r0
 | 
			
		||||
        bx      lr
 | 
			
		||||
END(strcmp)
 | 
			
		||||
							
								
								
									
										151
									
								
								libc/arch-arm/cortex-a15/bionic/strlen.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										151
									
								
								libc/arch-arm/cortex-a15/bionic/strlen.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,151 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 [r1, #128]
 | 
			
		||||
    mov r1, r0
 | 
			
		||||
 | 
			
		||||
    rsb     r3, r0, #0
 | 
			
		||||
    ands    r3, r3, #7
 | 
			
		||||
    beq     mainloop
 | 
			
		||||
 | 
			
		||||
    // Align to a double word (64 bits).
 | 
			
		||||
    ands    ip, r3, #1
 | 
			
		||||
    beq     align_to_32
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cmp     r2, #0
 | 
			
		||||
    beq     update_count_and_return
 | 
			
		||||
 | 
			
		||||
align_to_32:
 | 
			
		||||
    ands    ip, r3, #2
 | 
			
		||||
    beq     align_to_64
 | 
			
		||||
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cmp     r2, #0
 | 
			
		||||
    beq     update_count_and_return
 | 
			
		||||
    ldrb    r2, [r1], #1
 | 
			
		||||
    cmp     r2, #0
 | 
			
		||||
    beq     update_count_and_return
 | 
			
		||||
 | 
			
		||||
align_to_64:
 | 
			
		||||
    ands    ip, r3, #4
 | 
			
		||||
    beq     mainloop
 | 
			
		||||
    ldr     r3, [r1], #4
 | 
			
		||||
 | 
			
		||||
    sub     ip, r3, #0x01010101
 | 
			
		||||
    bic     ip, ip, r3
 | 
			
		||||
    ands    ip, ip, #0x80808080
 | 
			
		||||
    bne     zero_in_second_register
 | 
			
		||||
 | 
			
		||||
mainloop:
 | 
			
		||||
    ldrd    r2, r3, [r1], #8
 | 
			
		||||
 | 
			
		||||
    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     r1, r1, #4
 | 
			
		||||
 | 
			
		||||
zero_in_second_register:
 | 
			
		||||
    sub     r0, r1, r0
 | 
			
		||||
 | 
			
		||||
    // Check for zero in byte 0.
 | 
			
		||||
    ands    r1, ip, #0x80
 | 
			
		||||
    beq     check_byte1
 | 
			
		||||
 | 
			
		||||
    sub     r0, r0, #4
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
check_byte1:
 | 
			
		||||
    // Check for zero in byte 1.
 | 
			
		||||
    ands    r1, ip, #0x8000
 | 
			
		||||
    beq     check_byte2
 | 
			
		||||
 | 
			
		||||
    sub     r0, r0, #3
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
check_byte2:
 | 
			
		||||
    // Check for zero in byte 2.
 | 
			
		||||
    ands    r1, ip, #0x800000
 | 
			
		||||
    beq     return
 | 
			
		||||
 | 
			
		||||
    sub     r0, r0, #2
 | 
			
		||||
    bx      lr
 | 
			
		||||
 | 
			
		||||
update_count_and_return:
 | 
			
		||||
    sub     r0, r1, r0
 | 
			
		||||
 | 
			
		||||
return:
 | 
			
		||||
    sub     r0, r0, #1
 | 
			
		||||
    bx      lr
 | 
			
		||||
END(strlen)
 | 
			
		||||
							
								
								
									
										6
									
								
								libc/arch-arm/cortex-a15/cortex-a15.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								libc/arch-arm/cortex-a15/cortex-a15.mk
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
$(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,STRCMP,arch-arm/cortex-a15/bionic/strcmp.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRLEN,arch-arm/cortex-a15/bionic/strlen.S)
 | 
			
		||||
 | 
			
		||||
include bionic/libc/arch-arm/generic/generic.mk
 | 
			
		||||
							
								
								
									
										1
									
								
								libc/arch-arm/cortex-a8/cortex-a8.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								libc/arch-arm/cortex-a8/cortex-a8.mk
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
include bionic/libc/arch-arm/cortex-a15/cortex-a15.mk
 | 
			
		||||
							
								
								
									
										211
									
								
								libc/arch-arm/cortex-a9/bionic/memcpy.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										211
									
								
								libc/arch-arm/cortex-a9/bionic/memcpy.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,211 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *  * Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 *  * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 | 
			
		||||
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 | 
			
		||||
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 | 
			
		||||
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 | 
			
		||||
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 | 
			
		||||
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
        .text
 | 
			
		||||
        .fpu    neon
 | 
			
		||||
 | 
			
		||||
#define CACHE_LINE_SIZE     32
 | 
			
		||||
 | 
			
		||||
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)]
 | 
			
		||||
 | 
			
		||||
        // 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         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}
 | 
			
		||||
END(memcpy)
 | 
			
		||||
							
								
								
									
										152
									
								
								libc/arch-arm/cortex-a9/bionic/memset.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								libc/arch-arm/cortex-a9/bionic/memset.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,152 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *  * Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 *  * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 | 
			
		||||
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 | 
			
		||||
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 | 
			
		||||
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 | 
			
		||||
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 | 
			
		||||
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This code assumes it is running on a processor that supports all arm v7
 | 
			
		||||
 * instructions and that supports neon instructions.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
    .fpu    neon
 | 
			
		||||
 | 
			
		||||
ENTRY(bzero)
 | 
			
		||||
        mov     r2, r1
 | 
			
		||||
        mov     r1, #0
 | 
			
		||||
END(bzero)
 | 
			
		||||
 | 
			
		||||
/* memset() returns its first argument.  */
 | 
			
		||||
ENTRY(memset)
 | 
			
		||||
        # The neon memset only wins for less than 132.
 | 
			
		||||
        cmp         r2, #132
 | 
			
		||||
        bhi         11f
 | 
			
		||||
 | 
			
		||||
        .save       {r0}
 | 
			
		||||
        stmfd       sp!, {r0}
 | 
			
		||||
 | 
			
		||||
        vdup.8      q0, r1
 | 
			
		||||
 | 
			
		||||
        /* make sure we have at least 32 bytes to write */
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        blo         2f
 | 
			
		||||
        vmov        q1, q0
 | 
			
		||||
 | 
			
		||||
1:      /* The main loop writes 32 bytes at a time */
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        vst1.8      {d0 - d3}, [r0]!
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
2:      /* less than 32 left */
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
        tst         r2, #0x10
 | 
			
		||||
        beq         3f
 | 
			
		||||
 | 
			
		||||
        // writes 16 bytes, 128-bits aligned
 | 
			
		||||
        vst1.8      {d0, d1}, [r0]!
 | 
			
		||||
3:      /* write up to 15-bytes (count in r2) */
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
        bcc         1f
 | 
			
		||||
        vst1.8      {d0}, [r0]!
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        vst1.32     {d0[0]}, [r0]!
 | 
			
		||||
2:      movs        ip, r2, lsl #31
 | 
			
		||||
        strmib      r1, [r0], #1
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        ldmfd       sp!, {r0}
 | 
			
		||||
        bx          lr
 | 
			
		||||
11:
 | 
			
		||||
        /* 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}
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #3
 | 
			
		||||
        cmp         r3, r2
 | 
			
		||||
        movhi       r3, r2
 | 
			
		||||
 | 
			
		||||
        /* splat r1 */
 | 
			
		||||
        mov         r1, r1, lsl #24
 | 
			
		||||
        orr         r1, r1, r1, lsr #8
 | 
			
		||||
        orr         r1, r1, r1, lsr #16
 | 
			
		||||
 | 
			
		||||
        movs        r12, r3, lsl #31
 | 
			
		||||
        strcsb      r1, [r0], #1    /* can't use strh (alignment unknown) */
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        strmib      r1, [r0], #1
 | 
			
		||||
        subs        r2, r2, r3
 | 
			
		||||
        ldmlsfd     sp!, {r0, r4-r7, lr}   /* return */
 | 
			
		||||
        bxls        lr
 | 
			
		||||
 | 
			
		||||
        /* align the destination to a cache-line */
 | 
			
		||||
        mov         r12, r1
 | 
			
		||||
        mov         lr, r1
 | 
			
		||||
        mov         r4, r1
 | 
			
		||||
        mov         r5, r1
 | 
			
		||||
        mov         r6, r1
 | 
			
		||||
        mov         r7, r1
 | 
			
		||||
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #0x1C
 | 
			
		||||
        beq         3f
 | 
			
		||||
        cmp         r3, r2
 | 
			
		||||
        andhi       r3, r2, #0x1C
 | 
			
		||||
        sub         r2, r2, r3
 | 
			
		||||
 | 
			
		||||
        /* conditionally writes 0 to 7 words (length in r3) */
 | 
			
		||||
        movs        r3, r3, lsl #28
 | 
			
		||||
        stmcsia     r0!, {r1, lr}
 | 
			
		||||
        stmcsia     r0!, {r1, lr}
 | 
			
		||||
        stmmiia     r0!, {r1, lr}
 | 
			
		||||
        movs        r3, r3, lsl #2
 | 
			
		||||
        strcs       r1, [r0], #4
 | 
			
		||||
 | 
			
		||||
3:
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        mov         r3, r1
 | 
			
		||||
        bmi         2f
 | 
			
		||||
1:      subs        r2, r2, #32
 | 
			
		||||
        stmia       r0!, {r1,r3,r4,r5,r6,r7,r12,lr}
 | 
			
		||||
        bhs         1b
 | 
			
		||||
2:      add         r2, r2, #32
 | 
			
		||||
 | 
			
		||||
        /* conditionally stores 0 to 31 bytes */
 | 
			
		||||
        movs        r2, r2, lsl #28
 | 
			
		||||
        stmcsia     r0!, {r1,r3,r12,lr}
 | 
			
		||||
        stmmiia     r0!, {r1, lr}
 | 
			
		||||
        movs        r2, r2, lsl #2
 | 
			
		||||
        strcs       r1, [r0], #4
 | 
			
		||||
        strmih      r1, [r0], #2
 | 
			
		||||
        movs        r2, r2, lsl #2
 | 
			
		||||
        strcsb      r1, [r0]
 | 
			
		||||
        ldmfd       sp!, {r0, r4-r7, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
END(memset)
 | 
			
		||||
							
								
								
									
										544
									
								
								libc/arch-arm/cortex-a9/bionic/strcmp.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										544
									
								
								libc/arch-arm/cortex-a9/bionic/strcmp.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,544 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
#define S2LOMEM lsl
 | 
			
		||||
#define S2LOMEMEQ lsleq
 | 
			
		||||
#define S2HIMEM lsr
 | 
			
		||||
#define MSB 0x000000ff
 | 
			
		||||
#define LSB 0xff000000
 | 
			
		||||
#define BYTE0_OFFSET 24
 | 
			
		||||
#define BYTE1_OFFSET 16
 | 
			
		||||
#define BYTE2_OFFSET 8
 | 
			
		||||
#define BYTE3_OFFSET 0
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
#define S2LOMEM lsr
 | 
			
		||||
#define S2LOMEMEQ lsreq
 | 
			
		||||
#define S2HIMEM lsl
 | 
			
		||||
#define BYTE0_OFFSET 0
 | 
			
		||||
#define BYTE1_OFFSET 8
 | 
			
		||||
#define BYTE2_OFFSET 16
 | 
			
		||||
#define BYTE3_OFFSET 24
 | 
			
		||||
#define MSB 0xff000000
 | 
			
		||||
#define LSB 0x000000ff
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
 | 
			
		||||
.syntax         unified
 | 
			
		||||
 | 
			
		||||
#if defined (__thumb__)
 | 
			
		||||
        .thumb
 | 
			
		||||
        .thumb_func
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ENTRY(strcmp)
 | 
			
		||||
      /* Use LDRD whenever possible.  */
 | 
			
		||||
 | 
			
		||||
/* The main thing to look out for when comparing large blocks is that
 | 
			
		||||
   the loads do not cross a page boundary when loading past the index
 | 
			
		||||
   of the byte with the first difference or the first string-terminator.
 | 
			
		||||
 | 
			
		||||
   For example, if the strings are identical and the string-terminator
 | 
			
		||||
   is at index k, byte by byte comparison will not load beyond address
 | 
			
		||||
   s1+k and s2+k; word by word comparison may load up to 3 bytes beyond
 | 
			
		||||
   k; double word - up to 7 bytes.  If the load of these bytes crosses
 | 
			
		||||
   a page boundary, it might cause a memory fault (if the page is not mapped)
 | 
			
		||||
   that would not have happened in byte by byte comparison.
 | 
			
		||||
 | 
			
		||||
   If an address is (double) word aligned, then a load of a (double) word
 | 
			
		||||
   from that address will not cross a page boundary.
 | 
			
		||||
   Therefore, the algorithm below considers word and double-word alignment
 | 
			
		||||
   of strings separately.  */
 | 
			
		||||
 | 
			
		||||
/* High-level description of the algorithm.
 | 
			
		||||
 | 
			
		||||
   * The fast path: if both strings are double-word aligned,
 | 
			
		||||
     use LDRD to load two words from each string in every loop iteration.
 | 
			
		||||
   * If the strings have the same offset from a word boundary,
 | 
			
		||||
     use LDRB to load and compare byte by byte until
 | 
			
		||||
     the first string is aligned to a word boundary (at most 3 bytes).
 | 
			
		||||
     This is optimized for quick return on short unaligned strings.
 | 
			
		||||
   * If the strings have the same offset from a double-word boundary,
 | 
			
		||||
     use LDRD to load two words from each string in every loop iteration, as in the fast path.
 | 
			
		||||
   * If the strings do not have the same offset from a double-word boundary,
 | 
			
		||||
     load a word from the second string before the loop to initialize the queue.
 | 
			
		||||
     Use LDRD to load two words from every string in every loop iteration.
 | 
			
		||||
     Inside the loop, load the second word from the second string only after comparing
 | 
			
		||||
     the first word, using the queued value, to guarantee safety across page boundaries.
 | 
			
		||||
   * If the strings do not have the same offset from a word boundary,
 | 
			
		||||
     use LDR and a shift queue. Order of loads and comparisons matters,
 | 
			
		||||
     similarly to the previous case.
 | 
			
		||||
 | 
			
		||||
   * Use UADD8 and SEL to compare words, and use REV and CLZ to compute the return value.
 | 
			
		||||
   * The only difference between ARM and Thumb modes is the use of CBZ instruction.
 | 
			
		||||
   * The only difference between big and little endian is the use of REV in little endian
 | 
			
		||||
     to compute the return value, instead of MOV.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
        .macro m_cbz reg label
 | 
			
		||||
#ifdef __thumb2__
 | 
			
		||||
        cbz     \reg, \label
 | 
			
		||||
#else   /* not defined __thumb2__ */
 | 
			
		||||
        cmp     \reg, #0
 | 
			
		||||
        beq     \label
 | 
			
		||||
#endif /* not defined __thumb2__ */
 | 
			
		||||
        .endm /* m_cbz */
 | 
			
		||||
 | 
			
		||||
        .macro m_cbnz reg label
 | 
			
		||||
#ifdef __thumb2__
 | 
			
		||||
        cbnz    \reg, \label
 | 
			
		||||
#else   /* not defined __thumb2__ */
 | 
			
		||||
        cmp     \reg, #0
 | 
			
		||||
        bne     \label
 | 
			
		||||
#endif /* not defined __thumb2__ */
 | 
			
		||||
        .endm /* m_cbnz */
 | 
			
		||||
 | 
			
		||||
        .macro  init
 | 
			
		||||
        /* Macro to save temporary registers and prepare magic values.  */
 | 
			
		||||
        subs    sp, sp, #16
 | 
			
		||||
        strd    r4, r5, [sp, #8]
 | 
			
		||||
        strd    r6, r7, [sp]
 | 
			
		||||
        mvn     r6, #0  /* all F */
 | 
			
		||||
        mov     r7, #0  /* all 0 */
 | 
			
		||||
        .endm   /* init */
 | 
			
		||||
 | 
			
		||||
        .macro  magic_compare_and_branch w1 w2 label
 | 
			
		||||
        /* Macro to compare registers w1 and w2 and conditionally branch to label.  */
 | 
			
		||||
        cmp     \w1, \w2        /* Are w1 and w2 the same?  */
 | 
			
		||||
        magic_find_zero_bytes \w1
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   ip, #0          /* Is there a zero byte in w1?  */
 | 
			
		||||
        bne     \label
 | 
			
		||||
        .endm /* magic_compare_and_branch */
 | 
			
		||||
 | 
			
		||||
        .macro  magic_find_zero_bytes w1
 | 
			
		||||
        /* Macro to find all-zero bytes in w1, result is in ip.  */
 | 
			
		||||
#if (defined (__ARM_FEATURE_DSP))
 | 
			
		||||
        uadd8   ip, \w1, r6
 | 
			
		||||
        sel     ip, r7, r6
 | 
			
		||||
#else /* not defined (__ARM_FEATURE_DSP) */
 | 
			
		||||
        /* __ARM_FEATURE_DSP is not defined for some Cortex-M processors.
 | 
			
		||||
        Coincidently, these processors only have Thumb-2 mode, where we can use the
 | 
			
		||||
        the (large) magic constant available directly as an immediate in instructions.
 | 
			
		||||
        Note that we cannot use the magic constant in ARM mode, where we need
 | 
			
		||||
        to create the constant in a register.  */
 | 
			
		||||
        sub     ip, \w1, #0x01010101
 | 
			
		||||
        bic     ip, ip, \w1
 | 
			
		||||
        and     ip, ip, #0x80808080
 | 
			
		||||
#endif /* not defined (__ARM_FEATURE_DSP) */
 | 
			
		||||
        .endm /* magic_find_zero_bytes */
 | 
			
		||||
 | 
			
		||||
        .macro  setup_return w1 w2
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        mov     r1, \w1
 | 
			
		||||
        mov     r2, \w2
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
        rev     r1, \w1
 | 
			
		||||
        rev     r2, \w2
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
        .endm /* setup_return */
 | 
			
		||||
 | 
			
		||||
        pld [r0, #0]
 | 
			
		||||
        pld [r1, #0]
 | 
			
		||||
 | 
			
		||||
        /* Are both strings double-word aligned?  */
 | 
			
		||||
        orr     ip, r0, r1
 | 
			
		||||
        tst     ip, #7
 | 
			
		||||
        bne     do_align
 | 
			
		||||
 | 
			
		||||
        /* Fast path.  */
 | 
			
		||||
        init
 | 
			
		||||
 | 
			
		||||
doubleword_aligned:
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are double-word aligned.  */
 | 
			
		||||
        /* Compare two words in every iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
2:
 | 
			
		||||
        pld [r0, #16]
 | 
			
		||||
        pld [r1, #16]
 | 
			
		||||
 | 
			
		||||
        /* Load the next double-word from each string.  */
 | 
			
		||||
        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
 | 
			
		||||
        b       2b
 | 
			
		||||
 | 
			
		||||
do_align:
 | 
			
		||||
        /* Is the first string word-aligned?  */
 | 
			
		||||
        ands    ip, r0, #3
 | 
			
		||||
        beq     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
 | 
			
		||||
        to read until the next word boundary is 4-ip.  */
 | 
			
		||||
        bic     r0, r0, #3
 | 
			
		||||
        ldr     r2, [r0], #4
 | 
			
		||||
        lsls    ip, ip, #31
 | 
			
		||||
        beq     byte2
 | 
			
		||||
        bcs     byte3
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
fast_return:
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
        bx      lr
 | 
			
		||||
 | 
			
		||||
word_aligned_r0:
 | 
			
		||||
        init
 | 
			
		||||
        /* The first string is word-aligned.  */
 | 
			
		||||
        /* Is the second string word-aligned?  */
 | 
			
		||||
        ands    ip, r1, #3
 | 
			
		||||
        bne     strcmp_unaligned
 | 
			
		||||
 | 
			
		||||
word_aligned:
 | 
			
		||||
        /* The strings are word-aligned. */
 | 
			
		||||
        /* Is the first string double-word aligned?  */
 | 
			
		||||
        tst     r0, #4
 | 
			
		||||
        beq     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
 | 
			
		||||
 | 
			
		||||
doubleword_aligned_r0:
 | 
			
		||||
        /* Get here when r0 is double-word aligned.  */
 | 
			
		||||
        /* Is r1 doubleword_aligned?  */
 | 
			
		||||
        tst     r1, #4
 | 
			
		||||
        beq     doubleword_aligned
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are word-aligned,
 | 
			
		||||
        r0 is double-word aligned, but r1 is not double-word aligned.  */
 | 
			
		||||
 | 
			
		||||
        /* Initialize the queue.  */
 | 
			
		||||
        ldr     r5, [r1], #4
 | 
			
		||||
 | 
			
		||||
        /* Compare two words in every iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
3:
 | 
			
		||||
        pld [r0, #16]
 | 
			
		||||
        pld [r1, #16]
 | 
			
		||||
 | 
			
		||||
        /* 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
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        magic_compare_and_branch w1=r3 w2=r4 label=return_34
 | 
			
		||||
        b       3b
 | 
			
		||||
 | 
			
		||||
        .macro miscmp_word offsetlo offsethi
 | 
			
		||||
        /* Macro to compare misaligned strings.  */
 | 
			
		||||
        /* r0, r1 are word-aligned, and at least one of the strings
 | 
			
		||||
        is not double-word aligned.  */
 | 
			
		||||
        /* Compare one word in every loop iteration.  */
 | 
			
		||||
        /* OFFSETLO is the original bit-offset of r1 from a word-boundary,
 | 
			
		||||
        OFFSETHI is 32 - OFFSETLO (i.e., offset from the next word).  */
 | 
			
		||||
 | 
			
		||||
        /* Initialize the shift queue.  */
 | 
			
		||||
        ldr     r5, [r1], #4
 | 
			
		||||
 | 
			
		||||
        /* Compare one word from each string in every loop iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
7:
 | 
			
		||||
        ldr     r3, [r0], #4
 | 
			
		||||
        S2LOMEM r5, r5, #\offsetlo
 | 
			
		||||
        magic_find_zero_bytes w1=r3
 | 
			
		||||
        cmp     r7, ip, S2HIMEM #\offsetlo
 | 
			
		||||
        and     r2, r3, r6, S2LOMEM #\offsetlo
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   r2, r5
 | 
			
		||||
        bne     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
 | 
			
		||||
        b       7b
 | 
			
		||||
        .endm /* miscmp_word */
 | 
			
		||||
 | 
			
		||||
return_32:
 | 
			
		||||
        setup_return w1=r3, w2=r2
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_34:
 | 
			
		||||
        setup_return w1=r3, w2=r4
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_25:
 | 
			
		||||
        setup_return w1=r2, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_35:
 | 
			
		||||
        setup_return w1=r3, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_24:
 | 
			
		||||
        setup_return w1=r2, w2=r4
 | 
			
		||||
 | 
			
		||||
do_return:
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
        rev     r0, ip
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
 | 
			
		||||
        /* Restore temporaries early, before computing the return value.  */
 | 
			
		||||
        ldrd    r6, r7, [sp]
 | 
			
		||||
        ldrd    r4, r5, [sp, #8]
 | 
			
		||||
        adds    sp, sp, #16
 | 
			
		||||
 | 
			
		||||
        /* 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
 | 
			
		||||
        clz     r0, r0
 | 
			
		||||
        /* r0 contains the number of bits on the left of the first all-zero byte in r1.  */
 | 
			
		||||
        rsb     r0, r0, #24
 | 
			
		||||
        /* Here, r0 contains the number of bits on the right of the first all-zero byte in r1.  */
 | 
			
		||||
        lsr     r1, r1, r0
 | 
			
		||||
        lsr     r2, r2, r0
 | 
			
		||||
 | 
			
		||||
compute_return_value:
 | 
			
		||||
        movs    r0, #1
 | 
			
		||||
        cmp     r1, r2
 | 
			
		||||
        /* The return value is computed as follows.
 | 
			
		||||
        If r1>r2 then (C==1 and Z==0) and LS doesn't hold and r0 is #1 at return.
 | 
			
		||||
        If r1<r2 then (C==0 and Z==0) and we execute SBC with carry_in=0,
 | 
			
		||||
        which means r0:=r0-r0-1 and r0 is #-1 at return.
 | 
			
		||||
        If r1=r2 then (C==1 and Z==1) and we execute SBC with carry_in=1,
 | 
			
		||||
        which means r0:=r0-r0 and r0 is #0 at return.
 | 
			
		||||
        (C==0 and Z==1) cannot happen because the carry bit is "not borrow".  */
 | 
			
		||||
        it      ls
 | 
			
		||||
        sbcls   r0, r0, r0
 | 
			
		||||
        bx      lr
 | 
			
		||||
 | 
			
		||||
    /* The code from the previous version of strcmp.S handles all of the
 | 
			
		||||
     * cases where the first string and seconds string cannot both be
 | 
			
		||||
     * aligned to a word boundary faster than the new algorithm. See
 | 
			
		||||
     * bionic/libc/arch-arm/cortex-a15/bionic/strcmp.S for the unedited
 | 
			
		||||
     * version of the code.
 | 
			
		||||
     */
 | 
			
		||||
strcmp_unaligned:
 | 
			
		||||
	wp1 .req r0
 | 
			
		||||
	wp2 .req r1
 | 
			
		||||
	b1  .req r2
 | 
			
		||||
	w1  .req r4
 | 
			
		||||
	w2  .req r5
 | 
			
		||||
	t1  .req ip
 | 
			
		||||
	@ r3 is scratch
 | 
			
		||||
 | 
			
		||||
2:
 | 
			
		||||
	mov	b1, #1
 | 
			
		||||
	orr	b1, b1, b1, lsl #8
 | 
			
		||||
	orr	b1, b1, b1, lsl #16
 | 
			
		||||
 | 
			
		||||
	and	t1, wp2, #3
 | 
			
		||||
	bic	wp2, wp2, #3
 | 
			
		||||
	ldr	w1, [wp1], #4
 | 
			
		||||
	ldr	w2, [wp2], #4
 | 
			
		||||
	cmp	t1, #2
 | 
			
		||||
	beq	2f
 | 
			
		||||
	bhi	3f
 | 
			
		||||
 | 
			
		||||
	/* Critical inner Loop: Block with 3 bytes initial overlap */
 | 
			
		||||
	.p2align	2
 | 
			
		||||
1:
 | 
			
		||||
	bic	t1, w1, #MSB
 | 
			
		||||
	cmp	t1, w2, S2LOMEM #8
 | 
			
		||||
	sub	r3, w1, b1
 | 
			
		||||
	bic	r3, r3, w1
 | 
			
		||||
	bne	4f
 | 
			
		||||
	ands	r3, r3, b1, lsl #7
 | 
			
		||||
	it	eq
 | 
			
		||||
	ldreq	w2, [wp2], #4
 | 
			
		||||
	bne	5f
 | 
			
		||||
	eor	t1, t1, w1
 | 
			
		||||
	cmp	t1, w2, S2HIMEM #24
 | 
			
		||||
	bne	6f
 | 
			
		||||
	ldr	w1, [wp1], #4
 | 
			
		||||
	b	1b
 | 
			
		||||
4:
 | 
			
		||||
	S2LOMEM	w2, w2, #8
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
5:
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
	/* The syndrome value may contain false ones if the string ends
 | 
			
		||||
	 * with the bytes 0x01 0x00
 | 
			
		||||
	 */
 | 
			
		||||
	tst	w1, #0xff000000
 | 
			
		||||
	itt	ne
 | 
			
		||||
	tstne	w1, #0x00ff0000
 | 
			
		||||
	tstne	w1, #0x0000ff00
 | 
			
		||||
	beq	7f
 | 
			
		||||
#else
 | 
			
		||||
	bics	r3, r3, #0xff000000
 | 
			
		||||
	bne	7f
 | 
			
		||||
#endif
 | 
			
		||||
	ldrb	w2, [wp2]
 | 
			
		||||
	S2LOMEM	t1, w1, #24
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
	lsl	w2, w2, #24
 | 
			
		||||
#endif
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
6:
 | 
			
		||||
	S2LOMEM	t1, w1, #24
 | 
			
		||||
	and	w2, w2, #LSB
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
	/* Critical inner Loop: Block with 2 bytes initial overlap */
 | 
			
		||||
	.p2align	2
 | 
			
		||||
2:
 | 
			
		||||
	S2HIMEM	t1, w1, #16
 | 
			
		||||
	sub	r3, w1, b1
 | 
			
		||||
	S2LOMEM	t1, t1, #16
 | 
			
		||||
	bic	r3, r3, w1
 | 
			
		||||
	cmp	t1, w2, S2LOMEM #16
 | 
			
		||||
	bne	4f
 | 
			
		||||
	ands	r3, r3, b1, lsl #7
 | 
			
		||||
	it	eq
 | 
			
		||||
	ldreq	w2, [wp2], #4
 | 
			
		||||
	bne	5f
 | 
			
		||||
	eor	t1, t1, w1
 | 
			
		||||
	cmp	t1, w2, S2HIMEM #16
 | 
			
		||||
	bne	6f
 | 
			
		||||
	ldr	w1, [wp1], #4
 | 
			
		||||
	b	2b
 | 
			
		||||
 | 
			
		||||
5:
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
	/* The syndrome value may contain false ones if the string ends
 | 
			
		||||
	 * with the bytes 0x01 0x00
 | 
			
		||||
	 */
 | 
			
		||||
	tst	w1, #0xff000000
 | 
			
		||||
	it	ne
 | 
			
		||||
	tstne	w1, #0x00ff0000
 | 
			
		||||
	beq	7f
 | 
			
		||||
#else
 | 
			
		||||
	lsls	r3, r3, #16
 | 
			
		||||
	bne	7f
 | 
			
		||||
#endif
 | 
			
		||||
	ldrh	w2, [wp2]
 | 
			
		||||
	S2LOMEM	t1, w1, #16
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
	lsl	w2, w2, #16
 | 
			
		||||
#endif
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
6:
 | 
			
		||||
	S2HIMEM	w2, w2, #16
 | 
			
		||||
	S2LOMEM	t1, w1, #16
 | 
			
		||||
4:
 | 
			
		||||
	S2LOMEM	w2, w2, #16
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
	/* Critical inner Loop: Block with 1 byte initial overlap */
 | 
			
		||||
	.p2align	2
 | 
			
		||||
3:
 | 
			
		||||
	and	t1, w1, #LSB
 | 
			
		||||
	cmp	t1, w2, S2LOMEM #24
 | 
			
		||||
	sub	r3, w1, b1
 | 
			
		||||
	bic	r3, r3, w1
 | 
			
		||||
	bne	4f
 | 
			
		||||
	ands	r3, r3, b1, lsl #7
 | 
			
		||||
	it	eq
 | 
			
		||||
	ldreq	w2, [wp2], #4
 | 
			
		||||
	bne	5f
 | 
			
		||||
	eor	t1, t1, w1
 | 
			
		||||
	cmp	t1, w2, S2HIMEM #8
 | 
			
		||||
	bne	6f
 | 
			
		||||
	ldr	w1, [wp1], #4
 | 
			
		||||
	b	3b
 | 
			
		||||
4:
 | 
			
		||||
	S2LOMEM	w2, w2, #24
 | 
			
		||||
	b	8f
 | 
			
		||||
5:
 | 
			
		||||
	/* The syndrome value may contain false ones if the string ends
 | 
			
		||||
	 * with the bytes 0x01 0x00
 | 
			
		||||
	 */
 | 
			
		||||
	tst	w1, #LSB
 | 
			
		||||
	beq	7f
 | 
			
		||||
	ldr	w2, [wp2], #4
 | 
			
		||||
6:
 | 
			
		||||
	S2LOMEM	t1, w1, #8
 | 
			
		||||
	bic	w2, w2, #MSB
 | 
			
		||||
	b	8f
 | 
			
		||||
7:
 | 
			
		||||
	mov	r0, #0
 | 
			
		||||
 | 
			
		||||
    /* Restore registers and stack. */
 | 
			
		||||
    ldrd    r6, r7, [sp]
 | 
			
		||||
    ldrd    r4, r5, [sp, #8]
 | 
			
		||||
    adds    sp, sp, #16
 | 
			
		||||
 | 
			
		||||
	bx	lr
 | 
			
		||||
 | 
			
		||||
8:
 | 
			
		||||
	and	r2, t1, #LSB
 | 
			
		||||
	and	r0, w2, #LSB
 | 
			
		||||
	cmp	r0, #1
 | 
			
		||||
	it	cs
 | 
			
		||||
	cmpcs	r0, r2
 | 
			
		||||
	itt	eq
 | 
			
		||||
	S2LOMEMEQ	t1, t1, #8
 | 
			
		||||
	S2LOMEMEQ	w2, w2, #8
 | 
			
		||||
	beq	8b
 | 
			
		||||
	sub	r0, r2, r0
 | 
			
		||||
 | 
			
		||||
    /* Restore registers and stack. */
 | 
			
		||||
    ldrd    r6, r7, [sp]
 | 
			
		||||
    ldrd    r4, r5, [sp, #8]
 | 
			
		||||
    adds    sp, sp, #16
 | 
			
		||||
 | 
			
		||||
	bx	lr
 | 
			
		||||
END(strcmp)
 | 
			
		||||
							
								
								
									
										7
									
								
								libc/arch-arm/cortex-a9/cortex-a9.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								libc/arch-arm/cortex-a9/cortex-a9.mk
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
$(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,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)
 | 
			
		||||
 | 
			
		||||
include bionic/libc/arch-arm/generic/generic.mk
 | 
			
		||||
							
								
								
									
										380
									
								
								libc/arch-arm/generic/bionic/memcpy.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										380
									
								
								libc/arch-arm/generic/bionic/memcpy.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,380 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *  * Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 *  * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 | 
			
		||||
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 | 
			
		||||
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 | 
			
		||||
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 | 
			
		||||
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 | 
			
		||||
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Optimized memcpy() for ARM.
 | 
			
		||||
         *
 | 
			
		||||
         * note that memcpy() always returns the destination pointer,
 | 
			
		||||
         * so we have to preserve R0.
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
         * which we can use for better pipelining of the reads below
 | 
			
		||||
         */
 | 
			
		||||
        .save       {r0, r4, lr}
 | 
			
		||||
        stmfd       sp!, {r0, r4, lr}
 | 
			
		||||
        /* Making room for r5-r11 which will be spilled later */
 | 
			
		||||
        .pad        #28
 | 
			
		||||
        sub         sp, sp, #28
 | 
			
		||||
 | 
			
		||||
        // preload the destination because we'll align it to a cache line
 | 
			
		||||
        // with small writes. Also start the source "pump".
 | 
			
		||||
        PLD         (r0, #0)
 | 
			
		||||
        PLD         (r1, #0)
 | 
			
		||||
        PLD         (r1, #32)
 | 
			
		||||
 | 
			
		||||
        /* it simplifies things to take care of len<4 early */
 | 
			
		||||
        cmp         r2, #4
 | 
			
		||||
        blo         copy_last_3_and_return
 | 
			
		||||
 | 
			
		||||
        /* compute the offset to align the source
 | 
			
		||||
         * offset = (4-(src&3))&3 = -src & 3
 | 
			
		||||
         */
 | 
			
		||||
        rsb         r3, r1, #0
 | 
			
		||||
        ands        r3, r3, #3
 | 
			
		||||
        beq         src_aligned
 | 
			
		||||
 | 
			
		||||
        /* 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      r12,[r1], #1
 | 
			
		||||
        strmib      r3, [r0], #1
 | 
			
		||||
        strcsb      r4, [r0], #1
 | 
			
		||||
        strcsb      r12,[r0], #1
 | 
			
		||||
 | 
			
		||||
src_aligned:
 | 
			
		||||
 | 
			
		||||
        /* see if src and dst are aligned together (congruent) */
 | 
			
		||||
        eor         r12, r0, r1
 | 
			
		||||
        tst         r12, #3
 | 
			
		||||
        bne         non_congruent
 | 
			
		||||
 | 
			
		||||
        /* Use post-incriment mode for stm to spill r5-r11 to reserved stack
 | 
			
		||||
         * frame. Don't update sp.
 | 
			
		||||
         */
 | 
			
		||||
        stmea       sp, {r5-r11}
 | 
			
		||||
 | 
			
		||||
        /* align the destination to a cache-line */
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #0x1C
 | 
			
		||||
        beq         congruent_aligned32
 | 
			
		||||
        cmp         r3, r2
 | 
			
		||||
        andhi       r3, r2, #0x1C
 | 
			
		||||
 | 
			
		||||
        /* conditionally copies 0 to 7 words (length in r3) */
 | 
			
		||||
        movs        r12, r3, lsl #28
 | 
			
		||||
        ldmcsia     r1!, {r4, r5, r6, r7}   /* 16 bytes */
 | 
			
		||||
        ldmmiia     r1!, {r8, r9}           /*  8 bytes */
 | 
			
		||||
        stmcsia     r0!, {r4, r5, r6, r7}
 | 
			
		||||
        stmmiia     r0!, {r8, r9}
 | 
			
		||||
        tst         r3, #0x4
 | 
			
		||||
        ldrne       r10,[r1], #4            /*  4 bytes */
 | 
			
		||||
        strne       r10,[r0], #4
 | 
			
		||||
        sub         r2, r2, r3
 | 
			
		||||
 | 
			
		||||
congruent_aligned32:
 | 
			
		||||
        /*
 | 
			
		||||
         * here source is aligned to 32 bytes.
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
cached_aligned32:
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        blo         less_than_32_left
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * We preload a cache-line up to 64 bytes ahead. On the 926, this will
 | 
			
		||||
         * stall only until the requested world is fetched, but the linefill
 | 
			
		||||
         * continues in the the background.
 | 
			
		||||
         * While the linefill is going, we write our previous cache-line
 | 
			
		||||
         * into the write-buffer (which should have some free space).
 | 
			
		||||
         * When the linefill is done, the writebuffer will
 | 
			
		||||
         * start dumping its content into memory
 | 
			
		||||
         *
 | 
			
		||||
         * While all this is going, we then load a full cache line into
 | 
			
		||||
         * 8 registers, this cache line should be in the cache by now
 | 
			
		||||
         * (or partly in the cache).
 | 
			
		||||
         *
 | 
			
		||||
         * This code should work well regardless of the source/dest alignment.
 | 
			
		||||
         *
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
        // Align the preload register to a cache-line because the cpu does
 | 
			
		||||
        // "critical word first" (the first word requested is loaded first).
 | 
			
		||||
        bic         r12, r1, #0x1F
 | 
			
		||||
        add         r12, r12, #64
 | 
			
		||||
 | 
			
		||||
1:      ldmia       r1!, { r4-r11 }
 | 
			
		||||
        PLD         (r12, #64)
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
 | 
			
		||||
        // NOTE: if r12 is more than 64 ahead of r1, the following ldrhi
 | 
			
		||||
        // for ARM9 preload will not be safely guarded by the preceding subs.
 | 
			
		||||
        // When it is safely guarded the only possibility to have SIGSEGV here
 | 
			
		||||
        // is because the caller overstates the length.
 | 
			
		||||
        ldrhi       r3, [r12], #32      /* cheap ARM9 preload */
 | 
			
		||||
        stmia       r0!, { r4-r11 }
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
less_than_32_left:
 | 
			
		||||
        /*
 | 
			
		||||
         * less than 32 bytes left at this point (length in r2)
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
        /* skip all this if there is nothing to do, which should
 | 
			
		||||
         * be a common case (if not executed the code below takes
 | 
			
		||||
         * about 16 cycles)
 | 
			
		||||
         */
 | 
			
		||||
        tst         r2, #0x1F
 | 
			
		||||
        beq         1f
 | 
			
		||||
 | 
			
		||||
        /* conditionnaly copies 0 to 31 bytes */
 | 
			
		||||
        movs        r12, r2, lsl #28
 | 
			
		||||
        ldmcsia     r1!, {r4, r5, r6, r7}   /* 16 bytes */
 | 
			
		||||
        ldmmiia     r1!, {r8, r9}           /*  8 bytes */
 | 
			
		||||
        stmcsia     r0!, {r4, r5, r6, r7}
 | 
			
		||||
        stmmiia     r0!, {r8, r9}
 | 
			
		||||
        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]
 | 
			
		||||
 | 
			
		||||
        /* we're done! restore everything and return */
 | 
			
		||||
1:      ldmfd       sp!, {r5-r11}
 | 
			
		||||
        ldmfd       sp!, {r0, r4, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
 | 
			
		||||
        /********************************************************************/
 | 
			
		||||
 | 
			
		||||
non_congruent:
 | 
			
		||||
        /*
 | 
			
		||||
         * here source is aligned to 4 bytes
 | 
			
		||||
         * but destination is not.
 | 
			
		||||
         *
 | 
			
		||||
         * in the code below r2 is the number of bytes read
 | 
			
		||||
         * (the number of bytes written is always smaller, because we have
 | 
			
		||||
         * partial words in the shift queue)
 | 
			
		||||
         */
 | 
			
		||||
        cmp         r2, #4
 | 
			
		||||
        blo         copy_last_3_and_return
 | 
			
		||||
 | 
			
		||||
        /* Use post-incriment mode for stm to spill r5-r11 to reserved stack
 | 
			
		||||
         * frame. Don't update sp.
 | 
			
		||||
         */
 | 
			
		||||
        stmea       sp, {r5-r11}
 | 
			
		||||
 | 
			
		||||
        /* compute shifts needed to align src to dest */
 | 
			
		||||
        rsb         r5, r0, #0
 | 
			
		||||
        and         r5, r5, #3          /* r5 = # bytes in partial words */
 | 
			
		||||
        mov         r12, r5, lsl #3     /* r12 = right */
 | 
			
		||||
        rsb         lr, r12, #32        /* lr = left  */
 | 
			
		||||
 | 
			
		||||
        /* read the first word */
 | 
			
		||||
        ldr         r3, [r1], #4
 | 
			
		||||
        sub         r2, r2, #4
 | 
			
		||||
 | 
			
		||||
        /* write a partial word (0 to 3 bytes), such that destination
 | 
			
		||||
         * becomes aligned to 32 bits (r5 = nb of words to copy for alignment)
 | 
			
		||||
         */
 | 
			
		||||
        movs        r5, r5, lsl #31
 | 
			
		||||
        strmib      r3, [r0], #1
 | 
			
		||||
        movmi       r3, r3, lsr #8
 | 
			
		||||
        strcsb      r3, [r0], #1
 | 
			
		||||
        movcs       r3, r3, lsr #8
 | 
			
		||||
        strcsb      r3, [r0], #1
 | 
			
		||||
        movcs       r3, r3, lsr #8
 | 
			
		||||
 | 
			
		||||
        cmp         r2, #4
 | 
			
		||||
        blo         partial_word_tail
 | 
			
		||||
 | 
			
		||||
        /* Align destination to 32 bytes (cache line boundary) */
 | 
			
		||||
1:      tst         r0, #0x1c
 | 
			
		||||
        beq         2f
 | 
			
		||||
        ldr         r5, [r1], #4
 | 
			
		||||
        sub         r2, r2, #4
 | 
			
		||||
        orr         r4, r3, r5,     lsl lr
 | 
			
		||||
        mov         r3, r5,         lsr r12
 | 
			
		||||
        str         r4, [r0], #4
 | 
			
		||||
        cmp         r2, #4
 | 
			
		||||
        bhs         1b
 | 
			
		||||
        blo         partial_word_tail
 | 
			
		||||
 | 
			
		||||
        /* copy 32 bytes at a time */
 | 
			
		||||
2:      subs        r2, r2, #32
 | 
			
		||||
        blo         less_than_thirtytwo
 | 
			
		||||
 | 
			
		||||
        /* Use immediate mode for the shifts, because there is an extra cycle
 | 
			
		||||
         * for register shifts, which could account for up to 50% of
 | 
			
		||||
         * performance hit.
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
        cmp         r12, #24
 | 
			
		||||
        beq         loop24
 | 
			
		||||
        cmp         r12, #8
 | 
			
		||||
        beq         loop8
 | 
			
		||||
 | 
			
		||||
loop16:
 | 
			
		||||
        ldr         r12, [r1], #4
 | 
			
		||||
1:      mov         r4, r12
 | 
			
		||||
        ldmia       r1!, {   r5,r6,r7,  r8,r9,r10,r11}
 | 
			
		||||
        PLD         (r1, #64)
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        ldrhs       r12, [r1], #4
 | 
			
		||||
        orr         r3, r3, r4,     lsl #16
 | 
			
		||||
        mov         r4, r4,         lsr #16
 | 
			
		||||
        orr         r4, r4, r5,     lsl #16
 | 
			
		||||
        mov         r5, r5,         lsr #16
 | 
			
		||||
        orr         r5, r5, r6,     lsl #16
 | 
			
		||||
        mov         r6, r6,         lsr #16
 | 
			
		||||
        orr         r6, r6, r7,     lsl #16
 | 
			
		||||
        mov         r7, r7,         lsr #16
 | 
			
		||||
        orr         r7, r7, r8,     lsl #16
 | 
			
		||||
        mov         r8, r8,         lsr #16
 | 
			
		||||
        orr         r8, r8, r9,     lsl #16
 | 
			
		||||
        mov         r9, r9,         lsr #16
 | 
			
		||||
        orr         r9, r9, r10,    lsl #16
 | 
			
		||||
        mov         r10, r10,       lsr #16
 | 
			
		||||
        orr         r10, r10, r11,  lsl #16
 | 
			
		||||
        stmia       r0!, {r3,r4,r5,r6, r7,r8,r9,r10}
 | 
			
		||||
        mov         r3, r11,        lsr #16
 | 
			
		||||
        bhs         1b
 | 
			
		||||
        b           less_than_thirtytwo
 | 
			
		||||
 | 
			
		||||
loop8:
 | 
			
		||||
        ldr         r12, [r1], #4
 | 
			
		||||
1:      mov         r4, r12
 | 
			
		||||
        ldmia       r1!, {   r5,r6,r7,  r8,r9,r10,r11}
 | 
			
		||||
        PLD         (r1, #64)
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        ldrhs       r12, [r1], #4
 | 
			
		||||
        orr         r3, r3, r4,     lsl #24
 | 
			
		||||
        mov         r4, r4,         lsr #8
 | 
			
		||||
        orr         r4, r4, r5,     lsl #24
 | 
			
		||||
        mov         r5, r5,         lsr #8
 | 
			
		||||
        orr         r5, r5, r6,     lsl #24
 | 
			
		||||
        mov         r6, r6,         lsr #8
 | 
			
		||||
        orr         r6, r6, r7,     lsl #24
 | 
			
		||||
        mov         r7, r7,         lsr #8
 | 
			
		||||
        orr         r7, r7, r8,     lsl #24
 | 
			
		||||
        mov         r8, r8,         lsr #8
 | 
			
		||||
        orr         r8, r8, r9,     lsl #24
 | 
			
		||||
        mov         r9, r9,         lsr #8
 | 
			
		||||
        orr         r9, r9, r10,    lsl #24
 | 
			
		||||
        mov         r10, r10,       lsr #8
 | 
			
		||||
        orr         r10, r10, r11,  lsl #24
 | 
			
		||||
        stmia       r0!, {r3,r4,r5,r6, r7,r8,r9,r10}
 | 
			
		||||
        mov         r3, r11,        lsr #8
 | 
			
		||||
        bhs         1b
 | 
			
		||||
        b           less_than_thirtytwo
 | 
			
		||||
 | 
			
		||||
loop24:
 | 
			
		||||
        ldr         r12, [r1], #4
 | 
			
		||||
1:      mov         r4, r12
 | 
			
		||||
        ldmia       r1!, {   r5,r6,r7,  r8,r9,r10,r11}
 | 
			
		||||
        PLD         (r1, #64)
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        ldrhs       r12, [r1], #4
 | 
			
		||||
        orr         r3, r3, r4,     lsl #8
 | 
			
		||||
        mov         r4, r4,         lsr #24
 | 
			
		||||
        orr         r4, r4, r5,     lsl #8
 | 
			
		||||
        mov         r5, r5,         lsr #24
 | 
			
		||||
        orr         r5, r5, r6,     lsl #8
 | 
			
		||||
        mov         r6, r6,         lsr #24
 | 
			
		||||
        orr         r6, r6, r7,     lsl #8
 | 
			
		||||
        mov         r7, r7,         lsr #24
 | 
			
		||||
        orr         r7, r7, r8,     lsl #8
 | 
			
		||||
        mov         r8, r8,         lsr #24
 | 
			
		||||
        orr         r8, r8, r9,     lsl #8
 | 
			
		||||
        mov         r9, r9,         lsr #24
 | 
			
		||||
        orr         r9, r9, r10,    lsl #8
 | 
			
		||||
        mov         r10, r10,       lsr #24
 | 
			
		||||
        orr         r10, r10, r11,  lsl #8
 | 
			
		||||
        stmia       r0!, {r3,r4,r5,r6, r7,r8,r9,r10}
 | 
			
		||||
        mov         r3, r11,        lsr #24
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
less_than_thirtytwo:
 | 
			
		||||
        /* copy the last 0 to 31 bytes of the source */
 | 
			
		||||
        rsb         r12, lr, #32        /* we corrupted r12, recompute it  */
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
        cmp         r2, #4
 | 
			
		||||
        blo         partial_word_tail
 | 
			
		||||
 | 
			
		||||
1:      ldr         r5, [r1], #4
 | 
			
		||||
        sub         r2, r2, #4
 | 
			
		||||
        orr         r4, r3, r5,     lsl lr
 | 
			
		||||
        mov         r3, r5,         lsr r12
 | 
			
		||||
        str         r4, [r0], #4
 | 
			
		||||
        cmp         r2, #4
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
partial_word_tail:
 | 
			
		||||
        /* we have a partial word in the input buffer */
 | 
			
		||||
        movs        r5, lr, lsl #(31-3)
 | 
			
		||||
        strmib      r3, [r0], #1
 | 
			
		||||
        movmi       r3, r3, lsr #8
 | 
			
		||||
        strcsb      r3, [r0], #1
 | 
			
		||||
        movcs       r3, r3, lsr #8
 | 
			
		||||
        strcsb      r3, [r0], #1
 | 
			
		||||
 | 
			
		||||
        /* Refill spilled registers from the stack. Don't update sp. */
 | 
			
		||||
        ldmfd       sp, {r5-r11}
 | 
			
		||||
 | 
			
		||||
copy_last_3_and_return:
 | 
			
		||||
        movs        r2, r2, lsl #31 /* copy remaining 0, 1, 2 or 3 bytes */
 | 
			
		||||
        ldrmib      r2, [r1], #1
 | 
			
		||||
        ldrcsb      r3, [r1], #1
 | 
			
		||||
        ldrcsb      r12,[r1]
 | 
			
		||||
        strmib      r2, [r0], #1
 | 
			
		||||
        strcsb      r3, [r0], #1
 | 
			
		||||
        strcsb      r12,[r0]
 | 
			
		||||
 | 
			
		||||
        /* we're done! restore sp and spilled registers and return */
 | 
			
		||||
        add         sp,  sp, #28
 | 
			
		||||
        ldmfd       sp!, {r0, r4, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
END(memcpy)
 | 
			
		||||
							
								
								
									
										109
									
								
								libc/arch-arm/generic/bionic/memset.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								libc/arch-arm/generic/bionic/memset.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,109 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *  * Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 *  * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 | 
			
		||||
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 | 
			
		||||
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 | 
			
		||||
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 | 
			
		||||
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 | 
			
		||||
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Optimized memset() for ARM.
 | 
			
		||||
         *
 | 
			
		||||
         * memset() returns its first argument.
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
ENTRY(bzero)
 | 
			
		||||
        mov     r2, r1
 | 
			
		||||
        mov     r1, #0
 | 
			
		||||
END(bzero)
 | 
			
		||||
 | 
			
		||||
ENTRY(memset)
 | 
			
		||||
        /* 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}
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #3
 | 
			
		||||
        cmp         r3, r2
 | 
			
		||||
        movhi       r3, r2
 | 
			
		||||
 | 
			
		||||
        /* splat r1 */
 | 
			
		||||
        mov         r1, r1, lsl #24
 | 
			
		||||
        orr         r1, r1, r1, lsr #8
 | 
			
		||||
        orr         r1, r1, r1, lsr #16
 | 
			
		||||
 | 
			
		||||
        movs        r12, r3, lsl #31
 | 
			
		||||
        strcsb      r1, [r0], #1    /* can't use strh (alignment unknown) */
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        strmib      r1, [r0], #1
 | 
			
		||||
        subs        r2, r2, r3
 | 
			
		||||
        ldmlsfd     sp!, {r0, r4-r7, lr}    /* return */
 | 
			
		||||
        bxls        lr
 | 
			
		||||
 | 
			
		||||
        /* align the destination to a cache-line */
 | 
			
		||||
        mov         r12, r1
 | 
			
		||||
        mov         lr, r1
 | 
			
		||||
        mov         r4, r1
 | 
			
		||||
        mov         r5, r1
 | 
			
		||||
        mov         r6, r1
 | 
			
		||||
        mov         r7, r1
 | 
			
		||||
 | 
			
		||||
        rsb         r3, r0, #0
 | 
			
		||||
        ands        r3, r3, #0x1C
 | 
			
		||||
        beq         3f
 | 
			
		||||
        cmp         r3, r2
 | 
			
		||||
        andhi       r3, r2, #0x1C
 | 
			
		||||
        sub         r2, r2, r3
 | 
			
		||||
 | 
			
		||||
        /* conditionally writes 0 to 7 words (length in r3) */
 | 
			
		||||
        movs        r3, r3, lsl #28
 | 
			
		||||
        stmcsia     r0!, {r1, lr}
 | 
			
		||||
        stmcsia     r0!, {r1, lr}
 | 
			
		||||
        stmmiia     r0!, {r1, lr}
 | 
			
		||||
        movs        r3, r3, lsl #2
 | 
			
		||||
        strcs       r1, [r0], #4
 | 
			
		||||
 | 
			
		||||
3:
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        mov         r3, r1
 | 
			
		||||
        bmi         2f
 | 
			
		||||
1:      subs        r2, r2, #32
 | 
			
		||||
        stmia       r0!, {r1,r3,r4,r5,r6,r7,r12,lr}
 | 
			
		||||
        bhs         1b
 | 
			
		||||
2:      add         r2, r2, #32
 | 
			
		||||
 | 
			
		||||
        /* conditionally stores 0 to 31 bytes */
 | 
			
		||||
        movs        r2, r2, lsl #28
 | 
			
		||||
        stmcsia     r0!, {r1,r3,r12,lr}
 | 
			
		||||
        stmmiia     r0!, {r1, lr}
 | 
			
		||||
        movs        r2, r2, lsl #2
 | 
			
		||||
        strcs       r1, [r0], #4
 | 
			
		||||
        strmih      r1, [r0], #2
 | 
			
		||||
        movs        r2, r2, lsl #2
 | 
			
		||||
        strcsb      r1, [r0]
 | 
			
		||||
        ldmfd       sp!, {r0, r4-r7, lr}
 | 
			
		||||
        bx          lr
 | 
			
		||||
END(memset)
 | 
			
		||||
							
								
								
									
										317
									
								
								libc/arch-arm/generic/bionic/strcmp.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										317
									
								
								libc/arch-arm/generic/bionic/strcmp.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,317 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2011 The Android Open Source Project
 | 
			
		||||
 * Copyright (c) 2008 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/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
	.text
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
#define SHFT2LSB lsl
 | 
			
		||||
#define SHFT2LSBEQ lsleq
 | 
			
		||||
#define SHFT2MSB lsr
 | 
			
		||||
#define SHFT2MSBEQ lsreq
 | 
			
		||||
#define MSB 0x000000ff
 | 
			
		||||
#define LSB 0xff000000
 | 
			
		||||
#else
 | 
			
		||||
#define SHFT2LSB lsr
 | 
			
		||||
#define SHFT2LSBEQ lsreq
 | 
			
		||||
#define SHFT2MSB lsl
 | 
			
		||||
#define SHFT2MSBEQ lsleq
 | 
			
		||||
#define MSB 0xff000000
 | 
			
		||||
#define LSB 0x000000ff
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define magic1(REG) REG
 | 
			
		||||
#define magic2(REG) REG, lsl #7
 | 
			
		||||
 | 
			
		||||
ENTRY(strcmp)
 | 
			
		||||
	PLD(r0, #0)
 | 
			
		||||
	PLD(r1, #0)
 | 
			
		||||
	eor	r2, r0, r1
 | 
			
		||||
	tst	r2, #3
 | 
			
		||||
 | 
			
		||||
	/* Strings not at same byte offset from a word boundary.  */
 | 
			
		||||
	bne	.Lstrcmp_unaligned
 | 
			
		||||
	ands	r2, r0, #3
 | 
			
		||||
	bic	r0, r0, #3
 | 
			
		||||
	bic	r1, r1, #3
 | 
			
		||||
	ldr	ip, [r0], #4
 | 
			
		||||
	it	eq
 | 
			
		||||
	ldreq	r3, [r1], #4
 | 
			
		||||
	beq	1f
 | 
			
		||||
 | 
			
		||||
	/* Although s1 and s2 have identical initial alignment, they are
 | 
			
		||||
	 * not currently word aligned.  Rather than comparing bytes,
 | 
			
		||||
	 * make sure that any bytes fetched from before the addressed
 | 
			
		||||
	 * bytes are forced to 0xff.  Then they will always compare
 | 
			
		||||
	 * equal.
 | 
			
		||||
	 */
 | 
			
		||||
	eor	r2, r2, #3
 | 
			
		||||
	lsl	r2, r2, #3
 | 
			
		||||
	mvn	r3, #MSB
 | 
			
		||||
	SHFT2LSB	r2, r3, r2
 | 
			
		||||
	ldr	r3, [r1], #4
 | 
			
		||||
	orr	ip, ip, r2
 | 
			
		||||
	orr	r3, r3, r2
 | 
			
		||||
1:
 | 
			
		||||
	/* Load the 'magic' constant 0x01010101. */
 | 
			
		||||
	str	r4, [sp, #-4]!
 | 
			
		||||
	mov	r4, #1
 | 
			
		||||
	orr	r4, r4, r4, lsl #8
 | 
			
		||||
	orr	r4, r4, r4, lsl #16
 | 
			
		||||
	.p2align	2
 | 
			
		||||
4:
 | 
			
		||||
	PLD(r0, #8)
 | 
			
		||||
	PLD(r1, #8)
 | 
			
		||||
	sub	r2, ip, magic1(r4)
 | 
			
		||||
	cmp	ip, r3
 | 
			
		||||
	itttt	eq
 | 
			
		||||
 | 
			
		||||
	/* check for any zero bytes in first word */
 | 
			
		||||
	biceq	r2, r2, ip
 | 
			
		||||
	tsteq	r2, magic2(r4)
 | 
			
		||||
	ldreq	ip, [r0], #4
 | 
			
		||||
	ldreq	r3, [r1], #4
 | 
			
		||||
	beq	4b
 | 
			
		||||
2:
 | 
			
		||||
	/* There's a zero or a different byte in the word */
 | 
			
		||||
	SHFT2MSB	r0, ip, #24
 | 
			
		||||
	SHFT2LSB	ip, ip, #8
 | 
			
		||||
	cmp	r0, #1
 | 
			
		||||
	it	cs
 | 
			
		||||
	cmpcs	r0, r3, SHFT2MSB #24
 | 
			
		||||
	it	eq
 | 
			
		||||
	SHFT2LSBEQ r3, r3, #8
 | 
			
		||||
	beq	2b
 | 
			
		||||
	/* On a big-endian machine, r0 contains the desired byte in bits
 | 
			
		||||
	 * 0-7; on a little-endian machine they are in bits 24-31.  In
 | 
			
		||||
	 * both cases the other bits in r0 are all zero.  For r3 the
 | 
			
		||||
	 * interesting byte is at the other end of the word, but the
 | 
			
		||||
	 * other bits are not necessarily zero.  We need a signed result
 | 
			
		||||
	 * representing the differnece in the unsigned bytes, so for the
 | 
			
		||||
	 * little-endian case we can't just shift the interesting bits up.
 | 
			
		||||
	 */
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
	sub	r0, r0, r3, lsr #24
 | 
			
		||||
#else
 | 
			
		||||
	and	r3, r3, #255
 | 
			
		||||
	/* No RSB instruction in Thumb2 */
 | 
			
		||||
#ifdef __thumb2__
 | 
			
		||||
	lsr	r0, r0, #24
 | 
			
		||||
	sub	r0, r0, r3
 | 
			
		||||
#else
 | 
			
		||||
	rsb	r0, r3, r0, lsr #24
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
	ldr	r4, [sp], #4
 | 
			
		||||
	bx	lr
 | 
			
		||||
 | 
			
		||||
.Lstrcmp_unaligned:
 | 
			
		||||
	wp1 .req r0
 | 
			
		||||
	wp2 .req r1
 | 
			
		||||
	b1  .req r2
 | 
			
		||||
	w1  .req r4
 | 
			
		||||
	w2  .req r5
 | 
			
		||||
	t1  .req ip
 | 
			
		||||
	@ r3 is scratch
 | 
			
		||||
 | 
			
		||||
	/* First of all, compare bytes until wp1(sp1) is word-aligned. */
 | 
			
		||||
1:
 | 
			
		||||
	tst	wp1, #3
 | 
			
		||||
	beq	2f
 | 
			
		||||
	ldrb	r2, [wp1], #1
 | 
			
		||||
	ldrb	r3, [wp2], #1
 | 
			
		||||
	cmp	r2, #1
 | 
			
		||||
	it	cs
 | 
			
		||||
	cmpcs	r2, r3
 | 
			
		||||
	beq	1b
 | 
			
		||||
	sub	r0, r2, r3
 | 
			
		||||
	bx	lr
 | 
			
		||||
 | 
			
		||||
2:
 | 
			
		||||
	str	r5, [sp, #-4]!
 | 
			
		||||
	str	r4, [sp, #-4]!
 | 
			
		||||
	mov	b1, #1
 | 
			
		||||
	orr	b1, b1, b1, lsl #8
 | 
			
		||||
	orr	b1, b1, b1, lsl #16
 | 
			
		||||
 | 
			
		||||
	and	t1, wp2, #3
 | 
			
		||||
	bic	wp2, wp2, #3
 | 
			
		||||
	ldr	w1, [wp1], #4
 | 
			
		||||
	ldr	w2, [wp2], #4
 | 
			
		||||
	cmp	t1, #2
 | 
			
		||||
	beq	2f
 | 
			
		||||
	bhi	3f
 | 
			
		||||
 | 
			
		||||
	/* Critical inner Loop: Block with 3 bytes initial overlap */
 | 
			
		||||
	.p2align	2
 | 
			
		||||
1:
 | 
			
		||||
	bic	t1, w1, #MSB
 | 
			
		||||
	cmp	t1, w2, SHFT2LSB #8
 | 
			
		||||
	sub	r3, w1, b1
 | 
			
		||||
	bic	r3, r3, w1
 | 
			
		||||
	bne	4f
 | 
			
		||||
	ands	r3, r3, b1, lsl #7
 | 
			
		||||
	it	eq
 | 
			
		||||
	ldreq	w2, [wp2], #4
 | 
			
		||||
	bne	5f
 | 
			
		||||
	eor	t1, t1, w1
 | 
			
		||||
	cmp	t1, w2, SHFT2MSB #24
 | 
			
		||||
	bne	6f
 | 
			
		||||
	ldr	w1, [wp1], #4
 | 
			
		||||
	b	1b
 | 
			
		||||
4:
 | 
			
		||||
	SHFT2LSB	w2, w2, #8
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
5:
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
	/* The syndrome value may contain false ones if the string ends
 | 
			
		||||
	 * with the bytes 0x01 0x00
 | 
			
		||||
	 */
 | 
			
		||||
	tst	w1, #0xff000000
 | 
			
		||||
	itt	ne
 | 
			
		||||
	tstne	w1, #0x00ff0000
 | 
			
		||||
	tstne	w1, #0x0000ff00
 | 
			
		||||
	beq	7f
 | 
			
		||||
#else
 | 
			
		||||
	bics	r3, r3, #0xff000000
 | 
			
		||||
	bne	7f
 | 
			
		||||
#endif
 | 
			
		||||
	ldrb	w2, [wp2]
 | 
			
		||||
	SHFT2LSB	t1, w1, #24
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
	lsl	w2, w2, #24
 | 
			
		||||
#endif
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
6:
 | 
			
		||||
	SHFT2LSB	t1, w1, #24
 | 
			
		||||
	and	w2, w2, #LSB
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
	/* Critical inner Loop: Block with 2 bytes initial overlap */
 | 
			
		||||
	.p2align	2
 | 
			
		||||
2:
 | 
			
		||||
	SHFT2MSB	t1, w1, #16
 | 
			
		||||
	sub	r3, w1, b1
 | 
			
		||||
	SHFT2LSB	t1, t1, #16
 | 
			
		||||
	bic	r3, r3, w1
 | 
			
		||||
	cmp	t1, w2, SHFT2LSB #16
 | 
			
		||||
	bne	4f
 | 
			
		||||
	ands	r3, r3, b1, lsl #7
 | 
			
		||||
	it	eq
 | 
			
		||||
	ldreq	w2, [wp2], #4
 | 
			
		||||
	bne	5f
 | 
			
		||||
	eor	t1, t1, w1
 | 
			
		||||
	cmp	t1, w2, SHFT2MSB #16
 | 
			
		||||
	bne	6f
 | 
			
		||||
	ldr	w1, [wp1], #4
 | 
			
		||||
	b	2b
 | 
			
		||||
 | 
			
		||||
5:
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
	/* The syndrome value may contain false ones if the string ends
 | 
			
		||||
	 * with the bytes 0x01 0x00
 | 
			
		||||
	 */
 | 
			
		||||
	tst	w1, #0xff000000
 | 
			
		||||
	it	ne
 | 
			
		||||
	tstne	w1, #0x00ff0000
 | 
			
		||||
	beq	7f
 | 
			
		||||
#else
 | 
			
		||||
	lsls	r3, r3, #16
 | 
			
		||||
	bne	7f
 | 
			
		||||
#endif
 | 
			
		||||
	ldrh	w2, [wp2]
 | 
			
		||||
	SHFT2LSB	t1, w1, #16
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
	lsl	w2, w2, #16
 | 
			
		||||
#endif
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
6:
 | 
			
		||||
	SHFT2MSB	w2, w2, #16
 | 
			
		||||
	SHFT2LSB	t1, w1, #16
 | 
			
		||||
4:
 | 
			
		||||
	SHFT2LSB	w2, w2, #16
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
	/* Critical inner Loop: Block with 1 byte initial overlap */
 | 
			
		||||
	.p2align	2
 | 
			
		||||
3:
 | 
			
		||||
	and	t1, w1, #LSB
 | 
			
		||||
	cmp	t1, w2, SHFT2LSB #24
 | 
			
		||||
	sub	r3, w1, b1
 | 
			
		||||
	bic	r3, r3, w1
 | 
			
		||||
	bne	4f
 | 
			
		||||
	ands	r3, r3, b1, lsl #7
 | 
			
		||||
	it	eq
 | 
			
		||||
	ldreq	w2, [wp2], #4
 | 
			
		||||
	bne	5f
 | 
			
		||||
	eor	t1, t1, w1
 | 
			
		||||
	cmp	t1, w2, SHFT2MSB #8
 | 
			
		||||
	bne	6f
 | 
			
		||||
	ldr	w1, [wp1], #4
 | 
			
		||||
	b	3b
 | 
			
		||||
4:
 | 
			
		||||
	SHFT2LSB	w2, w2, #24
 | 
			
		||||
	b	8f
 | 
			
		||||
5:
 | 
			
		||||
	/* The syndrome value may contain false ones if the string ends
 | 
			
		||||
	 * with the bytes 0x01 0x00
 | 
			
		||||
	 */
 | 
			
		||||
	tst	w1, #LSB
 | 
			
		||||
	beq	7f
 | 
			
		||||
	ldr	w2, [wp2], #4
 | 
			
		||||
6:
 | 
			
		||||
	SHFT2LSB	t1, w1, #8
 | 
			
		||||
	bic	w2, w2, #MSB
 | 
			
		||||
	b	8f
 | 
			
		||||
7:
 | 
			
		||||
	mov	r0, #0
 | 
			
		||||
	ldr	r4, [sp], #4
 | 
			
		||||
	ldr	r5, [sp], #4
 | 
			
		||||
	bx	lr
 | 
			
		||||
 | 
			
		||||
8:
 | 
			
		||||
	and	r2, t1, #LSB
 | 
			
		||||
	and	r0, w2, #LSB
 | 
			
		||||
	cmp	r0, #1
 | 
			
		||||
	it	cs
 | 
			
		||||
	cmpcs	r0, r2
 | 
			
		||||
	itt	eq
 | 
			
		||||
	SHFT2LSBEQ	t1, t1, #8
 | 
			
		||||
	SHFT2LSBEQ	w2, w2, #8
 | 
			
		||||
	beq	8b
 | 
			
		||||
	sub	r0, r2, r0
 | 
			
		||||
	ldr	r4, [sp], #4
 | 
			
		||||
	ldr	r5, [sp], #4
 | 
			
		||||
	bx	lr
 | 
			
		||||
END(strcmp)
 | 
			
		||||
@@ -33,16 +33,16 @@ size_t strlen(const char *s)
 | 
			
		||||
{
 | 
			
		||||
    __builtin_prefetch(s);
 | 
			
		||||
    __builtin_prefetch(s+32);
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    union {
 | 
			
		||||
        const char      *b;
 | 
			
		||||
        const uint32_t  *w;
 | 
			
		||||
        uintptr_t       i;
 | 
			
		||||
    } u;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    // these are some scratch variables for the asm code below
 | 
			
		||||
    uint32_t v, t;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    // initialize the string length to zero
 | 
			
		||||
    size_t l = 0;
 | 
			
		||||
 | 
			
		||||
@@ -60,52 +60,60 @@ size_t strlen(const char *s)
 | 
			
		||||
    // We need to process 32 bytes per loop to schedule PLD properly
 | 
			
		||||
    // and achieve the maximum bus speed.
 | 
			
		||||
    asm(
 | 
			
		||||
        "ldr     %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "ldr     %[v], [%[s]], #4           \n"
 | 
			
		||||
        "sub     %[l], %[l], %[s]           \n"
 | 
			
		||||
        "0:                                 \n"
 | 
			
		||||
#if __ARM_HAVE_PLD
 | 
			
		||||
        "pld     [ %[s], #64 ]              \n"
 | 
			
		||||
        "pld     [%[s], #64]                \n"
 | 
			
		||||
#endif
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "it      eq                         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
#if !defined(__OPTIMIZE_SIZE__)
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "it      eq                         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "it      eq                         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "it      eq                         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "it      eq                         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "it      eq                         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "it      eq                         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
        "bne     1f                         \n"
 | 
			
		||||
        "sub     %[t], %[v], %[mask], lsr #7\n"
 | 
			
		||||
        "and     %[t], %[t], %[mask]        \n"
 | 
			
		||||
        "bics    %[t], %[t], %[v]           \n"
 | 
			
		||||
        "ldreq   %[v], [ %[s] ], #4         \n"
 | 
			
		||||
        "it      eq                         \n"
 | 
			
		||||
        "ldreq   %[v], [%[s]], #4           \n"
 | 
			
		||||
#endif
 | 
			
		||||
        "beq     0b                         \n"
 | 
			
		||||
        "1:                                 \n"
 | 
			
		||||
@@ -117,13 +125,14 @@ size_t strlen(const char *s)
 | 
			
		||||
        "beq     2f                         \n"
 | 
			
		||||
        "add     %[l], %[l], #1             \n"
 | 
			
		||||
        "tst     %[v], #0xFF0000            \n"
 | 
			
		||||
        "it      ne                         \n"
 | 
			
		||||
        "addne   %[l], %[l], #1             \n"
 | 
			
		||||
        "2:                                 \n"
 | 
			
		||||
        : [l]"=&r"(l), [v]"=&r"(v), [t]"=&r"(t), [s]"=&r"(u.b)
 | 
			
		||||
        : "%[l]"(l), "%[s]"(u.b), [mask]"r"(0x80808080UL)
 | 
			
		||||
        : "cc"
 | 
			
		||||
    );
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
done:
 | 
			
		||||
    return l;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								libc/arch-arm/generic/generic.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								libc/arch-arm/generic/generic.mk
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
$(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,STRCMP,arch-arm/generic/bionic/strcmp.S)
 | 
			
		||||
$(call libc-add-cpu-variant-src,STRLEN,arch-arm/generic/bionic/strlen.c)
 | 
			
		||||
							
								
								
									
										146
									
								
								libc/arch-arm/krait/bionic/memcpy.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										146
									
								
								libc/arch-arm/krait/bionic/memcpy.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,146 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* Assumes neon instructions and a cache line size of 32 bytes. */
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
        .text
 | 
			
		||||
        .fpu    neon
 | 
			
		||||
 | 
			
		||||
#define CACHE_LINE_SIZE     32
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
END(memcpy)
 | 
			
		||||
							
								
								
									
										81
									
								
								libc/arch-arm/krait/bionic/memset.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								libc/arch-arm/krait/bionic/memset.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,81 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *  * Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 *  * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 | 
			
		||||
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 | 
			
		||||
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 | 
			
		||||
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 | 
			
		||||
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 | 
			
		||||
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This code assumes it is running on a processor that supports all arm v7
 | 
			
		||||
 * instructions, that supports neon instructions, and that supports
 | 
			
		||||
 * unaligned neon instruction accesses to memory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
    .fpu    neon
 | 
			
		||||
 | 
			
		||||
ENTRY(bzero)
 | 
			
		||||
        mov     r2, r1
 | 
			
		||||
        mov     r1, #0
 | 
			
		||||
END(bzero)
 | 
			
		||||
 | 
			
		||||
/* memset() returns its first argument.  */
 | 
			
		||||
ENTRY(memset)
 | 
			
		||||
        .save       {r0}
 | 
			
		||||
        stmfd       sp!, {r0}
 | 
			
		||||
 | 
			
		||||
        vdup.8      q0, r1
 | 
			
		||||
 | 
			
		||||
        /* make sure we have at least 32 bytes to write */
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        blo         2f
 | 
			
		||||
        vmov        q1, q0
 | 
			
		||||
 | 
			
		||||
1:      /* The main loop writes 32 bytes at a time */
 | 
			
		||||
        subs        r2, r2, #32
 | 
			
		||||
        vst1.8      {d0 - d3}, [r0]!
 | 
			
		||||
        bhs         1b
 | 
			
		||||
 | 
			
		||||
2:      /* less than 32 left */
 | 
			
		||||
        add         r2, r2, #32
 | 
			
		||||
        tst         r2, #0x10
 | 
			
		||||
        beq         3f
 | 
			
		||||
 | 
			
		||||
        // writes 16 bytes, 128-bits aligned
 | 
			
		||||
        vst1.8      {d0, d1}, [r0]!
 | 
			
		||||
3:      /* write up to 15-bytes (count in r2) */
 | 
			
		||||
        movs        ip, r2, lsl #29
 | 
			
		||||
        bcc         1f
 | 
			
		||||
        vst1.8      {d0}, [r0]!
 | 
			
		||||
1:      bge         2f
 | 
			
		||||
        vst1.32     {d0[0]}, [r0]!
 | 
			
		||||
2:      movs        ip, r2, lsl #31
 | 
			
		||||
        strmib      r1, [r0], #1
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        strcsb      r1, [r0], #1
 | 
			
		||||
        ldmfd       sp!, {r0}
 | 
			
		||||
        bx          lr
 | 
			
		||||
END(memset)
 | 
			
		||||
							
								
								
									
										477
									
								
								libc/arch-arm/krait/bionic/strcmp.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										477
									
								
								libc/arch-arm/krait/bionic/strcmp.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,477 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
#define S2LOMEM lsl
 | 
			
		||||
#define S2LOMEMEQ lsleq
 | 
			
		||||
#define S2HIMEM lsr
 | 
			
		||||
#define MSB 0x000000ff
 | 
			
		||||
#define LSB 0xff000000
 | 
			
		||||
#define BYTE0_OFFSET 24
 | 
			
		||||
#define BYTE1_OFFSET 16
 | 
			
		||||
#define BYTE2_OFFSET 8
 | 
			
		||||
#define BYTE3_OFFSET 0
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
#define S2LOMEM lsr
 | 
			
		||||
#define S2LOMEMEQ lsreq
 | 
			
		||||
#define S2HIMEM lsl
 | 
			
		||||
#define BYTE0_OFFSET 0
 | 
			
		||||
#define BYTE1_OFFSET 8
 | 
			
		||||
#define BYTE2_OFFSET 16
 | 
			
		||||
#define BYTE3_OFFSET 24
 | 
			
		||||
#define MSB 0xff000000
 | 
			
		||||
#define LSB 0x000000ff
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
 | 
			
		||||
.syntax         unified
 | 
			
		||||
 | 
			
		||||
#if defined (__thumb__)
 | 
			
		||||
        .thumb
 | 
			
		||||
        .thumb_func
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ENTRY(strcmp)
 | 
			
		||||
      /* Use LDRD whenever possible.  */
 | 
			
		||||
 | 
			
		||||
/* The main thing to look out for when comparing large blocks is that
 | 
			
		||||
   the loads do not cross a page boundary when loading past the index
 | 
			
		||||
   of the byte with the first difference or the first string-terminator.
 | 
			
		||||
 | 
			
		||||
   For example, if the strings are identical and the string-terminator
 | 
			
		||||
   is at index k, byte by byte comparison will not load beyond address
 | 
			
		||||
   s1+k and s2+k; word by word comparison may load up to 3 bytes beyond
 | 
			
		||||
   k; double word - up to 7 bytes.  If the load of these bytes crosses
 | 
			
		||||
   a page boundary, it might cause a memory fault (if the page is not mapped)
 | 
			
		||||
   that would not have happened in byte by byte comparison.
 | 
			
		||||
 | 
			
		||||
   If an address is (double) word aligned, then a load of a (double) word
 | 
			
		||||
   from that address will not cross a page boundary.
 | 
			
		||||
   Therefore, the algorithm below considers word and double-word alignment
 | 
			
		||||
   of strings separately.  */
 | 
			
		||||
 | 
			
		||||
/* High-level description of the algorithm.
 | 
			
		||||
 | 
			
		||||
   * The fast path: if both strings are double-word aligned,
 | 
			
		||||
     use LDRD to load two words from each string in every loop iteration.
 | 
			
		||||
   * If the strings have the same offset from a word boundary,
 | 
			
		||||
     use LDRB to load and compare byte by byte until
 | 
			
		||||
     the first string is aligned to a word boundary (at most 3 bytes).
 | 
			
		||||
     This is optimized for quick return on short unaligned strings.
 | 
			
		||||
   * If the strings have the same offset from a double-word boundary,
 | 
			
		||||
     use LDRD to load two words from each string in every loop iteration, as in the fast path.
 | 
			
		||||
   * If the strings do not have the same offset from a double-word boundary,
 | 
			
		||||
     load a word from the second string before the loop to initialize the queue.
 | 
			
		||||
     Use LDRD to load two words from every string in every loop iteration.
 | 
			
		||||
     Inside the loop, load the second word from the second string only after comparing
 | 
			
		||||
     the first word, using the queued value, to guarantee safety across page boundaries.
 | 
			
		||||
   * If the strings do not have the same offset from a word boundary,
 | 
			
		||||
     use LDR and a shift queue. Order of loads and comparisons matters,
 | 
			
		||||
     similarly to the previous case.
 | 
			
		||||
 | 
			
		||||
   * Use UADD8 and SEL to compare words, and use REV and CLZ to compute the return value.
 | 
			
		||||
   * The only difference between ARM and Thumb modes is the use of CBZ instruction.
 | 
			
		||||
   * The only difference between big and little endian is the use of REV in little endian
 | 
			
		||||
     to compute the return value, instead of MOV.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
        .macro m_cbz reg label
 | 
			
		||||
#ifdef __thumb2__
 | 
			
		||||
        cbz     \reg, \label
 | 
			
		||||
#else   /* not defined __thumb2__ */
 | 
			
		||||
        cmp     \reg, #0
 | 
			
		||||
        beq     \label
 | 
			
		||||
#endif /* not defined __thumb2__ */
 | 
			
		||||
        .endm /* m_cbz */
 | 
			
		||||
 | 
			
		||||
        .macro m_cbnz reg label
 | 
			
		||||
#ifdef __thumb2__
 | 
			
		||||
        cbnz    \reg, \label
 | 
			
		||||
#else   /* not defined __thumb2__ */
 | 
			
		||||
        cmp     \reg, #0
 | 
			
		||||
        bne     \label
 | 
			
		||||
#endif /* not defined __thumb2__ */
 | 
			
		||||
        .endm /* m_cbnz */
 | 
			
		||||
 | 
			
		||||
        .macro  init
 | 
			
		||||
        /* Macro to save temporary registers and prepare magic values.  */
 | 
			
		||||
        subs    sp, sp, #16
 | 
			
		||||
        strd    r4, r5, [sp, #8]
 | 
			
		||||
        strd    r6, r7, [sp]
 | 
			
		||||
        mvn     r6, #0  /* all F */
 | 
			
		||||
        mov     r7, #0  /* all 0 */
 | 
			
		||||
        .endm   /* init */
 | 
			
		||||
 | 
			
		||||
        .macro  magic_compare_and_branch w1 w2 label
 | 
			
		||||
        /* Macro to compare registers w1 and w2 and conditionally branch to label.  */
 | 
			
		||||
        cmp     \w1, \w2        /* Are w1 and w2 the same?  */
 | 
			
		||||
        magic_find_zero_bytes \w1
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   ip, #0          /* Is there a zero byte in w1?  */
 | 
			
		||||
        bne     \label
 | 
			
		||||
        .endm /* magic_compare_and_branch */
 | 
			
		||||
 | 
			
		||||
        .macro  magic_find_zero_bytes w1
 | 
			
		||||
        /* Macro to find all-zero bytes in w1, result is in ip.  */
 | 
			
		||||
#if (defined (__ARM_FEATURE_DSP))
 | 
			
		||||
        uadd8   ip, \w1, r6
 | 
			
		||||
        sel     ip, r7, r6
 | 
			
		||||
#else /* not defined (__ARM_FEATURE_DSP) */
 | 
			
		||||
        /* __ARM_FEATURE_DSP is not defined for some Cortex-M processors.
 | 
			
		||||
        Coincidently, these processors only have Thumb-2 mode, where we can use the
 | 
			
		||||
        the (large) magic constant available directly as an immediate in instructions.
 | 
			
		||||
        Note that we cannot use the magic constant in ARM mode, where we need
 | 
			
		||||
        to create the constant in a register.  */
 | 
			
		||||
        sub     ip, \w1, #0x01010101
 | 
			
		||||
        bic     ip, ip, \w1
 | 
			
		||||
        and     ip, ip, #0x80808080
 | 
			
		||||
#endif /* not defined (__ARM_FEATURE_DSP) */
 | 
			
		||||
        .endm /* magic_find_zero_bytes */
 | 
			
		||||
 | 
			
		||||
        .macro  setup_return w1 w2
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        mov     r1, \w1
 | 
			
		||||
        mov     r2, \w2
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
        rev     r1, \w1
 | 
			
		||||
        rev     r2, \w2
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
        .endm /* setup_return */
 | 
			
		||||
 | 
			
		||||
        pld [r0, #0]
 | 
			
		||||
        pld [r1, #0]
 | 
			
		||||
 | 
			
		||||
        /* Are both strings double-word aligned?  */
 | 
			
		||||
        orr     ip, r0, r1
 | 
			
		||||
        tst     ip, #7
 | 
			
		||||
        bne     do_align
 | 
			
		||||
 | 
			
		||||
        /* Fast path.  */
 | 
			
		||||
        init
 | 
			
		||||
 | 
			
		||||
doubleword_aligned:
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are double-word aligned.  */
 | 
			
		||||
        /* Compare two words in every iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
2:
 | 
			
		||||
        pld [r0, #16]
 | 
			
		||||
        pld [r1, #16]
 | 
			
		||||
 | 
			
		||||
        /* Load the next double-word from each string.  */
 | 
			
		||||
        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
 | 
			
		||||
        b       2b
 | 
			
		||||
 | 
			
		||||
do_align:
 | 
			
		||||
        /* Is the first string word-aligned?  */
 | 
			
		||||
        ands    ip, r0, #3
 | 
			
		||||
        beq     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
 | 
			
		||||
        to read until the next word boundary is 4-ip.  */
 | 
			
		||||
        bic     r0, r0, #3
 | 
			
		||||
        ldr     r2, [r0], #4
 | 
			
		||||
        lsls    ip, ip, #31
 | 
			
		||||
        beq     byte2
 | 
			
		||||
        bcs     byte3
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
fast_return:
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
        bx      lr
 | 
			
		||||
 | 
			
		||||
word_aligned_r0:
 | 
			
		||||
        init
 | 
			
		||||
        /* The first string is word-aligned.  */
 | 
			
		||||
        /* Is the second string word-aligned?  */
 | 
			
		||||
        ands    ip, r1, #3
 | 
			
		||||
        bne     strcmp_unaligned
 | 
			
		||||
 | 
			
		||||
word_aligned:
 | 
			
		||||
        /* The strings are word-aligned. */
 | 
			
		||||
        /* Is the first string double-word aligned?  */
 | 
			
		||||
        tst     r0, #4
 | 
			
		||||
        beq     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
 | 
			
		||||
 | 
			
		||||
doubleword_aligned_r0:
 | 
			
		||||
        /* Get here when r0 is double-word aligned.  */
 | 
			
		||||
        /* Is r1 doubleword_aligned?  */
 | 
			
		||||
        tst     r1, #4
 | 
			
		||||
        beq     doubleword_aligned
 | 
			
		||||
 | 
			
		||||
        /* Get here when the strings to compare are word-aligned,
 | 
			
		||||
        r0 is double-word aligned, but r1 is not double-word aligned.  */
 | 
			
		||||
 | 
			
		||||
        /* Initialize the queue.  */
 | 
			
		||||
        ldr     r5, [r1], #4
 | 
			
		||||
 | 
			
		||||
        /* Compare two words in every iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
3:
 | 
			
		||||
        pld [r0, #16]
 | 
			
		||||
        pld [r1, #16]
 | 
			
		||||
 | 
			
		||||
        /* 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
 | 
			
		||||
        ldrd    r4, r5, [r1], #8
 | 
			
		||||
        magic_compare_and_branch w1=r3 w2=r4 label=return_34
 | 
			
		||||
        b       3b
 | 
			
		||||
 | 
			
		||||
        .macro miscmp_word offsetlo offsethi
 | 
			
		||||
        /* Macro to compare misaligned strings.  */
 | 
			
		||||
        /* r0, r1 are word-aligned, and at least one of the strings
 | 
			
		||||
        is not double-word aligned.  */
 | 
			
		||||
        /* Compare one word in every loop iteration.  */
 | 
			
		||||
        /* OFFSETLO is the original bit-offset of r1 from a word-boundary,
 | 
			
		||||
        OFFSETHI is 32 - OFFSETLO (i.e., offset from the next word).  */
 | 
			
		||||
 | 
			
		||||
        /* Initialize the shift queue.  */
 | 
			
		||||
        ldr     r5, [r1], #4
 | 
			
		||||
 | 
			
		||||
        /* Compare one word from each string in every loop iteration.  */
 | 
			
		||||
        .p2align        2
 | 
			
		||||
7:
 | 
			
		||||
        ldr     r3, [r0], #4
 | 
			
		||||
        S2LOMEM r5, r5, #\offsetlo
 | 
			
		||||
        magic_find_zero_bytes w1=r3
 | 
			
		||||
        cmp     r7, ip, S2HIMEM #\offsetlo
 | 
			
		||||
        and     r2, r3, r6, S2LOMEM #\offsetlo
 | 
			
		||||
        it      eq
 | 
			
		||||
        cmpeq   r2, r5
 | 
			
		||||
        bne     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
 | 
			
		||||
        b       7b
 | 
			
		||||
        .endm /* miscmp_word */
 | 
			
		||||
 | 
			
		||||
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.  */
 | 
			
		||||
        miscmp_word offsetlo=8 offsethi=24        /* If ip == 1.  */
 | 
			
		||||
miscmp_word_24:  miscmp_word offsetlo=24 offsethi=8
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
return_32:
 | 
			
		||||
        setup_return w1=r3, w2=r2
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_34:
 | 
			
		||||
        setup_return w1=r3, w2=r4
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_25:
 | 
			
		||||
        setup_return w1=r2, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_35:
 | 
			
		||||
        setup_return w1=r3, w2=r5
 | 
			
		||||
        b       do_return
 | 
			
		||||
return_24:
 | 
			
		||||
        setup_return w1=r2, w2=r4
 | 
			
		||||
 | 
			
		||||
do_return:
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
        mov     r0, ip
 | 
			
		||||
#else /* not  __ARMEB__ */
 | 
			
		||||
        rev     r0, ip
 | 
			
		||||
#endif /* not  __ARMEB__ */
 | 
			
		||||
 | 
			
		||||
        /* Restore temporaries early, before computing the return value.  */
 | 
			
		||||
        ldrd    r6, r7, [sp]
 | 
			
		||||
        ldrd    r4, r5, [sp, #8]
 | 
			
		||||
        adds    sp, sp, #16
 | 
			
		||||
 | 
			
		||||
        /* 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
 | 
			
		||||
        clz     r0, r0
 | 
			
		||||
        /* r0 contains the number of bits on the left of the first all-zero byte in r1.  */
 | 
			
		||||
        rsb     r0, r0, #24
 | 
			
		||||
        /* Here, r0 contains the number of bits on the right of the first all-zero byte in r1.  */
 | 
			
		||||
        lsr     r1, r1, r0
 | 
			
		||||
        lsr     r2, r2, r0
 | 
			
		||||
 | 
			
		||||
compute_return_value:
 | 
			
		||||
        movs    r0, #1
 | 
			
		||||
        cmp     r1, r2
 | 
			
		||||
        /* The return value is computed as follows.
 | 
			
		||||
        If r1>r2 then (C==1 and Z==0) and LS doesn't hold and r0 is #1 at return.
 | 
			
		||||
        If r1<r2 then (C==0 and Z==0) and we execute SBC with carry_in=0,
 | 
			
		||||
        which means r0:=r0-r0-1 and r0 is #-1 at return.
 | 
			
		||||
        If r1=r2 then (C==1 and Z==1) and we execute SBC with carry_in=1,
 | 
			
		||||
        which means r0:=r0-r0 and r0 is #0 at return.
 | 
			
		||||
        (C==0 and Z==1) cannot happen because the carry bit is "not borrow".  */
 | 
			
		||||
        it      ls
 | 
			
		||||
        sbcls   r0, r0, r0
 | 
			
		||||
        bx      lr
 | 
			
		||||
 | 
			
		||||
    /* The code from the previous version of strcmp.S handles this
 | 
			
		||||
     * particular case (the second string is 2 bytes off a word alignment)
 | 
			
		||||
     * faster than any current version. In this very specific case, use the
 | 
			
		||||
     * previous version. See bionic/libc/arch-arm/cortex-a15/bionic/strcmp.S
 | 
			
		||||
     * for the unedited version of this code.
 | 
			
		||||
     */
 | 
			
		||||
miscmp_word_16:
 | 
			
		||||
	wp1 .req r0
 | 
			
		||||
	wp2 .req r1
 | 
			
		||||
	b1  .req r2
 | 
			
		||||
	w1  .req r4
 | 
			
		||||
	w2  .req r5
 | 
			
		||||
	t1  .req ip
 | 
			
		||||
	@ r3 is scratch
 | 
			
		||||
 | 
			
		||||
    /* At this point, wp1 (r0) has already been word-aligned. */
 | 
			
		||||
2:
 | 
			
		||||
	mov	b1, #1
 | 
			
		||||
	orr	b1, b1, b1, lsl #8
 | 
			
		||||
	orr	b1, b1, b1, lsl #16
 | 
			
		||||
 | 
			
		||||
	and	t1, wp2, #3
 | 
			
		||||
	bic	wp2, wp2, #3
 | 
			
		||||
	ldr	w1, [wp1], #4
 | 
			
		||||
	ldr	w2, [wp2], #4
 | 
			
		||||
 | 
			
		||||
	/* Critical inner Loop: Block with 2 bytes initial overlap */
 | 
			
		||||
	.p2align	2
 | 
			
		||||
2:
 | 
			
		||||
	S2HIMEM	t1, w1, #16
 | 
			
		||||
	sub	r3, w1, b1
 | 
			
		||||
	S2LOMEM	t1, t1, #16
 | 
			
		||||
	bic	r3, r3, w1
 | 
			
		||||
	cmp	t1, w2, S2LOMEM #16
 | 
			
		||||
	bne	4f
 | 
			
		||||
	ands	r3, r3, b1, lsl #7
 | 
			
		||||
	it	eq
 | 
			
		||||
	ldreq	w2, [wp2], #4
 | 
			
		||||
	bne	5f
 | 
			
		||||
	eor	t1, t1, w1
 | 
			
		||||
	cmp	t1, w2, S2HIMEM #16
 | 
			
		||||
	bne	6f
 | 
			
		||||
	ldr	w1, [wp1], #4
 | 
			
		||||
	b	2b
 | 
			
		||||
 | 
			
		||||
5:
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
	/* The syndrome value may contain false ones if the string ends
 | 
			
		||||
	 * with the bytes 0x01 0x00
 | 
			
		||||
	 */
 | 
			
		||||
	tst	w1, #0xff000000
 | 
			
		||||
	it	ne
 | 
			
		||||
	tstne	w1, #0x00ff0000
 | 
			
		||||
	beq	7f
 | 
			
		||||
#else
 | 
			
		||||
	lsls	r3, r3, #16
 | 
			
		||||
	bne	7f
 | 
			
		||||
#endif
 | 
			
		||||
	ldrh	w2, [wp2]
 | 
			
		||||
	S2LOMEM	t1, w1, #16
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
	lsl	w2, w2, #16
 | 
			
		||||
#endif
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
6:
 | 
			
		||||
	S2HIMEM	w2, w2, #16
 | 
			
		||||
	S2LOMEM	t1, w1, #16
 | 
			
		||||
4:
 | 
			
		||||
	S2LOMEM	w2, w2, #16
 | 
			
		||||
	b	8f
 | 
			
		||||
 | 
			
		||||
7:
 | 
			
		||||
	mov	r0, #0
 | 
			
		||||
 | 
			
		||||
    /* Restore registers and stack. */
 | 
			
		||||
    ldrd    r6, r7, [sp]
 | 
			
		||||
    ldrd    r4, r5, [sp, #8]
 | 
			
		||||
    adds    sp, sp, #16
 | 
			
		||||
 | 
			
		||||
	bx	lr
 | 
			
		||||
 | 
			
		||||
8:
 | 
			
		||||
	and	r2, t1, #LSB
 | 
			
		||||
	and	r0, w2, #LSB
 | 
			
		||||
	cmp	r0, #1
 | 
			
		||||
	it	cs
 | 
			
		||||
	cmpcs	r0, r2
 | 
			
		||||
	itt	eq
 | 
			
		||||
	S2LOMEMEQ	t1, t1, #8
 | 
			
		||||
	S2LOMEMEQ	w2, w2, #8
 | 
			
		||||
	beq	8b
 | 
			
		||||
	sub	r0, r2, r0
 | 
			
		||||
 | 
			
		||||
    /* Restore registers and stack. */
 | 
			
		||||
    ldrd    r6, r7, [sp]
 | 
			
		||||
    ldrd    r4, r5, [sp, #8]
 | 
			
		||||
    adds    sp, sp, #16
 | 
			
		||||
 | 
			
		||||
	bx	lr
 | 
			
		||||
END(strcmp)
 | 
			
		||||
							
								
								
									
										7
									
								
								libc/arch-arm/krait/krait.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								libc/arch-arm/krait/krait.mk
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
$(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,STRLEN,arch-arm/cortex-a15/bionic/strlen.S)
 | 
			
		||||
 | 
			
		||||
include bionic/libc/arch-arm/generic/generic.mk
 | 
			
		||||
@@ -4,6 +4,7 @@ syscall_src += arch-arm/syscalls/_exit.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/_exit_thread.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/__fork.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/__waitid.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/wait4.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/__sys_clone.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/execve.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/__setuid.S
 | 
			
		||||
@@ -125,6 +126,8 @@ syscall_src += arch-arm/syscalls/removexattr.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/lremovexattr.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/__statfs64.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/unshare.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/swapon.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/swapoff.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/pause.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/gettimeofday.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/settimeofday.S
 | 
			
		||||
@@ -143,6 +146,9 @@ syscall_src += arch-arm/syscalls/__timer_getoverrun.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/__timer_delete.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/utimes.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/utimensat.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/timerfd_create.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/timerfd_settime.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/timerfd_gettime.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/sigaction.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/sigprocmask.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/__sigsuspend.S
 | 
			
		||||
@@ -180,7 +186,6 @@ syscall_src += arch-arm/syscalls/__getcpu.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/ioprio_set.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/ioprio_get.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/uname.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/__wait4.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/umask.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/__reboot.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/__syslog.S
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__brk)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_brk
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__brk)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__fcntl)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_fcntl
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__fcntl)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__fcntl64)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_fcntl64
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__fcntl64)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__fork)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_fork
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__fork)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__fstatfs64)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_fstatfs64
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__fstatfs64)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__getcpu)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_getcpu
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__getcpu)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__getcwd)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_getcwd
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__getcwd)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__getpriority)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_getpriority
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__getpriority)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__ioctl)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_ioctl
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__ioctl)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__llseek)
 | 
			
		||||
    mov     ip, sp
 | 
			
		||||
@@ -10,7 +11,8 @@ ENTRY(__llseek)
 | 
			
		||||
    ldr     r7, =__NR__llseek
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmfd   sp!, {r4, r5, r6, r7}
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__llseek)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__mmap2)
 | 
			
		||||
    mov     ip, sp
 | 
			
		||||
@@ -10,7 +11,8 @@ ENTRY(__mmap2)
 | 
			
		||||
    ldr     r7, =__NR_mmap2
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmfd   sp!, {r4, r5, r6, r7}
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__mmap2)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__open)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_open
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__open)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__openat)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_openat
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__openat)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__ptrace)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_ptrace
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__ptrace)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__reboot)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_reboot
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__reboot)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__rt_sigaction)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_rt_sigaction
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__rt_sigaction)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__rt_sigprocmask)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_rt_sigprocmask
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__rt_sigprocmask)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__rt_sigtimedwait)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_rt_sigtimedwait
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__rt_sigtimedwait)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__sched_getaffinity)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_sched_getaffinity
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__sched_getaffinity)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__set_tls)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_ARM_set_tls
 | 
			
		||||
    ldr     r7, =__ARM_NR_set_tls
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__set_tls)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__setresuid)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_setresuid32
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__setresuid)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__setreuid)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_setreuid32
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__setreuid)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__setuid)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_setuid32
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__setuid)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__sigsuspend)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_sigsuspend
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__sigsuspend)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__statfs64)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_statfs64
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__statfs64)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__sys_clone)
 | 
			
		||||
    mov     ip, sp
 | 
			
		||||
@@ -10,7 +11,8 @@ ENTRY(__sys_clone)
 | 
			
		||||
    ldr     r7, =__NR_clone
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmfd   sp!, {r4, r5, r6, r7}
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__sys_clone)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__syslog)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_syslog
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__syslog)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__timer_create)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_timer_create
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__timer_create)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__timer_delete)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_timer_delete
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__timer_delete)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__timer_getoverrun)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_timer_getoverrun
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__timer_getoverrun)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__timer_gettime)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_timer_gettime
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__timer_gettime)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__timer_settime)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_timer_settime
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__timer_settime)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__wait4)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_wait4
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
END(__wait4)
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(__waitid)
 | 
			
		||||
    mov     ip, sp
 | 
			
		||||
@@ -10,7 +11,8 @@ ENTRY(__waitid)
 | 
			
		||||
    ldr     r7, =__NR_waitid
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmfd   sp!, {r4, r5, r6, r7}
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(__waitid)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(_exit)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_exit_group
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(_exit)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(_exit_thread)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_exit
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(_exit_thread)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(accept)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_accept
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(accept)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(access)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_access
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(access)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(acct)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_acct
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(acct)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(bind)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_bind
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(bind)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(cacheflush)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_ARM_cacheflush
 | 
			
		||||
    ldr     r7, =__ARM_NR_cacheflush
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(cacheflush)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(capget)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_capget
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(capget)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(capset)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_capset
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(capset)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(chdir)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_chdir
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(chdir)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(chmod)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_chmod
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(chmod)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(chown)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_chown32
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(chown)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(chroot)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_chroot
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(chroot)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(clock_getres)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_clock_getres
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(clock_getres)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(clock_gettime)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_clock_gettime
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(clock_gettime)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(clock_nanosleep)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_clock_nanosleep
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(clock_nanosleep)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(clock_settime)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_clock_settime
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(clock_settime)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(close)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_close
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(close)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(connect)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_connect
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(connect)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(delete_module)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_delete_module
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(delete_module)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(dup)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_dup
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(dup)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(dup2)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_dup2
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(dup2)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(epoll_create)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_epoll_create
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(epoll_create)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(epoll_ctl)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_epoll_ctl
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(epoll_ctl)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <asm/unistd.h>
 | 
			
		||||
#include <linux/err.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(epoll_wait)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_epoll_wait
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno
 | 
			
		||||
END(epoll_wait)
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user