spcopy.S 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /* This is a generated file. DO NOT EDIT. */
  2. /*
  3. * Generated from:
  4. *
  5. * OpenBSD: bcopy.m4
  6. */
  7. /*
  8. * Copyright (c) 1999 Michael Shalayeff
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions and the following disclaimer.
  16. * 2. Redistributions in binary form must reproduce the above copyright
  17. * notice, this list of conditions and the following disclaimer in the
  18. * documentation and/or other materials provided with the distribution.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR
  21. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  22. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  23. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  25. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  29. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. *
  31. */
  32. #undef _LOCORE
  33. #define _LOCORE
  34. #include <machine/asm.h>
  35. #include <machine/frame.h>
  36. #ifdef _KERNEL
  37. #include <assym.h>
  38. /*
  39. * int spcopy (pa_space_t ssp, const void *src, pa_space_t dsp, void *dst,
  40. * size_t size)
  41. * do a space to space bcopy.
  42. *
  43. * assumes that spaces do not clash, otherwise we lose
  44. */
  45. .import copy_on_fault, code
  46. LEAF_ENTRY(spcopy)
  47. ldw HPPA_FRAME_ARG(4)(sp), ret0
  48. sub,<> r0, ret0, r0
  49. bv r0(rp)
  50. nop
  51. ldo 64(sp), sp
  52. stw rp, HPPA_FRAME_CRP(sp)
  53. /* setup fault handler */
  54. mfctl cr29, t1
  55. ldw CI_CURPROC(t1), t3
  56. ldil L%copy_on_fault, t2
  57. ldw P_ADDR(t3), r2
  58. ldo R%copy_on_fault(t2), t2
  59. ldw PCB_ONFAULT+U_PCB(r2), r1
  60. stw t2, PCB_ONFAULT+U_PCB(r2)
  61. mtsp arg0, sr1
  62. mtsp arg2, sr2
  63. comib,>=,n 15, ret0, $spcopy.byte
  64. extru arg1, 31, 2, t3
  65. extru arg3, 31, 2, t4
  66. add ret0, t4, ret0
  67. comb,<> t3, t4, $spcopy.unaligned
  68. dep r0, 31, 2, arg1
  69. addi -16, ret0, ret0
  70. $spcopy.loop16a
  71. ldws,ma 4(sr1, arg1), t1
  72. ldws,ma 4(sr1, arg1), t2
  73. ldws,ma 4(sr1, arg1), t3
  74. ldws,ma 4(sr1, arg1), t4
  75. stbys,b,m t1, 4(sr2, arg3)
  76. stws,ma t2, 4(sr2, arg3)
  77. stws,ma t3, 4(sr2, arg3)
  78. addib,>= -16, ret0, $spcopy.loop16a
  79. stws,ma t4, 4(sr2, arg3)
  80. addib,<,n 12, ret0, $spcopy.cleanup
  81. $spcopy.word
  82. ldws,ma 4(sr1, arg1), t1
  83. addib,>= -4, ret0, $spcopy.word
  84. stws,ma t1, 4(sr2, arg3)
  85. $spcopy.cleanup
  86. addib,=,n 4, ret0, $spcopy.done
  87. ldws 0(sr1, arg1), t1
  88. add arg3, ret0, arg3
  89. b $spcopy.done
  90. stbys,e t1, 0(sr2, arg3)
  91. $spcopy.unaligned
  92. sub,>= t4, t3, t2
  93. ldwm 4(sr1, arg1), ret1
  94. zdep t2, 28, 29, t1
  95. mtsar t1
  96. addi -16, ret0, ret0
  97. $spcopy.loop16u
  98. ldws,ma 4(sr1, arg1), t1
  99. ldws,ma 4(sr1, arg1), t2
  100. ldws,ma 4(sr1, arg1), t3
  101. ldws,ma 4(sr1, arg1), t4
  102. vshd ret1, t1, r31
  103. stbys,b,m r31, 4(sr2, arg3)
  104. vshd t1, t2, r31
  105. stws,ma r31, 4(sr2, arg3)
  106. vshd t2, t3, r31
  107. stws,ma r31, 4(sr2, arg3)
  108. vshd t3, t4, r31
  109. stws,ma r31, 4(sr2, arg3)
  110. addib,>= -16, ret0, $spcopy.loop16u
  111. copy t4, ret1
  112. addib,<,n 12, ret0, $spcopy.cleanup_un
  113. $spcopy.word_un
  114. ldws,ma 4(sr1, arg1), t1
  115. vshd ret1, t1, t2
  116. addib,< -4, ret0, $spcopy.cleanup1_un
  117. stws,ma t2, 4(sr2, arg3)
  118. ldws,ma 4(sr1, arg1), ret1
  119. vshd t1, ret1, t2
  120. addib,>= -4, ret0, $spcopy.word_un
  121. stws,ma t2, 4(sr2, arg3)
  122. $spcopy.cleanup_un
  123. addib,<=,n 4, ret0, $spcopy.done
  124. mfctl sar, t4
  125. add arg3, ret0, arg3
  126. extru t4, 28, 2, t4
  127. sub,<= ret0, t4, r0
  128. ldws,ma 4(sr1, arg1), t1
  129. vshd ret1, t1, t2
  130. b $spcopy.done
  131. stbys,e t2, 0(sr2, arg3)
  132. $spcopy.cleanup1_un
  133. b $spcopy.cleanup_un
  134. copy t1, ret1
  135. $spcopy.byte
  136. comb,>=,n r0, ret0, $spcopy.done
  137. $spcopy.byte_loop
  138. ldbs,ma 1(sr1, arg1), t1
  139. addib,<> -1, ret0, $spcopy.byte_loop
  140. stbs,ma t1, 1(sr2, arg3)
  141. $spcopy.done
  142. mtsp r0, sr1
  143. mtsp r0, sr2
  144. /* reset fault handler */
  145. stw r1, PCB_ONFAULT+U_PCB(r2)
  146. ldw HPPA_FRAME_CRP(sp), rp
  147. ldo -64(sp), sp
  148. bv 0(rp)
  149. copy r0, ret0
  150. EXIT(spcopy)
  151. #endif
  152. .end