Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 9039/1: assembler: generalize byte swapping macro into rev_l

Take the 4 instruction byte swapping sequence from the decompressor's
head.S, and turn it into a rev_l GAS macro for general use. While
at it, make it use the 'rev' instruction when compiling for v6 or
later.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

authored by

Ard Biesheuvel and committed by
Russell King
6468e898 5c8fe583

+18 -4
+1 -4
arch/arm/boot/compressed/head.S
··· 174 174 .macro be32tocpu, val, tmp 175 175 #ifndef __ARMEB__ 176 176 /* convert to little endian */ 177 - eor \tmp, \val, \val, ror #16 178 - bic \tmp, \tmp, #0x00ff0000 179 - mov \val, \val, ror #8 180 - eor \val, \val, \tmp, lsr #8 177 + rev_l \val, \tmp 181 178 #endif 182 179 .endm 183 180
+17
arch/arm/include/asm/assembler.h
··· 578 578 __adldst_l str, \src, \sym, \tmp, \cond 579 579 .endm 580 580 581 + /* 582 + * rev_l - byte-swap a 32-bit value 583 + * 584 + * @val: source/destination register 585 + * @tmp: scratch register 586 + */ 587 + .macro rev_l, val:req, tmp:req 588 + .if __LINUX_ARM_ARCH__ < 6 589 + eor \tmp, \val, \val, ror #16 590 + bic \tmp, \tmp, #0x00ff0000 591 + mov \val, \val, ror #8 592 + eor \val, \val, \tmp, lsr #8 593 + .else 594 + rev \val, \val 595 + .endif 596 + .endm 597 + 581 598 #endif /* __ASM_ASSEMBLER_H__ */