3 * emul_bugapi.c (emul_bugapi_create): Make formats type
8 * ppc-instructions (TLB Invalidate Entry, TLB Invalidate ALL):
9 Implement by passing on request to all processors.
10 * ppc-instructions (TLB Synchronize): Implement as empty, processor
11 tlb's are always in sync.
13 * cpu.c (cpu_page_tlb_invalidate_all): New function. Pass on TLB
14 invalidate request to processors VM sub-system.
15 * cpu.c (cpu_page_tlb_invalidate_entry): Ditto.
17 * vm.c (vm_page_tlb_invalidate_all): New function. Mark all page
18 TLB entries as invalid.
19 * vm.c (vm_page_tlb_invalidate_entry): New function. Ditt but only
20 invalidate one TLB entry.
22 * psim.c (psim_init): Invalidate TLB's before (re)starting.
26 * emul_generic.c (emul_add_tree_options): Add argument
27 oea_interrupt_prefix (0 or 1) that specifies the prefix MSR[IP]
28 and hence the location of the interrupt vectors. Add this to the
31 * emul_chirp.c (emul_chirp_create): Allow configuration of
32 floating-point and interrupt prefix (default 0) using the above.
34 * emul_netbsd.c (emul_netbsd_create): Pass dummy arg for
37 * emul_bugapi.c (emul_bugapi_create): Allow configuration of
38 interrupt prefix (default 1) and configure interrupt table traps
41 * emul_generic.c (emul_add_tree_hardware): Include a small eeprom
42 in the list of devices.
44 * device_table.c: For moment fake eeprom device by a memory
45 device. In future will need a proper eeprom device.
49 * config.in: Regenerated.
53 * psim.c: Include options.h so print_options is declared.
57 * emul_netbsd.c (toplevel): Do not include sys/resource.h if the
58 system doesn't have it, and turn off getrusage processing.
59 (write_rusage): #ifdef out if we don't have getrusage.
60 (do_getrusage): Define as 0 if we don't have getrusage.
64 * configure.in (AC_HEADER_DIRENT): Add, so that we can figure out
65 where the directory functions are declared.
66 * configure: Regenerate
68 * emul_netbsd.c: Use the macros defined by configure to find the
69 appropriate directory functions.
73 * configure.in (xor_endian): Trace setting of xor-endian flag.
77 * psim.c (psim_usage): Extend documentation.
79 * ppc-instructions (model-print): fix typo.
83 * configure.in (with-smp): Default configuration allow up to
84 five processors (but enable only one).
86 * emul_bugapi.c (emul_bugapi_create): If floating-point is
87 allowed, enable the floating point instruction set in the
92 * emul_chirp.c (chirp_emul_seek, chirp_emul_read,
93 chirp_emul_write): Tolerate invalid ihandles.
95 * device.c (device_instance_create, device_instance_delete):
96 init/delete instance name
98 * emul_chirp.c (emul_chirp_instruction_call): Read the nr args and
99 returns when determining the service.
101 * emul_chirp.c (chirp_read_t2h_args): Allow variable number of
102 args for the method "call-method".
104 * emul_chirp.c (chirp_emul_getprop): Tolerate a n_returns of zero
105 - should be one. Some OpenBoot code doesn't pass correct arg.
107 * emul_chirp.c (chirp_emul_getprop): Trace more property types.
111 * RUN: New file. Describe how to run PSIM
112 * INSTALL: New file. Describe how to install PSIM
113 * README: New file. Overview PSIM.
114 * BUGS: New file. Briefly discuss bugs and limitations
118 * emul_bugapi.c (OEA_START_ADDRESS): Put it back to 0x100000,
119 wasn't correctly using GLD.
123 * emul_generic.c (emul_add_tree_options): Make default number of
124 active processors 1 (even when SMP enabled).
128 * device_table.c (icu_io_read_buffer_callback): Add extra register
129 (at addr + 4) that returns number of processors.
131 * emul_generic.c (emul_add_tree_hardware): Update device node to
136 * emul_bugapi.c (OEA_START_ADDRESS): Change to 0x4000 so that it
137 matches gas-960116/ld.
141 * psim-960119 released - psim-1.0b01.
145 * psim.c (psim_create): Re-order so that all options are set
146 before the CPU's are created. Was breaking mon_create();
148 * psim.c (psim_create): Tidy up conflicting configuration errors.
150 * debug.c: Add missing print-info entry to trace table.
152 * os_emul.c (os_emul_create): Fix `-e' option. Was looking under
155 * psim.c (psim_options): Fix `-r' option. Was entering under wrong
160 * vm.c (om_unpack_bats): Fix checking of bat bits.
162 * emul_chirp.c (emul_chirp_create): Store address of OB in memory
163 in the os_emul_data structure.
165 * emul_bugapi.c (emul_bugapi_create): Store the address of the
166 bugapi code (in main memory) in the os_emul_data structure.
170 * vm.c (om_translate_effective_to_real): Fix trace output.
174 * device_table.c (generic_device_init_address): Create memory from
175 information obtained from `reg' property.
176 * device_table.c (vm_init_address_callback): Use information
177 obtained from properties.
178 * emul_netbsd.c (emul_netbsd_create): Update to create device and
179 property entries to match
183 * idecode_expression.h (ALU_END): Add ITRACE of the result.
185 * ppc-instructions (Equivalent): Enable this instruction.
186 (Add to Minus One Extended): Ditto.
187 (Subtract from Minus One Extended): Ditto.
188 (Add/And/Or/Xor Immediate): Add alu trace of result.
189 (Add/And/Or/Xor Shifted Immediate): Ditto.
190 (And/Or/Equivalent/Nand/Nor): Ditto.
191 (And/Or with Complement): Ditto.
192 (Extend Sign Byte/Half Word): Ditto.
193 (Count Leading Zeros): Ditto.
194 (Shift Right Algerbraic Word): Ditto.
195 (Shift Right Algerbraic Word Immediate): Ditto.
199 * emul_bugapi.c (emul_bugapi_instruction_call) : Make format type
201 * emul_chirp.c (map_over_chirp_note) : Ditto
202 * emul_chirp.c (chirp_emul_test) : Ditto
203 * device_table.c (register_init): Ditto
207 * configure.in: Make disable-sim-switch default. Switch only
208 useful if using --enable-sim-opcode=ppc-opcode-stupid and then
213 * device_table.c (register_init): Make format type correct.
217 * emul_bugapi.c (emul_bugapi_create): Add nodes to init the
218 system-call trap to the emul instruction call instruction (Along
219 with an rfi and infinate loop).
221 * emul_bugapi.c (emul_bugapi_instruction_call): Expand to include
222 a few real PPC bug calls. Test with simple hello world.
226 * device.h, device.c (device_child, device_sibling): New
227 functions. Return corresponding device value.
229 * emul_chirp.c (chirp_emul_child, chirp_emul_peer,
230 chirp_emul_parent): New functions - emulate corresponding OpenBoot
233 * device_table.c (register_init): Extend properties attached to
234 register init node to allow a specific processor's register to be
237 * emul_chirp.c (emul_chirp_create): Init SMP correctly - the
238 initial PC for all processors is an infinate loop but then, for
239 processor zero, is quickly changed to be the correct code starting
242 * emul_chirp.c (emul_chirp_create): Add fake bootpath
243 et.al. properties to tree.
245 * emul_chirp.c (chirp_emul_getproplen): New function. Emulate the
246 getproplen OpenBoot call.
248 * emul_chirp.c (emul_chirp_instruction_call): Document other
249 possible chirp emulation internal states.
251 * emul_chirp.c (emul_chirp_instruction_call): Trace failed lookups
252 as well as successful ones.
254 * emul_chirp.c (emul_chirp_open): New function - handle open
257 * Makefile.in (maintainer-clean): Proper rule that eliminates more
262 * emul_chirp.c (chirp_emul_exit): Full out call.
264 * device_table.c (htab_map_page): Wasn't handling byte swap when
265 creating entries in the hash table.
267 * device.c (device_tree_find_node): Allow primative wild-card match
268 of device names with the path.
270 FIXME: As mentioned earlier, the device stuff needs work to bring
271 it into line with OpenBoot. Part of this work is rewriting the
272 find_node function so that it behaves as specified in p1275.
276 * emul_chrp.c (chirp_emul_write, chirp_emul_finddevice): add
279 * emul_chrp.c: Change return type of emul functions to int. Emul
280 functions either return -1 or zero so unsigned was a bit
283 * inline.h (*), igen.c, dgen.c, *: Update INLINE macros so that
284 they are paramaterised with the type of the function. Gets around
285 the problem of `static' needing to come first with `attribute'
286 comming last. Format declarations and definitions so that emacs
287 doesn't get confused.
291 * std-config.h (PSIM_INLINE): Add missing inline configuration
292 control for the main loop.
294 * mon.c (mon_print_info): If monitoring disabled still print out
295 the number seconds used.
297 * psim.c (run_until_stop): Don't monitor the cache misses when
298 monitoring is disabled.
300 * configure.in (sim_mon, sim_monitor): Correct typo - sim_mon ->
301 sim_monitor for shell variable (or should that have been the other
304 * vm.c (vm_synchronize_context): Fix wrong test for unsuported
305 change in endian-mode.
307 * std-config.h (WITH_REGPARM), inline.h (IDECODE_INLINE,
308 SEMANTICS_INLINE): Add -DWITH_REGPARM=<n> option. Enables the
309 __attribute__((__regparm(WITH_REGPARM))) for some functions.
310 configure with --enable-sim-cflags="-DWITH_REGPARAM=3" (say).
311 Unfortunatly it tickles a bug (gcc?) and can't be used.
315 * device.c (device_tree_add_device): Make trace fprintf arguments
317 * device_table.c (htab_decode_hash_table): Ditto.
318 (htab_map_binary): Ditto.
319 (htab_init_callback): Ditto.
320 * vm.c (om_virtual_to_real): Ditto.
324 * emul_netbsd.c (emul_netbsd_create): Deal with new BFD that
325 changed how big/little endian support is recorded, while remaining
326 compatible with the old BFD with #ifdefs.
327 * emul_chirp.c (emul_chirp_create): Ditto.
328 * emul_bugapi.c (emul_bugapi_create): Ditto.
332 * std-config.h (MODEL_INLINE): Turn off INLINE_MODULE by default.
334 * corefile.h: Delete declarations for unknown functions.
336 * interrupts.h: Ditto.
337 * interrupts.c: Ditto.
341 * lf.c (lf_print_function_type): New function. Munges a function
342 type so that the prefix (eg INLINE...) is inserted after the type
345 * igen.c: Change to output functions using this.
349 FIXME: Emul CHIRP does not correctly implement the find device
352 FIXME: Emul CHIRP and device do not implement device instance
357 * options.c (options_inline): Function to output meaningful
358 description of the INLINE options.
360 * configure.in (inline): Replace inline magic numbers with macro
361 names. Map 1->LOCALS_INLINE and 2->ALL_INLINE.
363 * inline.h, inline.c: update to use inline method.
365 * std-config.h (CPU_INLINE), cpu.h, inline.h, inline.c: make cpu.h
368 * std-config.h (EVENTS_INLINE): Inline events in psim.
372 * device_table.c (htab_sum_binary): DMA binaries to correct byte
377 * psim.c (psim_merge_device_file): Change `=' to `==', was this an
382 * ppc-instructions (ppc_nr_mtcrf_crs, ppc_branch_conditional_name,
383 ppc_function_unit_name): Simplify by declaring these arrays as
384 pure and simple static (instead of STATIC_MODEL).
388 * sim_calls.c (sim_create, sim_load), main.c (main), psim.c: Pass
389 an options device into psim_create() so that options can be merged
392 * device.c (*add*): Change semantics so the add functions only add
393 when the new device (or property) doesn't already exist. This
394 allows merging of options and data.
398 * Makefile.in (BASICS_H): Didn't include basics.h in the list of
399 header files to depend on.
403 * std-config.h: (*_MODULE): Extend the <module>_inline macro's so
404 that they also allow control over static functions. Rewrite
405 document to reflect this.
407 * std-config.h: (INLINE): Simplify definition, the above and
408 earlier changes to igen.h eliminate the need to be defensive about
409 enabling the inline of static functions.
411 * std-config.h: (SIM_ENDIAN_INLINE, BITS_INLINE): Document limited
412 suport for inlineing of modules for all callers. Adjust relevant
413 macro's so that DEFAULT_INLINE will enable this.
415 * basics.h: Re-order #includes and definitions so that c-code for
416 basic include files does not call functions delcared in later
419 * basics.h (__attribute__), sim_callbacks.h: Move attribute macro
420 to basics.h and add hack (include <stdio.h>) to try and bring that
421 and other possible conflicting macros into scope much earler.
423 * sim-endian.h,c (SIM_ENDIAN_INLINE) bits.h,c (BITS_INLINE):
424 Change to use the updated inline definitions. If enabled
425 immediatly include the corresponding c-code so that it will inline
428 * inline.h, inline.c (SIM_ENDIAN_INLINE, BITS_INLINE): Remove
429 these cases, moved to module specific header files.
433 * vm.c, vm_n.c: Fix htab code.
435 * vm.c (vm_data_map_read_buffer): Was using EA not RA when reading
438 * device.c: Fix htab create code.
442 * bits.h, bits.c (EXTRACTED): Convert to function, fix - had &&
445 * sim-endian.h (SWAP_N), sim-endian-n.h, sim-endian.c: How
446 embarasing - fix yet another bug in the swap code! Simplify
447 everything by using more functions. Add host to big-endian byte
452 * devices.h, devices.c: delete, replaced by the files
453 device_table.[ch] and device.[ch].
454 * device_tree.h, device_tree.c: ditto
456 * device_table.h, device_table.c: New files. Contain a table of
459 * device.h, device.c, Makefile.in, std-config.h (DEVICE_INLINE),
460 options.c (print_options): New files. Define the device object
461 along with any attached properties.
463 * device_tree.h, device_tree.c: Update to use new device object.
464 For convenience, change the printd functions into device_tree_add
467 * psim.c (create_*_tree): Use new device_tree create functions.
469 * corefile.h, corefile.c corefile-n.h (core_n.h): Update to use
470 the new device.h / device_table.h interface. Rename core_n.h to
471 corefile-n.h to be consistent with other n files.
473 * Makefile.in (run): add corefile-n.h to dependencies for
476 * basics.h (device_instance), device.h, device.c, device_table.h,
477 device_table.c: Add the concept of a device instance and operators
478 on these instances - corresponds to ihandle in OpenBoot speak.
479 Don't yet implement it.
483 * emul_generic.h, emul_generic.c (emul_syscall_enter,
484 emul_syscall_exit): rename from emul_enter_call /
485 emul_exit_call. As only used by emul_do_system_call simplify
488 * os_emul.h, os_emul.c, emul_generic.h: Correct and fill an
491 * os_emul.c, emul_bugapi.h, emul_bugapi.c, Makefile.in: Add
492 preliminary hooks for a kernel mode rom emulation.
494 * cap.h (new), cap.c (new): Capability data base. Some emulations
495 pass object identifiers (capabilities?) to/from the simulated code
496 (for instance the phandle in OpenBoot). The cap object is able to
497 check/map between internal and external (target program)
498 representations of each identifier.
500 * os_emul.c, emul_chirp.h, emul_chirp.c, Makefile.in: Add
501 preliminary hooks for a kernel mode IEEE-1275 emulation.
503 * cpu.h, cpu.c (cpu_create, cpu_os_emulation, cpu): Add os_emul to
504 list of arguments passed in when creating a cpu. Grant access to
507 * std-config.h (OS_EMUL_INLINE), options.c (print_options),
508 inline.h, inline.c: New to allow control over inline of
509 corresponding code files.
511 * ppc-instructions (instruction_call): Add illegal instruction to
512 call the instruction-call emulation handler.
514 * interrupts.c (system_call_interrupt): Call renamed
515 os_emul_system_call function().
517 * emul_netbsd.c: Update to interface to generic emulation. Since
518 all its functions are called via a table don't worry about any
521 * emul_generic.h, emul_generic.c, spa-*(delete): Remove references
522 and code for spa, no longer to be used.
524 * psim.c (create_chirp_device_tree): Fill out what was previously
525 the openboot create function so that it starts to create a full
526 OpenBoot device tree.
530 * debug.h, debug.c: pte trace is made redundant by htab trace,
531 delete it. Add vm to list of options. Simplify tracing output so
532 lines are not as long.
536 * events.h, events.c (event_queue_init), psim.c (psim_init): (re)
537 initialize the event queue.
546 * sim-endian.h: Look at WORDS_BIGENDIAN to determine if the host
547 is big endian or little endian. For SWAP_n, use htonl/htons if
548 host is little endian, not big endian and if WITH_NTOH is defined.
550 * configure{,.in} (--enable-sim-model-issue): Instead of defining
551 0/1, define it to be MODEL_ISSUE_{PROCESS,IGNORE}. Add
552 AC_C_BIGENDIAN to determine if the host is big endian or not.
553 * config.in: Regenerate.
555 * std-config.h (WITH_MODEL_ISSUE): Default to 0.
556 (CURRENT_MODEL_ISSUE): Reference WITH_MODEL_ISSUE, and if that is
557 0, use current_model_issue.
558 (MODEL_ISSUE_{PROCESS,IGNORE}): Define as -1/1.
560 * psim.c (current_model_issue): New global variable.
562 * cpu.c (cpu_create): Use CURRENT_MODEL_ISSUE > 0 instead of
564 (cpu_{init,halt}): Ditto.
565 * mon.c (mon_print_info): Ditto.
566 * ppc-instructions (PPC_INSN_* macros, branch handling): Ditto.
568 * mon.c (mon_print_info): Print instructions/second if verbose > 0,
571 * main.c (main): Set current_model_issue to MODEL_ISSUE_PROCESS if
572 the -I switch is used.
573 * sim_calls (sim_open): Ditto.
575 * ppc-instructions (model support): Add support for determining
576 when we don't have enough writeback slots. Add tracing for the
577 beginning of each cycle.
581 * mon.c: Check for whether to include sys/types.h and sys/time.h.
583 * configure.in: Check for include files sys/types.h and
585 * configure: Regenerate.
586 * config.in: Regenerate.
588 * cpu.h (CONST_ATTRIBUTE): Define as __attribute__((__const__)) if
590 (cpu_system): Use CONST_ATTRIBUTE, so that when we're not inlining
591 the world, the optimizer has a fair chance of CSE'ing function
593 (cpu_{monitor,nr,registers,model}): Ditto.
595 * std-config.h (MODEL_INLINE): If not defined, define as 1 if
596 DEFAULT_INLINE is non-zero, 0 otherwise, rather than just the
597 value of DEFAULT_INLINE.
601 * lf.h (__attribute__): If not GCC and at least 2.7.0, define as
603 (lf_printf): Add printf __attribute__, so the compiler will
604 automatically check the format string.
606 * configure{,.in} (--enable-sim-icache): If argument is define,
607 add -R to flags passed to igen.
609 * igen.c (stdlib.h): Include if the system supplies one.
610 (semantics_use_cache_struct): New global for -R flag to say
611 semantics is to use the cache structure directly rather than
612 putting the values into local variables.
613 (first_undef, last_undef): New structures to remember names to
615 (lf_print_c_extraction): If -R and this is semantics, emit names
616 as #defines pointing to the cache structure, rather than loading
617 the values into local variables.
618 (lf_print_c_semantic_function): If -R, #undef all of the names
619 defined in lf_print_c_extraction.
620 (main): Recognize -R.
622 * idecode_fields.h (SPR_*): Redefine spr_* macros as SPR_* to
623 avoid a name confict if -R passed to igen.
625 * ppc-instructions (mfspr, mtspr): Rename spr field to SPR.
626 (model_data): Add field to count the various # of CRs that the
627 mtcrf instruction used.
628 (model_mon_info): Return structures counting the # of CRs that the
629 mtcrf instruction used.
630 (branches, sync instructions): Do not call model functions if
631 WITH_MODEL_ISSUE is 0.
633 * mon.c (stdlib.h): Include if the system supplies one.
634 (mon_sort_instruction_names): New function to sort instruction
635 names alphabetically.
636 (mon_print_info): Call qsort with mon_sort_instruction_names to
637 sort instruction names. Don't abort if WITH_MODEL_ISSUE is 0.
639 * debug.h (ITRACE): Make printf_filtered arguments type correct.
640 * idecode_expression.h (CR0_COMPARE): Ditto.
641 * psim.c (psim_read_register): Ditto.
643 * igen.c (lf_print_my_prefix): Use __attribute__((__unused__)) to
644 silence compiler warnings about unused automatically generated
646 (lf_print_c_extraction): Ditto.
647 * idecode_expression.h (FPSCR_BEGIN): Ditto.
649 * ppc-cache-rules: Define rules for making a bitmask for all
652 * ppc-instructions: Rewrite model specific functions to use the
653 bitmask of the register number, instead of using the register
654 pointer to get the register number, and then making the bitmask.
658 * ppc-instructions (model_branches): Add conditional argument to
659 count the number of times each type of conditional branch is used.
660 (conditional branches): Pass B0 or -1 to model_branches.
661 (model_mon_info): Print out conditional branch counts.
662 (model-data): Add support for printing out conditional branch
667 * igen.c (insn_table_load_insns): Add support for model-static for
668 internal functions that should not be inlined.
669 (lf_print_c_semantic): Remove model_cleanup.
670 (gen_model_{c,h}): Ditto.
672 * ppc-instructions: Redo model specific support once again. Add
673 floating point support to the model specific information. Flesh
674 out all of the floating mutiply add/subtract instructions. Add
675 better tracing support to the model specific information.
679 * ppc-instructions (model data, model_busy): Rather than using a
680 bit mask for the busy units, just use a char array. Also, only
681 support 2 function units an insn can use, rather than a loop.
685 * table.c (table_entry_read): Move setting entry->line_nr to after
686 the model specific fields so the line numbers for the annex are
689 * cpu.c (cpu_{create,init,halt}): Check for WITH_MODEL_ISSUE
690 before calling the model functions.
692 * debug.c (trace_descriptor): Add trace_model support.
693 * debug.h (trace_options): Ditto.
695 * igen.c (gen_icache_h): Create type idecode_cache as void if not
696 caching instructions.
697 (gen_model_{c,h}): Drop model_issue support. Add support for
699 (lf_print_my_prefix): Initialize a const itable_index with the
701 (lf_print_c_semantic): Call model_cleanup at the end of the
702 function to check for instructions that aren't supported yet by
705 * mon.h (count_type): New type for counters.
706 * mon.c: Use count_type instead of unsigned.
708 * ppc-instructions: Redo scheduling code once again. Make it all
709 inline friendly. Instead of having general code emitted by igen,
710 go the route of having each semantic routine call the appropriate
715 * table.c (table_entry_read): Allow the annex to have blank lines.
717 * ppc-instructions: Change lines in model stuff that just have a
718 tab to just newline. Add 601 support. Document most instructions
719 in terms of model specific timing information. Drop 'FUNCTION'
720 from PPC_FUNCTION_UNIT_xxx enums. Change PPC_UNIT_UNKNOWN ->
721 PPC_UNIT_BAD. Add TRACE(trace_tbd) for all data cache
722 instruction.s. Signal illegal instruciton if data cache block
723 invalidate is issued from problem state.
725 * igen.c (max_model_fields_len): New static to keep track of the
726 max size for the model specific fields.
727 (model_c_insn): Use max_model_fields_len to size fields.
728 (insn_table_insert_insn): Set max_model_fields_len.
729 (model_table_insert): Ditto.
730 (gen_model_{c,h}): Model_issue is now called with a processor
733 * debug.c (trace_description): Add support for trace_tbd.
735 * mon.c (mon_issue): Pass processor argument to model_issue.
737 * Makefile.in: Delete all function unit support, since the newer
738 table driven model support replaces it.
741 * inline.{c,h}: Ditto.
742 * std-config.h: Ditto.
744 * configure{,.in}: Ditto.
745 * Makefile.in: Ditto.
747 * function_unit.{c,h}: Delete these now usused files.
749 * std-config.h (WITH_MODEL_ISSUE): Add new macro on whether to
750 trace instructions in a model specific manor.
751 * options.c (print_options): Print it out.
752 * configure{,.in}: Add --enable-sim-model-issue option.
753 * Makefile.in: Add --enable-sim-model-issue flags.
754 * igen.c (lf_print_c_semantic): Add call to mon_issue here. Check
755 for WITH_MODEL_ISSUE.
756 * mon.c (mon_issue): Remove call to mon_issue_here.
758 * ppc-instructions: Move branch tracing to the actual branch
759 instructions, rather than testing it in model_issue. Add code to
760 code successful/unsuccessful branch predictions, and the number of
761 conditional branches that fell through.
765 * cpu.h (cpu_model): Add declaration.
767 * cpu.c (struct _cpu): Add model_ptr to hold model specific
769 (cpu_model): Return the model internal pointer.
770 (cpu_{create,init,halt}): Call the appropriate model function.
772 * inline.c (mon.c): Move include of mon.c after model.c.
774 * mon.c (_cpu_mon): Add fields to count unaligned memory
776 (mon_issue): Call model_issue, not function_unit_issue.
777 (mon_{read,write}): Count # of unaligned memory accesses.
778 (mon_print_info): Switch to calling model_mon_info and
779 model_mon_info_free instead of function_unit version. Print out
780 number of unaligned reads/writes.
782 * {ppc-instructions,igen.c}: More global changes to add model
785 * inline.{c,h}: Provide for inlining options.c.
786 * options.{c,h}: Ditto.
787 * std-config.h: Add OPTIONS_INLINE.
791 * Makefile.in (devices.o, main.o): Update dependency.
793 * igen.c (gen_model_h): Use correct variable in loop.
794 (gen_model_c): Use strcmp, strcasecmp.
795 (gen_model_c): Use EXTERN_MODEL for arrays.
796 (gen_model_h): Use STATIC_MODEL for arrays.
797 (lf_print_c_semantic_function_header): Delete unused function.
799 * main.c (cpu.h): Include cpu.h to get model.h.
801 * inline.h ({EXTERN,STATIC}_MODEL): Define.
805 * igen.c ({insn,model}_table_fields): Spell mnemonic correctly.
806 (gen_itable_h,itable_c_insn): Ditto.
807 (model support): Move model support around, add support for
808 model-data, model-internal. Use annex field for model-macros
811 * configure.in (--enable-sim-inline): If --enable-sim-inline=no,
812 also define INLINE as nothing.
813 * configure: Regenerate.
815 * std-config.h (INLINE): Rather than nuking INLINE, only define it
816 as __inline__ if any of the INLINE flags are non-zero.
818 * options.c (print_options): Print out WITH_XOR_ENDAIN.
820 Mon Nov 13 23:03:45 1995 Andrew Cagney <cagneyhighland.com.au>
822 * ppc-instructions (rfi): Add missing code.
824 * cpu.c (cpu_get_time_base): Fix calculation of current value of
827 * ppc-spr-table (TBL, TBU): Fix TBL/TBU entries - was confusing
828 m[tf]tb with m[tf]spr.
830 * ppc-instructions (mtspr, mfspr): Fix mttbl - wasn't storing
833 Mon Nov 13 21:35:37 1995 Andrew Cagney <cagneyhighland.com.au>
835 * std-config.h (INLINE, STATIC_INLINE): Was being set to static
836 inline.. Only problem being that with ppc-opcode-simple this gave
837 it the chance to inline all the idecode functions with potentially
838 disasterous results on a 16mb PC. For moment hobble INLINE.
840 * configure.in, std-config.h (WITH_SMP): Make that 5 processors by
843 * configure.in: Tweek flags passed to gcc for --with-sim-warnings.
844 Firstly make them errors and secondly remove the options gcc-245
849 * misc.c (zalloc), cpu.c (cpu_init), devices
850 (console_io_read_buffer_callback, icu_io_read_buffer_callback,
851 vm_io_read_buffer_callback), main.c (zalloc), mon.c (memset),
852 sim_calls.c (zalloc) : replace bzero() with memset().
854 * emul_netbsd.c (write_direntries), psim.c (psim_read_register,
855 psim_write_register): replace bcopy() with memcpy().
857 Sun Nov 12 20:55:41 1995 Andrew Cagney <cagneyhighland.com.au>
859 * configure.in: for --disable-sim-inline (--enable-sim-inline=no),
860 force DEFAULT_INLINE to 0 rather then trusting the std
863 Sun Nov 12 20:55:41 1995 Andrew Cagney <cagneyhighland.com.au>
865 * igen.c (lf_print_idecode_table, idecode_table_leaf): Fix
866 generation of switch entries in tables - treat the same as
867 cracking/semantic functions.
869 * igen.c (idecode_switch_end, idecode_switch_leaf): Fix generation
870 of a boolean switch statement (field zero or non-zero).
872 * ppc-opcode-test-1, ppc-opcode-test-2: New files. These test the
873 switch/table generation ability of igen.
875 * igen.c (idecode_switch_leaf): Fix code output when a switch
876 statement needs to look up a table.
878 * igen.c (idecode_declare_if_switch): New function called from
879 gen_idecode_c - need to declare any idecode switch functions
880 before they are used in idecode tables.
882 * igen.c (lf_print_c_cracker_function, idecode_crack_leaf,
883 idecode_crack_insn): Add is_inline_function argument to code
884 printing cracker functions which indicates if STATIC_IDECODE or
885 STATIC_INLINE_IDECODE should be used for definition. For
886 idecode_crack_insn (which implies not duplicating/expanding) don't
887 declare function as inline - we assume that the only time this is
888 code is generated is when things are being tested. For
889 idecode_crack_leaf, make static (instead of INLINE) if the
890 instructions parent is a table as function will always be called
893 * igen.c (idecode_expand_if_switch): Declare as STATIC_IDECODE not
894 STATIC_INLINE_IDECODE. Only the outermost idecode switch will be
895 called directly, all others are called via a table.
897 * igen.c (lf_print_semantic_function_header, semantics_h_leaf,
898 semantics_h_insn, semantics_h_function,
899 lf_print_c_semantic_function, semantics_c_function): Add
900 is_inline_function argument to lf_print_semantic_function_header
901 to indicate if an inline or static function declaration/definition
902 should be output. Depending on situtation call accordingly:
903 functions (not instruction semantic routines) are always inline;
904 Semantic routines are made inline when there is no icache (cache
905 will contain the function address) and are duplicating (see above)
906 and the parent of the instruction is a switch statement.
908 * igen.c (opcode_field_new): Delete. Code changed to use ZALLOC
909 and moved to insn_table_find_opcode_field.
911 * table.c (table_open): Fix typo (nr_model_fields vs nr_fields).
913 * igen.c (model_c_insn): Suggestion - document the name of the
914 instruction on each line of the instruction model table.
916 Fri Nov 10 00:44:38 1995 Andrew Cagney <cagneyhighland.com.au>
918 * emul_netbsd.c (do_ioctl): Cleanup compilation.
920 * sim_callbacks.h (__attribute__): Only define if not defined (was
921 already defined on NetBSD host).
923 Wed Nov 8 21:49:52 1995 Andrew Cagney <cagneyhighland.com.au>
925 * std-config.h (WITH_XOR_ENDIAN), configure.in, Makefile.in: New
926 macro, indicates if the PowerPC's horrible XOR endian mode should
927 be suported. Add to configure and make.
929 * vm_n.h (vm_data_map_read_N, vm_data_map_write_N), vm.c
930 (vm_instruction_map_read): If XOR endian, xor the address
931 with a value from an xor table (indexed by size of access).
933 * vm.c (vm_synchronize_context), cpu.c (cpu_synchronize_context):
934 set up xor table to xor if there is a conflict between the
935 CURRENT_TARGET_ENDIAN and the endian indicated in the MSR. Move
936 check of suported change of endian mode from cpu.c to vm.c.
938 * vm.c (vm_data_map_write_buffer, vm_data_map_read_buffer):
939 Hopefully added correct hack to handle XOR endian mode.
941 FIXME: If NONSTRICT alignment and XOR ENDIAN and MSR indicates
942 little endian mode, the model accepts miss aligned transfers.
944 FIXME: Need to create an `init' device that, during
945 initializatioin for XOR mode, it mushes (XOR address) all the dma
946 data before passing it on to the core for storage. Just like the
949 Wed Nov 8 21:49:52 1995 Andrew Cagney <cagneyhighland.com.au>
951 * devices.c (halt_io_write_buffer_callback): Use value written to
952 halt device to determine exit status. Thus allowing
953 success/failure of OEA tests.
955 Wed Nov 8 00:10:38 1995 Andrew Cagney <cagneyhighland.com.au>
957 * ppc-instructions (icbi): If icache present flush it.
959 Tue Nov 7 23:36:31 1995 Andrew Cagney <cagneyhighland.com.au>
961 * devices.c (htab_init_callback): Add code to create htab/pte.
963 * devices.c (dma_file, file_init_callback, htab_init_callback):
964 New function - Dma the named file into memory at the specified
967 * device_tree.h, device_tree.c (scand_*): New functions.
969 Tue Nov 7 23:36:31 1995 Andrew Cagney <cagneyhighland.com.au>
971 * filter_filename.c, Makefile.in: Change so that only dependant on
972 a very limited nr of files. Stops an unnecessary dependency.
976 * core.c (core_map_find_mapping): Use cpu_halt rather than error
977 to abort an access to an undefined address.
981 * igen.c (model_table_insert_{macro,function}): New functions.
982 (insn_table_load_insns): Call them.
983 (gen_model_h): Move section emiting model-macros to be first.
984 (model_{c,h}_function): New functions cloned from semantic
985 functions to print out the prototype and function for
987 (gen_model_{c,h}): Print out model-functions.
989 * ppc-instructions (model_{start,halt,print_info}): Add dummy
992 * options.c (print_options): Print out WITH_{,DEFAULT_}MODEL, not
993 WITH_PPC_{,DEFAULT_}_MODEL.
994 (options_ppc): Delete now unused function.
995 (cpu.h): Include cpu.h, not just basics.h.
997 * std-config.h (WITH_{,DEFAULT_}MODEL): Define.
999 * igen.c (model_macros, last_model_macro): New statics to keep
1000 track of macros to go in model.h.
1001 (insn_table_load_insns): Add model-macros to model_macros linked
1003 (model_table_fields): Add field for printable name.
1004 (gen_model_h): If there are model macros defined, print them out.
1005 Print out DEFAULT_MODEL as the first model if there any models
1006 specified, otherwise MODEL_NONE. Print out external decl for
1007 current_model. Print out decl for model_set.
1008 (gen_model_c): Add function model_set. Switch to use printable
1009 name for the model, not the internal identifier used.
1011 * psim.c (current_model): New global variable.
1013 * ppc-instructions: Add macros for flag defines. Switch first
1014 model so 604 is first.
1016 * main.c (main): Call model_set, not function_unit_model.
1017 * sim_calls.c (sim_open): Ditto.
1018 * sim_calls.c, Makefile.in: sim_calls.c now includes cpu.h.
1022 * mon.h (mon_events): New enumeration for other events we want to
1024 (mon_event): Add declaration for function.
1026 * mon.c (mon_event): New function.
1027 (mon_print_info): Print icache misses.
1029 * psim.c (run_until_stop): Monitor icache misses.
1031 * configure.in (--enable-sim-inline): Fix typos in handling comma
1032 separated inline options.
1033 (--enable-sim-icache): Echo icache size.
1034 * configure: Regenerate.
1036 * igen.c (semantics_h_print_function): Emit STATIC_SEMANTICS
1037 instead of INLINE_SEMANTICS so that the compiler won't keep all of
1038 the semantic functions as inline RTL, given that the address of
1039 the function is taken which forces outline calls anyway.
1040 (lf_print_c_semantic_function_header): Ditto.
1041 (gen_semantics_h): Define STATIC_SEMANTICS as nothing if not
1043 (lf_print_c_cracker_function): Emit STATIC_IDECODE instead of
1044 STATIC_INLINE_IDECODE.
1045 (gen_idecode_c): Define STATIC_IDECODE if not defined.
1046 (gen_model_h): Use #ifdefs to define types to hold model units,
1048 (model_table_insert): Add a sentinel functional unit at the end to
1049 simplify loop processing.
1050 (model_c_insn): Use <function-unit>_SENTINAL instead of 0 for any
1051 instruction not specifing a function unit for the current model.
1052 (gen_model_{c,h}): Provide bounds for model_time_mapping.
1054 * inline.h (STATIC_SEMANTICS): Define to be static if
1055 SEMANTICS_INLINE is defined.
1056 (STATIC_IDECODE): Define to be static if IDECODE_INLINE is
1059 * options.c (print_options): Fix typo.
1063 * configure.in (--enable-sim-{opcode,config}): Use $srcdir when
1064 check for the existence of files.
1065 * configure: Regenerate.
1067 * table.c (table): New field nr_model_fields.
1068 (table_open): New parameter nr_model_fields.
1069 (table_entry_read): Parse model fields that begin with a '*' after
1071 * igen.c, dgen.c: Change callers of table_open.
1073 * igen.c: Add support for dumping model specific information in
1074 model.h and model.c.
1075 (insn_field_name): Delete unused array.
1076 (global variables): Make global variables static, so we can tell
1077 when they are no longer used.
1078 (cache_semantic_actual): Delete unused variable.
1079 (insn_table_load_insns): If the insn is really a machine model,
1080 call model_table_insert instead of other processing.
1081 (model_table_insert): New function to handle defining the
1082 functional units of a particular machine model.
1083 (insn_table): Add last_function field so we can add functions at
1085 (insn_table_insert_function): Use last_function field when
1086 appending new function.
1088 * ppc-instructions: Add a few model specific information for 603,
1089 603e, and 604 for testing purposes.
1091 * table.h (table_model_entry): New linked list to hold model
1092 specific information, one per line.
1093 (table_entry): Add model_first, model_last fields.
1095 * configure.in (--enable-sim-inline): If gcc is found and
1096 --enable-sim-inline is not specified, defaine DEFAULT_INLINE to 1,
1098 (--enable-sim-reserved-bits): New switch to check whether reserved
1099 bits are set in the instruction.
1100 (--enable-sim-opcode): Make complex the default.
1101 (all switches): Add appropriate checks and error messages.
1102 * configure: Regenerate.
1104 * Makefile.in (RESERVED_CFLAGS): New variable set by
1105 --enable-sim-reserved-bits.
1106 (CONFIG_CFLAGS): Include RESERVED_CFLAGS.
1107 (BUILT_SRC): igen now generates model.c and model.h.
1108 (LIB_OBJ): Include table.o.
1109 (tmp-igen): Add -m/-M options to write model.c/model.h.
1110 (model.o): New object.
1111 (CPU_H): Include model.h.
1113 * cpu.h: Include model.h.
1115 * std-config.h (WITH_RESERVED_BITS): Define.
1116 (MODEL_INLINE): Ditto.
1118 * options.c (print_options): Print out WITH_RESERVED_BITS.
1122 * configure.in: If --silent, don't output information messages.
1123 * configure: Regenerate.
1125 * configure.in (--enable-sim-alignment): Fix typo in specifing non
1127 (--enable-sim-switch): Make default on.
1128 (--enable-sim-duplicate): Make default on.
1129 (--enable-sim-smp): Make default 0.
1130 (--enable-sim-mon): Don't set sim_float if not set.
1131 (--enable-sim-inline): If gcc is found and --enable-sim-inline is
1132 not specified, define DEFAULT_INLINE to be 2.
1133 (all --enable-sim-* rules): Echo rules set to non empty to file
1135 * configure: Regenerate.
1137 * options.c (options_env): Fix typo if WITH_ENV is 0.
1138 (print_options): Print GCC compiler version if available and
1139 date/time options was compiled. If OPCODE_RULES, IGEN_FLAGS,
1140 and/or DGEN_FLAGS are defined, print them.
1142 * Makefile.in (all link actions): Pass SIM_CFLAGS as well as
1144 (options.o): Compile options.o with OPCODE_RULES, IGEN_FLAGS, and
1145 DGEN_FLAGS defined, so they can be printed out.
1147 * igen.c (lf_print_c_validate): Check for WITH_ASSERT, so that
1148 this test can be compiled away if the user really wants a fast
1149 simulator by not doing assertion failures.
1153 * options.c: New file to print out all of the WITH_ options.
1154 * options.h: New include file to declare print_options.
1155 * debug.h (trace_options): Add trace_opts to call print_options.
1156 * debug.c (trace_description): Add trace_opts support.
1157 * main.c (main): If user requested options, print them.
1158 * sim_calls.c (sim_open): Ditto.
1160 * igen.c (opcode_field_new): Add void to make it a proper prototype.
1162 * emul_generic.c (emul_enter_call): Make printf_filtered arguments
1164 * emul_netbsd.c (do_kill): Ditto.
1165 * registers.c (registers_dump): Ditto.
1166 * vm.c (om_translate_effective_to_real): Ditto.
1167 * vm_n.h (vm_data_map_read_N): Ditto.
1168 (vm_data_map_write_N): Ditto.
1169 * devices.h (DTRACE_INIT): Ditto.
1170 (DTRACE_{ATTACH,DETACH}_ADDRESS): Ditto.
1171 (DTRACE_IO_{READ,WRITE}_BUFFER): Ditto.
1172 (DTRACE_DMA_{READ,WRITE}_BUFFER): Ditto.
1173 * devices.c (update_for_binary_section): Ditto.
1174 (write_stack_arguments): Ditto.
1175 (stack_ioctl_callback): Ditto.
1176 * device_tree.c (device_tree_add_passthrough): Ditto.
1177 (device_tree_{add,find}_device): Ditto.
1178 (device_tree_{add,find}_integer): Ditto.
1179 (device_tree_find_{string,boolean}): Ditto.
1180 (device_tree_init{,_device}): Ditto.
1181 (device_tree_dump): Ditto.
1182 * sim_calls.c (sim_{read,write}): Ditto.
1183 (sim_{fetch,store}_register): Ditto.
1184 (sim_stop_reason): Ditto.
1186 * sim_callbacks.h (printf_filtered): Declare with attribute
1187 printf, so we can enable format checks.
1189 * devices.c (console_io_{read,write}_buffer_callback): Cast swtich
1190 argument to int, since ANSI doesn't allow long switch values.
1191 * emul_netbsd.c (do___sysctl): Ditto.
1193 * emul_netbsd.c (do___sysctl): Fix up printf call.
1195 * corefile.c (core_translate): Don't do arithmetic with void *
1196 pointers. Cast to char * first.
1198 * function_unit.c (FUNC_{LOAD,STORE}): Rename from {LOAD,STORE}
1199 and change all uses.
1201 * Makefile.in ({FUNC,MODEL,WARNING}_CFLAGS): New flags set by
1202 configure --enable switches.
1203 (CONFIG_CFLAGS): Include FUNC_CFLAGS and MODE_CFLAGS.
1204 (.c.o): Include WARNING_CFLAGS.
1205 (CPU_H): Include function_unit.h.
1206 (LIB_OBJ): Include function_unit.o.
1207 (BUILT_SRC_WO_CONFIG): Split from BUILT_SRC and do not include
1208 config.h or ppc-config.h.
1209 (BUILT_SRC): Include BUILT_SRC_WO_CONFIG, config.h and
1211 (filter_filename.o): Include config.h/ppc-config.h dependencies.
1212 (idecode.o, semantics.o, psim.o): Specify CC line without
1213 WARNING_CFLAGS so that we don't get all of the unused variable
1214 warnings that are generated.
1215 (function_unit.o): Add rule to build.
1216 (main.o, sim_calls.o): Add function_unit.h, itable.h dependencies.
1217 (mon.o): Include mon.c dependency.
1218 (TAGS): Depend on BUILT_SRC.
1219 (clean): Don't delete config.h or ppc-config.h
1221 * basics.h (sim_callbacks.h): Move include after the include of
1222 config.h and ppc-config.h.
1224 * bits.{h,c} (ROTL32,ROTL64): Move these functions to bits.c. Add
1225 support for BITS_INLINE to inline these. Add declarations to
1228 * configure.in (--enable-sim-warnings): Add new option to specify
1229 compiler warnings for all modules except idecode.o and semantics.o
1230 which have lots of unused variables because they are machine
1232 (--enable-sim-function-unit): New switch to configure whether
1233 function unit support is compiled in or not.
1234 (--enable-sim-{,default-}mode): New switches to control which cpu
1236 * configure: Regenerate.
1238 * corefile.c (core_attach_address_callback): Delete unused
1239 variable device_address.
1241 * cpu.c (struct _cpu): Add function unit pointer field func_unit.
1242 (cpu_create): If WITH_FUNCTION_UNIT, call function_unit_create.
1243 (cpu_init): If WITH_FUNCTION_UNIT, call function_unit_init.
1244 (cpu_halt): If WITH_FUNCTION_UNIT, call function_unit_halt.
1245 (cpu_function_unit): New function to return func_unit field.
1247 * cpu.h (function_unit.h): Include new include file.
1248 (cpu_function_unit): Declare.
1250 * debug.c (stdlib.h): Test HAVE_STDLIB_H, not HAVE_STDLIB.
1251 (config.h): Include config.h.
1253 * devices.c (icu_io_write_buffer_callback): Delete unused variable
1256 * emul_generic.c (emul_exit_call): Print out status value.
1258 * emul_netbsd.c (do_read): Delete unused variable nr_moved.
1260 * filter_filename.h (includes): Include config.h, ppc-config.h,
1263 * inline.c: Include bits.c if BITS_INLINE. Include
1264 function_unit.c if FUNCTION_UNIT_INLINE.
1266 * inline.h (INLINE_BITS): Define if BITS_INLINE.
1267 (INLINE_FUNCTION_UNIT): Define if FUNCTION_UNIT_INLINE.
1269 * interrupts.c (instruction_storage_interrupt): Delete unused
1272 * lf.h (config.h): Include config.h.
1274 * main.c (includes): Include function_unit.c. If HAVE_UNISTD_H,
1276 (usage): Update for -m model, -i, and -I options.
1277 (main): Delete unused variables stack_pointer and i. Add support
1278 for -i, -m model arguments. Call psim_print_info with verbose ==
1279 1 if -i, and verbose == 2 if -I.
1281 * mon.c (stdio.h): Include stdio.h to pick up sprintf prototype.
1282 (mon_issue): Call function_unit_issue if function units are
1284 (mon_print_info): Take psim * argument. Print out information
1285 from function_unit if available. Move read/write stats to always
1286 print, instead of printing if verbose > 1. Fix up plural
1289 * mon.h (mon_print_info): Update prototype.
1291 * psim.c (current_ppc_model): Add global variable.
1292 (psim_print_info): Pass system argument to mon_print_info.
1294 * sim_calls.c (function_unit.h): Include.
1295 (sim_open): Add support for -i and -m model options. If -i call
1296 psim_print_info with verbose == 1, if -I, with verbose == 2.
1297 (sim_resume): Delete unused variable program_counter.
1299 * std-config.h (WITH_FUNCTION_UNIT): Define.
1300 (ppc_model): Add enumeration giving all PowerPC models currently
1302 ({WITH,CURRENT}_PPC_MODEL): Define.
1303 (FUNCTION_UNIT_INLINE): Define.
1305 * table.c (config.h): Include config.h.
1307 * vm.c (om_virtual_to_real): Print pte_word_{0,1} so the compiler
1308 doesn't complain that they're unused.
1310 * vm_n.h (vm_data_map_read_N): Delete unused variable rval.
1314 * sim-endian.c (ppc-endian.c), sim-endian.h (ppc-endian.h):
1315 renameed. These files are target independant.
1316 * Makefile.in, basics.h: update for new name.
1318 * sim-endian.h (SWAP_N), sim-endian.c (_SWAP_1): Rename existing
1319 SWAP_<N> to _SWAP_<N> so that sim-endian.h can contain SWAP_N
1320 macro's as required.
1322 * sim-endian.c, sim-endian-n.h (new file): Move endian code into a
1323 debugable header file.
1325 * ppc-instructions (Byte-Reverse): Enable byte reverse
1326 instructions using SWAP_N macros.
1330 * Makefile.in (config.status): Remove references to config.make
1333 * config.{make,hdr}: Delete, no longer used.
1334 * build-psim: Ditto.
1338 * sim_calls.c (sim_open): Fix parsing of `target sim' options.
1340 * device_tree.c (device_tree_add_string): Wasn't saving the value
1341 of the string being entered into the tree.
1343 * psim.c (create_filed_device_tree): Not terminating string device
1346 * psim.c (psim_create): Use `env' instead of
1347 `environment-architecture' to be consistent with configure.
1348 Reconize user/uea, virtual/vea and operating/oea.
1352 * core.c: Rename to corefile.c
1353 * core.h: Rename to corefile.h
1354 * inline.c: Include corefile.h, renamed from core.h.
1355 * cpu.h: Include corefile.h, renamed from core.h
1356 * vm.c: Include corefile.h, renamed from core.h
1357 * corefile.c: Include corefile.h rather than core.h
1358 * README.psim (KNOWN PROBLEMS): Change core.* references to corefile.*
1360 * Makefile.in (CPU_H): Change core.h to corefile.h
1361 (vm.o): Change dependency to corefile.h
1362 (LIB_SRC): Change core.c to corefile.c.
1363 (LIB_OBJ): Change core.o to corefile.o.
1364 (corefile.o): Change dependencies to corefile.c, corefile.h.
1368 * ppc-instructions (data cache instructions): Make all data cache
1369 instructions nops instead of invalid instructions.
1371 * Makefile.in (CONFIG_CFLAGS): Add ALIGNMENT_CFLAGS and
1372 TIMEBASE_CFLAGS which weren't included.
1376 * Makefile.in: Uncomment built file dependencies.
1378 * configure.in: Rewrite --enable-sim switch handling to use the
1379 autoconf builtins so it works correctly if the configure or
1380 Makefile.in files are modified and make decides to rebuild
1381 Makefile. Also document all of the --enable-sim switches
1382 supported. Check whether getrusage and sys/resource.h are
1384 * config.in: Regenerate.
1385 * configure: Regenerate.
1386 * Makefile.in: Add support for all of the variables set with
1387 --enable-sim switches.
1389 * Makefile.in (clean): make clean now removes all built sources as
1392 * cpu.c: Use HAVE_STRING_H, HAVE_STRINGS_H, HAVE_UNISTD_H,
1393 HAVE_TIME_H, HAVE_SYS_TIMES_H, HAVE_SYS_RESOURCE_H defined in
1394 the generated config.h.
1396 * device_tree.c: Ditto.
1399 * emul_netbsd.c: Ditto.
1404 * registers.c: Ditto.
1405 * sim_calls.c: Ditt.
1409 * main.c (main): Call psim_print_info with verbose == 2.
1411 * mon.c (mon_print_info): Align the cpu number and number of
1412 instructions fields. Do not print an instruction category if the
1413 CPU did not execute any of those instructions. Print out number
1414 of reads and writes. If getrusage is supported, print out number
1415 of simulated instructins per second.
1417 * configure.in: Add support for --enable-sim-opcode=stupid.
1418 * configure: Regenerate.
1422 * std-config (INLINE_DEVICE_TREE): Don't inline either of
1423 device_tree.c or devices.c. There is no significant gain.
1425 * configure.in, Makefile.in: add --enable-sim-icache=[0-9]* and
1430 * igen.c (main), misc.h (target_a2i, i2target), misc.c: Add
1431 functions to convert between target and igen internal bit numbers.
1432 Make IO go through these functions. Add -b (bit size) and -h (high
1433 bit nr) options to igen. Typical usage would be: ./igen -b 16 -h
1434 15 for a 16 bit instruction format with the msb given a number 15.
1438 * dgen.c (main): Was outputting optarg even when it was NULL.
1442 * vm_n.h (vm_data_map_load_N, vm_data_map_store_n), debug.h,
1443 debug.c: Add tracing of load/store unit (virtual) with -t
1448 * std-config.h (WITH_ENVIRONMENT): Add USER_ENVIRONMENT which does
1449 not include things such as the time base and events.
1451 * interrupt.c, sim_calls.c, cpu.h, vm.c, configure.in: Add UEA to
1452 all environment switches for above.
1454 * psim.c (psim_create): ditto - new device tree node name is
1455 /options/environment-architecture with values user, virtual and
1460 * ppc-opcode-stupid: Third example of use of opcode table - this
1461 one expands all mtspr/mfspr and branch instructions. Appears to
1462 give about a 10% gain in performance if everything enabled. Also
1463 takes about 150mb of swap to build.
1467 * emul_netbsd.c (do_exit): Print arguments and close parenthesis
1468 if tracing, since exit doesn't go through emul_exit_call.
1469 (do_read): Print arguments if tracing.
1475 (do_sigprocmask): Replace trace with printing arguments if
1477 (do_ioctl): Print arguments if tracing.
1481 (do_gettimeofday): Ditto.
1482 (do_getrusage): Ditto.
1483 (do_fstatfs): Ditto.
1485 * filter_filename.c: New file to provide filter_filename to strip
1486 the directory prefix from a file.
1487 * filter_filename.h: New include file to declare filter_filename.
1489 * debug.h: Include filter_filename.h.
1490 (TRACE,DTRACE,ERROR): Use filter_filename on __FILE__.
1492 * misc.h: Include filter_filename.h.
1493 (ASSERT): Use filter_filename on __FILE__.
1495 * igen.c (lf_print_my_prefix): Use filter_filename on the filename
1498 * Makefile.in: Add filter_filename support.
1500 * ppc-instructions (dcbi, icbi): Make these NOPs rather than
1501 invalid instructions.
1503 * configure.in: Add support for more --enable-sim-* switches.
1504 Use config.make and config.hdr to write to Makefile and config.h
1505 respectively. Don't rewrite Makefile, just append to it.
1506 * configure: Regenerate.
1507 * config.{make,hdr}: New shell scripts.
1509 * Makefile.in: Remove all variables set by configure.in.
1510 (psim.o): Depend on $(BUILT_SRC) also.
1512 * emul_netbsd.c (do_gettimeofday,do_getrusage): When comparing an
1513 integer, use 0, not NULL.
1517 * configure.in: Add support for --enable-sim-inline,
1518 --enable-sim-bswap, --enable-sim-cflags, --enable-sim-complex,
1519 --enable-sim-switch, --enable-sim-duplicate, --enable-sim-filter,
1520 and --enable-sim-endian switch to control various Makefile
1522 * configure: Regenerate from configure.in.
1523 * Makefile.in: Add various Make variables that the various
1526 * std-config.h (DEFAULT_INLINE): Don't set this to 2 if using GCC
1527 and optimizing by default.
1531 * bits.h (ROTL32, ROTL64): Were functions, made them macros, now
1532 make them functions again. Appears 2.6.3 is confused by just a
1537 * ppc-endian.c (SWAP_8): Fix 8 byte swap!
1539 * psim.c (psim_create): Not correctly checking that runtime
1540 configuration of things like ENDIAN, ENVIRONMENT and ALIGNMENT
1541 matched the compiled in ones.
1543 * debug.h (ITRACE), igen.c: Tidy up more tracing flags -
1544 trace_semantics is now different to trace_idecode, the former
1549 * ppc-instructions (mtsrin): Missing instruction
1550 * ppc-instructions (mfsrin): Missing instruction
1551 * ppc-instructions (eieio): Missing instruction
1555 * build-psim: New shell script - see internals for usage,
1556 simplifies the process of building custom simulators.
1560 * std-config.h (SEMANTICS_INLINE): Tidy up notes on each of the
1561 INLINE macros. Make SEMANTICS_INLINE == 1 if DEFAULT_INLINE == 2.
1562 Don't use DEFAULT_INLINE to define REGISTERS_INLINE DEVICES_INLINE
1563 DEVICE_TREE_INLINE or INTERRUPTS_INLINE as none of these are on
1564 the instruction or data critical paths.
1566 * FIXME: devices.c/emul_netbsd.c would benefit (slightly) from
1567 the inclusion of device_tree.c/emul_generic.c.
1571 * os_emul.[hc], emul_generic.[hc], emul_netbsd.[hc]: replace
1572 system.[hc]. Start of suport for multiple emulations and
1573 emulation state (os_emul object).
1575 * emul_generic.[hc]: Start of code to implement proper system call
1580 * cpu.h, cpu.c (cpu_init): New function, zero the registers before
1581 the processor is started. Fixes problem of registers being
1582 undefined when restarting from within gdb.
1584 * cpu.h, cpu.c (cpu_flush_icache): New function, flushes the
1585 instruction cache (if present). Fixes problem of cpu caching gdb
1586 breakpoint instructions.
1588 FIXME: PSIM sometimes aborts calling error(), it should instead
1589 call sim_error() say which takes care of housekeeping such as
1590 saving the CIA before calling error.
1592 * NOTE: cpu_flush_cache() instead of cpu_synchronize_context() is
1593 used when restarting a simulation because the latter has the
1594 unwanted side effect (well I as a kernel hacker think it is) of
1595 performing an isync when the instruction stream doesn't contain
1600 * mon.h (new), mon.c (new), std-config.h (WITH_MON): Performance
1601 monitoring module. Counts both instructions issued and
1604 * NOTE: mon does not contain to count instruction loads as this
1605 information is already available from the mon_issue() hook.
1607 * igen.c (lf_print_c_semantic), vm_n.h: Add counting code.
1609 * psim.h, psim.c (psim_create), cpu.h, cpu.c (cpu_create): Attach
1610 a common monitor to each of the cpus. Delete
1611 cpu_increment_number_of_insns() and cpu_get_number_of_insns()
1612 replaced by copied code in mon.[hc].
1616 * sim_calls.c, main.c, psim.c (psim_create): always create
1617 `WITH_SMP' cpus. The actual number of CPU's active in a
1618 simulation run is taken from the device node: /init/smp (an
1619 integer). WITH_SMP changed to 2 (remember to put it back to 0).
1623 * system.c: More system call emulation. If code appears NetBSD
1624 specific, make conditional to being compiled on a NetBSD system
1629 * Makefile.in, gen.c(delete), igen.c(new), dgen.c(new),
1630 lf.[ch](new), table.[ch](new): Split into two generators - igen
1631 that outputs the instruction tables and dgen that outputs the spr
1632 tables. Add -f (filter out) flag to igen to filter out certain
1633 instructions (ex 64 bit ones) from the created tables. Include
1634 $(LIBIBERTY_LIB) in link options in case host lacks some libc
1637 * NOTE: igen, since it was originally written for the
1638 PowerPC/RS6000, things the MSB is 0 and the LSB is 63{31}.
1640 * Makefile.in, std-config.h, ppc-cache-rules(new),
1641 ppc-opcode-complex(new), ppc-opcode-simple(new): (for igen) Create
1642 cache-rule and opcode-rule tables from macros found std-config.h.
1643 Delete corresponding macro's from std-config.h.
1645 * igen.c (gen_itable_c, gen_itable_h), Makefile.in: code to output
1646 an table of all the instructions. Code to output a type
1647 enumerating all the instructin names.
1649 * igen.c(lf_print_c_semantic): Move call to increment instruction
1650 counter so that it occures _after_ the instruction has been fully
1651 validated, was double counting illegal/invalid instructions. Add
1652 conditional so only compiled in when WITH_PROFILE enabled (enabled
1655 * igen.c, cpu.h, cpu.c(cpu_increment_number_of_insns): Include
1656 itable.h, count individual instruction types not just total,
1657 adjust reporting functions to output this.
1659 * ppc-instructions (64 bit Load Doubleword with Update Indexed):
1660 Had 32./ instead of 31./
1662 * ppc-instructions (64 bit Store Double Word Conditional Indexed):
1663 bitrot - updated to use newer CR register operators.
1665 * ppc-instructions (64bit Floating Convert from Integer
1666 Doubleword): Correct call to Round_Float().
1670 * basics.h: #include "sim_callbacks.h" earlier so that its
1671 prototypes are declared in all other header files.
1673 * bits.h, bits.c, idecode_expression.h (ROTL32, ROTL64): Update
1674 doc in bits.h, remove dead code in bits.c, move ROTL32/ROTL64 into
1677 * cpu.c(cpu_add_commas), device_tree.h, device_tree.c(scand_*):
1678 Add size of buffer argument to functions writing a string into a
1679 buffer. Check for buffer overflow.
1683 * devices.h, devices.c, debug.h, debug.c: add macro's for tracing
1684 of each device. Make parameter names consistent so macros work.
1685 Use macro's in device functions.
1687 * device_tree.c, devices.h, devices.c: include path to device in a
1688 devices node when creating it.
1690 * device_tree.c, debug.h, debug.c: Add tracing of `device-tree'.
1692 * core.c: add tracing of core-device, adjust parameter names in
1693 core functions to be consistent with those in devices*.
1697 * debug.h, debug.c (trace_option): New function. Parses the trace
1698 option, updating the trace array.
1700 * debug.h, debug.c (trace_usage): New function. Outputs the list
1701 of all possible trace options.
1703 * sim_calls.c (sim_open), main.c (main): Use new trace_option() to
1704 parse trace options specified with the simpler -t flag. Adjust
1707 * FIXME: basic parsing of command line options is still duplicated
1708 by main.c and sim_calls.c
1712 * Makefile.in (clean): Delete *.i and *.out files.
1714 * ppc-endian.c (SWAP_n): Add SET argument to allow use of SWAP
1715 macros for either assignment or return. Fix SWAP_8 to use a
1716 union, and two SWAP_4's. Delete SWAP_N, since nobody uses it now.
1717 (ENDIAN_N): Add SET argument to SWAP_n calls. Delete macro defs
1718 that hardwired swapping on/off, let optimizer delete dead code.
1720 * main.c (main): Add printf that we caught a signal and print out
1721 the failing address.
1725 * Makefile.in: Remove tabs from otherwise empty line.
1726 Confuses many non-GNU versions of "make".
1730 * Makefile.in (clean): Delete files produced by gen.
1734 * gen.c (lf_print_c_semantic_function): Move counting # of
1735 instructions here so it works with caching.
1736 (gen_idecode_c): Move from here.
1740 * gen.c, ppc-instructions, psim.c: Fix code for generating
1741 cracking instruction cache. Delete the code that cached just the
1742 result from doing an instruction lookup - this ran slower than no
1747 * Makefile.in (gen.o): Include $(INLINE_CFLAGS).
1749 * debug.h (ppc_trace): Rename from trace, to avoid a conflict with
1750 TCL when gdb is linked with the simulator.
1751 * debug.c (ppc_trace): Ditto.
1752 * sim_calls.c (sim_open): Change trace -> ppc_trace.
1753 * main.c (main): Ditto.
1755 * cpu.c (cpu_add_commas): Remove extra static.
1759 * Makefile.in (psim.o): Now that inlines are turned on, make
1760 psim.o depend on all sources.
1762 * cpu.c (cpu_add_commas): New function to format a long with
1764 (cpu_print_info): Use it to print number_of_insns.
1766 * ppc-endian.c (SWAP_n): New macros to speed up byte swapping for
1768 (ENDIAN_N): If both target and host byte orders are known, don't
1769 bother testing CURRENT_{TARGET,HOST}_BYTE_ORDER.
1771 * ppc-endian.h (target specific H2T_n/T2H_n macros): Remove #if 0
1772 to allow target specific H2T_n/T2H_n macros to be used.
1773 (htonl, ntohl): If compiled on a 486 by GCC and WITH_BSWAP is
1774 non-zero, redefine the htonl/ntohl macros to use the BSWAP instead
1775 of the 3 instruction sequence that runs on 386s.
1777 * std-config.h (WITH_{HOST,TARGET}_BYTE_ORDER): Don't override if
1778 specified on the compile line.
1779 (WITH_BSWAP): If not defined, define as 0.
1781 * Makefile.in (INLINE_CFLAGS): Add -DDEFAULT_INLINE=2 to add
1782 default inline support. Pass INLINE_CFLAGS when compiling.
1784 * devices.{h,c} (unimp_device_ioctl): Use STATIC_DEVICES, not
1785 INLINE_DEVICES since GCC doesn't like inline functions that
1786 accept variable arguments.
1787 (stack_ioctl_callback): Make function just static because GCC
1788 doesn't like inline functions that accept variable arguments.
1790 * devices.h (STATIC_DEVICES): Define as empty if not defined.
1792 * inline.c: Correct pathnames of included C files to match current
1795 * inline.h (STATIC_DEVICES): If DEVICES_INLINE is defined to be
1796 non-zero, define STATIC_DEVICES to be static.
1798 * std-config.h (INLINE): If GNU C and optimizing, define this as
1800 (DEFAULT_INLINE): If not defined, define as 0.
1801 (ENDIAN_INLINE): If not defined, define as DEFAULT_INLINE.
1802 ({CORE,VM,CPU,EVENTS,REGISTERS,INTERRUPTS}_INLINE): Ditto.
1803 ({SPREG,IDECODE}_INLINE): Ditto.
1807 * ppc-instructions: Initial cut of floating point suport added.
1808 Of note include - use of host IEEE floating point instructions,
1809 use of PowerPC manual pseudo code to handle the FPSCR. It is not
1810 currently a pretty sight.
1812 * memory_map.h, memory_map.c, memory_map_n.h, core.h, core.c:
1813 merge into core.h, core.c, core_n.h. The type memory_map replaced
1814 with core_map. This removes a level of pointer indirection when
1815 translating an address.
1817 * memory_map.h, memory_map.c, memory_map_n.h: delete.
1819 * Makefile.in et.al (sorry): tweek to use new core, core_map and
1824 * sim_calls.c, main.c: Add -g (trace_gdb) option, add tracing to
1825 most of the other functions in sim_calls.c.
1827 * basics.h (CONCAT3), memory_map.c, memory_map_n.h, Makefile.in:
1828 Add macros to better cover up `generic' code. Makes it possible
1829 to step through the generic code!
1831 * vm.c, vm_n.h, Makefile.in: ditto
1835 * devices.h, devices.c, memory_map.h, memory_map.c: Changed
1836 callback interface so that there is a read/write buffer but no
1837 read/write_word. VEA default memory read/write handler sometimes
1838 couldn't resolve an access and of those some were for a memory
1839 fault and some were because gdb was making a bogus request.
1841 * devices.h, devices.c, memory_map.h, memory_map.c, vm.h, vm.c:
1842 eliminate transfer_mode (raw or cooked) parameter from read/write
1847 * ppc-instructions (fmul, fmuls): correct instruction format - had
1852 * psim.c, device_tree.h, device_tree.c, devices.c (printd_*,
1853 scand_*): new functions to parse/print fields in device names
1854 while hiding any machine dependency.
1856 * devices.c, psim.c: Change the stack init code so that it is
1857 handled by a device. Arguments passed across using a device ioctl
1860 * devices.h, devices.c: device ioctl callback changed to allow a
1861 variable number of arguments. This gives greater flexability and
1862 greater chance of bugs.
1866 * main.c (printf_filtered, error): Missing va_end() to close off
1867 variable argument use.
1869 * Makefile.in (tmp-gencode): comment out hack to get around some
1870 versions of make not handling files being created as side-effects.
1872 * gen.c (lf_open): Add -n (real_file_name) option. Specifies an
1873 alternative file name to use in output files for things like #line
1876 Makefile.in (tmp-gencode): Use gen -n so that debug info is
1879 * Makefile.in (TARGETLIB): Use this instead of libsim.a in the
1884 * sim_calls.c (sim_set_callbacks): Define new function.
1888 * psim.c (psim_print_info): Print exit status or signal number.
1892 * cpu.c (struct _cpu): Add number_of_insns field to trace how many
1893 instructions are executed.
1894 (cpu_increment_number_of_insns): New function to increment the
1895 number of instructions issued.
1896 (cpu_get_number_of_insns): New function to return the number of
1897 instructions issued.
1898 (cpu_print_info): New function to print cpu related information.
1899 At present, print the number of instructions executed.
1901 * gen_idecode_c: Emit call to cpu_increment_number_of_insns within
1904 * psim.c (psim_print_info): New function to iterate over each of
1905 the CPU's calling cpu_print_info.
1907 * psim.h,cpu.h: Add new declarations.
1909 * sim_calls.c (sim_open): Add argument processing to add the same
1910 switches main.c accepts for the standalone processor.
1911 (sim_close): Call psim_print_info if -I.
1913 * main.c (main): Add comment saying to update sim_calls.c when
1914 adding switches. Add -I to call psim_print_info when done.
1915 (usage): Update usage message.
1919 * main.c (printf_filtered): Correct to match new prototype.
1923 * sim_callbacks.h (printf_filtered): Correct prototype.
1927 * device_tree.c (OEA_MEMORY_SIZE): Define if not defined to
1929 (clayton_memory_size): Define as OEA_MEMORY_SIZE.
1931 * std-config.h (WITH_TRACE): Default to 1 now.
1933 * psim.c (write_stack_arguments): Don't write any stack arguments
1936 * main.c (main): Switch to using getopt. Make -p also set
1937 trace_semantics. Make -a turn on all trace flags. Make -C turn
1940 * device_tree.c (create_option_device_node): Assume a program is
1941 OEA if the start address is < 4096, not just == 0.
1945 * Makefile.in (maintainer-clean): New synonym for realclean.
1949 * registers.c (register_description): Add gdb synonyms for cr
1954 * Makefile.in (install): Don't install in $(tooldir).
1956 * configure.in: Call AC_CONFIG_HEADER. Don't try to use
1957 bfd/hosts/*.h file or bfd/config/*.mh file. Call AC_PROG_CC and
1958 AC_PROG_RANLIB. Substitute in values for CFLAGS, HDEFINES, AR,
1959 and CC_FOR_BUILD. Call AC_CHECK_HEADERS for various header files.
1960 Touch stamp.h if creating config.h.
1961 * configure: Rebuild.
1962 * config.in: New file, created by autoheader.
1963 * Makefile.in (AR): Define as @AR@.
1964 (CC): New variable, defined as @CC@.
1965 (CFLAGS): Define as @CFLAGS@.
1966 (CC_FOR_BUILD): New variable, defined as @CC_FOR_BUILD@.
1967 (RANLIB): Define as @RANLIB@.
1968 (HDEFINES, TDEFINES): New variables.
1969 (@host_makefile_frag@): Remove.
1970 (mostlyclean): Make the same as clean, not distclean.
1971 (clean): Remove config.log.
1972 (distclean): Remove config.h and stamp-h.
1973 (Makefile): Don't depend upon @frags@. Just rebuild Makefile when
1974 invoking config.status.
1975 (config.h, stamp-h): New targets.
1976 (gen, gen.o): Build with CC_FOR_BUILD, not CC.
1977 (ppc-config.h): Rename from old config.h build.
1978 * (basics.h,gen.c,ppc-endian.c,psim.c): Include ppc-config.h.
1982 * configure{,.in}: Don't include sysdep.h from bfd, since bfd no
1984 * basics.h (sysdep.h): Don't include it.
1985 * Makefile.in (BASICS_H): Remove sysdep.h.
1989 * core.c (core_add_data): First growth of bss was being put at
1990 wrong address (0) instead of &end.
1992 * core.c (core_add_stack, core_add_data): Was not handling case
1993 where bss/stack is grown across the current end-of-{bss,stack}.
1997 * system.c (system_call): Fix SYS_break - was aligning bss to a
1998 page boundary instead of just an 8 byte one; On first call sbrk(0)
2003 * Makefile.in (install): Fix install rule.
2007 * system.c (system_call): Add read support.
2009 * main.c (main): -t sets trace_device_tree. Correct usage message
2012 * device_tree.c (update_memory_node_for_section): Make tracing
2013 output line up. If not code or readonly, assume that the section
2014 is a data section and has read/write permissions. Add readonly
2017 * core.c (create_core_from_addresses): Print end address in traces
2018 and make tracing output line up.
2020 * Makefile.in: Rewrite from Makefile to work with the Cygnus
2021 environment, and support compiling in a different directory than
2022 the sources reside in.
2024 * ppc-endian.h: Rename from endian.h so that it doesn't get
2025 confused with /usr/include/sys/endian.h on Linux. Add Linux
2028 * ppc-endian.c: Rename to be consistant with ppc-endian.h.
2029 Include ppc-endian.h, not endian.h.
2031 * basics.h (sysdep.h): Include sysdep.h that configure makes.
2032 Include ppc-endian.h, not endian.h.
2034 * std-config.h: Rename from ppc-config. Put #ifndefs around most
2035 configuration macros, so they can be overridden via CFLAGS. By
2036 default, turn off tracing.
2038 * configure.in: Clone from other simulator targets.
2039 * configure: Generate via autoconf from configure.in.
2043 * ppc-instructions: fix srawi (was geting XER[CA] real wrong).
2045 * interrupts.c (data_storage_interrupt): allow stack to grow by
2046 upto one MB per increment.
2048 * ppc-instructions: divw was computing rA / rA not rA / rB
2050 * main.c (main): really stupid. Wasn't exiting with correct status
2054 * system.c (system_call): add system calls kill(2) and getpid(2).
2056 * main.c (main): Check/return exit status when simulation
2061 * device_tree.c (create_option_device_node): Alignment rules (at
2062 least for the moment) now are for strict alignment only for LE OEA
2063 mode. (Because of compiler problems).
2065 * system.c (system_call) SYS_exit: Wasn't exiting with correct status.
2069 * vm.c (DEFINE_VM_DATA_MAP_WRITE_N): For miss aligned transfer
2072 * system.c (system_call): didn't page align break argument before
2073 determining increment break increment.
2075 * psim/ppc: Re-arange entire directory structure so that
2076 everything lives in the one directory. While a pain for cleaning,
2077 makes building across multiple architectures much simpler.
2079 * devices.c, device_tree.c: Added code that provides a simple
2080 illustration of how an interrupt control device could be
2083 * devices.c: Added code so that the dumb console device can read
2084 (from stdin) as well as write to stdout.