Skip to content
Snippets Groups Projects
Commit da8ed1ab authored by jdh8d's avatar jdh8d
Browse files

New drops, f2null for worker, vgt testing harness updates for nogx,struct si....

New drops, f2null for worker, vgt testing harness updates for nogx,struct si. operand hasMemoryDisplacement method bulletproofed.

Former-commit-id: 6547f95c555731437fcd063cc6e1e37f02c7893e
parent a60fc103
No related branches found
No related tags found
No related merge requests found
......@@ -410,8 +410,7 @@ uint32_t DecodedOperandCapstone_t::getScaleValue() const
bool DecodedOperandCapstone_t::hasMemoryDisplacement() const
{
if (!isMemory())
return false;
if(!isMemory()) throw std::logic_error(string("Cannot ")+__FUNCTION__+" of non-memory operand");
const auto the_insn = static_cast<cs_insn*>(my_insn.get());
const auto &op = (the_insn->detail->x86.operands[op_num]);
......@@ -425,30 +424,30 @@ bool DecodedOperandCapstone_t::hasMemoryDisplacement() const
switch (mod)
{
case 0 /* 00 */:
if (rm == 4 && // indicates SIB is present.
sib_base == 0x5 // indicates disp32 when sib present and mod=00.
)
return true; // abs 32-bit
case 0 /* 00 */:
if (rm == 4 && // indicates SIB is present.
sib_base == 0x5 // indicates disp32 when sib present and mod=00.
)
return true; // abs 32-bit
if (rm == 5)
return true; // pcrel or abs 32-bit depending on if 32-bit or 64-bit arch.
if (rm == 5)
return true; // pcrel or abs 32-bit depending on if 32-bit or 64-bit arch.
return false;
return false;
case 1 /* 01 */:
return true;
case 1 /* 01 */:
return true;
case 2 /* 10 */:
return true;
case 2 /* 10 */:
return true;
case 3 /* 11 */:
return false;
case 3 /* 11 */:
return false;
default:
return false;
default:
assert(0); //unreachable
}
return false; // should be unreachable
assert(0); // unreachable
} // end of DecodedOperandCapstone_t::hasMemoryDisplacement()
virtual_offset_t DecodedOperandCapstone_t::getMemoryDisplacement() const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment