io-writesb.S 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. .macro outword, rd
  13. #ifndef __ARMEB__
  14. strb \rd, [r0]
  15. mov \rd, \rd, lsr #8
  16. strb \rd, [r0]
  17. mov \rd, \rd, lsr #8
  18. strb \rd, [r0]
  19. mov \rd, \rd, lsr #8
  20. strb \rd, [r0]
  21. #else
  22. mov lr, \rd, lsr #24
  23. strb lr, [r0]
  24. mov lr, \rd, lsr #16
  25. strb lr, [r0]
  26. mov lr, \rd, lsr #8
  27. strb lr, [r0]
  28. strb \rd, [r0]
  29. #endif
  30. .endm
  31. .Loutsb_align: rsb ip, ip, #4
  32. cmp ip, r2
  33. movgt ip, r2
  34. cmp ip, #2
  35. ldrb r3, [r1], #1
  36. strb r3, [r0]
  37. ldrgeb r3, [r1], #1
  38. strgeb r3, [r0]
  39. ldrgtb r3, [r1], #1
  40. strgtb r3, [r0]
  41. subs r2, r2, ip
  42. bne .Loutsb_aligned
  43. ENTRY(__raw_writesb)
  44. teq r2, #0 @ do we have to check for the zero len?
  45. reteq lr
  46. ands ip, r1, #3
  47. bne .Loutsb_align
  48. .Loutsb_aligned:
  49. stmfd sp!, {r4, r5, lr}
  50. subs r2, r2, #16
  51. bmi .Loutsb_no_16
  52. .Loutsb_16_lp: ldmia r1!, {r3, r4, r5, ip}
  53. outword r3
  54. outword r4
  55. outword r5
  56. outword ip
  57. subs r2, r2, #16
  58. bpl .Loutsb_16_lp
  59. tst r2, #15
  60. ldmeqfd sp!, {r4, r5, pc}
  61. .Loutsb_no_16: tst r2, #8
  62. beq .Loutsb_no_8
  63. ldmia r1!, {r3, r4}
  64. outword r3
  65. outword r4
  66. .Loutsb_no_8: tst r2, #4
  67. beq .Loutsb_no_4
  68. ldr r3, [r1], #4
  69. outword r3
  70. .Loutsb_no_4: ands r2, r2, #3
  71. ldmeqfd sp!, {r4, r5, pc}
  72. cmp r2, #2
  73. ldrb r3, [r1], #1
  74. strb r3, [r0]
  75. ldrgeb r3, [r1], #1
  76. strgeb r3, [r0]
  77. ldrgtb r3, [r1]
  78. strgtb r3, [r0]
  79. ldmfd sp!, {r4, r5, pc}
  80. ENDPROC(__raw_writesb)