1/* 2 * linux/arch/arm/lib/io-writesw-armv4.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#include <asm/export.h> 13 14 .macro outword, rd 15#ifndef __ARMEB__ 16 strh \rd, [r0] 17 mov \rd, \rd, lsr #16 18 strh \rd, [r0] 19#else 20 mov lr, \rd, lsr #16 21 strh lr, [r0] 22 strh \rd, [r0] 23#endif 24 .endm 25 26.Loutsw_align: movs ip, r1, lsl #31 27 bne .Loutsw_noalign 28 29 ldrh r3, [r1], #2 30 sub r2, r2, #1 31 strh r3, [r0] 32 33ENTRY(__raw_writesw) 34 teq r2, #0 35 reteq lr 36 ands r3, r1, #3 37 bne .Loutsw_align 38 39 stmfd sp!, {r4, r5, lr} 40 41 subs r2, r2, #8 42 bmi .Lno_outsw_8 43 44.Loutsw_8_lp: ldmia r1!, {r3, r4, r5, ip} 45 subs r2, r2, #8 46 outword r3 47 outword r4 48 outword r5 49 outword ip 50 bpl .Loutsw_8_lp 51 52.Lno_outsw_8: tst r2, #4 53 beq .Lno_outsw_4 54 55 ldmia r1!, {r3, ip} 56 outword r3 57 outword ip 58 59.Lno_outsw_4: movs r2, r2, lsl #31 60 bcc .Lno_outsw_2 61 62 ldr r3, [r1], #4 63 outword r3 64 65.Lno_outsw_2: ldrneh r3, [r1] 66 strneh r3, [r0] 67 68 ldmfd sp!, {r4, r5, pc} 69 70#ifdef __ARMEB__ 71#define pull_hbyte0 lsl #8 72#define push_hbyte1 lsr #24 73#else 74#define pull_hbyte0 lsr #24 75#define push_hbyte1 lsl #8 76#endif 77 78.Loutsw_noalign: 79 ARM( ldr r3, [r1, -r3]! ) 80 THUMB( rsb r3, r3, #0 ) 81 THUMB( ldr r3, [r1, r3] ) 82 THUMB( sub r1, r3 ) 83 subcs r2, r2, #1 84 bcs 2f 85 subs r2, r2, #2 86 bmi 3f 87 881: mov ip, r3, lsr #8 89 strh ip, [r0] 902: mov ip, r3, pull_hbyte0 91 ldr r3, [r1, #4]! 92 subs r2, r2, #2 93 orr ip, ip, r3, push_hbyte1 94 strh ip, [r0] 95 bpl 1b 96 97 tst r2, #1 983: movne ip, r3, lsr #8 99 strneh ip, [r0] 100 ret lr 101ENDPROC(__raw_writesw) 102EXPORT_SYMBOL(__raw_writesw) 103