Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-3999: Reformatted sleigh for ppc vlee_rlwi(nm/mi) instructions

ghidorahrexc497b8a52b1f
diff --git a/Ghidra/Processors/PowerPC/data/languages/ppc_vle.sinc b/Ghidra/Processors/PowerPC/data/languages/ppc_vle.sinc
index 19915ce500..f57d1d94bf 100644
--- a/Ghidra/Processors/PowerPC/data/languages/ppc_vle.sinc
+++ b/Ghidra/Processors/PowerPC/data/languages/ppc_vle.sinc
@@ -813,7 +813,7 @@ IMM16B: val is IMM_0_10_VLE & IMM_16_20_VLE [ val = (IMM_16_20_VLE << 11) |
cr0flags(A);
}
-# The manual uses MB instead of NB here, but because the "MB" symbol is already taken, NB it is
+# The manual uses MB instead of MBL here, but because the "MB" symbol is already taken, MBL it is
:e_rlwimi A,S,SHL,MBL,ME is $(ISVLE) & OP=29 & BIT_0=0 & MBL & ME & A & SHL & S {
tmpS:4 = S:4;
tmpA:4 = (tmpS << SHL) | (tmpS >> (32 - SHL));
@@ -827,7 +827,8 @@ IMM16B: val is IMM_0_10_VLE & IMM_16_20_VLE [ val = (IMM_16_20_VLE << 11) |
tmpM2 = tmpM2 << (31-MBL);
tmpM2 = ~tmpM2;
- tmpM = zext(ME:1 >= MBL:1)*tmpM1 + zext(ME:1 < MBL:1)*tmpM2;
+ local invert = (ME:1 < MBL:1);
+ tmpM = (zext(invert == 0)*tmpM1) + (zext(invert == 1)*tmpM2);
A = zext(tmpA & tmpM) | (A & zext(~tmpM));
}
@@ -844,7 +845,8 @@ IMM16B: val is IMM_0_10_VLE & IMM_16_20_VLE [ val = (IMM_16_20_VLE << 11) |
tmpM2 = tmpM2 << (31-MBL);
tmpM2 = ~tmpM2;
- tmpM = zext(ME:1 >= MBL:1)*tmpM1 + zext(ME:1 < MBL:1)*tmpM2;
+ local invert = (ME:1 < MBL:1);
+ tmpM = (zext(invert == 0)*tmpM1) + (zext(invert == 1)*tmpM2);
A = zext(tmpA & tmpM);
}