Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 Viro | 4dd1837 | 2016-01-13 13:46:22 -0500 | [diff] [blame] | 12 | #include <asm/export.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
| 14 | ENTRY(__raw_readsl) |
| 15 | teq r2, #0 @ do we have to check for the zero len? |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 16 | reteq lr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | ands ip, r1, #3 |
| 18 | bne 3f |
| 19 | |
| 20 | subs r2, r2, #4 |
| 21 | bmi 2f |
| 22 | stmfd sp!, {r4, lr} |
| 23 | 1: 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} |
| 31 | 2: 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 King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 37 | ret lr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
| 39 | 3: 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 | |
| 50 | 4: subs r2, r2, #1 |
Victor Kamensky | d98b90e | 2014-02-25 08:41:09 +0100 | [diff] [blame] | 51 | mov ip, r3, lspull #24 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | ldrne r3, [r0] |
Victor Kamensky | d98b90e | 2014-02-25 08:41:09 +0100 | [diff] [blame] | 53 | orrne ip, ip, r3, lspush #8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | strne ip, [r1], #4 |
| 55 | bne 4b |
| 56 | b 8f |
| 57 | |
| 58 | 5: subs r2, r2, #1 |
Victor Kamensky | d98b90e | 2014-02-25 08:41:09 +0100 | [diff] [blame] | 59 | mov ip, r3, lspull #16 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | ldrne r3, [r0] |
Victor Kamensky | d98b90e | 2014-02-25 08:41:09 +0100 | [diff] [blame] | 61 | orrne ip, ip, r3, lspush #16 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | strne ip, [r1], #4 |
| 63 | bne 5b |
| 64 | b 7f |
| 65 | |
| 66 | 6: subs r2, r2, #1 |
Victor Kamensky | d98b90e | 2014-02-25 08:41:09 +0100 | [diff] [blame] | 67 | mov ip, r3, lspull #8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | ldrne r3, [r0] |
Victor Kamensky | d98b90e | 2014-02-25 08:41:09 +0100 | [diff] [blame] | 69 | orrne ip, ip, r3, lspush #24 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | strne ip, [r1], #4 |
| 71 | bne 6b |
| 72 | |
| 73 | mov r3, ip, get_byte_2 |
| 74 | strb r3, [r1, #2] |
| 75 | 7: mov r3, ip, get_byte_1 |
| 76 | strb r3, [r1, #1] |
| 77 | 8: mov r3, ip, get_byte_0 |
| 78 | strb r3, [r1, #0] |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 79 | ret lr |
Catalin Marinas | 93ed397 | 2008-08-28 11:22:32 +0100 | [diff] [blame] | 80 | ENDPROC(__raw_readsl) |
Al Viro | 4dd1837 | 2016-01-13 13:46:22 -0500 | [diff] [blame] | 81 | EXPORT_SYMBOL(__raw_readsl) |