io-readsb.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * linux/arch/arm/lib/io-readsb.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. .Linsb_align: rsb ip, ip, #4
  13. cmp ip, r2
  14. movgt ip, r2
  15. cmp ip, #2
  16. ldrb r3, [r0]
  17. strb r3, [r1], #1
  18. ldrgeb r3, [r0]
  19. strgeb r3, [r1], #1
  20. ldrgtb r3, [r0]
  21. strgtb r3, [r1], #1
  22. subs r2, r2, ip
  23. bne .Linsb_aligned
  24. ENTRY(__raw_readsb)
  25. teq r2, #0 @ do we have to check for the zero len?
  26. moveq pc, lr
  27. ands ip, r1, #3
  28. bne .Linsb_align
  29. .Linsb_aligned: stmfd sp!, {r4 - r6, lr}
  30. subs r2, r2, #16
  31. bmi .Linsb_no_16
  32. .Linsb_16_lp: ldrb r3, [r0]
  33. ldrb r4, [r0]
  34. ldrb r5, [r0]
  35. mov r3, r3, put_byte_0
  36. ldrb r6, [r0]
  37. orr r3, r3, r4, put_byte_1
  38. ldrb r4, [r0]
  39. orr r3, r3, r5, put_byte_2
  40. ldrb r5, [r0]
  41. orr r3, r3, r6, put_byte_3
  42. ldrb r6, [r0]
  43. mov r4, r4, put_byte_0
  44. ldrb ip, [r0]
  45. orr r4, r4, r5, put_byte_1
  46. ldrb r5, [r0]
  47. orr r4, r4, r6, put_byte_2
  48. ldrb r6, [r0]
  49. orr r4, r4, ip, put_byte_3
  50. ldrb ip, [r0]
  51. mov r5, r5, put_byte_0
  52. ldrb lr, [r0]
  53. orr r5, r5, r6, put_byte_1
  54. ldrb r6, [r0]
  55. orr r5, r5, ip, put_byte_2
  56. ldrb ip, [r0]
  57. orr r5, r5, lr, put_byte_3
  58. ldrb lr, [r0]
  59. mov r6, r6, put_byte_0
  60. orr r6, r6, ip, put_byte_1
  61. ldrb ip, [r0]
  62. orr r6, r6, lr, put_byte_2
  63. orr r6, r6, ip, put_byte_3
  64. stmia r1!, {r3 - r6}
  65. subs r2, r2, #16
  66. bpl .Linsb_16_lp
  67. tst r2, #15
  68. ldmeqfd sp!, {r4 - r6, pc}
  69. .Linsb_no_16: tst r2, #8
  70. beq .Linsb_no_8
  71. ldrb r3, [r0]
  72. ldrb r4, [r0]
  73. ldrb r5, [r0]
  74. mov r3, r3, put_byte_0
  75. ldrb r6, [r0]
  76. orr r3, r3, r4, put_byte_1
  77. ldrb r4, [r0]
  78. orr r3, r3, r5, put_byte_2
  79. ldrb r5, [r0]
  80. orr r3, r3, r6, put_byte_3
  81. ldrb r6, [r0]
  82. mov r4, r4, put_byte_0
  83. ldrb ip, [r0]
  84. orr r4, r4, r5, put_byte_1
  85. orr r4, r4, r6, put_byte_2
  86. orr r4, r4, ip, put_byte_3
  87. stmia r1!, {r3, r4}
  88. .Linsb_no_8: tst r2, #4
  89. beq .Linsb_no_4
  90. ldrb r3, [r0]
  91. ldrb r4, [r0]
  92. ldrb r5, [r0]
  93. ldrb r6, [r0]
  94. mov r3, r3, put_byte_0
  95. orr r3, r3, r4, put_byte_1
  96. orr r3, r3, r5, put_byte_2
  97. orr r3, r3, r6, put_byte_3
  98. str r3, [r1], #4
  99. .Linsb_no_4: ands r2, r2, #3
  100. ldmeqfd sp!, {r4 - r6, pc}
  101. cmp r2, #2
  102. ldrb r3, [r0]
  103. strb r3, [r1], #1
  104. ldrgeb r3, [r0]
  105. strgeb r3, [r1], #1
  106. ldrgtb r3, [r0]
  107. strgtb r3, [r1]
  108. ldmfd sp!, {r4 - r6, pc}
  109. ENDPROC(__raw_readsb)