home *** CD-ROM | disk | FTP | other *** search
- .title prf
- .ident /v1.0/
- .sbttl image section $code
- .psect $code,con,rel,novec,rd,nowrt,exe,pic,lcl,shr,long
- ; this entry point is never used. It is here to give a name to the routine
- ; that the profiler will see
- .entry __mcount_overhead,^M<R2>
- ;mcount::
- ; pushl 16(fp) ; the PC of the routine that called the routine we just
- ; ; came from. (Whew!)
- ; pushl 4(SP) ; the PC of the routine we just came from
- ; ; the 4 offset is due to the fact that we just pushed
- ; pushl R0 ; and the addr of the count location
- ; calls s^#3,_mcount
- ; rsb
- ;
- ;
- ; This version is written to work as a jsb routine. This is done for speed,
- ; since the calls overhead can be quite significant. I do, however, inject a
- ; note of sanity here - if this is the first time through for this routine,
- ; we call the C version, which will set up R0 to point to the struct containing
- ; info for the function.
- ;
- ; We also check to see if the "called from" block has been allocated. If this
- ; has not been done, we also call the C version
- mcount::
- tstl (r0)
- beql USE_C1
- pushl r0
- movl (r0),r0 ;get address of function block
- movl 24(r0),r1 ; get where element of struct...
- beql USE_C ; is there a where block pointed to???
- pushl r3 ; don't trash callers R3 -- ERD/EVL 13jul92
- L5:
- movl 12(r1),r3
- cmpl 16(r3),16(fp) ; check start address
- bgtru L4
- cmpl 20(r3),16(fp) ; and end address.
- bgequ DO_LCL
- L4:
- movl (r1),r1 ;Not this routine. Try next one.
- bneq L5 ;Is there another called from block in chain??
- popl r3 ;restore callers R3 -- ERD/EVL 13jul92
- ;
- ; Go here if we use the C version. This is required if one of the pointers
- ; to the structs is not set up, the C version can allocate the struct.
- ; Since this is only called once for each caller-called pair, efficiency is
- ; not quite as important.
- ;
- USE_C:
- popl r0 ;Restore R0 - this will be used by C version.
- USE_C1:
- pushl 16(fp)
- pushl 4(sp)
- pushl r0
- calls s^#3,_mcount
- rsb
-
- ; Locally increment counters. No calls are required.
- DO_LCL:
- incl 4(r0) ;increment count for routine
- incl 4(r1) ;and increment count for called from
- ;
- ;
- ; movl #200,r0 ;test to add some more time to this routine
- ;test: decl r0
- ; bneq test
- ;
- popl r3 ;restore callers R3 -- ERD/EVL 13jul92
- popl r0 ;restore stack
- rsb
- ;
- ;
- ;
- ; this entry point is used by the timer. This is called as an AST routine
- ; by VMS, and the PC is the fourth argument. To find the PC of the routine
- ; that called the routine, we look at the FP to find the FP where that PC is
- ; saved.
- ;
- .entry ___time_tick,^M<R2>
- movl 12(fp),r0 ;get FP from AST handler (i.e. skip 1 call frame)
- pushl 16(r0) ;PC that called routine that was interrupted
- pushl 16(ap) ; PC that was interrupted (passed from AST handler)
- calls s^#1,___ast_routine
- ret
- .end
-