io-readsl.S 1.5 KB

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