Skip to content

Ghidra is a software reverse engineering (SRE) framework

PowerPC: fix the condition register updates of sradi., mtfsb1. and cr1flags

Andrei Bacescu7443af41c09c
diff --git a/Ghidra/Processors/PowerPC/data/languages/ppc_common.sinc b/Ghidra/Processors/PowerPC/data/languages/ppc_common.sinc
index cbcfd2bd13..5b7c0ea9d1 100644
--- a/Ghidra/Processors/PowerPC/data/languages/ppc_common.sinc
+++ b/Ghidra/Processors/PowerPC/data/languages/ppc_common.sinc
@@ -1662,7 +1662,7 @@ macro cr1flags() {
setCrBit(cr1, 0, fp_fx);
setCrBit(cr1, 1, fp_fex);
setCrBit(cr1, 2, fp_vx);
- setCrBit(cr3, 2, fp_ox);
+ setCrBit(cr1, 3, fp_ox);
}
macro setFPRF(result) {
fp_cc0 = result f< 0;
diff --git a/Ghidra/Processors/PowerPC/data/languages/ppc_instructions.sinc b/Ghidra/Processors/PowerPC/data/languages/ppc_instructions.sinc
index 736c7cce31..5d5063698c 100644
--- a/Ghidra/Processors/PowerPC/data/languages/ppc_instructions.sinc
+++ b/Ghidra/Processors/PowerPC/data/languages/ppc_instructions.sinc
@@ -2484,6 +2484,7 @@ define pcodeop lswxOp;
:mtfsb1. CRBD is $(NOTVLE) & OP=63 & CRBD & BITS_11_20=0 & XOP_1_10=38 & Rc=1
{
CRBD = 1;
+ cr1flags();
}
#mtfsf 10,fr0 0xfc 00 05 8e
@@ -3269,6 +3270,7 @@ CRM_val: crmval is CRM [crmval = CRM+0;] {export *[const]:1 crmval;}
{
shiftCarry(S,SH);
A = S s>> SH;
+ cr0flags(A);
}
@endif