本文整理汇总了C++中sim_io_eprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ sim_io_eprintf函数的具体用法?C++ sim_io_eprintf怎么用?C++ sim_io_eprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sim_io_eprintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mn10300_core_signal
void
mn10300_core_signal (SIM_DESC sd,
sim_cpu *cpu,
sim_cia cia,
unsigned map,
int nr_bytes,
address_word addr,
transfer_type transfer,
sim_core_signals sig)
{
const char *copy = (transfer == read_transfer ? "read" : "write");
address_word ip = CIA_ADDR (cia);
switch (sig)
{
case sim_core_unmapped_signal:
sim_io_eprintf (sd, "mn10300-core: %d byte %s to unmapped address 0x%lx at 0x%lx\n",
nr_bytes, copy,
(unsigned long) addr, (unsigned long) ip);
program_interrupt(sd, cpu, cia, SIM_SIGSEGV);
break;
case sim_core_unaligned_signal:
sim_io_eprintf (sd, "mn10300-core: %d byte %s to unaligned address 0x%lx at 0x%lx\n",
nr_bytes, copy,
(unsigned long) addr, (unsigned long) ip);
program_interrupt(sd, cpu, cia, SIM_SIGBUS);
break;
default:
sim_engine_abort (sd, cpu, cia,
"mn10300_core_signal - internal error - bad switch");
}
}
示例2: sim_do_command
void
sim_do_command (SIM_DESC sd, char *cmd)
{
char *mm_cmd = "memory-map";
char *int_cmd = "interrupt";
sim_cpu *cpu;
cpu = STATE_CPU (sd, 0);
/* Commands available from GDB: */
if (sim_args_command (sd, cmd) != SIM_RC_OK)
{
if (strncmp (cmd, "info", sizeof ("info") - 1) == 0)
sim_get_info (sd, &cmd[4]);
else if (strncmp (cmd, mm_cmd, strlen (mm_cmd) == 0))
sim_io_eprintf (sd,
"`memory-map' command replaced by `sim memory'\n");
else if (strncmp (cmd, int_cmd, strlen (int_cmd)) == 0)
sim_io_eprintf (sd, "`interrupt' command replaced by `sim watch'\n");
else
sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
}
/* If the architecture changed, re-configure. */
if (STATE_ARCHITECTURE (sd) != cpu->cpu_configured_arch)
sim_hw_configure (sd);
}
示例3: sim_engine_vabort
void
sim_engine_vabort (SIM_DESC sd,
sim_cpu *cpu,
sim_cia cia,
const char *fmt,
va_list ap)
{
ASSERT (sd == NULL || STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
if (sd == NULL)
{
vfprintf (stderr, fmt, ap);
fprintf (stderr, "\nQuit\n");
abort ();
}
else if (STATE_ENGINE (sd)->jmpbuf == NULL)
{
sim_io_evprintf (sd, fmt, ap);
sim_io_eprintf (sd, "\n");
sim_io_error (sd, "Quit Simulator");
abort ();
}
else
{
sim_io_evprintf (sd, fmt, ap);
sim_io_eprintf (sd, "\n");
sim_engine_halt (sd, cpu, NULL, cia, sim_stopped, SIM_SIGABRT);
}
}
示例4: mn10300_cpu_exception_resume
void
mn10300_cpu_exception_resume(SIM_DESC sd, sim_cpu* cpu, int exception)
{
ASSERT(cpu != NULL);
if(exception == 0 && State.exc_suspended > 0)
{
if(State.exc_suspended != SIGTRAP) /* warn not for breakpoints */
sim_io_eprintf(sd, "Warning, resuming but ignoring pending exception signal (%d)\n",
State.exc_suspended);
}
else if(exception != 0 && State.exc_suspended > 0)
{
if(exception != State.exc_suspended)
sim_io_eprintf(sd, "Warning, resuming with mismatched exception signal (%d vs %d)\n",
State.exc_suspended, exception);
memcpy(State.regs, State.exc_suspend_regs, sizeof(State.regs));
CPU_PC_SET (cpu, PC); /* copy PC back from new State.regs */
}
else if(exception != 0 && State.exc_suspended == 0)
{
sim_io_eprintf(sd, "Warning, ignoring spontanous exception signal (%d)\n", exception);
}
State.exc_suspended = 0;
}
示例5: sim_model_init
static SIM_RC
sim_model_init (SIM_DESC sd)
{
SIM_CPU *cpu;
/* If both cpu model and state architecture are set, ensure they're
compatible. If only one is set, set the other. If neither are set,
use the default model. STATE_ARCHITECTURE is the bfd_arch_info data
for the selected "mach" (bfd terminology). */
/* Only check cpu 0. STATE_ARCHITECTURE is for that one only. */
/* ??? At present this only supports homogeneous multiprocessors. */
cpu = STATE_CPU (sd, 0);
if (! STATE_ARCHITECTURE (sd)
&& ! CPU_MACH (cpu))
{
/* Set the default model. */
const MODEL *model = sim_model_lookup (WITH_DEFAULT_MODEL);
sim_model_set (sd, NULL, model);
}
if (STATE_ARCHITECTURE (sd)
&& CPU_MACH (cpu))
{
if (strcmp (STATE_ARCHITECTURE (sd)->printable_name,
MACH_BFD_NAME (CPU_MACH (cpu))) != 0)
{
sim_io_eprintf (sd, "invalid model `%s' for `%s'\n",
MODEL_NAME (CPU_MODEL (cpu)),
STATE_ARCHITECTURE (sd)->printable_name);
return SIM_RC_FAIL;
}
}
else if (STATE_ARCHITECTURE (sd))
{
/* Use the default model for the selected machine.
The default model is the first one in the list. */
const MACH *mach = sim_mach_lookup_bfd_name (STATE_ARCHITECTURE (sd)->printable_name);
if (mach == NULL)
{
sim_io_eprintf (sd, "unsupported machine `%s'\n",
STATE_ARCHITECTURE (sd)->printable_name);
return SIM_RC_FAIL;
}
sim_model_set (sd, NULL, MACH_MODELS (mach));
}
else
{
STATE_ARCHITECTURE (sd) = bfd_scan_arch (MACH_BFD_NAME (CPU_MACH (cpu)));
}
return SIM_RC_OK;
}
示例6: sim_get_bank_parameters
/* Get the memory bank parameters by looking at the global symbols
defined by the linker. */
static int
sim_get_bank_parameters (SIM_DESC sd, bfd* abfd)
{
sim_cpu *cpu;
long symsize;
long symbol_count, i;
unsigned size;
asymbol** asymbols;
asymbol** current;
cpu = STATE_CPU (sd, 0);
symsize = bfd_get_symtab_upper_bound (abfd);
if (symsize < 0)
{
sim_io_eprintf (sd, "Cannot read symbols of program");
return 0;
}
asymbols = (asymbol **) xmalloc (symsize);
symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
if (symbol_count < 0)
{
sim_io_eprintf (sd, "Cannot read symbols of program");
return 0;
}
size = 0;
for (i = 0, current = asymbols; i < symbol_count; i++, current++)
{
const char* name = bfd_asymbol_name (*current);
if (strcmp (name, BFD_M68HC11_BANK_START_NAME) == 0)
{
cpu->bank_start = bfd_asymbol_value (*current);
}
else if (strcmp (name, BFD_M68HC11_BANK_SIZE_NAME) == 0)
{
size = bfd_asymbol_value (*current);
}
else if (strcmp (name, BFD_M68HC11_BANK_VIRTUAL_NAME) == 0)
{
cpu->bank_virtual = bfd_asymbol_value (*current);
}
}
free (asymbols);
cpu->bank_end = cpu->bank_start + size;
cpu->bank_shift = 0;
for (; size > 1; size >>= 1)
cpu->bank_shift++;
return 0;
}
示例7: hw_trace
void
hw_trace (struct hw *me,
const char *fmt,
...)
{
if (hw_trace_p (me)) /* to be sure, to be sure */
{
va_list ap;
va_start (ap, fmt);
sim_io_eprintf (hw_system (me), "%s: ", hw_path (me));
sim_io_evprintf (hw_system (me), fmt, ap);
sim_io_eprintf (hw_system (me), "\n");
va_end (ap);
}
}
示例8: bfin_mmr_invalid
static void
bfin_mmr_invalid (struct hw *me, address_word addr,
unsigned nr_bytes, bool write, bool missing)
{
SIM_CPU *cpu = hw_system_cpu (me);
const char *rw = write ? "write" : "read";
const char *reason =
missing ? "no such register" :
(addr & 3) ? "must be 32-bit aligned" : "invalid length";
/* Only throw a fit if the cpu is doing the access. DMA/GDB simply
go unnoticed. Not exactly hardware behavior, but close enough. */
if (!cpu)
{
sim_io_eprintf (hw_system (me),
"%s: invalid MMR %s at %#x length %u: %s\n",
hw_path (me), rw, addr, nr_bytes, reason);
return;
}
HW_TRACE ((me, "invalid MMR %s at %#x length %u: %s",
rw, addr, nr_bytes, reason));
/* XXX: is this what hardware does ? What about priority of unaligned vs
wrong length vs missing register ? What about system-vs-core ? */
/* XXX: We should move this addr check to a model property so we get the
same behavior regardless of where we map the model. */
if (addr >= BFIN_CORE_MMR_BASE)
/* XXX: This should be setting up CPLB fault addrs ? */
mmu_process_fault (cpu, addr, write, false, false, true);
else
/* XXX: Newer parts set up an interrupt from EBIU and program
EBIU_ERRADDR with the address. */
cec_hwerr (cpu, HWERR_SYSTEM_MMR);
}
示例9: sim_board_reset
void
sim_board_reset (SIM_DESC sd)
{
struct hw *hw_cpu;
sim_cpu *cpu;
const struct bfd_arch_info *arch;
const char *cpu_type;
cpu = STATE_CPU (sd, 0);
arch = STATE_ARCHITECTURE (sd);
/* hw_cpu = sim_hw_parse (sd, "/"); */
if (arch->arch == bfd_arch_m68hc11)
{
cpu->cpu_type = CPU_M6811;
cpu_type = "/m68hc11";
}
else
{
cpu->cpu_type = CPU_M6812;
cpu_type = "/m68hc12";
}
hw_cpu = sim_hw_parse (sd, cpu_type);
if (hw_cpu == 0)
{
sim_io_eprintf (sd, "%s cpu not found in device tree.", cpu_type);
return;
}
cpu_reset (cpu);
hw_port_event (hw_cpu, 3, 0);
cpu_restart (cpu);
}
示例10: bfin_mmr_invalid
static void
bfin_mmr_invalid (struct hw *me, SIM_CPU *cpu, address_word addr,
unsigned nr_bytes, bool write)
{
if (!cpu)
cpu = hw_system_cpu (me);
/* Only throw a fit if the cpu is doing the access. DMA/GDB simply
go unnoticed. Not exactly hardware behavior, but close enough. */
if (!cpu)
{
sim_io_eprintf (hw_system (me), "%s: invalid MMR access @ %#x\n",
hw_path (me), addr);
return;
}
HW_TRACE ((me, "invalid MMR %s to 0x%08lx length %u",
write ? "write" : "read", (unsigned long) addr, nr_bytes));
/* XXX: is this what hardware does ? */
if (addr >= BFIN_CORE_MMR_BASE)
/* XXX: This should be setting up CPLB fault addrs ? */
mmu_process_fault (cpu, addr, write, false, false, true);
else
/* XXX: Newer parts set up an interrupt from EBIU and program
EBIU_ERRADDR with the address. */
cec_hwerr (cpu, HWERR_SYSTEM_MMR);
}
示例11: sim_do_command
void
sim_do_command (SIM_DESC sd, const char *cmd)
{
if (sim_args_command (sd, cmd) != SIM_RC_OK)
sim_io_eprintf (sd, "Unknown sim command: \"%s\". Try \"sim help\".\n",
cmd);
}
示例12: sim_get_info
/* Give some information about the simulator. */
static void
sim_get_info (SIM_DESC sd, char *cmd)
{
sim_cpu *cpu;
cpu = STATE_CPU (sd, 0);
if (cmd != 0 && (cmd[0] == ' ' || cmd[0] == '-'))
{
int i;
struct hw *hw_dev;
struct sim_info_list *dev_list;
const struct bfd_arch_info *arch;
arch = STATE_ARCHITECTURE (sd);
cmd++;
if (arch->arch == bfd_arch_m68hc11)
dev_list = dev_list_68hc11;
else
dev_list = dev_list_68hc12;
for (i = 0; dev_list[i].name; i++)
if (strcmp (cmd, dev_list[i].name) == 0)
break;
if (dev_list[i].name == 0)
{
sim_io_eprintf (sd, "Device '%s' not found.\n", cmd);
sim_io_eprintf (sd, "Valid devices: cpu timer sio eeprom\n");
return;
}
hw_dev = sim_hw_parse (sd, dev_list[i].device);
if (hw_dev == 0)
{
sim_io_eprintf (sd, "Device '%s' not found\n", dev_list[i].device);
return;
}
hw_ioctl (hw_dev, 23, 0);
return;
}
cpu_info (sd, cpu);
interrupts_info (sd, &cpu->cpu_interrupts);
}
示例13: sim_prepare_for_program
static int
sim_prepare_for_program (SIM_DESC sd, bfd* abfd)
{
sim_cpu *cpu;
int elf_flags = 0;
cpu = STATE_CPU (sd, 0);
if (abfd != NULL)
{
asection *s;
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
elf_flags = elf_elfheader (abfd)->e_flags;
cpu->cpu_elf_start = bfd_get_start_address (abfd);
/* See if any section sets the reset address */
cpu->cpu_use_elf_start = 1;
for (s = abfd->sections; s && cpu->cpu_use_elf_start; s = s->next)
{
if (s->flags & SEC_LOAD)
{
bfd_size_type size;
size = bfd_get_section_size (s);
if (size > 0)
{
bfd_vma lma;
if (STATE_LOAD_AT_LMA_P (sd))
lma = bfd_section_lma (abfd, s);
else
lma = bfd_section_vma (abfd, s);
if (lma <= 0xFFFE && lma+size >= 0x10000)
cpu->cpu_use_elf_start = 0;
}
}
}
if (elf_flags & E_M68HC12_BANKS)
{
if (sim_get_bank_parameters (sd, abfd) != 0)
sim_io_eprintf (sd, "Memory bank parameters are not initialized\n");
}
}
if (!sim_hw_configure (sd))
return SIM_RC_FAIL;
/* reset all state information */
sim_board_reset (sd);
return SIM_RC_OK;
}
示例14: sim_signal_to_host
int
sim_signal_to_host (SIM_DESC sd, SIM_SIGNAL sig)
{
switch (sig)
{
case SIM_SIGINT :
return SIGINT;
case SIM_SIGABRT :
return SIGABRT;
case SIM_SIGILL :
#ifdef SIGILL
return SIGILL;
#else
return SIGSEGV;
#endif
case SIM_SIGTRAP :
return SIGTRAP;
case SIM_SIGBUS :
#ifdef SIGBUS
return SIGBUS;
#else
return SIGSEGV;
#endif
case SIM_SIGSEGV :
return SIGSEGV;
case SIM_SIGXCPU :
#ifdef SIGXCPU
return SIGXCPU;
#endif
break;
case SIM_SIGFPE:
#ifdef SIGFPE
return SIGFPE;
#endif
break;
case SIM_SIGNONE:
return 0;
break;
}
sim_io_eprintf (sd, "sim_signal_to_host: unknown signal: %d\n", sig);
#ifdef SIGHUP
return SIGHUP; /* FIXME: Suggestions? */
#else
return 1;
#endif
}
示例15: sim_info
void
sim_info (SIM_DESC sd, int verbose)
{
const char *cpu_type;
const struct bfd_arch_info *arch;
/* Nothing to do if there is no verbose flag set. */
if (verbose == 0 && STATE_VERBOSE_P (sd) == 0)
return;
arch = STATE_ARCHITECTURE (sd);
if (arch->arch == bfd_arch_m68hc11)
cpu_type = "68HC11";
else
cpu_type = "68HC12";
sim_io_eprintf (sd, "Simulator info:\n");
sim_io_eprintf (sd, " CPU Motorola %s\n", cpu_type);
sim_get_info (sd, 0);
sim_module_info (sd, verbose || STATE_VERBOSE_P (sd));
}