hppa_b.s 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. ; QuickThreads -- Threads-building toolkit.
  2. ; Copyright (c) 1993 by David Keppel
  3. ; Permission to use, copy, modify and distribute this software and
  4. ; its documentation for any purpose and without fee is hereby
  5. ; granted, provided that the above copyright notice and this notice
  6. ; appear in all copies. This software is provided as a
  7. ; proof-of-concept and for demonstration purposes; there is no
  8. ; representation about the suitability of this software for any
  9. ; purpose.
  10. ; This file (pa-risc_b.s) is part of the port of QuickThreads for
  11. ; PA-RISC 1.1 architecture. It contains assembly-level support for
  12. ; raw processor performance measurement. It was written in 1994 by
  13. ; Uwe Reder (`uereder@cip.informatik.uni-erlangen.de')
  14. ; for the Operating Systems Department (IMMD4) at the
  15. ; University of Erlangen/Nuernberg Germany.
  16. ; Note that the number of instructions in the measurement-loops, differ
  17. ; from implementation to implementation. I took eight instructions in a loop
  18. ; for every test (execute eight instructions and loop to the start).
  19. .CODE
  20. .IMPORT $global$,DATA
  21. .IMPORT $$dyncall,MILLICODE
  22. .EXPORT b_call_reg
  23. .EXPORT b_call_imm
  24. .EXPORT b_add
  25. .EXPORT b_load
  26. ; Just do nothing, only return to caller. This procedure is called by
  27. ; `b_call_reg' and `b_call_imm'.
  28. b_null
  29. .PROC
  30. .CALLINFO NO_CALLS, FRAME=0
  31. .ENTRY
  32. bv,n %r0(%rp) ; just return
  33. .EXIT
  34. .PROCEND
  35. ; Call the procedure `b_null' with function pointer in a register.
  36. b_call_reg
  37. .PROC
  38. .CALLINFO CALLER, FRAME=0
  39. .ENTRY
  40. stwm %r3,64(%sp) ; store r3 (may be used by caller)
  41. stw %rp,-20(%sp) ; save return-pointer to frame-marker
  42. addil LR'to_call-$global$,%r27
  43. ldw RR'to_call-$global$(%r1),%r3
  44. _loop0
  45. copy %r3,%r22 ; copy the procedure label to r22, ...
  46. .CALL ; ...this is the input to $$dyncall
  47. bl $$dyncall,%mrp ; call $$dyncall (millicode function)
  48. copy %mrp,%rp ; remember the return-pointer
  49. copy %r3,%r22
  50. .CALL
  51. bl $$dyncall,%mrp
  52. copy %mrp,%rp
  53. copy %r3,%r22
  54. .CALL
  55. bl $$dyncall,%mrp
  56. copy %mrp,%rp
  57. copy %r3,%r22
  58. .CALL
  59. bl $$dyncall,%mrp
  60. copy %mrp,%rp
  61. copy %r3,%r22
  62. .CALL
  63. bl $$dyncall,%mrp
  64. copy %mrp,%rp
  65. copy %r3,%r22
  66. .CALL
  67. bl $$dyncall,%mrp
  68. copy %mrp,%rp
  69. copy %r3,%r22
  70. .CALL
  71. bl $$dyncall,%mrp
  72. copy %mrp,%rp
  73. copy %r3,%r22
  74. .CALL
  75. bl $$dyncall,%mrp
  76. copy %mrp,%rp
  77. addibf,<= -8,%arg0,_loop0 ; decrement counter by 8 and loop
  78. nop
  79. ldw -20(%sp),%rp ; restore return-pointer
  80. bv %r0(%rp) ; return to caller
  81. ldwm -64(%sp),%r3 ; resore r3 and remove stack frame
  82. .EXIT
  83. .PROCEND
  84. ; Call the procedure `b_null' immediate.
  85. b_call_imm
  86. .PROC
  87. .CALLINFO CALLER, FRAME=0, SAVE_RP
  88. .ENTRY
  89. ldo 64(%sp),%sp ; caller needs a stack-frame
  90. stw %rp,-20(%sp) ; save return-pointer to frame-marker
  91. _loop1
  92. bl b_null,%rp ; call `b_null' immediate (8 times)
  93. nop
  94. bl b_null,%rp
  95. nop
  96. bl b_null,%rp
  97. nop
  98. bl b_null,%rp
  99. nop
  100. bl b_null,%rp
  101. nop
  102. bl b_null,%rp
  103. nop
  104. bl b_null,%rp
  105. nop
  106. bl b_null,%rp
  107. nop
  108. addibf,<= -8,%arg0,_loop1 ; decrement counter by 8 and loop
  109. nop
  110. ldw -20(%sp),%rp ; restore return-pointer
  111. bv %r0(%rp) ; return to caller
  112. ldo -64(%sp),%sp ; remove stack-frame
  113. .EXIT
  114. .PROCEND
  115. ; Copy register-to-register.
  116. ; On PA-RISC this is implemented with an `or'.
  117. ; The `or' is hidden by a pseudo-operation called `copy'.
  118. b_add
  119. .PROC
  120. .CALLINFO NO_CALLS, FRAME=0
  121. .ENTRY
  122. _loop2
  123. copy %r19,%r20 ; copy register-to-register
  124. copy %r20,%r21 ; use caller-saves registers
  125. copy %r21,%r22
  126. copy %r22,%r21
  127. copy %r21,%r20
  128. copy %r20,%r19
  129. copy %r19,%r20
  130. copy %r20,%r21
  131. addibf,<= -8,%arg0,_loop2 ; decrement counter by 8 and loop
  132. nop
  133. bv,n %r0(%rp)
  134. .EXIT
  135. .PROCEND
  136. ; Load memory to a register.
  137. b_load
  138. .PROC
  139. .CALLINFO NO_CALLS, FRAME=0
  140. .ENTRY
  141. _loop3
  142. ldw -4(%sp),%r22 ; load data from frame-marker
  143. ldw -8(%sp),%r22 ; use a caller-saves register
  144. ldw -12(%sp),%r22
  145. ldw -16(%sp),%r22
  146. ldw -20(%sp),%r22
  147. ldw -24(%sp),%r22
  148. ldw -28(%sp),%r22
  149. ldw -32(%sp),%r22
  150. addibf,<= -8,%arg0,_loop3 ; decrement counter by 8 and loop
  151. nop
  152. bv,n %r0(%rp)
  153. .EXIT
  154. .PROCEND
  155. .ALIGN 8
  156. to_call
  157. .WORD b_null