int sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) { SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); return sim_core_read_buffer (sd, NULL, read_map, buf, mem, length); }
syscall_read_mem (host_callback *cb, struct cb_syscall *sc, unsigned long taddr, char *buf, int bytes) { SIM_DESC sd = (SIM_DESC) sc->p1; sim_cpu *cpu = STATE_CPU(sd, 0); return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes); }
static int syscall_read_mem (host_callback *cb, struct cb_syscall *sc, unsigned long taddr, char *buf, int bytes) { SIM_DESC sd = (SIM_DESC) sc->p1; SIM_CPU *cpu = (SIM_CPU *) sc->p2; frv_cache_invalidate_all (CPU_DATA_CACHE (cpu), 1); return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes); }
static int syscall_read_mem (host_callback *cb, struct cb_syscall *sc, unsigned long taddr, char *buf, int bytes) { SIM_DESC sd = (SIM_DESC) sc->p1; SIM_CPU *cpu = (SIM_CPU *) sc->p2; MAYBE_TRACE (CORE, cpu, "DBUS FETCH (syscall) %i bytes @ 0x%08lx", bytes, taddr); return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes); }
static unsigned dv_core_dma_read_buffer_callback (struct hw *me, void *dest, int space, unsigned_word addr, unsigned nr_bytes) { return sim_core_read_buffer (hw_system (me), NULL, /*CPU*/ space, /*???*/ dest, addr, nr_bytes); }
void aarch64_get_mem_blk (sim_cpu * cpu, uint64_t address, char * buffer, unsigned length) { unsigned len; len = sim_core_read_buffer (CPU_STATE (cpu), cpu, read_map, buffer, address, length); if (len == length) return; memset (buffer, 0, length); if (cpu) mem_error (cpu, "read of non-existant mem block at", address); sim_engine_halt (CPU_STATE (cpu), cpu, NULL, aarch64_get_PC (cpu), sim_stopped, SIM_SIGBUS); }
SIM_DESC sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd, char **argv) { char c; int i; SIM_DESC sd = sim_state_alloc (kind, callback); /* The cpu data is kept in a separately allocated chunk of memory. */ if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) { free_state (sd); return 0; } { /* XXX: Only first core gets profiled ? */ SIM_CPU *cpu = STATE_CPU (sd, 0); STATE_WATCHPOINTS (sd)->pc = &PCREG; STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PCREG); } if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK) { free_state (sd); return 0; } /* XXX: Default to the Virtual environment. */ if (STATE_ENVIRONMENT (sd) == ALL_ENVIRONMENT) STATE_ENVIRONMENT (sd) = VIRTUAL_ENVIRONMENT; /* These options override any module options. Obviously ambiguity should be avoided, however the caller may wish to augment the meaning of an option. */ #define e_sim_add_option_table(sd, options) \ do { \ extern const OPTION options[]; \ sim_add_option_table (sd, NULL, options); \ } while (0) e_sim_add_option_table (sd, bfin_mmu_options); e_sim_add_option_table (sd, bfin_mach_options); /* getopt will print the error message so we just have to exit if this fails. FIXME: Hmmm... in the case of gdb we need getopt to call print_filtered. */ if (sim_parse_args (sd, argv) != SIM_RC_OK) { free_state (sd); return 0; } /* Allocate external memory if none specified by user. Use address 4 here in case the user wanted address 0 unmapped. */ if (sim_core_read_buffer (sd, NULL, read_map, &c, 4, 1) == 0) { bu16 emuexcpt = 0x25; sim_do_commandf (sd, "memory-size 0x%lx", BFIN_DEFAULT_MEM_SIZE); sim_write (sd, 0, (void *)&emuexcpt, 2); } /* Check for/establish the a reference program image. */ if (sim_analyze_program (sd, (STATE_PROG_ARGV (sd) != NULL ? *STATE_PROG_ARGV (sd) : NULL), abfd) != SIM_RC_OK) { free_state (sd); return 0; } /* Establish any remaining configuration options. */ if (sim_config (sd) != SIM_RC_OK) { free_state (sd); return 0; } if (sim_post_argv_init (sd) != SIM_RC_OK) { free_state (sd); return 0; } /* CPU specific initialization. */ for (i = 0; i < MAX_NR_PROCESSORS; ++i) { SIM_CPU *cpu = STATE_CPU (sd, i); bfin_initialize_cpu (sd, cpu); } return sd; }