diff options
author | Nicolas Pitre <nicolas.pitre@linaro.org> | 2015-12-11 20:49:21 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-12-17 05:29:01 -0500 |
commit | 42f25bddd0a226d2431e057b9e01c5cc61067e12 (patch) | |
tree | 33e3bf9c4669caba06f72303e5d333e2acd15e78 /arch/arm/lib | |
parent | 38fc2f6c98262913388de338d5b0cda67e3f78cd (diff) |
ARM: 8477/1: runtime patch udiv/sdiv instructions into __aeabi_{u}idiv()
The ARM compiler inserts calls to __aeabi_idiv() and
__aeabi_uidiv() when it needs to perform division on signed and
unsigned integers. If a processor has support for the sdiv and
udiv instructions, the kernel may overwrite the beginning of those
functions with those instructions and a "bx lr" to get better
performance.
To ensure that those functions are aligned to a 32-bit word for easier
patching (which might not always be the case in Thumb mode) and that
the two patched instructions end up in the same cache line, a 8-byte
alignment is enforced when ARM_PATCH_IDIV is selected.
This was heavily inspired by a previous patch from Stephen Boyd.
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/lib')
-rw-r--r-- | arch/arm/lib/lib1funcs.S | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm/lib/lib1funcs.S b/arch/arm/lib/lib1funcs.S index af2267f6a529..9397b2e532af 100644 --- a/arch/arm/lib/lib1funcs.S +++ b/arch/arm/lib/lib1funcs.S | |||
@@ -205,6 +205,10 @@ Boston, MA 02111-1307, USA. */ | |||
205 | .endm | 205 | .endm |
206 | 206 | ||
207 | 207 | ||
208 | #ifdef CONFIG_ARM_PATCH_IDIV | ||
209 | .align 3 | ||
210 | #endif | ||
211 | |||
208 | ENTRY(__udivsi3) | 212 | ENTRY(__udivsi3) |
209 | ENTRY(__aeabi_uidiv) | 213 | ENTRY(__aeabi_uidiv) |
210 | UNWIND(.fnstart) | 214 | UNWIND(.fnstart) |
@@ -253,6 +257,10 @@ UNWIND(.fnstart) | |||
253 | UNWIND(.fnend) | 257 | UNWIND(.fnend) |
254 | ENDPROC(__umodsi3) | 258 | ENDPROC(__umodsi3) |
255 | 259 | ||
260 | #ifdef CONFIG_ARM_PATCH_IDIV | ||
261 | .align 3 | ||
262 | #endif | ||
263 | |||
256 | ENTRY(__divsi3) | 264 | ENTRY(__divsi3) |
257 | ENTRY(__aeabi_idiv) | 265 | ENTRY(__aeabi_idiv) |
258 | UNWIND(.fnstart) | 266 | UNWIND(.fnstart) |