Subject: Re: [V2 PATCH 1/3] powerpc: Enable emulate_step In Little Endian Mode

From: Paul Mackerras <[email-masked]>
Date: Mon, 4 Nov 2013 13:28:35 +1100

On Thu, Oct 31, 2013 at 01:38:56PM -0500, Tom wrote:
> From: Tom Musta <[email-masked]>
> 
> This patch modifies the endian chicken switch in the single step

"Chicken switch" is IBM jargon, perhaps best avoided where possible in
commit messages.

> emulation code (emulate_step()).  The old (big endian) code bailed
> early if a load or store instruction was to be emulated in little
> endian mode.
> 
> The new code modifies the check and only bails in a cross-endian
> situation (LE mode in a kernel compiled for BE and vice verse).

The patch adds #ifdefs inside code, which is generally frowned upon
in kernel code as it can make the code flow harder to see.  Perhaps
you could do something like

	if ((regs->msr & MSR_LE) != (MSR_KERNEL & MSR_LE))

as an alternative that wouldn't require an #ifdef.  Or, define a
symbol that is 0 in a BE kernel and MSR_LE in a LE kernel, and compare
to that.

Paul.