| 95 | |
| 96 | |
| 97 | static size_t ReadILOperand(LowLevelILFunction& il, |
| 98 | const Instruction& instr, |
| 99 | size_t i, |
| 100 | size_t registerSize, |
| 101 | size_t opSize = SIZE_MAX, |
| 102 | bool isAddress = false) |
| 103 | { |
| 104 | if (opSize == SIZE_MAX) |
| 105 | { |
| 106 | opSize = registerSize; |
| 107 | } |
| 108 | InstructionOperand operand = instr.operands[i - 1]; |
| 109 | switch (operand.operandClass) |
| 110 | { |
| 111 | case NONE: |
| 112 | return il.Undefined(); |
| 113 | case IMM: |
| 114 | if (isAddress) |
| 115 | return il.Operand(i - 1, il.ConstPointer(registerSize, operand.immediate)); |
| 116 | return il.Operand(i - 1, il.Const(opSize, operand.immediate)); |
| 117 | case MEM_REG: |
| 118 | case MEM_IMM: |
| 119 | return il.Operand(i - 1, il.Load(opSize, GetILOperandMemoryAddress(il, operand, registerSize))); |
| 120 | default: |
| 121 | if (operand.reg == REG_ZERO) |
| 122 | return il.Operand(i - 1, il.Const(opSize, 0)); |
| 123 | return il.Operand(i - 1, il.Register(opSize, operand.reg)); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | |
| 128 | static size_t WriteILOperand(LowLevelILFunction& il, Instruction& instr, size_t i, size_t addrSize, size_t value) |
no test coverage detected