Lines Matching refs:data
311 static void get_modrm(byte data, int* mod, int* regop, int* rm) { in get_modrm() argument
312 *mod = (data >> 6) & 3; in get_modrm()
313 *regop = (data & 0x38) >> 3; in get_modrm()
314 *rm = data & 7; in get_modrm()
318 static void get_sib(byte data, int* scale, int* index, int* base) { in get_sib() argument
319 *scale = (data >> 6) & 3; in get_sib()
320 *index = (data >> 3) & 7; in get_sib()
321 *base = data & 7; in get_sib()
329 int PrintOperands(const char* mnem, OperandOrder op_order, byte* data);
330 int PrintImmediateOp(byte* data);
331 int F7Instruction(byte* data);
332 int D1D3C1Instruction(byte* data);
333 int JumpShort(byte* data);
334 int JumpConditional(byte* data, const char* comment);
335 int JumpConditionalShort(byte* data, const char* comment);
336 int SetCC(byte* data);
337 int CMov(byte* data);
338 int FPUInstruction(byte* data);
456 byte* data) { in PrintOperands() argument
457 byte modrm = *data; in PrintOperands()
464 advance = PrintRightOperand(data); in PrintOperands()
469 advance = PrintRightOperand(data); in PrintOperands()
483 int DisassemblerIA32::PrintImmediateOp(byte* data) { in PrintImmediateOp() argument
484 bool sign_extension_bit = (*data & 0x02) != 0; in PrintImmediateOp()
485 byte modrm = *(data+1); in PrintImmediateOp()
500 int count = PrintRightOperand(data+1); in PrintImmediateOp()
502 AppendToBuffer(",0x%x", *(data + 1 + count)); in PrintImmediateOp()
505 AppendToBuffer(",0x%x", *reinterpret_cast<int32_t*>(data + 1 + count)); in PrintImmediateOp()
512 int DisassemblerIA32::F7Instruction(byte* data) { in F7Instruction() argument
513 ASSERT_EQ(0xF7, *data); in F7Instruction()
514 byte modrm = *(data+1); in F7Instruction()
529 int32_t imm = *reinterpret_cast<int32_t*>(data+2); in F7Instruction()
534 int count = PrintRightOperand(data+1); in F7Instruction()
535 int32_t imm = *reinterpret_cast<int32_t*>(data+1+count); in F7Instruction()
544 int DisassemblerIA32::D1D3C1Instruction(byte* data) { in D1D3C1Instruction() argument
545 byte op = *data; in D1D3C1Instruction()
547 byte modrm = *(data+1); in D1D3C1Instruction()
566 imm8 = *(data+2); in D1D3C1Instruction()
586 int DisassemblerIA32::JumpShort(byte* data) { in JumpShort() argument
587 ASSERT_EQ(0xEB, *data); in JumpShort()
588 byte b = *(data+1); in JumpShort()
589 byte* dest = data + static_cast<int8_t>(b) + 2; in JumpShort()
596 int DisassemblerIA32::JumpConditional(byte* data, const char* comment) { in JumpConditional() argument
597 ASSERT_EQ(0x0F, *data); in JumpConditional()
598 byte cond = *(data+1) & 0x0F; in JumpConditional()
599 byte* dest = data + *reinterpret_cast<int32_t*>(data+2) + 6; in JumpConditional()
610 int DisassemblerIA32::JumpConditionalShort(byte* data, const char* comment) { in JumpConditionalShort() argument
611 byte cond = *data & 0x0F; in JumpConditionalShort()
612 byte b = *(data+1); in JumpConditionalShort()
613 byte* dest = data + static_cast<int8_t>(b) + 2; in JumpConditionalShort()
624 int DisassemblerIA32::SetCC(byte* data) { in SetCC() argument
625 ASSERT_EQ(0x0F, *data); in SetCC()
626 byte cond = *(data+1) & 0x0F; in SetCC()
629 PrintRightByteOperand(data+2); in SetCC()
635 int DisassemblerIA32::CMov(byte* data) { in CMov() argument
636 ASSERT_EQ(0x0F, *data); in CMov()
637 byte cond = *(data + 1) & 0x0F; in CMov()
639 int op_size = PrintOperands(mnem, REG_OPER_OP_ORDER, data + 2); in CMov()
645 int DisassemblerIA32::FPUInstruction(byte* data) { in FPUInstruction() argument
646 byte escape_opcode = *data; in FPUInstruction()
648 byte modrm_byte = *(data+1); in FPUInstruction()
653 return MemoryFPUInstruction(escape_opcode, modrm_byte, data+1); in FPUInstruction()
834 byte* data = instr; in InstructionDecode() local
838 if (*data == 0x3E /*ds*/) { in InstructionDecode()
840 data++; in InstructionDecode()
841 } else if (*data == 0x2E /*cs*/) { in InstructionDecode()
843 data++; in InstructionDecode()
847 const InstructionDesc& idesc = instruction_table.Get(*data); in InstructionDecode()
851 data++; in InstructionDecode()
855 data++; in InstructionDecode()
856 data += PrintOperands(idesc.mnem, idesc.op_order_, data); in InstructionDecode()
860 data += JumpConditionalShort(data, branch_hint); in InstructionDecode()
864 AppendToBuffer("%s %s", idesc.mnem, NameOfCPURegister(*data & 0x07)); in InstructionDecode()
865 data++; in InstructionDecode()
869 byte* addr = reinterpret_cast<byte*>(*reinterpret_cast<int32_t*>(data+1)); in InstructionDecode()
871 NameOfCPURegister(*data & 0x07), in InstructionDecode()
873 data += 5; in InstructionDecode()
878 byte* addr = data + *reinterpret_cast<int32_t*>(data+1) + 5; in InstructionDecode()
880 data += 5; in InstructionDecode()
885 byte* addr = reinterpret_cast<byte*>(*reinterpret_cast<int32_t*>(data+1)); in InstructionDecode()
887 data += 5; in InstructionDecode()
900 switch (*data) { in InstructionDecode()
902 AppendToBuffer("ret 0x%x", *reinterpret_cast<uint16_t*>(data+1)); in InstructionDecode()
903 data += 3; in InstructionDecode()
909 get_modrm(*(data+1), &mod, ®op, &rm); in InstructionDecode()
911 *data == 0x6B ? *(data+2) : *reinterpret_cast<int32_t*>(data+2); in InstructionDecode()
916 data += 2 + (*data == 0x6B ? 1 : 4); in InstructionDecode()
922 get_modrm(*(data+1), &mod, ®op, &rm); in InstructionDecode()
924 AppendToBuffer("test_b %s,%d", NameOfCPURegister(rm), *(data+2)); in InstructionDecode()
928 data += 3; in InstructionDecode()
934 data += PrintImmediateOp(data); in InstructionDecode()
938 { byte f0byte = *(data+1); in InstructionDecode()
942 data += 2; in InstructionDecode()
944 data += JumpConditional(data, branch_hint); in InstructionDecode()
947 data += 2; in InstructionDecode()
948 data += PrintOperands(f0mnem, REG_OPER_OP_ORDER, data); in InstructionDecode()
950 data += SetCC(data); in InstructionDecode()
952 data += CMov(data); in InstructionDecode()
954 data += 2; in InstructionDecode()
959 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
960 data += PrintRightOperand(data); in InstructionDecode()
974 { data++; in InstructionDecode()
976 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
979 data += PrintRightOperand(data); in InstructionDecode()
985 { data++; in InstructionDecode()
987 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
998 data += PrintRightOperand(data); in InstructionDecode()
1004 { bool is_byte = *data == 0xC6; in InstructionDecode()
1005 data++; in InstructionDecode()
1007 data += PrintRightOperand(data); in InstructionDecode()
1008 int32_t imm = is_byte ? *data : *reinterpret_cast<int32_t*>(data); in InstructionDecode()
1010 data += is_byte ? 1 : 4; in InstructionDecode()
1015 { data++; in InstructionDecode()
1017 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1025 data += PrintRightOperand(data); in InstructionDecode()
1026 int32_t imm = *data; in InstructionDecode()
1028 data++; in InstructionDecode()
1034 { bool is_byte = *data == 0x88; in InstructionDecode()
1036 data++; in InstructionDecode()
1037 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1039 data += PrintRightOperand(data); in InstructionDecode()
1045 data++; in InstructionDecode()
1046 if (*data == 0x8B) { in InstructionDecode()
1047 data++; in InstructionDecode()
1048 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); in InstructionDecode()
1049 } else if (*data == 0x89) { in InstructionDecode()
1050 data++; in InstructionDecode()
1052 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1054 data += PrintRightOperand(data); in InstructionDecode()
1056 } else if (*data == 0x0F) { in InstructionDecode()
1057 data++; in InstructionDecode()
1058 if (*data == 0x2F) { in InstructionDecode()
1059 data++; in InstructionDecode()
1061 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1065 data++; in InstructionDecode()
1066 } else if (*data == 0x57) { in InstructionDecode()
1067 data++; in InstructionDecode()
1069 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1073 data++; in InstructionDecode()
1074 } else if (*data == 0x6F) { in InstructionDecode()
1075 data++; in InstructionDecode()
1077 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1079 data += PrintRightOperand(data); in InstructionDecode()
1080 } else if (*data == 0x7F) { in InstructionDecode()
1082 data++; in InstructionDecode()
1084 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1085 data += PrintRightOperand(data); in InstructionDecode()
1096 { data++; in InstructionDecode()
1098 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1104 data++; in InstructionDecode()
1109 AppendToBuffer("push 0x%x", *reinterpret_cast<int32_t*>(data+1)); in InstructionDecode()
1110 data += 5; in InstructionDecode()
1114 AppendToBuffer("push 0x%x", *reinterpret_cast<int8_t*>(data + 1)); in InstructionDecode()
1115 data += 2; in InstructionDecode()
1119 AppendToBuffer("test al,0x%x", *reinterpret_cast<uint8_t*>(data+1)); in InstructionDecode()
1120 data += 2; in InstructionDecode()
1124 AppendToBuffer("subb eax,0x%x", *reinterpret_cast<uint8_t*>(data+1)); in InstructionDecode()
1125 data += 2; in InstructionDecode()
1129 AppendToBuffer("test eax,0x%x", *reinterpret_cast<int32_t*>(data+1)); in InstructionDecode()
1130 data += 5; in InstructionDecode()
1136 data += D1D3C1Instruction(data); in InstructionDecode()
1146 data += FPUInstruction(data); in InstructionDecode()
1150 data += JumpShort(data); in InstructionDecode()
1154 if (*(data+1) == 0x0F) { in InstructionDecode()
1155 byte b2 = *(data+2); in InstructionDecode()
1158 data += 3; in InstructionDecode()
1160 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1161 data += PrintRightOperand(data); in InstructionDecode()
1164 data += 3; in InstructionDecode()
1166 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1168 data += PrintRightOperand(data); in InstructionDecode()
1178 data += 3; in InstructionDecode()
1180 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1183 data += PrintRightOperand(data); in InstructionDecode()
1189 data++; in InstructionDecode()
1198 if (*(data+1) == 0x0F) { in InstructionDecode()
1199 if (*(data+2) == 0x2C) { in InstructionDecode()
1200 data += 3; in InstructionDecode()
1201 data += PrintOperands("cvttss2si", REG_OPER_OP_ORDER, data); in InstructionDecode()
1202 } else if (*(data+2) == 0x6F) { in InstructionDecode()
1203 data += 3; in InstructionDecode()
1205 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1207 data += PrintRightOperand(data); in InstructionDecode()
1208 } else if (*(data+2) == 0x7F) { in InstructionDecode()
1210 data += 3; in InstructionDecode()
1212 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1213 data += PrintRightOperand(data); in InstructionDecode()
1218 } else if (*(data+1) == 0xA5) { in InstructionDecode()
1219 data += 2; in InstructionDecode()
1227 data += F7Instruction(data); in InstructionDecode()
1239 int instr_len = data - instr; in InstructionDecode()
1241 printf("%02x", *data); in InstructionDecode()
1247 for (byte* bp = instr; bp < data; bp++) { in InstructionDecode()