Example #1
0
void ModifyContext(CONTEXT * ctxt)
{
    vector<REG> regs = GetTestRegs();
    int numOfRegs = regs.size();
    for (int r = 0; r < numOfRegs; ++r)
    {
        REG reg = regs[r];
        PIN_SetContextRegval(ctxt, reg, GetToolRegisterValue(reg));
    }
}
Example #2
0
// There is no verification on the validity of the ID.
void PINContextHandler::setSSERegisterValue(uint64 TritRegID, uint128 value) const
{
  REG reg = safecast(PINConverter::convertTritonReg2DBIReg(TritRegID));
  unsigned char *tmp      = (unsigned char*)malloc(16);

  if (tmp == nullptr)
    throw std::runtime_error("Error: setSSERegisterValue() - Not enough memory.");

  if (!REG_valid(reg) || !(TritRegID >= ID_XMM0 && TritRegID <= ID_XMM15))
    throw std::runtime_error("Error: setSSERegisterValue() - Invalid PIN register id.");

  *(uint128 *)tmp = value;

  PIN_SetContextRegval(this->_ctx, reg, tmp);
  PIN_ExecuteAt(this->_ctx);
  free(tmp);
}