All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Owens <kaos@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] fpswa logging redux
Date: Wed, 11 Dec 2002 23:07:57 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590709805546@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590709805545@msgid-missing>

On Wed, 11 Dec 2002 14:25:14 -0800, 
Jesse Barnes <jbarnes@sgi.com> wrote:
>I've recently had some requests from people running apps on our ia64
>boxes for more detailed fpswa fault information.  Currently, the ia64
>kernel will print up to a certain number of fpswa fault messages per
>tick, with ip information about where the fault came from.  The user can
>also choose to be notified of faults via a SIGFPE signal, but the
>si_info field of the siginfo structure doesn't contain enough
>information about the fault to be useful.
>
>I'd like to fully decode the information in the isr about what type of
>fault occured (whether it be a software assist fault, some sort of IEEE
>filter fault, etc.) and print it along with the ip when faults occur.
>While I'm at it, I may as well the proper SIGFPE subcode into si_info in
>case of signal delivery is selected.

I have a couple of Perl scripts for decoding isr and psr.  They read
hex values (with or without the leading 0x) from stdin and pretty print
the result.

--- 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();
	s/^0[xX]//;
	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 || $_->[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_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();
	s/^0[xX]//;
	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 || $_->[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);
	}
}



  reply	other threads:[~2002-12-11 23:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-11 22:25 [Linux-ia64] fpswa logging redux Jesse Barnes
2002-12-11 23:07 ` Keith Owens [this message]
2002-12-11 23:12 ` Jesse Barnes
2002-12-11 23:17 ` Keith Owens
2002-12-11 23:26 ` Jesse Barnes
2002-12-11 23:42 ` David Mosberger
2002-12-12 18:25 ` Jesse Barnes
2002-12-12 19:14 ` David Mosberger

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-105590709805546@msgid-missing \
    --to=kaos@sgi.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.