user_anns.tcl 992 Bytes
#
# Copyright (C) 1996-1998 by the Board of Trustees
#    of Leland Stanford Junior University.
# 
# This file is part of the SimOS distribution. 
# See LICENSE file for terms of the license. 
#


proc registerUserAnns {proc tag} {
    global userAnns
    lappend userAnns($proc) $tag
    annotation disable $tag
}

proc turnOnUserAnn {proc} {
    global userAnns CPU
    if [info exists userAnns($proc)] {
        foreach tag $userAnns($proc) {
            annotation enable $tag $CPU
        }
    }
}

proc turnOffUserAnn {proc} {
    global userAnns CPU
    if [info exists userAnns($proc)] {
        foreach tag $userAnns($proc) {
            annotation disable $tag $CPU
        }
    }
}

annotation set simos enter {
    turnOnUserAnn $PID($CPU)
    turnOnUserAnn $PROCESS($CPU)
}

annotation set osEvent switchOut {
    turnOffUserAnn $PID($CPU)
    turnOffUserAnn $PROCESS($CPU)
}

annotation set osEvent switchIn {
    turnOnUserAnn $PID($CPU)
    turnOnUserAnn $PROCESS($CPU)
}