1 ; QuickThreads -- Threads-building toolkit.
2 ; Copyright (c) 1993 by David Keppel
4 ; Permission to use, copy, modify and distribute this software and
5 ; its documentation for any purpose and without fee is hereby
6 ; granted, provided that the above copyright notice and this notice
7 ; appear in all copies. This software is provided as a
8 ; proof-of-concept and for demonstration purposes; there is no
9 ; representation about the suitability of this software for any
12 ; This file (pa-risc_b.s) is part of the port of QuickThreads for
13 ; PA-RISC 1.1 architecture. It contains assembly-level support for
14 ; raw processor performance measurement. It was written in 1994 by
15 ; Uwe Reder (`uereder@cip.informatik.uni-erlangen.de')
16 ; for the Operating Systems Department (IMMD4) at the
17 ; University of Erlangen/Nuernberg Germany.
20 ; Note that the number of instructions in the measurement-loops, differ
21 ; from implementation to implementation. I took eight instructions in a loop
22 ; for every test (execute eight instructions and loop to the start).
27 .IMPORT $$dyncall,MILLICODE
33 ; Just do nothing, only return to caller. This procedure is called by
34 ; `b_call_reg' and `b_call_imm'.
38 .CALLINFO NO_CALLS, FRAME=0
41 bv,n %r0(%rp) ; just return
46 ; Call the procedure `b_null' with function pointer in a register.
50 .CALLINFO CALLER, FRAME=0
53 stwm %r3,64(%sp) ; store r3 (may be used by caller)
54 stw %rp,-20(%sp) ; save return-pointer to frame-marker
56 addil LR'to_call-$global$,%r27
57 ldw RR'to_call-$global$(%r1),%r3
60 copy %r3,%r22 ; copy the procedure label to r22, ...
61 .CALL ; ...this is the input to $$dyncall
62 bl $$dyncall,%mrp ; call $$dyncall (millicode function)
63 copy %mrp,%rp ; remember the return-pointer
100 addibf,<= -8,%arg0,_loop0 ; decrement counter by 8 and loop
103 ldw -20(%sp),%rp ; restore return-pointer
104 bv %r0(%rp) ; return to caller
105 ldwm -64(%sp),%r3 ; resore r3 and remove stack frame
110 ; Call the procedure `b_null' immediate.
114 .CALLINFO CALLER, FRAME=0, SAVE_RP
117 ldo 64(%sp),%sp ; caller needs a stack-frame
118 stw %rp,-20(%sp) ; save return-pointer to frame-marker
121 bl b_null,%rp ; call `b_null' immediate (8 times)
138 addibf,<= -8,%arg0,_loop1 ; decrement counter by 8 and loop
141 ldw -20(%sp),%rp ; restore return-pointer
142 bv %r0(%rp) ; return to caller
143 ldo -64(%sp),%sp ; remove stack-frame
148 ; Copy register-to-register.
149 ; On PA-RISC this is implemented with an `or'.
150 ; The `or' is hidden by a pseudo-operation called `copy'.
154 .CALLINFO NO_CALLS, FRAME=0
158 copy %r19,%r20 ; copy register-to-register
159 copy %r20,%r21 ; use caller-saves registers
167 addibf,<= -8,%arg0,_loop2 ; decrement counter by 8 and loop
175 ; Load memory to a register.
179 .CALLINFO NO_CALLS, FRAME=0
183 ldw -4(%sp),%r22 ; load data from frame-marker
184 ldw -8(%sp),%r22 ; use a caller-saves register
192 addibf,<= -8,%arg0,_loop3 ; decrement counter by 8 and loop