From 5e5da2da5d09e7c088a73599b5ee23574ab1be38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Fri, 8 Sep 1995 19:37:11 +0000 Subject: [PATCH] Perl script to convert NCR script address into label+offset. Useful to find the failed NCR instruction ... --- sys/pci/locate.pl | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 sys/pci/locate.pl diff --git a/sys/pci/locate.pl b/sys/pci/locate.pl new file mode 100755 index 000000000000..5fcb5d93b0c6 --- /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 ($_ = ) +{ + last if /^struct script \{/; +} + +while ($_ = ) +{ + 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); + } + } +} +