Thread (11 messages) flat view 11 messages, 3 authors, 2017-08-23

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

From: Michael Neuling <hidden>
Date: 2017-08-23 09:23:55

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.
=20
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.=C2=A0=C2=A0A companion function called emulate_update_regs() c=
an
then use that information to update a pt_regs struct appropriately.
=20
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 po=
werpc
next.  In fact, the new instructions added there need to have these changes
applied.

Mikey
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help