⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modes.tcl

📁 一个用在mips体系结构中的操作系统
💻 TCL
字号:
## 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. ####### modes.tcl###FileSourced modes.tclif ![info exists modesByPID] {    set modesByPID 0}timing create modeslog [timing fields]proc modesSwitch args {    global PROCESS PID CPU CELL M RUNNING_HIVE PARAM    global modesByPID    if $modesByPID {        set args [linsert $args 0 PID$PID($CPU)]    }    if [info exists RUNNING_HIVE] {        eval timing switch modes ${CELL}_$PID($CPU) cell$CELL $args    } elseif { $PARAM(MACHINE.Count) == 1 } {        eval timing switch modes $PID($CPU) $args    } else {        eval timing switch modes $M($CPU)_$PID($CPU) machine$M($CPU) $args    }}###### Initialization based on current state###annotation set simos enter {    if [inUserMode] {        modesSwitch    } elseif {$PROCESS($CPU) == "idle"} {        modesSwitch kernel idle    } elseif {($SIMOS(ISA)=="ALPHA") && ($pc & 1)} {        modesSwitch kernel pal    } else {        modesSwitch kernel    }}###### The Annotations###if {$SIMOS(ISA)=="ALPHA"} {     annotation set osEvent switchIn {        modesSwitch kernel kernel    }} else {     annotation set osEvent switchIn {        modesSwitch kernel    }}annotation set osEvent procexit {    if [info exists RUNNING_HIVE] {        timing terminate modes ${CELL}_$PID($CPU)    } elseif { $PARAM(MACHINE.Count) == 1 } {        timing terminate modes $PID($CPU)    } else {        timing terminate modes $M($CPU)_$PID($CPU)    }}proc foobar { msg } {    global CYCLES pc    if {$CYCLES > 6152856} {         log "Modes $CYCLES pc= [format %-20s $pc] top=[timing current modes] action $msg\n"    }}annotation set osEvent startKernel {    #foobar "startKernel"    timing start modes kernel}annotation set osEvent endKernel {    #foobar "endKernel"    timing end modes kernel}if {$SIMOS(ISA)=="ALPHA"} {     annotation set osEvent startPal {        #foobar startPal        timing start modes pal    }        annotation set osEvent endPal {        timing end modes pal        #foobar endPal        set cur [timing current modes]        # poped too far        if {$cur=="ROOT" && ![inUserMode]} {            #console "endPal cur=$cur exc=$IPR(0x10b) inUserMode=[inUserMode] \n"            timing start modes kernel        }            }}annotation set osEvent startIdle {    #foobar "startIdle"    if { [timing current modes] != "idle"} {	timing start modes idle    }}annotation set osEvent endIdle {    #foobar "endIdle"    timing end modes idle}annotation set osEvent startSync {    timing start modes sync}annotation set osEvent endSync {    timing end modes sync}if [info exists RUNNING_HIVE] {    annotation set osEvent startRpc {        timing start modes rpcwait    }    annotation set osEvent endRpc {        timing end modes rpcwait    }}###### Need to dump to stats ###annotation set simos periodic {    log [timing dump modes]}annotation set simos exit {    timing exit modes    log [timing dump modes]}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -