spcopy.S 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /* This is a generated file. DO NOT EDIT. */
  2. /*
  3. * Generated from:
  4. *
  5. * OpenBSD: bcopy.m4
  6. */
  7. /*
  8. * Copyright (c) 1999,2004 Michael Shalayeff
  9. * All rights reserved.
  10. *
  11. * Permission to use, copy, modify, and distribute this software for any
  12. * purpose with or without fee is hereby granted, provided that the above
  13. * copyright notice and this permission notice appear in all copies.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  16. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  18. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  19. * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
  20. * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  21. * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  22. */
  23. #undef _LOCORE
  24. #define _LOCORE
  25. #include <machine/asm.h>
  26. #include <machine/frame.h>
  27. #ifdef _KERNEL
  28. #include <assym.h>
  29. /*
  30. * int spcopy (pa_space_t ssp, const void *src, pa_space_t dsp, void *dst,
  31. * size_t size)
  32. * do a space to space bcopy.
  33. *
  34. * assumes that spaces do not clash, otherwise we lose
  35. */
  36. .import copy_on_fault, code
  37. LEAF_ENTRY(spcopy)
  38. sub,*<> %r0, arg4, %r0
  39. bv %r0(%rp)
  40. nop
  41. std %rp, HPPA_FRAME_RP(%sp)
  42. ldo HPPA_FRAME_SIZE(%sp), %sp
  43. /* setup fault handler */
  44. mfctl %cr24, %r1
  45. ldd CI_CURPROC(%r1), %r1
  46. ldil L%copy_on_fault, %r21
  47. ldd P_ADDR(%r1), %r2
  48. ldo R%copy_on_fault(%r21), %r21
  49. ldd PCB_ONFAULT+U_PCB(%r2), %r1
  50. std %r21, PCB_ONFAULT+U_PCB(%r2)
  51. mtsp %arg0, %sr1
  52. mtsp %arg2, %sr2
  53. copy arg4, %ret0
  54. cmpib,*>=,n 15, %ret0, $spcopy.byte
  55. extrd,u %arg1, 63, 2, %r20
  56. extrd,u %arg3, 63, 2, %r19
  57. add %ret0, %r19, %ret0
  58. cmpb,*<> %r20, %r19, $spcopy.unaligned
  59. depd %r0, 63, 2, %arg1
  60. addi -16, %ret0, %ret0
  61. $spcopy.loop16a
  62. ldw 32(%sr1, %arg1), %r0
  63. ldw,ma 4(%sr1, %arg1), %r22
  64. ldw,ma 4(%sr1, %arg1), %r21
  65. ldw,ma 4(%sr1, %arg1), %r20
  66. ldw,ma 4(%sr1, %arg1), %r19
  67. stby,b,m %r22, 4(%sr2, %arg3)
  68. stw,ma %r21, 4(%sr2, %arg3)
  69. stw,ma %r20, 4(%sr2, %arg3)
  70. addib,*>= -16, %ret0, $spcopy.loop16a
  71. stw,ma %r19, 4(%sr2, %arg3)
  72. addib,*<,n 12, %ret0, $spcopy.cleanup
  73. $spcopy.word
  74. ldw,ma 4(%sr1, %arg1), %r22
  75. addib,*>= -4, %ret0, $spcopy.word
  76. stw,ma %r22, 4(%sr2, %arg3)
  77. $spcopy.cleanup
  78. addib,*=,n 4, %ret0, $spcopy.done
  79. ldw 0(%sr1, %arg1), %r22
  80. add %arg3, %ret0, %arg3
  81. b $spcopy.done
  82. stby,e %r22, 0(%sr2, %arg3)
  83. $spcopy.unaligned
  84. sub,*>= %r19, %r20, %r21
  85. ldw,ma 4(%sr1, %arg1), %ret1
  86. depd,z %r21, 60, 61, %r22
  87. mtsar %r22
  88. addi -16, %ret0, %ret0
  89. $spcopy.loop16u
  90. ldw 32(%sr1, %arg1), %r0
  91. ldw,ma 4(%sr1, %arg1), %r22
  92. ldw,ma 4(%sr1, %arg1), %r21
  93. ldw,ma 4(%sr1, %arg1), %r20
  94. ldw,ma 4(%sr1, %arg1), %r19
  95. shrpw %ret1, %r22, %sar, %r31
  96. stby,b,m %r31, 4(%sr2, %arg3)
  97. shrpw %r22, %r21, %sar, %r31
  98. stw,ma %r31, 4(%sr2, %arg3)
  99. shrpw %r21, %r20, %sar, %r31
  100. stw,ma %r31, 4(%sr2, %arg3)
  101. shrpw %r20, %r19, %sar, %r31
  102. stw,ma %r31, 4(%sr2, %arg3)
  103. addib,*>= -16, %ret0, $spcopy.loop16u
  104. copy %r19, %ret1
  105. addib,*<,n 12, %ret0, $spcopy.cleanup_un
  106. $spcopy.word_un
  107. ldw,ma 4(%sr1, %arg1), %r22
  108. shrpw %ret1, %r22, %sar, %r21
  109. addib,*< -4, %ret0, $spcopy.cleanup1_un
  110. stw,ma %r21, 4(%sr2, %arg3)
  111. ldw,ma 4(%sr1, %arg1), %ret1
  112. shrpw %r22, %ret1, %sar, %r21
  113. addib,*>= -4, %ret0, $spcopy.word_un
  114. stw,ma %r21, 4(%sr2, %arg3)
  115. $spcopy.cleanup_un
  116. addib,*<=,n 4, %ret0, $spcopy.done
  117. mfctl %sar, %r19
  118. add %arg3, %ret0, %arg3
  119. extrd,u %r19, 60, 2, %r19
  120. sub,*<= %ret0, %r19, %r0
  121. ldw,ma 4(%sr1, %arg1), %r22
  122. shrpw %ret1, %r22, %sar, %r21
  123. b $spcopy.done
  124. stby,e %r21, 0(%sr2, %arg3)
  125. $spcopy.cleanup1_un
  126. b $spcopy.cleanup_un
  127. copy %r22, %ret1
  128. $spcopy.byte
  129. cmpb,*>=,n %r0, %ret0, $spcopy.done
  130. $spcopy.byte_loop
  131. ldbs,ma 1(%sr1, %arg1), %r22
  132. addib,*<> -1, %ret0, $spcopy.byte_loop
  133. stbs,ma %r22, 1(%sr2, %arg3)
  134. $spcopy.done
  135. mtsp %r0, %sr1
  136. mtsp %r0, %sr2
  137. /* reset fault handler */
  138. std %r1, PCB_ONFAULT+U_PCB(%r2)
  139. ldo -HPPA_FRAME_SIZE(%sp), %sp
  140. ldd HPPA_FRAME_RP(%sp), %rp
  141. bv %r0(%rp)
  142. copy %r0, %ret0
  143. EXIT(spcopy)
  144. #endif
  145. .end