MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / GetFlagWriteLowLevelIL

Method GetFlagWriteLowLevelIL

arch/x86/arch_x86.cpp:2103–2156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2101}
2102
2103size_t X86CommonArchitecture::GetFlagWriteLowLevelIL(BNLowLevelILOperation op, size_t size, uint32_t flagWriteType,
2104 uint32_t flag, BNRegisterOrConstant* operands, size_t operandCount, LowLevelILFunction& il)
2105{
2106 switch (op)
2107 {
2108 case LLIL_NEG:
2109 switch (flag)
2110 {
2111 case IL_FLAG_O:
2112 return il.AddExpr(LLIL_CMP_E, size, 0, il.GetExprForRegisterOrConstantOperation(op, size, operands, operandCount),
2113 il.AddExpr(LLIL_CONST, size, 0, (1LL << ((size * 8) - 1))));
2114 }
2115 break;
2116 case LLIL_XOR:
2117 case LLIL_AND:
2118 case LLIL_OR:
2119 switch (flag)
2120 {
2121 case IL_FLAG_C:
2122 case IL_FLAG_O:
2123 return il.Const(0, 0);
2124 case IL_FLAG_A:
2125 return il.Undefined();
2126 }
2127 break;
2128 case LLIL_MULU_DP:
2129 switch (flag)
2130 {
2131 case IL_FLAG_C:
2132 case IL_FLAG_O:
2133 return il.AddExpr(LLIL_CMP_NE, size * 2, 0, il.AddExpr(LLIL_LSR, size * 2, 0,
2134 il.GetExprForRegisterOrConstantOperation(op, size, operands, operandCount),
2135 il.AddExpr(LLIL_CONST, 1, 0, size * 8)), il.AddExpr(LLIL_CONST, size * 2, 0, 0));
2136 }
2137 default:
2138 break;
2139 }
2140
2141 if (flagWriteType == IL_FLAGWRITE_VCOMI)
2142 {
2143 switch (flag)
2144 {
2145 case IL_FLAG_S:
2146 case IL_FLAG_O:
2147 case IL_FLAG_A:
2148 return il.Const(0, 0);
2149 default:
2150 break;
2151 }
2152 }
2153 if (((flagWriteType == IL_FLAGWRITE_X87COM) || (flagWriteType == IL_FLAGWRITE_X87C1Z)) && (flag == IL_FLAG_C1))
2154 return il.Const(0, 0);
2155 return Architecture::GetFlagWriteLowLevelIL(op, size, flagWriteType, flag, operands, operandCount, il);
2156}
2157
2158size_t X86CommonArchitecture::GetSemanticFlagGroupLowLevelIL(uint32_t semGroup, LowLevelILFunction& il)
2159{

Callers

nothing calls this directly

Calls 4

AddExprMethod · 0.45
ConstMethod · 0.45
UndefinedMethod · 0.45

Tested by

no test coverage detected