예제 #1
0
  bool operator()(BinaryStream const& rBinStrm, TOffset Offset, Operand* pOprd)
  {
    u16 Seg;
    OffType Off;

    rBinStrm.Read(Offset + sizeof(OffType), Seg);
    rBinStrm.Read(Offset, Off);
    pOprd->SetValue(Off);
    pOprd->SetSegValue(Seg);
    pOprd->SetType(OpType | O_SEG_VAL);
    return true;
  }
예제 #2
0
  bool operator()(BinaryStream const& rBinStrm, TOffset Offset, Instruction& rInsn, Operand* pOprd)
  {
    ConstType ct;

    rBinStrm.Read(Offset, ct);
    pOprd->SetValue(ct);
    pOprd->SetType(OpType);
    pOprd->SetOffset(static_cast<u8>(rInsn.GetLength()));
    rInsn.Length() += sizeof(ct);
    return true;
  }
예제 #3
0
bool GameBoyLoader::IsCompatible(BinaryStream const& rBinStrm)
{
  if (rBinStrm.GetSize() < GAMEBOY_HEADER_OFFSET + sizeof m_GameBoyRom)
    return false;

  if (!rBinStrm.Read(GAMEBOY_HEADER_OFFSET, reinterpret_cast<u8*>(&m_GameBoyRom), sizeof m_GameBoyRom))
    return false;

  if (memcmp(m_GameBoyRom.NintendoLogo, s_NintendoLogo, NINTENDO_LOGO_LEN))
    return false;

  return true;
}
예제 #4
0
파일: x86_operand.cpp 프로젝트: anat/medusa
  bool operator()(BinaryStream const& rBinStrm, X86_Bit Bit, TOffset Offset, Instruction& rInsn, Operand* pOprd)
  {
    ConstType ct;

    rBinStrm.Read(Offset, ct);
    pOprd->SetValue(SignExtend<ConstType, Pos>(ct));
    switch (Bit)
    {
    case X86_Bit_16: pOprd->SetType(O_REL16); break;
    case X86_Bit_32: pOprd->SetType(O_REL32); break;
    case X86_Bit_64: pOprd->SetType(O_REL64); break;
    default:         pOprd->SetType(O_NONE);  break;
    }
    pOprd->SetOffset(static_cast<u8>(rInsn.GetLength()));
    rInsn.Length() += sizeof(ct);
    return true;
  }
예제 #5
0
bool Architecture::FormatCharacter(
  Document      const& rDoc,
  BinaryStream  const& rBinStrm,
  Address       const& rAddr,
  Character     const& rChar,
  std::string        & rStrCell,
  Cell::Mark::List   & rMarks) const
{
  std::ostringstream oss;
  TOffset Off;

  if (!rDoc.ConvertAddressToFileOffset(rAddr, Off))
    return false;

  switch (rChar.GetSubType())
  {
  case Character::AsciiCharacterType: default:
    {
      s8 Char;
      if (!rBinStrm.Read(Off, Char))
        return false;

      switch (Char)
      {
      case '\0': oss << "\\0"; break;
      case '\a': oss << "\\a"; break;
      case '\b': oss << "\\b"; break;
      case '\t': oss << "\\t"; break;
      case '\n': oss << "\\n"; break;
      case '\v': oss << "\\v"; break;
      case '\f': oss << "\\f"; break;
      case '\r': oss << "\\r"; break;
      default:   oss << Char;  break;
      }
    }
  }
  rMarks.push_back(Cell::Mark(Cell::Mark::StringType, 1));
  rStrCell = oss.str();
  return true;
}
예제 #6
0
static x86::ModRM GetModRm(BinaryStream const& rBinStrm, TOffset Offset)
{
  u8 ModRmByte;
  rBinStrm.Read(Offset, ModRmByte);
  return ModRmByte;
}