UQI frvbf_read_mem_UQI (SIM_CPU *current_cpu, IADDR pc, SI address) { USI hsr0 = GET_HSR0 (); FRV_CACHE *cache = CPU_DATA_CACHE (current_cpu); /* Check for access exceptions. */ address = check_data_read_address (current_cpu, address, 0); address = check_readwrite_address (current_cpu, address, 0); /* If we need to count cycles, then the cache operation will be initiated from the model profiling functions. See frvbf_model_.... */ if (model_insn) { CPU_LOAD_ADDRESS (current_cpu) = address; CPU_LOAD_LENGTH (current_cpu) = 1; CPU_LOAD_SIGNED (current_cpu) = 0; return 0xb7; /* any random value */ } if (GET_HSR0_DCE (hsr0)) { int cycles; cycles = frv_cache_read (cache, 0, address); if (cycles != 0) return CACHE_RETURN_DATA (cache, 0, address, UQI, 1); } return GETMEMUQI (current_cpu, pc, address); }
UHI frvbf_read_mem_UHI (SIM_CPU *current_cpu, IADDR pc, SI address) { USI hsr0; FRV_CACHE *cache; /* Check for access exceptions. */ address = check_data_read_address (current_cpu, address, 1); address = check_readwrite_address (current_cpu, address, 1); /* If we need to count cycles, then the cache operation will be initiated from the model profiling functions. See frvbf_model_.... */ hsr0 = GET_HSR0 (); cache = CPU_DATA_CACHE (current_cpu); if (model_insn) { CPU_LOAD_ADDRESS (current_cpu) = address; CPU_LOAD_LENGTH (current_cpu) = 2; CPU_LOAD_SIGNED (current_cpu) = 0; return 0xb711; /* any random value */ } if (GET_HSR0_DCE (hsr0)) { int cycles; /* Handle access which crosses cache line boundary */ SIM_DESC sd = CPU_STATE (current_cpu); if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_fr550) { if (DATA_CROSSES_CACHE_LINE (cache, address, 2)) return read_mem_unaligned_HI (current_cpu, pc, address); } cycles = frv_cache_read (cache, 0, address); if (cycles != 0) return CACHE_RETURN_DATA (cache, 0, address, UHI, 2); } return GETMEMUHI (current_cpu, pc, address); }
void frvbf_check_recovering_store ( SIM_CPU *current_cpu, PCADDR address, SI regno, int size, int is_float ) { FRV_CACHE *cache = CPU_DATA_CACHE (current_cpu); int reg_ix; CPU_RSTR_INVALIDATE(current_cpu) = 0; for (reg_ix = next_valid_nesr (current_cpu, NO_NESR); reg_ix != NO_NESR; reg_ix = next_valid_nesr (current_cpu, reg_ix)) { if (address == GET_H_SPR (H_SPR_NEEAR0 + reg_ix)) { SI nesr = GET_NESR (reg_ix); int nesr_drn = GET_NESR_DRN (nesr); BI nesr_fr = GET_NESR_FR (nesr); SI remain; /* Invalidate cache block containing this address. If we need to count cycles, then the cache operation will be initiated from the model profiling functions. See frvbf_model_.... */ if (model_insn) { CPU_RSTR_INVALIDATE(current_cpu) = 1; CPU_LOAD_ADDRESS (current_cpu) = address; } else frv_cache_invalidate (cache, address, 1/* flush */); /* Copy the stored value to the register indicated by NESR.DRN. */ for (remain = size; remain > 0; remain -= 4) { SI value; if (is_float) value = GET_H_FR (regno); else value = GET_H_GR (regno); switch (size) { case 1: value &= 0xff; break; case 2: value &= 0xffff; break; default: break; } if (nesr_fr) sim_queue_fn_sf_write (current_cpu, frvbf_h_fr_set, nesr_drn, value); else sim_queue_fn_si_write (current_cpu, frvbf_h_gr_set, nesr_drn, value); nesr_drn++; regno++; } break; /* Only consider the first matching register. */ } } /* loop over active neear registers. */ }