Re: [PATCH 3/4] powerpc: Rename and flesh out the facility unavailable exception handler
From: Stephen Rothwell <hidden>
Date: 2013-06-28 04:52:39
Attachments
- (unnamed) [application/pgp-signature] 836 bytes
From: Stephen Rothwell <hidden>
Date: 2013-06-28 04:52:39
Hi Michael, On Fri, 28 Jun 2013 00:16:31 +1000 Michael Ellerman [off-list ref] wrote:
On Thu, Jun 27, 2013 at 02:05:39PM +1000, Stephen Rothwell wrote:quoted
On Tue, 25 Jun 2013 17:47:56 +1000 Michael Ellerman [off-list ref] wrote:quoted
-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@canb.auug.org.au