io-readsw-armv3.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * linux/arch/arm/lib/io-readsw-armv3.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. .Linsw_bad_alignment:
  13. adr r0, .Linsw_bad_align_msg
  14. mov r2, lr
  15. b panic
  16. .Linsw_bad_align_msg:
  17. .asciz "insw: bad buffer alignment (0x%p, lr=0x%08lX)\n"
  18. .align
  19. .Linsw_align: tst r1, #1
  20. bne .Linsw_bad_alignment
  21. ldr r3, [r0]
  22. strb r3, [r1], #1
  23. mov r3, r3, lsr #8
  24. strb r3, [r1], #1
  25. subs r2, r2, #1
  26. reteq lr
  27. ENTRY(__raw_readsw)
  28. teq r2, #0 @ do we have to check for the zero len?
  29. reteq lr
  30. tst r1, #3
  31. bne .Linsw_align
  32. .Linsw_aligned: mov ip, #0xff
  33. orr ip, ip, ip, lsl #8
  34. stmfd sp!, {r4, r5, r6, lr}
  35. subs r2, r2, #8
  36. bmi .Lno_insw_8
  37. .Linsw_8_lp: ldr r3, [r0]
  38. and r3, r3, ip
  39. ldr r4, [r0]
  40. orr r3, r3, r4, lsl #16
  41. ldr r4, [r0]
  42. and r4, r4, ip
  43. ldr r5, [r0]
  44. orr r4, r4, r5, lsl #16
  45. ldr r5, [r0]
  46. and r5, r5, ip
  47. ldr r6, [r0]
  48. orr r5, r5, r6, lsl #16
  49. ldr r6, [r0]
  50. and r6, r6, ip
  51. ldr lr, [r0]
  52. orr r6, r6, lr, lsl #16
  53. stmia r1!, {r3 - r6}
  54. subs r2, r2, #8
  55. bpl .Linsw_8_lp
  56. tst r2, #7
  57. ldmeqfd sp!, {r4, r5, r6, pc}
  58. .Lno_insw_8: tst r2, #4
  59. beq .Lno_insw_4
  60. ldr r3, [r0]
  61. and r3, r3, ip
  62. ldr r4, [r0]
  63. orr r3, r3, r4, lsl #16
  64. ldr r4, [r0]
  65. and r4, r4, ip
  66. ldr r5, [r0]
  67. orr r4, r4, r5, lsl #16
  68. stmia r1!, {r3, r4}
  69. .Lno_insw_4: tst r2, #2
  70. beq .Lno_insw_2
  71. ldr r3, [r0]
  72. and r3, r3, ip
  73. ldr r4, [r0]
  74. orr r3, r3, r4, lsl #16
  75. str r3, [r1], #4
  76. .Lno_insw_2: tst r2, #1
  77. ldrne r3, [r0]
  78. strneb r3, [r1], #1
  79. movne r3, r3, lsr #8
  80. strneb r3, [r1]
  81. ldmfd sp!, {r4, r5, r6, pc}