3 * hw-base.h (create_hw_property_data, delete_hw_property_data):
5 * hw-base.c (hw_create, hw_delete): Call
6 * hw-properties.c (create_hw_property_data,
7 delete_hw_property_data): Define.
11 * hw-device.c, hw-properties.c: Include hw-base.h
13 * hw-alloc.h, hw-alloc.c: New files. Move alloc code to here.
14 * hw-device.c: From here.
15 * hw-base.h: Include "hw-events.h".
17 * hw-base.h (create_hw_alloc_data, delete_hw_alloc_data): Declare.
18 * hw-base.c (hw_create, hw_delete): Call.
19 * hw-alloc.c (create_hw_alloc_data, delete_hw_alloc_data): Define.
21 * Make-common.in (SIM_NEW_COMMON_OBJS): Add hw-alloc.o.
22 (hw-alloc.o): New target.
26 * hw-events.h, hw-events.c: New files. Move event code to here.
27 * sim-hw.c: From here.
28 * hw-base.h: Include "hw-events.h".
29 * Make-common.in (SIM_NEW_COMMON_OBJS): Add hw-events.o.
30 (hw-events.o): New target.
32 * hw-device.h (struct hw): Add struct hw_event_data events_of_hw.
33 * hw-events.h (struct hw_event): Replace typedef hw_event.
35 * hw-base.h (create_hw_event_data, delete_hw_event_data): Declare.
36 * hw-base.c (hw_create, hw_delete): Call.
37 * hw-events.c (create_hw_event_data, delete_hw_event_data): Define.
43 * hw-base.c (panic_hw_port_event, empty_hw_ports): Move from here.
44 * hw-ports.c: To here.
46 * hw-base.h, hw-ports.c (create_hw_port_data,
47 delete_hw_port_data): New functions.
48 * hw-base.c (hw_delete, hw_create): Call same.
50 * hw-base.h (set_hw_ports, set_hw_port_event): Move set functions
52 * hw-ports.h: To here.
56 * hw-device.c (hw_ioctl), hw-device.h (hw_ioctl_callback): Drop
57 PROCESSOR and CIA arguments.
61 * aclocal.m4 (SIM_AC_OPTION_HW): Add enable / disable argument.
62 Move common object files from here.
63 * Make-common.in (SIM_COMMON_HW_OBJS): To here.
67 * sim-hw.c: Include ctype.h.
68 (do_hw_poll_read): Do not assume EAGAIN.
72 * cgen-trace.c (first_insn_p): New static local.
73 (trace_insn_init): Set it.
74 (trace_insn_fini): Use TRACE_PREFIX.
75 (trace_insn): Rewrite to use trace_prefix.
76 * sim-trace.c (trace_prefix): Don't print filename arg if NULL.
77 Adjust width accordingly.
79 * sim-profile.h (PROFILE_DATA): New member profile_any_p.
80 (PROFILE_ANY_P,PROFILE_INSN_P,PROFILE_MEMORY): New macros.
81 (PROFILE_SCACHE_P,PROFILE_PC_P,PROFILE_CORE_P): New macros.
82 (PROFILE_COUNT_INSN,PROFILE_COUNT_READ,PROFILE_COUNT_WRITE): Simplify.
83 (PROFILE_COUNT_CORE): Simplify.
84 * sim-profile.c (profile_option_handler): Compute profile_any_p.
88 * cgen-ops.h (ADDCFSI): Fix typo.
92 * cgen-sim.h (CGEN_CPU): New members idesc_{read,sem}_init_p.
93 * genmloop.sh: Use them rather than static locals.
95 * sim-engine.c (sim_engine_set_run_state): New function.
96 * sim-engine.h (sim_engine_set_run_state): Declare.
97 * genmloop.sh (pending_reason,pending_sigrc): New static locals.
98 (@cpu@_engine_stop): New args reason,sigrc. All callers updated.
99 (engine_resume): Reorganize. Allow synchronous exit from main loop.
103 * cgen-trace.c (trace_insn_init): New arg first_p.
105 (trace_insn_fini): New arg last_p. All callers updated.
106 * cgen-trace.h (trace_insn_init,trace_insn_fini): Update.
107 (TRACE_INSN_INIT,TRACE_INSN_FINI): Update.
108 * genmloop.sh (engine_resume): Update.
112 * Make-common.in (install-common): Run ranlib on installed copy of
117 * Make-common.in (install-common): Rename and install libsim.a.
121 * sim-io.c (unistd.h): Include.
125 * Make-common (sim_main_headers): Sort.
126 (cgen-*.o): Add cgen-sim.h dependency.
128 * cgen-scache.c (scache_init): Only allocate space if scache element
130 (scache_flush,scache_print_profile): Check if scache in use first.
132 * cgen-sim.h (IDESC): Provide forward declaration.
134 (CGEN_CPU): Always define scache member. New members idesc,opcode.
135 (cgen_cpu_max_extra_bytes): Declare.
136 * cgen-utils.c (cgen_cpu_max_extra_bytes): New function.
138 * cgen.sh: s/@arch@/${arch}/ for cpu files.
140 * sim-cpu.h: New file. sim_cpu_base moved here.
141 Move sim_cpu_lookup decl here.
142 * sim-base.h: #include "sim-cpu.h".
143 * sim-cpu.c: New file.
144 * Make-common (sim_main_headers): Add sim-cpu.h.
145 (sim-cpu.o): Add rule for.
147 * sim-model.c (set_model): Delete.
148 (sim_model_set,model_set): New functions.
149 (sim_model_install): Renamed from model_install.
150 Don't set default model here.
151 (model_option_handler): Rewrite --model processing.
152 (sim_model_lookup,sim_mach_lookup): New functions.
153 * sim-model.h (MAX_MODELS,MAX_INSNS): Delete.
154 (insn_timing): Delete.
155 (INSN_TIMING): New member `num'.
156 (IMP_PROPERTIES): Always define scache_elm_size member.
157 (MACH): New member init_cpu.
158 (sim_machs): Renamed from machs.
159 (sim_model_install): Renamed from model_install.
160 (sim_model_set,sim_model_lookup,sim_mach_lookup): Declare.
161 * sim-module.c (modules): Update.
163 * sim-profile.c (profile_print_insn): Add cpu arg to INSN_NAME macro.
165 * sim-io.c: #include <errno.h>.
169 * dv-pal.c (struct hw_pal_device): Add reader.
170 (hw_pal_finish): Initialize reader.
171 (scan_hw_pal): Use reader.
173 * hw-base.h, sim-hw.c (do_hw_poll_read): New function.
174 (HW_IO_EOF, HW_IO_NOT_READY): Define.
177 * sim-io.h, sim-io.c (sim_io_poll_read): New function. Copy from
178 ../ppc/main.c sim_io_read_stdin.
182 * hw-tree.h (hw_tree_print): Paramaterize with print and file
186 * hw-base.h (hw_port_event_callback): Delete CPU/CIA args.
187 * hw-device.h (hw_io_read_buffer, hw_io_write_buffer): Delete
189 * hw-ports.h (hw_port_event): Ditto.
190 * hw-ports.c (hw_port_event): Update.
191 * hw-base.c (panic_hw_io_read_buffer, panic_hw_io_write_buffer):
193 * dv-pal.c (hw_pal_io_read_buffer, hw_pal_io_write_buffer):
195 (hw_pal_io_write_buffer): Call hw_halt not sim_engine_halt.
196 (do_counter_event): Update.
197 * dv-glue.c (hw_glue_io_read_buffer): Update.
198 (hw_glue_port_event): Update.
200 * hw-device.h (SIM_DESC): Replace with struct sim_state.
201 * hw-base.h (hw_create): Ditto.
202 * hw-base.c (hw_create): Ditto.
204 * hw-device.c (hw_abort, hw_trace, hw_hw_event_queue_schedule,
205 hw_event_queue_deschedule, hw_event_queue_time): Delete, moved
208 * hw-device.h (hw_system_cpu): Declare.
209 * sim-hw.c (hw_system_cpu): New function.
211 * sim-core.c (sim_core_map_attach, sim_core_attach): Call
212 sim_hw_abort not hw_abort.
214 (sim_core_read_buffer, sim_core_write_buffer): Call
215 sim_hw_io_read_buffer and sim_hw_io_write_buffer. Do not pass CPU
217 (sim_core_set_xor): Do not pass CPU when aborting.
219 * sim-n-core.h (sim_core_read_aligned_N,
220 sim_core_write_aligned_N): Call sim_hw_abort not hw_abort.
221 (sim_core_read_aligned_N, sim_core_write_aligned_N): Call
222 sim_cpu_hw_io_read_buffer and sim_cpu_hw_io_write_buffer. Does not
225 * sim-hw.h: Declare sim_hw_io_{read,write}_buffer. Declare
227 * sim-hw.c (sim_hw_io_read_buffer, sim_hw_io_write_buffer,
228 sim_cpu_hw_io_read_buffer, sim_cpu_hw_io_write_buffer): New
230 (sim_hw_print): New function.
232 * sim-engine.h (sim_engine_vabort): Declare.
233 * sim-engine.c (sim_engine_vabort): New function.
237 * sim-trace.c (print_data): For floating-point numbers trace raw
239 (trace_result_fp2): New function.
240 * sim-trace.h (trace_result_fp2): New declaration.
241 (TRACE_FP_RESULT2): New macro.
245 * common/aclocal.m4: call AM_EXEEXT in SIM_AC_COMMON, define
246 AM_CYGWIN32 and AM_EXEEXT.
247 * common/Make-common.in: set EXEEXT, add missing EXEEXTs
248 to run and install-common rules.
249 * common/configure: regenerate
253 * sim-types.h (cell_word): New type.
254 (natural_cell): Delete type.
256 Sun Apr 26 15:31:55 1998 Tom Tromey <tromey@creche>
258 * configure: Regenerated to track ../common/aclocal.m4 changes.
263 * acconfig.h (NEED_DECLARATION_PRINTF): Removed.
265 Fri Apr 24 14:16:40 1998 Tom Tromey <tromey@creche>
267 * configure: Regenerated to track ../common/aclocal.m4 changes.
272 * acconfig.h: New file.
273 * Make-common.in (top_builddir): New macro.
275 (INTLLIBS): New macro.
276 (INTLDEPS): Likewise.
277 (LIBDEPS): Use INTLDEPS.
278 (EXTRA_LIBS): Use INTLLIBS.
279 * aclocal.m4 (SIM_AC_COMMON): Call CY_GNU_GETTEXT.
280 (CY_WITH_NLS, CY_GNU_GETTEXT, AM_PATH_PROG_WITH_TEST,
281 AM_LC_MESSAGES): New macros from GNU gettext.
285 * sim-config.h: Discard leading _ from macros.
286 * sim-types.h: Ditto.
290 * Make-common.in (CSEARCH): Add -I to intl directories.
291 (INTL_LIB): Point to libintl.a.
292 (LIBDEPS): Add $(INTL_LIB).
297 * cgen-types.h (GETHIDI,MAKEDI): Tweak.
299 * cgen-ops.h (ADDCFSI): Fix.
304 * sim-types.h (signed_address, unsigned_address): Define.
308 * sim-fpu.c (sim_fpu_2d): Don't return an SNaN, convert it into a
313 * sim-fpu.c, sim-fpu.h (sim_fpu_fractionto, sim_fpu_tofraction):
314 New functions, pack / unpack sim_fpu struct using raw values.
315 (sim_fpu_is): Differentiate between negative and positive
320 * sim-bits.h (EXTEND4): Define.
321 (EXTEND4, EXTEND15, EXTEND11): Ditto.
325 * sim-memopt.c (parse_addr): Sunos 4.5 does not hane strtol
326 declared so we need this cast to prevent long long addresses
327 from being misconfigures. Results in access to unmapped memory.
331 * Make-common.in (RUNTESTFLAGS): Define.
332 (check): Pass RUNTESTFLAGS to recursive make.
336 * sim-info.c (sim_info): Be verbose when either VERBOSE or
341 * aclocal.m4 (sim-inline): By default, disable sim-inline when
346 * aclocal.m4 (sim-cflags): Add -fomit-frame-pointer to defaults.
347 (sim-inline): Update to match sim-inline.[hc]
348 * configure: Regenerated to track ../common/aclocal.m4 changes.
350 * Make-common.in (sim_main_headers): Add sim-inline.h
352 * sim-bits.h (sim-bits.c): Include when H_REVEALS_MODULE_P.
354 * sim-endian.h (sim-endian.c): Ditto.
356 * sim-events.h (_SIM_EVENTS_H_): Replace with SIM_EVENTS_H.
357 (sim_events_set_trace): Delete unused prototype.
359 * sim-core.h (_SIM_CORE_H_): Replace with SIM_CORE_H.
360 * sim-core.c (_SIM_CORE_C_): Ditto for SIM_CORE_C.
362 * sim-fpu.h (sim-fpu.c): Include when H_REVEALS_MODULE_P.
363 (sim_fpu_to232i, sim_fpu_to232u, sim_fpu_i232to, sim_fpu_u232to):
364 Comment out, not yet implemented in sim-fpu.c.
365 (sim_fpu_zero, sim_fpu_one, sim_fpu_two, sim_fpu_qnan,
366 sim_fpu_max32, sim_fpu_max64): Mark as EXTERN_SIM_FPU.
368 * sim-inline.h: Rewrite description.
369 (H_REVEALS_MODULE_P, C_REVEALS_MODULE_P): Define.
370 (SIM_MAIN_INLINE): Add inline option.
372 * sim-inline.c (semantics.c, idecode.c, engine.c, ...): Do not
373 include generated files. Handled by generator directly.
377 * sim-trace.c (set_trace_option_mask): Keep TRACE_ANY_P
380 * sim-trace.h (TRACE_ANY_P): Define.
381 (struct _trace_data): Add trace_any_p.
385 * run.c (main): Handle all alternatives of enum sim_stop.
386 (main): Delete unused `asection *s'.
390 * hw-tree.h, hw-tree.c (hw_tree_vparse): New function
392 * configure: Regenerated to track ../common/aclocal.m4 changes.
394 * sim-hw.c: New file.
395 * sim-hw.h (sim_hw_parse): Declare function.
396 (hw-tree.h): Do not include.
398 * sim-base.h (STATE_HW): Define.
399 (struct sim_state_base): Add member struct *hw.
401 * sim-module.c (sim-hw.h): Include.
402 (modules): Add sim_hw_install.
404 * aclocal.m4 (sim_hw_obj): Add sim-hw.o
408 * sim-base.h (CPU_INDEX): Define.
410 * sim-utils.c (sim_state_alloc): Initialize.
411 * sim-module.c (sim_post_argv_init): Ditto.
415 * aclocal.m4 (sim_hw_obj): Fix sed expression to generate
416 properly formatted lists.
420 * dv-pal.c (enum hw_pal_address_mask): From Stu Grossman, was
421 0x2f needs to be 0x3f.
425 * hw-tree.c (hw_tree_find_property): Return NULL when device is
427 (hw_tree_find_*_property): Clean up error message when property is
430 * dv-pal.c (hw_pal_io_read_buffer): Check the smp property is
431 present before looking for it.
435 * aclocal.m4 (AC_CHECK_HEADERS): Add check for fpu_control.h.
436 (AC_CHECK_FUNCS): Add check for __setfpucw.
437 * configure: Regenerated.
441 * dv-pal.c (hw_pal_countdown, hw_pal_countdown_value,
442 hw_pal_timer, hw_pal_timer_value): Define.
443 (hw_pal_io_read_buffer, hw_pal_io_write_buffer): Add timer support
444 (do_counter_event, do_counter_read, do_counter_value,
445 do_counter_write): new functions.
449 * hw-tree.c (hw_printf): Send tree dump to stderr, same as other
452 * hw-base.c (hw_create): Stop searching for a device when one is
457 * configure: Regenerated to track ../common/aclocal.m4 changes.
461 * aclocal.m4 (SIM_AC_OPTION_HARDWARE): Add second argument,
462 appends extra devices.
463 (SIM_AC_OPTION_HARDWARE): Substute sim_hw, a non-duplicate list of
466 * Make-common.in (hw-config.h): New target, create hw-config.h
468 (SIM_HW): Definition from @sim_hw@.
469 (hw-base.o): Depend on hw-config.h
473 * Make-common.in: Get SHELL from configure.
474 * (stamp-tvals sim-inline.c): Use $(SHELL) when invoking
475 move-if-change. Fixes NT native build problem.
476 * Makefile.in (nltvals.def): Use $(SHELL) when invoking
477 move-if-change. Fixes NT native build problem.
478 * configure: Regenerate with autoconf 2.12.1 to fix shell issues for
483 * hw-device.h, hw-device.c (hw_strdup): New function.
485 * hw-base.c (hw_create): Use hw_strdup when saving a copy of the
486 strings name, family and args.
487 (full_name_of_hw): Use hw_strdup when returning the full path.
489 * hw-properties.c: Clean up property not found / wrong type error
492 * hw-tree.c (hw_tree_parse): Finish a devices initialization
493 before attaching any ports.
495 * hw-base.c (hw-config.): Include. Replace hardwired table.
497 * dv-glue.c: Copy over ../ppc/hw_glue.c. Update to new framework.
499 * Make-common.in: Add rule for dv-glue.o.
503 * hw-base.c (hw_finish): Move setting of trace level to here.
504 (hw_create): From here.
506 * hw-base.h, hw-base.c (do_hw_attach_regs): Copy function from
507 ../ppc/device_table.c.
509 * dv-pal.c (hw_pal_finish): Attach PAL device to parent bus.
511 * hw-tree.c (print_properties): Supress path when printing
512 properties of root node.
516 * hw-device.h (HW_TRACE): Define.
518 * hw-device.c (hw_trace): Implement function.
520 * hw-base.c (hw_create): Set hw trace level from "trace?"
523 * dv-core.c (dv_core_attach_address_callback): Add trace.
525 * dv-pal.c: Replace DTRACE with HW_TRACE.
529 * hw-device.h (HW_ZALLOC, HW_MALLOC): New macros.
530 (hw_alloc_data): Delcare.
531 (struct hw): Add member alloc_of_hw.
533 * hw-device.c (hw_zalloc, hw_malloc, hw_free, hw_free_all): New
534 functions. Assocate memory with a device.
537 * hw-base.h (set_hw_delete): Define.
538 (hw_delete_callback): Declare.
539 (hw_delete): Declare.
541 * hw-base.c (hw_delete): Implement function.
542 (struct hw_base_data): Add member to_delete.
543 (ignore_hw_delete): New function, does nothing.
544 (hw_create): Set the hw_delete method.
545 (hw_create): Allocate the base type using HW_ZALLOC before setting
548 * hw-tree.h, hw-tree.c (hw_tree_delete): New function.
550 * hw-properties.c: Replace zalloc/zfree with hw_zalloc/hw_free.
552 * hw-ports.c: Replace zalloc/zfree with hw_zalloc/hw_free.
553 (attach_hw_port_edge): Add struct hw argument
555 * dv-pal.c (hw_pal_finish): Replace zalloc/zfree with
560 * hw-device.h (hw_attach_address_callback,
561 hw_detach_address_callback): Attach to a single space not a space
562 mask. Clarify interpretation of SPACE:ADDR parameters.
564 * hw-base.c (passthrough_hw_attach_address,
565 passthrough_hw_detach_address): Update.
566 * dv-core.c (dv_core_attach_address_callback): Ditto.
567 * dv-pal.c (hw_pal_attach_address): Ditto.
571 * sim-options.h: Document additional CPU arg to OPTION_HANDLER.
575 * Make-common.in (SIM_HW_OBJS, SIM_HW_SRC, SIM_DV_OBJS): Define.
576 (hw-base_h, hw-device_h, hw-handles_h, hw-instances_h, hw_ports_h,
577 hw-properties_h, hw-tree_h): Define, point at corresponding
579 (hw_base_headers): Define list of headers included by hw-base.h
580 (hw-base.o, hw-device.o, hw-instances.o, hw-handles.o, hw-ports.o,
581 hw-properties.o, hw-tree.o): Specify dependencies.
582 (dv-core.o, dv-pal.o): Ditto.
584 * sim-hw.h: New file.
586 * hw-device.h, hw-device.c, hw-properties.h, hw-properties.c,
587 hw-ports.h, hw-ports.c: New files. Copied from ../ppc/device.[ch].
589 * hw-tree.h, hw-tree.c: New files. Copied from ../ppc/tree.[hc].
591 * hw-base.h, hw-base.c: new files. Copied from
592 ../ppc/device_table.[hc].
594 * dv-core.c, dv-pal.c: New files. Copied from
595 ../ppc/hw_{core,pal}.c
597 * sim-basics.h (struct hw): Declare.
598 (enum port_direction, enum object_disposition): Declare.
602 * aclocal.m4 (SIM_AC_OPTION_HARDWARE): Set sim_hw_obj, sim_dv_obj,
603 sim_dv_src in Makefile. Take list of devices as parameter to m4
606 * configure: Regenerated to track ../common/aclocal.m4 changes.
610 * sim-trace.h, sim-trace.c (trace_prefix): Pass in sim_cia so that
611 trace_prefix can abort cleanly.
615 * dv-sockser.c, dv-sockser.h: New files.
616 * Make-common.in (dv-sockser.o): Add rule for.
617 * aclocal.m4: Check for fcntl.h.
618 * config.h: Add HAVE_FCNTL_H.
620 * sim-break.c (remove_breakpoint): Fix thinko.
622 * sim-hload.c (sim_load): Provide default value of SIM_HANDLES_LMA.
623 Use SIM_HANDLES_LMA for lma_p arg to sim_load_file.
627 * sim-base.h (struct sim_state_base): Add prog_syms and
628 define macro STATE_PROG_SYMS.
629 * sim-trace.c (trace_prefix): Add variables abfd, symsize,
630 symbol_count, and asymbols. Call bfd_get_symtab_upper_bound
631 and bfd_canonicalize_symtab, to get symbol table on first use
632 and preserve it via STATE_PROG_SYMS for future calls to
633 bfd_find_nearest_line.
637 * sim-core.h, sim-core.c (sim_core_map_to_str): Delete.
639 * sim-core.c (sim_core_attach): Handle a generic number of maps -
640 up to nr_maps, not just access_* maps.
642 * sim-profile.h (struct PROFILE_DATA): Track nr_maps different
645 * sim-profile.c (profile_print_core): Make map unsigned. Iterate
646 over nr_maps not sim_core_nr_maps.
648 * sim-events.h, sim-events.c (sim_events_watch_core): Change
649 core_map argument to unsigned.
650 (struct _sim_core): Ditto for struct member core_map.
652 * sim-core.h (nr_sim_core_maps, sim_core_*_map): Delete
654 * sim-basics.h (access_io, access_*_io): Define.
655 (map_read, map_write, map_exec, map_io): Define.
657 * sim-core.c, sim-core.h (sim_core_attach): Replace argument
658 attach with more generic mapmask.
659 (sim_core_{read,write}_*): Change map argument to unsigned.
661 * sim-core.c (sim_core_uninstall, sim_core_attach,
662 sim_core_detach): Iterate over nr_maps instead of
665 * sim-break.c (insert_breakpoint): Write breakpoints to exec_map
666 instead of the write_map.
667 (remove_breakpoint): Ditto.
669 * genmloop.sh (engine_resume_full): Replace sim_core_*_map
670 with read_map, write_map, exec_map resp.
672 * cgen-mem.h (DECLARE_GETMEM, DECLARE_SETMEM, DECLARE_GETIMEM):
675 * cgen-utils.c (sim_disassemble_insn): Ditto.
677 * sim-hrw.c (sim_write, sim_write): Ditto.
679 * sim-utils.h, sim-utils.c (access_to_str, map_to_str,
680 transfer_to_str): New functions.
684 * sim-base.h (sim_state_base): New member environment.
685 (STATE_ENVIRONMENT): New macro.
686 * sim-config.c (current_environment): Delete.
687 (sim_config_default): New function.
688 (sim_config): Set STATE_ENVIRONMENT, not current_environment.
689 * sim-config.h (current_environment,CURRENT_ENVIRONMENT): Delete.
690 (sim_config_default): Add prototype.
691 * sim-module.c (sim_pre_argv_init): Call sim_config_default.
692 * sim-options.c (standard_option_handler, case OPTION_ENVIRONMENT):
693 Set STATE_ENVIRONMENT, not current_environment.
697 * sim-fpu.c (NR_GUARDS64): Change NR_PAD32 to NR_PAD64.
701 * sim-types.h (SIGNED32, SIGNED64): Pacify GCC.
703 * sim-alu.h (ALU64_BEGIN): Make alu64_r unsigned.
707 * Make-common.in (TAGS): Make smarter.
708 * Makefile.in (TAGS): Ditto.
712 * sim-module.c (*): Fix typos in assertion tests.
716 * sim-module.c (sim_pre_argv_init): String passed to asprintf
719 * sim-options.c (sim_parse_args): Ditto.
720 (sim_args_command): Return OK, instead of nothing, for an empty
725 * sim-profile.c (profile_info): Rename from profile_print. Drop
726 misc and misc_cpu callback arguments. Use
727 PROFILE_INFO_CPU_CALLBACK and STATE_PROFILE_INFO_CALLBACK instead.
728 (profile_install): Install profile_info function.
730 * sim-profile.h (PROFILE_INFO_CPU_CALLBACK,
731 STATE_PROFILE_INFO_CALLBACK): Define.
732 (struct PROFILE_DATA): Add field info_cpu_callback.
733 (profile_print): Delete function.
735 * sim-base.h (STATE_MODULES): Define. Replace individual
736 STATE_*_LIST with single struct module_list.
738 * sim-module.h (MODULE_INFO_FN, MODULE_INFO_LIST): Declare.
739 (struct module_list): Declare.
741 * sim-module.h, sim-module.c (sim_module_add_info_fn,
742 sim_module_info): New functions.
743 (sim_module_install): Clean up module data structures.
745 * sim-info.c (sim_info): New file. New function. Call
748 * Make-common.in (sim-info.o): Define rule.
749 (SIM_NEW_COMMON_OBJS): Add sim-info.o.
754 * sim-base.h (sim_cpu_base): New members name, options.
755 (sim_cpu_lookup): Add prototype.
756 * sim-module.c (sim_pre_argv_init): Provide default names for cpus.
757 * sim-options.h (DECLARE_OPTION_HANDLER): New argument `cpu'.
758 (sim_add_option_table): Update prototype.
759 * sim-options.c (sim_add_option_table): New argument `cpu'.
760 (standard_option_handler,standard_install): Update.
761 (sim_parse_args): Handle cpu specific options.
762 (print_help): New static function.
763 (sim_print_help): Call it. Print cpu specific options.
764 (find_match): New static function.
765 (sim_args_command): Call it. Handle cpu specific options.
766 * sim-utils.c (sim_cpu_lookup): New function.
767 * sim-memopt.c (memory_option_handler): Update.
768 (sim_memopt_install): Update.
769 * sim-model.c (model_option_handler): Update.
770 (model_install): Update.
771 * sim-profile.c (profile_option_handler): Update.
772 (profile_install): Update.
773 * sim-trace.c (trace_option_handler): Update.
774 (trace_install): Update.
775 * sim-watch.c (watchpoint_option_handler): Update.
776 (sim_watchpoint_install): Update.
777 * cgen-scache.c (scache_option_handler): Update.
778 (scache_install): Update.
782 * Make-common.in (check): Run `make check' in testsuite dir.
786 * sim-trace.c (trace_result0): New function.
788 * sim-trace.h (TRACE_FP_*, TRACE_FPU_*): Rename TRACE_FPU_*
789 macro's to TRACE_FP_*. TRACE_FPU_* should be defined and used when
790 tracing sim_fpu variables.
791 (TRACE_ALU_RESULT0): Define.
792 (TRACE_FP_RESULT_WORD): Define.
793 (TRACE_FP_INPUT_WORD1): Define.
795 * sim-fpu.c, sim-fpu.h (sim_fpu_max32, sim_fpu_max64, sim_fpu_one,
796 sim_fpu_two): New constants.
797 (sim_fpu_op1, sim_fpu_op2): New types.
798 (struct _sim_fpu): Delete member result. Re-order other members.
799 (sim_fpu_sign, sim_fpu_exp): New functions.
800 (sim_fpu_max, sim_fpu_min): new functions.
801 (EXPMAX32, EXPMAX64, NR_PAD32, NR_PAD64, NR_GUARDS32, NR_GUARDS64,
802 NORMAL_EXPMAX32, NORMAL_EXPMAX64): Define.
806 * sim-profile.c (profile_print): Delete duplicate test of
808 (profile_print_pc): Exit early if data collection not set up.
809 (profile_print_core): Simplify by calling sim_core_map_to_str.
810 * sim-core.h (sim_core_map_to_str): Declare.
811 * sim-core.c (sim_core_map_to_str): Make non-static.
813 * genmloop.sh (engine_resume): Update insn_count before exiting.
814 (engine_resume_full): Keep accurate core profile data.
816 * cgen-utils.c (sim_disassemble_insn): Don't use
817 sim_core_read_aligned_N, it messes up profiling results.
821 * nltvals.def: Regenerate with MN10300 additions.
825 * sim-trace.h (TRACE_ALU_RESULT2): Define.
827 * sim-trace.h, sim-trace.c (trace_result_word2,
828 trace_input_word4, trace_result_word4): New function.
832 * cgen-sim.h (SEM_NEXT_PC): New arg `len'.
834 * sim-xcat.h: Delete.
835 * cgen-mem.h: Delete inclusion of sim-xcat.h.
837 * sim-alu.h: Replace sim-xcat.h with symcat.h.
838 * sim-n-bits.h: Ditto.
839 * sim-n-core.h: Ditto.
840 * sim-n-endian.h: Ditto.
844 * syscall.c (cb_syscall): Handle short reads, and EOF.
848 * sim-trace.c (print_data): case trace_fmt_fp missing break. Use
849 sim_fpu to safely print fp_word values.
850 (print_data): Add trace_fmt_bool and trace_fmt_addr.
851 (trace_result_bool1, trace_result_addr1): New functions.
852 (trace_input_bool1, trace_input_addr1): New functions.
854 * sim-trace.h (TRACE_FPU_*): Define.
858 * sim-fpu.h (enum sim_fpu_class): Add sim_fpu_class_denorm.
859 (sim_fpu_fpto, sim_fpu_tofp): Define.
863 * sim-fpu.c (sim_fpu_cmp): New function.
867 * cgen-utils.h (sim_disassemble_insn): Use CGEN_INSN_BITSIZE
868 instead of abuf->length.
869 * sim-trace.c (trace_options): Have -t only trace a few useful things.
870 (set_trace_option_mask): Renamed from set_trace_options.
871 (set_trace_option): New function.
872 (trace_option_handler): Update calls to set_trace_option{,_mask}.
873 * sim-trace.h (TRACE_USEFUL_MASK): New macro.
877 * sim-basics.h: Declare struct _sim_fpu.
881 * sim-trace.h (TRACE_ALU_INPUT*, TRACE_ALU_RESULT): Define.
882 (trace_prefix, trace_input*, trace_result*): Declare.
883 (trace_one_insn): Change declaration, assume trace_prefix called.
884 (trace_generic): Like trace_one_insn.
885 (TRACE_ALU_IDX, TRACE_*_IDX): Change #define's to enum.
886 (TRACE_alu, TRACE_[a-z]*): Update.
888 * sim-trace.c (trace_prefix, trace_input*, trace_result*,
889 trace_insn, save_data, trace_idx_to_str, print_data): New
891 (trace_one_insn): Rewrite.
892 (trace_generic): New function.
896 * Make-common.in (CGEN_MAIN_SCM): Update.
897 * aclocal.m4 (USE_MAINTAINER_MODE): New variable.
899 * cgen-sim.h (SEMANTIC_CACHE_FN): Delete.
900 (SEMANTIC_FN): Rewrite declaration.
901 (DECODE): Update type of semantic_fast member.
902 ({EX,SEM}_FN_NAME): Have only one version.
903 * cgen.sh: Support building cpu.c.
904 * sim-base.h (sim_state_base): Delete conditionals surrounding
909 * sim-load.c (sim_load_file): Print LMA/VMA according to value
914 * sim-core.c: Add missing prototypes for WITH_DEVICES.
915 Add missing parameters to device_io calls.
916 * sim-core.h: Add missing parameters to device_io calls.
920 * cgen-sim.h (DECODE): Always use switch for `read' for now.
921 (PAREXEC): Renamed from PARALLEL_EXEC. All uses updated.
922 (SEMANTIC{,_CACHE}_FN): Fix return type.
923 * cgen.sh (decode): Add s/@arch@/$arch/.
924 * genmloop.sh (@cpu@_engine_run): Delete `current_state'.
925 (engine_resume): Likewise. Make `engine' volatile. Save copy
926 of cpu pointer in volatile object. Initialize read switch if
931 * cgen-sim.h (EX_FN_NAME): _exc_ -> _ex_.
932 (SEM_INSN): New macro.
936 * sim-run.c (sim_engine_run): Assume IMEM is 32 bit.
940 * configure: Regenerated to track ../common/aclocal.m4 changes.
944 * sim-types.h (fp_word): New type, define according to
945 WITH_TARGET_FLOATING_POINT_BITSIZE.
947 * aclocal.m4 (default_sim_floating_point_bitsize): Add
948 configuration of size of floating point registers.
952 * sim-profile.c (profile_print): Only print CPU <N> if other
953 output is going to appear.
957 * configure: Regenerated to track ../common/aclocal.m4 changes.
961 * sim-types.h (address_word): Typedef according to
962 WITH_TARGET_ADDRESS_BITSIZE.
963 (signed_cell, unsigned_cell, natural_cell): Ditto using
964 WITH_TARGET_CELL_BITSIZE.
966 * sim-config.h (WITH_TARGET_ADDRESS_BITSIZE): Define.
967 (WITH_TARGET_CELL_BITSIZE): Define.
968 (WITH_HOST_WORD_BITSIZE): Delete.
970 * sim-config.c (print_sim_config): Update.
972 * aclocal.m4 (SIM_AC_OPTION_BITSIZE): Add support for
973 configuration of address and OpenFirmware cell sizes.
977 * sim-engine.h (sim_engine_run): Add argument nr_cpus.
978 * sim-run.c (sim_engine_run): Update.
980 * sim-engine.h (SIM_ENGINE_HALT_HOOK): Use SET_CPU_CIA instead of
982 * sim-run.c (sim_engine_run): Ditto.
984 * sim-resume.c (sim_resume): Obtain nr_cpus from sim_engine.
985 (sim_resume): Pass nr_cpus to sim_engine_run.
987 * sim-engine.h (struct _sim_engine): Add member nr_cpus.
989 * sim-engine.c (sim_engine_init): Hardwire nr_cpus to
991 (sim_engine_nr_cpus) sim-engine.c, sim-engine.h: New function
995 * cgen.sh: Portably read parms past $9.
999 * Make-common.in (stamp-tvals): New rule.
1000 (targ-vals.h,targ-map.c): Depend on it.
1001 (clean): Remove stamp-tvals.
1005 * sim-utils.c (sim_state_alloc): #if 0 variable that is only used
1006 in code also #if 0'ed.
1008 Mon Jan 19 22:26:29 1998 Doug Evans <devans@seba>
1010 * configure: Regenerated to track ../common/aclocal.m4 changes.
1011 * aclocal.m4: Recognize --enable-maintainer-mode.
1015 start-sanitize-cygnus
1016 * Make-common.in (cgen-{arch,cpu,decode}): New targets.
1017 * cgen.sh: New file.
1019 * cgen-scache.h: Deleted.
1020 * Make-common.in (cgen-run.o,cgen-scache.o): Delete cgen-scache.h dep.
1021 (CGEN_CPU_SCM): Add sim-model.scm.
1022 * cgen-scache.c: Only compile contents if WITH_SCACHE.
1023 (scache_init): Use runtime computed size of SCACHE.
1024 (scache_flush): Likewise.
1025 * cgen-mem.h (GETIMEMU[QHSD]I): Declare.
1026 ([GS]ETT{QI,UQI,HI,UHI,SI,USI,DI,UDI}): Declare.
1027 * cgen-sim.h: Scache support moved here.
1028 (PC): Redo definition.
1029 (ARGBUF,SCACHE,PARALLEL_EXEC): Provide forward decls.
1030 (DECODE): Add parallel execution support.
1031 Only include semantic label members if using switch.
1032 (SWITCH,CASE,BREAK,DEFAULT,ENDSWITCH): Portable computed goto support.
1033 (CGEN_CPU): Delete members exec_state, halt_sigrc, halt_jmp_buf.
1034 (IADDR,CIA,SEM_ARG,EX_FN_NAME,SEM_FN_NAME,RECORD_IADDR,SEM_ARGBUF,
1035 SEM_NEXT_PC,SEM_BRANCH_VIA_{CACHE,ADDR},SEM_NEW_PC_ADDR): Moved here
1037 (engine_{stop,run,resume,halt,signal}): Delete decls.
1038 * cgen-types.h (CGEN_{XCAT3,CAT3}): Delete.
1039 (argbuf,scache): Delete forward decls.
1040 (STATE): Delete decl.
1041 * cgen-utils.c: Don't include decode.h, mem-ops.h, sem-ops.h.
1042 Include cgen-mem.h, cgen-ops.h.
1043 (engine_halt,engine_signal): Delete.
1044 ({ex,exc,sem,semc}_illegal): Delete.
1045 (sim_disassemble_insn): Result of extract fn is in bits.
1046 * genmloop.sh: Rewrite.
1048 * cgen-trace.c (trace_insn): Set printed_result_p=0 if not tracing
1051 * sim-base.h (sim_state_base): Delete member `model'.
1052 (sim_cpu_base): Add member `model'.
1053 * sim-model.h (IMP_PROPERTIES): New type.
1054 (MACH): New members imp_props, models.
1055 (models): Delete decl.
1056 * sim-model.c (set_model): Update.
1057 * sim-profile.c (profile_print_model): Update.
1059 * sim-utils.c (sim_state_alloc): Delete setting of cpu backlink here.
1063 * cgen-trace.c (trace_insn): Call CGEN_INSN_MNEMONIC() rather than
1068 * configure: Regenerated to track ../common/aclocal.m4 changes.
1073 * aclocal.m4 (AR): Check for sigaction.
1077 * Make-common.in (sim-core.o): Depend on $(sim_main_headers).
1079 * sim-config.h (WITH_TREE_PROPERTIES): Define as 0.
1080 * sim-config.c (sim_config): Replace WITH_DEVICES with
1081 WITH_TREE_PROPERTIES.
1083 * configure: Regenerated to track ../common/aclocal.m4 changes.
1087 * Make-common.in (SIM_ENVIRONMENT): New variable.
1088 (CONFIG_CFLAGS): Add it.
1089 * aclocal.m4 (SIM_AC_OPTION_ENVIRONMENT): Handle
1090 --enable-sim-environment option.
1091 * configure: Regenerated.
1092 * sim-config.h (environment support): Rewrite.
1093 * sim-config.c (current_environment): Define as enum, unconditionally.
1094 (current_alignment): Define unconditionally.
1095 (config_environment_to_a): Update.
1096 (config_alignment_to_a): Fix type of argument. Define unconditionally.
1097 (sim_config): Handle environment and alignment determination
1098 unconditionally. Delete sanity checks of current_environment,
1100 (print_sim_config): Update.
1101 * sim-options.c (STANDARD_OPTIONS enum): Add OPTION_ENVIRONMENT.
1102 (standard_options): Add --environment.
1103 (standard_option_handler): Likewise.
1107 * sim-alu.h: Add notes on carry vs borrow for subtraction.
1108 (ALU{,8,16,32,64}ADD): Redefine ADD macro as add overflowing.
1109 (ALU{,8,16,32,64}ADDC): Define - add carrying.
1110 (ALU{,8,16,32,64}SUB): Redefine SUB macro as subtract overflowing.
1111 (ALU{,8,16,32,64}SUBB): Define - subtract borrowing.
1112 (ALU{,8,16,32,64}SUBC): Define - tract carrying.
1113 (ALU{,8,16,32,64}ADD_CA, ALU{,8,16,32,64}ADDC_C): Replace single
1114 argument ADD_CA macro with two argument ADDC_C - add carrying with
1116 (ALU{,8,16,32,64}SUB_CA, ALU{,8,16,32,64}SUBC_X): Replace single
1117 argument SUB_CA macro with two argument SUBC_X - subtract
1119 (ALU{,8,16,32,64}SUBB_B): Define - subtract borrowing with
1121 (ALU{,8,16,32,64}NEGC, ALU{,8,16,32,64}NEGB): Define.
1125 * sim-io.c (sim_io_{syscalls,getstring}): Delete. No longer used.
1126 * sim-io.h (sim_io_syscalls): Delete.
1130 * syscall.c (cb_syscall): Add missing else, so write to stdout
1133 * sim-alu.h (ALU{,8,16,32,64}_SET_CARRY): Provide macros to import
1134 the carry bit from the CPU's psw.
1138 * gennltvals.sh: Redo syscall support.
1139 * nltvals.def: Regenerated.
1143 * syscall.c (cb_syscall): If writing to stdout or stderr, flush
1144 the stream immediately.
1148 * sim-io.c (sim_io_getstring): Delete unused len2.
1149 (sim_io_syscalls): Ditto for sys_errno.
1153 * syscall.c (cb_syscall): Test CB_SYSCALL struct magic number.
1155 * Make-common.in (run.o): Depend on remote-sim.h.
1156 (nrun.o,sim-hload.o,sim-hrw.o): Likewise.
1157 (sim-io.o,sim-reason.o,sim-resume.o): Likewise.
1161 * sim-io.c (sim_io_syscalls): Disable lseek.
1166 * gennltvals.sh: Generate syscall values for d30v.
1168 * gennltvals.sh: Use libgloss/syscall.h for sparc.
1169 * nltvals.def: Regenerate.
1171 * callback.c (os_stat): Make 3rd arg a host struct stat ptr.
1172 (os_fstat): Likewise. Validate fd argument.
1173 (cb_host_to_target_stat): Delete big_p arg. If HS arg is NULL,
1174 just compute target stat struct length.
1175 * syscall.c: #include "libiberty.h", <sys/types.h>, <sys/stat.h>.
1176 (ENOSYS,ENAMETOOLONG): Provide definitions if missing.
1177 (get_string): Return host errno values so they can be properly
1179 (cb_syscall): Likewise.
1180 (cb_syscall, cases open,unlink): Use get_path instead of get_string.
1181 (cb_syscall, case read): Use read_stdin for file descriptor 0.
1182 (cb_syscall, case write): Use write_stderr for file descriptor 2.
1183 (cb_syscall): Add cases for lseek, unlink, stat, fstat, time.
1184 (get_path): New function.
1188 * sim-io.c (sim_io_syscalls): New function to provide system call
1189 emulation. Provide exit, open, close, read, write, lseek, and
1191 (sim_io_getstring): New function to return a string from a
1192 simulated memory location.
1194 * sim-io.h (sim_io_syscalls): Add declaration.
1198 * sim-core.c (sim_core_signal): Fix spelling error in message.
1200 * sim-hrw.c (sim_read): Use read map, not write map.
1202 * Make-common.in (all): Add .gdbinit.
1203 * gdbinit.in: Add dump command.
1205 * sim-model.c (model_options): Use '\0' for `shortopt'.
1207 * sim-trace.c (trace_option_handler): Set state trace file
1208 for --trace-file in addition to cpu's values.
1209 (trace_vprintf): If cpu == NULL, try state's trace file.
1210 (trace_options): Reorganize table, reword some descriptions.
1214 * sim-fpu.c (sim_fpu_abs, sim_fpu_neg, sim_fpu_inv), sim-fpu.h:
1219 * sim-reason.c (sim_stop_reason): For sim_signalled, return the
1220 signal untranslated, document problem with this.
1222 * nrun.c (main): Check for a prog name of `*step'. If present,
1223 step the simulator instead of allowing it to run free.
1225 * sim-signal.c (SIGQUIT): Define on _MSC_VER hosts.
1227 * Make-common.in (sim_main_headers): Add sim-signal.h.
1231 * sim-signal.c (sim_signal_to_host): Return 0 for SIM_SIGNONE.
1235 * sim-signal.h: Start simulator signals at 64 so that host signal
1236 numbers can be detected and reported.
1238 * sim-signal.h (SIM_SIGFPE), sim-signal.h: Add signal.
1242 * callback.c (cb_host_to_target_stat): Fix return values.
1244 * cgen-sim.h (enum_signal_type): Delete.
1245 (engine_signal): Update prototype.
1246 * cgen-utils.c: Don't include <signal.h>.
1247 (sim_signal_to_host): Delete, lives in sim-signal.c now.
1248 (engine_signal): Update.
1250 * sim-utils.c (sim_state_alloc): Call SIM_STATE_ALLOC if defined.
1251 (sim_state_free): Call SIM_STATE_FREE if defined.
1253 * sim-module.c (sim_module_install): Don't leave any modules
1254 installed if one fails to install.
1258 * sim-options.c: Don't include ../libiberty/alloca-conf.h any
1259 more, since alloca is not used in this file.
1261 * sim-alu.h (ALU{32,64}_*): Rewrite 32 and 64 bit ALU support to
1262 correctly set the carry and overflow bits for those types.
1263 (ALU{8,16,32,64}_{ADD,SUB}_CA): Take VAL argument to add along
1264 with carry, so carry is correct after doing both adds.
1265 (ALU*): Space out '\' to make it easier to read.
1269 * sim-core.c (sim_core_signal): Use sim_stopped instead of
1272 * sim-signal.c, sim-signal.h: New files.
1273 * Make-common.in (sim-signal.o): Add rule for.
1274 (SIM_NEW_COMMON_OBJS): Add sim-signal.o.
1275 * sim-abort.c: Don't include <signal.h>.
1276 * sim-basics.h: #include "sim-signal.h".
1277 * sim-break.c: Don't include <signal.h>.
1278 (sim_handle_breakpoint): Replace SIGTRAP with SIM_SIGTRAP.
1279 * sim-core.c: Don't include <signal.h>.
1280 (SIGBUS): Delete definition.
1281 (sim_core_signal): Replace SIGSEGV,SIGBUS with SIM_SIGSEGV,SIM_SIGBUS.
1282 * sim-engine.c: Don't include <signal.h>.
1283 (sim_engine_abort): Replace SIGABRT with SIM_SIGABRT.
1284 * sim-reason.c (sim_stop_reason): Call sim_signal_to_host.
1285 * sim-resume.c: Don't include <signal.h>.
1286 (SIGTRAP): Delete definition.
1287 (has_stepped): Replace SIGTRAP with SIM_SIGTRAP.
1288 * sim-stop.c: Don't include <signal.h>.
1289 (control_c_simulation): Replace SIGINT with SIM_SIGINT.
1290 * sim-watch.c: Don't include <signal.h>.
1291 (handle_watchpoint): Replace SIGINT with SIM_SIGINT.
1293 * Make-common.in (SIM_NEW_COMMON_OBJS): New variable.
1295 * sim-base.h (CIA_ADDR): Provide default definition.
1296 * sim-core.c (sim_core_signal): Use CIA_ADDR to fetch value.
1297 * sim-break.c (sim_handle_breakpoint): Likewise.
1301 * Make-common.in (srccom): New variable.
1303 * Make-common.in (DEP, COMMON_DEP_CFLAGS): Define.
1304 (LIB_OBJS): Add syscall.o.
1305 (gentmap): Pass $(NL_TARGET) to $(CC).
1306 (syscall.o): Add rule for.
1307 (sim_main_headers): Add $(SIM_EXTRA_DEPS).
1308 (sim-bits.o): Depend on $(sim-n-bits_h).
1309 (sim-load.o): Depend on callback.h.
1311 * Make-common.in (cgen-*.o): Update dependencies, mem-ops.h renamed to
1312 cgen-mem.h, sem-ops.h renamed to cgen-ops.h.
1313 * cgen-mem.h, cgen-ops.h: New files.
1315 * aclocal.m4 (--enable-sim-scache): Pass -DWITH_SCACHE=0 for "=no".
1317 * Makefile.in (nltvals.def): Depend on gennltvals.sh.
1319 * callback.c: #include string.h or strings.h.
1320 #include sys/types.h and sys/stat.h.
1321 (cb_init_syscall_map,cb_init_errno_map,cb_init_open_map): Declare.
1322 (os_get_errno,os_open): Update.
1323 (os_stat,os_fstat): New functions.
1324 (os_init): Initialize syscall_map, errno_map, open_map.
1325 (default_callback): Add entries for os_stat, os_fstat, syscall_map,
1326 errno_map, open_map, signal_map, stat_map.
1327 (cb_read_target_syscall_maps): New function.
1328 (cb_target_to_host_syscall): New function.
1329 (cb_host_to_target_errno): Renamed from host_to_target_errno.
1330 (cb_target_to_host_open): Renamed from target_to_host_open.
1331 (store): New function.
1332 (cb_host_to_target_stat): New function.
1333 * syscall.c: New file.
1334 * gentmap.c (sys_tdefs): New global.
1335 (gen_targ_vals_h): Output target syscall numbers.
1336 (gen_targ_map_c): Update. Output target syscall translation map.
1337 * gentvals.sh: New first argument `target'. Preface table with
1338 #ifdef NL_TARGET_$target if non-null target passed.
1339 * gennltvals.sh: New file.
1340 * nltvals.def: Regenerated.
1344 * sim-n-core.h (sim_core_read_unaligned_N): Return static
1346 (sim_core_dummy_M): Declare.
1350 * sim-core.c (sim_core_signal): Print the address of the
1355 * sim-base.h (sim_state_base): Move `magic' to end of struct.
1357 * sim-base.h (sim_state_base): Add member trace_data.
1358 (STATE_TRACE_DATA): New macro.
1359 * sim-trace.h (TRACE_DEBUG_IDX,TRACE_debug): New macros.
1360 ({WITH_,}TRACE_DEBUG_P): New macros.
1361 (STATE_TRACE_FLAGS,STRACE_P,STRACE_DEBUG_P): New macros.
1362 (_sim_cpu): Delete forward reference.
1363 (debug_printf): Update.
1364 * sim-trace.c (OPTION_TRACE_DEBUG): Define.
1365 (trace_options): Add --trace-debug.
1366 (set_trace_options): Handle it.
1367 (trace_option_handler): Likewise.
1368 (trace_install): Init state trace_data struct.
1369 (trace_uninstall): Close state trace file.
1370 * sim-events.c (ETRACE): Only print source file and line number if
1372 * sim-n-core.h (sim_core_trace_M): Likewise.
1374 * sim-core.c (sim_core_signal): Add missing "\n" in message.
1378 * sim-n-core.h (sim_core_read_unaligned_N): illegal empty
1380 * sim-types.h (unsigned128,signed128): fix typo for MSVC.
1384 * aclocal.m4 (SIM_AC_OPTION_SCACHE): Fix typo.
1386 * Make-common.in (BUILT_SRC_FROM_COMMON): Remove files no longer
1388 (sim-config.o): Remove non-existent $(sim-nconfig_h) dependency.
1389 (clean): Don't delete $(BUILT_SRC_FROM_COMMON) if building in
1394 * sim-events.c (sim_events_process): Re-compute the time -
1395 update_time_from_event - as each event is processed. Reverses
1400 * callback.c (os_poll_quit): Replace _WIN32 with _MSC_VER.
1404 * sim-events.c (sim_events_process): Delete redundant call to
1405 update_time_from_event.
1406 (sim_events_slip): Always decrement time_from_event.
1407 (sim_events_tick, sim_events_deschedule, update_time_from_event):
1408 Delete assertion that time_from_event >=0 when work in queue, no
1413 * sim-options.c (STANDARD_OPTIONS): Change OPTION_* to an enum.
1414 (standard_option_handler): Update.
1416 * sim-options.h: Clarify documentation.
1417 (OPTION_LONG_ONLY_P): Delete definition.
1418 (OPTION_VALID_P): Define.
1420 * sim-options.c (sim_print_help): Allow short only options.
1421 (sim_parse_args): Ditto.
1422 (sim_args_command): Skip short only options.
1423 (sim_parse_args): Allocate space for NUM_OPTS not just 256. Make
1424 separate entries for short and long options in the HANDLERS and
1426 (sim_parse_args): Disable argument permutation.
1430 * sim-core.h (DECLARE_SIM_CORE_WRITE_N. DECLARE_SIM_CORE_READ_N):
1431 Add argument M, size of data type.
1432 (sim_core_read_misaligned_3, sim_core_write_misaligned_3):
1433 Declare, ditto for 5, 6 & 7 byte transfers.
1434 (sim_core_write_unaligned_1, sim_core_write_unaligned_1): Define
1437 * sim-n-core.h (sim_core_trace_M): Rename from
1438 sim_core_trace_N. Add nr_bytes argument. Replace transfer argument
1439 with transfer type. Print transfer direction. Handle 1 and 2 byte
1441 (sim_core_read_unaligned_N, sim_core_write_unaligned_N): Trace
1443 (unsigned_M, T2H_M, H2T_M): Rename from unsigned_N, T2H_N, H2T_N.
1444 Update all functions.
1446 * sim-core.c: Generate functions starting with 16 not 1.
1447 (sim_core_read_unaligned_3): Generate. Ditto for 3 byte write and
1448 all 5, 6 & 7 byte transfers.
1450 * sim-n-core.h (sim_core_read_misaligned_N,
1451 sim_core_write_misaligned_N): Implement.
1455 * sim-endian.h (U16_8): Implement
1457 * sim-endian.c (sim_endian_split_16, sim_endian_join_16): New functions
1459 * sim-endian.h (VL8_16, VH8_16): Implement.
1461 * sim-memopt.c (memory_option_handler): Typecast 64bit value to
1463 (memory_option_handler): Only zalloc modulo bytes when non-zero.
1464 (memory_option_handler): Skip comma in alias address list
1468 * sim-memopt.c (do_memopt_add, do_memopt_delete): Add level and
1470 (parse_size, parse_addr): New functions
1471 (memory_option_handler, memory_options): Parse address & size
1472 using new functions. Pass level, space, modulo to do_memopt_add &
1475 * sim-memopt.h (struct _sim_memopt): Add level & space fields.
1477 * sim-core.h (sim_core_arrach, sim_core_detach): Replace
1478 `attach_type attach' argument with `unsigned level' argument.
1481 * sim-core.c (new_sim_core_mapping, sim_core_map_attach,
1482 sim_core_attach): Replace argument attach with level. Update
1483 verification of arguments.
1484 (sim_core_map_detach, sim_core_detach): Replace argument attach
1487 * sim-basics.h (enum _attach_type): Delete.
1491 * sim-core.h (sim_core_write_8): Define.
1495 * sim-bits.h: Document ROTn macro.
1497 * sim-endian.h (H2T): Handle 16 byte variables.
1499 * sim-n-core.h (sim_core_read_unaligned_N): Return a dummy when an
1502 * sim-core.c: Do not generate sim_core_*_word.
1504 * sim-n-core.h (sim_core_trace_N): Add line_nr argument.
1505 (sim_core_write_aligned_N, sim_core_read_aligned_N): Update.
1507 * sim-core.h (sim_core_read_unaligned_word,
1508 sim_core_read_aligned_word, sim_core_read_word,
1509 sim_core_write_unaligned_word, sim_core_write_aligned_word,
1510 sim_core_write_word): Change to macros that map onto sim_core_*_N.
1514 * sim-n-endian.h: Add TAGS entrys for 16 byte versions.
1516 * sim-endian.h: Disable 16 byte support.
1520 * sim-endian.c (_SWAP_16): Define. Generate 126 bit swap code.
1522 * sim-n-core.h (sim_core_trace_N): New function.
1523 (sim_core_read_aligned_N, sim_core_write_aligned_N): Use,
1524 (sim_core_read_unaligned_N): Do not retyrn bogus value wden error.
1526 * sim-endian.h: Add 128 bit variant.
1528 * sim-core.h, sim-core.c: Add 128 bit variant.
1530 * sim-types.h: Add signed128 and unsigned128 types using a struct.
1534 * sim-events.c (sim_events_process): Clear events->work_pending.
1535 (sim_events_tickn, sim_events_tick): Accumulate, instead of
1536 setting, nr_ticks_to_process.
1537 (sim_events_preprocess): Allow nr_ticks_to_process to be non-zero
1538 when the event queue isn't next.
1540 * sim-events.h, sim-events.c (sim_events_slip): New function.
1544 * sim-hload.c (sim_load): Pass lma_p==0 and do_load=sim_load.
1546 * sim-utils.h, sim-load.c (sim_load_file): Add lma_p and do_load
1551 * nrun.c (main): Remove useless test of name != NULL.
1552 Exit if bfd_openr fails. Call bfd_check_format after bfd_openr.
1556 * sim-fpu.c (EXPMAX): Type is unsigned.
1557 (MIN_INT, MAX_INT): Type is signed64.
1558 (i2fpu): Type of val is signed64.
1562 * sim-profile.h (PROFILE_PC_BUCKET_SIZE): Treat a shift of zero as
1563 a bucket size of zero.
1565 * sim-profile.c (OPTION_PROFILE_PC_GRANULARITY,
1566 OPTION_PROFILE_PC): Define.
1567 (profile_option_handler): Add support for --profile-pc and
1568 --profile-pc-granularity options.
1569 (profile_pc_init): When possible, compute nr buckets from bucket
1572 * sim-profile.c (profile_pc_init): Align the profile-pc end
1573 address with the profile-pc bucket size.
1575 * sim-profile.h (PROFILE_PC_NR_BUCKETS): Rename PROFILE_PC_SIZE to
1576 something less ambiguous.
1577 (PROFILE_PC_BUCKET_SIZE): Ditto for PROFILE_PC_SAMPLE_SIZE.
1579 * sim-profile.c (profile_pc_cleanup): New function. Move
1580 profile_pc_uninstall code to here.
1581 (profile_pc_uninstall): Call.
1582 (profile_pc_init): Call.
1586 * sim-profile.c (profile_print_pc): Dump pc profile to dmon.out
1587 file using BSD gprof format.
1589 * sim-bits.h (LSBIT, MSBIT, BIT): Force result to type
1591 (LSBIT8, LSBIT16, LSBIT32, LSBIT64, MSBIT8, MSBIT16, MSBIT32,
1592 MSBIT64): Force result to unsignedN.
1596 * sim-alu.h (ALU16_BEGIN, ALU32_BEGIN, ALU64_BEGIN): Drop opening
1598 (ALU8_BEGIN, ALU8_SET, ALU8_ADD, ALU8_SUB, ALU8_NEGATE): Define.
1599 (ALU16_ADD, ALU16_SUB, ALU16_NEGATE): Simplify arrithmetic.
1600 (ALU32_ADD, ALU32_SUB, ALU32_NEGATE): Simplify arrithmetic.
1601 (ALU64_ADD, ALU64_SUB, ALU64_NEGATE): Simplify arrithmetic.
1605 * sim-core.h (struct _sim_core_mapping): Change free_buffer to
1608 * sim-core.c (sim_core_uninstall, new_sim_core_mapping,
1609 sim_core_map_attach, sim_core_map_detach): Change free_buffer to
1611 (sim_core_attach): Rename buffer_freed to free_buffer, type
1612 void*. Ensure that allocated buffer is alligned according to
1617 * sim-alu.h (ALU64_HAD_OVERFLOW): Define.
1618 (ALU64_SUB): Define.
1620 * Make-common.in (all): Build SIM_EXTRA_ALL first.
1621 (.gdbinit): Remove dependencies, generate once per build.
1625 * sim-n-core.h (sim_core_read_aligned_N,
1626 sim_core_write_aligned_N): Make xaddr param type address_word not
1631 * sim-fpu.h, sim-fpu.c: Rewrite. Change sim_fpu object to an
1632 unpacked floating point struct. Pass sim_fpu object by reference.
1633 Add preliminary support for rounding modes.
1637 * configure: Regenerated to track ../common/aclocal.m4 changes.
1641 * aclocal.m4 (sim-bitsize): Fix typo, WITH_TARGET_WORD_BITSIZE not
1642 WITH_TARGET_BITSIZE.
1646 * sim-profile.c (profile_print_core): label needs empty statement.
1650 * sim-break.c (sim_set_breakpoint sim_clear_breakpoint): Use ZALLOC
1651 and zfree instead of xmalloc and free. Prevents warnings.
1655 * configure: Regenerated to track ../common/aclocal.m4 changes.
1659 * Make-common.in (SIM_BITSIZE): Assign from configured value.
1660 (CONFIG_CFLAGS): Add SIM_BITSIZE.
1662 * aclocal.m4 (--enable-sim-bitsize): Developer option for
1663 controling the bitsize/msb of the target.
1667 * Make-common.in: New files sim-break.c, sim-break.h.
1668 * sim-base.h: Add point to breakpoint list to sim_state_base.
1669 * sim-break.c sim-break.h: New modules that implement intrinsic
1671 * sim-module.c: Add breakpoint module.
1675 * sim-events.c (SIM_EVENTS_POLL_RATE): poll more often than once
1677 * sim-n-core.h (WITH_XOR_ENDIAN): MSVC barfs on
1679 * sim-core.c (sim_core_xor_write_buffer): WITH_XOR_ENDIAN + 1.
1680 (SIGBUS) define for Windows.
1681 * sim-trace.c (trace_printf,debug_printf): added ALMOST_STDC.
1682 * sim-resume.c: define SIGTRAP for windows.
1683 * sim-xcat.h: use token pasting if ALMOST_STDC.
1687 * Make-common.in (SIM_SCACHE, SIM_DEFAULT_MODEL): Assign
1689 (CONFIG_CFLAGS): Add same.
1693 * sim-types.h (SIGNED64): ##i64 when _MSC_VER, not _WIN32.
1694 (SIGNED32): use ##i32.
1698 * configure: Regenerated to track ../common/aclocal.m4 changes.
1702 * aclocal.m4 (sim-endian): Simplify logic determining [default]
1705 * Make-common.in (SIM_WARNINGS, SIM_ALIGNMENT, SIM_ENDIAN,
1706 SIM_HOSTENDIAN, SIM_RESERVED_BITS, SIM_ASSERT, SIM_FLOAT,
1707 SIM_HARDWARE, SIM_INLINE, SIM_PACKAGES, SIM_REGPARM, SIM_SMP,
1708 SIM_STDCALL, SIM_XOR_ENDIAN): Assign configured values.
1709 (CONFIG_CFLAGS): Add same.
1711 * aclocal.m4: Perform AC_SUBST on optional options.
1715 * sim-config.h (WITH_DEFAULT_ALIGNMENT): Don't hardwire any alignment.
1717 * sim-options.c (standard_option_handler): Typo in warning message.
1719 * sim-base.h (STATE_MODEL): Make conditional on SIM_HAVE_MODEL.
1721 * sim-profile.c (profile_print_insn): Check 0 .. MAX_INSN for any
1722 insn count. Make count conditional on there being a valid
1724 (profile_pc_init): Make default PC profile frequency an arbitrary
1727 * sim-base.h: Ditto.
1729 * sim-profile.h (WITH_PROFILE_MODEL_P): Only enable modeling when
1732 * sim-model.h (struct MACH): Depreciate, to be replaced by bfd
1737 * configure: Regenerated to track ../common/aclocal.m4 changes.
1741 * aclocal.m4 (sim_alignment): Simplify logic for selecting the
1742 configured alignment.
1746 * configure: Regenerated to track ../common/aclocal.m4 changes.
1750 * sim-config.c (sim_config): Check for default alignment.
1752 * sim-options.c (standard_option_handler): Add alignment option.
1754 * aclocal.m4 (sim_alignment): Allow configuration of hardwired and
1755 default alignment requirements on memory accesses.
1759 * sim-load.c (sim_load_file): Return failure if the executable
1760 had no loadable sections.
1764 * sim-events.c (ETRACE): Use trace_printf not sim_io_printf for
1767 * sim-core.c (sim_core_signal): When bad access halt simulator
1768 SIGSEGV / SIGBUS instead of aborting.
1769 (signal.h): Include.
1771 * sim-watch.c (sim_watchpoint_install): Handler for watchpoint
1772 options was missing.
1774 * sim-bits.h (MOVED): Define
1778 * sim-alu.h (ALU32_HAD_OVERFLOW): Pacify GCC, Use MSBIT instead of
1781 * sim-bits.h (LSBIT, MSBIT): Check for overflow of shift value.
1783 * sim-bits.c: Add 8 bit versions of bit macros.
1785 * sim-bits.h: Ditto.
1789 * sim-bits.c (LSSEXT, MSSEXT): Replace SEXT.
1790 (LSINSERTED, MSINSERTED): Ditto for INSERTED.
1792 * sim-n-bits.h (MSSEXTn, LSSEXTn): Replace SEXTn.
1793 (LSINSERTDn, MSINSERTEDN): Ditto for INSERTEDn.
1795 * sim-bits.h (SEXT*): Define as MSEXT/LSEXT.
1796 (INSERTED*): Ditto for LSINSERTED/MSINSERTED.
1800 * aclocal.m4 (SIM_AC_COMMON): Add optional config.h file argument.
1801 configure.in: Output to cconfig.h instead of config.h.
1803 * configure: Regenerated to track ../common/aclocal.m4 changes.
1807 * sim-utils.c (sim_analyze_program): Set STATE_ARCHITECTURE from
1812 * callback.c (os_write): divert stdout and stderr to their
1817 * sim-profile.c (profile_print_speed): Call
1818 sim_events_elapsed_time instead of PROFILE_EXEC_TIME for moment.
1820 * sim-events.c (sim_events_elapsed_time): New function return nr
1821 host MS consumed by the simulator.
1822 (sim_watch_valid): Use.
1824 * sim-module.c (modules): Install sim_events very very early.
1826 * sim-profile.c (profile_print): Call profile_print_pc.
1828 (profile_pc_init): New function, set up processor for PC
1830 (profile_print_pc): New function, print a PC profile.
1831 (profile_pc_event): New function, sample PC.
1833 * sim-profile.h (PROFILE_PC_COUNT, PROFILE_PC_START,
1834 PROFILE_PC_END, PROFILE_PC_SHIFT, PROFILE_PC_SAMPLE_SIZE): Add to
1837 * sim-options.c (sim_print_help): Pacify GCC.
1839 * sim-n-core.h (sim_core_read_aligned_N,
1840 sim_core_write_aligned_N): Add un-conditional profile call.
1841 (sim_core_read_unaligned_N, sim_core_write_unaligned_N): Add
1842 profile call when aligned read/write isn't used.
1844 * sim-base.h: Include sim-profile, sim-model after sim-core &
1845 sim-events allow sim-core to define useful values.
1847 * sim-profile.c (OPTION_PROFILE_CORE): Define.
1848 (profile_option_handler, profile_options): Add support for
1849 --profile-core option.
1850 (print_bar): Include when core profiling.
1851 (profile_print_core): New function, print core profile.
1853 * sim-config.c (print_sim_config): Print profile status.
1855 * sim-profile.h (PROFILE_NEXT_IDX, PROFILE_core,
1856 WITH_PROFILE_PC_P): Define.
1857 (PROFILE_CORE_COUNT): Count each core-map/size separatly.
1858 (PROFILE_COUNT_CORE): Define.
1862 * sim-watch.c (handle_watchpoint): Pass a char** index into the
1863 interrupt_names array as the data.
1864 (sim-watch.h): Document.
1868 * sim-options.c (sim_print_help): When the doc string is to long
1871 * sim-watch.c (sim_watchpoint_install): Use option.doc_name so
1872 that only the first few the watch options are listed. Generate
1873 meanginful usage messages.
1875 * sim-options.h (struct OPTION): Clarify use of doc_name field
1879 * sim-options.c (OPTION_ARCHITECTURE_INFO): New option.
1880 (standard_option_handler): Handle --architecture-info.
1884 * sim-core.h (sim_cpu_core): [WITH_XOR_ENDIAN + 1], to avoid
1885 illegal zero-sized array.
1886 * sim-core.c (sim_core_xor_read_buffer): same.
1890 * nltvals.def: Regenerate.
1894 * sim-fpu.c (DP_FRACHIGH2): Define LL using SIGNED64.
1898 * sim-bits.c (MASKED): Delete.
1899 (EXTRACTED): Delete.
1900 (LSEXTRACTED, MSEXTRACTED): New functions.
1902 * sim-n-bits.h (MASKEDn): Delete, define as MSMASKED or LSMASKED.
1903 (MSMASKEDn, LSMASKEDn): Add last argument.
1906 * sim-bits.h (EXTEND8, EXTEND16): Define.
1907 (EXTRACTED64): Define as 64 bit extract, not 32 bit.
1909 * sim-run.c (sim_engine_run): Use CPU_CIA macro.
1911 * sim-engine.h (SIM_ENGINE_HALT_HOOK): Use CPU_CIA to get at
1912 current instruction address.
1914 * sim-inline.h (*_ENGINE): Define.
1918 * sim-core.c (sim_core_attach): Fix checks of modulo/mask.
1920 * sim-watch.c (delete_watchpoint): Delete by ident and type.
1921 (watch_option_handler): Call delete_watchpoint with ident or type.
1922 (sim_watchpoint_install): Create interrupt specific watchpoint
1923 commands on the fly.
1924 (do_watchpoint_create): New function, create a watch point using
1925 type/int-nr info encoded in the option nr.
1926 (do_watchpoint_info): New function. List active watchpoints.
1928 * sim-watch.h: Change data structure to a list.
1930 * sim-memopt.c (memory_option_handler): Require explicit "all"
1931 before deleting all memory regions.
1933 * sim-utils.c (sim_do_commandf): New function, printf version of
1936 * sim-basics.h (asprintf, vasprintf): Hack, define for CYGWIN32.
1938 * sim-alu.h (ALU64_ADD): Use explicit MSEXTRACTED64, do not assume
1940 (SIGNED64, UNSIGNED64): Delete.
1941 (ALU64_ADD): Don't rely on bit endianness.
1942 (ALU64_BEGIN): Define.
1944 * sim-n-bits.h (MSEXTRACTEDn, LSEXTRACTED): New functions.
1945 (EXTRACTEDn): Delete, define as either LSEXTRACTED or MSEXTRACTED.
1947 * sim-types.h (SIGNED64, UNSIGNED64): New macros, attach relevant
1948 suffix - u64, LL - to 64 bit constants.
1952 * sim-config.c (sim_config): Add assert for SIM_MAGIC_NUMBER.
1954 * sim-utils.h (NZALLOC): Define - zalloc * N.
1956 * sim-hrw.c (sim_read, sim_write): New file. Provide generic
1957 implementation of read/write functions.
1959 * Make-common.in (sim-hrw.o): New target.
1961 * sim-base.h (STATE_MEMOPT_P): Delete, simulators _always_ add
1964 * sim-memopt.c (memory_option_handler): Implement memory-size
1965 command. Implement memory-alias command. Let memory-delete delete
1967 (add_memopt): New function. Add a memory region.
1968 (do_memopt_delete): New function. Delete a memory region.
1970 * sim-utils.c (sim_elapsed_time_get): Never return zero.
1972 * sim-core.c (sim_core_detach): New function.
1973 (sim_core_map_detach): New function. Perform the actual detach.
1974 (sim_core_init): Move initialization code from here.
1975 (sim_core_install): To here.
1976 (sim_core_uninstall): And here.
1978 * sim-module.c: Add memopt module.
1980 * sim-base.h (STATE_MEMOPT, STATE_MEMOPT_P): Add memopt to
1981 simulator base type.
1983 * Make-common.in (sim_main_headers): Add sim-memopt.h
1984 (sim-memopt.o): New target.
1986 * sim-core.c (sim_core_install): Add core_options to the option
1989 * sim-watch.c (watch_options): Make --delete-watch a synonym for
1992 * sim-config.h (WITH_MODULO_MEMORY): Define as 0. Update
1995 * sim-core.h (struct _sim_core_mapping): Change nr_bytes to type
1996 address_word, add mask member.
1998 * sim-core.h, sim-core.c (sim_core_attach): Make nr_bytes of type
1999 address_word, allow for 64bit targets in 32bit host. Add modulo
2001 (sim_core_map_attach): Ditto.
2002 (new_sim_core_mapping): Ditto.
2003 (sim_core_translate): Mask address when modulo memory.
2007 * sim-hload.c (sim_load): Add assert for SIM_MAGIC_NUMBER.
2009 * gdbinit.in: New file.
2010 * aclocal.m4 (SIM_AC_OUTPUT): Build .gdbinit.
2011 * Make-common.in (distclean): Delete .gdbinit.
2012 (.gdbinit): Add rule for.
2013 * configure: Regenerated to track ../common/aclocal.m4 changes.
2015 * Make-common.in (cgen-run.o): Add rule for.
2019 * sim-resume.c (sim_resume): Suspend/resume the simulator.
2021 * sim-events.c (sim_watch_valid): Compute total elapsed time from
2022 both resumed and previous elapsed time.
2023 (sim_events_init): Set initial_wallclock and current_wallclock to
2025 (sim_events_install): Install sim_events_suspend and
2027 (sim_events_watch_clock): Allow for suspended simulator when
2028 computing the time of the clock event.
2030 * sim-events.h (struct _sim_event): Add resume_wallclock, rename
2031 initial_wallclock to elapsed_wallclock, set both to zero.
2032 (sim_events_init, sim_events_uninstall): Delete prototypes.
2034 * sim-module.h (MODULE_SUSPEND_FN, MODULE_RESUME_FN): Define types.
2036 * sim-module.c(sim_module_resume, sim_module_suspend): New
2041 * sim-core.c (sim_core_map_attach): Clarify memory overlap error
2046 * Makefile.in (TAGS): Add support for "/* TAGS: foo */" marker.
2047 * Make-common.in (TAGS): Likewise.
2048 * sim-n-bits.h: Add TAGS comments for all functions.
2049 * sim-n-core.h: Likewise.
2050 * sim-n-endian.h: Likewise.
2054 * sim-utils.c (sim_state_alloc): Set CPU backlinks, callback and
2057 * sim-base.h (sim_state_alloc): Add callback and kind arguments.
2059 * sim-base.h (INVALID_INSTRUCTION_ADDRESS): Add default
2064 * sim-fpu.c (DP_GARDMSB, ...): Make unsigned.
2065 (DP_FRACHIGH, DP_FRACHIGH2, ..): Use MSMASK to avoid LL.
2069 * sim-core.c (sim_core_map_attach): Cast attach enum to int.
2070 (sim_core_xor_read_buffer, sim_core_xor_write_buffer): Make
2071 nr_transfered and nr_this_transfer unsigned.
2073 * sim-events.c (sim_events_tickn): N is signed, as limited to
2076 * sim-n-endian.h (offset_N): Change size to unsigned.
2078 * callback.c (os_poll_quit): Add prototypes for kbhit and getkey.
2082 * sim-utils.c (sim_copy_argv): Delete, replaced by dupargv.
2084 * sim-options.c (sim_parse_args): Use dupargv.
2088 * sim-options.c (standard_option_handler): Use xstrdup, not strdup.
2092 * sim-base.h (STATE_ARCHITECTURE, STATE_TARGET): Add to simulator
2095 * sim-options.c (standard_options): Add --architecture=MACHINE and
2096 --target=TARGET options.
2097 (OPTION_ARCHITECTURE, OPTION_TARGET): Define.
2098 (standard_option_handler): Handle architecture and target options.
2101 * sim-utils.c (sim_analyze_program): Pass STATE_TARGET to
2103 (sim_analyze_program): Set prog_bfd architecture from
2104 STATE_ARCHITECTURE if known.
2108 * configure: Regenerated to track ../common/aclocal.m4 changes.
2113 * aclocal.m4 (enable-sim-warnings): Remove comment stating
2114 that option does not apply to certain files.
2118 * sim-bits.h (LSBIT8, LSBIT16, LSBIT32, LSBIT64, LSBIT, MSBIT8,
2119 MSBIT16, MSBIT32, MSBIT64, MSBIT): New macros - single bit as
2120 offset from MSB/LSB.
2122 * sim-endian.h (A1_8, A2_8, A4_8, A1_4, A2_4, A1_2): New macro,
2123 access address of sub word quantity of a hosts 16, 32, 64 bit word
2125 (V1_2, V1_4, V2_4, V1_8, V2_8, V4_8): Ditto for values.
2126 (U8_1, U8_2, U8_4, U4_1, U4_2, U2_1): Ditto for set of values.
2127 (V2_H1, V2_L1, V4_H2, V4_L2, V8_L4, V8_H4): Given N byte argument,
2128 return N*2 byte value with argument in Hi/Lo word. Renamed from
2129 V1_H2, V1_L2, V2_H4, V2_L4, V4_H8, V4_L8.
2131 * sim-alu.h (ALU32_HAD_OVERFLOW): Use 64 bit mask not 32bit.
2132 (ALU16_HAD_CARRY, ALU32_HAD_CARRY, ALU16_HAD_OVERFLOW): Use MSBIT
2133 so that bit offset is explicit.
2137 * sim-utils.c (sim_analyze_program): Add prog_name argument.
2138 Update STATE_PROG_BFD when needed with a dup'd copy of the
2141 * sim-config.c (sim_config): Delete ABFD argument, use
2142 STATE_PROG_BFD directly.
2146 * run.c (main): Pass the open ABFD to sim_create_inferior.
2148 * nrun.c (main): Determine prog_bfd. Pass to sim_create_inferior
2152 * sim-hload.c (sim_load): New file. Implement generic sim_load for
2153 hardware only simulator targets.
2155 * Make-common.in (sim-hload.o): Add rule.
2159 * sim-utils.c (sim_copy_argv): Rewrite to match malloc strategy
2160 used by copyargv and freeargv.
2162 * sim-options.c (sim_parse_args): Save a copy of PROG-ARGS in
2163 STATE_PROG_ARGV, not just a pointer.
2167 * configure: Regenerated to track ../common/aclocal.m4 changes.
2172 * aclocal.m4 (sim-endian): Add second argument to
2173 SIM_AC_OPTION_ENDIAN. First is hardwired endian, second is
2174 default endian when not hardwired.
2176 * sim-config.h (WITH_DEFAULT_TARGET_BYTE_ORDER): New macro, if all
2177 else failes value for target byte order.
2179 * sim-config.c (sim_config): Add abfd arguments. Set
2180 STATE_PROG_BFD accordingly. Determine prefered_target_byte_order
2182 (sim_config): Return SIM_RC, don't abort.
2185 * run.c (main): Update call to sim_open - add ABFD argument.
2186 * nrun.c (main): Add NULL ABFD argument.
2190 * callback.c (os_poll_quit): Make static.
2191 Call sim_cb_eprintf, not p->eprintf.
2192 (sim_cb_printf, sim_cb_eprintf): New functions.
2193 * sim-utils.h (sim_cb_printf, sim_cb_eprintf): Declare.
2195 * sim-basics.h (zalloc,zfree,sim_add_commas,SIM_ELAPSED_TIME,
2196 sim_elapsed_time_get,sim_elapsed_time_since): Move decls to
2197 sim-utils.h. #include sim-utils.h.
2198 * sim-utils.h: Above decls moved here.
2199 (sim_analyze_program,sim_load_file): Use `struct _bfd', not `bfd'.
2201 * sim-watch.c (action_watchpoint): Fix thinkos.
2205 * sim-types.h: Fix defs of 64 bit data types for MSVC.
2209 * sim-n-core.h (sim_core_write_unaligned_N): Add missing break
2210 to FORCED_ALIGNMENT case.
2214 * callback.c (target_to_host_open): Handle hosts with O_BINARY.
2218 * Make-common.in (libsim.a): Fix typo.
2222 * nrun.c (main): Verify the structure returned before using it.
2226 * sim-config.h (WITH_ENGINE): Enable the sim-engine module by
2229 * sim-engine.c (sim_engine_install): New function. Install the
2230 engine init functions.
2231 (sim_engine_init): [Re]initialize the simulator engine.
2233 * sim-module.c: Add sim_engine to list of modules that always
2238 * sim-watch.c (schedule_watchpoint): Use sim_unschedule_watchpoint
2239 to remove the old watchpoint, not delete_watchpoint.
2240 (watch_option_handler): Action the correct watchpoint, not just
2245 * sim-n-core.h (sim_core_write_aligned_N): For 8byte reads, output
2246 both low and high word.
2247 (sim_core_write_aligned_N): Ditto.
2249 * sim-trace.c (set_trace_options): Delete code explicitly setting
2252 * sim-options.c (sim_print_help): Call the list commands if not a
2253 standalone simulator.
2254 (sim_print_help): Advise that some options may not be applicable.
2256 * sim-trace.c (set_trace_options): Assume core present.
2258 * sim-events.c (sim_events_schedule_after_signal): Overflow signal
2259 buffer when full not almost full.
2263 * sim-events.c (sim_events_process): Don't blat the event queue
2264 when processing watchpoints.
2266 * sim-watch.h: Make arg unsigned long - stop sign extension.
2268 * sim-events.c (sim_watch_valid): rewrite so debugable.
2270 * sim-config.h (WITH_XOR_ENDIAN): Default to zero.
2272 * sim-watch.c (schedule_watchpoint): Add is_within option so that
2273 inequality test is possible.
2274 (handle_watchpoint): Re-pass is_within arg.
2275 (watch_option_handler): When `!' prefix to pc-watchpoint arg pass
2276 0 to schedule_watchpoint's is_within arg.
2277 (sim_watchpoint_init): Re-pass is_within arg.
2279 * sim-options.c (sim_print_help): Add is_command argument. Don't
2280 include -- prefix when called from the command line interpreter.
2282 * sim-watch.c (schedule_watchpoint): Pass true is_within argument.
2284 * sim-events.c (sim_events_watch_sim): Add is_within argument,
2285 zero indicates that the test should be reversed.
2286 (sim_events_watch_core): Ditto.
2287 (WATCH_CORE): Compare range against is_within.
2292 * sim-events.c (WATCH_CORE): Pass NULL cpu argument to
2293 sim_core_read_buffer. Check nr-bytes transfered.
2295 * sim-core.h (sim_core_common): Define a new struct that contains
2296 the common data. to sd and cpu structures.
2297 * sim-core.c (sim_core_attach): Update.
2298 (sim_core_init): Update. Remember to copy initialized data to each
2300 (sim_core_find_mapping): Ditto.
2302 * sim-core.c (sim_core_read_buffer): Add cpu argument.
2303 (sim_core_write_buffer): Ditto.
2305 * sim-n-core.h (sim_core_read_unaligned_N): When mis-aligned
2306 transfer use xor version of read buffer.
2307 (sim_core_write_unaligned_N): Ditto for write.
2309 * sim-core.c (sim_core_xor_read_buffer): New function implement
2310 xor-endian data read breaking transfer up into xor-endian sized
2312 (sim_core_xor_write_buffer): Ditto for write.
2313 (reverse_n): Reverse order of arbitrary number of bytes in buffer
2314 - needed for xor-endian transfers.
2318 * sim-inline.h: Review description.
2320 * sim-core.h, sim-core.c: Reduce number of functions being inlined
2321 to just those involved in data transfers and configuration.
2323 * sim-xcat.h (XSTRING): New macro, map macro definition onto
2325 * sim-n-core.h (sim_core_read_aligned_N): Use.
2326 (sim_core_read_unaligned_N): Ditto.
2327 (sim_core_read_unaligned_N): Ditto..
2328 (sim_core_write_unaligned_N): Ditto.
2330 * sim-core.h: Add xor endian bitmap to main structure. *
2332 sim-n-core.h (sim_core_write_aligned_N): Add suport for xor
2334 (sim_core_read_aligned_N): Ditto.
2336 * sim-core.c (sim_core_set_xor_endian): New function.
2337 (sim_core_attach): Don't overwrite the per-cpu xor map when
2338 cloning the global core.
2342 * sim-engine.h: Update below so that it is using an enumerated
2347 * sim-engine.c (sim_engine_restart):
2348 * sim-resume.c (sim_resume): Change longjmp param/setjmp
2349 return value used for simulator restart from 0 to 2.
2353 * cgen-scache.c (scache_option_handler): Add is_command arg.
2355 * sim-model.c (model_option_handler): Add is_command argument.
2357 * sim-profile.c (profile_option_handler): Add is_command arg.
2359 * sim-events.c (sim_watch_valid): Use ub64, lb64 when 64bit value
2362 * sim-module.c (sim_module_add_init_fn): Call init fn in the same
2363 order that they are registered.
2365 * sim-options.h (OPTION_HANDLER): Add argument to differentiate
2366 between option and command line processing.
2368 * sim-options.c: Include stdlib.h, ctype.h.
2370 * Make-common.in (sim-watch.o): Add rule.
2371 (sim_main_headers): Assume sim-assert.h included.
2372 (sim-*.o): Simplify make rule.
2374 * sim-module.c: Add sim_watch_install to module list.
2378 * sim-base.h (STATE_LOADED_P): New predicate. Set once everything
2381 * sim-trace.c (trace_install): Check magic. Include sim-assert.h.
2382 * sim-events.c (sim_events_install): Ditto.
2383 * sim-core.c (sim_core_install): Ditto.
2384 * sim-model.c (model_install): Ditto.
2385 * sim-options.c (standard_install): Ditto.
2386 * sim-profile.c (profile_install): Ditto.
2387 * sim-reason.c (sim_stop_reason): Ditto.
2388 * sim-run.c (sim_engine_run): Ditto.
2389 * sim-utils.c (sim_analyze_program): Ditto.
2391 * sim-module.c (modules): Make profile_install and trace_install
2394 * sim-base.h (STATE_MEM_BASE): Define for flat memory systems.
2396 * sim-options.c (standard_option_handler): Set the byte order.
2398 * sim-events.c (sim_events_process): Allow multi tick processing.
2399 (sim_events_tickn): New function - multi cycle tick.
2401 * sim-events.h (sim_events_tickn, sim_events_timewarp): Add
2402 prototypes. Under development.
2403 (sim_events): Replace processing with nr_ticks_to_process.
2407 * nrun.c (main): Pass callbacks to sim_open instead of using
2410 * run.c (main): Ditto.
2414 * sim-events.c (sim_events_zalloc): Signal save memory allocator -
2415 stop tk interrupting malloc calls.
2416 (sim_events_zalloc): Converse.
2418 * Make-common.in (sim_main_headers): Add sim-events.h.
2420 * sim-events.c (sim_events_schedule_after_signal): Change return
2421 type to void - signal events are strictly internal.
2422 (sim_events_init): Allocate a finite buffer for signal events.
2423 (sim_events_schedule_after_signal): Enter signal events into the
2426 * sim-engine.c (sim_engine_halt): Check SIM_DESC magic.
2427 (sim_engine_restart): Ditto.
2428 (sim_engine_abort): Ditto.
2429 * sim-stop.c (sim_stop): Ditto.
2430 (control_c_simulation): Ditto.
2431 * sim-resume.c (sim_resume): Ditto.
2432 (has_stepped): Ditto.
2433 * sim-abort.c (sim_engine_abort): Ditto.
2435 * sim-basics.h (transfer_type): New type.
2437 * sim-core.c (sim_core_signal): New function. Print core signal
2439 (sim_core_find_mapping): Add transfer argument.
2441 * sim-n-core.h (sim_core_{write,write}_unaligned_N): Call
2442 SIM_CORE_SIGNAL if a recoverable abort.
2443 * sim-core.c (sim_core_find_mapping): Ditto.
2447 * sim-core.c (sim_core_find_mapping): Replace calls to
2448 sim_io_error to more resiliant sim_engine_abort.
2450 * sim-n-core.h (sim_core_read_unaligned_N): Ditto.
2451 (sim_core_write_unaligned_N): Ditto.
2455 * sim-module.c: Add sim_events_install to list.
2457 * sim-events.c (sim_events_install, sim_events_uninstall): Clonse
2459 (sim_events_init): Now returns SIG_RC.
2461 * sim-run.c: New file. Generic sim_engine_run.
2462 * sim-reason.c: New file. Generic sim_stop_reason.
2463 * sim-stop.c: New file. Generic sim_stop.
2464 * sim-resume.c: New file. Generic sim_resume.
2466 * Make-common.in (sim-engine.o): Add rule.
2467 (sim-run.o, sim-reason.o, sim-stop.o, sim-resume.o): Ditto.
2469 * sim-engine.h, sim-engine.c: New file. Provide generic
2470 implementation of sim_engine_halt, sim_engine_error. et.al.
2472 * sim-base.h (sim_state_base): Add member halt.
2473 (sim-engine.h): Include.
2475 * sim-events.h (sim_event_handler): Always pass SIM_DESC to event
2477 * sim-events.c (sim_events_poll): Update event handler.
2481 * sim-events.h, sim-events.c (sim_events_watch_clock): New
2483 (sim_events_watch_sim): New function.
2484 (sim_events_watch_core): New function.
2485 (sim_watch_valid): New function.
2486 (sim_events_preprocess): New function.
2487 (sim_events_process): Process the watchpoints as well as the timer
2489 (sim_events_tick): Check WORK_PENDING instead of the hold queue.
2490 (sim_events_deschedule): Check all the queues when removing an
2492 (sim_events_init): Ditto for cleaning.
2496 * sim-fpu.c (is_ufpu_number): Comment out - currently unused.
2500 * callback.c (os_open): Type of arg flags is int.
2504 * sim-fpu.c (sim_fpu_is_{eq,ne,lt,le,gt,ge}): Compare Infinities
2505 just like normal numbers as per IEEE rules.
2509 * callback.c (os_close): Mark the descriptor as being
2510 available if the close succeeded.
2511 (os_open): Pass 0644 as the mode of the file being created.
2515 * sim-fpu.c (pack_fpu, unpack_fpu): New functions - decode a
2518 * sim-inline.c (SIM_INLINE_C): Rename from _SIM_INLINE_C_.
2519 * sim-lnline.h: Update.
2521 * sim-fpu.h, sim-fpu.c (sim_fpu_[iu]{32,64}to): New int2fp
2522 conversion functions.
2523 (sim_fpu_to{32,64}[iu]): New fp2int functions.
2525 * sim-fpu.h, sim-fpu.c (sim_fpu_is_{lt,le,eq,ne,ge,gt}): New fp
2526 compare functions. Replacing.
2527 (sim_fpu_cmp): This. Delete.
2531 * sim-core.c (sim_core_find_mapping): Call engine_error not
2532 sim_io_error when possible.
2536 * sim-endian.h (V1_H2): Add macro's to insert a word into a
2537 high/low double word.
2539 * sim-trace.h: Remove definition of attribute - defined in
2544 * sim-options.h (struct OPTION): Add doc_opt as the documenting
2545 name of the option - or family of options.
2547 * sim-options.c (sim_args_command): Match command `a-b c' with
2548 option `--a-b-c' from option table.
2552 * sim-options.c (sim_print_help): For optional arguments, wrap
2555 * sim-trace.c (set_trace_options): New function, handle optional
2556 argument and multiple assignment.
2557 (trace_option_handler): Update.
2559 * sim-trace.c (trace_option_handler): Trace branch and not fpu
2560 when branch tracing selected.
2564 * sim-trace.c (trace_one_insn): Make a va-args function.
2566 * sim-trace.c (trace_vprintf): New function, va-arg version of
2571 * sim-trace.c (trace_uninstall): Don't close a file twice.
2572 * sim-profile.c (profile_uninstall): Likewise.
2576 * sim-trace.c (toplevel): Include bfd.h.
2577 (trace_options): Note that --trace-linenum also turns on
2578 --trace-insn. Add --trace-{branch,semantics}.
2579 (trace_option_handler): If --trace-linenum, also turn on
2580 --trace-insn. Add --trace-branch support. If --trace-semantics,
2581 turn on ALU, FPU, branch, and memory tracing.
2582 (trace_one_insn): New function to trace an instruction. Support
2584 (OPTION_TRACE_*): Use an enum, rather than lots of defines.
2586 * sim-trace.h (TRACE_{SEMANTICS,BRANCH}_IDX): Add new macros.
2587 (MAX_TRACE_VALUES): Use 32, not 12 by default.
2588 (TRACE_branch): Add new mask.
2589 (TRACE_*_P): Define all possible trace_p macros.
2590 (trace_one_insn): Declare function.
2594 * sim-trace.h (__attribute__): Define as nothing if not GNU C or
2595 GNU C doesn't support __attributes__.
2596 ({trace,debug}_printf): Add attribute's so -Wformat can check the
2601 * sim-config.h (FORCED_ALIGNMENT): New alignment option -
2602 addresses are masked forcing them to be correctly aligned.
2603 (WITH_ALIGNMENT): Make NONSTRICT_ALIGNMENT the default.
2604 * sim-config.c (config_alignment_to_a): Update.
2606 * sim-core.h (sim_cpu_core): New data type contains cpu specific
2608 * sim-base.h (CPU_CORE): Add cpu specific core data to cpu base
2610 * sim-core.c (sim_core_attach): Add CPU argument. Ready for
2611 processor specific core maps.
2612 (sim_core_map_attach): Copy the core map data to each of the
2613 processor specific core data structures.
2614 * sim-core.c (sim_core_find_mapping): Update.
2616 * sim-n-core.h (sim_core_read_N, sim_core_write_N): Rename.
2617 (sim_core_write_aligned_N, sim_core_write_aligned_N): New names.
2618 (sim_core_write_unaligned_N, sim_core_write_unaligned_N): New
2619 alternatives that handle unaligned addresses.
2620 (sim_core_{read,write}_{,un}aligned_N): Drop SIM_DESC arg, replace
2622 * cgen-utils.c (sim_disassemble_insn): Update.
2626 * sim-trace.h (TRACE_FPU_IDX): Add Floating-point specific
2629 * sim-fpu.h, sim-fpu.c: New files - prototype for generic target
2632 * sim-inline.h, sim-inline.c: Add support for SIM_FPU.
2636 * sim-core.c (sim_core_map_to_str): New function ascii equivalent
2639 * sim-n-core.h (sim_core_read_N, sim_core_write_N): Use in trace
2644 * cgen-trace.c: Prepend additional trace_printf argument.
2646 * cgen-utils.c (sim_disassemble_insn): Add additional core
2651 * nrun.c (main): Catch/report errorenous simulator states.
2653 * sim-module.c: #include "libiberty.h" so that xmalloc is defined.
2654 * sim-trace.c: #include string.h/strings.h so that memset is
2656 * sim-utils.c: Ditto.
2657 * sim-profile.c: Ditto. And stdlib.h.
2658 (print_bar): Only define when used by instruction or memory profiler.
2660 * sim-options.c (standard_option_handler): Make ul more local.
2662 * sim-load.c (sim_load_file): Make the name constant.
2663 (sim_load_file): Passify gcc.
2665 * sim-utils.h: New file, pre-declare utilites in corresponding .c
2667 * sim-utils.c, sim-load.c: Include sim-utils.h.
2669 * sim-base.h (sim_cpu): Pre define here so available to all.
2671 * sim-core.h (DECLARE_SIM_CORE_WRITE_N, DECLARE_SIM_CORE_READ_N):
2672 Restore the sim_cpu and instruction_address arguments so that full
2673 information is available to the abort function.
2674 * sim-core.c (sim_core_find_mapping, sim_core_write_buffer): Ditto.
2675 * sim-n-core.h (sim_core_write_N, sim_core_read_N): Update.
2677 * sim-trace.h, sim-trace.c (trace_option_handler): Add interim
2678 tracing support for sim-events and sim-core.
2679 (trace_option_handler): Convert #if to if where possible so always
2680 compiled/checked by C compiler.
2681 * sim-n-core.h (sim_core_write_N, sim_core_read_N): Update.
2683 * sim-base.h: Adjust comment documenting how to define the cpu
2685 (sim_state_base): Add sim_core and sim_events to simulator base
2688 * sim-trace.h, sim-trace.c (trace_printf): Add SIM_DESC argument.
2689 * sim-core.c (sim_core_init, sim_core_attach,
2690 sim_core_find_mapping): Update.
2691 * sim-events.c (ETRACE, sim_events_init, sim_events_time,
2692 update_time_from_event, insert_sim_event,
2693 sim_events_schedule_after_signal, sim_events_deschedule,
2694 sim_events_tick): Ditto.
2696 * sim-basics.h (sim-module.h, sim-trace.h, sim-profile.h,
2697 sim-model.h): Move #includes from here.
2698 * sim-base.h: To here.
2699 (sim-core.h, sim-events.h, sim-io.h): Include also
2703 * callback.c (default_callback): Missing initialisers.
2707 * sim-utils.c (sim_add_commas): New function.
2708 * sim-basics.h (sim_add_commas): Add prototype.
2709 * cgen-scache.c (scache_print_profile): Print commas in numbers.
2710 * sim-profile.c (COMMAS): New macro.
2711 (print_*): Use it to print commas in numbers.
2713 * configure: Regenerated.
2715 * cgen-sim.h (sim_signal_type): Add SIM_SIGINT.
2716 (cgen_state): New member run_fast_p.
2717 (cgen_init): Add prototype.
2718 (sim_disassemble_insn): New arg `cpu'.
2719 * cgen-trace.c (trace_insn): Update call to sim_disassemble_insn.
2720 * cgen-utils.c (cgen_init): New function.
2721 (sim_disassemble_insn): New arg `cpu'. Rewrite fetching of insn.
2722 * genmloop.sh: Call engine_halt if loop exits.
2724 * Makefile.in (sim-options_h): Define.
2725 (sim-{module,options,trace,profile,utils}.o): Clean up dependencies.
2726 (sim-model.o): Add new rule.
2727 (cgen-{scache,trace,utils}.o): Add new rules.
2728 * aclocal.m4 (SIM_AC_OPTION_{SCACHE,DEFAULT_MODEL}): Add.
2729 * cgen-scache.c (scache_print_profile): Change `sd' arg to `cpu'.
2730 Indent output by 2 spaces.
2731 * cgen-scache.h (scache_print_profile): Update.
2732 * cgen-trace.c (trace_insn_fini): Indent output by 2 spaces.
2733 Use trace_printf, not fprintf.
2734 (trace_extract): Use trace_printf, not cgen_trace_printf.
2735 * genmloop.sh (!FAST case): Increment `insn_count'.
2736 * sim-base.h (sim_state_base): Only include scache_size if WITH_SCACHE.
2737 (sim_cpu_base): Rename member `sd' to `state' to be consistent with
2738 access macro's name.
2739 * sim-core.c (sim_core_init): Use EXTERN_SIM_CORE to define it.
2740 Change return type to SIM_RC.
2741 (sim_core_{install,uninstall}): New functions.
2742 * sim-core.h (sim_core_{install,uninstall}): Declare.
2743 (sim_core_init): Use EXTERN_SIM_CORE to define it.
2744 Change return type to SIM_RC.
2745 * sim-model.h (models,machs,model_install): Declare.
2746 * sim-module.c (modules): Add scache_install, model_install.
2747 (sim_post_argv_init): Set cpu->state backlinks.
2748 * sim-options.c (standard_options): Delete --simcache-size,--max-insns.
2749 (standard_option_handler): Likewise.
2750 * sim-profile.c (PROFILE_{HISTOGRAM,LABEL}_WIDTH): Move to
2753 (profile_options): Delete --profile-simcache.
2754 (profile_option_handler): Likewise.
2755 (profile_print_insn): Change `sd' arg to `cpu'. Indent output 2
2757 (profile_print_{memory,model}): Likewise.
2758 (profile_print_simcache): Delete.
2759 (profile_print_speed): New function.
2760 (profile_print): Rewrite.
2761 * sim-profile.h (PROFILE_scache): Renamed from PROFILE_simcache.
2762 (WITH_PROFILE_SCACHE_P): Renamed from WITH_PROFILE_SIMCACHE_P.
2763 (PROFILE_DATA): Delete members simcache_{hits,misses}.
2764 (PROFILE_COUNT_SIMCACHE_{HIT,MISS}): Delete.
2765 (PROFILE_{CALLBACK,CPU_CALLBACK}): New types.
2766 (profile_print): Update prototype.
2770 * cgen-scache.[ch], cgen-sim.h: New files.
2771 * cgen-trace.[ch], cgen-types.h, cgen-utils.c, genmloop.sh: New files.
2772 * sim-model.c: New file.
2774 * Make-common.in (clean targets): Undo patch of Apr. 22.
2778 * sim-n-bits.h (signed): If we have a standard compiler, undef
2779 signed, so that signedN is defined correctly.
2783 * sim-module.h, sim-model.h, sim-profile.h: New files.
2784 * sim-module.c, sim-profile.c: New files.
2785 * Make-common.in (SIM_PROFILE): Define
2786 (CONFIG_CFLAGS): Add $(SIM_PROFILE).
2787 (sim_main_headers): Add sim-module.h, sim-model.h, sim-profile.h.
2788 (sim_module.o,sim-profile.o): Add rules for.
2789 * aclocal.m4 (--enable-sim-trace): Allow symbolic arguments.
2790 (--enable-sim-profile): Add.
2791 * configure: Regenerated.
2792 * sim-base.h (sim_state_base): New members init_list, uninstall_list,
2793 model. Move trace and profile support to sim-{trace,profile}.h.
2794 New members trace_data, profile_data.
2795 * sim-basics.h: #include sim-module.h, sim-model.h, sim-profile.h.
2796 * sim-config.h: Provide default definition of WITH_PROFILE.
2797 (WITH_TRACE): Change default to -1.
2798 (MAX_NR_PROCESSORS): Always define.
2799 * sim-options.c: Move trace and profile support to
2800 sim-{trace,profile}.h.
2801 (sim_pre_argv_init): Moved to sim-model.c.
2802 (standard_install): New function.
2803 * sim-options.h (sim_pre_argv_init): Move decl to sim-model.c.
2804 (standard_install): Declare.
2805 * sim-trace.c: Tracing option handling moved here from sim-options.c.
2806 (trace_install, trace_uninstall): New functions.
2807 (trace_printf): Update reference to TRACE_FILE.
2808 * sim-trace.h (TRACE_FOO_IDX): Moved here from sim-base.h.
2809 (TRACE_foo): Bit masks for symbolic arguments to --enable-sim-trace.
2810 (WITH_TRACE_FOO_P): Define.
2811 (trace_install): Declare.
2812 (TRACE_DATA): New struct.
2816 * run.c: Undo last exec_bfd patch.
2817 (main): Only pass -E ifdef SIM_HAVE_BIENDIAN.
2821 * run.c (exec_bfd): Add back in.
2822 (main): Set exec_bfd.
2826 * sim-load.c (sim_load_file): #include <stdio.h> for NULL.
2830 * sim-events.c (insert_sim_event): Call sim_io_error instead of
2831 less well defined engine_error.
2832 * sim-core.c: Ditto.
2836 * Make-common.in: Change clean targets to use :: so that other
2837 Makefiles can have their own clean targets.
2838 * sim-load.c (xprintf eprintf): Use ANSI_PROTOTYPES instead of
2839 __STDC__ to control use of stdarg vs. varargs syntax. Some
2840 systems can't use __STDC__, but require stdarg.
2844 * sim-options.c (standard_options): Add --endian.
2845 (standard_option_handler): Likewise.
2847 * nrun.c: #include <signal.h>.
2848 (main, cntrl_c): Wrap calls to sim_resume in a SIGINT
2849 handler that calls sim_stop ().
2853 * run.c (main, cntrl_c): Wrap calls to sim_resume in a SIGINT
2854 handler that calls sim_stop (). Simulators may still be
2855 establishing their own handler.
2857 * sim-events.c (sim_events_poll): Rename from
2858 sim_events_at_large_int. Poll IO.
2860 * sim-io.c (sim_io_poll_quit): New function - pass on a polling
2863 * callback.c (os_poll_quit): New function poll for quit signal
2865 (default_callback): Include magic number.
2869 * aclocal.m4: Check for headers time.h, sys/time.h, sys/resource.h.
2870 Check for functions getrusage, time.
2871 * sim-basics.h (SIM_ELAPSED_TIME): New typedef.
2872 (sim_elapsed_time_get, sim_elapsed_time_since): Add prototypes.
2873 * sim-utils.c: #include time.h, sys/time.h, sys/resource.h if able.
2874 (sim_elapsed_time_get, sim_elapsed_time_since): New functions.
2876 * sim-utils.c (sim_copy_argv, sim_analyze_program): New functions.
2878 * sim-options.c, sim-options.h: New files.
2879 * sim-config.h (WITH_DEBUG): Provide default value of zero.
2880 * Make-common.in (nrun.o): Add rules for.
2883 * run.c (main): Check return value of sim_open.
2885 * Make-common.in (sim-options.o, sim-load.o, sim-trace.o): Add rules.
2886 (sim_main_headers): Add sim-trace.h.
2887 * run.c (exec_bfd, target_byte_order): Delete.
2888 (main): Pass -E <endian> to sim_open. Delete code to load sections,
2889 call sim_load instead. Check return code of sim_create_inferior.
2890 * sim-base.h (CURRENT_STATE): Define.
2891 (sim_state_base): Make typedef. New members options, prog_argv,
2892 prog_bfd, text_{section,start,end}, start_addr, simcache_size,
2893 mem_size, memory [+ corresponding access macros].
2894 (sim_cpu_base): New typedef.
2895 * sim-trace.h: New file.
2896 * sim-trace.c: New file.
2897 * sim-basics.h: #include it.
2898 * sim-load.c: New file.
2902 * Make-common.in (INSTALL): Set to @INSTALL@.
2903 (INSTALL_XFORM, INSTALL_XFORM1): Remove.
2904 (install-common): Depend upon installdirs. Use
2905 $(program_transform_name) directly, rather than using
2907 (installdirs): New target.
2908 * Makefile.in (INSTALL): Set to @INSTALL@.
2909 (INSTALL_XFORM, INSTALL_XFORM1): Remove.
2910 (install-man): Depend upon installdirs. Use
2911 $(program_transform_name) directly, rather than using
2913 (installdirs): New target.
2917 * sim-assert.h (SIM_ASSERT, ASSERT): Allow these macros to
2922 * sim-basics.h: Only bring in config.h and tconfig.h if
2927 * sim-config.h (WITH_TARGET_WORD_MSB): New Macro. Define the bit
2928 numbering convention of the target.
2929 * sim-config.c (print_sim_config): Print WITH_TARGET_WORD_BITSIZE
2930 and WITH_TARGET_WORD_MSB.
2931 (sim_config): When possible, check for consistency with bitsize
2934 * sim-bits.h: Allow MSB to be other than zero.
2935 * sim-bits.c: Ditto.
2936 * sim-n-bits.h: Ditto.
2938 * sim-bits.h (MSMASK*): New macros - converce to LSMASK*.
2939 * sim-n-bits.h (MSMASKEDn): Ditto.
2943 * Makefile.in (INSTALL): Change install.sh to install-sh.
2947 * sim-base.h (sim_state_base): Move `magic' to end of struct.
2951 * run.c (main): Check that a program to run was specified.
2955 * aclocal.m4 (AC_TYPE_SIGNAL): Add check.
2957 * configure: Regenerated to track ../common/aclocal.m4 changes.
2962 * sim-endian.h: Move host {LITTLE,BIG}_ENDIAN support from here,
2963 * sim-config.h: To here.
2965 * Make-common.in (SIM_EXTRA_DEPS): New config var.
2966 (sim_main_headers): Define.
2967 (sim-*.o): Depend on $(SIM_EXTRA_DEPS).
2969 (BUILT_SRC_FROM_COMMON): Move here from ../d30v/Makefile.in.
2972 (sim-utils.o): Add rule for.
2973 * sim-utils.o: New file.
2974 * sim-basics.h: #include sim-base.h.
2975 (zalloc): Make argument unsigned long.
2976 * sim-base.h: New file.
2977 * sim-inline.h (SIM_IO support): Delete.
2978 * sim-io.h: Delete inline support.
2979 * sim-io.c: Likewise. sim-state.h renamed to sim-main.h.
2980 * sim-config.c: sim-state.h renamed to sim-main.h.
2981 * sim-core.c: Likewise.
2982 * sim-events.c: Likewise.
2984 * run.c (main): Pass SIM_OPEN_STANDALONE to sim_open.
2986 * aclocal.m4: Check for stdlib.h, string.h, strings.h, unistd.h.
2987 (sim-debug): Allow arguments. Define WITH_DEBUG in addition to
2989 * configure: Regenerated to track ../common/aclocal.m4 changes.
2993 * configure: Regenerated to track ../common/aclocal.m4 changes.
2997 * sim-config.h (WITH_ALIGNMENT, WITH_FLOATING_POINT,
2998 WITH_XOR_ENDIAN, WITH_SMP, WITH_RESERVED_BITS): Assume that these
2999 are defined by the configure.
3001 * aclocal.m4 (sim-stdio): Add option stdio from ../ppc configure.
3003 * aclocal.m4 (floating-point, xor-endian, alignment, smp,
3004 reserved-bits): Always define.
3006 * sim-config.h, sim-config.c (sim_config): New function - and new
3007 file - co-ordinate the setting/checking of the common simulator
3008 configuration options.
3010 * Make-common.in (sim-config.o): Add rule.
3014 * callback.c (os_{,e}vprintf_filtered): Change stdarg type to
3015 va_list from void *, since va_list might not be a pointer type.
3019 * sim-n-endian.h (offset_N): Correct assertion - word and sub word
3021 (offset_N): Correct computation of LE offset.
3023 * sim-io.c (sim_io_error): Include a new line when reporting
3026 * sim-assert.h (SIM_FILTER_PATH): Out by one when locating last
3031 * run.c: Include alloca-conf.h.
3033 * callback.c (os_evprintf_filtered): Fix typo.
3037 * run.c (string.h, strings.h, stdlib.h): Include.
3039 * sim-events.c (sim_events_tick): Recent cleanup failed to return
3040 0 when nothing pending.
3042 * run.c (sim_size, sim_trace): Plicate GCC - these two functions
3043 will soon be going away.
3044 (getopt): Plicate GCC.
3046 * sim-endian.c (sim-io.h): Plicate GCC.
3047 * sim-bits.c (sim-io.h): Ditto.
3048 * sim-n-bits.h (ROTn): Ditto.
3050 * sim-io.c (sim_io_error): Correct check for NULL.
3052 * sim-assert.h (SIM_FILTER_PATH): Separate out the code filtering
3054 * sim-events.c: Use SIM_FILTER_PATH to filter out the filename
3059 * aclocal.m4 (SIM_AC_OPTION_*: Move so that they are outside of
3060 SIM_AC_COMMON - SIM_AC_COMMON was gobling arguments.
3064 * sim-alu.h: Include sim-xcat.h.
3068 * Make-common.in (sim-bits.c, sim-core.c, sim-endian.c,
3069 sim-events.c, sim-inline.c, sim-io.c): Define rules for building
3072 * sim-events.c (sim_events_at_large_int): New function. Just
3073 schedules an event every large-int ticks.
3074 (sim_events_init): Call.
3075 (sim_events_tick, sim_events_process): Move async handing to
3076 sim_events_process. Move timer decrement so that it occures after
3077 events have been processed.
3079 * sim-basics.h (struct _engine): Remove declaration.
3081 * sim-events.h, sim-events.c: Rename type to sim_events. Prefix
3082 everything with same. Rename global struct to SIM_DESC.
3083 * sim-core.h, sim-core.c, sim-n-core.c: Ditto for sim_core.
3084 * sim-io.h, sim-io.c: Ditto.
3086 * sim-assert.h: New file. Optional assertion checking macros.
3087 * sim-io.c (sim_io_error): Make just this function tolerant to
3090 * sim-xcat.h: New file. Define concatenate macros.
3091 * sim-basics.h (XCONCAT*): Move to sim-xcat.h.
3092 * sim-n-core.h, sim-n-bits.h, sim-n-endian.h: Explicitly include
3098 * sim-bits.h (LSMASK): New macro. Create mask of LS bits.
3102 * sim-inline.h: Add definitions for sim-types.
3103 (ALL_BY_MODULE): New macro, encapsulate full inlining by the
3108 * sim-events.h: Remove defunct reference to callback struct.
3112 * configure: Re-generate.
3116 * Make-common.in (CSEARCH): Do not include the gdb directory in
3121 * Make-common.in (SIM_ENDIAN, SIM_HOSTENDIAN, SIM_INLINE,
3122 SIM_WARNING): Drop, requiring the simulator specific Makefile.in
3123 to explicitly incorporate these.
3125 * aclocal.m4 (--enable-sim-alignment); New option. Strongly
3126 specify the alignment restrictions of the target architecture -
3127 without this option all alignment restrictions are accomodated.
3128 (--enable-sim-assert): New option. Conditionally compile in
3129 assertion statements.
3130 (--enable-sim-float): New option. Strongly specify the target's
3131 floating point support.
3132 (--enable-sim-hardware): New option. Specify the hardware devices
3133 included in the simulation.
3134 (--enable-sim-packages): New option. Specify the hardware
3135 packages included in the simulation.
3136 (--enable-sim-regparm): New option. Specify that parameters be
3137 passed in registers instead of on the stack.
3138 (--enable-sim-reserved-bits): New option. Specify that reserved
3139 bits within an instruction are are correctly set.
3140 (--enable-sim-smp): New option. Specify the level of SMP support
3141 to be included in the simulator.
3142 (--enable-sim-stdcall): New option. Specify an alternative
3143 function call convention.
3144 (--enable-sim-xor-endian): New option. Configure xor-endian
3145 support used by some targets to implement bi-endian support.
3149 * aclocal.m4 (--enable-sim-hostendian): New option. Allow the
3150 host endianness to be overridden.
3151 (--enable-sim-endian): Allow the target platform's byte order
3153 (--enable-sim-inline): Control the inlining of common components.
3154 (--enable-sim-bswap): For compatibility, also define WITH_BSWAP.
3155 (--enable-sim-warnings): Enable additional GCC compiler checks.
3156 * Make-common.in (SIM_ENDIAN, SIM_HOSTENDIAN, SIM_INLINE,
3159 * sim-n-core.h, sim-n-bits.h, sim-n-endian.h: Rename from
3160 sim-*-n.h so that the names are uniq on dos machines
3161 * sim-core.c, sim-bits.c, sim-endian.c: Update.
3165 * run.c: #include "libiberty.h".
3166 (main): New locals sd,no_args,sim_argv.
3167 Run buildargv on -a option. Pass argv to sim_open, argv[0]
3168 is program name. Update call to sim_set_callbacks.
3169 Record result of sim_open, pass to other sim_foo routines.
3173 * callback.c (os_printf_filtered): Do not call exit(1) or print a
3178 * callback.c: Add os_flush_stdout and vprintf_filtered callbacks.
3179 Route stdout through buffered IO.
3181 * callback.c: Add os_flush_stderr, os_write_stderr,
3182 os_evprintf_filtered functions to route error output through
3185 * sim-io.h, sim-io.c (sim_io_flush_stderr, sim_io_flush_stdout):
3186 Correct return type - should be void.
3190 * sim-basics.h: Clean up. Many macro's moved to sim-inline.h.
3192 * sim-config.h: Ditto. For some options - eg WITH_DEVICES - do
3193 not provide a default value as undefined indicates disable code.
3197 * sim-core.h, sim-core-n.h, sim-core.c: Borrow code from ppc
3199 * sim-events.h, sim-events.c: Ditto.
3200 * sim-io.h, sim-io.c: Ditto.
3204 * sim-alu.h (ALU_SUB_CA, ALU*_SUB_CA): New alu operation.
3206 * sim-bits.h, sim-bits-n.h, sim-bits.c (LSMASKED*): New macro's
3207 extract the tail or least signifiant bits from an integer of the
3210 * sim-bits.h, sim-bits.c: Clean up conditionally compiled #if
3211 WITH_TARGET_BITSIZE so that the compilation will fail when an
3212 unsupported bitsize value is defined.
3214 (INSERTED*): Convert to functions.
3215 (EXTRACTED*): Ditto.
3217 (SIGN_EXTEND, SEXT): Change to more terse name.
3221 * sim-inline.h: Allow explicit control over which .c files will be
3222 included by their header.
3224 * sim-inline.h: Allow explicit control over which .c files use the
3225 alternative - REGPARM - parameter passing mechanism.
3227 * sim-inline.h, sim-inline.c: Don't attempt to include any of
3228 icache.c, idecode.c, semantics.c or support.c. Those names are
3229 not generally applicable.
3233 * sim-bits.c, sim-bits-n.h (new): Split sim-bits.c into two parts
3234 in a fashion similar to sim-endian-n.
3236 * sim-endian.h: (H_word, L_word, AL_*, VL_*): Extend to include
3237 both value and address macro's.
3241 * sim-alu.h (ALU16_BEGIN, ALU16_SET, ...): Fill in.
3243 * sim-endian.h (L_word, H_word): Replace MS2W_4, LS2W_4 with more
3244 generic L_word, H_word macro's.
3248 * sim-basics.h: Borrow code from ppc directory.
3249 * sim-bits.c: Ditto.
3250 * sim-bits.h: Ditto.
3251 * sim-config.h: Ditto.
3252 * sim-endian-n.h: Ditto.
3253 * sim-endian.c: Ditto.
3254 * sim-endian.h: Ditto.
3255 * sim-inline.c: Ditto.
3256 * sim-inline.h: Ditto.
3257 * sim-types.h: Ditto.
3261 * sim-alu.h (ALU_SET16, ALU_SET32, ALU_SET64, etc): Make available
3262 all the ALU size alternatives and then auto-configure a default.
3264 * sim-alu.h: Copy ppc/idecode_expression.h.
3268 * bits.h, bits.c (SIGN_EXTEND32, SIGN_EXTEND64): New functions,
3269 sign extend a bit within a value.
3271 * sim-endian.h, sim-endian-n.h (offset_N): New functions - return
3272 a pointer into the middle of a host word.
3273 * sim-endian.h (MS2W_4, LS2W_4): Use this function.
3277 * callback.c: If HAVE_CONFIG_H is defined, include config.h from
3278 autoconf. If HAVE_UNISTD_H is defined, include unistd.h to get
3279 appropriate definitions of read, write, etc. Add prototype for
3284 * Makefile.in (libcommon.a): Delete.
3285 (callback.o,targ-map.o): Delete, moved to Make-common.in.
3286 (gentmap,targ-vals.h,targ-map.c): Likewise.
3287 (run-autoconf): Delete.
3288 * aclocal.m4 (SIM_AC_OUTPUT): Redo creation of Makefile.
3289 (common makefile fragment): Moved back into ...
3290 * Make-common.in: Resurrect.
3291 * configure.in (AC_LINK_FILES): Delete, unnecessary now.
3292 * configure: Regenerated.
3296 * aclocal.m4 (SIM_AC_COMMON): Move COMMON_MAKEFILE_FRAG from here.
3297 (SIM_AC_OUTPUT): To here.
3301 * aclocal.m4 (COMMON_MAKEFILE_FRAG): Quote a couple of $'s in
3302 comments and single quotes. Fixes a problem found on hpux.
3306 * aclocal.m4: Remove Make-common.in from dependencies.
3307 * (distclean): Remove targ-vals.def.
3309 * aclocal.m4 (SIM_AC_COMMON): Move contents of Make-common.in
3310 into here. Makes insertion into makefiles easier. Also, change
3311 the way that callback.o, gentmap, targ-vals.h, targ-map.c,
3312 targ-map.o, and run are built. They are now built in the
3313 individual simulator directories, taking sources from ../common as
3314 necessary. This replaces the merging of libcommon.a into
3315 linsim.a, which was problematic for the WinGDB build process.
3316 * run.c: Include config.h from . instead of ../common.
3317 * Make-common.in: Remove. It's no longer necessary.
3321 * Make-common.in (ALL_CLAGS): Put CFLAGS at the end.
3322 (.c.o): Put $(ALL_CFLAGS) before the file being compiled.
3326 * run.c (main): Set target_byte_order before call to sim_open.
3330 * callback.c: #include <stdlib.h>
3331 (os_error): New function.
3332 (default_callback): Add os_error.
3336 * Make-common.in (Makefile): Set CONFIG_HEADERS="".
3337 * aclocal.m4: Mark the fact that --enable-sim-bswap isn't host
3339 (SIM_AC_OUTPUT): Don't build Makefile if CONFIG_FILES="".
3343 * run.c: #include ../common/config.h, tconfig.h.
3344 (myname): New static global.
3345 (main): Recognize new options -a, -c. Also recognize -h if h8/300.
3346 Only process -c ifdef SIM_HAVE_SIMCACHE.
3347 Only process -p/-s ifdef SIM_HAVE_PROFILE.
3348 Parse program name from argv[0] and use in error messages.
3349 Pass sim_args to sim_open. Pass prog_args to sim_create_inferior.
3350 Add support for incomplete h8/300 termination indicators.
3351 (usage): Make more verbose.
3352 * aclocal.m4,config.in,tconfig.in,configure.in,configure: New files.
3353 * Makefile.in,Make-common.in,callback.c: New files.
3354 * nltvals.def,gentmap.c,gentvals.sh: New files.
3358 * run.c: Include stdarg.h if __STDC__.
3362 * run.c (main): Don't print out anything if the signal
3363 number is zero (ie no signal).
3367 * run.c (main): Print out if the program raised a signal.
3371 * run.c (exec_bfd): Rename from sim_bfd, to use the gdb name.
3376 * run.c (main): Explicitly cast malloc() parameter.
3380 * run.c (sim_bfd): New global to hold the bfd pointer for the
3382 (main): Initialize sim_bfd.
3386 * run.c (main): Use new bfd_big_endian macro.
3390 * run.c (main): Removed SH specific comments, so source is
3391 generic. Also updated to only load relevant sections. Moved
3392 sim_open() to after callback attach (to match GDB).
3394 * run.1: Removed SH specific comments.
3398 * run.c (main): Always return sigrc at end.
3402 * run.c (main): Print error diagnostic and exit if bfd_openr() or
3403 bfd_check_format() fails.
3407 * run.c, run.1: From sh directory.