#!/bin/sh # # Build a textsym file for use in the Arium ITP probe. # # # This file is subject to the terms and conditions of the GNU General Public # License. See the file "COPYING" in the main directory of this archive # for more details. # # Copyright (c) 2001-2003 Silicon Graphics, Inc. All rights reserved. # help() { cat < []] If no input file is specified, it defaults to vmlinux. If no output file name is specified, it defaults to "textsym". END exit 1 } err () { echo "ERROR - $*" >&2 exit 1 } OPTS="H" while getopts "$OPTS" c ; do case $c in H) help;; \?) help;; esac done shift `expr $OPTIND - 1` #OBJDUMP=/usr/bin/ia64-linux-objdump LINUX=${1:-vmlinux} TEXTSYM=${2:-${LINUX}.sym} TMPSYM=${2:-${LINUX}.sym.tmp} trap "/bin/rm -f $TMPSYM" 0 [ -f $VMLINUX ] || help $OBJDUMP -t $LINUX | egrep -v '__ks' | sort > $TMPSYM SN1=`egrep "dig_setup|Synergy_da_indr" $TMPSYM|wc -l` # Dataprefix and textprefix correspond to the VGLOBAL_BASE and VPERNODE_BASE. # Eventually, these values should be: # dataprefix ffffffff # textprefix fffffffe # but right now they're still changing, so make them dynamic. dataprefix=`awk ' / \.data / { print substr($1, 0, 8) ; exit ; }' $TMPSYM` textprefix=`awk ' / \.text / { print substr($1, 0, 8) ; exit ; }' $TMPSYM` # pipe everything thru sort echo "TEXTSYM V1.0" (cat < 0) { n = n*16 + (index("0123456789abcdef", substr(s,1,1)) - 1) s = substr(s,2) } printf "GLOBAL | %s | DATA | %s | %d\n", $1, $NF, n } } if($NF == "_end") exit } ' $TMPSYM ) | egrep -v " __device| __vendor" | awk -v sn1="$SN1" ' /GLOBAL/ { print $0 if (sn1 != 0) { /* 32 bits of sn1 physical addrs, */ print substr($0,1,9) "04" substr($0,20,16) "Phy_" substr($0,36) } else { /* 38 bits of sn2 physical addrs, need addr space bits */ print substr($0,1,9) "3004" substr($0,20,16) "Phy_" substr($0,36) } } ' | sort -k3 N=`wc -l $TEXTSYM|awk '{print $1}'` echo "Generated TEXTSYM file" >&2 echo " $LINUX --> $TEXTSYM" >&2 echo " Found $N symbols" >&2