Index: src/ia32/disasm-ia32.cc |
=================================================================== |
--- src/ia32/disasm-ia32.cc (revision 3576) |
+++ src/ia32/disasm-ia32.cc (working copy) |
@@ -117,11 +117,6 @@ |
}; |
-static const char* loop_mnem[] = { |
- "loopne", "loope", "loop" |
-}; |
- |
- |
static const char* set_conditional_mnem[] = { |
/*0*/ "seto", "setno", "setc", "setnc", |
/*4*/ "setz", "setnz", "setna", "seta", |
@@ -143,7 +138,6 @@ |
ZERO_OPERANDS_INSTR, |
TWO_OPERANDS_INSTR, |
JUMP_CONDITIONAL_SHORT_INSTR, |
- LOOP_INSTR, |
REGISTER_INSTR, |
MOVE_REG_INSTR, |
CALL_JUMP_INSTR, |
@@ -173,7 +167,6 @@ |
byte end, |
const char* mnem); |
void AddJumpConditionalShort(); |
- void AddLoop(); |
}; |
@@ -198,7 +191,6 @@ |
CopyTable(call_jump_instr, CALL_JUMP_INSTR); |
CopyTable(short_immediate_instr, SHORT_IMMEDIATE_INSTR); |
AddJumpConditionalShort(); |
- AddLoop(); |
SetTableRange(REGISTER_INSTR, 0x40, 0x47, "inc"); |
SetTableRange(REGISTER_INSTR, 0x48, 0x4F, "dec"); |
SetTableRange(REGISTER_INSTR, 0x50, 0x57, "push"); |
@@ -242,16 +234,6 @@ |
} |
-void InstructionTable::AddLoop() { |
- for (byte b = 0xE0; b <= 0xE2; b++) { |
- InstructionDesc* id = &instructions_[b]; |
- ASSERT_EQ(NO_INSTR, id->type); // Information not already entered. |
- id->mnem = loop_mnem[b & 0x03]; |
- id->type = LOOP_INSTR; |
- } |
-} |
- |
- |
static InstructionTable instruction_table; |
@@ -348,7 +330,6 @@ |
int JumpShort(byte* data); |
int JumpConditional(byte* data, const char* comment); |
int JumpConditionalShort(byte* data, const char* comment); |
- int Loop(byte* data); |
int SetCC(byte* data); |
int CMov(byte* data); |
int FPUInstruction(byte* data); |
@@ -637,17 +618,6 @@ |
// Returns number of bytes used, including *data. |
-int DisassemblerIA32::Loop(byte* data) { |
- byte cond = *data & 0x03; |
- byte b = *(data+1); |
- byte* dest = data + static_cast<int8_t>(b) + 2; |
- const char* mnem = loop_mnem[cond]; |
- AppendToBuffer("%s %s", mnem, NameOfAddress(dest)); |
- return 2; |
-} |
- |
- |
-// Returns number of bytes used, including *data. |
int DisassemblerIA32::SetCC(byte* data) { |
ASSERT_EQ(0x0F, *data); |
byte cond = *(data+1) & 0x0F; |
@@ -885,10 +855,6 @@ |
data += JumpConditionalShort(data, branch_hint); |
break; |
- case LOOP_INSTR: |
- data += Loop(data); |
- break; |
- |
case REGISTER_INSTR: |
AppendToBuffer("%s %s", idesc.mnem, NameOfCPURegister(*data & 0x07)); |
data++; |
@@ -1042,7 +1008,16 @@ |
case 0x80: |
{ data++; |
- AppendToBuffer("%s ", "cmpb"); |
+ int mod, regop, rm; |
+ get_modrm(*data, &mod, ®op, &rm); |
+ const char* mnem = NULL; |
+ printf("%d\n", regop); |
+ switch (regop) { |
+ case 5: mnem = "subb"; break; |
+ case 7: mnem = "cmpb"; break; |
+ default: UnimplementedInstruction(); |
+ } |
+ AppendToBuffer("%s ", mnem); |
data += PrintRightOperand(data); |
int32_t imm = *data; |
AppendToBuffer(",0x%x", imm); |
@@ -1092,6 +1067,19 @@ |
NameOfXMMRegister(regop), |
NameOfXMMRegister(rm)); |
data++; |
+ } else if (*data == 0x6F) { |
+ data++; |
+ int mod, regop, rm; |
+ get_modrm(*data, &mod, ®op, &rm); |
+ AppendToBuffer("movdqa %s,", NameOfXMMRegister(regop)); |
+ data += PrintRightOperand(data); |
+ } else if (*data == 0x7F) { |
+ AppendToBuffer("movdqa "); |
+ data++; |
+ int mod, regop, rm; |
+ get_modrm(*data, &mod, ®op, &rm); |
+ data += PrintRightOperand(data); |
+ AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
} else { |
UnimplementedInstruction(); |
} |
@@ -1128,6 +1116,11 @@ |
data += 2; |
break; |
+ case 0x2C: |
+ AppendToBuffer("subb eax,0x%x", *reinterpret_cast<uint8_t*>(data+1)); |
+ data += 2; |
+ break; |
+ |
case 0xA9: |
AppendToBuffer("test eax,0x%x", *reinterpret_cast<int32_t*>(data+1)); |
data += 5; |
@@ -1198,9 +1191,29 @@ |
break; |
case 0xF3: |
- if (*(data+1) == 0x0F && *(data+2) == 0x2C) { |
- data += 3; |
- data += PrintOperands("cvttss2si", REG_OPER_OP_ORDER, data); |
+ if (*(data+1) == 0x0F) { |
+ if (*(data+2) == 0x2C) { |
+ data += 3; |
+ data += PrintOperands("cvttss2si", REG_OPER_OP_ORDER, data); |
+ } else if (*(data+2) == 0x6F) { |
+ data += 3; |
+ int mod, regop, rm; |
+ get_modrm(*data, &mod, ®op, &rm); |
+ AppendToBuffer("movdqu %s,", NameOfXMMRegister(regop)); |
+ data += PrintRightOperand(data); |
+ } else if (*(data+2) == 0x7F) { |
+ AppendToBuffer("movdqu "); |
+ data += 3; |
+ int mod, regop, rm; |
+ get_modrm(*data, &mod, ®op, &rm); |
+ data += PrintRightOperand(data); |
+ AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
+ } else { |
+ UnimplementedInstruction(); |
+ } |
+ } else if (*(data+1) == 0xA5) { |
+ data += 2; |
+ AppendToBuffer("rep_movs"); |
} else { |
UnimplementedInstruction(); |
} |
@@ -1220,6 +1233,9 @@ |
} |
int instr_len = data - instr; |
+ if (instr_len == 0) { |
+ printf("%02x", *data); |
+ } |
ASSERT(instr_len > 0); // Ensure progress. |
int outp = 0; |