diff options
author | se <se@FreeBSD.org> | 1995-09-08 19:37:11 +0000 |
---|---|---|
committer | se <se@FreeBSD.org> | 1995-09-08 19:37:11 +0000 |
commit | 39094846c89660aea0b1af673ed14609aa262641 (patch) | |
tree | c1f952f50150d48912a962c25f249ba3de0315b4 /sys/pci/locate.pl | |
parent | 28b7aad27691a6f8bbe63942a1517866e1f59826 (diff) | |
download | FreeBSD-src-39094846c89660aea0b1af673ed14609aa262641.zip FreeBSD-src-39094846c89660aea0b1af673ed14609aa262641.tar.gz |
Perl script to convert NCR script address into label+offset.
Useful to find the failed NCR instruction ...
Diffstat (limited to 'sys/pci/locate.pl')
-rwxr-xr-x | sys/pci/locate.pl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/pci/locate.pl b/sys/pci/locate.pl new file mode 100755 index 0000000..5fcb5d9 --- /dev/null +++ b/sys/pci/locate.pl @@ -0,0 +1,31 @@ +#!/usr/local/bin/perl + +$errpos = hex($ARGV[0])/4; +$ofs=0; + +open (INPUT, "cc -E ncr.c 2>/dev/null |"); + +while ($_ = <INPUT>) +{ + last if /^struct script \{/; +} + +while ($_ = <INPUT>) +{ + last if /^\}\;/; + ($label, $size) = /ncrcmd\s+(\S+)\s+\[([^]]+)/; + $size = eval($size); + if ($label) { + if ($errpos) { + if ($ofs + $size > $errpos) { + printf ("%4x: %s\n", $ofs * 4, $label); + printf ("%4x: %s + %d\n", $errpos * 4, $label, $errpos - $ofs); + last; + } + $ofs += $size; + } else { + printf ("%4x: %s\n", $ofs * 4, $label); + } + } +} + |