| 171 | |
| 172 | |
| 173 | static ExprId ExtractConditionClause(LowLevelILFunction& il, uint8_t crBit, bool negate = false) |
| 174 | { |
| 175 | // MYLOG("%s() crbit:%x", __func__, crBit); |
| 176 | uint32_t flagBase = (crBit / 4) * 10; |
| 177 | |
| 178 | switch (crBit & 3) |
| 179 | { |
| 180 | case IL_FLAG_LT: |
| 181 | if (negate) return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_GE); |
| 182 | else return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_LT); |
| 183 | case IL_FLAG_GT: |
| 184 | if (negate) return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_LE); |
| 185 | else return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_GT); |
| 186 | case IL_FLAG_EQ: |
| 187 | if (negate) return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_NE); |
| 188 | else return il.FlagGroup(flagBase + IL_FLAGGROUP_CR0_EQ); |
| 189 | } |
| 190 | |
| 191 | ExprId result = il.Flag(crBit); |
| 192 | |
| 193 | if (negate) |
| 194 | result = il.Not(0, result); |
| 195 | |
| 196 | return result; |
| 197 | } |
| 198 | |
| 199 | |
| 200 | static bool LiftConditionalBranch(LowLevelILFunction& il, uint8_t bo, uint8_t bi, BNLowLevelILLabel& takenLabel, BNLowLevelILLabel& falseLabel, size_t addressSize_a=4) |
no test coverage detected