aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/lib/sstep.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/lib/sstep.c')
-rw-r--r--arch/powerpc/lib/sstep.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index fb9f58b868e7..5e8418c28bd8 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -944,9 +944,9 @@ NOKPROBE_SYMBOL(emulate_dcbz);
944 : "r" (addr), "i" (-EFAULT), "0" (err)) 944 : "r" (addr), "i" (-EFAULT), "0" (err))
945 945
946static nokprobe_inline void set_cr0(const struct pt_regs *regs, 946static nokprobe_inline void set_cr0(const struct pt_regs *regs,
947 struct instruction_op *op, int rd) 947 struct instruction_op *op)
948{ 948{
949 long val = regs->gpr[rd]; 949 long val = op->val;
950 950
951 op->type |= SETCC; 951 op->type |= SETCC;
952 op->ccval = (regs->ccr & 0x0fffffff) | ((regs->xer >> 3) & 0x10000000); 952 op->ccval = (regs->ccr & 0x0fffffff) | ((regs->xer >> 3) & 0x10000000);
@@ -1326,7 +1326,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
1326 case 13: /* addic. */ 1326 case 13: /* addic. */
1327 imm = (short) instr; 1327 imm = (short) instr;
1328 add_with_carry(regs, op, rd, regs->gpr[ra], imm, 0); 1328 add_with_carry(regs, op, rd, regs->gpr[ra], imm, 0);
1329 set_cr0(regs, op, rd); 1329 set_cr0(regs, op);
1330 return 1; 1330 return 1;
1331 1331
1332 case 14: /* addi */ 1332 case 14: /* addi */
@@ -1397,13 +1397,13 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
1397 1397
1398 case 28: /* andi. */ 1398 case 28: /* andi. */
1399 op->val = regs->gpr[rd] & (unsigned short) instr; 1399 op->val = regs->gpr[rd] & (unsigned short) instr;
1400 set_cr0(regs, op, ra); 1400 set_cr0(regs, op);
1401 goto logical_done_nocc; 1401 goto logical_done_nocc;
1402 1402
1403 case 29: /* andis. */ 1403 case 29: /* andis. */
1404 imm = (unsigned short) instr; 1404 imm = (unsigned short) instr;
1405 op->val = regs->gpr[rd] & (imm << 16); 1405 op->val = regs->gpr[rd] & (imm << 16);
1406 set_cr0(regs, op, ra); 1406 set_cr0(regs, op);
1407 goto logical_done_nocc; 1407 goto logical_done_nocc;
1408 1408
1409#ifdef __powerpc64__ 1409#ifdef __powerpc64__
@@ -1513,10 +1513,10 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
1513 op->type = COMPUTE + SETCC; 1513 op->type = COMPUTE + SETCC;
1514 imm = 0xf0000000UL; 1514 imm = 0xf0000000UL;
1515 val = regs->gpr[rd]; 1515 val = regs->gpr[rd];
1516 op->val = regs->ccr; 1516 op->ccval = regs->ccr;
1517 for (sh = 0; sh < 8; ++sh) { 1517 for (sh = 0; sh < 8; ++sh) {
1518 if (instr & (0x80000 >> sh)) 1518 if (instr & (0x80000 >> sh))
1519 op->val = (op->val & ~imm) | 1519 op->ccval = (op->ccval & ~imm) |
1520 (val & imm); 1520 (val & imm);
1521 imm >>= 4; 1521 imm >>= 4;
1522 } 1522 }
@@ -1651,8 +1651,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
1651 goto arith_done; 1651 goto arith_done;
1652 1652
1653 case 235: /* mullw */ 1653 case 235: /* mullw */
1654 op->val = (unsigned int) regs->gpr[ra] * 1654 op->val = (long)(int) regs->gpr[ra] *
1655 (unsigned int) regs->gpr[rb]; 1655 (int) regs->gpr[rb];
1656
1656 goto arith_done; 1657 goto arith_done;
1657 1658
1658 case 266: /* add */ 1659 case 266: /* add */
@@ -2526,7 +2527,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
2526 2527
2527 logical_done: 2528 logical_done:
2528 if (instr & 1) 2529 if (instr & 1)
2529 set_cr0(regs, op, ra); 2530 set_cr0(regs, op);
2530 logical_done_nocc: 2531 logical_done_nocc:
2531 op->reg = ra; 2532 op->reg = ra;
2532 op->type |= SETREG; 2533 op->type |= SETREG;
@@ -2534,7 +2535,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
2534 2535
2535 arith_done: 2536 arith_done:
2536 if (instr & 1) 2537 if (instr & 1)
2537 set_cr0(regs, op, rd); 2538 set_cr0(regs, op);
2538 compute_done: 2539 compute_done:
2539 op->reg = rd; 2540 op->reg = rd;
2540 op->type |= SETREG; 2541 op->type |= SETREG;