io-readsw-armv3.S 1.8 KB

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