[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]

FreeBSD/Linux Kernel Cross Reference
sys/pci/locate.pl

Version: -  FREEBSD  -  FREEBSD7  -  FREEBSD70  -  FREEBSD6  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  OPENSOLARIS  -  minix-3-1-1  -  TRUSTEDBSD-SEBSD  -  FREEBSD-LIBC  -  FREEBSD7-LIBC  -  FREEBSD6-LIBC  -  GLIBC27 
SearchContext: -  none  -  excerpts  -  bigexcerpts 

  1 #!/usr/bin/perl -w
  2 # $FreeBSD: src/sys/pci/locate.pl,v 1.4 2000/06/27 22:41:12 alfred Exp $
  3 
  4 use strict;
  5 
  6 if (!defined($ARGV[0])) {
  7     print(
  8 "
  9 Perl script to convert NCR script address into label+offset.
 10 Useful to find the failed NCR instruction ...
 11 
 12 usage: $0 <address>
 13 ");
 14     exit(1);
 15 }
 16 
 17 my $errpos = hex($ARGV[0])/4;
 18 my $ofs=0;
 19 
 20 open (INPUT, "cc -E ncr.c 2>/dev/null |");
 21 
 22 while ($_ = <INPUT>)
 23 {
 24     last if /^struct script \{/;
 25 }
 26 
 27 while ($_ = <INPUT>)
 28 {
 29     last if /^\}\;/;
 30     my ($label, $size) = /ncrcmd\s+(\S+)\s+\[([^]]+)/;
 31     $size = eval($size);
 32     if (defined($label) && $label) {
 33         if ($errpos) {
 34             if ($ofs + $size > $errpos) {
 35                 printf ("%4x: %s\n", $ofs * 4, $label);
 36                 printf ("%4x: %s + %d\n", $errpos * 4, $label, $errpos - $ofs);
 37                 last;
 38             }
 39             $ofs += $size;
 40         } else {
 41             printf ("%4x: %s\n", $ofs * 4, $label);
 42         }
 43     }
 44 }
 45 

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.