From: Keith Owens <kaos@ocs.com.au>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] Script for decoding PSR in oopses
Date: Fri, 31 Jan 2003 02:10:58 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590709805785@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590709805784@msgid-missing>
On Fri, 31 Jan 2003 12:46:00 +1100,
Peter Chubb <peter@chubb.wattle.id.au> wrote:
> I find trying to work out what the PSR is after an oops to be
>a bit of a pain, so here's an awk script to do it for you.
>
>Usage is
> decode_psr hex_number
>if you save the script as decode_psr.
Below are Perl ia64_psr and ia64_isr. Run as
echo hex_number | ia64_[pi]sr
== ia64_psr =
#!/usr/bin/perl -w
use strict;
use integer;
my @fields = (
[ 0, 6, "User mask" ],
[ 0, 1, "rv" ],
[ 1, 1, "be" ],
[ 2, 1, "up" ],
[ 3, 1, "ac" ],
[ 4, 1, "mfl" ],
[ 5, 1, "mfh" ],
[ 0, 24, "System mask" ],
[ 6, 6, "rv" ],
[ 13, 1, "ic" ],
[ 14, 1, "i" ],
[ 15, 1, "pk" ],
[ 16, 1, "rv" ],
[ 17, 1, "dt" ],
[ 18, 1, "dfl" ],
[ 19, 1, "dfh" ],
[ 20, 1, "sp" ],
[ 21, 1, "pp" ],
[ 22, 1, "di" ],
[ 23, 1, "si" ],
[ 24, 1, "db" ],
[ 25, 1, "lp" ],
[ 26, 1, "tb" ],
[ 27, 1, "rt" ],
[ 28, 4, "rv" ],
[ 32, 2, "cpl" ],
[ 34, 1, "is" ],
[ 35, 1, "mc" ],
[ 36, 1, "it" ],
[ 37, 1, "id" ],
[ 38, 1, "da" ],
[ 39, 1, "dd" ],
[ 40, 1, "ss" ],
[ 41, 2, "ri" ],
[ 43, 1, "ed" ],
[ 44, 1, "bn" ],
[ 45, 1, "ia" ],
[ 46, 18, "rv" ]
);
while (defined($_ = <STDIN>)) {
chomp();
my $w0 = hex(substr($_, 0, -8));
my $w1 = hex(substr($_, -8));
printf("psr %s\n", $_);
&ia64_psr($w1, 0, 32);
&ia64_psr($w0, 32, 64);
}
sub ia64_psr()
{
my ($w, $s, $e) = @_;
my $v;
foreach (@fields) {
next if ($_->[0] >= $e);
next if ($_->[0] < $s);
# use integer implies signed shift, I want unsigned
no integer;
$v = ($w >> ($_->[0] - $s)) & (~0 >> (32 - $_->[1]));
printf("%2d %2d %12s %x\n", $_->[0], $_->[1], $_->[2], $v);
}
}
== ia64_isr =
#!/usr/bin/perl -w
use strict;
use integer;
my @fields = (
[ 0, 16, "Code" ],
[ 16, 8, "Vector" ],
[ 24, 8, "rv" ],
[ 32, 1, "x" ],
[ 33, 1, "w" ],
[ 34, 1, "r" ],
[ 35, 1, "na" ],
[ 36, 1, "sp" ],
[ 37, 1, "rs" ],
[ 39, 1, "ni" ],
[ 40, 1, "so" ],
[ 41, 2, "ei" ],
[ 43, 1, "ed" ],
[ 44, 20, "rv" ],
);
while (defined($_ = <STDIN>)) {
chomp();
my $w0 = hex(substr($_, 0, -8));
my $w1 = hex(substr($_, -8));
printf("isr %s\n", $_);
&ia64_isr($w1, 0, 32);
&ia64_isr($w0, 32, 64);
}
sub ia64_isr()
{
my ($w, $s, $e) = @_;
my $v;
foreach (@fields) {
next if ($_->[0] >= $e);
next if ($_->[0] < $s);
# use integer implies signed shift, I want unsigned
no integer;
$v = ($w >> ($_->[0] - $s)) & (~0 >> (32 - $_->[1]));
printf("%2d %2d %12s %x\n", $_->[0], $_->[1], $_->[2], $v);
}
}
next prev parent reply other threads:[~2003-01-31 2:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-31 1:46 [Linux-ia64] Script for decoding PSR in oopses Peter Chubb
2003-01-31 2:10 ` Keith Owens [this message]
2003-01-31 2:31 ` David Mosberger
2003-01-31 3:31 ` Peter Chubb
2003-01-31 4:41 ` Wichmann, Mats D
2003-01-31 4:56 ` Keith Owens
2003-01-31 5:08 ` David Mosberger
2003-01-31 20:10 ` Jim Hull
2003-02-10 5:12 ` Matt Chapman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-ia64-105590709805785@msgid-missing \
--to=kaos@ocs.com.au \
--cc=linux-ia64@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox