io-writesw-armv4.S 1.7 KB

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