1: /*
   2:  * Copyright (c) 1987 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)mch_profile.s	1.2 (2.11BSD GTE) 12/24/92
   7:  */
   8: 
   9: /*
  10:  * XXX - Current system profiling code doesn't really work with the new
  11:  * kernel.  As soon as I've figured out how I'm going to implement
  12:  * general profiling, I'll integrate it into the kernel.
  13:  *
  14:  * Casey
  15:  */
  16: 
  17: #ifdef PROF
  18: /*
  19:  * System profiler
  20:  *
  21:  * Expects to have a KW11-P in addition to the line-frequency clock, and it
  22:  * should be set to BR7.  Uses supervisor I space register 2 and 3 (040000 -
  23:  * 0100000) to maintain the profile.
  24:  */
  25: 
  26: CONST(GLOBAL, _probsiz, 040000)         / max prof pc/4 (040000 is everything)
  27: SPACE(GLOBAL, _outside, 2)              / times outside profiling range
  28: SPACE(GLOBAL, _mode, 4*4)               / what mode we're spending our time in
  29: 
  30: /*
  31:  * Process profiling clock interrupts
  32:  */
  33: ENTRY(sprof)
  34:         mov     r0,-(sp)                / snag a register for our use
  35:         mov     PS,r0                   / r0 = previous mode * 4
  36:         ash     $-10.,r0
  37:         bic     $!14,r0
  38:         add     $1,_mode+2(r0)          / mode[previous mode]++
  39:         adc     _mode(r0)
  40:         cmp     r0,$14                  / if previous made was user,
  41:         beq     2f                      /   we're done ...
  42:         mov     2(sp),r0                / r0 = (interrupted pc / 4) &~ 0140001
  43:         asr     r0
  44:         asr     r0
  45:         bic     $0140001,r0
  46:         cmp     r0,$_probsiz            / if r0 >= probsiz,
  47:         blo     1f
  48:         inc     _outside                /   outside++
  49:         br      2f                      /   and we're done
  50: 1:
  51:         mov     $010340,PS              / set previous mode to supervisor
  52: #ifdef INET
  53:         mov     SISA2, -(sp)            / save supervisor mapping
  54:         mov     SISD2, -(sp)
  55:         mov     SISA3, -(sp)
  56:         mov     SISD3, -(sp)
  57:         mov     _proloc, SISA2
  58:         mov     77406, SISD2
  59:         mov     _proloc+2, SISA3
  60:         mov     77406, SISD3
  61: #endif
  62:         mfpi    40000(r0)               /   and increment 040000[r0]
  63:         inc     (sp)                    /   (the rtt will reset the PS
  64:         mtpi    40000(r0)               /   properly)
  65: #ifdef INET
  66:         mov     (sp)+, SISD3
  67:         mov     (sp)+, SISA3
  68:         mov     (sp)+, SISD2
  69:         mov     (sp)+, SISA2
  70: #endif
  71: 2:
  72:         mov     (sp)+,r0                / restore the used register
  73:         rtt                             /   and return from the interrupt
  74: #endif PROF
Last modified: 1992-12-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1515
Valid CSS Valid XHTML 1.0 Strict