hive2.tcl 1.7 KB
#
# 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. 

# hive2.tcl -- this code should be in hive.tcl but a bug
# in the alpha tcl compiler requires that it be in another file.
#
# Specifically, the alpha compiler translates names to bindings
# when it firsts reads the file but neglects to invalidate the bindings
# when the rename occurs.  Therefore using 'annotation' after
# the rename in hive.tcl gets the wrong function.


if {$PARAM(HIVE.NumCells) > 1} {

    proc loadImageHelper {namep start len} {
	global kernelNames

	# NOTE:
	# Hive thinks the kernels are named u0, u1, etc. so we're
	# translating here to what the user wishes the kernels to
	# be named.
	#
	set hiveName [symbol read "kernel::(char*)$namep"]
	regsub {[^0-9]} $hiveName {} hiveIndex
	set kernName [lindex $kernelNames $hiveIndex] 

	if {$kernName == ""} {
	    console "error: bad kernel $hiveName in loadImageHelper\n"
	    exit
	}
	
	return [hive loadimage $kernName $start $len]
    }

    annotation set pc kernel::SimosLoadImage:LoadImageDoit {
	# a0 - pointer to image name
	# a1 - pointer to start address of range
	# a2 - length of range (max. image size)
	set v0 [loadImageHelper $a0 $a1 $a2]
    }

    annotation set pc kernel::SimosLaunchSlave:LaunchSlaveDoit {
	# a0 - CPU number of first CPU in slave cell
	# a1 - image entry address
	# a2 - argv pointer
	# a3 - environ pointer (or 0)
	set v0 [hive launchslave $a0 $a1 $a2 $a3]
    }

    annotation set pc kernel::SimosResetCPUs:ResetCPUsDoit {
	# a0 - CPU number of first CPU to reset
	# a1 - last CPU to reset
	set v0 [hive resetcpus $a0 $a1]
    }

}