]>
Commit | Line | Data |
---|---|---|
96f84f2b GKH |
1 | From 87c4b83e0fe234a1f0eed131ab6fa232036860d5 Mon Sep 17 00:00:00 2001 |
2 | From: Anton Blanchard <anton@samba.org> | |
3 | Date: Thu, 15 Jun 2017 09:46:38 +1000 | |
4 | Subject: powerpc: Fix emulation of mcrf in emulate_step() | |
5 | ||
6 | From: Anton Blanchard <anton@samba.org> | |
7 | ||
8 | commit 87c4b83e0fe234a1f0eed131ab6fa232036860d5 upstream. | |
9 | ||
10 | The mcrf emulation code was using the CR field number directly as the shift | |
11 | value, without taking into account that CR fields are numbered from 0-7 starting | |
12 | at the high bits. That meant it was looking at the CR fields in the reverse | |
13 | order. | |
14 | ||
15 | Fixes: cf87c3f6b647 ("powerpc: Emulate icbi, mcrf and conditional-trap instructions") | |
16 | Signed-off-by: Anton Blanchard <anton@samba.org> | |
17 | Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> | |
18 | Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> | |
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
20 | ||
21 | --- | |
22 | arch/powerpc/lib/sstep.c | 6 ++++-- | |
23 | 1 file changed, 4 insertions(+), 2 deletions(-) | |
24 | ||
25 | --- a/arch/powerpc/lib/sstep.c | |
26 | +++ b/arch/powerpc/lib/sstep.c | |
27 | @@ -687,8 +687,10 @@ int __kprobes analyse_instr(struct instr | |
28 | case 19: | |
29 | switch ((instr >> 1) & 0x3ff) { | |
30 | case 0: /* mcrf */ | |
31 | - rd = (instr >> 21) & 0x1c; | |
32 | - ra = (instr >> 16) & 0x1c; | |
33 | + rd = 7 - ((instr >> 23) & 0x7); | |
34 | + ra = 7 - ((instr >> 18) & 0x7); | |
35 | + rd *= 4; | |
36 | + ra *= 4; | |
37 | val = (regs->ccr >> ra) & 0xf; | |
38 | regs->ccr = (regs->ccr & ~(0xfUL << rd)) | (val << rd); | |
39 | goto instr_done; |