Beispiel #1
0
void initialize(){
  
  if(!pluggedin){
#if 0
    BootLoader::plug(arg1,arg2);
#else
    int arg1          = 1;
    const char *arg2[] = {"cachetest", 0};
    setenv("ESESC_tradCORE_DL1","DL1_core DL1",1);

    SescConf = new SConfig(arg1, arg2);
    unsetenv("ESESC_tradCore_DL1");
    gms_p0 = new MemorySystem(0);
    gms_p0->buildMemorySystem();
    gms_p1 = new MemorySystem(1);
    gms_p1->buildMemorySystem();
#endif
    pluggedin=true;
  }

  // Create a LD (e5d33000) with PC = 0xfeeffeef and address 1203
  rinst.set(0xe5d33000,0xfeeffeef,1203,true);
  crackInstARM.expand(&rinst);
  ld = DInst::create(rinst.getInstRef(0), &rinst, rinst.getPC(), 0);

  // Create a ST (e5832000) with PC = 0x410 and address 0x400
  rinst.set(0xe5832000,0x410,0x400,true);
  crackInstARM.expand(&rinst);
  st = DInst::create(rinst.getInstRef(0), &rinst, rinst.getPC(), 0);
}
Beispiel #2
0
DInst *QEMUReader::executeHead(FlowID fid)
/* speculative advance of execution {{{1 */
{
  if (!ruffer[fid].empty()) {
    DInst *dinst = ruffer[fid].getHead();
    ruffer[fid].popHead();
    I(dinst); // We just added, there should be one or more
    return dinst;
  }


  int conta = 0;
  while(!tsfifo[fid].full()) {
    
    pthread_mutex_lock(&mutex_ctrl); // BEGIN

    if (tsfifo_snd_mutex_blocked[fid]) {
      tsfifo_snd_mutex_blocked[fid] = 0;
      pthread_mutex_unlock(&tsfifo_snd_mutex[fid]);
      //MSG("2.alarmt snd%d",fid);
    }
#if 0
    if (tsfifo_rcv_mutex_blocked == 0) {
      tsfifo_rcv_mutex_blocked = 1;
      pthread_mutex_unlock(&mutex_ctrl); // END

      //MSG("1.sleep  rcv%d",fid);
      pthread_mutex_lock(&tsfifo_rcv_mutex);
      //MSG("1.wakeup rcv%d",fid);
    }else{
      pthread_mutex_unlock(&mutex_ctrl); // END
    }
#else
    pthread_mutex_unlock(&mutex_ctrl); // END
#endif

    if (qsamplerlist[fid]->isActive(fid) == false) {
      MSG("DOWN");
      return 0;
    }

    if (!live_qemu_active) {
      pthread_mutex_lock(&mutex_live);
      pthread_cond_wait(&cond_live, &mutex_live);
      pthread_mutex_unlock(&mutex_live);
    }

    if (conta++>100) {
      //printf("+%d",fid);
      return 0;
    }
  }

  for(int i=32;i<tsfifo[fid].size();i++) {
    RAWDInst  *rinst = tsfifo[fid].getHeadRef();
    DInst **dinsth = ruffer[fid].getInsertPointRef();

    *dinsth = DInst::create(rinst->getInst(), rinst->getPC(), rinst->getAddr(), fid, rinst->getStatsFlag());

    ruffer[fid].add();
    tsfifo[fid].pop();
  }

  if (tsfifo_snd_mutex_blocked[fid]) {
    tsfifo_snd_mutex_blocked[fid] = 0;
    pthread_mutex_unlock(&tsfifo_snd_mutex[fid]);
  }

  if (ruffer[fid].empty())
    return 0;

  DInst *dinst = ruffer[fid].getHead();
  ruffer[fid].popHead();
  I(dinst); // We just added, there should be one or more
  return dinst;
}