| 135 | //----------------------------------------------------------------------------- |
| 136 | |
| 137 | static inline uint32_t get_shifted_register( |
| 138 | const InstructionOperand *operand, |
| 139 | uint32_t registerNumber, |
| 140 | char *outBuffer, |
| 141 | uint32_t outBufferSize) |
| 142 | { |
| 143 | char immBuff[32] = {0}; |
| 144 | char shiftBuff[64] = {0}; |
| 145 | |
| 146 | char reg[16]; |
| 147 | if(get_register_full(operand->reg[registerNumber], operand, reg)) |
| 148 | return FAILED_TO_DISASSEMBLE_REGISTER; |
| 149 | |
| 150 | if (operand->shiftType != ShiftType_NONE) |
| 151 | { |
| 152 | if (operand->shiftValueUsed != 0) |
| 153 | { |
| 154 | if (snprintf(immBuff, sizeof(immBuff), " #%#x", operand->shiftValue) >= sizeof(immBuff)) |
| 155 | { |
| 156 | return FAILED_TO_DISASSEMBLE_REGISTER; |
| 157 | } |
| 158 | } |
| 159 | const char *shiftStr = get_shift(operand->shiftType); |
| 160 | if (shiftStr == NULL) |
| 161 | return FAILED_TO_DISASSEMBLE_OPERAND; |
| 162 | snprintf( |
| 163 | shiftBuff, |
| 164 | sizeof(shiftBuff), |
| 165 | ", %s%s", |
| 166 | shiftStr, |
| 167 | immBuff); |
| 168 | } |
| 169 | if (snprintf(outBuffer, outBufferSize, "%s%s", reg, shiftBuff) < 0) |
| 170 | return FAILED_TO_DISASSEMBLE_REGISTER; |
| 171 | return DISASM_SUCCESS; |
| 172 | } |
| 173 | |
| 174 | uint32_t get_memory_operand( |
| 175 | const InstructionOperand *operand, |
no test coverage detected