Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/lib/io-writesb.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> |
| 12 | |
| 13 | .macro outword, rd |
| 14 | #ifndef __ARMEB__ |
| 15 | strb \rd, [r0] |
| 16 | mov \rd, \rd, lsr #8 |
| 17 | strb \rd, [r0] |
| 18 | mov \rd, \rd, lsr #8 |
| 19 | strb \rd, [r0] |
| 20 | mov \rd, \rd, lsr #8 |
| 21 | strb \rd, [r0] |
| 22 | #else |
| 23 | mov lr, \rd, lsr #24 |
| 24 | strb lr, [r0] |
| 25 | mov lr, \rd, lsr #16 |
| 26 | strb lr, [r0] |
| 27 | mov lr, \rd, lsr #8 |
| 28 | strb lr, [r0] |
| 29 | strb \rd, [r0] |
| 30 | #endif |
| 31 | .endm |
| 32 | |
Nicolas Pitre | a9c4814 | 2005-11-11 21:51:48 +0000 | [diff] [blame] | 33 | .Loutsb_align: rsb ip, ip, #4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | cmp ip, r2 |
| 35 | movgt ip, r2 |
| 36 | cmp ip, #2 |
| 37 | ldrb r3, [r1], #1 |
| 38 | strb r3, [r0] |
| 39 | ldrgeb r3, [r1], #1 |
| 40 | strgeb r3, [r0] |
| 41 | ldrgtb r3, [r1], #1 |
| 42 | strgtb r3, [r0] |
| 43 | subs r2, r2, ip |
Nicolas Pitre | a9c4814 | 2005-11-11 21:51:48 +0000 | [diff] [blame] | 44 | bne .Loutsb_aligned |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
| 46 | ENTRY(__raw_writesb) |
| 47 | teq r2, #0 @ do we have to check for the zero len? |
| 48 | moveq pc, lr |
| 49 | ands ip, r1, #3 |
Nicolas Pitre | a9c4814 | 2005-11-11 21:51:48 +0000 | [diff] [blame] | 50 | bne .Loutsb_align |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Nicolas Pitre | a9c4814 | 2005-11-11 21:51:48 +0000 | [diff] [blame] | 52 | .Loutsb_aligned: |
| 53 | stmfd sp!, {r4, r5, lr} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
| 55 | subs r2, r2, #16 |
Nicolas Pitre | a9c4814 | 2005-11-11 21:51:48 +0000 | [diff] [blame] | 56 | bmi .Loutsb_no_16 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | |
Nicolas Pitre | a9c4814 | 2005-11-11 21:51:48 +0000 | [diff] [blame] | 58 | .Loutsb_16_lp: ldmia r1!, {r3, r4, r5, ip} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | outword r3 |
| 60 | outword r4 |
| 61 | outword r5 |
| 62 | outword ip |
| 63 | subs r2, r2, #16 |
Nicolas Pitre | a9c4814 | 2005-11-11 21:51:48 +0000 | [diff] [blame] | 64 | bpl .Loutsb_16_lp |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
| 66 | tst r2, #15 |
Russell King | 1b93a71 | 2006-06-25 11:23:45 +0100 | [diff] [blame] | 67 | ldmeqfd sp!, {r4, r5, pc} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
Nicolas Pitre | a9c4814 | 2005-11-11 21:51:48 +0000 | [diff] [blame] | 69 | .Loutsb_no_16: tst r2, #8 |
| 70 | beq .Loutsb_no_8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | |
| 72 | ldmia r1!, {r3, r4} |
| 73 | outword r3 |
| 74 | outword r4 |
| 75 | |
Nicolas Pitre | a9c4814 | 2005-11-11 21:51:48 +0000 | [diff] [blame] | 76 | .Loutsb_no_8: tst r2, #4 |
| 77 | beq .Loutsb_no_4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
| 79 | ldr r3, [r1], #4 |
| 80 | outword r3 |
| 81 | |
Nicolas Pitre | a9c4814 | 2005-11-11 21:51:48 +0000 | [diff] [blame] | 82 | .Loutsb_no_4: ands r2, r2, #3 |
Russell King | 1b93a71 | 2006-06-25 11:23:45 +0100 | [diff] [blame] | 83 | ldmeqfd sp!, {r4, r5, pc} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | |
| 85 | cmp r2, #2 |
| 86 | ldrb r3, [r1], #1 |
| 87 | strb r3, [r0] |
| 88 | ldrgeb r3, [r1], #1 |
| 89 | strgeb r3, [r0] |
| 90 | ldrgtb r3, [r1] |
| 91 | strgtb r3, [r0] |
| 92 | |
Russell King | 1b93a71 | 2006-06-25 11:23:45 +0100 | [diff] [blame] | 93 | ldmfd sp!, {r4, r5, pc} |