io-readsl.S 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * linux/arch/arm26/lib/io-readsl.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/hardware.h>
  13. /*
  14. * Note that some reads can be aligned on half-word boundaries.
  15. */
  16. ENTRY(__raw_readsl)
  17. teq r2, #0 @ do we have to check for the zero len?
  18. moveq pc, lr
  19. ands ip, r1, #3
  20. bne 2f
  21. 1: ldr r3, [r0]
  22. str r3, [r1], #4
  23. subs r2, r2, #1
  24. bne 1b
  25. mov pc, lr
  26. 2: cmp ip, #2
  27. ldr ip, [r0]
  28. blt 4f
  29. bgt 6f
  30. strb ip, [r1], #1
  31. mov ip, ip, lsr #8
  32. strb ip, [r1], #1
  33. mov ip, ip, lsr #8
  34. 3: subs r2, r2, #1
  35. ldrne r3, [r0]
  36. orrne ip, ip, r3, lsl #16
  37. strne ip, [r1], #4
  38. movne ip, r3, lsr #16
  39. bne 3b
  40. strb ip, [r1], #1
  41. mov ip, ip, lsr #8
  42. strb ip, [r1], #1
  43. mov pc, lr
  44. 4: strb ip, [r1], #1
  45. mov ip, ip, lsr #8
  46. strb ip, [r1], #1
  47. mov ip, ip, lsr #8
  48. strb ip, [r1], #1
  49. mov ip, ip, lsr #8
  50. 5: subs r2, r2, #1
  51. ldrne r3, [r0]
  52. orrne ip, ip, r3, lsl #8
  53. strne ip, [r1], #4
  54. movne ip, r3, lsr #24
  55. bne 5b
  56. strb ip, [r1], #1
  57. mov pc, lr
  58. 6: strb ip, [r1], #1
  59. mov ip, ip, lsr #8
  60. 7: subs r2, r2, #1
  61. ldrne r3, [r0]
  62. orrne ip, ip, r3, lsl #24
  63. strne ip, [r1], #4
  64. movne ip, r3, lsr #8
  65. bne 7b
  66. strb ip, [r1], #1
  67. mov ip, ip, lsr #8
  68. strb ip, [r1], #1
  69. mov ip, ip, lsr #8
  70. strb ip, [r1], #1
  71. mov pc, lr