⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mloop.in

📁 这个是LINUX下的GDB调度工具的源码
💻 IN
📖 第 1 页 / 共 2 页
字号:
				       "Branch penalty:");	  ps->branch_penalty = 0;	}      /* Account for insn fetch latency.  */      wait = 0;      while (frv_insn_fetch_buffer[cur_ix].reqno != NO_REQNO)	{	  frv_model_advance_cycles (current_cpu, 1);	  ++wait;	}      frv_model_trace_wait_cycles (current_cpu, wait, "Insn fetch:");      return;    }  /* Otherwise just load the insns directly from the cache.   */  if (frv_insn_fetch_buffer[cur_ix].reqno != NO_REQNO)    {      frv_cache_read (cache, cur_ix, vpc);      frv_insn_fetch_buffer[cur_ix].reqno = NO_REQNO;    }}#endif /* experimental *//* FR500 has dual prefetch.  */static voidsimulate_dual_insn_prefetch (SIM_CPU *current_cpu, IADDR vpc, int fetch_size){  int i;  int cur_ix, pre_ix;  SI pre_address;  FRV_CACHE *cache;  /* See if the pc is within the addresses specified by either of the     fetch buffers.  If so, that will be the current buffer. Otherwise,     arbitrarily select the LD buffer as the current one since it gets     priority in the case of interfering load requests.  */  cur_ix = LD;  vpc &= ~(fetch_size - 1);  for (i = LS; i < FRV_CACHE_PIPELINES; ++i)    {      if (frv_insn_fetch_buffer[i].address == vpc)	{	  cur_ix = i;	  break;	}    }  cache = CPU_INSN_CACHE (current_cpu);  /* Request a load of the current address buffer, if necessary.  */  if (frv_insn_fetch_buffer[cur_ix].address != vpc)    {      frv_insn_fetch_buffer[cur_ix].address = vpc;      frv_insn_fetch_buffer[cur_ix].reqno = cache_reqno++;      if (FRV_COUNT_CYCLES (current_cpu, 1))	frv_cache_request_load (cache, frv_insn_fetch_buffer[cur_ix].reqno,				frv_insn_fetch_buffer[cur_ix].address,				UNIT_I0 + cur_ix);    }  /* If the prefetch buffer does not represent the next sequential address, then     request a load of the next sequential address.  */  pre_ix = (cur_ix + 1) % FRV_CACHE_PIPELINES;  pre_address = vpc + fetch_size;  if (frv_insn_fetch_buffer[pre_ix].address != pre_address)    {      frv_insn_fetch_buffer[pre_ix].address = pre_address;      frv_insn_fetch_buffer[pre_ix].reqno = cache_reqno++;      if (FRV_COUNT_CYCLES (current_cpu, 1))	frv_cache_request_load (cache, frv_insn_fetch_buffer[pre_ix].reqno,				frv_insn_fetch_buffer[pre_ix].address,				UNIT_I0 + pre_ix);    }  /* If counting cycles, account for any branch penalty and/or insn fetch     latency here.  */  if (FRV_COUNT_CYCLES (current_cpu, 1))    {      FRV_PROFILE_STATE *ps = CPU_PROFILE_STATE (current_cpu);      int wait;      /* Account for any branch penalty.  */      if (ps->branch_penalty > 0 && ! ps->past_first_p)	{	  frv_model_advance_cycles (current_cpu, ps->branch_penalty);	  frv_model_trace_wait_cycles (current_cpu, ps->branch_penalty,				       "Branch penalty:");	  ps->branch_penalty = 0;	}      /* Account for insn fetch latency.  */      wait = 0;      while (frv_insn_fetch_buffer[cur_ix].reqno != NO_REQNO)	{	  frv_model_advance_cycles (current_cpu, 1);	  ++wait;	}      frv_model_trace_wait_cycles (current_cpu, wait, "Insn fetch:");      return;    }  /* Otherwise just load the insns directly from the cache.   */  if (frv_insn_fetch_buffer[cur_ix].reqno != NO_REQNO)    {      frv_cache_read (cache, cur_ix, vpc);      frv_insn_fetch_buffer[cur_ix].reqno = NO_REQNO;    }  if (frv_insn_fetch_buffer[pre_ix].reqno != NO_REQNO)    {      frv_cache_read (cache, pre_ix, pre_address);      frv_insn_fetch_buffer[pre_ix].reqno = NO_REQNO;    }}static void@cpu@_simulate_insn_prefetch (SIM_CPU *current_cpu, IADDR vpc){  SI hsr0;  SIM_DESC sd;  /* Nothing to do if not counting cycles and the cache is not enabled.  */  hsr0 = GET_HSR0 ();  if (! GET_HSR0_ICE (hsr0) && ! FRV_COUNT_CYCLES (current_cpu, 1))    return;  /* Different machines handle prefetch defferently.  */  sd = CPU_STATE (current_cpu);  switch (STATE_ARCHITECTURE (sd)->mach)    {    case bfd_mach_fr400:    case bfd_mach_fr450:      simulate_dual_insn_prefetch (current_cpu, vpc, 8);      break;    case bfd_mach_frvtomcat:    case bfd_mach_fr500:    case bfd_mach_fr550:    case bfd_mach_frv:      simulate_dual_insn_prefetch (current_cpu, vpc, 16);      break;    default:      break;    }}int frv_save_profile_model_p;EOF;;xinit)cat <<EOF/*xxxinit*/  /* If the timer is enabled, then we will enable model profiling during     execution.  This is because the timer needs accurate cycles counts to     work properly.  Save the original setting of model profiling.  */  if (frv_interrupt_state.timer.enabled)    frv_save_profile_model_p = PROFILE_MODEL_P (current_cpu);EOF;;xextract-simple | xextract-scache)# Inputs:  current_cpu, vpc, sc, FAST_P# Outputs: sc filled in# SET_LAST_INSN_P(last_p) called to indicate whether insn is last onecat <<EOF{  CGEN_INSN_INT insn = frvbf_read_imem_USI (current_cpu, vpc);  extract (current_cpu, vpc, insn, SEM_ARGBUF (sc), FAST_P);  SET_LAST_INSN_P ((insn & 0x80000000) != 0);}EOF;;xfull-exec-* | xfast-exec-*)# Inputs: current_cpu, vpc, FAST_P# Outputs:#   vpc contains the address of the next insn to execute#   pc of current_cpu must be up to date (=vpc) upon exit#   CPU_INSN_COUNT (current_cpu) must be updated by number of insns executed## Unlike the non-parallel case, this version is responsible for doing the# scache lookup.cat <<EOF{  FRV_VLIW *vliw;  int first_insn_p = 1;  int last_insn_p = 0;  int ninsns;  CGEN_ATTR_VALUE_TYPE slot;  /* If the timer is enabled, then enable model profiling.  This is because     the timer needs accurate cycles counts to work properly.  */  if (frv_interrupt_state.timer.enabled && ! frv_save_profile_model_p)    sim_profile_set_option (current_state, "-model", PROFILE_MODEL_IDX, "1");  /* Init parallel-write queue and vliw.  */  @cpu@_parallel_write_init (current_cpu);  vliw = CPU_VLIW (current_cpu);  frv_vliw_reset (vliw, STATE_ARCHITECTURE (CPU_STATE (current_cpu))->mach,                  CPU_ELF_FLAGS (current_cpu));  frv_current_fm_slot = UNIT_NIL;  for (ninsns = 0; ! last_insn_p && ninsns < FRV_VLIW_SIZE; ++ninsns)    {      SCACHE *sc;      const CGEN_INSN *insn;      int error;      /* Go through the motions of finding the insns in the cache.  */      @cpu@_simulate_insn_prefetch (current_cpu, vpc);      sc = @cpu@_scache_lookup (current_cpu, vpc, scache, hash_mask, FAST_P);      sc->first_insn_p = first_insn_p;      last_insn_p = sc->last_insn_p;      /* Add the insn to the vliw and set up the interrupt state.  */      insn = sc->argbuf.idesc->idata;      error = frv_vliw_add_insn (vliw, insn);      if (! error)        frv_vliw_setup_insn (current_cpu, insn);      frv_detect_insn_access_interrupts (current_cpu, sc);      slot = (*vliw->current_vliw)[vliw->next_slot - 1];      if (slot >= UNIT_FM0 && slot <= UNIT_FM3)        frv_current_fm_slot = slot;      vpc = execute (current_cpu, sc, FAST_P);      SET_H_PC (vpc); /* needed for interrupt handling */      first_insn_p = 0;    }  /* If the timer is enabled, and model profiling was not originally enabled,     then turn it off again.  This is the only place we can currently gain     control to do this.  */  if (frv_interrupt_state.timer.enabled && ! frv_save_profile_model_p)    sim_profile_set_option (current_state, "-model", PROFILE_MODEL_IDX, "0");  /* Check for interrupts.  Also handles writeback if necessary.  */  frv_process_interrupts (current_cpu);  CPU_INSN_COUNT (current_cpu) += ninsns;}EOF;;*)  echo "Invalid argument to mainloop.in: $1" >&2  exit 1  ;;esac

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -