summaryrefslogtreecommitdiff
path: root/arch/arm/lib/bswapsdi2.S
blob: f05f78247304bb41d18dda92c6c674e86a84c90b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <linux/linkage.h>
#include <asm/assembler.h>
#include <asm/export.h>

#if __LINUX_ARM_ARCH__ >= 6
ENTRY(__bswapsi2)
	rev r0, r0
	bx lr
ENDPROC(__bswapsi2)

ENTRY(__bswapdi2)
	rev r3, r0
	rev r0, r1
	mov r1, r3
	bx lr
ENDPROC(__bswapdi2)
#else
ENTRY(__bswapsi2)
	eor r3, r0, r0, ror #16
	mov r3, r3, lsr #8
	bic r3, r3, #0xff00
	eor r0, r3, r0, ror #8
	ret lr
ENDPROC(__bswapsi2)

ENTRY(__bswapdi2)
	mov ip, r1
	eor r3, ip, ip, ror #16
	eor r1, r0, r0, ror #16
	mov r1, r1, lsr #8
	mov r3, r3, lsr #8
	bic r3, r3, #0xff00
	bic r1, r1, #0xff00
	eor r1, r1, r0, ror #8
	eor r0, r3, ip, ror #8
	ret lr
ENDPROC(__bswapdi2)
#endif
EXPORT_SYMBOL(__bswapsi2)
EXPORT_SYMBOL(__bswapdi2)