From: Peter Dinda Date: Tue, 20 Sep 2011 23:02:19 +0000 (-0500) Subject: Simple tools for analyzing palacios serial output file X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=f9880e9bc8ae1964d3c1a4ab422f4f6d7f408eba Simple tools for analyzing palacios serial output file - scan for unhandled ports - scan for guest rips and translate to guest function names --- diff --git a/utils/output_analysis/bad_ports.pl b/utils/output_analysis/bad_ports.pl new file mode 100755 index 0000000..468e698 --- /dev/null +++ b/utils/output_analysis/bad_ports.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl -w + +$#ARGV==0 or die "Finds all unique unhandled I/O ports in a palacios output file\nusage: bad_ports.pl serial.out\n"; + +open(K,shift); + +while () { + if (/: (\S+) operation on unhooked IO port 0x(\S+)/) { + $dir=$1; + $port=$2; + + $p{$port} |= ($dir eq 'IN' ? 1 : 2); + $n{$port}++; + } +} + +close(K); + +@list = sort keys %p; + +foreach $port (@list) { + print $port,"\t",$n{$port}; + if ($p{$port} & 1) { + print "\tIN"; + } + if ($p{$port} & 2) { + print "\tOUT"; + } + print "\n"; +} + diff --git a/utils/output_analysis/guest_kernel_calls.pl b/utils/output_analysis/guest_kernel_calls.pl new file mode 100755 index 0000000..07a710b --- /dev/null +++ b/utils/output_analysis/guest_kernel_calls.pl @@ -0,0 +1,65 @@ +#!/usr/bin/perl -w + +$#ARGV==0 or die "Decodes guest RIP addresses against a guest kernel dissassembly file\nThis tells you which functions in the guest kernel are being used\nusage: guest_kernel_calls.pl disassmfile < RIPS\n"; + +open(K,shift); + +@k = ; + +close(K); + +while () { + if (/RIP Linear: (\S+)/) { + $addr=$1; + chomp($addr); + print join("\t",$addr,findit($addr)),"\n"; + } +} + + +sub findit { + my $addr=shift; + my $i; + my $line=-1; + my $funcline=-1; + my $funcaddr; + my $funcname; + + if (substr($addr,0,1) eq "0") { + return "USER"; + } else { + # search forward + for ($i=0;$i<=$#k;$i++) { + if ($k[$i] =~ /^(\S+):/) { + $x=$1; + if ($x eq $addr) { + $line=$i; + last; + } + } + } + if ($line<0) { + return "CANNOT FIND IN DISASSEMBLY"; + } else { + # search backward + for ($i=$line;$i>=0;$i--) { + if ($k[$i] =~ /^(\S+)\s\<(\S+)\>:/) { + $funcline=$i; + $funcname=$2; + $funcaddr=$1; + last; + } + } + if ($funcline<0) { + return "CANNOT FIND FUNCTION IN DISASSEMBLY"; + } else { + return $funcname." at ".$funcaddr; + } + } + } +} + + + + +