io-readsl.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * linux/arch/arm/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. ENTRY(__raw_readsl)
  13. teq r2, #0 @ do we have to check for the zero len?
  14. reteq lr
  15. ands ip, r1, #3
  16. bne 3f
  17. subs r2, r2, #4
  18. bmi 2f
  19. stmfd sp!, {r4, lr}
  20. 1: ldr r3, [r0, #0]
  21. ldr r4, [r0, #0]
  22. ldr ip, [r0, #0]
  23. ldr lr, [r0, #0]
  24. subs r2, r2, #4
  25. stmia r1!, {r3, r4, ip, lr}
  26. bpl 1b
  27. ldmfd sp!, {r4, lr}
  28. 2: movs r2, r2, lsl #31
  29. ldrcs r3, [r0, #0]
  30. ldrcs ip, [r0, #0]
  31. stmcsia r1!, {r3, ip}
  32. ldrne r3, [r0, #0]
  33. strne r3, [r1, #0]
  34. ret lr
  35. 3: ldr r3, [r0]
  36. cmp ip, #2
  37. mov ip, r3, get_byte_0
  38. strb ip, [r1], #1
  39. bgt 6f
  40. mov ip, r3, get_byte_1
  41. strb ip, [r1], #1
  42. beq 5f
  43. mov ip, r3, get_byte_2
  44. strb ip, [r1], #1
  45. 4: subs r2, r2, #1
  46. mov ip, r3, lspull #24
  47. ldrne r3, [r0]
  48. orrne ip, ip, r3, lspush #8
  49. strne ip, [r1], #4
  50. bne 4b
  51. b 8f
  52. 5: subs r2, r2, #1
  53. mov ip, r3, lspull #16
  54. ldrne r3, [r0]
  55. orrne ip, ip, r3, lspush #16
  56. strne ip, [r1], #4
  57. bne 5b
  58. b 7f
  59. 6: subs r2, r2, #1
  60. mov ip, r3, lspull #8
  61. ldrne r3, [r0]
  62. orrne ip, ip, r3, lspush #24
  63. strne ip, [r1], #4
  64. bne 6b
  65. mov r3, ip, get_byte_2
  66. strb r3, [r1, #2]
  67. 7: mov r3, ip, get_byte_1
  68. strb r3, [r1, #1]
  69. 8: mov r3, ip, get_byte_0
  70. strb r3, [r1, #0]
  71. ret lr
  72. ENDPROC(__raw_readsl)