4 * sim-gx-run.c (sim_engine_run): Allay warnings. Write out updated
5 gx block list after each successful compilation job.
6 * sim-gx.c (sim_gx_compiled_block_f): dlopen the main executable
7 image, to allow gx block DLLs to resolve symbols there.
8 (sim_gx_{read,write}_block_list): Allay warnings.
9 (sim_gx_block_translate): Allay warnings. Add $GX_FLAGS to
10 gx compilation/link jobs.
11 * sim-gx.h: Allay warnings.
16 * Make-common.in (CGEN_INCLUDE_DEPS): Add cgen-defs.h, cgen-engine.h.
17 (CGEN_MAIN_SCM): Add rtx-funcs.scm.
18 (cgen-arch): Pass $(mach) to cgen.sh.
19 * cgen-engine.h (SEM_BRANCH_FINI): New arg pcvar, all uses updated.
20 (SEM_BRANCH_INIT_EXTRACT): New macro.
21 (SEM_BRANCH_INIT): Add taken_p.
22 (TARGET_SEM_BRANCH_FINI): Provide default definition.
23 (SEM_BRANCH_FINI): Use it.
25 * cgen-run.c (sim_resume): Handle tracing of last insn.
26 * cgen-scache.h (WITH_SCACHE): Define as 0 if not defined.
27 * cgen-trace.c (current_abuf): New static global.
28 (trace_insn_init): Initialize it.
29 (trace_insn_fini): Use it.
31 * cgen.sh (arch case): Pass -m ${mach} to cgen.
32 * genmloop.sh (@cpu@_emit_before): Only define if WITH_SCACHE_PBB.
33 (@cpu@_emit_after): Ditto.
34 (simple @cpu@_engine_run_full): New local `pc'. Initialize semantic
35 labels if WITH_SEM_SWITCH_FULL.
36 * sim-model.c: Include bfd.h.
37 (sim_model_init): New function.
38 (sim_model_install): Record init fn.
39 * sim-model.h (MACH): New member bfd_name.
40 * sim-module.c (modules): Initialize model before scache.
44 * dv-sockser.c (DEFAULT_TIMEOUT): Increase to 1 ms.
46 * nrun.c (main): Remain in simulation loop for traps and
47 exceptions when in operating environment mode.
48 (ui_loop_hook): New stub hook for standalone use.
49 * sim-events.c (sim_events_process): Call ui_loop_hook
50 periodically on CYGWIN host.
52 * sim-reason.c (sim_stop_reason): Return host signal numbers
53 to gdb on sim_stopped and sim_signalled cases.
54 * sim-engine.c (sim_engine_halt): Call SIM_CPU_EXCEPTION_SUSPEND
55 hook just before longjmp.
56 * sim-resume.c (sim_resume): Call SIM_CPU_EXCEPTION_RESUME
57 hook just before sim_engine_run.
59 * sim-n-core.h (sim_core_trace_M): Allay const warning.
60 * sim-trace.h (trace_generic): Ditto.
61 * sim-trace.c (trace_generic): Ditto.
65 * Make-common.in (SIM_MAIN_DEPS): New var.
66 (CGEN_MAIN_CPU_DEPS): New var.
67 * aclocal.m4: Add --enable-cgen-maint option.
68 * cgen-mem.h (GETMEM*): New arg `pc'. Pass to sim_core routine.
70 (GETIMEM*): Pass pc value to sim_core routine.
74 * hw-handles.c (hw_handle_add_ihandle, hw_handle_add_phandle):
75 Compare with ZERO not NULL.
79 * hw-properties.c, hw-instances.c, hw-tree.c: Include
84 * sim-arange.c: Include libiberty.h, and stdlib.h if present.
85 * sim-trace.c: Include stdlib.h if present.
86 * dv-sockser.c: Include unistd.h if present.
87 (dv_sockser_init): Add missing arg to call to sim_io_eprintf.
88 * cgen-scache.c (scache_flush): Delete unused locals i,sc.
92 * gennltvals.sh: Add i960.
93 * nltvals.def: Rebuild.
97 * cgen-defs.h: New file, old cgen-sim.h.
98 * cgen-sim.h: Simple header that includes others.
99 * sim-arange.c: New file.
100 * sim-arange.h: New file.
101 * sim-basics.h: Include it.
102 * Make-common.in (SIM_NEW_COMMON_OBJS): Add sim-arange.o.
103 (sim-arange.o): Add rule for.
104 * sim-cpu.h (sim_cpu_msg_prefix): Add prototype.
105 (sim_io_eprintf_cpu): Add prototype.
106 * sim-inline.h (HAVE_INLINE): Define if GNUC.
107 (INLINE2): New macro.
108 (EXTERN_INLINE): New macro.
109 * sim-module.c (sim_post_argv_init): Initialize cpu backlink
110 before calling module init fns.
111 * sim-profile.c (OPTION_PROFILE_*): Move into enum.
112 (profile_init): New function.
113 (profile_options): New option --profile-range.
114 (profile_option_handler): Handle --profile-range.
115 (profile_print_insn): Qualify address range specific section titles.
116 (profile_print_addr_ranges): New function.
117 (profile_info): Print address ranges if specified.
118 (profile_install): Set profile_init init fn.
119 * sim-profile.h (PROFILE_DATA): New member `range'.
120 * sim-trace.c (trace_init): New function.
121 (trace_options): New option --trace-range.
122 (trace_option_handler): Handle --trace-range.
123 (trace_install): Set trace_init init fn.
124 * sim-trace.h (TRACE_DATA): New member `range'.
125 * sim-utils.c (sim_cpu_msg_prefix): New function.
126 (sim_io_eprintf_cpu): New function.
127 * cgen-engine.h (PC_IN_TRACE_RANGE_P): New macro.
128 (PC_IN_PROFILE_RANGE_P): New macro.
129 * cgen-trace.c (trace_insn_init): Set current_insn to NULL.
130 (trace_insn_fini): New arg abuf. All callers updated.
131 Exit early if trace_insn not called. Check ARGBUF_PROFILE_P before
132 printing cycle counts.
133 * cgen-trace.h (trace_insn_fini): Update prototype.
134 (TRACE_RESULT_P): New macro.
135 (TRACE_INSN_INIT,TRACE_INSN_FINI): New arg abuf. All callers updated.
136 (TRACE_INSN): Check ARGBUF_TRACE_P.
137 (TRACE_EXTRACT,TRACE_RESULT): New arg abuf. All callers updated.
138 * cgen-types.h (SIM_INLINE): Delete.
139 (SIM_HAVE_MODEL,SIM_HAVE_ADDR_RANGE): Define.
140 * cgen-utils.c: Don't include cgen-engine.h
141 * genmloop.sh (@cpu@_fill_argbuf): New function.
142 (@cpu@_fill_argbuf_tp): New function.
143 (@cpu@_emit_before,@cpu@_emit_after): New functions.
144 (@cpu@_pbb_begin): Prefix cti_sc,insn_count with '_'.
145 (SET_CTI_VPC,SET_INSN_COUNT): Update.
146 (@cpu@_pbb_before): Check ARGBUF_PROFILE_P before calling
147 doing profiling. Update call to TRACE_INSN_INIT,TRACE_INSN_FINI.
148 (@cpu@_pbb_after): Check ARGBUF_PROFILE_P before calling
149 doing profiling. Update call to TRACE_INSN_FINI.
151 * sim-memopt.c (sim_memory_uninstall): Result type is `void'.
155 * sim-memopt.c (sim_memory_uninstall): Deallocate all memory
160 * sim-inline.c (SIM_INLINE_P): Fix typo.
165 * sim-gx-run.c (sim_engine_run): Use new tgx_info struct to
166 collect run-time arguments to gx block.
167 * sim-gx.h (sim_gx_function): Corresponding signature change.
169 * sim-gx.c (sim_gx_compiled_block_f): Remove nonfunctional code to
170 again compile a gx block source file.
171 (sim_gx_compiled_block_dispose): Uninstall obsoleted gx block
173 (sim_gx_block_translate): Always emit new "gx_label_NNNN" labels,
174 for basic block entry points, even if !__GNUC__.
179 * cgen-utils.c (cgen_virtual_opcode_table): Update.
183 * gennltvals.sh: Add v850 and d10v. Sort alphabetically.
184 * nltvals.def: Re-generate.
188 * sim-core.c (reverse_n, sim_core_uninstall, sim_core_init,
189 sim_core_map_attach, sim_core_map_detach, next_event_queue,
190 new_sim_core_mapping): Only define when EXTERN_SIM_CORE_P, pacify
192 * sim-events.c (sim_events_uninstall, sim_events_suspend,
193 sim_events_resume, sim_events_zalloc, insert_sim_event): Ditto.
197 * genmloop.sh (${cpu}_pbb_chain): Watch for Ctrl-C's.
198 (${cpu}_pbb_cti_chain): Ditto.
203 * sim-gx.c (sim_gx_block_translate): Generate computed
204 goto for __GNUC__ instead of plain switch() for gx block
205 entry. Lose "-g" compile option for gx block.
210 * Make-common.in (cgen-utils.o): Depend on cgen-engine.h.
211 (CGEN_ARCH_SCM): New variable.
212 * cgen-engine.h (EXTRACT_[ML]SB0_{INT,UINT}): New macros.
213 (EXTRACT_INT,EXTRACT_UINT): New macros.
214 (SEM_SEM_ARG): New macro.
215 (SEM_NEXT_VPC): New arg `pc'.
216 * cgen-sim.h (EXTRACT_SIGNED,EXTRACT_UNSIGNED): Delete.
217 (sim_disassemble_insn): Update prototype.
218 * cgen-trace.c (current_insn,insn_fields): New static locals.
219 (trace_insn): Set them.
220 * cgen-utils.scm: #include cgen-engine.h.
221 (sim_disassemble_insn): New arg insn_fields.
222 Handle variable length insns.
223 * genmloop.sh: Only emit pbb decls if -pbb.
224 (${cpu}_scache_lookup): New arg `vpc'.
225 (scache support): Fetch pc before entering loop.
227 * gennltvals.sh: Add fr30 support.
228 * nltvals.def: Rebuild.
232 * sim-types.h: Re-do type system so that GCC's attribute and mode
233 are used to specify types. Handle case of ALPHA.
238 * Make-common.im: Build sim-gx.o and sim-gx-run.o.
239 * sim-gx.c: New file: target-independent gx routines.
240 * sim-gx.h: Declarations for gx structs and routines.
241 * sim-gx-run.c: New file: target-independent gx driver.
242 * sim-base.h: Add gx block vector to state struct.
244 * aclocal.m4: Add tests for dlopen family.
245 * config.in: Regenerated.
249 * sim-hload.c (sim_load): Pass `prog_name' to sim_load_file, not NULL.
253 * genmloop.sh (eng.hin): Rename HAVE_PARALLEL_EXEC to
254 HAVE_PARALLEL_INSNS, define as 0 or 1. Emit decls of fns in mloop.cin.
255 * cgen-engine.h: Typedefs of IADDR,CIA,SEM_ARG,SEM_PC moved ...
256 * cgen-sim.h: ... to here.
260 * aclocal.m4 (enable-build-warnings): Replace
261 enable-sim-warnings. Extend =LIST syntax so that prepend and
262 append of options is possible. Drop -Werror, add
263 -Wstrict-prototypes for GDB compatibility.
264 * Make-common.in (SIM_WARNINGS): Update.
268 * Make-common.in (CGEN_INCLUDE_DEPS): Define.
269 (sim-core.o): Delete duplicate dependence on $(SIM_EXTRA_DEPS).
270 (sim-cpu.o,sim-endian.o,sim-hw.o): Ditto.
271 (cgen-run.o,cgen-scache.o,cgen-trace.o,cgen-utils.o): Delete
272 explicit cgen header dependencies, require SIM_EXTRA_DEPS to include
274 * cgen-cpu.h: New file.
275 * cgen-engine.h: New file.
276 * cgen-scache.h: New file.
277 * cgen-sim.h: Delete portions moved to new files.
278 * genmloop.sh: Generate two files eng.hin,mloop.cin explicitly,
279 rather than sending result to stdout.
283 * Make-common.in (sim-reg.o): New rule.
284 (cgen-run.o): New rule.
285 * cgen-ops.h: Delete many BI macros. Change all UBI -> BI.
286 * cgen-run.c (prime_cpu): New function.
287 * cgen-scache.c: Add pseudo-basic-block (pbb) scaching support.
288 (scache_option_handler, case OPTION_PROFILE_SCACHE): Handle explicitly
290 (scache_flush_cpu,scache_lookup,scache_lookup_or_alloc): New fns.
291 * cgen-sim.h (CGEN_INSN_VIRTUAL_TYPE): New enum.
292 (CGEN_INSN_VIRTUAL_P): New macro.
293 (SEM_PC): New typedef.
294 (SEMANTIC_FN): Change type of result to SEM_PC.
295 (SEM_SET_FULL_CODE,SEM_SET_FAST_CODE,SEM_SET_CODE): New macros.
296 (IDESC_CTI_P,IDESC_SKIP_P): New macros.
297 (SCACHE_MAP): New typedef.
298 (CPU_SCACHE): Add pbb support.
299 (scace_lookup,scache_lookup_or_alloc,scache_flush_cpu): Declare.
300 (SEM_BRANCH_INIT_EXTRACT,SEM_BRANCH_INIT,SEM_BRANCH_FINI): New macros.
301 (CGEN_CPU): New members running_p,insn_count,{fast,full}_engine_fn,
304 (cgen_insn_name): Declare.
305 (sim_engine_invalid_insn): Renamed from sim_engine_illegal_insn.
306 * cgen-trace.c (trace_buf): Shrink from 1024 to 256 bytes.
307 (first_insn_p): Make static.
308 (trace_insn): Handle virtual insns specially.
309 (cgen_trace_printf): Ensure we haven't overflowed the buffer.
310 * cgen-types.h (UBI): Delete.
311 (MODE_TYPE): New enum.
312 (HOSTINT,HOSTUINT,HOSTPTR): Delete.
313 * cgen-utils.c (mode_names): Delete UBI. Add INT,UINT,PTR.
314 (cgen_virtual_opcode_table): New global.
315 (cgen_insn_name): New function.
316 (sim_disassemble_insn): Ignore virtual insns.
317 * genmloop.sh: Delete top level loop generation. Add pbb support.
318 * sim-cpu.h (CPU_INSN_NAME_FN): New typedef.
319 (sim_cpu_base): New members max_insns,insn_name,model_data.
320 (CPU_PC_GET,CPU_PC_SET): New macros.
321 (sim_pc_get,sim_pc_set): Declare.
322 * sim-model.c (model_set): Call model init fn.
323 * sim-model.h (MODEL_FN): New typedef.
324 (INSN_TIMING): New member model_fn.
325 (MODEL): New members num,init.
326 * sim-profile.c (sim_profile_print_bar): Renamed from print_bar.
328 (profile_insn_init): New fn.
329 (profile_print_insn): Update, INSN_NAME -> CPU_INSN_NAME.
330 Exit early if insn profiling not supported.
331 (profile_print_memory): Update, MAX_MODES -> MODE_TARGET_MAX.
332 (profile_install): Record profile_insn_init as init fn.
333 (profile_uninstall): Free PROFILE_INSN_COUNT if non-null.
334 * sim-profile.h: Update, MAX_MODES -> MODE_TARGET_MAX.
335 (PROFILE_DATA): Delete member exec_time.
336 Change insn_count to pointer to array, rather than the array.
337 (sim_profile_print_bar): Declare.
341 * cgen-run.c: New file.
342 * sim-reg.c: New file.
346 * aclocal.m4: Add checks for -lsocket and -lnsl.
348 * dv-sockser.c (dv_sockser_init): Use SO_REUSEADDR to
349 allow local port reuse on listening socket.
353 * sim-config.h: Remove reference to linux kernel header.
357 * dv-sockser.c (sockser_addr): Make variable non-static.
361 * sim-hw.{c,h} (sim_hw_parse): Return struct hw pointer.
365 * sim-events.c (sim_events_elapsed_time): Fix calculation.
369 * Make-common.in (install-common): Add $(EXEEXT) when installing
374 * cgen-sim.h (cgen_state): New member opcode_table.
375 * cgen-utils.c (sim_disassemble_insn): Use it.
379 * cgen-mem.h (DECLARE_SETT): Fix return type.
380 * cgen-sim.h (sim_engine_illegal_insn): Declare.
381 * cgen-scache.c: Include stdlib.h.
382 * cgen-trace.c (trace_extract): Use %lx for PCADDR.
383 * sim-model.c (model_option_handler): Remove unused variable `n'.
387 * cgen-utils.c: Include bfd.h.
388 (sim_disassemble_insn): Update call to CGEN_EXTRACT_FN.
392 * sim-bits.h (EXTEND24): Fix typo.
396 * sim-events.c (ETRACE_P): New macro.
397 (struct _sim_event): Add member trace.
398 (sim_events_free): Reclaim trace message.
400 * sim-events.c, sim-events.h (sim_events_schedule_vtracef,
401 sim_events_schedule_tracef): New functions, include printf trace
402 information in argument list. If tracing, store asprintf'd trace
403 message in sim_event.
405 * hw-events.c, hw-events.h (hw_event_queue_schedule_tracef,
406 hw_event_queue_schedule_vtracef): New functions, mimic
411 * sim-bits.h (EXTEND24): Define.
415 * cgen-sim.h (CPU_SCACHE): Make size unsigned.
416 (CPU_SCACHE_HASH_MASK): New macro.
417 (SCACHE_HASH_PC): Rewrite.
418 * genmloop.sh (engine_resume_{full,fast}): Move some of hash
419 computation out of main loop.
423 * Make-common.in (SCHEME,SCHEMEFLAGS): Delete.
424 (CGENDIR,CGEN): New variables.
425 (CGEN_VERBOSE): Renamed to CGENFLAGS.
426 (cgen-arch,cgen-cpu,cgen-decode): Update.
427 (CGEN_CPU_WRITE): New variable.
428 (CGEN_CPU_SEMSW): -W -> -X.
429 (CGEN_FLAGS_TO_PASS): Delete SCHEME. Add CGEN,CGENFLAGS.
430 * cgen.sh: Delete args scheme,schemeflags. New arg cgen.
432 * cgen-sim.h (RECORD_IADDR): Delete.
433 * cgen-types.h (HOSTINT,HOSTUINT,HOSTPTR): New types.
434 * genmloop.sh (engine_resume_{full,fast}): Delete icount.
438 * gennltvals.def (mn10200): Add entry.
439 * nltvals.def: Regenerate with MN10200 additions.
443 * sim-inline.h (EXTERN_*): Replace with EXTERN_*_P. Correct
444 documentation on how it works.
446 * sim-core.h, sim-core.c (sim_core_install, sim_core_attach,
447 sim_core_detach, sim_core_read_buffer, sim_core_write_buffer,
448 sim_core_set_xor, sim_core_xor_read_buffer,
449 sim_core_xor_write_buffer): Update.
451 * sim-events.h, sim-events.c (sim_events_install,
452 sim_events_watch_clock, sim_events_schedule_after_signal,
453 sim_events_schedule, sim_events_watch_sim, sim_events_watch_core,
454 sim_events_deschedule): Update.
456 * sim-fpu.h, sim-fpu.c (sim_fpu_zero, sim_fpu_one, sim_fpu_two,
457 sim_fpu_max32, sim_fpu_max64): Update.
461 * cgen-trace.c (trace_insn_fini): Redo cycle handling.
462 * sim-profile.h (PROFILE_DATA): Rename cycle handling members.
463 * sim-profile.c (profile_print_model): Update.
467 * gennltvals.def (m32r): Use common syscall.h now.
468 (mn10300): Add entry.
469 * nltvals.def: Regenerate.
471 * sim-engine.c (sim_engine_get_run_state): New function.
472 * sim-engine.h (sim_engine_get_run_state): Declare it.
476 * sim-core.h (SIM_CORE_SIGNAL_FN): New typedef.
477 * sim-core.c (sim_core_signal): Make extern, always define.
481 * Make-common.in (CGEN_FLAGS_TO_PASS): New variable.
482 * cgen-ops.h (ANDIF): New macro.
483 (ANDIF[BQHSD]I): Delete.
487 * hw-events.c (create_hw_event, delete_hw_event): Delete.
488 (hw_event_queue_schedule, hw_event_queue_deschedule,
489 bounce_hw_event): Fix hw-event memory corruptions found by Joyce
492 * hw-alloc.h (HW_NZALLOC): Define.
494 * Make-common.in (test-hw-events): Add target for testing the
499 * Make-common.in (SIM_COMMON_HW_OBJS): Add hw-handles.o and
501 hw-handles.c, hw-instances.c, hw-handles.h, hw-instances.h: New
503 * hw-main.h: Include hw-handles.h, hw-instances.h.
504 * hw-base.h ({create,delete}_hw_{handles,instances}_data): Declare
505 * hw-base.c (hw_create, hw_delete): Call same.
509 * dv-core.c: Include hw-main.h and sim-main.h.
510 * dv-pal.c: Include hw-main.h and sim-io.h.
511 * dv-glue.c: Include hw-main.h.
513 * hw-main.h: New file. Move list of includes to here.
514 * hw-base.h: From here.
515 * Make-common.in (hw_base_headers): Rename to hw_main_headers.
516 (hw-*.o, dv-*.o): Update.
517 * hw-tree.c, hw-base.c, hw-properties.c, hw-ports.c, hw-device.c,
518 hw-events.c, hw-alloc.c, sim-hw.c: Include hw-main.h instead of
521 * hw-base.h (do_hw_attach_regs, do_hw_poll_read_method,
522 do_hw_poll_read): Move declarations from here.
523 * hw-main.h: To here.
525 * hw-base.h (struct hw_device_descriptor, hw_finish_callback):
527 * hw-main.h (struct hw_descriptor, hw_finish_method): To here,
529 * Make-common.in (hw-config.h): Update
530 * hw-base.c, dv-pal.c, dv-glue.c: Update
532 * dv-glue.c, hw-device.h, hw-base.h, hw-ports.c: Rename
533 `*_callback' to `*_method.
537 * hw-base.h (set_*): Move set method macros from here.
538 * hw-device.h: To here.
542 * hw-base.h (create_hw_property_data, delete_hw_property_data):
545 * hw-base.c (hw_create, hw_delete): Call
546 * hw-properties.c (create_hw_property_data,
547 delete_hw_property_data): Define.
551 * hw-device.c, hw-properties.c: Include hw-base.h
553 * hw-alloc.h, hw-alloc.c: New files. Move alloc code to here.
554 * hw-device.c: From here.
555 * hw-base.h: Include "hw-events.h".
557 * hw-base.h (create_hw_alloc_data, delete_hw_alloc_data): Declare.
558 * hw-base.c (hw_create, hw_delete): Call.
559 * hw-alloc.c (create_hw_alloc_data, delete_hw_alloc_data): Define.
561 * Make-common.in (SIM_NEW_COMMON_OBJS): Add hw-alloc.o.
562 (hw-alloc.o): New target.
566 * hw-events.h, hw-events.c: New files. Move event code to here.
567 * sim-hw.c: From here.
568 * hw-base.h: Include "hw-events.h".
569 * Make-common.in (SIM_NEW_COMMON_OBJS): Add hw-events.o.
570 (hw-events.o): New target.
572 * hw-device.h (struct hw): Add struct hw_event_data events_of_hw.
573 * hw-events.h (struct hw_event): Replace typedef hw_event.
575 * hw-base.h (create_hw_event_data, delete_hw_event_data): Declare.
576 * hw-base.c (hw_create, hw_delete): Call.
577 * hw-events.c (create_hw_event_data, delete_hw_event_data): Define.
583 * hw-base.c (panic_hw_port_event, empty_hw_ports): Move from here.
584 * hw-ports.c: To here.
586 * hw-base.h, hw-ports.c (create_hw_port_data,
587 delete_hw_port_data): New functions.
588 * hw-base.c (hw_delete, hw_create): Call same.
590 * hw-base.h (set_hw_ports, set_hw_port_event): Move set functions
592 * hw-ports.h: To here.
596 * hw-device.c (hw_ioctl), hw-device.h (hw_ioctl_callback): Drop
597 PROCESSOR and CIA arguments.
601 * aclocal.m4 (SIM_AC_OPTION_HW): Add enable / disable argument.
602 Move common object files from here.
603 * Make-common.in (SIM_COMMON_HW_OBJS): To here.
607 * sim-hw.c: Include ctype.h.
608 (do_hw_poll_read): Do not assume EAGAIN.
612 * cgen-trace.c (first_insn_p): New static local.
613 (trace_insn_init): Set it.
614 (trace_insn_fini): Use TRACE_PREFIX.
615 (trace_insn): Rewrite to use trace_prefix.
616 * sim-trace.c (trace_prefix): Don't print filename arg if NULL.
617 Adjust width accordingly.
619 * sim-profile.h (PROFILE_DATA): New member profile_any_p.
620 (PROFILE_ANY_P,PROFILE_INSN_P,PROFILE_MEMORY): New macros.
621 (PROFILE_SCACHE_P,PROFILE_PC_P,PROFILE_CORE_P): New macros.
622 (PROFILE_COUNT_INSN,PROFILE_COUNT_READ,PROFILE_COUNT_WRITE): Simplify.
623 (PROFILE_COUNT_CORE): Simplify.
624 * sim-profile.c (profile_option_handler): Compute profile_any_p.
628 * cgen-ops.h (ADDCFSI): Fix typo.
632 * cgen-sim.h (CGEN_CPU): New members idesc_{read,sem}_init_p.
633 * genmloop.sh: Use them rather than static locals.
635 * sim-engine.c (sim_engine_set_run_state): New function.
636 * sim-engine.h (sim_engine_set_run_state): Declare.
637 * genmloop.sh (pending_reason,pending_sigrc): New static locals.
638 (@cpu@_engine_stop): New args reason,sigrc. All callers updated.
639 (engine_resume): Reorganize. Allow synchronous exit from main loop.
643 * cgen-trace.c (trace_insn_init): New arg first_p.
645 (trace_insn_fini): New arg last_p. All callers updated.
646 * cgen-trace.h (trace_insn_init,trace_insn_fini): Update.
647 (TRACE_INSN_INIT,TRACE_INSN_FINI): Update.
648 * genmloop.sh (engine_resume): Update.
652 * Make-common.in (install-common): Run ranlib on installed copy of
657 * Make-common.in (install-common): Rename and install libsim.a.
661 * sim-io.c (unistd.h): Include.
665 * Make-common (sim_main_headers): Sort.
666 (cgen-*.o): Add cgen-sim.h dependency.
668 * cgen-scache.c (scache_init): Only allocate space if scache element
670 (scache_flush,scache_print_profile): Check if scache in use first.
672 * cgen-sim.h (IDESC): Provide forward declaration.
674 (CGEN_CPU): Always define scache member. New members idesc,opcode.
675 (cgen_cpu_max_extra_bytes): Declare.
676 * cgen-utils.c (cgen_cpu_max_extra_bytes): New function.
678 * cgen.sh: s/@arch@/${arch}/ for cpu files.
680 * sim-cpu.h: New file. sim_cpu_base moved here.
681 Move sim_cpu_lookup decl here.
682 * sim-base.h: #include "sim-cpu.h".
683 * sim-cpu.c: New file.
684 * Make-common (sim_main_headers): Add sim-cpu.h.
685 (sim-cpu.o): Add rule for.
687 * sim-model.c (set_model): Delete.
688 (sim_model_set,model_set): New functions.
689 (sim_model_install): Renamed from model_install.
690 Don't set default model here.
691 (model_option_handler): Rewrite --model processing.
692 (sim_model_lookup,sim_mach_lookup): New functions.
693 * sim-model.h (MAX_MODELS,MAX_INSNS): Delete.
694 (insn_timing): Delete.
695 (INSN_TIMING): New member `num'.
696 (IMP_PROPERTIES): Always define scache_elm_size member.
697 (MACH): New member init_cpu.
698 (sim_machs): Renamed from machs.
699 (sim_model_install): Renamed from model_install.
700 (sim_model_set,sim_model_lookup,sim_mach_lookup): Declare.
701 * sim-module.c (modules): Update.
703 * sim-profile.c (profile_print_insn): Add cpu arg to INSN_NAME macro.
705 * sim-io.c: #include <errno.h>.
709 * dv-pal.c (struct hw_pal_device): Add reader.
710 (hw_pal_finish): Initialize reader.
711 (scan_hw_pal): Use reader.
713 * hw-base.h, sim-hw.c (do_hw_poll_read): New function.
714 (HW_IO_EOF, HW_IO_NOT_READY): Define.
717 * sim-io.h, sim-io.c (sim_io_poll_read): New function. Copy from
718 ../ppc/main.c sim_io_read_stdin.
722 * hw-tree.h (hw_tree_print): Paramaterize with print and file
726 * hw-base.h (hw_port_event_callback): Delete CPU/CIA args.
727 * hw-device.h (hw_io_read_buffer, hw_io_write_buffer): Delete
729 * hw-ports.h (hw_port_event): Ditto.
730 * hw-ports.c (hw_port_event): Update.
731 * hw-base.c (panic_hw_io_read_buffer, panic_hw_io_write_buffer):
733 * dv-pal.c (hw_pal_io_read_buffer, hw_pal_io_write_buffer):
735 (hw_pal_io_write_buffer): Call hw_halt not sim_engine_halt.
736 (do_counter_event): Update.
737 * dv-glue.c (hw_glue_io_read_buffer): Update.
738 (hw_glue_port_event): Update.
740 * hw-device.h (SIM_DESC): Replace with struct sim_state.
741 * hw-base.h (hw_create): Ditto.
742 * hw-base.c (hw_create): Ditto.
744 * hw-device.c (hw_abort, hw_trace, hw_hw_event_queue_schedule,
745 hw_event_queue_deschedule, hw_event_queue_time): Delete, moved
748 * hw-device.h (hw_system_cpu): Declare.
749 * sim-hw.c (hw_system_cpu): New function.
751 * sim-core.c (sim_core_map_attach, sim_core_attach): Call
752 sim_hw_abort not hw_abort.
754 (sim_core_read_buffer, sim_core_write_buffer): Call
755 sim_hw_io_read_buffer and sim_hw_io_write_buffer. Do not pass CPU
757 (sim_core_set_xor): Do not pass CPU when aborting.
759 * sim-n-core.h (sim_core_read_aligned_N,
760 sim_core_write_aligned_N): Call sim_hw_abort not hw_abort.
761 (sim_core_read_aligned_N, sim_core_write_aligned_N): Call
762 sim_cpu_hw_io_read_buffer and sim_cpu_hw_io_write_buffer. Does not
765 * sim-hw.h: Declare sim_hw_io_{read,write}_buffer. Declare
767 * sim-hw.c (sim_hw_io_read_buffer, sim_hw_io_write_buffer,
768 sim_cpu_hw_io_read_buffer, sim_cpu_hw_io_write_buffer): New
770 (sim_hw_print): New function.
772 * sim-engine.h (sim_engine_vabort): Declare.
773 * sim-engine.c (sim_engine_vabort): New function.
777 * sim-trace.c (print_data): For floating-point numbers trace raw
779 (trace_result_fp2): New function.
780 * sim-trace.h (trace_result_fp2): New declaration.
781 (TRACE_FP_RESULT2): New macro.
785 * common/aclocal.m4: call AM_EXEEXT in SIM_AC_COMMON, define
786 AM_CYGWIN32 and AM_EXEEXT.
787 * common/Make-common.in: set EXEEXT, add missing EXEEXTs
788 to run and install-common rules.
789 * common/configure: regenerate
793 * sim-types.h (cell_word): New type.
794 (natural_cell): Delete type.
796 Sun Apr 26 15:31:55 1998 Tom Tromey <tromey@creche>
798 * configure: Regenerated to track ../common/aclocal.m4 changes.
803 * acconfig.h (NEED_DECLARATION_PRINTF): Removed.
805 Fri Apr 24 14:16:40 1998 Tom Tromey <tromey@creche>
807 * configure: Regenerated to track ../common/aclocal.m4 changes.
812 * acconfig.h: New file.
813 * Make-common.in (top_builddir): New macro.
815 (INTLLIBS): New macro.
816 (INTLDEPS): Likewise.
817 (LIBDEPS): Use INTLDEPS.
818 (EXTRA_LIBS): Use INTLLIBS.
819 * aclocal.m4 (SIM_AC_COMMON): Call CY_GNU_GETTEXT.
820 (CY_WITH_NLS, CY_GNU_GETTEXT, AM_PATH_PROG_WITH_TEST,
821 AM_LC_MESSAGES): New macros from GNU gettext.
825 * sim-config.h: Discard leading _ from macros.
826 * sim-types.h: Ditto.
830 * Make-common.in (CSEARCH): Add -I to intl directories.
831 (INTL_LIB): Point to libintl.a.
832 (LIBDEPS): Add $(INTL_LIB).
837 * cgen-types.h (GETHIDI,MAKEDI): Tweak.
839 * cgen-ops.h (ADDCFSI): Fix.
844 * sim-types.h (signed_address, unsigned_address): Define.
848 * sim-fpu.c (sim_fpu_2d): Don't return an SNaN, convert it into a
853 * sim-fpu.c, sim-fpu.h (sim_fpu_fractionto, sim_fpu_tofraction):
854 New functions, pack / unpack sim_fpu struct using raw values.
855 (sim_fpu_is): Differentiate between negative and positive
860 * sim-bits.h (EXTEND4): Define.
861 (EXTEND4, EXTEND15, EXTEND11): Ditto.
865 * sim-memopt.c (parse_addr): Sunos 4.5 does not have strtol
866 declared so we need this cast to prevent long long addresses
867 from being misconfigures. Results in access to unmapped memory.
871 * Make-common.in (RUNTESTFLAGS): Define.
872 (check): Pass RUNTESTFLAGS to recursive make.
876 * sim-info.c (sim_info): Be verbose when either VERBOSE or
881 * aclocal.m4 (sim-inline): By default, disable sim-inline when
886 * aclocal.m4 (sim-cflags): Add -fomit-frame-pointer to defaults.
887 (sim-inline): Update to match sim-inline.[hc]
888 * configure: Regenerated to track ../common/aclocal.m4 changes.
890 * Make-common.in (sim_main_headers): Add sim-inline.h
892 * sim-bits.h (sim-bits.c): Include when H_REVEALS_MODULE_P.
894 * sim-endian.h (sim-endian.c): Ditto.
896 * sim-events.h (_SIM_EVENTS_H_): Replace with SIM_EVENTS_H.
897 (sim_events_set_trace): Delete unused prototype.
899 * sim-core.h (_SIM_CORE_H_): Replace with SIM_CORE_H.
900 * sim-core.c (_SIM_CORE_C_): Ditto for SIM_CORE_C.
902 * sim-fpu.h (sim-fpu.c): Include when H_REVEALS_MODULE_P.
903 (sim_fpu_to232i, sim_fpu_to232u, sim_fpu_i232to, sim_fpu_u232to):
904 Comment out, not yet implemented in sim-fpu.c.
905 (sim_fpu_zero, sim_fpu_one, sim_fpu_two, sim_fpu_qnan,
906 sim_fpu_max32, sim_fpu_max64): Mark as EXTERN_SIM_FPU.
908 * sim-inline.h: Rewrite description.
909 (H_REVEALS_MODULE_P, C_REVEALS_MODULE_P): Define.
910 (SIM_MAIN_INLINE): Add inline option.
912 * sim-inline.c (semantics.c, idecode.c, engine.c, ...): Do not
913 include generated files. Handled by generator directly.
917 * sim-trace.c (set_trace_option_mask): Keep TRACE_ANY_P
920 * sim-trace.h (TRACE_ANY_P): Define.
921 (struct _trace_data): Add trace_any_p.
925 * run.c (main): Handle all alternatives of enum sim_stop.
926 (main): Delete unused `asection *s'.
930 * hw-tree.h, hw-tree.c (hw_tree_vparse): New function
932 * configure: Regenerated to track ../common/aclocal.m4 changes.
934 * sim-hw.c: New file.
935 * sim-hw.h (sim_hw_parse): Declare function.
936 (hw-tree.h): Do not include.
938 * sim-base.h (STATE_HW): Define.
939 (struct sim_state_base): Add member struct *hw.
941 * sim-module.c (sim-hw.h): Include.
942 (modules): Add sim_hw_install.
944 * aclocal.m4 (sim_hw_obj): Add sim-hw.o
948 * sim-base.h (CPU_INDEX): Define.
950 * sim-utils.c (sim_state_alloc): Initialize.
951 * sim-module.c (sim_post_argv_init): Ditto.
955 * aclocal.m4 (sim_hw_obj): Fix sed expression to generate
956 properly formatted lists.
960 * dv-pal.c (enum hw_pal_address_mask): From Stu Grossman, was
961 0x2f needs to be 0x3f.
965 * hw-tree.c (hw_tree_find_property): Return NULL when device is
967 (hw_tree_find_*_property): Clean up error message when property is
970 * dv-pal.c (hw_pal_io_read_buffer): Check the smp property is
971 present before looking for it.
975 * aclocal.m4 (AC_CHECK_HEADERS): Add check for fpu_control.h.
976 (AC_CHECK_FUNCS): Add check for __setfpucw.
977 * configure: Regenerated.
981 * dv-pal.c (hw_pal_countdown, hw_pal_countdown_value,
982 hw_pal_timer, hw_pal_timer_value): Define.
983 (hw_pal_io_read_buffer, hw_pal_io_write_buffer): Add timer support
984 (do_counter_event, do_counter_read, do_counter_value,
985 do_counter_write): new functions.
989 * hw-tree.c (hw_printf): Send tree dump to stderr, same as other
992 * hw-base.c (hw_create): Stop searching for a device when one is
997 * configure: Regenerated to track ../common/aclocal.m4 changes.
1001 * aclocal.m4 (SIM_AC_OPTION_HARDWARE): Add second argument,
1002 appends extra devices.
1003 (SIM_AC_OPTION_HARDWARE): Substute sim_hw, a non-duplicate list of
1006 * Make-common.in (hw-config.h): New target, create hw-config.h
1008 (SIM_HW): Definition from @sim_hw@.
1009 (hw-base.o): Depend on hw-config.h
1013 * Make-common.in: Get SHELL from configure.
1014 * (stamp-tvals sim-inline.c): Use $(SHELL) when invoking
1015 move-if-change. Fixes NT native build problem.
1016 * Makefile.in (nltvals.def): Use $(SHELL) when invoking
1017 move-if-change. Fixes NT native build problem.
1018 * configure: Regenerate with autoconf 2.12.1 to fix shell issues for
1023 * hw-device.h, hw-device.c (hw_strdup): New function.
1025 * hw-base.c (hw_create): Use hw_strdup when saving a copy of the
1026 strings name, family and args.
1027 (full_name_of_hw): Use hw_strdup when returning the full path.
1029 * hw-properties.c: Clean up property not found / wrong type error
1032 * hw-tree.c (hw_tree_parse): Finish a devices initialization
1033 before attaching any ports.
1035 * hw-base.c (hw-config.): Include. Replace hardwired table.
1037 * dv-glue.c: Copy over ../ppc/hw_glue.c. Update to new framework.
1039 * Make-common.in: Add rule for dv-glue.o.
1043 * hw-base.c (hw_finish): Move setting of trace level to here.
1044 (hw_create): From here.
1046 * hw-base.h, hw-base.c (do_hw_attach_regs): Copy function from
1047 ../ppc/device_table.c.
1049 * dv-pal.c (hw_pal_finish): Attach PAL device to parent bus.
1051 * hw-tree.c (print_properties): Supress path when printing
1052 properties of root node.
1056 * hw-device.h (HW_TRACE): Define.
1057 (hw_trace): Declare.
1058 * hw-device.c (hw_trace): Implement function.
1060 * hw-base.c (hw_create): Set hw trace level from "trace?"
1063 * dv-core.c (dv_core_attach_address_callback): Add trace.
1065 * dv-pal.c: Replace DTRACE with HW_TRACE.
1069 * hw-device.h (HW_ZALLOC, HW_MALLOC): New macros.
1070 (hw_alloc_data): Delcare.
1071 (struct hw): Add member alloc_of_hw.
1073 * hw-device.c (hw_zalloc, hw_malloc, hw_free, hw_free_all): New
1074 functions. Assocate memory with a device.
1075 (stdlib.h): Include.
1077 * hw-base.h (set_hw_delete): Define.
1078 (hw_delete_callback): Declare.
1079 (hw_delete): Declare.
1081 * hw-base.c (hw_delete): Implement function.
1082 (struct hw_base_data): Add member to_delete.
1083 (ignore_hw_delete): New function, does nothing.
1084 (hw_create): Set the hw_delete method.
1085 (hw_create): Allocate the base type using HW_ZALLOC before setting
1088 * hw-tree.h, hw-tree.c (hw_tree_delete): New function.
1090 * hw-properties.c: Replace zalloc/zfree with hw_zalloc/hw_free.
1092 * hw-ports.c: Replace zalloc/zfree with hw_zalloc/hw_free.
1093 (attach_hw_port_edge): Add struct hw argument
1095 * dv-pal.c (hw_pal_finish): Replace zalloc/zfree with
1100 * hw-device.h (hw_attach_address_callback,
1101 hw_detach_address_callback): Attach to a single space not a space
1102 mask. Clarify interpretation of SPACE:ADDR parameters.
1104 * hw-base.c (passthrough_hw_attach_address,
1105 passthrough_hw_detach_address): Update.
1106 * dv-core.c (dv_core_attach_address_callback): Ditto.
1107 * dv-pal.c (hw_pal_attach_address): Ditto.
1111 * sim-options.h: Document additional CPU arg to OPTION_HANDLER.
1115 * Make-common.in (SIM_HW_OBJS, SIM_HW_SRC, SIM_DV_OBJS): Define.
1116 (hw-base_h, hw-device_h, hw-handles_h, hw-instances_h, hw_ports_h,
1117 hw-properties_h, hw-tree_h): Define, point at corresponding
1119 (hw_base_headers): Define list of headers included by hw-base.h
1120 (hw-base.o, hw-device.o, hw-instances.o, hw-handles.o, hw-ports.o,
1121 hw-properties.o, hw-tree.o): Specify dependencies.
1122 (dv-core.o, dv-pal.o): Ditto.
1124 * sim-hw.h: New file.
1126 * hw-device.h, hw-device.c, hw-properties.h, hw-properties.c,
1127 hw-ports.h, hw-ports.c: New files. Copied from ../ppc/device.[ch].
1129 * hw-tree.h, hw-tree.c: New files. Copied from ../ppc/tree.[hc].
1131 * hw-base.h, hw-base.c: new files. Copied from
1132 ../ppc/device_table.[hc].
1134 * dv-core.c, dv-pal.c: New files. Copied from
1135 ../ppc/hw_{core,pal}.c
1137 * sim-basics.h (struct hw): Declare.
1138 (enum port_direction, enum object_disposition): Declare.
1142 * aclocal.m4 (SIM_AC_OPTION_HARDWARE): Set sim_hw_obj, sim_dv_obj,
1143 sim_dv_src in Makefile. Take list of devices as parameter to m4
1146 * configure: Regenerated to track ../common/aclocal.m4 changes.
1150 * sim-trace.h, sim-trace.c (trace_prefix): Pass in sim_cia so that
1151 trace_prefix can abort cleanly.
1155 * dv-sockser.c, dv-sockser.h: New files.
1156 * Make-common.in (dv-sockser.o): Add rule for.
1157 * aclocal.m4: Check for fcntl.h.
1158 * config.h: Add HAVE_FCNTL_H.
1160 * sim-break.c (remove_breakpoint): Fix thinko.
1162 * sim-hload.c (sim_load): Provide default value of SIM_HANDLES_LMA.
1163 Use SIM_HANDLES_LMA for lma_p arg to sim_load_file.
1167 * sim-base.h (struct sim_state_base): Add prog_syms and
1168 define macro STATE_PROG_SYMS.
1169 * sim-trace.c (trace_prefix): Add variables abfd, symsize,
1170 symbol_count, and asymbols. Call bfd_get_symtab_upper_bound
1171 and bfd_canonicalize_symtab, to get symbol table on first use
1172 and preserve it via STATE_PROG_SYMS for future calls to
1173 bfd_find_nearest_line.
1177 * sim-core.h, sim-core.c (sim_core_map_to_str): Delete.
1179 * sim-core.c (sim_core_attach): Handle a generic number of maps -
1180 up to nr_maps, not just access_* maps.
1182 * sim-profile.h (struct PROFILE_DATA): Track nr_maps different
1185 * sim-profile.c (profile_print_core): Make map unsigned. Iterate
1186 over nr_maps not sim_core_nr_maps.
1188 * sim-events.h, sim-events.c (sim_events_watch_core): Change
1189 core_map argument to unsigned.
1190 (struct _sim_core): Ditto for struct member core_map.
1192 * sim-core.h (nr_sim_core_maps, sim_core_*_map): Delete
1194 * sim-basics.h (access_io, access_*_io): Define.
1195 (map_read, map_write, map_exec, map_io): Define.
1197 * sim-core.c, sim-core.h (sim_core_attach): Replace argument
1198 attach with more generic mapmask.
1199 (sim_core_{read,write}_*): Change map argument to unsigned.
1201 * sim-core.c (sim_core_uninstall, sim_core_attach,
1202 sim_core_detach): Iterate over nr_maps instead of
1205 * sim-break.c (insert_breakpoint): Write breakpoints to exec_map
1206 instead of the write_map.
1207 (remove_breakpoint): Ditto.
1209 * genmloop.sh (engine_resume_full): Replace sim_core_*_map
1210 with read_map, write_map, exec_map resp.
1212 * cgen-mem.h (DECLARE_GETMEM, DECLARE_SETMEM, DECLARE_GETIMEM):
1215 * cgen-utils.c (sim_disassemble_insn): Ditto.
1217 * sim-hrw.c (sim_write, sim_write): Ditto.
1219 * sim-utils.h, sim-utils.c (access_to_str, map_to_str,
1220 transfer_to_str): New functions.
1224 * sim-base.h (sim_state_base): New member environment.
1225 (STATE_ENVIRONMENT): New macro.
1226 * sim-config.c (current_environment): Delete.
1227 (sim_config_default): New function.
1228 (sim_config): Set STATE_ENVIRONMENT, not current_environment.
1229 * sim-config.h (current_environment,CURRENT_ENVIRONMENT): Delete.
1230 (sim_config_default): Add prototype.
1231 * sim-module.c (sim_pre_argv_init): Call sim_config_default.
1232 * sim-options.c (standard_option_handler, case OPTION_ENVIRONMENT):
1233 Set STATE_ENVIRONMENT, not current_environment.
1237 * sim-fpu.c (NR_GUARDS64): Change NR_PAD32 to NR_PAD64.
1241 * sim-types.h (SIGNED32, SIGNED64): Pacify GCC.
1243 * sim-alu.h (ALU64_BEGIN): Make alu64_r unsigned.
1247 * Make-common.in (TAGS): Make smarter.
1248 * Makefile.in (TAGS): Ditto.
1252 * sim-module.c (*): Fix typos in assertion tests.
1256 * sim-module.c (sim_pre_argv_init): String passed to asprintf
1259 * sim-options.c (sim_parse_args): Ditto.
1260 (sim_args_command): Return OK, instead of nothing, for an empty
1265 * sim-profile.c (profile_info): Rename from profile_print. Drop
1266 misc and misc_cpu callback arguments. Use
1267 PROFILE_INFO_CPU_CALLBACK and STATE_PROFILE_INFO_CALLBACK instead.
1268 (profile_install): Install profile_info function.
1270 * sim-profile.h (PROFILE_INFO_CPU_CALLBACK,
1271 STATE_PROFILE_INFO_CALLBACK): Define.
1272 (struct PROFILE_DATA): Add field info_cpu_callback.
1273 (profile_print): Delete function.
1275 * sim-base.h (STATE_MODULES): Define. Replace individual
1276 STATE_*_LIST with single struct module_list.
1278 * sim-module.h (MODULE_INFO_FN, MODULE_INFO_LIST): Declare.
1279 (struct module_list): Declare.
1281 * sim-module.h, sim-module.c (sim_module_add_info_fn,
1282 sim_module_info): New functions.
1283 (sim_module_install): Clean up module data structures.
1285 * sim-info.c (sim_info): New file. New function. Call
1288 * Make-common.in (sim-info.o): Define rule.
1289 (SIM_NEW_COMMON_OBJS): Add sim-info.o.
1294 * sim-base.h (sim_cpu_base): New members name, options.
1295 (sim_cpu_lookup): Add prototype.
1296 * sim-module.c (sim_pre_argv_init): Provide default names for cpus.
1297 * sim-options.h (DECLARE_OPTION_HANDLER): New argument `cpu'.
1298 (sim_add_option_table): Update prototype.
1299 * sim-options.c (sim_add_option_table): New argument `cpu'.
1300 (standard_option_handler,standard_install): Update.
1301 (sim_parse_args): Handle cpu specific options.
1302 (print_help): New static function.
1303 (sim_print_help): Call it. Print cpu specific options.
1304 (find_match): New static function.
1305 (sim_args_command): Call it. Handle cpu specific options.
1306 * sim-utils.c (sim_cpu_lookup): New function.
1307 * sim-memopt.c (memory_option_handler): Update.
1308 (sim_memopt_install): Update.
1309 * sim-model.c (model_option_handler): Update.
1310 (model_install): Update.
1311 * sim-profile.c (profile_option_handler): Update.
1312 (profile_install): Update.
1313 * sim-trace.c (trace_option_handler): Update.
1314 (trace_install): Update.
1315 * sim-watch.c (watchpoint_option_handler): Update.
1316 (sim_watchpoint_install): Update.
1317 * cgen-scache.c (scache_option_handler): Update.
1318 (scache_install): Update.
1322 * Make-common.in (check): Run `make check' in testsuite dir.
1326 * sim-trace.c (trace_result0): New function.
1328 * sim-trace.h (TRACE_FP_*, TRACE_FPU_*): Rename TRACE_FPU_*
1329 macro's to TRACE_FP_*. TRACE_FPU_* should be defined and used when
1330 tracing sim_fpu variables.
1331 (TRACE_ALU_RESULT0): Define.
1332 (TRACE_FP_RESULT_WORD): Define.
1333 (TRACE_FP_INPUT_WORD1): Define.
1335 * sim-fpu.c, sim-fpu.h (sim_fpu_max32, sim_fpu_max64, sim_fpu_one,
1336 sim_fpu_two): New constants.
1337 (sim_fpu_op1, sim_fpu_op2): New types.
1338 (struct _sim_fpu): Delete member result. Re-order other members.
1339 (sim_fpu_sign, sim_fpu_exp): New functions.
1340 (sim_fpu_max, sim_fpu_min): new functions.
1341 (EXPMAX32, EXPMAX64, NR_PAD32, NR_PAD64, NR_GUARDS32, NR_GUARDS64,
1342 NORMAL_EXPMAX32, NORMAL_EXPMAX64): Define.
1346 * sim-profile.c (profile_print): Delete duplicate test of
1348 (profile_print_pc): Exit early if data collection not set up.
1349 (profile_print_core): Simplify by calling sim_core_map_to_str.
1350 * sim-core.h (sim_core_map_to_str): Declare.
1351 * sim-core.c (sim_core_map_to_str): Make non-static.
1353 * genmloop.sh (engine_resume): Update insn_count before exiting.
1354 (engine_resume_full): Keep accurate core profile data.
1356 * cgen-utils.c (sim_disassemble_insn): Don't use
1357 sim_core_read_aligned_N, it messes up profiling results.
1361 * nltvals.def: Regenerate with MN10300 additions.
1365 * sim-trace.h (TRACE_ALU_RESULT2): Define.
1367 * sim-trace.h, sim-trace.c (trace_result_word2,
1368 trace_input_word4, trace_result_word4): New function.
1372 * cgen-sim.h (SEM_NEXT_PC): New arg `len'.
1374 * sim-xcat.h: Delete.
1375 * cgen-mem.h: Delete inclusion of sim-xcat.h.
1376 * cgen-sim.h: Ditto.
1377 * sim-alu.h: Replace sim-xcat.h with symcat.h.
1378 * sim-n-bits.h: Ditto.
1379 * sim-n-core.h: Ditto.
1380 * sim-n-endian.h: Ditto.
1384 * syscall.c (cb_syscall): Handle short reads, and EOF.
1388 * sim-trace.c (print_data): case trace_fmt_fp missing break. Use
1389 sim_fpu to safely print fp_word values.
1390 (print_data): Add trace_fmt_bool and trace_fmt_addr.
1391 (trace_result_bool1, trace_result_addr1): New functions.
1392 (trace_input_bool1, trace_input_addr1): New functions.
1394 * sim-trace.h (TRACE_FPU_*): Define.
1398 * sim-fpu.h (enum sim_fpu_class): Add sim_fpu_class_denorm.
1399 (sim_fpu_fpto, sim_fpu_tofp): Define.
1403 * sim-fpu.c (sim_fpu_cmp): New function.
1407 * cgen-utils.h (sim_disassemble_insn): Use CGEN_INSN_BITSIZE
1408 instead of abuf->length.
1409 * sim-trace.c (trace_options): Have -t only trace a few useful things.
1410 (set_trace_option_mask): Renamed from set_trace_options.
1411 (set_trace_option): New function.
1412 (trace_option_handler): Update calls to set_trace_option{,_mask}.
1413 * sim-trace.h (TRACE_USEFUL_MASK): New macro.
1417 * sim-basics.h: Declare struct _sim_fpu.
1421 * sim-trace.h (TRACE_ALU_INPUT*, TRACE_ALU_RESULT): Define.
1422 (trace_prefix, trace_input*, trace_result*): Declare.
1423 (trace_one_insn): Change declaration, assume trace_prefix called.
1424 (trace_generic): Like trace_one_insn.
1425 (TRACE_ALU_IDX, TRACE_*_IDX): Change #define's to enum.
1426 (TRACE_alu, TRACE_[a-z]*): Update.
1428 * sim-trace.c (trace_prefix, trace_input*, trace_result*,
1429 trace_insn, save_data, trace_idx_to_str, print_data): New
1431 (trace_one_insn): Rewrite.
1432 (trace_generic): New function.
1436 * Make-common.in (CGEN_MAIN_SCM): Update.
1437 * aclocal.m4 (USE_MAINTAINER_MODE): New variable.
1439 * cgen-sim.h (SEMANTIC_CACHE_FN): Delete.
1440 (SEMANTIC_FN): Rewrite declaration.
1441 (DECODE): Update type of semantic_fast member.
1442 ({EX,SEM}_FN_NAME): Have only one version.
1443 * cgen.sh: Support building cpu.c.
1444 * sim-base.h (sim_state_base): Delete conditionals surrounding
1449 * sim-load.c (sim_load_file): Print LMA/VMA according to value
1454 * sim-core.c: Add missing prototypes for WITH_DEVICES.
1455 Add missing parameters to device_io calls.
1456 * sim-core.h: Add missing parameters to device_io calls.
1460 * cgen-sim.h (DECODE): Always use switch for `read' for now.
1461 (PAREXEC): Renamed from PARALLEL_EXEC. All uses updated.
1462 (SEMANTIC{,_CACHE}_FN): Fix return type.
1463 * cgen.sh (decode): Add s/@arch@/$arch/.
1464 * genmloop.sh (@cpu@_engine_run): Delete `current_state'.
1465 (engine_resume): Likewise. Make `engine' volatile. Save copy
1466 of cpu pointer in volatile object. Initialize read switch if
1471 * cgen-sim.h (EX_FN_NAME): _exc_ -> _ex_.
1472 (SEM_INSN): New macro.
1476 * sim-run.c (sim_engine_run): Assume IMEM is 32 bit.
1480 * configure: Regenerated to track ../common/aclocal.m4 changes.
1484 * sim-types.h (fp_word): New type, define according to
1485 WITH_TARGET_FLOATING_POINT_BITSIZE.
1487 * aclocal.m4 (default_sim_floating_point_bitsize): Add
1488 configuration of size of floating point registers.
1492 * sim-profile.c (profile_print): Only print CPU <N> if other
1493 output is going to appear.
1497 * configure: Regenerated to track ../common/aclocal.m4 changes.
1501 * sim-types.h (address_word): Typedef according to
1502 WITH_TARGET_ADDRESS_BITSIZE.
1503 (signed_cell, unsigned_cell, natural_cell): Ditto using
1504 WITH_TARGET_CELL_BITSIZE.
1506 * sim-config.h (WITH_TARGET_ADDRESS_BITSIZE): Define.
1507 (WITH_TARGET_CELL_BITSIZE): Define.
1508 (WITH_HOST_WORD_BITSIZE): Delete.
1510 * sim-config.c (print_sim_config): Update.
1512 * aclocal.m4 (SIM_AC_OPTION_BITSIZE): Add support for
1513 configuration of address and OpenFirmware cell sizes.
1517 * sim-engine.h (sim_engine_run): Add argument nr_cpus.
1518 * sim-run.c (sim_engine_run): Update.
1520 * sim-engine.h (SIM_ENGINE_HALT_HOOK): Use SET_CPU_CIA instead of
1522 * sim-run.c (sim_engine_run): Ditto.
1524 * sim-resume.c (sim_resume): Obtain nr_cpus from sim_engine.
1525 (sim_resume): Pass nr_cpus to sim_engine_run.
1527 * sim-engine.h (struct _sim_engine): Add member nr_cpus.
1529 * sim-engine.c (sim_engine_init): Hardwire nr_cpus to
1531 (sim_engine_nr_cpus) sim-engine.c, sim-engine.h: New function
1535 * cgen.sh: Portably read parms past $9.
1539 * Make-common.in (stamp-tvals): New rule.
1540 (targ-vals.h,targ-map.c): Depend on it.
1541 (clean): Remove stamp-tvals.
1545 * sim-utils.c (sim_state_alloc): #if 0 variable that is only used
1546 in code also #if 0'ed.
1548 Mon Jan 19 22:26:29 1998 Doug Evans <devans@seba>
1550 * configure: Regenerated to track ../common/aclocal.m4 changes.
1551 * aclocal.m4: Recognize --enable-maintainer-mode.
1555 start-sanitize-cygnus
1556 * Make-common.in (cgen-{arch,cpu,decode}): New targets.
1557 * cgen.sh: New file.
1559 * cgen-scache.h: Deleted.
1560 * Make-common.in (cgen-run.o,cgen-scache.o): Delete cgen-scache.h dep.
1561 (CGEN_CPU_SCM): Add sim-model.scm.
1562 * cgen-scache.c: Only compile contents if WITH_SCACHE.
1563 (scache_init): Use runtime computed size of SCACHE.
1564 (scache_flush): Likewise.
1565 * cgen-mem.h (GETIMEMU[QHSD]I): Declare.
1566 ([GS]ETT{QI,UQI,HI,UHI,SI,USI,DI,UDI}): Declare.
1567 * cgen-sim.h: Scache support moved here.
1568 (PC): Redo definition.
1569 (ARGBUF,SCACHE,PARALLEL_EXEC): Provide forward decls.
1570 (DECODE): Add parallel execution support.
1571 Only include semantic label members if using switch.
1572 (SWITCH,CASE,BREAK,DEFAULT,ENDSWITCH): Portable computed goto support.
1573 (CGEN_CPU): Delete members exec_state, halt_sigrc, halt_jmp_buf.
1574 (IADDR,CIA,SEM_ARG,EX_FN_NAME,SEM_FN_NAME,RECORD_IADDR,SEM_ARGBUF,
1575 SEM_NEXT_PC,SEM_BRANCH_VIA_{CACHE,ADDR},SEM_NEW_PC_ADDR): Moved here
1577 (engine_{stop,run,resume,halt,signal}): Delete decls.
1578 * cgen-types.h (CGEN_{XCAT3,CAT3}): Delete.
1579 (argbuf,scache): Delete forward decls.
1580 (STATE): Delete decl.
1581 * cgen-utils.c: Don't include decode.h, mem-ops.h, sem-ops.h.
1582 Include cgen-mem.h, cgen-ops.h.
1583 (engine_halt,engine_signal): Delete.
1584 ({ex,exc,sem,semc}_illegal): Delete.
1585 (sim_disassemble_insn): Result of extract fn is in bits.
1586 * genmloop.sh: Rewrite.
1588 * cgen-trace.c (trace_insn): Set printed_result_p=0 if not tracing
1591 * sim-base.h (sim_state_base): Delete member `model'.
1592 (sim_cpu_base): Add member `model'.
1593 * sim-model.h (IMP_PROPERTIES): New type.
1594 (MACH): New members imp_props, models.
1595 (models): Delete decl.
1596 * sim-model.c (set_model): Update.
1597 * sim-profile.c (profile_print_model): Update.
1599 * sim-utils.c (sim_state_alloc): Delete setting of cpu backlink here.
1603 * cgen-trace.c (trace_insn): Call CGEN_INSN_MNEMONIC() rather than
1608 * configure: Regenerated to track ../common/aclocal.m4 changes.
1613 * aclocal.m4 (AR): Check for sigaction.
1617 * Make-common.in (sim-core.o): Depend on $(sim_main_headers).
1619 * sim-config.h (WITH_TREE_PROPERTIES): Define as 0.
1620 * sim-config.c (sim_config): Replace WITH_DEVICES with
1621 WITH_TREE_PROPERTIES.
1623 * configure: Regenerated to track ../common/aclocal.m4 changes.
1627 * Make-common.in (SIM_ENVIRONMENT): New variable.
1628 (CONFIG_CFLAGS): Add it.
1629 * aclocal.m4 (SIM_AC_OPTION_ENVIRONMENT): Handle
1630 --enable-sim-environment option.
1631 * configure: Regenerated.
1632 * sim-config.h (environment support): Rewrite.
1633 * sim-config.c (current_environment): Define as enum, unconditionally.
1634 (current_alignment): Define unconditionally.
1635 (config_environment_to_a): Update.
1636 (config_alignment_to_a): Fix type of argument. Define unconditionally.
1637 (sim_config): Handle environment and alignment determination
1638 unconditionally. Delete sanity checks of current_environment,
1640 (print_sim_config): Update.
1641 * sim-options.c (STANDARD_OPTIONS enum): Add OPTION_ENVIRONMENT.
1642 (standard_options): Add --environment.
1643 (standard_option_handler): Likewise.
1647 * sim-alu.h: Add notes on carry vs borrow for subtraction.
1648 (ALU{,8,16,32,64}ADD): Redefine ADD macro as add overflowing.
1649 (ALU{,8,16,32,64}ADDC): Define - add carrying.
1650 (ALU{,8,16,32,64}SUB): Redefine SUB macro as subtract overflowing.
1651 (ALU{,8,16,32,64}SUBB): Define - subtract borrowing.
1652 (ALU{,8,16,32,64}SUBC): Define - tract carrying.
1653 (ALU{,8,16,32,64}ADD_CA, ALU{,8,16,32,64}ADDC_C): Replace single
1654 argument ADD_CA macro with two argument ADDC_C - add carrying with
1656 (ALU{,8,16,32,64}SUB_CA, ALU{,8,16,32,64}SUBC_X): Replace single
1657 argument SUB_CA macro with two argument SUBC_X - subtract
1659 (ALU{,8,16,32,64}SUBB_B): Define - subtract borrowing with
1661 (ALU{,8,16,32,64}NEGC, ALU{,8,16,32,64}NEGB): Define.
1665 * sim-io.c (sim_io_{syscalls,getstring}): Delete. No longer used.
1666 * sim-io.h (sim_io_syscalls): Delete.
1670 * syscall.c (cb_syscall): Add missing else, so write to stdout
1673 * sim-alu.h (ALU{,8,16,32,64}_SET_CARRY): Provide macros to import
1674 the carry bit from the CPU's psw.
1678 * gennltvals.sh: Redo syscall support.
1679 * nltvals.def: Regenerated.
1683 * syscall.c (cb_syscall): If writing to stdout or stderr, flush
1684 the stream immediately.
1688 * sim-io.c (sim_io_getstring): Delete unused len2.
1689 (sim_io_syscalls): Ditto for sys_errno.
1693 * syscall.c (cb_syscall): Test CB_SYSCALL struct magic number.
1695 * Make-common.in (run.o): Depend on remote-sim.h.
1696 (nrun.o,sim-hload.o,sim-hrw.o): Likewise.
1697 (sim-io.o,sim-reason.o,sim-resume.o): Likewise.
1701 * sim-io.c (sim_io_syscalls): Disable lseek.
1705 * gennltvals.sh: Generate syscall values for d30v.
1707 * gennltvals.sh: Use libgloss/syscall.h for sparc.
1708 * nltvals.def: Regenerate.
1710 * callback.c (os_stat): Make 3rd arg a host struct stat ptr.
1711 (os_fstat): Likewise. Validate fd argument.
1712 (cb_host_to_target_stat): Delete big_p arg. If HS arg is NULL,
1713 just compute target stat struct length.
1714 * syscall.c: #include "libiberty.h", <sys/types.h>, <sys/stat.h>.
1715 (ENOSYS,ENAMETOOLONG): Provide definitions if missing.
1716 (get_string): Return host errno values so they can be properly
1718 (cb_syscall): Likewise.
1719 (cb_syscall, cases open,unlink): Use get_path instead of get_string.
1720 (cb_syscall, case read): Use read_stdin for file descriptor 0.
1721 (cb_syscall, case write): Use write_stderr for file descriptor 2.
1722 (cb_syscall): Add cases for lseek, unlink, stat, fstat, time.
1723 (get_path): New function.
1727 * sim-io.c (sim_io_syscalls): New function to provide system call
1728 emulation. Provide exit, open, close, read, write, lseek, and
1730 (sim_io_getstring): New function to return a string from a
1731 simulated memory location.
1733 * sim-io.h (sim_io_syscalls): Add declaration.
1737 * sim-core.c (sim_core_signal): Fix spelling error in message.
1739 * sim-hrw.c (sim_read): Use read map, not write map.
1741 * Make-common.in (all): Add .gdbinit.
1742 * gdbinit.in: Add dump command.
1744 * sim-model.c (model_options): Use '\0' for `shortopt'.
1746 * sim-trace.c (trace_option_handler): Set state trace file
1747 for --trace-file in addition to cpu's values.
1748 (trace_vprintf): If cpu == NULL, try state's trace file.
1749 (trace_options): Reorganize table, reword some descriptions.
1753 * sim-fpu.c (sim_fpu_abs, sim_fpu_neg, sim_fpu_inv), sim-fpu.h:
1758 * sim-reason.c (sim_stop_reason): For sim_signalled, return the
1759 signal untranslated, document problem with this.
1761 * nrun.c (main): Check for a prog name of `*step'. If present,
1762 step the simulator instead of allowing it to run free.
1764 * sim-signal.c (SIGQUIT): Define on _MSC_VER hosts.
1766 * Make-common.in (sim_main_headers): Add sim-signal.h.
1770 * sim-signal.c (sim_signal_to_host): Return 0 for SIM_SIGNONE.
1774 * sim-signal.h: Start simulator signals at 64 so that host signal
1775 numbers can be detected and reported.
1777 * sim-signal.h (SIM_SIGFPE), sim-signal.h: Add signal.
1781 * callback.c (cb_host_to_target_stat): Fix return values.
1783 * cgen-sim.h (enum_signal_type): Delete.
1784 (engine_signal): Update prototype.
1785 * cgen-utils.c: Don't include <signal.h>.
1786 (sim_signal_to_host): Delete, lives in sim-signal.c now.
1787 (engine_signal): Update.
1789 * sim-utils.c (sim_state_alloc): Call SIM_STATE_ALLOC if defined.
1790 (sim_state_free): Call SIM_STATE_FREE if defined.
1792 * sim-module.c (sim_module_install): Don't leave any modules
1793 installed if one fails to install.
1797 * sim-options.c: Don't include ../libiberty/alloca-conf.h any
1798 more, since alloca is not used in this file.
1800 * sim-alu.h (ALU{32,64}_*): Rewrite 32 and 64 bit ALU support to
1801 correctly set the carry and overflow bits for those types.
1802 (ALU{8,16,32,64}_{ADD,SUB}_CA): Take VAL argument to add along
1803 with carry, so carry is correct after doing both adds.
1804 (ALU*): Space out '\' to make it easier to read.
1808 * sim-core.c (sim_core_signal): Use sim_stopped instead of
1811 * sim-signal.c, sim-signal.h: New files.
1812 * Make-common.in (sim-signal.o): Add rule for.
1813 (SIM_NEW_COMMON_OBJS): Add sim-signal.o.
1814 * sim-abort.c: Don't include <signal.h>.
1815 * sim-basics.h: #include "sim-signal.h".
1816 * sim-break.c: Don't include <signal.h>.
1817 (sim_handle_breakpoint): Replace SIGTRAP with SIM_SIGTRAP.
1818 * sim-core.c: Don't include <signal.h>.
1819 (SIGBUS): Delete definition.
1820 (sim_core_signal): Replace SIGSEGV,SIGBUS with SIM_SIGSEGV,SIM_SIGBUS.
1821 * sim-engine.c: Don't include <signal.h>.
1822 (sim_engine_abort): Replace SIGABRT with SIM_SIGABRT.
1823 * sim-reason.c (sim_stop_reason): Call sim_signal_to_host.
1824 * sim-resume.c: Don't include <signal.h>.
1825 (SIGTRAP): Delete definition.
1826 (has_stepped): Replace SIGTRAP with SIM_SIGTRAP.
1827 * sim-stop.c: Don't include <signal.h>.
1828 (control_c_simulation): Replace SIGINT with SIM_SIGINT.
1829 * sim-watch.c: Don't include <signal.h>.
1830 (handle_watchpoint): Replace SIGINT with SIM_SIGINT.
1832 * Make-common.in (SIM_NEW_COMMON_OBJS): New variable.
1834 * sim-base.h (CIA_ADDR): Provide default definition.
1835 * sim-core.c (sim_core_signal): Use CIA_ADDR to fetch value.
1836 * sim-break.c (sim_handle_breakpoint): Likewise.
1840 * Make-common.in (srccom): New variable.
1842 * Make-common.in (DEP, COMMON_DEP_CFLAGS): Define.
1843 (LIB_OBJS): Add syscall.o.
1844 (gentmap): Pass $(NL_TARGET) to $(CC).
1845 (syscall.o): Add rule for.
1846 (sim_main_headers): Add $(SIM_EXTRA_DEPS).
1847 (sim-bits.o): Depend on $(sim-n-bits_h).
1848 (sim-load.o): Depend on callback.h.
1850 * Make-common.in (cgen-*.o): Update dependencies, mem-ops.h renamed to
1851 cgen-mem.h, sem-ops.h renamed to cgen-ops.h.
1852 * cgen-mem.h, cgen-ops.h: New files.
1854 * aclocal.m4 (--enable-sim-scache): Pass -DWITH_SCACHE=0 for "=no".
1856 * Makefile.in (nltvals.def): Depend on gennltvals.sh.
1858 * callback.c: #include string.h or strings.h.
1859 #include sys/types.h and sys/stat.h.
1860 (cb_init_syscall_map,cb_init_errno_map,cb_init_open_map): Declare.
1861 (os_get_errno,os_open): Update.
1862 (os_stat,os_fstat): New functions.
1863 (os_init): Initialize syscall_map, errno_map, open_map.
1864 (default_callback): Add entries for os_stat, os_fstat, syscall_map,
1865 errno_map, open_map, signal_map, stat_map.
1866 (cb_read_target_syscall_maps): New function.
1867 (cb_target_to_host_syscall): New function.
1868 (cb_host_to_target_errno): Renamed from host_to_target_errno.
1869 (cb_target_to_host_open): Renamed from target_to_host_open.
1870 (store): New function.
1871 (cb_host_to_target_stat): New function.
1872 * syscall.c: New file.
1873 * gentmap.c (sys_tdefs): New global.
1874 (gen_targ_vals_h): Output target syscall numbers.
1875 (gen_targ_map_c): Update. Output target syscall translation map.
1876 * gentvals.sh: New first argument `target'. Preface table with
1877 #ifdef NL_TARGET_$target if non-null target passed.
1878 * gennltvals.sh: New file.
1879 * nltvals.def: Regenerated.
1883 * sim-n-core.h (sim_core_read_unaligned_N): Return static
1885 (sim_core_dummy_M): Declare.
1889 * sim-core.c (sim_core_signal): Print the address of the
1894 * sim-base.h (sim_state_base): Move `magic' to end of struct.
1896 * sim-base.h (sim_state_base): Add member trace_data.
1897 (STATE_TRACE_DATA): New macro.
1898 * sim-trace.h (TRACE_DEBUG_IDX,TRACE_debug): New macros.
1899 ({WITH_,}TRACE_DEBUG_P): New macros.
1900 (STATE_TRACE_FLAGS,STRACE_P,STRACE_DEBUG_P): New macros.
1901 (_sim_cpu): Delete forward reference.
1902 (debug_printf): Update.
1903 * sim-trace.c (OPTION_TRACE_DEBUG): Define.
1904 (trace_options): Add --trace-debug.
1905 (set_trace_options): Handle it.
1906 (trace_option_handler): Likewise.
1907 (trace_install): Init state trace_data struct.
1908 (trace_uninstall): Close state trace file.
1909 * sim-events.c (ETRACE): Only print source file and line number if
1911 * sim-n-core.h (sim_core_trace_M): Likewise.
1913 * sim-core.c (sim_core_signal): Add missing "\n" in message.
1917 * sim-n-core.h (sim_core_read_unaligned_N): illegal empty
1919 * sim-types.h (unsigned128,signed128): fix typo for MSVC.
1923 * aclocal.m4 (SIM_AC_OPTION_SCACHE): Fix typo.
1925 * Make-common.in (BUILT_SRC_FROM_COMMON): Remove files no longer
1927 (sim-config.o): Remove non-existent $(sim-nconfig_h) dependency.
1928 (clean): Don't delete $(BUILT_SRC_FROM_COMMON) if building in
1933 * sim-events.c (sim_events_process): Re-compute the time -
1934 update_time_from_event - as each event is processed. Reverses
1939 * callback.c (os_poll_quit): Replace _WIN32 with _MSC_VER.
1943 * sim-events.c (sim_events_process): Delete redundant call to
1944 update_time_from_event.
1945 (sim_events_slip): Always decrement time_from_event.
1946 (sim_events_tick, sim_events_deschedule, update_time_from_event):
1947 Delete assertion that time_from_event >=0 when work in queue, no
1952 * sim-options.c (STANDARD_OPTIONS): Change OPTION_* to an enum.
1953 (standard_option_handler): Update.
1955 * sim-options.h: Clarify documentation.
1956 (OPTION_LONG_ONLY_P): Delete definition.
1957 (OPTION_VALID_P): Define.
1959 * sim-options.c (sim_print_help): Allow short only options.
1960 (sim_parse_args): Ditto.
1961 (sim_args_command): Skip short only options.
1962 (sim_parse_args): Allocate space for NUM_OPTS not just 256. Make
1963 separate entries for short and long options in the HANDLERS and
1965 (sim_parse_args): Disable argument permutation.
1969 * sim-core.h (DECLARE_SIM_CORE_WRITE_N. DECLARE_SIM_CORE_READ_N):
1970 Add argument M, size of data type.
1971 (sim_core_read_misaligned_3, sim_core_write_misaligned_3):
1972 Declare, ditto for 5, 6 & 7 byte transfers.
1973 (sim_core_write_unaligned_1, sim_core_write_unaligned_1): Define
1976 * sim-n-core.h (sim_core_trace_M): Rename from
1977 sim_core_trace_N. Add nr_bytes argument. Replace transfer argument
1978 with transfer type. Print transfer direction. Handle 1 and 2 byte
1980 (sim_core_read_unaligned_N, sim_core_write_unaligned_N): Trace
1982 (unsigned_M, T2H_M, H2T_M): Rename from unsigned_N, T2H_N, H2T_N.
1983 Update all functions.
1985 * sim-core.c: Generate functions starting with 16 not 1.
1986 (sim_core_read_unaligned_3): Generate. Ditto for 3 byte write and
1987 all 5, 6 & 7 byte transfers.
1989 * sim-n-core.h (sim_core_read_misaligned_N,
1990 sim_core_write_misaligned_N): Implement.
1994 * sim-endian.h (U16_8): Implement
1996 * sim-endian.c (sim_endian_split_16, sim_endian_join_16): New functions
1998 * sim-endian.h (VL8_16, VH8_16): Implement.
2000 * sim-memopt.c (memory_option_handler): Typecast 64bit value to
2002 (memory_option_handler): Only zalloc modulo bytes when non-zero.
2003 (memory_option_handler): Skip comma in alias address list
2007 * sim-memopt.c (do_memopt_add, do_memopt_delete): Add level and
2009 (parse_size, parse_addr): New functions
2010 (memory_option_handler, memory_options): Parse address & size
2011 using new functions. Pass level, space, modulo to do_memopt_add &
2014 * sim-memopt.h (struct _sim_memopt): Add level & space fields.
2016 * sim-core.h (sim_core_arrach, sim_core_detach): Replace
2017 `attach_type attach' argument with `unsigned level' argument.
2020 * sim-core.c (new_sim_core_mapping, sim_core_map_attach,
2021 sim_core_attach): Replace argument attach with level. Update
2022 verification of arguments.
2023 (sim_core_map_detach, sim_core_detach): Replace argument attach
2026 * sim-basics.h (enum _attach_type): Delete.
2030 * sim-core.h (sim_core_write_8): Define.
2034 * sim-bits.h: Document ROTn macro.
2036 * sim-endian.h (H2T): Handle 16 byte variables.
2038 * sim-n-core.h (sim_core_read_unaligned_N): Return a dummy when an
2041 * sim-core.c: Do not generate sim_core_*_word.
2043 * sim-n-core.h (sim_core_trace_N): Add line_nr argument.
2044 (sim_core_write_aligned_N, sim_core_read_aligned_N): Update.
2046 * sim-core.h (sim_core_read_unaligned_word,
2047 sim_core_read_aligned_word, sim_core_read_word,
2048 sim_core_write_unaligned_word, sim_core_write_aligned_word,
2049 sim_core_write_word): Change to macros that map onto sim_core_*_N.
2053 * sim-n-endian.h: Add TAGS entrys for 16 byte versions.
2055 * sim-endian.h: Disable 16 byte support.
2059 * sim-endian.c (_SWAP_16): Define. Generate 126 bit swap code.
2061 * sim-n-core.h (sim_core_trace_N): New function.
2062 (sim_core_read_aligned_N, sim_core_write_aligned_N): Use,
2063 (sim_core_read_unaligned_N): Do not retyrn bogus value wden error.
2065 * sim-endian.h: Add 128 bit variant.
2067 * sim-core.h, sim-core.c: Add 128 bit variant.
2069 * sim-types.h: Add signed128 and unsigned128 types using a struct.
2073 * sim-events.c (sim_events_process): Clear events->work_pending.
2074 (sim_events_tickn, sim_events_tick): Accumulate, instead of
2075 setting, nr_ticks_to_process.
2076 (sim_events_preprocess): Allow nr_ticks_to_process to be non-zero
2077 when the event queue isn't next.
2079 * sim-events.h, sim-events.c (sim_events_slip): New function.
2083 * sim-hload.c (sim_load): Pass lma_p==0 and do_load=sim_load.
2085 * sim-utils.h, sim-load.c (sim_load_file): Add lma_p and do_load
2090 * nrun.c (main): Remove useless test of name != NULL.
2091 Exit if bfd_openr fails. Call bfd_check_format after bfd_openr.
2095 * sim-fpu.c (EXPMAX): Type is unsigned.
2096 (MIN_INT, MAX_INT): Type is signed64.
2097 (i2fpu): Type of val is signed64.
2101 * sim-profile.h (PROFILE_PC_BUCKET_SIZE): Treat a shift of zero as
2102 a bucket size of zero.
2104 * sim-profile.c (OPTION_PROFILE_PC_GRANULARITY,
2105 OPTION_PROFILE_PC): Define.
2106 (profile_option_handler): Add support for --profile-pc and
2107 --profile-pc-granularity options.
2108 (profile_pc_init): When possible, compute nr buckets from bucket
2111 * sim-profile.c (profile_pc_init): Align the profile-pc end
2112 address with the profile-pc bucket size.
2114 * sim-profile.h (PROFILE_PC_NR_BUCKETS): Rename PROFILE_PC_SIZE to
2115 something less ambiguous.
2116 (PROFILE_PC_BUCKET_SIZE): Ditto for PROFILE_PC_SAMPLE_SIZE.
2118 * sim-profile.c (profile_pc_cleanup): New function. Move
2119 profile_pc_uninstall code to here.
2120 (profile_pc_uninstall): Call.
2121 (profile_pc_init): Call.
2125 * sim-profile.c (profile_print_pc): Dump pc profile to dmon.out
2126 file using BSD gprof format.
2128 * sim-bits.h (LSBIT, MSBIT, BIT): Force result to type
2130 (LSBIT8, LSBIT16, LSBIT32, LSBIT64, MSBIT8, MSBIT16, MSBIT32,
2131 MSBIT64): Force result to unsignedN.
2135 * sim-alu.h (ALU16_BEGIN, ALU32_BEGIN, ALU64_BEGIN): Drop opening
2137 (ALU8_BEGIN, ALU8_SET, ALU8_ADD, ALU8_SUB, ALU8_NEGATE): Define.
2138 (ALU16_ADD, ALU16_SUB, ALU16_NEGATE): Simplify arrithmetic.
2139 (ALU32_ADD, ALU32_SUB, ALU32_NEGATE): Simplify arrithmetic.
2140 (ALU64_ADD, ALU64_SUB, ALU64_NEGATE): Simplify arrithmetic.
2144 * sim-core.h (struct _sim_core_mapping): Change free_buffer to
2147 * sim-core.c (sim_core_uninstall, new_sim_core_mapping,
2148 sim_core_map_attach, sim_core_map_detach): Change free_buffer to
2150 (sim_core_attach): Rename buffer_freed to free_buffer, type
2151 void*. Ensure that allocated buffer is alligned according to
2156 * sim-alu.h (ALU64_HAD_OVERFLOW): Define.
2157 (ALU64_SUB): Define.
2159 * Make-common.in (all): Build SIM_EXTRA_ALL first.
2160 (.gdbinit): Remove dependencies, generate once per build.
2164 * sim-n-core.h (sim_core_read_aligned_N,
2165 sim_core_write_aligned_N): Make xaddr param type address_word not
2170 * sim-fpu.h, sim-fpu.c: Rewrite. Change sim_fpu object to an
2171 unpacked floating point struct. Pass sim_fpu object by reference.
2172 Add preliminary support for rounding modes.
2176 * configure: Regenerated to track ../common/aclocal.m4 changes.
2180 * aclocal.m4 (sim-bitsize): Fix typo, WITH_TARGET_WORD_BITSIZE not
2181 WITH_TARGET_BITSIZE.
2185 * sim-profile.c (profile_print_core): label needs empty statement.
2189 * sim-break.c (sim_set_breakpoint sim_clear_breakpoint): Use ZALLOC
2190 and zfree instead of xmalloc and free. Prevents warnings.
2194 * configure: Regenerated to track ../common/aclocal.m4 changes.
2198 * Make-common.in (SIM_BITSIZE): Assign from configured value.
2199 (CONFIG_CFLAGS): Add SIM_BITSIZE.
2201 * aclocal.m4 (--enable-sim-bitsize): Developer option for
2202 controling the bitsize/msb of the target.
2206 * Make-common.in: New files sim-break.c, sim-break.h.
2207 * sim-base.h: Add point to breakpoint list to sim_state_base.
2208 * sim-break.c sim-break.h: New modules that implement intrinsic
2210 * sim-module.c: Add breakpoint module.
2214 * sim-events.c (SIM_EVENTS_POLL_RATE): poll more often than once
2216 * sim-n-core.h (WITH_XOR_ENDIAN): MSVC barfs on
2218 * sim-core.c (sim_core_xor_write_buffer): WITH_XOR_ENDIAN + 1.
2219 (SIGBUS) define for Windows.
2220 * sim-trace.c (trace_printf,debug_printf): added ALMOST_STDC.
2221 * sim-resume.c: define SIGTRAP for windows.
2222 * sim-xcat.h: use token pasting if ALMOST_STDC.
2226 * Make-common.in (SIM_SCACHE, SIM_DEFAULT_MODEL): Assign
2228 (CONFIG_CFLAGS): Add same.
2232 * sim-types.h (SIGNED64): ##i64 when _MSC_VER, not _WIN32.
2233 (SIGNED32): use ##i32.
2237 * configure: Regenerated to track ../common/aclocal.m4 changes.
2241 * aclocal.m4 (sim-endian): Simplify logic determining [default]
2244 * Make-common.in (SIM_WARNINGS, SIM_ALIGNMENT, SIM_ENDIAN,
2245 SIM_HOSTENDIAN, SIM_RESERVED_BITS, SIM_ASSERT, SIM_FLOAT,
2246 SIM_HARDWARE, SIM_INLINE, SIM_PACKAGES, SIM_REGPARM, SIM_SMP,
2247 SIM_STDCALL, SIM_XOR_ENDIAN): Assign configured values.
2248 (CONFIG_CFLAGS): Add same.
2250 * aclocal.m4: Perform AC_SUBST on optional options.
2254 * sim-config.h (WITH_DEFAULT_ALIGNMENT): Don't hardwire any alignment.
2256 * sim-options.c (standard_option_handler): Typo in warning message.
2258 * sim-base.h (STATE_MODEL): Make conditional on SIM_HAVE_MODEL.
2260 * sim-profile.c (profile_print_insn): Check 0 .. MAX_INSN for any
2261 insn count. Make count conditional on there being a valid
2263 (profile_pc_init): Make default PC profile frequency an arbitrary
2266 * sim-base.h: Ditto.
2268 * sim-profile.h (WITH_PROFILE_MODEL_P): Only enable modeling when
2271 * sim-model.h (struct MACH): Depreciate, to be replaced by bfd
2276 * configure: Regenerated to track ../common/aclocal.m4 changes.
2280 * aclocal.m4 (sim_alignment): Simplify logic for selecting the
2281 configured alignment.
2285 * configure: Regenerated to track ../common/aclocal.m4 changes.
2289 * sim-config.c (sim_config): Check for default alignment.
2291 * sim-options.c (standard_option_handler): Add alignment option.
2293 * aclocal.m4 (sim_alignment): Allow configuration of hardwired and
2294 default alignment requirements on memory accesses.
2298 * sim-load.c (sim_load_file): Return failure if the executable
2299 had no loadable sections.
2303 * sim-events.c (ETRACE): Use trace_printf not sim_io_printf for
2306 * sim-core.c (sim_core_signal): When bad access halt simulator
2307 SIGSEGV / SIGBUS instead of aborting.
2308 (signal.h): Include.
2310 * sim-watch.c (sim_watchpoint_install): Handler for watchpoint
2311 options was missing.
2313 * sim-bits.h (MOVED): Define
2317 * sim-alu.h (ALU32_HAD_OVERFLOW): Pacify GCC, Use MSBIT instead of
2320 * sim-bits.h (LSBIT, MSBIT): Check for overflow of shift value.
2322 * sim-bits.c: Add 8 bit versions of bit macros.
2324 * sim-bits.h: Ditto.
2328 * sim-bits.c (LSSEXT, MSSEXT): Replace SEXT.
2329 (LSINSERTED, MSINSERTED): Ditto for INSERTED.
2331 * sim-n-bits.h (MSSEXTn, LSSEXTn): Replace SEXTn.
2332 (LSINSERTDn, MSINSERTEDN): Ditto for INSERTEDn.
2334 * sim-bits.h (SEXT*): Define as MSEXT/LSEXT.
2335 (INSERTED*): Ditto for LSINSERTED/MSINSERTED.
2339 * aclocal.m4 (SIM_AC_COMMON): Add optional config.h file argument.
2340 configure.in: Output to cconfig.h instead of config.h.
2342 * configure: Regenerated to track ../common/aclocal.m4 changes.
2346 * sim-utils.c (sim_analyze_program): Set STATE_ARCHITECTURE from
2351 * callback.c (os_write): divert stdout and stderr to their
2356 * sim-profile.c (profile_print_speed): Call
2357 sim_events_elapsed_time instead of PROFILE_EXEC_TIME for moment.
2359 * sim-events.c (sim_events_elapsed_time): New function return nr
2360 host MS consumed by the simulator.
2361 (sim_watch_valid): Use.
2363 * sim-module.c (modules): Install sim_events very very early.
2365 * sim-profile.c (profile_print): Call profile_print_pc.
2367 (profile_pc_init): New function, set up processor for PC
2369 (profile_print_pc): New function, print a PC profile.
2370 (profile_pc_event): New function, sample PC.
2372 * sim-profile.h (PROFILE_PC_COUNT, PROFILE_PC_START,
2373 PROFILE_PC_END, PROFILE_PC_SHIFT, PROFILE_PC_SAMPLE_SIZE): Add to
2376 * sim-options.c (sim_print_help): Pacify GCC.
2378 * sim-n-core.h (sim_core_read_aligned_N,
2379 sim_core_write_aligned_N): Add un-conditional profile call.
2380 (sim_core_read_unaligned_N, sim_core_write_unaligned_N): Add
2381 profile call when aligned read/write isn't used.
2383 * sim-base.h: Include sim-profile, sim-model after sim-core &
2384 sim-events allow sim-core to define useful values.
2386 * sim-profile.c (OPTION_PROFILE_CORE): Define.
2387 (profile_option_handler, profile_options): Add support for
2388 --profile-core option.
2389 (print_bar): Include when core profiling.
2390 (profile_print_core): New function, print core profile.
2392 * sim-config.c (print_sim_config): Print profile status.
2394 * sim-profile.h (PROFILE_NEXT_IDX, PROFILE_core,
2395 WITH_PROFILE_PC_P): Define.
2396 (PROFILE_CORE_COUNT): Count each core-map/size separatly.
2397 (PROFILE_COUNT_CORE): Define.
2401 * sim-watch.c (handle_watchpoint): Pass a char** index into the
2402 interrupt_names array as the data.
2403 (sim-watch.h): Document.
2407 * sim-options.c (sim_print_help): When the doc string is to long
2410 * sim-watch.c (sim_watchpoint_install): Use option.doc_name so
2411 that only the first few the watch options are listed. Generate
2412 meanginful usage messages.
2414 * sim-options.h (struct OPTION): Clarify use of doc_name field
2418 * sim-options.c (OPTION_ARCHITECTURE_INFO): New option.
2419 (standard_option_handler): Handle --architecture-info.
2423 * sim-core.h (sim_cpu_core): [WITH_XOR_ENDIAN + 1], to avoid
2424 illegal zero-sized array.
2425 * sim-core.c (sim_core_xor_read_buffer): same.
2429 * nltvals.def: Regenerate.
2433 * sim-fpu.c (DP_FRACHIGH2): Define LL using SIGNED64.
2437 * sim-bits.c (MASKED): Delete.
2438 (EXTRACTED): Delete.
2439 (LSEXTRACTED, MSEXTRACTED): New functions.
2441 * sim-n-bits.h (MASKEDn): Delete, define as MSMASKED or LSMASKED.
2442 (MSMASKEDn, LSMASKEDn): Add last argument.
2445 * sim-bits.h (EXTEND8, EXTEND16): Define.
2446 (EXTRACTED64): Define as 64 bit extract, not 32 bit.
2448 * sim-run.c (sim_engine_run): Use CPU_CIA macro.
2450 * sim-engine.h (SIM_ENGINE_HALT_HOOK): Use CPU_CIA to get at
2451 current instruction address.
2453 * sim-inline.h (*_ENGINE): Define.
2457 * sim-core.c (sim_core_attach): Fix checks of modulo/mask.
2459 * sim-watch.c (delete_watchpoint): Delete by ident and type.
2460 (watch_option_handler): Call delete_watchpoint with ident or type.
2461 (sim_watchpoint_install): Create interrupt specific watchpoint
2462 commands on the fly.
2463 (do_watchpoint_create): New function, create a watch point using
2464 type/int-nr info encoded in the option nr.
2465 (do_watchpoint_info): New function. List active watchpoints.
2467 * sim-watch.h: Change data structure to a list.
2469 * sim-memopt.c (memory_option_handler): Require explicit "all"
2470 before deleting all memory regions.
2472 * sim-utils.c (sim_do_commandf): New function, printf version of
2475 * sim-basics.h (asprintf, vasprintf): Hack, define for CYGWIN32.
2477 * sim-alu.h (ALU64_ADD): Use explicit MSEXTRACTED64, do not assume
2479 (SIGNED64, UNSIGNED64): Delete.
2480 (ALU64_ADD): Don't rely on bit endianness.
2481 (ALU64_BEGIN): Define.
2483 * sim-n-bits.h (MSEXTRACTEDn, LSEXTRACTED): New functions.
2484 (EXTRACTEDn): Delete, define as either LSEXTRACTED or MSEXTRACTED.
2486 * sim-types.h (SIGNED64, UNSIGNED64): New macros, attach relevant
2487 suffix - u64, LL - to 64 bit constants.
2491 * sim-config.c (sim_config): Add assert for SIM_MAGIC_NUMBER.
2493 * sim-utils.h (NZALLOC): Define - zalloc * N.
2495 * sim-hrw.c (sim_read, sim_write): New file. Provide generic
2496 implementation of read/write functions.
2498 * Make-common.in (sim-hrw.o): New target.
2500 * sim-base.h (STATE_MEMOPT_P): Delete, simulators _always_ add
2503 * sim-memopt.c (memory_option_handler): Implement memory-size
2504 command. Implement memory-alias command. Let memory-delete delete
2506 (add_memopt): New function. Add a memory region.
2507 (do_memopt_delete): New function. Delete a memory region.
2509 * sim-utils.c (sim_elapsed_time_get): Never return zero.
2511 * sim-core.c (sim_core_detach): New function.
2512 (sim_core_map_detach): New function. Perform the actual detach.
2513 (sim_core_init): Move initialization code from here.
2514 (sim_core_install): To here.
2515 (sim_core_uninstall): And here.
2517 * sim-module.c: Add memopt module.
2519 * sim-base.h (STATE_MEMOPT, STATE_MEMOPT_P): Add memopt to
2520 simulator base type.
2522 * Make-common.in (sim_main_headers): Add sim-memopt.h
2523 (sim-memopt.o): New target.
2525 * sim-core.c (sim_core_install): Add core_options to the option
2528 * sim-watch.c (watch_options): Make --delete-watch a synonym for
2531 * sim-config.h (WITH_MODULO_MEMORY): Define as 0. Update
2534 * sim-core.h (struct _sim_core_mapping): Change nr_bytes to type
2535 address_word, add mask member.
2537 * sim-core.h, sim-core.c (sim_core_attach): Make nr_bytes of type
2538 address_word, allow for 64bit targets in 32bit host. Add modulo
2540 (sim_core_map_attach): Ditto.
2541 (new_sim_core_mapping): Ditto.
2542 (sim_core_translate): Mask address when modulo memory.
2546 * sim-hload.c (sim_load): Add assert for SIM_MAGIC_NUMBER.
2548 * gdbinit.in: New file.
2549 * aclocal.m4 (SIM_AC_OUTPUT): Build .gdbinit.
2550 * Make-common.in (distclean): Delete .gdbinit.
2551 (.gdbinit): Add rule for.
2552 * configure: Regenerated to track ../common/aclocal.m4 changes.
2554 * Make-common.in (cgen-run.o): Add rule for.
2558 * sim-resume.c (sim_resume): Suspend/resume the simulator.
2560 * sim-events.c (sim_watch_valid): Compute total elapsed time from
2561 both resumed and previous elapsed time.
2562 (sim_events_init): Set initial_wallclock and current_wallclock to
2564 (sim_events_install): Install sim_events_suspend and
2566 (sim_events_watch_clock): Allow for suspended simulator when
2567 computing the time of the clock event.
2569 * sim-events.h (struct _sim_event): Add resume_wallclock, rename
2570 initial_wallclock to elapsed_wallclock, set both to zero.
2571 (sim_events_init, sim_events_uninstall): Delete prototypes.
2573 * sim-module.h (MODULE_SUSPEND_FN, MODULE_RESUME_FN): Define types.
2575 * sim-module.c(sim_module_resume, sim_module_suspend): New
2580 * sim-core.c (sim_core_map_attach): Clarify memory overlap error
2585 * Makefile.in (TAGS): Add support for "/* TAGS: foo */" marker.
2586 * Make-common.in (TAGS): Likewise.
2587 * sim-n-bits.h: Add TAGS comments for all functions.
2588 * sim-n-core.h: Likewise.
2589 * sim-n-endian.h: Likewise.
2593 * sim-utils.c (sim_state_alloc): Set CPU backlinks, callback and
2596 * sim-base.h (sim_state_alloc): Add callback and kind arguments.
2598 * sim-base.h (INVALID_INSTRUCTION_ADDRESS): Add default
2603 * sim-fpu.c (DP_GARDMSB, ...): Make unsigned.
2604 (DP_FRACHIGH, DP_FRACHIGH2, ..): Use MSMASK to avoid LL.
2608 * sim-core.c (sim_core_map_attach): Cast attach enum to int.
2609 (sim_core_xor_read_buffer, sim_core_xor_write_buffer): Make
2610 nr_transfered and nr_this_transfer unsigned.
2612 * sim-events.c (sim_events_tickn): N is signed, as limited to
2615 * sim-n-endian.h (offset_N): Change size to unsigned.
2617 * callback.c (os_poll_quit): Add prototypes for kbhit and getkey.
2621 * sim-utils.c (sim_copy_argv): Delete, replaced by dupargv.
2623 * sim-options.c (sim_parse_args): Use dupargv.
2627 * sim-options.c (standard_option_handler): Use xstrdup, not strdup.
2631 * sim-base.h (STATE_ARCHITECTURE, STATE_TARGET): Add to simulator
2634 * sim-options.c (standard_options): Add --architecture=MACHINE and
2635 --target=TARGET options.
2636 (OPTION_ARCHITECTURE, OPTION_TARGET): Define.
2637 (standard_option_handler): Handle architecture and target options.
2640 * sim-utils.c (sim_analyze_program): Pass STATE_TARGET to
2642 (sim_analyze_program): Set prog_bfd architecture from
2643 STATE_ARCHITECTURE if known.
2647 * configure: Regenerated to track ../common/aclocal.m4 changes.
2652 * aclocal.m4 (enable-sim-warnings): Remove comment stating
2653 that option does not apply to certain files.
2657 * sim-bits.h (LSBIT8, LSBIT16, LSBIT32, LSBIT64, LSBIT, MSBIT8,
2658 MSBIT16, MSBIT32, MSBIT64, MSBIT): New macros - single bit as
2659 offset from MSB/LSB.
2661 * sim-endian.h (A1_8, A2_8, A4_8, A1_4, A2_4, A1_2): New macro,
2662 access address of sub word quantity of a hosts 16, 32, 64 bit word
2664 (V1_2, V1_4, V2_4, V1_8, V2_8, V4_8): Ditto for values.
2665 (U8_1, U8_2, U8_4, U4_1, U4_2, U2_1): Ditto for set of values.
2666 (V2_H1, V2_L1, V4_H2, V4_L2, V8_L4, V8_H4): Given N byte argument,
2667 return N*2 byte value with argument in Hi/Lo word. Renamed from
2668 V1_H2, V1_L2, V2_H4, V2_L4, V4_H8, V4_L8.
2670 * sim-alu.h (ALU32_HAD_OVERFLOW): Use 64 bit mask not 32bit.
2671 (ALU16_HAD_CARRY, ALU32_HAD_CARRY, ALU16_HAD_OVERFLOW): Use MSBIT
2672 so that bit offset is explicit.
2676 * sim-utils.c (sim_analyze_program): Add prog_name argument.
2677 Update STATE_PROG_BFD when needed with a dup'd copy of the
2680 * sim-config.c (sim_config): Delete ABFD argument, use
2681 STATE_PROG_BFD directly.
2685 * run.c (main): Pass the open ABFD to sim_create_inferior.
2687 * nrun.c (main): Determine prog_bfd. Pass to sim_create_inferior
2691 * sim-hload.c (sim_load): New file. Implement generic sim_load for
2692 hardware only simulator targets.
2694 * Make-common.in (sim-hload.o): Add rule.
2698 * sim-utils.c (sim_copy_argv): Rewrite to match malloc strategy
2699 used by copyargv and freeargv.
2701 * sim-options.c (sim_parse_args): Save a copy of PROG-ARGS in
2702 STATE_PROG_ARGV, not just a pointer.
2706 * configure: Regenerated to track ../common/aclocal.m4 changes.
2711 * aclocal.m4 (sim-endian): Add second argument to
2712 SIM_AC_OPTION_ENDIAN. First is hardwired endian, second is
2713 default endian when not hardwired.
2715 * sim-config.h (WITH_DEFAULT_TARGET_BYTE_ORDER): New macro, if all
2716 else failes value for target byte order.
2718 * sim-config.c (sim_config): Add abfd arguments. Set
2719 STATE_PROG_BFD accordingly. Determine prefered_target_byte_order
2721 (sim_config): Return SIM_RC, don't abort.
2724 * run.c (main): Update call to sim_open - add ABFD argument.
2725 * nrun.c (main): Add NULL ABFD argument.
2729 * callback.c (os_poll_quit): Make static.
2730 Call sim_cb_eprintf, not p->eprintf.
2731 (sim_cb_printf, sim_cb_eprintf): New functions.
2732 * sim-utils.h (sim_cb_printf, sim_cb_eprintf): Declare.
2734 * sim-basics.h (zalloc,zfree,sim_add_commas,SIM_ELAPSED_TIME,
2735 sim_elapsed_time_get,sim_elapsed_time_since): Move decls to
2736 sim-utils.h. #include sim-utils.h.
2737 * sim-utils.h: Above decls moved here.
2738 (sim_analyze_program,sim_load_file): Use `struct _bfd', not `bfd'.
2740 * sim-watch.c (action_watchpoint): Fix thinkos.
2744 * sim-types.h: Fix defs of 64 bit data types for MSVC.
2748 * sim-n-core.h (sim_core_write_unaligned_N): Add missing break
2749 to FORCED_ALIGNMENT case.
2753 * callback.c (target_to_host_open): Handle hosts with O_BINARY.
2757 * Make-common.in (libsim.a): Fix typo.
2761 * nrun.c (main): Verify the structure returned before using it.
2765 * sim-config.h (WITH_ENGINE): Enable the sim-engine module by
2768 * sim-engine.c (sim_engine_install): New function. Install the
2769 engine init functions.
2770 (sim_engine_init): [Re]initialize the simulator engine.
2772 * sim-module.c: Add sim_engine to list of modules that always
2777 * sim-watch.c (schedule_watchpoint): Use sim_unschedule_watchpoint
2778 to remove the old watchpoint, not delete_watchpoint.
2779 (watch_option_handler): Action the correct watchpoint, not just
2784 * sim-n-core.h (sim_core_write_aligned_N): For 8byte reads, output
2785 both low and high word.
2786 (sim_core_write_aligned_N): Ditto.
2788 * sim-trace.c (set_trace_options): Delete code explicitly setting
2791 * sim-options.c (sim_print_help): Call the list commands if not a
2792 standalone simulator.
2793 (sim_print_help): Advise that some options may not be applicable.
2795 * sim-trace.c (set_trace_options): Assume core present.
2797 * sim-events.c (sim_events_schedule_after_signal): Overflow signal
2798 buffer when full not almost full.
2802 * sim-events.c (sim_events_process): Don't blat the event queue
2803 when processing watchpoints.
2805 * sim-watch.h: Make arg unsigned long - stop sign extension.
2807 * sim-events.c (sim_watch_valid): rewrite so debugable.
2809 * sim-config.h (WITH_XOR_ENDIAN): Default to zero.
2811 * sim-watch.c (schedule_watchpoint): Add is_within option so that
2812 inequality test is possible.
2813 (handle_watchpoint): Re-pass is_within arg.
2814 (watch_option_handler): When `!' prefix to pc-watchpoint arg pass
2815 0 to schedule_watchpoint's is_within arg.
2816 (sim_watchpoint_init): Re-pass is_within arg.
2818 * sim-options.c (sim_print_help): Add is_command argument. Don't
2819 include -- prefix when called from the command line interpreter.
2821 * sim-watch.c (schedule_watchpoint): Pass true is_within argument.
2823 * sim-events.c (sim_events_watch_sim): Add is_within argument,
2824 zero indicates that the test should be reversed.
2825 (sim_events_watch_core): Ditto.
2826 (WATCH_CORE): Compare range against is_within.
2831 * sim-events.c (WATCH_CORE): Pass NULL cpu argument to
2832 sim_core_read_buffer. Check nr-bytes transfered.
2834 * sim-core.h (sim_core_common): Define a new struct that contains
2835 the common data. to sd and cpu structures.
2836 * sim-core.c (sim_core_attach): Update.
2837 (sim_core_init): Update. Remember to copy initialized data to each
2839 (sim_core_find_mapping): Ditto.
2841 * sim-core.c (sim_core_read_buffer): Add cpu argument.
2842 (sim_core_write_buffer): Ditto.
2844 * sim-n-core.h (sim_core_read_unaligned_N): When mis-aligned
2845 transfer use xor version of read buffer.
2846 (sim_core_write_unaligned_N): Ditto for write.
2848 * sim-core.c (sim_core_xor_read_buffer): New function implement
2849 xor-endian data read breaking transfer up into xor-endian sized
2851 (sim_core_xor_write_buffer): Ditto for write.
2852 (reverse_n): Reverse order of arbitrary number of bytes in buffer
2853 - needed for xor-endian transfers.
2857 * sim-inline.h: Review description.
2859 * sim-core.h, sim-core.c: Reduce number of functions being inlined
2860 to just those involved in data transfers and configuration.
2862 * sim-xcat.h (XSTRING): New macro, map macro definition onto
2864 * sim-n-core.h (sim_core_read_aligned_N): Use.
2865 (sim_core_read_unaligned_N): Ditto.
2866 (sim_core_read_unaligned_N): Ditto..
2867 (sim_core_write_unaligned_N): Ditto.
2869 * sim-core.h: Add xor endian bitmap to main structure. *
2871 sim-n-core.h (sim_core_write_aligned_N): Add suport for xor
2873 (sim_core_read_aligned_N): Ditto.
2875 * sim-core.c (sim_core_set_xor_endian): New function.
2876 (sim_core_attach): Don't overwrite the per-cpu xor map when
2877 cloning the global core.
2881 * sim-engine.h: Update below so that it is using an enumerated
2886 * sim-engine.c (sim_engine_restart):
2887 * sim-resume.c (sim_resume): Change longjmp param/setjmp
2888 return value used for simulator restart from 0 to 2.
2892 * cgen-scache.c (scache_option_handler): Add is_command arg.
2894 * sim-model.c (model_option_handler): Add is_command argument.
2896 * sim-profile.c (profile_option_handler): Add is_command arg.
2898 * sim-events.c (sim_watch_valid): Use ub64, lb64 when 64bit value
2901 * sim-module.c (sim_module_add_init_fn): Call init fn in the same
2902 order that they are registered.
2904 * sim-options.h (OPTION_HANDLER): Add argument to differentiate
2905 between option and command line processing.
2907 * sim-options.c: Include stdlib.h, ctype.h.
2909 * Make-common.in (sim-watch.o): Add rule.
2910 (sim_main_headers): Assume sim-assert.h included.
2911 (sim-*.o): Simplify make rule.
2913 * sim-module.c: Add sim_watch_install to module list.
2917 * sim-base.h (STATE_LOADED_P): New predicate. Set once everything
2920 * sim-trace.c (trace_install): Check magic. Include sim-assert.h.
2921 * sim-events.c (sim_events_install): Ditto.
2922 * sim-core.c (sim_core_install): Ditto.
2923 * sim-model.c (model_install): Ditto.
2924 * sim-options.c (standard_install): Ditto.
2925 * sim-profile.c (profile_install): Ditto.
2926 * sim-reason.c (sim_stop_reason): Ditto.
2927 * sim-run.c (sim_engine_run): Ditto.
2928 * sim-utils.c (sim_analyze_program): Ditto.
2930 * sim-module.c (modules): Make profile_install and trace_install
2933 * sim-base.h (STATE_MEM_BASE): Define for flat memory systems.
2935 * sim-options.c (standard_option_handler): Set the byte order.
2937 * sim-events.c (sim_events_process): Allow multi tick processing.
2938 (sim_events_tickn): New function - multi cycle tick.
2940 * sim-events.h (sim_events_tickn, sim_events_timewarp): Add
2941 prototypes. Under development.
2942 (sim_events): Replace processing with nr_ticks_to_process.
2946 * nrun.c (main): Pass callbacks to sim_open instead of using
2949 * run.c (main): Ditto.
2953 * sim-events.c (sim_events_zalloc): Signal save memory allocator -
2954 stop tk interrupting malloc calls.
2955 (sim_events_zalloc): Converse.
2957 * Make-common.in (sim_main_headers): Add sim-events.h.
2959 * sim-events.c (sim_events_schedule_after_signal): Change return
2960 type to void - signal events are strictly internal.
2961 (sim_events_init): Allocate a finite buffer for signal events.
2962 (sim_events_schedule_after_signal): Enter signal events into the
2965 * sim-engine.c (sim_engine_halt): Check SIM_DESC magic.
2966 (sim_engine_restart): Ditto.
2967 (sim_engine_abort): Ditto.
2968 * sim-stop.c (sim_stop): Ditto.
2969 (control_c_simulation): Ditto.
2970 * sim-resume.c (sim_resume): Ditto.
2971 (has_stepped): Ditto.
2972 * sim-abort.c (sim_engine_abort): Ditto.
2974 * sim-basics.h (transfer_type): New type.
2976 * sim-core.c (sim_core_signal): New function. Print core signal
2978 (sim_core_find_mapping): Add transfer argument.
2980 * sim-n-core.h (sim_core_{write,write}_unaligned_N): Call
2981 SIM_CORE_SIGNAL if a recoverable abort.
2982 * sim-core.c (sim_core_find_mapping): Ditto.
2986 * sim-core.c (sim_core_find_mapping): Replace calls to
2987 sim_io_error to more resiliant sim_engine_abort.
2989 * sim-n-core.h (sim_core_read_unaligned_N): Ditto.
2990 (sim_core_write_unaligned_N): Ditto.
2994 * sim-module.c: Add sim_events_install to list.
2996 * sim-events.c (sim_events_install, sim_events_uninstall): Clonse
2998 (sim_events_init): Now returns SIG_RC.
3000 * sim-run.c: New file. Generic sim_engine_run.
3001 * sim-reason.c: New file. Generic sim_stop_reason.
3002 * sim-stop.c: New file. Generic sim_stop.
3003 * sim-resume.c: New file. Generic sim_resume.
3005 * Make-common.in (sim-engine.o): Add rule.
3006 (sim-run.o, sim-reason.o, sim-stop.o, sim-resume.o): Ditto.
3008 * sim-engine.h, sim-engine.c: New file. Provide generic
3009 implementation of sim_engine_halt, sim_engine_error. et.al.
3011 * sim-base.h (sim_state_base): Add member halt.
3012 (sim-engine.h): Include.
3014 * sim-events.h (sim_event_handler): Always pass SIM_DESC to event
3016 * sim-events.c (sim_events_poll): Update event handler.
3020 * sim-events.h, sim-events.c (sim_events_watch_clock): New
3022 (sim_events_watch_sim): New function.
3023 (sim_events_watch_core): New function.
3024 (sim_watch_valid): New function.
3025 (sim_events_preprocess): New function.
3026 (sim_events_process): Process the watchpoints as well as the timer
3028 (sim_events_tick): Check WORK_PENDING instead of the hold queue.
3029 (sim_events_deschedule): Check all the queues when removing an
3031 (sim_events_init): Ditto for cleaning.
3035 * sim-fpu.c (is_ufpu_number): Comment out - currently unused.
3039 * callback.c (os_open): Type of arg flags is int.
3043 * sim-fpu.c (sim_fpu_is_{eq,ne,lt,le,gt,ge}): Compare Infinities
3044 just like normal numbers as per IEEE rules.
3048 * callback.c (os_close): Mark the descriptor as being
3049 available if the close succeeded.
3050 (os_open): Pass 0644 as the mode of the file being created.
3054 * sim-fpu.c (pack_fpu, unpack_fpu): New functions - decode a
3057 * sim-inline.c (SIM_INLINE_C): Rename from _SIM_INLINE_C_.
3058 * sim-lnline.h: Update.
3060 * sim-fpu.h, sim-fpu.c (sim_fpu_[iu]{32,64}to): New int2fp
3061 conversion functions.
3062 (sim_fpu_to{32,64}[iu]): New fp2int functions.
3064 * sim-fpu.h, sim-fpu.c (sim_fpu_is_{lt,le,eq,ne,ge,gt}): New fp
3065 compare functions. Replacing.
3066 (sim_fpu_cmp): This. Delete.
3070 * sim-core.c (sim_core_find_mapping): Call engine_error not
3071 sim_io_error when possible.
3075 * sim-endian.h (V1_H2): Add macro's to insert a word into a
3076 high/low double word.
3078 * sim-trace.h: Remove definition of attribute - defined in
3083 * sim-options.h (struct OPTION): Add doc_opt as the documenting
3084 name of the option - or family of options.
3086 * sim-options.c (sim_args_command): Match command `a-b c' with
3087 option `--a-b-c' from option table.
3091 * sim-options.c (sim_print_help): For optional arguments, wrap
3094 * sim-trace.c (set_trace_options): New function, handle optional
3095 argument and multiple assignment.
3096 (trace_option_handler): Update.
3098 * sim-trace.c (trace_option_handler): Trace branch and not fpu
3099 when branch tracing selected.
3103 * sim-trace.c (trace_one_insn): Make a va-args function.
3105 * sim-trace.c (trace_vprintf): New function, va-arg version of
3110 * sim-trace.c (trace_uninstall): Don't close a file twice.
3111 * sim-profile.c (profile_uninstall): Likewise.
3115 * sim-trace.c (toplevel): Include bfd.h.
3116 (trace_options): Note that --trace-linenum also turns on
3117 --trace-insn. Add --trace-{branch,semantics}.
3118 (trace_option_handler): If --trace-linenum, also turn on
3119 --trace-insn. Add --trace-branch support. If --trace-semantics,
3120 turn on ALU, FPU, branch, and memory tracing.
3121 (trace_one_insn): New function to trace an instruction. Support
3123 (OPTION_TRACE_*): Use an enum, rather than lots of defines.
3125 * sim-trace.h (TRACE_{SEMANTICS,BRANCH}_IDX): Add new macros.
3126 (MAX_TRACE_VALUES): Use 32, not 12 by default.
3127 (TRACE_branch): Add new mask.
3128 (TRACE_*_P): Define all possible trace_p macros.
3129 (trace_one_insn): Declare function.
3133 * sim-trace.h (__attribute__): Define as nothing if not GNU C or
3134 GNU C doesn't support __attributes__.
3135 ({trace,debug}_printf): Add attribute's so -Wformat can check the
3140 * sim-config.h (FORCED_ALIGNMENT): New alignment option -
3141 addresses are masked forcing them to be correctly aligned.
3142 (WITH_ALIGNMENT): Make NONSTRICT_ALIGNMENT the default.
3143 * sim-config.c (config_alignment_to_a): Update.
3145 * sim-core.h (sim_cpu_core): New data type contains cpu specific
3147 * sim-base.h (CPU_CORE): Add cpu specific core data to cpu base
3149 * sim-core.c (sim_core_attach): Add CPU argument. Ready for
3150 processor specific core maps.
3151 (sim_core_map_attach): Copy the core map data to each of the
3152 processor specific core data structures.
3153 * sim-core.c (sim_core_find_mapping): Update.
3155 * sim-n-core.h (sim_core_read_N, sim_core_write_N): Rename.
3156 (sim_core_write_aligned_N, sim_core_write_aligned_N): New names.
3157 (sim_core_write_unaligned_N, sim_core_write_unaligned_N): New
3158 alternatives that handle unaligned addresses.
3159 (sim_core_{read,write}_{,un}aligned_N): Drop SIM_DESC arg, replace
3161 * cgen-utils.c (sim_disassemble_insn): Update.
3165 * sim-trace.h (TRACE_FPU_IDX): Add Floating-point specific
3168 * sim-fpu.h, sim-fpu.c: New files - prototype for generic target
3171 * sim-inline.h, sim-inline.c: Add support for SIM_FPU.
3175 * sim-core.c (sim_core_map_to_str): New function ascii equivalent
3178 * sim-n-core.h (sim_core_read_N, sim_core_write_N): Use in trace
3183 * cgen-trace.c: Prepend additional trace_printf argument.
3185 * cgen-utils.c (sim_disassemble_insn): Add additional core
3190 * nrun.c (main): Catch/report errorenous simulator states.
3192 * sim-module.c: #include "libiberty.h" so that xmalloc is defined.
3193 * sim-trace.c: #include string.h/strings.h so that memset is
3195 * sim-utils.c: Ditto.
3196 * sim-profile.c: Ditto. And stdlib.h.
3197 (print_bar): Only define when used by instruction or memory profiler.
3199 * sim-options.c (standard_option_handler): Make ul more local.
3201 * sim-load.c (sim_load_file): Make the name constant.
3202 (sim_load_file): Passify gcc.
3204 * sim-utils.h: New file, pre-declare utilites in corresponding .c
3206 * sim-utils.c, sim-load.c: Include sim-utils.h.
3208 * sim-base.h (sim_cpu): Pre define here so available to all.
3210 * sim-core.h (DECLARE_SIM_CORE_WRITE_N, DECLARE_SIM_CORE_READ_N):
3211 Restore the sim_cpu and instruction_address arguments so that full
3212 information is available to the abort function.
3213 * sim-core.c (sim_core_find_mapping, sim_core_write_buffer): Ditto.
3214 * sim-n-core.h (sim_core_write_N, sim_core_read_N): Update.
3216 * sim-trace.h, sim-trace.c (trace_option_handler): Add interim
3217 tracing support for sim-events and sim-core.
3218 (trace_option_handler): Convert #if to if where possible so always
3219 compiled/checked by C compiler.
3220 * sim-n-core.h (sim_core_write_N, sim_core_read_N): Update.
3222 * sim-base.h: Adjust comment documenting how to define the cpu
3224 (sim_state_base): Add sim_core and sim_events to simulator base
3227 * sim-trace.h, sim-trace.c (trace_printf): Add SIM_DESC argument.
3228 * sim-core.c (sim_core_init, sim_core_attach,
3229 sim_core_find_mapping): Update.
3230 * sim-events.c (ETRACE, sim_events_init, sim_events_time,
3231 update_time_from_event, insert_sim_event,
3232 sim_events_schedule_after_signal, sim_events_deschedule,
3233 sim_events_tick): Ditto.
3235 * sim-basics.h (sim-module.h, sim-trace.h, sim-profile.h,
3236 sim-model.h): Move #includes from here.
3237 * sim-base.h: To here.
3238 (sim-core.h, sim-events.h, sim-io.h): Include also
3242 * callback.c (default_callback): Missing initialisers.
3246 * sim-utils.c (sim_add_commas): New function.
3247 * sim-basics.h (sim_add_commas): Add prototype.
3248 * cgen-scache.c (scache_print_profile): Print commas in numbers.
3249 * sim-profile.c (COMMAS): New macro.
3250 (print_*): Use it to print commas in numbers.
3252 * configure: Regenerated.
3254 * cgen-sim.h (sim_signal_type): Add SIM_SIGINT.
3255 (cgen_state): New member run_fast_p.
3256 (cgen_init): Add prototype.
3257 (sim_disassemble_insn): New arg `cpu'.
3258 * cgen-trace.c (trace_insn): Update call to sim_disassemble_insn.
3259 * cgen-utils.c (cgen_init): New function.
3260 (sim_disassemble_insn): New arg `cpu'. Rewrite fetching of insn.
3261 * genmloop.sh: Call engine_halt if loop exits.
3263 * Makefile.in (sim-options_h): Define.
3264 (sim-{module,options,trace,profile,utils}.o): Clean up dependencies.
3265 (sim-model.o): Add new rule.
3266 (cgen-{scache,trace,utils}.o): Add new rules.
3267 * aclocal.m4 (SIM_AC_OPTION_{SCACHE,DEFAULT_MODEL}): Add.
3268 * cgen-scache.c (scache_print_profile): Change `sd' arg to `cpu'.
3269 Indent output by 2 spaces.
3270 * cgen-scache.h (scache_print_profile): Update.
3271 * cgen-trace.c (trace_insn_fini): Indent output by 2 spaces.
3272 Use trace_printf, not fprintf.
3273 (trace_extract): Use trace_printf, not cgen_trace_printf.
3274 * genmloop.sh (!FAST case): Increment `insn_count'.
3275 * sim-base.h (sim_state_base): Only include scache_size if WITH_SCACHE.
3276 (sim_cpu_base): Rename member `sd' to `state' to be consistent with
3277 access macro's name.
3278 * sim-core.c (sim_core_init): Use EXTERN_SIM_CORE to define it.
3279 Change return type to SIM_RC.
3280 (sim_core_{install,uninstall}): New functions.
3281 * sim-core.h (sim_core_{install,uninstall}): Declare.
3282 (sim_core_init): Use EXTERN_SIM_CORE to define it.
3283 Change return type to SIM_RC.
3284 * sim-model.h (models,machs,model_install): Declare.
3285 * sim-module.c (modules): Add scache_install, model_install.
3286 (sim_post_argv_init): Set cpu->state backlinks.
3287 * sim-options.c (standard_options): Delete --simcache-size,--max-insns.
3288 (standard_option_handler): Likewise.
3289 * sim-profile.c (PROFILE_{HISTOGRAM,LABEL}_WIDTH): Move to
3292 (profile_options): Delete --profile-simcache.
3293 (profile_option_handler): Likewise.
3294 (profile_print_insn): Change `sd' arg to `cpu'. Indent output 2
3296 (profile_print_{memory,model}): Likewise.
3297 (profile_print_simcache): Delete.
3298 (profile_print_speed): New function.
3299 (profile_print): Rewrite.
3300 * sim-profile.h (PROFILE_scache): Renamed from PROFILE_simcache.
3301 (WITH_PROFILE_SCACHE_P): Renamed from WITH_PROFILE_SIMCACHE_P.
3302 (PROFILE_DATA): Delete members simcache_{hits,misses}.
3303 (PROFILE_COUNT_SIMCACHE_{HIT,MISS}): Delete.
3304 (PROFILE_{CALLBACK,CPU_CALLBACK}): New types.
3305 (profile_print): Update prototype.
3309 * cgen-scache.[ch], cgen-sim.h: New files.
3310 * cgen-trace.[ch], cgen-types.h, cgen-utils.c, genmloop.sh: New files.
3311 * sim-model.c: New file.
3313 * Make-common.in (clean targets): Undo patch of Apr. 22.
3317 * sim-n-bits.h (signed): If we have a standard compiler, undef
3318 signed, so that signedN is defined correctly.
3322 * sim-module.h, sim-model.h, sim-profile.h: New files.
3323 * sim-module.c, sim-profile.c: New files.
3324 * Make-common.in (SIM_PROFILE): Define
3325 (CONFIG_CFLAGS): Add $(SIM_PROFILE).
3326 (sim_main_headers): Add sim-module.h, sim-model.h, sim-profile.h.
3327 (sim_module.o,sim-profile.o): Add rules for.
3328 * aclocal.m4 (--enable-sim-trace): Allow symbolic arguments.
3329 (--enable-sim-profile): Add.
3330 * configure: Regenerated.
3331 * sim-base.h (sim_state_base): New members init_list, uninstall_list,
3332 model. Move trace and profile support to sim-{trace,profile}.h.
3333 New members trace_data, profile_data.
3334 * sim-basics.h: #include sim-module.h, sim-model.h, sim-profile.h.
3335 * sim-config.h: Provide default definition of WITH_PROFILE.
3336 (WITH_TRACE): Change default to -1.
3337 (MAX_NR_PROCESSORS): Always define.
3338 * sim-options.c: Move trace and profile support to
3339 sim-{trace,profile}.h.
3340 (sim_pre_argv_init): Moved to sim-model.c.
3341 (standard_install): New function.
3342 * sim-options.h (sim_pre_argv_init): Move decl to sim-model.c.
3343 (standard_install): Declare.
3344 * sim-trace.c: Tracing option handling moved here from sim-options.c.
3345 (trace_install, trace_uninstall): New functions.
3346 (trace_printf): Update reference to TRACE_FILE.
3347 * sim-trace.h (TRACE_FOO_IDX): Moved here from sim-base.h.
3348 (TRACE_foo): Bit masks for symbolic arguments to --enable-sim-trace.
3349 (WITH_TRACE_FOO_P): Define.
3350 (trace_install): Declare.
3351 (TRACE_DATA): New struct.
3355 * run.c: Undo last exec_bfd patch.
3356 (main): Only pass -E ifdef SIM_HAVE_BIENDIAN.
3360 * run.c (exec_bfd): Add back in.
3361 (main): Set exec_bfd.
3365 * sim-load.c (sim_load_file): #include <stdio.h> for NULL.
3369 * sim-events.c (insert_sim_event): Call sim_io_error instead of
3370 less well defined engine_error.
3371 * sim-core.c: Ditto.
3375 * Make-common.in: Change clean targets to use :: so that other
3376 Makefiles can have their own clean targets.
3377 * sim-load.c (xprintf eprintf): Use ANSI_PROTOTYPES instead of
3378 __STDC__ to control use of stdarg vs. varargs syntax. Some
3379 systems can't use __STDC__, but require stdarg.
3383 * sim-options.c (standard_options): Add --endian.
3384 (standard_option_handler): Likewise.
3386 * nrun.c: #include <signal.h>.
3387 (main, cntrl_c): Wrap calls to sim_resume in a SIGINT
3388 handler that calls sim_stop ().
3392 * run.c (main, cntrl_c): Wrap calls to sim_resume in a SIGINT
3393 handler that calls sim_stop (). Simulators may still be
3394 establishing their own handler.
3396 * sim-events.c (sim_events_poll): Rename from
3397 sim_events_at_large_int. Poll IO.
3399 * sim-io.c (sim_io_poll_quit): New function - pass on a polling
3402 * callback.c (os_poll_quit): New function poll for quit signal
3404 (default_callback): Include magic number.
3408 * aclocal.m4: Check for headers time.h, sys/time.h, sys/resource.h.
3409 Check for functions getrusage, time.
3410 * sim-basics.h (SIM_ELAPSED_TIME): New typedef.
3411 (sim_elapsed_time_get, sim_elapsed_time_since): Add prototypes.
3412 * sim-utils.c: #include time.h, sys/time.h, sys/resource.h if able.
3413 (sim_elapsed_time_get, sim_elapsed_time_since): New functions.
3415 * sim-utils.c (sim_copy_argv, sim_analyze_program): New functions.
3417 * sim-options.c, sim-options.h: New files.
3418 * sim-config.h (WITH_DEBUG): Provide default value of zero.
3419 * Make-common.in (nrun.o): Add rules for.
3422 * run.c (main): Check return value of sim_open.
3424 * Make-common.in (sim-options.o, sim-load.o, sim-trace.o): Add rules.
3425 (sim_main_headers): Add sim-trace.h.
3426 * run.c (exec_bfd, target_byte_order): Delete.
3427 (main): Pass -E <endian> to sim_open. Delete code to load sections,
3428 call sim_load instead. Check return code of sim_create_inferior.
3429 * sim-base.h (CURRENT_STATE): Define.
3430 (sim_state_base): Make typedef. New members options, prog_argv,
3431 prog_bfd, text_{section,start,end}, start_addr, simcache_size,
3432 mem_size, memory [+ corresponding access macros].
3433 (sim_cpu_base): New typedef.
3434 * sim-trace.h: New file.
3435 * sim-trace.c: New file.
3436 * sim-basics.h: #include it.
3437 * sim-load.c: New file.
3441 * Make-common.in (INSTALL): Set to @INSTALL@.
3442 (INSTALL_XFORM, INSTALL_XFORM1): Remove.
3443 (install-common): Depend upon installdirs. Use
3444 $(program_transform_name) directly, rather than using
3446 (installdirs): New target.
3447 * Makefile.in (INSTALL): Set to @INSTALL@.
3448 (INSTALL_XFORM, INSTALL_XFORM1): Remove.
3449 (install-man): Depend upon installdirs. Use
3450 $(program_transform_name) directly, rather than using
3452 (installdirs): New target.
3456 * sim-assert.h (SIM_ASSERT, ASSERT): Allow these macros to
3461 * sim-basics.h: Only bring in config.h and tconfig.h if
3466 * sim-config.h (WITH_TARGET_WORD_MSB): New Macro. Define the bit
3467 numbering convention of the target.
3468 * sim-config.c (print_sim_config): Print WITH_TARGET_WORD_BITSIZE
3469 and WITH_TARGET_WORD_MSB.
3470 (sim_config): When possible, check for consistency with bitsize
3473 * sim-bits.h: Allow MSB to be other than zero.
3474 * sim-bits.c: Ditto.
3475 * sim-n-bits.h: Ditto.
3477 * sim-bits.h (MSMASK*): New macros - converce to LSMASK*.
3478 * sim-n-bits.h (MSMASKEDn): Ditto.
3482 * Makefile.in (INSTALL): Change install.sh to install-sh.
3486 * sim-base.h (sim_state_base): Move `magic' to end of struct.
3490 * run.c (main): Check that a program to run was specified.
3494 * aclocal.m4 (AC_TYPE_SIGNAL): Add check.
3496 * configure: Regenerated to track ../common/aclocal.m4 changes.
3501 * sim-endian.h: Move host {LITTLE,BIG}_ENDIAN support from here,
3502 * sim-config.h: To here.
3504 * Make-common.in (SIM_EXTRA_DEPS): New config var.
3505 (sim_main_headers): Define.
3506 (sim-*.o): Depend on $(SIM_EXTRA_DEPS).
3507 (BUILT_SRC_FROM_COMMON): Move here from ../d30v/Makefile.in.
3509 (sim-utils.o): Add rule for.
3510 * sim-utils.o: New file.
3511 * sim-basics.h: #include sim-base.h.
3512 (zalloc): Make argument unsigned long.
3513 * sim-base.h: New file.
3514 * sim-inline.h (SIM_IO support): Delete.
3515 * sim-io.h: Delete inline support.
3516 * sim-io.c: Likewise. sim-state.h renamed to sim-main.h.
3517 * sim-config.c: sim-state.h renamed to sim-main.h.
3518 * sim-core.c: Likewise.
3519 * sim-events.c: Likewise.
3521 * run.c (main): Pass SIM_OPEN_STANDALONE to sim_open.
3523 * aclocal.m4: Check for stdlib.h, string.h, strings.h, unistd.h.
3524 (sim-debug): Allow arguments. Define WITH_DEBUG in addition to
3526 * configure: Regenerated to track ../common/aclocal.m4 changes.
3530 * configure: Regenerated to track ../common/aclocal.m4 changes.
3534 * sim-config.h (WITH_ALIGNMENT, WITH_FLOATING_POINT,
3535 WITH_XOR_ENDIAN, WITH_SMP, WITH_RESERVED_BITS): Assume that these
3536 are defined by the configure.
3538 * aclocal.m4 (sim-stdio): Add option stdio from ../ppc configure.
3540 * aclocal.m4 (floating-point, xor-endian, alignment, smp,
3541 reserved-bits): Always define.
3543 * sim-config.h, sim-config.c (sim_config): New function - and new
3544 file - co-ordinate the setting/checking of the common simulator
3545 configuration options.
3547 * Make-common.in (sim-config.o): Add rule.
3551 * callback.c (os_{,e}vprintf_filtered): Change stdarg type to
3552 va_list from void *, since va_list might not be a pointer type.
3556 * sim-n-endian.h (offset_N): Correct assertion - word and sub word
3558 (offset_N): Correct computation of LE offset.
3560 * sim-io.c (sim_io_error): Include a new line when reporting
3563 * sim-assert.h (SIM_FILTER_PATH): Out by one when locating last
3568 * run.c: Include alloca-conf.h.
3570 * callback.c (os_evprintf_filtered): Fix typo.
3574 * run.c (string.h, strings.h, stdlib.h): Include.
3576 * sim-events.c (sim_events_tick): Recent cleanup failed to return
3577 0 when nothing pending.
3579 * run.c (sim_size, sim_trace): Plicate GCC - these two functions
3580 will soon be going away.
3581 (getopt): Plicate GCC.
3583 * sim-endian.c (sim-io.h): Plicate GCC.
3584 * sim-bits.c (sim-io.h): Ditto.
3585 * sim-n-bits.h (ROTn): Ditto.
3587 * sim-io.c (sim_io_error): Correct check for NULL.
3589 * sim-assert.h (SIM_FILTER_PATH): Separate out the code filtering
3591 * sim-events.c: Use SIM_FILTER_PATH to filter out the filename
3596 * aclocal.m4 (SIM_AC_OPTION_*: Move so that they are outside of
3597 SIM_AC_COMMON - SIM_AC_COMMON was gobling arguments.
3601 * sim-alu.h: Include sim-xcat.h.
3605 * Make-common.in (sim-bits.c, sim-core.c, sim-endian.c,
3606 sim-events.c, sim-inline.c, sim-io.c): Define rules for building
3609 * sim-events.c (sim_events_at_large_int): New function. Just
3610 schedules an event every large-int ticks.
3611 (sim_events_init): Call.
3612 (sim_events_tick, sim_events_process): Move async handing to
3613 sim_events_process. Move timer decrement so that it occures after
3614 events have been processed.
3616 * sim-basics.h (struct _engine): Remove declaration.
3618 * sim-events.h, sim-events.c: Rename type to sim_events. Prefix
3619 everything with same. Rename global struct to SIM_DESC.
3620 * sim-core.h, sim-core.c, sim-n-core.c: Ditto for sim_core.
3621 * sim-io.h, sim-io.c: Ditto.
3623 * sim-assert.h: New file. Optional assertion checking macros.
3624 * sim-io.c (sim_io_error): Make just this function tolerant to
3627 * sim-xcat.h: New file. Define concatenate macros.
3628 * sim-basics.h (XCONCAT*): Move to sim-xcat.h.
3629 * sim-n-core.h, sim-n-bits.h, sim-n-endian.h: Explicitly include
3635 * sim-bits.h (LSMASK): New macro. Create mask of LS bits.
3639 * sim-inline.h: Add definitions for sim-types.
3640 (ALL_BY_MODULE): New macro, encapsulate full inlining by the
3645 * sim-events.h: Remove defunct reference to callback struct.
3649 * configure: Re-generate.
3653 * Make-common.in (CSEARCH): Do not include the gdb directory in
3658 * Make-common.in (SIM_ENDIAN, SIM_HOSTENDIAN, SIM_INLINE,
3659 SIM_WARNING): Drop, requiring the simulator specific Makefile.in
3660 to explicitly incorporate these.
3662 * aclocal.m4 (--enable-sim-alignment); New option. Strongly
3663 specify the alignment restrictions of the target architecture -
3664 without this option all alignment restrictions are accomodated.
3665 (--enable-sim-assert): New option. Conditionally compile in
3666 assertion statements.
3667 (--enable-sim-float): New option. Strongly specify the target's
3668 floating point support.
3669 (--enable-sim-hardware): New option. Specify the hardware devices
3670 included in the simulation.
3671 (--enable-sim-packages): New option. Specify the hardware
3672 packages included in the simulation.
3673 (--enable-sim-regparm): New option. Specify that parameters be
3674 passed in registers instead of on the stack.
3675 (--enable-sim-reserved-bits): New option. Specify that reserved
3676 bits within an instruction are are correctly set.
3677 (--enable-sim-smp): New option. Specify the level of SMP support
3678 to be included in the simulator.
3679 (--enable-sim-stdcall): New option. Specify an alternative
3680 function call convention.
3681 (--enable-sim-xor-endian): New option. Configure xor-endian
3682 support used by some targets to implement bi-endian support.
3686 * aclocal.m4 (--enable-sim-hostendian): New option. Allow the
3687 host endianness to be overridden.
3688 (--enable-sim-endian): Allow the target platform's byte order
3690 (--enable-sim-inline): Control the inlining of common components.
3691 (--enable-sim-bswap): For compatibility, also define WITH_BSWAP.
3692 (--enable-sim-warnings): Enable additional GCC compiler checks.
3693 * Make-common.in (SIM_ENDIAN, SIM_HOSTENDIAN, SIM_INLINE,
3696 * sim-n-core.h, sim-n-bits.h, sim-n-endian.h: Rename from
3697 sim-*-n.h so that the names are uniq on dos machines
3698 * sim-core.c, sim-bits.c, sim-endian.c: Update.
3702 * run.c: #include "libiberty.h".
3703 (main): New locals sd,no_args,sim_argv.
3704 Run buildargv on -a option. Pass argv to sim_open, argv[0]
3705 is program name. Update call to sim_set_callbacks.
3706 Record result of sim_open, pass to other sim_foo routines.
3710 * callback.c (os_printf_filtered): Do not call exit(1) or print a
3715 * callback.c: Add os_flush_stdout and vprintf_filtered callbacks.
3716 Route stdout through buffered IO.
3718 * callback.c: Add os_flush_stderr, os_write_stderr,
3719 os_evprintf_filtered functions to route error output through
3722 * sim-io.h, sim-io.c (sim_io_flush_stderr, sim_io_flush_stdout):
3723 Correct return type - should be void.
3727 * sim-basics.h: Clean up. Many macro's moved to sim-inline.h.
3729 * sim-config.h: Ditto. For some options - eg WITH_DEVICES - do
3730 not provide a default value as undefined indicates disable code.
3734 * sim-core.h, sim-core-n.h, sim-core.c: Borrow code from ppc
3736 * sim-events.h, sim-events.c: Ditto.
3737 * sim-io.h, sim-io.c: Ditto.
3741 * sim-alu.h (ALU_SUB_CA, ALU*_SUB_CA): New alu operation.
3743 * sim-bits.h, sim-bits-n.h, sim-bits.c (LSMASKED*): New macro's
3744 extract the tail or least signifiant bits from an integer of the
3747 * sim-bits.h, sim-bits.c: Clean up conditionally compiled #if
3748 WITH_TARGET_BITSIZE so that the compilation will fail when an
3749 unsupported bitsize value is defined.
3751 (INSERTED*): Convert to functions.
3752 (EXTRACTED*): Ditto.
3754 (SIGN_EXTEND, SEXT): Change to more terse name.
3758 * sim-inline.h: Allow explicit control over which .c files will be
3759 included by their header.
3761 * sim-inline.h: Allow explicit control over which .c files use the
3762 alternative - REGPARM - parameter passing mechanism.
3764 * sim-inline.h, sim-inline.c: Don't attempt to include any of
3765 icache.c, idecode.c, semantics.c or support.c. Those names are
3766 not generally applicable.
3770 * sim-bits.c, sim-bits-n.h (new): Split sim-bits.c into two parts
3771 in a fashion similar to sim-endian-n.
3773 * sim-endian.h: (H_word, L_word, AL_*, VL_*): Extend to include
3774 both value and address macro's.
3778 * sim-alu.h (ALU16_BEGIN, ALU16_SET, ...): Fill in.
3780 * sim-endian.h (L_word, H_word): Replace MS2W_4, LS2W_4 with more
3781 generic L_word, H_word macro's.
3785 * sim-basics.h: Borrow code from ppc directory.
3786 * sim-bits.c: Ditto.
3787 * sim-bits.h: Ditto.
3788 * sim-config.h: Ditto.
3789 * sim-endian-n.h: Ditto.
3790 * sim-endian.c: Ditto.
3791 * sim-endian.h: Ditto.
3792 * sim-inline.c: Ditto.
3793 * sim-inline.h: Ditto.
3794 * sim-types.h: Ditto.
3798 * sim-alu.h (ALU_SET16, ALU_SET32, ALU_SET64, etc): Make available
3799 all the ALU size alternatives and then auto-configure a default.
3801 * sim-alu.h: Copy ppc/idecode_expression.h.
3805 * bits.h, bits.c (SIGN_EXTEND32, SIGN_EXTEND64): New functions,
3806 sign extend a bit within a value.
3808 * sim-endian.h, sim-endian-n.h (offset_N): New functions - return
3809 a pointer into the middle of a host word.
3810 * sim-endian.h (MS2W_4, LS2W_4): Use this function.
3814 * callback.c: If HAVE_CONFIG_H is defined, include config.h from
3815 autoconf. If HAVE_UNISTD_H is defined, include unistd.h to get
3816 appropriate definitions of read, write, etc. Add prototype for
3821 * Makefile.in (libcommon.a): Delete.
3822 (callback.o,targ-map.o): Delete, moved to Make-common.in.
3823 (gentmap,targ-vals.h,targ-map.c): Likewise.
3824 (run-autoconf): Delete.
3825 * aclocal.m4 (SIM_AC_OUTPUT): Redo creation of Makefile.
3826 (common makefile fragment): Moved back into ...
3827 * Make-common.in: Resurrect.
3828 * configure.in (AC_LINK_FILES): Delete, unnecessary now.
3829 * configure: Regenerated.
3833 * aclocal.m4 (SIM_AC_COMMON): Move COMMON_MAKEFILE_FRAG from here.
3834 (SIM_AC_OUTPUT): To here.
3838 * aclocal.m4 (COMMON_MAKEFILE_FRAG): Quote a couple of $'s in
3839 comments and single quotes. Fixes a problem found on hpux.
3843 * aclocal.m4: Remove Make-common.in from dependencies.
3844 * (distclean): Remove targ-vals.def.
3846 * aclocal.m4 (SIM_AC_COMMON): Move contents of Make-common.in
3847 into here. Makes insertion into makefiles easier. Also, change
3848 the way that callback.o, gentmap, targ-vals.h, targ-map.c,
3849 targ-map.o, and run are built. They are now built in the
3850 individual simulator directories, taking sources from ../common as
3851 necessary. This replaces the merging of libcommon.a into
3852 linsim.a, which was problematic for the WinGDB build process.
3853 * run.c: Include config.h from . instead of ../common.
3854 * Make-common.in: Remove. It's no longer necessary.
3858 * Make-common.in (ALL_CLAGS): Put CFLAGS at the end.
3859 (.c.o): Put $(ALL_CFLAGS) before the file being compiled.
3863 * run.c (main): Set target_byte_order before call to sim_open.
3867 * callback.c: #include <stdlib.h>
3868 (os_error): New function.
3869 (default_callback): Add os_error.
3873 * Make-common.in (Makefile): Set CONFIG_HEADERS="".
3874 * aclocal.m4: Mark the fact that --enable-sim-bswap isn't host
3876 (SIM_AC_OUTPUT): Don't build Makefile if CONFIG_FILES="".
3880 * run.c: #include ../common/config.h, tconfig.h.
3881 (myname): New static global.
3882 (main): Recognize new options -a, -c. Also recognize -h if h8/300.
3883 Only process -c ifdef SIM_HAVE_SIMCACHE.
3884 Only process -p/-s ifdef SIM_HAVE_PROFILE.
3885 Parse program name from argv[0] and use in error messages.
3886 Pass sim_args to sim_open. Pass prog_args to sim_create_inferior.
3887 Add support for incomplete h8/300 termination indicators.
3888 (usage): Make more verbose.
3889 * aclocal.m4,config.in,tconfig.in,configure.in,configure: New files.
3890 * Makefile.in,Make-common.in,callback.c: New files.
3891 * nltvals.def,gentmap.c,gentvals.sh: New files.
3895 * run.c: Include stdarg.h if __STDC__.
3899 * run.c (main): Don't print out anything if the signal
3900 number is zero (ie no signal).
3904 * run.c (main): Print out if the program raised a signal.
3908 * run.c (exec_bfd): Rename from sim_bfd, to use the gdb name.
3913 * run.c (main): Explicitly cast malloc() parameter.
3917 * run.c (sim_bfd): New global to hold the bfd pointer for the
3919 (main): Initialize sim_bfd.
3923 * run.c (main): Use new bfd_big_endian macro.
3927 * run.c (main): Removed SH specific comments, so source is
3928 generic. Also updated to only load relevant sections. Moved
3929 sim_open() to after callback attach (to match GDB).
3931 * run.1: Removed SH specific comments.
3935 * run.c (main): Always return sigrc at end.
3939 * run.c (main): Print error diagnostic and exit if bfd_openr() or
3940 bfd_check_format() fails.
3944 * run.c, run.1: From sh directory.