[PATCH 3/4] powerpc: Rename and flesh out the facility unavailable exception handler
Stephen Rothwell
sfr at canb.auug.org.au
Fri Jun 28 14:52:33 EST 2013
Hi Michael,
On Fri, 28 Jun 2013 00:16:31 +1000 Michael Ellerman <michael at ellerman.id.au> wrote:
>
> On Thu, Jun 27, 2013 at 02:05:39PM +1000, Stephen Rothwell wrote:
> >
> > On Tue, 25 Jun 2013 17:47:56 +1000 Michael Ellerman <michael at ellerman.id.au> wrote:
> > >
> > > -void tm_unavailable_exception(struct pt_regs *regs)
> > > +void facility_unavailable_exception(struct pt_regs *regs)
> > > {
> > > + static char *facility_strings[] = {
> > > + "FPU",
> > > + "VMX/VSX",
> > > + "DSCR",
> > > + "PMU SPRs",
> > > + "BHRB",
> > > + "TM",
> > > + "AT",
> > > + "EBB",
> > > + "TAR",
> > > + };
> >
> > Are the indexes into this array defined somewhere? If not, can we do
> > that. Then, can we use explicit indexed initialisers for this array?
>
> I'm not sure I follow.
>
> The mapping is defined by the definition of the "Interruption Cause"
> field of the FSCR, section 6.2.10 of PowerISA v2.07.
OK, so these numbers are externally defined:
#define FSCR_INT_CAUSE_FPU 0
...
#define FSCR_INT_CAUSE_TAR 8
(or maybe an enum)
static char *facility_strings[] = {
[ FSCR_INT_CAUSE_FPU ] = "FPU",
[ FSCR_INT_CAUSE_VMX_VSX ] = "VMX/VSX",
[ FSCR_INT_CAUSE_DSCR ] = "DSCR",
[ FSCR_INT_CAUSE_PMU_SPRs ] = "PMU SPRs",
[ FSCR_INT_CAUSE_BHRB ] = "BHRB",
[ FSCR_INT_CAUSE_TM ] = "TM",
[ FSCR_INT_CAUSE_AT ] = "AT",
[ FSCR_INT_CAUSE_EBB ] = "EBB",
[ FSCR_INT_CAUSE_TAR ] = "TAR",
};
Or something similar. Of course, then your code should cope with
facility_strings[...] being NULL. This makes it very clear that these
things are not just "made up" for your code.
--
Cheers,
Stephen Rothwell sfr at canb.auug.org.au
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20130628/a7c64c3b/attachment.sig>
More information about the Linuxppc-dev
mailing list