예제 #1
0
파일: elf.cpp 프로젝트: Manouchehri/Triton
 triton::uint64 Elf::getOffsetFromAddress(triton::uint64 vaddr) const {
   for (auto it = this->programHeaders.begin(); it != this->programHeaders.end(); it++) {
     if (it->getType() == triton::format::elf::PT_LOAD) {
       if (vaddr >= it->getVaddr() && vaddr < (it->getVaddr() + it->getFilesz())) {
         return ((vaddr - it->getVaddr()) + it->getOffset());
       }
     }
   }
   return 0;
 }
예제 #2
0
파일: elf.cpp 프로젝트: Manouchehri/Triton
      void Elf::initMemoryMapping(void) {
        for (auto it = this->programHeaders.begin(); it != this->programHeaders.end(); it++) {
          triton::format::MemoryMapping area(this->raw.data());

          if (this->totalSize < (it->getOffset() + it->getFilesz())) {
            std::cerr << "Warning Elf::initMemoryMapping(): Some ELF Program Headers of the binary file are corrupted." << std::endl;
            continue;
          }

          area.setOffset(it->getOffset());
          area.setSize(it->getFilesz());
          area.setVirtualAddress(it->getVaddr());

          this->memoryMapping.push_back(area);
        }
      }
예제 #3
0
파일: DInst.cpp 프로젝트: dilawar/sesc
void DInst::setRetireTime()
{
  I(fetch1Time);
  I(fetch2Time);
  I(renameTime);
  I(issueTime);
  I(schedTime);
  I(exeTime);

  InstType i = inst->getOpcode();
  // Based on instruction type keep statistics
  avgFetch1QTime[i]->sample(fetch2Time-fetch1Time);
  avgFetch2QTime[i]->sample(renameTime-fetch2Time);
  avgIssueQTime[i]->sample(issueTime-renameTime);
  avgSchedQTime[i]->sample(schedTime-issueTime);
  avgExeQTime[i]->sample(exeTime-schedTime);
  avgRetireQTime[i]->sample(globalClock-exeTime);

  retireQHistDown->sample(retireQSize);
  retireQSize--;


  static int32_t nInsts = 0;
  nInsts++;
  if (getFetch()) {
    // Instruction that triggered a branch miss
    brdistHist1->sample(nInsts);
    nInsts = 0;
  }

#if 0
  int32_t pc = inst->getAddr();
  if (pc) {
#ifdef SESC_BAAD
    printf("BAAD: f1T=%lld f2T=%lld rT=%lld xT=%lld cT=%lld pc=0x%x op=%d:%d s1=%d s2=%d d=%u "
           ,fetch1Time
           ,fetch2Time
           ,renameTime
           ,exeTime
           ,globalClock
           ,pc,inst->getOpcode(),inst->getSubCode()
           ,inst->getSrc1(), inst->getSrc2(), inst->getDest()
           );

    if (inst->isMemory())
      printf(" nmB a=0x%x t=%d", getVaddr(), (int)(exeTime-schedTime));
    else if (getFetch())
      printf(" mB");
    else
      printf(" nmB");
#else
    printf("TR: %lld dest=%3d src1=%3d src2=%3d lat=%3d "
	   ,renameTime
           ,preg, pend[0].preg, pend[1].preg
           ,(int)(exeTime-schedTime));

    if (inst->getOpcode() == iALU)
      printf(" unit=0");
    else if (inst->getOpcode() == iMult)
      printf(" unit=1");
    else if (inst->getOpcode() == iDiv)
      printf(" unit=1");
    else if (inst->getOpcode() == iBJ)
      printf(" unit=2");
    else if (inst->getOpcode() == iLoad)
      printf(" unit=3");
    else if (inst->getOpcode() == iStore)
      printf(" unit=3");
    else
      printf(" unit=1");

    if (getFetch())
      printf(" FLUSH");
#endif

    printf("\n");
  }
#endif
}