1#!/bin/sh 2# 3# Build a textsym file for use in the Arium ITP probe. 4# 5# 6# This file is subject to the terms and conditions of the GNU General Public 7# License. See the file "COPYING" in the main directory of this archive 8# for more details. 9# 10# Copyright (c) 2001-2003 Silicon Graphics, Inc. All rights reserved. 11# 12 13help() { 14cat <<END 15Build a WinDD "symtxt" file for use with the Arium ECM-30 probe. 16 17 Usage: $0 [<vmlinux file> [<output file>]] 18 If no input file is specified, it defaults to vmlinux. 19 If no output file name is specified, it defaults to "textsym". 20END 21exit 1 22} 23 24err () { 25 echo "ERROR - $*" >&2 26 exit 1 27} 28 29 30OPTS="H" 31while getopts "$OPTS" c ; do 32 case $c in 33 H) help;; 34 \?) help;; 35 esac 36 37done 38shift `expr $OPTIND - 1` 39 40if [ -f /usr/bin/ia64-linux-objdump ] ; then 41 OBJDUMP=${OBJDUMP:-/usr/bin/ia64-linux-objdump} 42else 43 OBJDUMP=${OBJDUMP:-objdump} 44fi 45 46LINUX=${1:-vmlinux} 47TEXTSYM=${2:-${LINUX}.sym} 48TMPSYM=${2:-${LINUX}.sym.tmp} 49trap "/bin/rm -f $TMPSYM" 0 50 51[ -f $VMLINUX ] || help 52 53$OBJDUMP -t $LINUX | egrep -v '__ks' | sort > $TMPSYM 54 55# pipe everything thru sort 56echo "TEXTSYM V1.0" >$TEXTSYM 57(cat <<END 58GLOBAL | e000000004400000 | CODE | VEC_VHPT_Translation_0000 59GLOBAL | e000000004400400 | CODE | VEC_ITLB_0400 60GLOBAL | e000000004400800 | CODE | VEC_DTLB_0800 61GLOBAL | e000000004400c00 | CODE | VEC_Alt_ITLB_0c00 62GLOBAL | e000000004401000 | CODE | VEC_Alt_DTLB_1000 63GLOBAL | e000000004401400 | CODE | VEC_Data_nested_TLB_1400 64GLOBAL | e000000004401800 | CODE | VEC_Instruction_Key_Miss_1800 65GLOBAL | e000000004401c00 | CODE | VEC_Data_Key_Miss_1c00 66GLOBAL | e000000004402000 | CODE | VEC_Dirty-bit_2000 67GLOBAL | e000000004402400 | CODE | VEC_Instruction_Access-bit_2400 68GLOBAL | e000000004402800 | CODE | VEC_Data_Access-bit_2800 69GLOBAL | e000000004402c00 | CODE | VEC_Break_instruction_2c00 70GLOBAL | e000000004403000 | CODE | VEC_External_Interrupt_3000 71GLOBAL | e000000004403400 | CODE | VEC_Reserved_3400 72GLOBAL | e000000004403800 | CODE | VEC_Reserved_3800 73GLOBAL | e000000004403c00 | CODE | VEC_Reserved_3c00 74GLOBAL | e000000004404000 | CODE | VEC_Reserved_4000 75GLOBAL | e000000004404400 | CODE | VEC_Reserved_4400 76GLOBAL | e000000004404800 | CODE | VEC_Reserved_4800 77GLOBAL | e000000004404c00 | CODE | VEC_Reserved_4c00 78GLOBAL | e000000004405000 | CODE | VEC_Page_Not_Present_5000 79GLOBAL | e000000004405100 | CODE | VEC_Key_Permission_5100 80GLOBAL | e000000004405200 | CODE | VEC_Instruction_Access_Rights_5200 81GLOBAL | e000000004405300 | CODE | VEC_Data_Access_Rights_5300 82GLOBAL | e000000004405400 | CODE | VEC_General_Exception_5400 83GLOBAL | e000000004405500 | CODE | VEC_Disabled_FP-Register_5500 84GLOBAL | e000000004405600 | CODE | VEC_Nat_Consumption_5600 85GLOBAL | e000000004405700 | CODE | VEC_Speculation_5700 86GLOBAL | e000000004405800 | CODE | VEC_Reserved_5800 87GLOBAL | e000000004405900 | CODE | VEC_Debug_5900 88GLOBAL | e000000004405a00 | CODE | VEC_Unaligned_Reference_5a00 89GLOBAL | e000000004405b00 | CODE | VEC_Unsupported_Data_Reference_5b00 90GLOBAL | e000000004405c00 | CODE | VEC_Floating-Point_Fault_5c00 91GLOBAL | e000000004405d00 | CODE | VEC_Floating_Point_Trap_5d00 92GLOBAL | e000000004405e00 | CODE | VEC_Lower_Privilege_Tranfer_Trap_5e00 93GLOBAL | e000000004405f00 | CODE | VEC_Taken_Branch_Trap_5f00 94GLOBAL | e000000004406000 | CODE | VEC_Single_Step_Trap_6000 95GLOBAL | e000000004406100 | CODE | VEC_Reserved_6100 96GLOBAL | e000000004406200 | CODE | VEC_Reserved_6200 97GLOBAL | e000000004406300 | CODE | VEC_Reserved_6300 98GLOBAL | e000000004406400 | CODE | VEC_Reserved_6400 99GLOBAL | e000000004406500 | CODE | VEC_Reserved_6500 100GLOBAL | e000000004406600 | CODE | VEC_Reserved_6600 101GLOBAL | e000000004406700 | CODE | VEC_Reserved_6700 102GLOBAL | e000000004406800 | CODE | VEC_Reserved_6800 103GLOBAL | e000000004406900 | CODE | VEC_IA-32_Exeception_6900 104GLOBAL | e000000004406a00 | CODE | VEC_IA-32_Intercept_6a00 105GLOBAL | e000000004406b00 | CODE | VEC_IA-32_Interrupt_6b00 106GLOBAL | e000000004406c00 | CODE | VEC_Reserved_6c00 107GLOBAL | e000000004406d00 | CODE | VEC_Reserved_6d00 108GLOBAL | e000000004406e00 | CODE | VEC_Reserved_6e00 109GLOBAL | e000000004406f00 | CODE | VEC_Reserved_6f00 110GLOBAL | e000000004407000 | CODE | VEC_Reserved_7000 111GLOBAL | e000000004407100 | CODE | VEC_Reserved_7100 112GLOBAL | e000000004407200 | CODE | VEC_Reserved_7200 113GLOBAL | e000000004407300 | CODE | VEC_Reserved_7300 114GLOBAL | e000000004407400 | CODE | VEC_Reserved_7400 115GLOBAL | e000000004407500 | CODE | VEC_Reserved_7500 116GLOBAL | e000000004407600 | CODE | VEC_Reserved_7600 117GLOBAL | e000000004407700 | CODE | VEC_Reserved_7700 118GLOBAL | e000000004407800 | CODE | VEC_Reserved_7800 119GLOBAL | e000000004407900 | CODE | VEC_Reserved_7900 120GLOBAL | e000000004407a00 | CODE | VEC_Reserved_7a00 121GLOBAL | e000000004407b00 | CODE | VEC_Reserved_7b00 122GLOBAL | e000000004407c00 | CODE | VEC_Reserved_7c00 123GLOBAL | e000000004407d00 | CODE | VEC_Reserved_7d00 124GLOBAL | e000000004407e00 | CODE | VEC_Reserved_7e00 125GLOBAL | e000000004407f00 | CODE | VEC_Reserved_7f00 126END 127 128 129awk ' 130/ _start$/ {start=1} 131/ start_ap$/ {start=1} 132/__start_gate_section/ {start=1} 133/^e0000000/ { 134 if ($4 == ".kdb") 135 next 136 if (start && substr($NF,1,1) != "0") { 137 type = substr($0,26,5) 138 if (type == ".text") 139 printf "GLOBAL | %s | CODE | %s\n", $1, $NF 140 else { 141 n = 0 142 s = $(NF-1) 143 while (length(s) > 0) { 144 n = n*16 + (index("0123456789abcdef", substr(s,1,1)) - 1) 145 s = substr(s,2) 146 } 147 printf "GLOBAL | %s | DATA | %s | %d\n", $1, $NF, n 148 } 149 } 150 if($NF == "_end") 151 exit 152 153} 154' $TMPSYM ) | egrep -v " __device| __vendor" | awk ' 155/GLOBAL/ { 156 print $0 157 /* 38 bits of sn2 physical addrs, need addr space bits */ 158 if (substr($0,19,1) == "4") 159 print substr($0,1,9) "3004" substr($0,20,16) "Phy_" substr($0,36) 160 else 161 print substr($0,1,9) "3005" substr($0,20,16) "Phy_" substr($0,36) 162 163} ' | sort -k3 >>$TEXTSYM 164 165N=`wc -l $TEXTSYM|awk '{print $1}'` 166echo "Generated TEXTSYM file" >&2 167echo " $LINUX --> $TEXTSYM" >&2 168echo " Found $N symbols" >&2 169