io-writesw-armv4.S 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. .outsw_align: movs ip, r1, lsl #31
  24. bne .outsw_noalign
  25. ldrh r3, [r1], #2
  26. sub r2, r2, #1
  27. strh r3, [r0]
  28. ENTRY(__raw_writesw)
  29. teq r2, #0
  30. moveq pc, lr
  31. ands r3, r1, #3
  32. bne .outsw_align
  33. stmfd sp!, {r4, r5, lr}
  34. subs r2, r2, #8
  35. bmi .no_outsw_8
  36. .outsw_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 .outsw_8_lp
  43. .no_outsw_8: tst r2, #4
  44. beq .no_outsw_4
  45. ldmia r1!, {r3, ip}
  46. outword r3
  47. outword ip
  48. .no_outsw_4: movs r2, r2, lsl #31
  49. bcc .no_outsw_2
  50. ldr r3, [r1], #4
  51. outword r3
  52. .no_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. .outsw_noalign: ldr r3, [r1, -r3]!
  63. subcs r2, r2, #1
  64. bcs 2f
  65. subs r2, r2, #2
  66. bmi 3f
  67. 1: mov ip, r3, lsr #8
  68. strh ip, [r0]
  69. 2: mov ip, r3, pull_hbyte0
  70. ldr r3, [r1, #4]!
  71. subs r2, r2, #2
  72. orr ip, ip, r3, push_hbyte1
  73. strh ip, [r0]
  74. bpl 1b
  75. tst r2, #1
  76. 3: movne ip, r3, lsr #8
  77. strneh ip, [r0]
  78. mov pc, lr