summaryrefslogtreecommitdiffstats
path: root/sys/pci/locate.pl
diff options
context:
space:
mode:
authorse <se@FreeBSD.org>1995-09-08 19:37:11 +0000
committerse <se@FreeBSD.org>1995-09-08 19:37:11 +0000
commit39094846c89660aea0b1af673ed14609aa262641 (patch)
treec1f952f50150d48912a962c25f249ba3de0315b4 /sys/pci/locate.pl
parent28b7aad27691a6f8bbe63942a1517866e1f59826 (diff)
downloadFreeBSD-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-xsys/pci/locate.pl31
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);
+ }
+ }
+}
+
OpenPOWER on IntegriCloud