Deleted Added
full compact
locate.pl (50659) locate.pl (59874)
1#!/usr/bin/perl
1#!/usr/bin/perl
2# $FreeBSD: head/sys/pci/locate.pl 59874 2000-05-01 20:32:07Z peter $
2
3$errpos = hex($ARGV[0])/4;
4$ofs=0;
5
6open (INPUT, "cc -E ncr.c 2>/dev/null |");
7
8while ($_ = <INPUT>)
9{
10 last if /^struct script \{/;
11}
12
13while ($_ = <INPUT>)
14{
15 last if /^\}\;/;
16 ($label, $size) = /ncrcmd\s+(\S+)\s+\[([^]]+)/;
17 $size = eval($size);
18 if ($label) {
19 if ($errpos) {
20 if ($ofs + $size > $errpos) {
21 printf ("%4x: %s\n", $ofs * 4, $label);
22 printf ("%4x: %s + %d\n", $errpos * 4, $label, $errpos - $ofs);
23 last;
24 }
25 $ofs += $size;
26 } else {
27 printf ("%4x: %s\n", $ofs * 4, $label);
28 }
29 }
30}
31
3
4$errpos = hex($ARGV[0])/4;
5$ofs=0;
6
7open (INPUT, "cc -E ncr.c 2>/dev/null |");
8
9while ($_ = <INPUT>)
10{
11 last if /^struct script \{/;
12}
13
14while ($_ = <INPUT>)
15{
16 last if /^\}\;/;
17 ($label, $size) = /ncrcmd\s+(\S+)\s+\[([^]]+)/;
18 $size = eval($size);
19 if ($label) {
20 if ($errpos) {
21 if ($ofs + $size > $errpos) {
22 printf ("%4x: %s\n", $ofs * 4, $label);
23 printf ("%4x: %s + %d\n", $errpos * 4, $label, $errpos - $ofs);
24 last;
25 }
26 $ofs += $size;
27 } else {
28 printf ("%4x: %s\n", $ofs * 4, $label);
29 }
30 }
31}
32