[PATCH RFC 2/7] powerpc: Change analyse_instr so it doesn't modify *regs

Michael Neuling mikey at neuling.org
Wed Aug 23 19:23:54 AEST 2017


On Wed, 2017-08-23 at 09:47 +1000, Paul Mackerras wrote:
> The analyse_instr function currently doesn't just work out what an
> instruction does, it also executes those instructions whose effect
> is only to update CPU registers that are stored in struct pt_regs.
> This is undesirable because optprobes uses analyse_instr to work out
> if an instruction could be successfully emulated in future.
> 
> This changes analyse_instr so it doesn't modify *regs; instead it
> stores information in the instruction_op structure to indicate what
> registers (GPRs, CR, XER, LR) would be set and what value they would
> be set to.  A companion function called emulate_update_regs() can
> then use that information to update a pt_regs struct appropriately.
> 
> As a minor cleanup, this replaces inline asm using the cntlzw and
> cntlzd instructions with calls to __builtin_clz() and __builtin_clzl().

+1 ! This is super useful!

As mentioned offline, this clashes with the recent changes to sstep.c in powerpc
next.  In fact, the new instructions added there need to have these changes
applied.

Mikey



More information about the Linuxppc-dev mailing list