insn * ins, const struct itemplate *temp,
int64_t insn_end)
{
- static const char condval[] = { /* conditional opcodes */
- 0x7, 0x3, 0x2, 0x6, 0x2, 0x4, 0xF, 0xD, 0xC, 0xE, 0x6, 0x2,
- 0x3, 0x7, 0x3, 0x5, 0xE, 0xC, 0xD, 0xF, 0x1, 0xB, 0x9, 0x5,
- 0x0, 0xA, 0xA, 0xB, 0x8, 0x4
- };
uint8_t c;
uint8_t bytes[4];
int64_t size;
break;
case 0330:
- *bytes = *codes++ ^ condval[ins->condition];
+ *bytes = *codes++ ^ get_cond_opcode(ins->condition);
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG, NO_SEG);
offset += 1;
break;
C_none = -1
};
+static inline uint8_t get_cond_opcode(enum ccode c)
+{
+ static const uint8_t ccode_opcodes[] = {
+ 0x7, 0x3, 0x2, 0x6, 0x2, 0x4, 0xf, 0xd, 0xc, 0xe, 0x6, 0x2,
+ 0x3, 0x7, 0x3, 0x5, 0xe, 0xc, 0xd, 0xf, 0x1, 0xb, 0x9, 0x5,
+ 0x0, 0xa, 0xa, 0xb, 0x8, 0x4
+ };
+
+ return ccode_opcodes[(int)c];
+}
+
/*
* REX flags
*/