blob: bfd39682325b0c43ba990a130cc14afca9d87104 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/lib/io-readsl.S
3 *
4 * Copyright (C) 1995-2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
Al Viro4dd18372016-01-13 13:46:22 -050012#include <asm/export.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
14ENTRY(__raw_readsl)
15 teq r2, #0 @ do we have to check for the zero len?
Russell King6ebbf2c2014-06-30 16:29:12 +010016 reteq lr
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 ands ip, r1, #3
18 bne 3f
19
20 subs r2, r2, #4
21 bmi 2f
22 stmfd sp!, {r4, lr}
231: ldr r3, [r0, #0]
24 ldr r4, [r0, #0]
25 ldr ip, [r0, #0]
26 ldr lr, [r0, #0]
27 subs r2, r2, #4
28 stmia r1!, {r3, r4, ip, lr}
29 bpl 1b
30 ldmfd sp!, {r4, lr}
312: movs r2, r2, lsl #31
32 ldrcs r3, [r0, #0]
33 ldrcs ip, [r0, #0]
34 stmcsia r1!, {r3, ip}
35 ldrne r3, [r0, #0]
36 strne r3, [r1, #0]
Russell King6ebbf2c2014-06-30 16:29:12 +010037 ret lr
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
393: ldr r3, [r0]
40 cmp ip, #2
41 mov ip, r3, get_byte_0
42 strb ip, [r1], #1
43 bgt 6f
44 mov ip, r3, get_byte_1
45 strb ip, [r1], #1
46 beq 5f
47 mov ip, r3, get_byte_2
48 strb ip, [r1], #1
49
504: subs r2, r2, #1
Victor Kamenskyd98b90e2014-02-25 08:41:09 +010051 mov ip, r3, lspull #24
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 ldrne r3, [r0]
Victor Kamenskyd98b90e2014-02-25 08:41:09 +010053 orrne ip, ip, r3, lspush #8
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 strne ip, [r1], #4
55 bne 4b
56 b 8f
57
585: subs r2, r2, #1
Victor Kamenskyd98b90e2014-02-25 08:41:09 +010059 mov ip, r3, lspull #16
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 ldrne r3, [r0]
Victor Kamenskyd98b90e2014-02-25 08:41:09 +010061 orrne ip, ip, r3, lspush #16
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 strne ip, [r1], #4
63 bne 5b
64 b 7f
65
666: subs r2, r2, #1
Victor Kamenskyd98b90e2014-02-25 08:41:09 +010067 mov ip, r3, lspull #8
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 ldrne r3, [r0]
Victor Kamenskyd98b90e2014-02-25 08:41:09 +010069 orrne ip, ip, r3, lspush #24
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 strne ip, [r1], #4
71 bne 6b
72
73 mov r3, ip, get_byte_2
74 strb r3, [r1, #2]
757: mov r3, ip, get_byte_1
76 strb r3, [r1, #1]
778: mov r3, ip, get_byte_0
78 strb r3, [r1, #0]
Russell King6ebbf2c2014-06-30 16:29:12 +010079 ret lr
Catalin Marinas93ed3972008-08-28 11:22:32 +010080ENDPROC(__raw_readsl)
Al Viro4dd18372016-01-13 13:46:22 -050081EXPORT_SYMBOL(__raw_readsl)