mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-10 14:02:43 +00:00
Perl script to convert NCR script address into label+offset.
Useful to find the failed NCR instruction ...
This commit is contained in:
parent
ff3498c91e
commit
5e5da2da5d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10641
31
sys/pci/locate.pl
Executable file
31
sys/pci/locate.pl
Executable file
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user