112027Sjungma@eit.uni-kl.de; QuickThreads -- Threads-building toolkit.
212027Sjungma@eit.uni-kl.de; Copyright (c) 1993 by David Keppel
312027Sjungma@eit.uni-kl.de
412027Sjungma@eit.uni-kl.de; Permission to use, copy, modify and distribute this software and
512027Sjungma@eit.uni-kl.de; its documentation for any purpose and without fee is hereby
612027Sjungma@eit.uni-kl.de; granted, provided that the above copyright notice and this notice
712027Sjungma@eit.uni-kl.de; appear in all copies.  This software is provided as a
812027Sjungma@eit.uni-kl.de; proof-of-concept and for demonstration purposes; there is no
912027Sjungma@eit.uni-kl.de; representation about the suitability of this software for any
1012027Sjungma@eit.uni-kl.de; purpose.
1112027Sjungma@eit.uni-kl.de
1212027Sjungma@eit.uni-kl.de; This file (pa-risc_b.s) is part of the port of QuickThreads for
1312027Sjungma@eit.uni-kl.de; PA-RISC 1.1 architecture.  It contains assembly-level support for
1412027Sjungma@eit.uni-kl.de; raw processor performance measurement.  It was written in 1994 by
1512027Sjungma@eit.uni-kl.de; Uwe Reder (`uereder@cip.informatik.uni-erlangen.de')
1612027Sjungma@eit.uni-kl.de; for the Operating Systems Department (IMMD4) at the
1712027Sjungma@eit.uni-kl.de; University of Erlangen/Nuernberg Germany.
1812027Sjungma@eit.uni-kl.de
1912027Sjungma@eit.uni-kl.de
2012027Sjungma@eit.uni-kl.de; Note that the number of instructions in the measurement-loops, differ
2112027Sjungma@eit.uni-kl.de; from implementation to implementation. I took eight instructions in a loop
2212027Sjungma@eit.uni-kl.de; for every test (execute eight instructions and loop to the start).
2312027Sjungma@eit.uni-kl.de
2412027Sjungma@eit.uni-kl.de            .CODE
2512027Sjungma@eit.uni-kl.de
2612027Sjungma@eit.uni-kl.de            .IMPORT $global$,DATA
2712027Sjungma@eit.uni-kl.de            .IMPORT $$dyncall,MILLICODE
2812027Sjungma@eit.uni-kl.de            .EXPORT b_call_reg
2912027Sjungma@eit.uni-kl.de            .EXPORT b_call_imm
3012027Sjungma@eit.uni-kl.de            .EXPORT b_add
3112027Sjungma@eit.uni-kl.de            .EXPORT b_load
3212027Sjungma@eit.uni-kl.de
3312027Sjungma@eit.uni-kl.de; Just do nothing, only return to caller. This procedure is called by
3412027Sjungma@eit.uni-kl.de; `b_call_reg' and `b_call_imm'.
3512027Sjungma@eit.uni-kl.de
3612027Sjungma@eit.uni-kl.deb_null
3712027Sjungma@eit.uni-kl.de            .PROC
3812027Sjungma@eit.uni-kl.de            .CALLINFO   NO_CALLS, FRAME=0
3912027Sjungma@eit.uni-kl.de            .ENTRY
4012027Sjungma@eit.uni-kl.de
4112027Sjungma@eit.uni-kl.de            bv,n        %r0(%rp)        ; just return
4212027Sjungma@eit.uni-kl.de
4312027Sjungma@eit.uni-kl.de            .EXIT
4412027Sjungma@eit.uni-kl.de            .PROCEND
4512027Sjungma@eit.uni-kl.de
4612027Sjungma@eit.uni-kl.de; Call the procedure `b_null' with function pointer in a register.
4712027Sjungma@eit.uni-kl.de
4812027Sjungma@eit.uni-kl.deb_call_reg
4912027Sjungma@eit.uni-kl.de            .PROC
5012027Sjungma@eit.uni-kl.de            .CALLINFO   CALLER, FRAME=0
5112027Sjungma@eit.uni-kl.de            .ENTRY
5212027Sjungma@eit.uni-kl.de
5312027Sjungma@eit.uni-kl.de            stwm        %r3,64(%sp)     ; store r3 (may be used by caller)
5412027Sjungma@eit.uni-kl.de            stw         %rp,-20(%sp)    ; save return-pointer to frame-marker
5512027Sjungma@eit.uni-kl.de
5612027Sjungma@eit.uni-kl.de            addil       LR'to_call-$global$,%r27
5712027Sjungma@eit.uni-kl.de            ldw         RR'to_call-$global$(%r1),%r3
5812027Sjungma@eit.uni-kl.de
5912027Sjungma@eit.uni-kl.de_loop0
6012027Sjungma@eit.uni-kl.de            copy        %r3,%r22        ; copy the procedure label to r22, ...
6112027Sjungma@eit.uni-kl.de            .CALL                       ; ...this is the input to $$dyncall
6212027Sjungma@eit.uni-kl.de            bl          $$dyncall,%mrp  ; call $$dyncall (millicode function)
6312027Sjungma@eit.uni-kl.de            copy        %mrp,%rp        ; remember the return-pointer
6412027Sjungma@eit.uni-kl.de
6512027Sjungma@eit.uni-kl.de            copy        %r3,%r22
6612027Sjungma@eit.uni-kl.de            .CALL
6712027Sjungma@eit.uni-kl.de            bl          $$dyncall,%mrp
6812027Sjungma@eit.uni-kl.de            copy        %mrp,%rp
6912027Sjungma@eit.uni-kl.de
7012027Sjungma@eit.uni-kl.de            copy        %r3,%r22
7112027Sjungma@eit.uni-kl.de            .CALL
7212027Sjungma@eit.uni-kl.de            bl          $$dyncall,%mrp
7312027Sjungma@eit.uni-kl.de            copy        %mrp,%rp
7412027Sjungma@eit.uni-kl.de
7512027Sjungma@eit.uni-kl.de            copy        %r3,%r22
7612027Sjungma@eit.uni-kl.de            .CALL
7712027Sjungma@eit.uni-kl.de            bl          $$dyncall,%mrp
7812027Sjungma@eit.uni-kl.de            copy        %mrp,%rp
7912027Sjungma@eit.uni-kl.de
8012027Sjungma@eit.uni-kl.de            copy        %r3,%r22
8112027Sjungma@eit.uni-kl.de            .CALL
8212027Sjungma@eit.uni-kl.de            bl          $$dyncall,%mrp
8312027Sjungma@eit.uni-kl.de            copy        %mrp,%rp
8412027Sjungma@eit.uni-kl.de
8512027Sjungma@eit.uni-kl.de            copy        %r3,%r22
8612027Sjungma@eit.uni-kl.de            .CALL
8712027Sjungma@eit.uni-kl.de            bl          $$dyncall,%mrp
8812027Sjungma@eit.uni-kl.de            copy        %mrp,%rp
8912027Sjungma@eit.uni-kl.de
9012027Sjungma@eit.uni-kl.de            copy        %r3,%r22
9112027Sjungma@eit.uni-kl.de            .CALL
9212027Sjungma@eit.uni-kl.de            bl          $$dyncall,%mrp
9312027Sjungma@eit.uni-kl.de            copy        %mrp,%rp
9412027Sjungma@eit.uni-kl.de
9512027Sjungma@eit.uni-kl.de            copy        %r3,%r22
9612027Sjungma@eit.uni-kl.de            .CALL
9712027Sjungma@eit.uni-kl.de            bl          $$dyncall,%mrp
9812027Sjungma@eit.uni-kl.de            copy        %mrp,%rp
9912027Sjungma@eit.uni-kl.de
10012027Sjungma@eit.uni-kl.de            addibf,<=   -8,%arg0,_loop0 ; decrement counter by 8 and loop
10112027Sjungma@eit.uni-kl.de            nop
10212027Sjungma@eit.uni-kl.de
10312027Sjungma@eit.uni-kl.de            ldw         -20(%sp),%rp    ; restore return-pointer
10412027Sjungma@eit.uni-kl.de            bv          %r0(%rp)        ; return to caller
10512027Sjungma@eit.uni-kl.de            ldwm        -64(%sp),%r3    ; resore r3 and remove stack frame
10612027Sjungma@eit.uni-kl.de
10712027Sjungma@eit.uni-kl.de            .EXIT
10812027Sjungma@eit.uni-kl.de            .PROCEND
10912027Sjungma@eit.uni-kl.de
11012027Sjungma@eit.uni-kl.de; Call the procedure `b_null' immediate.
11112027Sjungma@eit.uni-kl.de
11212027Sjungma@eit.uni-kl.deb_call_imm
11312027Sjungma@eit.uni-kl.de            .PROC
11412027Sjungma@eit.uni-kl.de            .CALLINFO   CALLER, FRAME=0, SAVE_RP
11512027Sjungma@eit.uni-kl.de            .ENTRY
11612027Sjungma@eit.uni-kl.de
11712027Sjungma@eit.uni-kl.de            ldo         64(%sp),%sp     ; caller needs a stack-frame
11812027Sjungma@eit.uni-kl.de            stw         %rp,-20(%sp)    ; save return-pointer to frame-marker
11912027Sjungma@eit.uni-kl.de
12012027Sjungma@eit.uni-kl.de_loop1
12112027Sjungma@eit.uni-kl.de            bl          b_null,%rp      ; call `b_null' immediate (8 times)
12212027Sjungma@eit.uni-kl.de            nop
12312027Sjungma@eit.uni-kl.de            bl          b_null,%rp
12412027Sjungma@eit.uni-kl.de            nop
12512027Sjungma@eit.uni-kl.de            bl          b_null,%rp
12612027Sjungma@eit.uni-kl.de            nop
12712027Sjungma@eit.uni-kl.de            bl          b_null,%rp
12812027Sjungma@eit.uni-kl.de            nop
12912027Sjungma@eit.uni-kl.de            bl          b_null,%rp
13012027Sjungma@eit.uni-kl.de            nop
13112027Sjungma@eit.uni-kl.de            bl          b_null,%rp
13212027Sjungma@eit.uni-kl.de            nop
13312027Sjungma@eit.uni-kl.de            bl          b_null,%rp
13412027Sjungma@eit.uni-kl.de            nop
13512027Sjungma@eit.uni-kl.de            bl          b_null,%rp
13612027Sjungma@eit.uni-kl.de            nop
13712027Sjungma@eit.uni-kl.de
13812027Sjungma@eit.uni-kl.de            addibf,<=   -8,%arg0,_loop1 ; decrement counter by 8 and loop
13912027Sjungma@eit.uni-kl.de            nop
14012027Sjungma@eit.uni-kl.de
14112027Sjungma@eit.uni-kl.de            ldw         -20(%sp),%rp    ; restore return-pointer
14212027Sjungma@eit.uni-kl.de            bv          %r0(%rp)        ; return to caller
14312027Sjungma@eit.uni-kl.de            ldo         -64(%sp),%sp    ; remove stack-frame
14412027Sjungma@eit.uni-kl.de
14512027Sjungma@eit.uni-kl.de            .EXIT
14612027Sjungma@eit.uni-kl.de            .PROCEND
14712027Sjungma@eit.uni-kl.de
14812027Sjungma@eit.uni-kl.de; Copy register-to-register.
14912027Sjungma@eit.uni-kl.de; On PA-RISC this is implemented with an `or'.
15012027Sjungma@eit.uni-kl.de; The `or' is hidden by a pseudo-operation called `copy'.
15112027Sjungma@eit.uni-kl.de
15212027Sjungma@eit.uni-kl.deb_add
15312027Sjungma@eit.uni-kl.de            .PROC
15412027Sjungma@eit.uni-kl.de            .CALLINFO   NO_CALLS, FRAME=0
15512027Sjungma@eit.uni-kl.de            .ENTRY
15612027Sjungma@eit.uni-kl.de
15712027Sjungma@eit.uni-kl.de_loop2
15812027Sjungma@eit.uni-kl.de            copy        %r19,%r20       ; copy register-to-register
15912027Sjungma@eit.uni-kl.de            copy        %r20,%r21       ; use caller-saves registers
16012027Sjungma@eit.uni-kl.de            copy        %r21,%r22
16112027Sjungma@eit.uni-kl.de            copy        %r22,%r21
16212027Sjungma@eit.uni-kl.de            copy        %r21,%r20
16312027Sjungma@eit.uni-kl.de            copy        %r20,%r19
16412027Sjungma@eit.uni-kl.de            copy        %r19,%r20
16512027Sjungma@eit.uni-kl.de            copy        %r20,%r21
16612027Sjungma@eit.uni-kl.de
16712027Sjungma@eit.uni-kl.de            addibf,<=   -8,%arg0,_loop2 ; decrement counter by 8 and loop
16812027Sjungma@eit.uni-kl.de            nop
16912027Sjungma@eit.uni-kl.de
17012027Sjungma@eit.uni-kl.de            bv,n        %r0(%rp)
17112027Sjungma@eit.uni-kl.de
17212027Sjungma@eit.uni-kl.de            .EXIT
17312027Sjungma@eit.uni-kl.de            .PROCEND
17412027Sjungma@eit.uni-kl.de
17512027Sjungma@eit.uni-kl.de; Load memory to a register.
17612027Sjungma@eit.uni-kl.de
17712027Sjungma@eit.uni-kl.deb_load
17812027Sjungma@eit.uni-kl.de            .PROC
17912027Sjungma@eit.uni-kl.de            .CALLINFO   NO_CALLS, FRAME=0
18012027Sjungma@eit.uni-kl.de            .ENTRY
18112027Sjungma@eit.uni-kl.de
18212027Sjungma@eit.uni-kl.de_loop3
18312027Sjungma@eit.uni-kl.de            ldw         -4(%sp),%r22    ; load data from frame-marker
18412027Sjungma@eit.uni-kl.de            ldw         -8(%sp),%r22    ; use a caller-saves register
18512027Sjungma@eit.uni-kl.de            ldw         -12(%sp),%r22
18612027Sjungma@eit.uni-kl.de            ldw         -16(%sp),%r22
18712027Sjungma@eit.uni-kl.de            ldw         -20(%sp),%r22
18812027Sjungma@eit.uni-kl.de            ldw         -24(%sp),%r22
18912027Sjungma@eit.uni-kl.de            ldw         -28(%sp),%r22
19012027Sjungma@eit.uni-kl.de            ldw         -32(%sp),%r22
19112027Sjungma@eit.uni-kl.de
19212027Sjungma@eit.uni-kl.de            addibf,<=   -8,%arg0,_loop3 ; decrement counter by 8 and loop
19312027Sjungma@eit.uni-kl.de            nop
19412027Sjungma@eit.uni-kl.de
19512027Sjungma@eit.uni-kl.de            bv,n        %r0(%rp)
19612027Sjungma@eit.uni-kl.de
19712027Sjungma@eit.uni-kl.de            .EXIT
19812027Sjungma@eit.uni-kl.de            .PROCEND
19912027Sjungma@eit.uni-kl.de
20012027Sjungma@eit.uni-kl.de
20112027Sjungma@eit.uni-kl.de            .ALIGN 8
20212027Sjungma@eit.uni-kl.deto_call
20312027Sjungma@eit.uni-kl.de            .WORD       b_null
204