From: Peter Chubb <peter@chubb.wattle.id.au>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] Script for decoding PSR in oopses
Date: Fri, 31 Jan 2003 01:46:00 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590709805784@msgid-missing> (raw)
[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 204 bytes --]
hi,
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.
[-- Attachment #2: decode_psr --]
[-- Type: text/plain, Size: 2821 bytes --]
#!/bin/sh
echo $1 | awk '
function readhex(hexval, i, digits, value, ndigit) {
tolower(hexval);
ndigit = gsub("[a-f0-9]", " &", hexval);
split(hexval, digits, " ");
value = 0;
for ( i = 1; i <= ndigit; i++) {
value *= 16;
value += values[digits[i]];
}
return value;
}
function decode_psr(psr, decoded, cpl) {
psr = int(psr / 2);
if (psr % 2 == 1)
decoded = "be "
psr = int(psr / 2);
if (psr % 2 == 1)
decoded = decoded "up "
psr = int(psr / 2);
if (psr % 2 == 1)
decoded = decoded "ac "
psr = int(psr / 2);
if (psr % 2 == 1)
decoded = decoded "mfl "
psr = int(psr / 2);
if (psr % 2 == 1)
decoded = decoded "mfh "
psr = int(psr / 256);
if (psr % 2)
decoded = decoded "ic "
psr = int(psr / 2);
if (psr % 2 == 1)
decoded = decoded "i "
psr = int(psr / 2);
if (psr % 2 == 1)
decoded = decoded "pk "
psr = int(psr / 4)
if (psr % 2 == 1)
decoded = decoded "dt "
psr = int(psr / 2)
if (psr % 2 == 1)
decoded = decoded "dfl "
psr = int(psr / 2)
if (psr % 2 == 1)
decoded = decoded "dfh "
psr = int(psr / 2)
if (psr % 2 == 1)
decoded = decoded "sp "
psr = int(psr / 2)
if (psr % 2 == 1)
decoded = decoded "pp "
psr = int(psr / 2)
if (psr % 2 == 1)
decoded = decoded "di "
psr = int(psr / 2)
if (psr % 2 == 1)
decoded = decoded "si "
psr = int(psr / 2)
if (psr % 2 == 1)
decoded = decoded "db "
psr = int(psr / 2)
if (psr % 2 == 1)
decoded = decoded "lb "
psr = int(psr / 2)
if (psr % 2 == 1)
decoded = decoded "tb "
psr = int(psr / 2)
if (psr % 2 == 1)
decoded = decoded "rt "
psr = int(psr / 16)
cpl = psr % 4;
decoded = decoded "cpl=" cpl " "
psr = int(psr/4)
if (psr % 2)
decoded = decoded "IA32 "
psr = int(psr / 2)
if (psr % 2)
decoded = decoded "mc "
psr = int(psr / 2)
if (psr % 2)
decoded = decoded "it "
psr = int(psr / 2)
if (psr % 2)
decoded = decoded "id "
psr = int(psr / 2)
if (psr % 2)
decoded = decoded "da "
psr = int(psr / 2)
if (psr % 2)
decoded = decoded "dd "
psr = int(psr / 2)
if (psr % 2)
decoded = decoded "ss "
psr = int(psr / 2)
cpl = psr %4
decoded= decoded "ri=" cpl " "
psr = int(psr / 4)
if (psr % 2)
decoded = decoded "ed "
psr = int(psr / 2)
if (psr % 2)
decoded = decoded "bn"
psr = int(psr / 2)
if (psr % 2)
decoded = decoded "ia"
psr = int(psr / 2)
if (psr)
decoded = decoded "Reserved = " psr
return decoded
}
BEGIN {
for (i = 0; i < 10; i++)
values[i ""] = i;
values["a"] = 10;
values["b"] = 11;
values["c"] = 12;
values["d"] = 13;
values["e"] = 14;
values["f"] = 15;
}
{ print $1, decode_psr(readhex($1)) }
'
next reply other threads:[~2003-01-31 1:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-31 1:46 Peter Chubb [this message]
2003-01-31 2:10 ` [Linux-ia64] Script for decoding PSR in oopses Keith Owens
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-105590709805784@msgid-missing \
--to=peter@chubb.wattle.id.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