The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

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

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #!/usr/bin/perl -w
    2 # $FreeBSD: releng/10.4/sys/pci/locate.pl 62183 2000-06-27 22:41:12Z alfred $
    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 

Cache object: 0e89e43a8a4520ed47e0ffd1c9287921


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


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