From d4d3c7adbb45714fb2d1ddc7a94627729bf0a82a Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Wed, 17 Apr 1996 20:09:36 +0000 Subject: [PATCH] update from Andrew --- sim/ppc/.Sanitize | 14 + sim/ppc/ChangeLog.00 | 2455 ++++++++++++++++++++++++++++++++++++++++++ sim/ppc/hw_com.c | 23 + sim/ppc/hw_cpu.c | 145 +++ sim/ppc/hw_cpu.h | 34 + sim/ppc/hw_eeprom.c | 289 +++++ sim/ppc/hw_iobus.c | 98 ++ sim/ppc/hw_nvram.c | 234 ++++ sim/ppc/hw_pci_ide.c | 1 + sim/ppc/hw_pic.c | 98 ++ sim/ppc/psim.texinfo | 1105 +++++++++++++++++++ 11 files changed, 4496 insertions(+) create mode 100644 sim/ppc/ChangeLog.00 create mode 100644 sim/ppc/hw_com.c create mode 100644 sim/ppc/hw_cpu.c create mode 100644 sim/ppc/hw_cpu.h create mode 100644 sim/ppc/hw_eeprom.c create mode 100644 sim/ppc/hw_iobus.c create mode 100644 sim/ppc/hw_nvram.c create mode 100644 sim/ppc/hw_pci_ide.c create mode 100644 sim/ppc/hw_pic.c create mode 100644 sim/ppc/psim.texinfo diff --git a/sim/ppc/.Sanitize b/sim/ppc/.Sanitize index 52b25c18cdb..459eeb33405 100644 --- a/sim/ppc/.Sanitize +++ b/sim/ppc/.Sanitize @@ -28,6 +28,7 @@ BUGS COPYING COPYING.LIB ChangeLog +ChangeLog.00 INSTALL Makefile.in NOTES @@ -67,6 +68,18 @@ events.c events.h filter_filename.c filter_filename.h +hw_com.c +hw_cpu.c +hw_cpu.h +hw_eeprom.c +hw_iobus.c +hw_memory.c +hw_nvram.c +hw_pal.c +hw_pci_ide.c +hw_phb.c +hw_phb.h +hw_pic.c idecode_branch.h idecode_expression.h idecode_fields.h @@ -98,6 +111,7 @@ ppc-spr-table ppc.mt psim.c psim.h +psim.texinfo registers.c registers.h sim-endian-n.h diff --git a/sim/ppc/ChangeLog.00 b/sim/ppc/ChangeLog.00 new file mode 100644 index 00000000000..8216544232e --- /dev/null +++ b/sim/ppc/ChangeLog.00 @@ -0,0 +1,2455 @@ +Sat Apr 13 00:00:24 1996 Andrew Cagney + + * emul_netbsd.c (do_read): Correctly set the return value. + (do_getpid): Ditto. + (do_getuid): Ditto. + (do_geteuid): Ditto. + (do_dup): Ditto. + (do_getegid): Ditto. + (do_getgid): Ditto. + (do_sigprocmask): Ditto. + (do_umask): Ditto. + (do_dup2): Ditto. + (do_gettimeofday): Ditto. + (do_getrusage): Ditto. + (do_fstat): Ditto. + (do_stat): Ditto. + (do_lseek): Ditto. + (do___sysctl): Ditto. + +Fri Apr 12 20:56:47 1996 Andrew Cagney + + * device_table.c (vm_ioctl_callback): Don't access the processor + registers directly, instead leave it to the caller to handle this. + + * emul_netbsd.c (do_break): Which calls vm_ioctl_callback to + perform a break. Pass in the new break value and set the + registers according to the result. + + * emul_generic.c (emul_write_status): Change so that r3 contains + either status or errno and failure is indicated by SO. + +Thu Apr 4 23:03:38 1996 Andrew Cagney + + * emul_bugapi.c (emul_bugapi_create): More strict check of OEA + address. + +Thu Apr 4 15:17:22 1996 Michael Meissner + + * INSTALL: Fix some long lines and remove x86 specific options in + the examples. + +Sun Mar 31 15:47:33 1996 Andrew Cagney + + * INSTALL: Update to reflect gdb-4.16. + + * RUN: Update to reflect gdb-4.16. Review notes on building a BSD + runtime environment. + +Fri Mar 29 12:17:58 1996 Andrew Cagney + + * emul_bugapi.c (_os_emul_data): Add fields for output, input. + (emul_bugapi_create): Create input, output from /chosen/stdin and + /chosen/stdout. + (emul_bugapi_do_{read,write}): Switch to use device_instance + interface. + (emul_bugapi_instruction_call): Change calls to + emul_bugapi_do_{read,write} to pass device instance argument. + +Tue Mar 26 14:57:58 1996 Michael Meissner + + * igen.c (idecode_switch_end): Fix 2/26 change so that an extra + default is not written out if a default was already written. + + * psim.c (psim_{read,write}_register): Use sizeof unsigned_8 to + size cooked_buf, not sizeof natural_word, since floating point + registers are 8 bytes. + +Thu Mar 21 00:06:09 1996 Andrew Cagney + + * main.c (error): Be careful to not try to print out statistics + when the simulation was never created. + +Thu Mar 7 19:53:49 1996 Michael Meissner + + * emul_netbsd.c: Only include sys/mount.h if HAVE_SYS_MOUNT_H is + defined. + * configure.in: Test for sys/mount.h. + * configure,config.in: Regenerate. + +Wed Feb 28 00:43:07 1996 Andrew Cagney - aka Noid + + * Makefile.in (corefile.o): missing dependency on device_table.h + etc. + +Mon Feb 26 21:11:20 1996 Andrew Cagney - aka Noid + + * igen.c (idecode_switch_end): Output a default entry when the + switch statement is perfect. Firstly stops GCC complaining about + an incomplete switch and secondly it will be eliminated by a good + compiler any way. + +Thu Feb 22 22:48:57 1996 Andrew Cagney + + * README, RUN, INSTALL: Update to reflect announcement + * psim: PSIM 1.0.1 released + +Thu Feb 22 14:01:56 1996 Michael Meissner + + * emul_bugapi.c (emul_bugapi_do_read): New function to handle + reads. + (emul_bugapi_instruction_call): Add support for .INCHR/.INLN + system calls. + + * emul_bugapi.c (emul_bugapi_do_write): Call flush_stdoutput. + * emul_netbsd.c (do_write): Call flush_stdoutput. + + * main.c (flush_stdoutput): Do fflush (stdout). + * sim_calls.c (flush_stdoutput): Do gdb_flush (gdb_stdout); + * sim_callbacks.h (flush_stdoutput): Declare. + +Wed Feb 21 10:39:35 1996 Michael Meissner + + * emul_bugapi.c (bug_mapping): New structure to map bug system + call numbers to a string. + (toplevel): Add remaining bugapi system calls. + (emul_bugapi_instruction_name): Map bugapi system call number to a + string. + (emul_bugapi_do_write): Common code to process write system calls. + (emul_bugapi_instruction_call): If os-emul tracing is on, trace + the system call. Use the name to print unknown system call. + Correct implementation of _OUTLN. Add support for _OUTSTR and + _PCRLR system calls. + +Wed Feb 21 17:07:27 1996 Andrew Cagney + + * NOTES: New file. Ramblings on why things were done they way + they were. + + * psim.c (psim_options): Didn't enter the model value into the + device tree as a string. + + * cpu.c (cpu_synchronize_context): Wrong test for conditional + flush of cache. + + * emul_generic.c (emul_add_tree_hardware): reg value didn't match + bus address. + + * ppc-opcode-flat: new file. Generate an instruction decode + function like ppc-opcode-complex but use switch statements. + + * INSTALL: document new opcode file, add example configurations. + +Tue Feb 20 18:42:31 1996 Andrew Cagney + + * main.c (main): rename psim instance (system) to simulation and + make global. + * main.c (error): print out performance even when an error occures. + + * emul_bugapi.c (emul_bugapi_create): Fix argument passing. + + * emul_generic.c (emul_add_tree_hardware): Move hardware devices + to 0x80000000 from 0x400000. + +Mon Feb 19 23:52:31 1996 Andrew Cagney + + * config.in (HAVE_DIRENT_H): Temp until config.in regenerated. + +Mon Feb 19 22:54:40 1996 Andrew Cagney + + * ppc-instructions (TLB Invalidate Entry, TLB Invalidate ALL): + Implement by passing on request to all processors. + * ppc-instructions (TLB Synchronize): Implement as empty, processor + tlb's are always in sync. + + * cpu.c (cpu_page_tlb_invalidate_all): New function. Pass on TLB + invalidate request to processors VM sub-system. + * cpu.c (cpu_page_tlb_invalidate_entry): Ditto. + + * vm.c (vm_page_tlb_invalidate_all): New function. Mark all page + TLB entries as invalid. + * vm.c (vm_page_tlb_invalidate_entry): New function. Ditt but only + invalidate one TLB entry. + + * psim.c (psim_init): Invalidate TLB's before (re)starting. + +Mon Feb 19 21:25:56 1996 Andrew Cagney + + * emul_generic.c (emul_add_tree_options): Add argument + oea_interrupt_prefix (0 or 1) that specifies the prefix MSR[IP] + and hence the location of the interrupt vectors. Add this to the + device tree. + + * emul_chirp.c (emul_chirp_create): Allow configuration of + floating-point and interrupt prefix (default 0) using the above. + + * emul_netbsd.c (emul_netbsd_create): Pass dummy arg for + interrupt-prefix. + + * emul_bugapi.c (emul_bugapi_create): Allow configuration of + interrupt prefix (default 1) and configure interrupt table traps + accordingly. + + * emul_generic.c (emul_add_tree_hardware): Include a small eeprom + in the list of devices. + + * device_table.c: For moment fake eeprom device by a memory + device. In future will need a proper eeprom device. + +Fri Feb 16 10:42:27 1996 Michael Meissner + + * psim.c: Include options.h so print_options is declared. + +Thu Feb 15 18:10:13 1996 Michael Meissner + + * emul_netbsd.c (toplevel): Do not include sys/resource.h if the + system doesn't have it, and turn off getrusage processing. + (write_rusage): #ifdef out if we don't have getrusage. + (do_getrusage): Define as 0 if we don't have getrusage. + +Wed Feb 14 17:38:12 1996 J. T. Conklin + + * configure.in (AC_HEADER_DIRENT): Add, so that we can figure out + where the directory functions are declared. + * configure: Regenerate + + * emul_netbsd.c: Use the macros defined by configure to find the + appropriate directory functions. + +Mon Feb 12 16:07:44 1996 Andrew Cagney + + * psim: PSIM-1.0 released + +Thu Feb 8 00:53:13 1996 Andrew Cagney + + * configure.in (xor_endian): Trace setting of xor-endian flag. + +Wed Feb 7 18:20:56 1996 Andrew Cagney + + * psim.c (psim_usage): Extend documentation. + + * ppc-instructions (model-print): fix typo. + +Sun Feb 4 23:58:02 1996 Andrew Cagney + + * configure.in (with-smp): Default configuration allow up to + five processors (but enable only one). + + * emul_bugapi.c (emul_bugapi_create): If floating-point is + allowed, enable the floating point instruction set in the + msr. + +Tue Jan 30 22:52:32 1996 Andrew Cagney + + * emul_chirp.c (chirp_emul_seek, chirp_emul_read, + chirp_emul_write): Tolerate invalid ihandles. + + * device.c (device_instance_create, device_instance_delete): + init/delete instance name + + * emul_chirp.c (emul_chirp_instruction_call): Read the nr args and + returns when determining the service. + + * emul_chirp.c (chirp_read_t2h_args): Allow variable number of + args for the method "call-method". + + * emul_chirp.c (chirp_emul_getprop): Tolerate a n_returns of zero + - should be one. Some OpenBoot code doesn't pass correct arg. + + * emul_chirp.c (chirp_emul_getprop): Trace more property types. + +Tue Jan 30 19:12:29 1996 Andrew Cagney + + * RUN: New file. Describe how to run PSIM + * INSTALL: New file. Describe how to install PSIM + * README: New file. Overview PSIM. + * BUGS: New file. Briefly discuss bugs and limitations + +Wed Jan 24 20:28:08 1996 Andrew Cagney + + * emul_bugapi.c (OEA_START_ADDRESS): Put it back to 0x100000, + wasn't correctly using GLD. + +Mon Jan 22 22:44:13 1996 Andrew Cagney + + * emul_generic.c (emul_add_tree_options): Make default number of + active processors 1 (even when SMP enabled). + +Mon Jan 22 22:37:34 1996 Andrew Cagney + + * device_table.c (icu_io_read_buffer_callback): Add extra register + (at addr + 4) that returns number of processors. + + * emul_generic.c (emul_add_tree_hardware): Update device node to + match. + +Mon Jan 22 22:00:42 1996 Andrew Cagney + + * emul_bugapi.c (OEA_START_ADDRESS): Change to 0x4000 so that it + matches gas-960116/ld. + +Fri Jan 19 00:32:27 1996 Andrew Cagney + + * psim-960119 released - psim-1.0b01. + +Fri Jan 19 00:32:27 1996 Andrew Cagney + + * psim.c (psim_create): Re-order so that all options are set + before the CPU's are created. Was breaking mon_create(); + + * psim.c (psim_create): Tidy up conflicting configuration errors. + + * * (*): Adjust copyleft as required. + + * debug.c: Add missing print-info entry to trace table. + + * os_emul.c (os_emul_create): Fix `-e' option. Was looking under + wrong name. + + * psim.c (psim_options): Fix `-r' option. Was entering under wrong + name. + +Thu Jan 18 20:33:48 1996 Andrew Cagney + + * vm.c (om_unpack_bats): Fix checking of bat bits. + + * emul_chirp.c (emul_chirp_create): Store address of OB in memory + in the os_emul_data structure. + + * emul_bugapi.c (emul_bugapi_create): Store the address of the + bugapi code (in main memory) in the os_emul_data structure. + +Thu Jan 18 01:14:55 1996 Andrew Cagney + + * vm.c (om_translate_effective_to_real): Fix trace output. + +Wed Jan 17 22:21:55 1996 Andrew Cagney + + * device_table.c (generic_device_init_address): Create memory from + information obtained from `reg' property. + * device_table.c (vm_init_address_callback): Use information + obtained from properties. + * emul_netbsd.c (emul_netbsd_create): Update to create device and + property entries to match + +Tue Jan 16 09:50:53 1996 Michael Meissner + + * idecode_expression.h (ALU_END): Add ITRACE of the result. + + * ppc-instructions (Equivalent): Enable this instruction. + (Add to Minus One Extended): Ditto. + (Subtract from Minus One Extended): Ditto. + (Add/And/Or/Xor Immediate): Add alu trace of result. + (Add/And/Or/Xor Shifted Immediate): Ditto. + (And/Or/Equivalent/Nand/Nor): Ditto. + (And/Or with Complement): Ditto. + (Extend Sign Byte/Half Word): Ditto. + (Count Leading Zeros): Ditto. + (Shift Right Algerbraic Word): Ditto. + (Shift Right Algerbraic Word Immediate): Ditto. + +Wed Jan 17 21:47:34 1996 Andrew Cagney + + * device.c (device_init_address): New. Split initialization into + two stages, address and address spaces + * device.c (device_init_data): New. ... and data or other work. + With out this, devices try to modify memory before it as been + attached. + + * device.c (device_tree_init): Update to perform staged + initialization. + + * device.c (device_init): Delete. + +Wed Jan 17 21:43:09 1996 Andrew Cagney + + * device_table.c (data_*): Rewrite to make heaver use of property + nodes. Allow initialization by different data types. + * device_table.c (htab_* pte_*): Rewrite to use properties. + + * emul_chirp.c (emul_chirp_create): Use + * emul_bugapi.c (emul_bugapi_create): Ditto + * emul_netbsd.c (emul_netbsd_create): Ditto + +Wed Jan 17 21:24:50 1996 Andrew Cagney + + * emul_generic.c (emul_add_tree_options): Annotate existing tree + with options that haven't yet been specified. + * emul_generic.c (emul_add_tree_hardware): Annotate existing tree + with demo devices and properties. + + * emul_chirp.c (emul_chirp_create): Update to use new + device_tree_add_parsed call and additional information now + included in the device tree. Use emul_add_tree* functions to add + any missing details. + * emul_bugapi.c (emul_bugapi_create): Ditto + * emul_netbsd.c (emul_netbsd_create): Ditto + +Wed Jan 17 21:18:27 1996 Andrew Cagney + + * device.c (device_instance_create): New. Create/delete and + operate on instances of a device. + * device.c (device_instance_delete): Ditto + * device.c (device_instance_read): Ditto + * device.c (device_instance_write): Ditto + * device.c (device_instance_seek): Ditto + * device.c (device_instance_data): Ditto + * device.c (device_instance_name): Ditto + * device.c (device_instance_path): Ditto + + * emul_chirp.c (chirp_emul_open): Implement using device_instance. + * emul_chirp.c (chirp_emul_close): Ditto + * emul_chirp.c (chirp_emul_read): Ditto + * emul_chirp.c (chirp_emul_write): Ditto + * emul_chirp.c (chirp_emul_seek): Ditto + + * emul_chirp.c (chirp_read_t2h_args): Read arguments from device. + Being careful to convert all from target to host byte order. + * emul_chirp.c (chirp_write_h2t_args): Converse. + +Wed Jan 17 20:07:15 1996 Andrew Cagney + + * device.c (device_tree_add_parsed): New. Rewrite code to add + devices to the device tree so that a single printf style function + is used. + + * device.c (device_tree_add_*): Delete. Replaced by above. + + * device.c (split_device_specifier): Functions to manipulate a + device specifier (path) breaking it into its components + * device.c (split_property_specifier): Ditto + * device.c (split_device_name): Ditto + * device.c (split_find_device): Ditto + + * device.c (scan_*): Delete + + * device.c (device_tree_find_device): Rewrite to use above. + * device.c (device_add_property): Ditto + +Wed Jan 17 19:51:56 1996 Andrew Cagney + + * psim.c(psim_options): Parse the psim options, installing their + value in the device tree. Options are now first entered into a + device tree and then extracted out again when needed. This allows + greater flexability in configuration. + + * psim.c (psim_tree): Returns a basic device tree ready for + parsing by psim_options. + * psim.c (psim_usage): New. Give usage to varing levels of detail + according to the verbosity. In turn output device and trace + usage. + + * main.c (main): Update to use new system + * sim_calls.c (sim_open, sim_do_command): Ditto + + * psim.c (psim_options): Add `r' option - ram size. + * psim.c (psim_options): Add `o' option - openboot tree entry. + * psim.c (psim_options): Add `h'/`H' options - more help. + + * debug.c (trace_usage): Add more detailed help. + * device.c (device_usage): New. Output help including a list of + the devices currently available in the device table. + * device_table.c: Add usage operator to each device. + + * corefile.c (core_create, core_device_create): Adjust so that the + core device is created earlier for psim_tree(). Core can later be + created from it. + + * psim.c (psim_create): Update to handle above way of creating + things. Extract all information from the device tree. + + * device_tree.c (trace_*): New device node, its properties are + used to set the value of the trace options. Init this device (in + psim_options) when ever the options are updated. + +Wed Jan 17 19:46:07 1996 Andrew Cagney + + * debug.h: Add trace_print_info, trace_print_device_tree and + trace_dump_device_tree. The first is a replacement for the + variable `print_info' found in main.c and sim_calls.c. The latter + two enable the dumping of the entire device tree. + + * debug.c: Add to trace_description table. + + * main.c (main): Use above trace instead of local variable + * sim_calls.c (sim_close): Ditto + + * device.c (device_tree_print_device): New. Prints the device + tree in a format that is consistent with what can be parsed by the + device tree load from file code. + + * psim.c (psim_create): Dump device tree if enabled. If nump + selected, exit psim immediatly. + +Wed Jan 17 19:36:52 1996 Andrew Cagney + + * corefile-n.h (core_map_read_N): When mapping from an address to + a device, do not subtract the devices base. The device its self + can do this. Brings the behavour into line with OpenBoot. + * corefile-n.h (core_map_write_N): Ditto + * corefile.c (core_map_read_buffer): Ditto + * corefile.c (core_map_write_buffer): Ditto + + * device_table.c (console_io_read_buffer_callback): Adjust to + handle biased address. + * device_table.c (console_io_write_buffer_callback): Ditto + +Wed Jan 17 18:36:09 1996 Andrew Cagney + + * device.c (attach_device_interrupt_edge): New. Interrupt model + did not allow interrupts to be wired up as a general net (edges). + Re-implement so that interrupt events can be passed to multiple + controllers and interrupt controllers can further propogate + interrupt events. + + * device.c (attach_device_interrupt_edge) : New, Ditto + * device.c (detach_device_interrupt_edge) : New, Ditto + * device.c (clean_device_interrupt_edges) : New, Ditto + * device.c (device_interrupt_event) : New, Ditto + * device.c (device_interrupt_attach) : New, Ditto + * device.c (device_interrupt_detach) : New, Ditto + * device.c (device_child_interrupt_attach) : New, Ditto + * device.c (device_child_interrupt_detach) : New, Ditto + + * device.c (device_attach_interrupt) : Delete old + * device.c (device_detach_interrupt) : Delete old + * device.c (device_interrupt) : Delete old + * device.c (device_interrupt_ack) : Delete old + + * device_table.c (unimp_*) : Update to match + + * device_table.c (icu_io_write_buffer_callback) : Update to use + interface. + * device_table.c (icu_interrupt_event_callback) : Ditto + +Wed Jan 17 18:18:40 1996 Andrew Cagney + + * device.c (external_to_device) : New function that provides a + standard mapping between a devices internal representation (a + pointer) and its external (or what is passed to a client) + representation (a phandle). Implement using the cap object + attached to the root node. + + * device.c (device_to_external) : Ditto + * device.c (external_to_device_instance) : Ditto but for ihandle + and device instance. + * device.c (device_instance_to_external) : Ditto + + * Makefile (device.o): Add dependency on cap. + + * emul_chirp.c (struct _emul_chirp_data) : Elimate use of cap. Code + needing to translate between internal and external representations + changed to use the external_to_device et.al. device operations. + * emul_chirp.c (chirp_emul_*) : Ditto + + * Makefile (emul_chirp.o): Remove dependency on cap + +Tue Jan 9 15:10:27 1996 Andrew Cagney + + * emul_bugapi.c (emul_bugapi_instruction_call) : Make format type + correct. + * emul_chirp.c (map_over_chirp_note) : Ditto + * emul_chirp.c (chirp_emul_test) : Ditto + * device_table.c (register_init): Ditto + +Tue Jan 9 14:16:26 1996 Andrew Cagney + + * configure.in: Make disable-sim-switch default. Switch only + useful if using --enable-sim-opcode=ppc-opcode-stupid and then + only marginally so. + +Mon Jan 8 12:17:22 1996 Michael Meissner + + * device_table.c (register_init): Make format type correct. + +Sat Jan 6 10:13:26 1996 Andrew Cagney - aka Noid + + * emul_chirp.c (map_over_chirp_note): Tighten up (and fix) checks + on OpenBoot note section. + +Fri Jan 5 20:28:53 1996 Andrew Cagney + + * emul_generic.c (emul_write_buffer): Use vm faulting byte + read/write calls for buffer transfers. This will cause a fault to + occure if the transfer fails. CHRP catches the fault while the + others suffer the consequences. + (emul_read_buffer): Ditto. + (emul_write_word): Ditto. + (emul_read_word): Ditto. + (emul_read_string): Ditto. + +Fri Jan 5 18:55:34 1996 Andrew Cagney + + * emul_chirp.c (emul_chirp_create, emul_chirp_instruction_call), + emul_generic (emul_blr_instruction): Use a real blr instruction to + return from a client service call. + + * emul_chirp.c (services): Add all OpenBoot services to table. + + * emul_generic.h, emul_bugapi.c (emul_bugapi_create), emul_chirp.c + (emul_chirp_create) : Use names instead of numbers for + instructions being stored in memory. + +Fri Jan 5 18:52:28 1996 Andrew Cagney + + * Makefile.in (maintainer-clean): Remove .log, core and *.core + (From NetBSD) files. + +Wed Jan 3 19:21:46 1996 Andrew Cagney + + * emul_bugapi.c (emul_bugapi_create): Add nodes to init the + system-call trap to the emul instruction call instruction (Along + with an rfi and infinate loop). + + * emul_bugapi.c (emul_bugapi_instruction_call): Expand to include + a few real PPC bug calls. Test with simple hello world. + +Tue Jan 2 20:51:19 1996 Andrew Cagney - aka Noid + + * device.h, device.c (device_child, device_sibling): New + functions. Return corresponding device value. + + * emul_chirp.c (chirp_emul_child, chirp_emul_peer, + chirp_emul_parent): New functions - emulate corresponding OpenBoot + interfaces. + + * device_table.c (register_init): Extend properties attached to + register init node to allow a specific processor's register to be + specified. + + * emul_chirp.c (emul_chirp_create): Init SMP correctly - the + initial PC for all processors is an infinate loop but then, for + processor zero, is quickly changed to be the correct code starting + address. + + * emul_chirp.c (emul_chirp_create): Add fake bootpath + et.al. properties to tree. + + * emul_chirp.c (chirp_emul_getproplen): New function. Emulate the + getproplen OpenBoot call. + + * emul_chirp.c (emul_chirp_instruction_call): Document other + possible chirp emulation internal states. + + * emul_chirp.c (emul_chirp_instruction_call): Trace failed lookups + as well as successful ones. + + * emul_chirp.c (emul_chirp_open): New function - handle open + client call. + + * Makefile.in (maintainer-clean): Proper rule that eliminates more + junk. + +Tue Dec 19 13:00:11 1995 Andrew Cagney + + * emul_chirp.c (chirp_emul_exit): Full out call. + + * device_table.c (htab_map_page): Wasn't handling byte swap when + creating entries in the hash table. + + * device.c (device_tree_find_node): Allow primative wild-card match + of device names with the path. + +Mon Dec 18 19:58:56 1995 Andrew Cagney - aka Noid + + * emul_chrp.c (chirp_emul_write, chirp_emul_finddevice): add + better tracing. + + * emul_chrp.c: Change return type of emul functions to int. Emul + functions either return -1 or zero so unsigned was a bit + dangerous. + + * inline.h (*), igen.c, dgen.c, *: Update INLINE macros so that + they are paramaterised with the type of the function. Gets around + the problem of `static' needing to come first with `attribute' + comming last. Format declarations and definitions so that emacs + doesn't get confused. + +Fri Dec 15 17:06:44 1995 Andrew Cagney + + * std-config.h (PSIM_INLINE): Add missing inline configuration + control for the main loop. + + * mon.c (mon_print_info): If monitoring disabled still print out + the number seconds used. + + * psim.c (run_until_stop): Don't monitor the cache misses when + monitoring is disabled. + + * configure.in (sim_mon, sim_monitor): Correct typo - sim_mon -> + sim_monitor for shell variable (or should that have been the other + way around?). + + * vm.c (vm_synchronize_context): Fix wrong test for unsuported + change in endian-mode. + + * std-config.h (WITH_REGPARM), inline.h (IDECODE_INLINE, + SEMANTICS_INLINE): Add -DWITH_REGPARM= option. Enables the + __attribute__((__regparm(WITH_REGPARM))) for some functions. + configure with --enable-sim-cflags="-DWITH_REGPARAM=3" (say). + Unfortunatly it tickles a bug (gcc?) and can't be used. + + + +Mon Dec 18 13:36:06 1995 Michael Meissner + + * device.c (device_tree_add_device): Make trace fprintf arguments + type correct. + * device_table.c (htab_decode_hash_table): Ditto. + (htab_map_binary): Ditto. + (htab_init_callback): Ditto. + * vm.c (om_virtual_to_real): Ditto. + +Sat Dec 16 09:54:18 1995 Michael Meissner + + * emul_netbsd.c (emul_netbsd_create): Deal with new BFD that + changed how big/little endian support is recorded, while remaining + compatible with the old BFD with #ifdefs. + * emul_chirp.c (emul_chirp_create): Ditto. + * emul_bugapi.c (emul_bugapi_create): Ditto. + +Fri Dec 15 15:55:56 1995 Michael Meissner + + * std-config.h (MODEL_INLINE): Turn off INLINE_MODULE by default. + + * corefile.h: Delete declarations for unknown functions. + * device.h: Ditto. + * interrupts.h: Ditto. + * interrupts.c: Ditto. + +Thu Dec 14 18:49:34 1995 Andrew Cagney + + * lf.c (lf_print_function_type): New function. Munges a function + type so that the prefix (eg INLINE...) is inserted after the type + but before any `*'. + + * igen.c: Change to output functions using this. + +Wed Dec 13 23:47:00 1995 Andrew Cagney - aka Noid + + * options.c (options_inline): Function to output meaningful + description of the INLINE options. + + * configure.in (inline): Replace inline magic numbers with macro + names. Map 1->LOCALS_INLINE and 2->ALL_INLINE. + + * inline.h, inline.c: update to use inline method. + + * std-config.h (CPU_INLINE), cpu.h, inline.h, inline.c: make cpu.h + inline always. + + * std-config.h (EVENTS_INLINE): Inline events in psim. + +Wed Dec 13 22:01:21 1995 Andrew Cagney - aka Noid + + * device_table.c (htab_sum_binary): DMA binaries to correct byte + within a page. + +Tue Dec 12 22:51:18 1995 Andrew Cagney - aka Noid + + * psim.c (psim_merge_device_file): Change `=' to `==', was this an + error? + +Tue Dec 5 11:56:14 1995 Andrew Cagney + + * ppc-instructions (ppc_nr_mtcrf_crs, ppc_branch_conditional_name, + ppc_function_unit_name): Simplify by declaring these arrays as + pure and simple static (instead of STATIC_MODEL). + +Tue Dec 5 00:45:34 1995 Andrew Cagney + + * sim_calls.c (sim_create, sim_load), main.c (main), psim.c: Pass + an options device into psim_create() so that options can be merged + into the tree. + + * device.c (*add*): Change semantics so the add functions only add + when the new device (or property) doesn't already exist. This + allows merging of options and data. + +Mon Dec 4 17:12:13 1995 Andrew Cagney + + * Makefile.in (BASICS_H): Didn't include basics.h in the list of + header files to depend on. + +Mon Dec 4 17:12:13 1995 Andrew Cagney + + * std-config.h: (*_MODULE): Extend the _inline macro's so + that they also allow control over static functions. Rewrite + document to reflect this. + + * std-config.h: (INLINE): Simplify definition, the above and + earlier changes to igen.h eliminate the need to be defensive about + enabling the inline of static functions. + + * std-config.h: (SIM_ENDIAN_INLINE, BITS_INLINE): Document limited + suport for inlineing of modules for all callers. Adjust relevant + macro's so that DEFAULT_INLINE will enable this. + + * basics.h: Re-order #includes and definitions so that c-code for + basic include files does not call functions delcared in later + #includes. + + * basics.h (__attribute__), sim_callbacks.h: Move attribute macro + to basics.h and add hack (include ) to try and bring that + and other possible conflicting macros into scope much earler. + + * sim-endian.h,c (SIM_ENDIAN_INLINE) bits.h,c (BITS_INLINE): + Change to use the updated inline definitions. If enabled + immediatly include the corresponding c-code so that it will inline + for all modules. + + * inline.h, inline.c (SIM_ENDIAN_INLINE, BITS_INLINE): Remove + these cases, moved to module specific header files. + +Sat Dec 2 18:37:51 1995 Andrew Cagney + + * vm.c, vm_n.c: Fix htab code. + + * vm.c (vm_data_map_read_buffer): Was using EA not RA when reading + the data from core. + + * device.c: Fix htab create code. + +Fri Nov 24 23:10:09 1995 Andrew Cagney + + * bits.h, bits.c (EXTRACTED): Convert to function, fix - had && + instead of &. + + * sim-endian.h (SWAP_N), sim-endian-n.h, sim-endian.c: How + embarasing - fix yet another bug in the swap code! Simplify + everything by using more functions. Add host to big-endian byte + swapping support. + +Fri Nov 24 23:10:09 1995 Andrew Cagney + + * devices.h, devices.c: delete, replaced by the files + device_table.[ch] and device.[ch]. + * device_tree.h, device_tree.c: ditto + + * device_table.h, device_table.c: New files. Contain a table of + devices. + + * device.h, device.c, Makefile.in, std-config.h (DEVICE_INLINE), + options.c (print_options): New files. Define the device object + along with any attached properties. + + * device_tree.h, device_tree.c: Update to use new device object. + For convenience, change the printd functions into device_tree_add + functions. + + * psim.c (create_*_tree): Use new device_tree create functions. + + * corefile.h, corefile.c corefile-n.h (core_n.h): Update to use + the new device.h / device_table.h interface. Rename core_n.h to + corefile-n.h to be consistent with other n files. + + * Makefile.in (run): add corefile-n.h to dependencies for + corefile. + + * basics.h (device_instance), device.h, device.c, device_table.h, + device_table.c: Add the concept of a device instance and operators + on these instances - corresponds to ihandle in OpenBoot speak. + Don't yet implement it. + +Tue Nov 14 12:27:08 1995 Andrew Cagney + + * emul_generic.h, emul_generic.c (emul_syscall_enter, + emul_syscall_exit): rename from emul_enter_call / + emul_exit_call. As only used by emul_do_system_call simplify + associated code. + + * os_emul.h, os_emul.c, emul_generic.h: Correct and fill an + os_emul interface. + + * os_emul.c, emul_bugapi.h, emul_bugapi.c, Makefile.in: Add + preliminary hooks for a kernel mode rom emulation. + + * cap.h (new), cap.c (new): Capability data base. Some emulations + pass object identifiers (capabilities?) to/from the simulated code + (for instance the phandle in OpenBoot). The cap object is able to + check/map between internal and external (target program) + representations of each identifier. + + * os_emul.c, emul_chirp.h, emul_chirp.c, Makefile.in: Add + preliminary hooks for a kernel mode IEEE-1275 emulation. + + * cpu.h, cpu.c (cpu_create, cpu_os_emulation, cpu): Add os_emul to + list of arguments passed in when creating a cpu. Grant access to + the element. + + * std-config.h (OS_EMUL_INLINE), options.c (print_options), + inline.h, inline.c: New to allow control over inline of + corresponding code files. + + * ppc-instructions (instruction_call): Add illegal instruction to + call the instruction-call emulation handler. + + * interrupts.c (system_call_interrupt): Call renamed + os_emul_system_call function(). + + * emul_netbsd.c: Update to interface to generic emulation. Since + all its functions are called via a table don't worry about any + inline. + + * emul_generic.h, emul_generic.c, spa-*(delete): Remove references + and code for spa, no longer to be used. + + * psim.c (create_chirp_device_tree): Fill out what was previously + the openboot create function so that it starts to create a full + OpenBoot device tree. + +Tue Nov 28 21:48:06 1995 Andrew Cagney + + * debug.h, debug.c: pte trace is made redundant by htab trace, + delete it. Add vm to list of options. Simplify tracing output so + lines are not as long. + +Tue Nov 14 12:27:08 1995 Andrew Cagney + + * events.h, events.c (event_queue_init), psim.c (psim_init): (re) + initialize the event queue. + + + + + + +Tue Nov 28 13:38:26 1995 Michael Meissner + + * sim-endian.h: Look at WORDS_BIGENDIAN to determine if the host + is big endian or little endian. For SWAP_n, use htonl/htons if + host is little endian, not big endian and if WITH_NTOH is defined. + + * configure{,.in} (--enable-sim-model-issue): Instead of defining + 0/1, define it to be MODEL_ISSUE_{PROCESS,IGNORE}. Add + AC_C_BIGENDIAN to determine if the host is big endian or not. + * config.in: Regenerate. + + * std-config.h (WITH_MODEL_ISSUE): Default to 0. + (CURRENT_MODEL_ISSUE): Reference WITH_MODEL_ISSUE, and if that is + 0, use current_model_issue. + (MODEL_ISSUE_{PROCESS,IGNORE}): Define as -1/1. + + * psim.c (current_model_issue): New global variable. + + * cpu.c (cpu_create): Use CURRENT_MODEL_ISSUE > 0 instead of + WITH_MODEL_ISSUE. + (cpu_{init,halt}): Ditto. + * mon.c (mon_print_info): Ditto. + * ppc-instructions (PPC_INSN_* macros, branch handling): Ditto. + + * mon.c (mon_print_info): Print instructions/second if verbose > 0, + rather than > 1. + + * main.c (main): Set current_model_issue to MODEL_ISSUE_PROCESS if + the -I switch is used. + * sim_calls (sim_open): Ditto. + + * ppc-instructions (model support): Add support for determining + when we don't have enough writeback slots. Add tracing for the + beginning of each cycle. + +Mon Nov 27 17:46:33 1995 Michael Meissner + + * mon.c: Check for whether to include sys/types.h and sys/time.h. + + * configure.in: Check for include files sys/types.h and + sys/time.h. + * configure: Regenerate. + * config.in: Regenerate. + + * cpu.h (CONST_ATTRIBUTE): Define as __attribute__((__const__)) if + not already defined. + (cpu_system): Use CONST_ATTRIBUTE, so that when we're not inlining + the world, the optimizer has a fair chance of CSE'ing function + calls. + (cpu_{monitor,nr,registers,model}): Ditto. + + * std-config.h (MODEL_INLINE): If not defined, define as 1 if + DEFAULT_INLINE is non-zero, 0 otherwise, rather than just the + value of DEFAULT_INLINE. + +Fri Nov 24 11:24:34 1995 Michael Meissner + + * lf.h (__attribute__): If not GCC and at least 2.7.0, define as + nothing. + (lf_printf): Add printf __attribute__, so the compiler will + automatically check the format string. + + * configure{,.in} (--enable-sim-icache): If argument is define, + add -R to flags passed to igen. + + * igen.c (stdlib.h): Include if the system supplies one. + (semantics_use_cache_struct): New global for -R flag to say + semantics is to use the cache structure directly rather than + putting the values into local variables. + (first_undef, last_undef): New structures to remember names to + #undef if -R. + (lf_print_c_extraction): If -R and this is semantics, emit names + as #defines pointing to the cache structure, rather than loading + the values into local variables. + (lf_print_c_semantic_function): If -R, #undef all of the names + defined in lf_print_c_extraction. + (main): Recognize -R. + + * idecode_fields.h (SPR_*): Redefine spr_* macros as SPR_* to + avoid a name confict if -R passed to igen. + + * ppc-instructions (mfspr, mtspr): Rename spr field to SPR. + (model_data): Add field to count the various # of CRs that the + mtcrf instruction used. + (model_mon_info): Return structures counting the # of CRs that the + mtcrf instruction used. + (branches, sync instructions): Do not call model functions if + WITH_MODEL_ISSUE is 0. + + * mon.c (stdlib.h): Include if the system supplies one. + (mon_sort_instruction_names): New function to sort instruction + names alphabetically. + (mon_print_info): Call qsort with mon_sort_instruction_names to + sort instruction names. Don't abort if WITH_MODEL_ISSUE is 0. + + * debug.h (ITRACE): Make printf_filtered arguments type correct. + * idecode_expression.h (CR0_COMPARE): Ditto. + * psim.c (psim_read_register): Ditto. + + * igen.c (lf_print_my_prefix): Use __attribute__((__unused__)) to + silence compiler warnings about unused automatically generated + variables. + (lf_print_c_extraction): Ditto. + * idecode_expression.h (FPSCR_BEGIN): Ditto. + + * ppc-cache-rules: Define rules for making a bitmask for all + registers. + + * ppc-instructions: Rewrite model specific functions to use the + bitmask of the register number, instead of using the register + pointer to get the register number, and then making the bitmask. + +Wed Nov 22 15:24:27 1995 Michael Meissner + + * ppc-instructions (model_branches): Add conditional argument to + count the number of times each type of conditional branch is used. + (conditional branches): Pass B0 or -1 to model_branches. + (model_mon_info): Print out conditional branch counts. + (model-data): Add support for printing out conditional branch + types. + +Tue Nov 21 16:31:25 1995 Michael Meissner + + * igen.c (insn_table_load_insns): Add support for model-static for + internal functions that should not be inlined. + (lf_print_c_semantic): Remove model_cleanup. + (gen_model_{c,h}): Ditto. + + * ppc-instructions: Redo model specific support once again. Add + floating point support to the model specific information. Flesh + out all of the floating mutiply add/subtract instructions. Add + better tracing support to the model specific information. + +Sun Nov 19 23:00:52 1995 Michael Meissner + + * ppc-instructions (model data, model_busy): Rather than using a + bit mask for the busy units, just use a char array. Also, only + support 2 function units an insn can use, rather than a loop. + +Fri Nov 17 14:08:08 1995 Michael Meissner + + * table.c (table_entry_read): Move setting entry->line_nr to after + the model specific fields so the line numbers for the annex are + correct. + + * cpu.c (cpu_{create,init,halt}): Check for WITH_MODEL_ISSUE + before calling the model functions. + + * debug.c (trace_descriptor): Add trace_model support. + * debug.h (trace_options): Ditto. + + * igen.c (gen_icache_h): Create type idecode_cache as void if not + caching instructions. + (gen_model_{c,h}): Drop model_issue support. Add support for + model_cleanup. + (lf_print_my_prefix): Initialize a const itable_index with the + current index. + (lf_print_c_semantic): Call model_cleanup at the end of the + function to check for instructions that aren't supported yet by + the scheduling code. + + * mon.h (count_type): New type for counters. + * mon.c: Use count_type instead of unsigned. + + * ppc-instructions: Redo scheduling code once again. Make it all + inline friendly. Instead of having general code emitted by igen, + go the route of having each semantic routine call the appropriate + module. + +Thu Nov 16 09:52:26 1995 Michael Meissner + + * table.c (table_entry_read): Allow the annex to have blank lines. + + * ppc-instructions: Change lines in model stuff that just have a + tab to just newline. Add 601 support. Document most instructions + in terms of model specific timing information. Drop 'FUNCTION' + from PPC_FUNCTION_UNIT_xxx enums. Change PPC_UNIT_UNKNOWN -> + PPC_UNIT_BAD. Add TRACE(trace_tbd) for all data cache + instruction.s. Signal illegal instruciton if data cache block + invalidate is issued from problem state. + + * igen.c (max_model_fields_len): New static to keep track of the + max size for the model specific fields. + (model_c_insn): Use max_model_fields_len to size fields. + (insn_table_insert_insn): Set max_model_fields_len. + (model_table_insert): Ditto. + (gen_model_{c,h}): Model_issue is now called with a processor + argument. + + * debug.c (trace_description): Add support for trace_tbd. + + * mon.c (mon_issue): Pass processor argument to model_issue. + + * Makefile.in: Delete all function unit support, since the newer + table driven model support replaces it. + * cpu.{c,h}: Ditto. + * mon.c: Ditto. + * inline.{c,h}: Ditto. + * std-config.h: Ditto. + * options.c: Ditto. + * configure{,.in}: Ditto. + * Makefile.in: Ditto. + * psim.c: Ditto. + * function_unit.{c,h}: Delete these now usused files. + + * std-config.h (WITH_MODEL_ISSUE): Add new macro on whether to + trace instructions in a model specific manor. + * options.c (print_options): Print it out. + * configure{,.in}: Add --enable-sim-model-issue option. + * Makefile.in: Add --enable-sim-model-issue flags. + * igen.c (lf_print_c_semantic): Add call to mon_issue here. Check + for WITH_MODEL_ISSUE. + * mon.c (mon_issue): Remove call to mon_issue_here. + + * ppc-instructions: Move branch tracing to the actual branch + instructions, rather than testing it in model_issue. Add code to + code successful/unsuccessful branch predictions, and the number of + conditional branches that fell through. + +Wed Nov 15 17:32:13 1995 Michael Meissner + + * cpu.h (cpu_model): Add declaration. + + * cpu.c (struct _cpu): Add model_ptr to hold model specific + information. + (cpu_model): Return the model internal pointer. + (cpu_{create,init,halt}): Call the appropriate model function. + + * inline.c (mon.c): Move include of mon.c after model.c. + + * mon.c (_cpu_mon): Add fields to count unaligned memory + references. + (mon_issue): Call model_issue, not function_unit_issue. + (mon_{read,write}): Count # of unaligned memory accesses. + (mon_print_info): Switch to calling model_mon_info and + model_mon_info_free instead of function_unit version. Print out + number of unaligned reads/writes. + + * {ppc-instructions,igen.c}: More global changes to add model + specific features. + + * inline.{c,h}: Provide for inlining options.c. + * options.{c,h}: Ditto. + * std-config.h: Add OPTIONS_INLINE. + +Tue Nov 14 04:47:25 1995 Michael Meissner + + * Makefile.in (devices.o, main.o): Update dependency. + + * igen.c (gen_model_h): Use correct variable in loop. + (gen_model_c): Use strcmp, strcasecmp. + (gen_model_c): Use EXTERN_MODEL for arrays. + (gen_model_h): Use STATIC_MODEL for arrays. + (lf_print_c_semantic_function_header): Delete unused function. + + * main.c (cpu.h): Include cpu.h to get model.h. + + * inline.h ({EXTERN,STATIC}_MODEL): Define. + +Mon Nov 13 09:14:13 1995 Michael Meissner + + * igen.c ({insn,model}_table_fields): Spell mnemonic correctly. + (gen_itable_h,itable_c_insn): Ditto. + (model support): Move model support around, add support for + model-data, model-internal. Use annex field for model-macros + now. + + * configure.in (--enable-sim-inline): If --enable-sim-inline=no, + also define INLINE as nothing. + * configure: Regenerate. + + * std-config.h (INLINE): Rather than nuking INLINE, only define it + as __inline__ if any of the INLINE flags are non-zero. + + * options.c (print_options): Print out WITH_XOR_ENDAIN. + +Mon Nov 13 23:03:45 1995 Andrew Cagney + + * ppc-instructions (rfi): Add missing code. + + * cpu.c (cpu_get_time_base): Fix calculation of current value of + time base register. + + * ppc-spr-table (TBL, TBU): Fix TBL/TBU entries - was confusing + m[tf]tb with m[tf]spr. + + * ppc-instructions (mtspr, mfspr): Fix mttbl - wasn't storing + lower word. + +Mon Nov 13 21:35:37 1995 Andrew Cagney + + * std-config.h (INLINE, STATIC_INLINE): Was being set to static + inline.. Only problem being that with ppc-opcode-simple this gave + it the chance to inline all the idecode functions with potentially + disasterous results on a 16mb PC. For moment hobble INLINE. + + * configure.in, std-config.h (WITH_SMP): Make that 5 processors by + default ... + + * configure.in: Tweek flags passed to gcc for --with-sim-warnings. + Firstly make them errors and secondly remove the options gcc-245 + doesn't reconize. + +Mon Nov 13 17:57:24 1995 Andrew Cagney + + * misc.c (zalloc), cpu.c (cpu_init), devices + (console_io_read_buffer_callback, icu_io_read_buffer_callback, + vm_io_read_buffer_callback), main.c (zalloc), mon.c (memset), + sim_calls.c (zalloc) : replace bzero() with memset(). + + * emul_netbsd.c (write_direntries), psim.c (psim_read_register, + psim_write_register): replace bcopy() with memcpy(). + +Sun Nov 12 20:55:41 1995 Andrew Cagney + + * configure.in: for --disable-sim-inline (--enable-sim-inline=no), + force DEFAULT_INLINE to 0 rather then trusting the std + configuration. + +Sun Nov 12 20:55:41 1995 Andrew Cagney + + * igen.c (lf_print_idecode_table, idecode_table_leaf): Fix + generation of switch entries in tables - treat the same as + cracking/semantic functions. + + * igen.c (idecode_switch_end, idecode_switch_leaf): Fix generation + of a boolean switch statement (field zero or non-zero). + + * ppc-opcode-test-1, ppc-opcode-test-2: New files. These test the + switch/table generation ability of igen. + + * igen.c (idecode_switch_leaf): Fix code output when a switch + statement needs to look up a table. + + * igen.c (idecode_declare_if_switch): New function called from + gen_idecode_c - need to declare any idecode switch functions + before they are used in idecode tables. + + * igen.c (lf_print_c_cracker_function, idecode_crack_leaf, + idecode_crack_insn): Add is_inline_function argument to code + printing cracker functions which indicates if STATIC_IDECODE or + STATIC_INLINE_IDECODE should be used for definition. For + idecode_crack_insn (which implies not duplicating/expanding) don't + declare function as inline - we assume that the only time this is + code is generated is when things are being tested. For + idecode_crack_leaf, make static (instead of INLINE) if the + instructions parent is a table as function will always be called + via a table. + + * igen.c (idecode_expand_if_switch): Declare as STATIC_IDECODE not + STATIC_INLINE_IDECODE. Only the outermost idecode switch will be + called directly, all others are called via a table. + + * igen.c (lf_print_semantic_function_header, semantics_h_leaf, + semantics_h_insn, semantics_h_function, + lf_print_c_semantic_function, semantics_c_function): Add + is_inline_function argument to lf_print_semantic_function_header + to indicate if an inline or static function declaration/definition + should be output. Depending on situtation call accordingly: + functions (not instruction semantic routines) are always inline; + Semantic routines are made inline when there is no icache (cache + will contain the function address) and are duplicating (see above) + and the parent of the instruction is a switch statement. + + * igen.c (opcode_field_new): Delete. Code changed to use ZALLOC + and moved to insn_table_find_opcode_field. + + * table.c (table_open): Fix typo (nr_model_fields vs nr_fields). + + * igen.c (model_c_insn): Suggestion - document the name of the + instruction on each line of the instruction model table. + +Fri Nov 10 00:44:38 1995 Andrew Cagney + + * emul_netbsd.c (do_ioctl): Cleanup compilation. + + * sim_callbacks.h (__attribute__): Only define if not defined (was + already defined on NetBSD host). + +Wed Nov 8 21:49:52 1995 Andrew Cagney + + * std-config.h (WITH_XOR_ENDIAN), configure.in, Makefile.in: New + macro, indicates if the PowerPC's horrible XOR endian mode should + be suported. Add to configure and make. + + * vm_n.h (vm_data_map_read_N, vm_data_map_write_N), vm.c + (vm_instruction_map_read): If XOR endian, xor the address + with a value from an xor table (indexed by size of access). + + * vm.c (vm_synchronize_context), cpu.c (cpu_synchronize_context): + set up xor table to xor if there is a conflict between the + CURRENT_TARGET_ENDIAN and the endian indicated in the MSR. Move + check of suported change of endian mode from cpu.c to vm.c. + + * vm.c (vm_data_map_write_buffer, vm_data_map_read_buffer): + Hopefully added correct hack to handle XOR endian mode. + + FIXME: If NONSTRICT alignment and XOR ENDIAN and MSR indicates + little endian mode, the model accepts miss aligned transfers. + + FIXME: Need to create an `init' device that, during + initializatioin for XOR mode, it mushes (XOR address) all the dma + data before passing it on to the core for storage. Just like the + real thing really. + +Wed Nov 8 21:49:52 1995 Andrew Cagney + + * devices.c (halt_io_write_buffer_callback): Use value written to + halt device to determine exit status. Thus allowing + success/failure of OEA tests. + +Wed Nov 8 00:10:38 1995 Andrew Cagney + + * ppc-instructions (icbi): If icache present flush it. + +Tue Nov 7 23:36:31 1995 Andrew Cagney + + * devices.c (htab_init_callback): Add code to create htab/pte. + + * devices.c (dma_file, file_init_callback, htab_init_callback): + New function - Dma the named file into memory at the specified + address. Use. + + * device_tree.h, device_tree.c (scand_*): New functions. + +Tue Nov 7 23:36:31 1995 Andrew Cagney + + * filter_filename.c, Makefile.in: Change so that only dependant on + a very limited nr of files. Stops an unnecessary dependency. + +Tue Nov 7 15:44:33 1995 Andrew Cagney + + * core.c (core_map_find_mapping): Use cpu_halt rather than error + to abort an access to an undefined address. + +Sun Nov 12 07:58:09 1995 Michael Meissner + + * igen.c (model_table_insert_{macro,function}): New functions. + (insn_table_load_insns): Call them. + (gen_model_h): Move section emiting model-macros to be first. + (model_{c,h}_function): New functions cloned from semantic + functions to print out the prototype and function for + model-functions. + (gen_model_{c,h}): Print out model-functions. + + * ppc-instructions (model_{start,halt,print_info}): Add dummy + model-functions. + + * options.c (print_options): Print out WITH_{,DEFAULT_}MODEL, not + WITH_PPC_{,DEFAULT_}_MODEL. + (options_ppc): Delete now unused function. + (cpu.h): Include cpu.h, not just basics.h. + + * std-config.h (WITH_{,DEFAULT_}MODEL): Define. + + * igen.c (model_macros, last_model_macro): New statics to keep + track of macros to go in model.h. + (insn_table_load_insns): Add model-macros to model_macros linked + list. + (model_table_fields): Add field for printable name. + (gen_model_h): If there are model macros defined, print them out. + Print out DEFAULT_MODEL as the first model if there any models + specified, otherwise MODEL_NONE. Print out external decl for + current_model. Print out decl for model_set. + (gen_model_c): Add function model_set. Switch to use printable + name for the model, not the internal identifier used. + + * psim.c (current_model): New global variable. + + * ppc-instructions: Add macros for flag defines. Switch first + model so 604 is first. + + * main.c (main): Call model_set, not function_unit_model. + * sim_calls.c (sim_open): Ditto. + * sim_calls.c, Makefile.in: sim_calls.c now includes cpu.h. + +Sat Nov 11 07:27:41 1995 Michael Meissner + + * mon.h (mon_events): New enumeration for other events we want to + handle. + (mon_event): Add declaration for function. + + * mon.c (mon_event): New function. + (mon_print_info): Print icache misses. + + * psim.c (run_until_stop): Monitor icache misses. + + * configure.in (--enable-sim-inline): Fix typos in handling comma + separated inline options. + (--enable-sim-icache): Echo icache size. + * configure: Regenerate. + + * igen.c (semantics_h_print_function): Emit STATIC_SEMANTICS + instead of INLINE_SEMANTICS so that the compiler won't keep all of + the semantic functions as inline RTL, given that the address of + the function is taken which forces outline calls anyway. + (lf_print_c_semantic_function_header): Ditto. + (gen_semantics_h): Define STATIC_SEMANTICS as nothing if not + defined. + (lf_print_c_cracker_function): Emit STATIC_IDECODE instead of + STATIC_INLINE_IDECODE. + (gen_idecode_c): Define STATIC_IDECODE if not defined. + (gen_model_h): Use #ifdefs to define types to hold model units, + cycles, and flags. + (model_table_insert): Add a sentinel functional unit at the end to + simplify loop processing. + (model_c_insn): Use _SENTINAL instead of 0 for any + instruction not specifing a function unit for the current model. + (gen_model_{c,h}): Provide bounds for model_time_mapping. + + * inline.h (STATIC_SEMANTICS): Define to be static if + SEMANTICS_INLINE is defined. + (STATIC_IDECODE): Define to be static if IDECODE_INLINE is + defined. + + * options.c (print_options): Fix typo. + +Fri Nov 10 06:39:46 1995 Michael Meissner + + * configure.in (--enable-sim-{opcode,config}): Use $srcdir when + check for the existence of files. + * configure: Regenerate. + + * table.c (table): New field nr_model_fields. + (table_open): New parameter nr_model_fields. + (table_entry_read): Parse model fields that begin with a '*' after + each instruction. + * igen.c, dgen.c: Change callers of table_open. + + * igen.c: Add support for dumping model specific information in + model.h and model.c. + (insn_field_name): Delete unused array. + (global variables): Make global variables static, so we can tell + when they are no longer used. + (cache_semantic_actual): Delete unused variable. + (insn_table_load_insns): If the insn is really a machine model, + call model_table_insert instead of other processing. + (model_table_insert): New function to handle defining the + functional units of a particular machine model. + (insn_table): Add last_function field so we can add functions at + the end. + (insn_table_insert_function): Use last_function field when + appending new function. + + * ppc-instructions: Add a few model specific information for 603, + 603e, and 604 for testing purposes. + + * table.h (table_model_entry): New linked list to hold model + specific information, one per line. + (table_entry): Add model_first, model_last fields. + + * configure.in (--enable-sim-inline): If gcc is found and + --enable-sim-inline is not specified, defaine DEFAULT_INLINE to 1, + not 2. + (--enable-sim-reserved-bits): New switch to check whether reserved + bits are set in the instruction. + (--enable-sim-opcode): Make complex the default. + (all switches): Add appropriate checks and error messages. + * configure: Regenerate. + + * Makefile.in (RESERVED_CFLAGS): New variable set by + --enable-sim-reserved-bits. + (CONFIG_CFLAGS): Include RESERVED_CFLAGS. + (BUILT_SRC): igen now generates model.c and model.h. + (LIB_OBJ): Include table.o. + (tmp-igen): Add -m/-M options to write model.c/model.h. + (model.o): New object. + (CPU_H): Include model.h. + + * cpu.h: Include model.h. + + * std-config.h (WITH_RESERVED_BITS): Define. + (MODEL_INLINE): Ditto. + + * options.c (print_options): Print out WITH_RESERVED_BITS. + +Thu Nov 9 12:22:15 1995 Michael Meissner + + * configure.in: If --silent, don't output information messages. + * configure: Regenerate. + + * configure.in (--enable-sim-alignment): Fix typo in specifing non + strict alignment. + (--enable-sim-switch): Make default on. + (--enable-sim-duplicate): Make default on. + (--enable-sim-smp): Make default 0. + (--enable-sim-mon): Don't set sim_float if not set. + (--enable-sim-inline): If gcc is found and --enable-sim-inline is + not specified, define DEFAULT_INLINE to be 2. + (all --enable-sim-* rules): Echo rules set to non empty to file + descriptor 6. + * configure: Regenerate. + + * options.c (options_env): Fix typo if WITH_ENV is 0. + (print_options): Print GCC compiler version if available and + date/time options was compiled. If OPCODE_RULES, IGEN_FLAGS, + and/or DGEN_FLAGS are defined, print them. + + * Makefile.in (all link actions): Pass SIM_CFLAGS as well as + CFLAGS. + (options.o): Compile options.o with OPCODE_RULES, IGEN_FLAGS, and + DGEN_FLAGS defined, so they can be printed out. + + * igen.c (lf_print_c_validate): Check for WITH_ASSERT, so that + this test can be compiled away if the user really wants a fast + simulator by not doing assertion failures. + +Wed Nov 8 13:19:47 1995 Michael Meissner + + * options.c: New file to print out all of the WITH_ options. + * options.h: New include file to declare print_options. + * debug.h (trace_options): Add trace_opts to call print_options. + * debug.c (trace_description): Add trace_opts support. + * main.c (main): If user requested options, print them. + * sim_calls.c (sim_open): Ditto. + + * igen.c (opcode_field_new): Add void to make it a proper prototype. + + * emul_generic.c (emul_enter_call): Make printf_filtered arguments + type correct. + * emul_netbsd.c (do_kill): Ditto. + * registers.c (registers_dump): Ditto. + * vm.c (om_translate_effective_to_real): Ditto. + * vm_n.h (vm_data_map_read_N): Ditto. + (vm_data_map_write_N): Ditto. + * devices.h (DTRACE_INIT): Ditto. + (DTRACE_{ATTACH,DETACH}_ADDRESS): Ditto. + (DTRACE_IO_{READ,WRITE}_BUFFER): Ditto. + (DTRACE_DMA_{READ,WRITE}_BUFFER): Ditto. + * devices.c (update_for_binary_section): Ditto. + (write_stack_arguments): Ditto. + (stack_ioctl_callback): Ditto. + * device_tree.c (device_tree_add_passthrough): Ditto. + (device_tree_{add,find}_device): Ditto. + (device_tree_{add,find}_integer): Ditto. + (device_tree_find_{string,boolean}): Ditto. + (device_tree_init{,_device}): Ditto. + (device_tree_dump): Ditto. + * sim_calls.c (sim_{read,write}): Ditto. + (sim_{fetch,store}_register): Ditto. + (sim_stop_reason): Ditto. + + * sim_callbacks.h (printf_filtered): Declare with attribute + printf, so we can enable format checks. + + * devices.c (console_io_{read,write}_buffer_callback): Cast swtich + argument to int, since ANSI doesn't allow long switch values. + * emul_netbsd.c (do___sysctl): Ditto. + + * emul_netbsd.c (do___sysctl): Fix up printf call. + + * corefile.c (core_translate): Don't do arithmetic with void * + pointers. Cast to char * first. + + * function_unit.c (FUNC_{LOAD,STORE}): Rename from {LOAD,STORE} + and change all uses. + + * Makefile.in ({FUNC,MODEL,WARNING}_CFLAGS): New flags set by + configure --enable switches. + (CONFIG_CFLAGS): Include FUNC_CFLAGS and MODE_CFLAGS. + (.c.o): Include WARNING_CFLAGS. + (CPU_H): Include function_unit.h. + (LIB_OBJ): Include function_unit.o. + (BUILT_SRC_WO_CONFIG): Split from BUILT_SRC and do not include + config.h or ppc-config.h. + (BUILT_SRC): Include BUILT_SRC_WO_CONFIG, config.h and + ppc-config.h. + (filter_filename.o): Include config.h/ppc-config.h dependencies. + (idecode.o, semantics.o, psim.o): Specify CC line without + WARNING_CFLAGS so that we don't get all of the unused variable + warnings that are generated. + (function_unit.o): Add rule to build. + (main.o, sim_calls.o): Add function_unit.h, itable.h dependencies. + (mon.o): Include mon.c dependency. + (TAGS): Depend on BUILT_SRC. + (clean): Don't delete config.h or ppc-config.h + + * basics.h (sim_callbacks.h): Move include after the include of + config.h and ppc-config.h. + + * bits.{h,c} (ROTL32,ROTL64): Move these functions to bits.c. Add + support for BITS_INLINE to inline these. Add declarations to + bits.h. + + * configure.in (--enable-sim-warnings): Add new option to specify + compiler warnings for all modules except idecode.o and semantics.o + which have lots of unused variables because they are machine + generated. + (--enable-sim-function-unit): New switch to configure whether + function unit support is compiled in or not. + (--enable-sim-{,default-}mode): New switches to control which cpu + model is used. + * configure: Regenerate. + + * corefile.c (core_attach_address_callback): Delete unused + variable device_address. + + * cpu.c (struct _cpu): Add function unit pointer field func_unit. + (cpu_create): If WITH_FUNCTION_UNIT, call function_unit_create. + (cpu_init): If WITH_FUNCTION_UNIT, call function_unit_init. + (cpu_halt): If WITH_FUNCTION_UNIT, call function_unit_halt. + (cpu_function_unit): New function to return func_unit field. + + * cpu.h (function_unit.h): Include new include file. + (cpu_function_unit): Declare. + + * debug.c (stdlib.h): Test HAVE_STDLIB_H, not HAVE_STDLIB. + (config.h): Include config.h. + + * devices.c (icu_io_write_buffer_callback): Delete unused variable + system. + + * emul_generic.c (emul_exit_call): Print out status value. + + * emul_netbsd.c (do_read): Delete unused variable nr_moved. + + * filter_filename.h (includes): Include config.h, ppc-config.h, + not basics.h. + + * inline.c: Include bits.c if BITS_INLINE. Include + function_unit.c if FUNCTION_UNIT_INLINE. + + * inline.h (INLINE_BITS): Define if BITS_INLINE. + (INLINE_FUNCTION_UNIT): Define if FUNCTION_UNIT_INLINE. + + * interrupts.c (instruction_storage_interrupt): Delete unused + variable nia. + + * lf.h (config.h): Include config.h. + + * main.c (includes): Include function_unit.c. If HAVE_UNISTD_H, + include unistd.h. + (usage): Update for -m model, -i, and -I options. + (main): Delete unused variables stack_pointer and i. Add support + for -i, -m model arguments. Call psim_print_info with verbose == + 1 if -i, and verbose == 2 if -I. + + * mon.c (stdio.h): Include stdio.h to pick up sprintf prototype. + (mon_issue): Call function_unit_issue if function units are + supported. + (mon_print_info): Take psim * argument. Print out information + from function_unit if available. Move read/write stats to always + print, instead of printing if verbose > 1. Fix up plural + vs. singular usage. + + * mon.h (mon_print_info): Update prototype. + + * psim.c (current_ppc_model): Add global variable. + (psim_print_info): Pass system argument to mon_print_info. + + * sim_calls.c (function_unit.h): Include. + (sim_open): Add support for -i and -m model options. If -i call + psim_print_info with verbose == 1, if -I, with verbose == 2. + (sim_resume): Delete unused variable program_counter. + + * std-config.h (WITH_FUNCTION_UNIT): Define. + (ppc_model): Add enumeration giving all PowerPC models currently + known about. + ({WITH,CURRENT}_PPC_MODEL): Define. + (FUNCTION_UNIT_INLINE): Define. + + * table.c (config.h): Include config.h. + + * vm.c (om_virtual_to_real): Print pte_word_{0,1} so the compiler + doesn't complain that they're unused. + + * vm_n.h (vm_data_map_read_N): Delete unused variable rval. + +Mon Nov 6 23:15:54 1995 Andrew Cagney + + * sim-endian.c (ppc-endian.c), sim-endian.h (ppc-endian.h): + renameed. These files are target independant. + * Makefile.in, basics.h: update for new name. + + * sim-endian.h (SWAP_N), sim-endian.c (_SWAP_1): Rename existing + SWAP_ to _SWAP_ so that sim-endian.h can contain SWAP_N + macro's as required. + + * sim-endian.c, sim-endian-n.h (new file): Move endian code into a + debugable header file. + + * ppc-instructions (Byte-Reverse): Enable byte reverse + instructions using SWAP_N macros. + +Mon Nov 6 10:39:28 1995 Michael Meissner + + * Makefile.in (config.status): Remove references to config.make + and config.hdr. + + * config.{make,hdr}: Delete, no longer used. + * build-psim: Ditto. + +Mon Nov 6 20:49:56 1995 Andrew Cagney + + * sim_calls.c (sim_open): Fix parsing of `target sim' options. + + * device_tree.c (device_tree_add_string): Wasn't saving the value + of the string being entered into the tree. + + * psim.c (create_filed_device_tree): Not terminating string device + names with a null. + + * psim.c (psim_create): Use `env' instead of + `environment-architecture' to be consistent with configure. + Reconize user/uea, virtual/vea and operating/oea. + +Sat Nov 4 12:29:45 1995 Fred Fish + + * core.c: Rename to corefile.c + * core.h: Rename to corefile.h + * inline.c: Include corefile.h, renamed from core.h. + * cpu.h: Include corefile.h, renamed from core.h + * vm.c: Include corefile.h, renamed from core.h + * corefile.c: Include corefile.h rather than core.h + * README.psim (KNOWN PROBLEMS): Change core.* references to corefile.* + references. + * Makefile.in (CPU_H): Change core.h to corefile.h + (vm.o): Change dependency to corefile.h + (LIB_SRC): Change core.c to corefile.c. + (LIB_OBJ): Change core.o to corefile.o. + (corefile.o): Change dependencies to corefile.c, corefile.h. + +Fri Nov 3 11:37:24 1995 Michael Meissner + + * ppc-instructions (data cache instructions): Make all data cache + instructions nops instead of invalid instructions. + + * Makefile.in (CONFIG_CFLAGS): Add ALIGNMENT_CFLAGS and + TIMEBASE_CFLAGS which weren't included. + +Thu Nov 2 08:54:04 1995 Michael Meissner + + * Makefile.in: Uncomment built file dependencies. + + * configure.in: Rewrite --enable-sim switch handling to use the + autoconf builtins so it works correctly if the configure or + Makefile.in files are modified and make decides to rebuild + Makefile. Also document all of the --enable-sim switches + supported. Check whether getrusage and sys/resource.h are + supported. + * config.in: Regenerate. + * configure: Regenerate. + * Makefile.in: Add support for all of the variables set with + --enable-sim switches. + + * Makefile.in (clean): make clean now removes all built sources as + well. + + * cpu.c: Use HAVE_STRING_H, HAVE_STRINGS_H, HAVE_UNISTD_H, + HAVE_TIME_H, HAVE_SYS_TIMES_H, HAVE_SYS_RESOURCE_H defined in + the generated config.h. + * debug.c: Ditto. + * device_tree.c: Ditto. + * devices.c: Ditto. + * dgen.c: Ditto. + * emul_netbsd.c: Ditto. + * igen.c: Ditto. + * lf.c: Ditto. + * misc.c: Ditto. + * psim.c: Ditto. + * registers.c: Ditto. + * sim_calls.c: Ditt. + * table.c: Ditto. + + + * main.c (main): Call psim_print_info with verbose == 2. + + * mon.c (mon_print_info): Align the cpu number and number of + instructions fields. Do not print an instruction category if the + CPU did not execute any of those instructions. Print out number + of reads and writes. If getrusage is supported, print out number + of simulated instructins per second. + + * configure.in: Add support for --enable-sim-opcode=stupid. + * configure: Regenerate. + +Wed Nov 1 23:46:59 1995 Andrew Cagney + + * std-config (INLINE_DEVICE_TREE): Don't inline either of + device_tree.c or devices.c. There is no significant gain. + + * configure.in, Makefile.in: add --enable-sim-icache=[0-9]* and + IGEN_ICACHE macro. + +Wed Nov 1 23:46:59 1995 Andrew Cagney + + * igen.c (main), misc.h (target_a2i, i2target), misc.c: Add + functions to convert between target and igen internal bit numbers. + Make IO go through these functions. Add -b (bit size) and -h (high + bit nr) options to igen. Typical usage would be: ./igen -b 16 -h + 15 for a 16 bit instruction format with the msb given a number 15. + +Wed Nov 1 22:17:32 1995 Andrew Cagney + + * dgen.c (main): Was outputting optarg even when it was NULL. + +Tue Oct 31 23:48:33 1995 Andrew Cagney + + * vm_n.h (vm_data_map_load_N, vm_data_map_store_n), debug.h, + debug.c: Add tracing of load/store unit (virtual) with -t + load-store. + +Tue Oct 31 21:44:01 1995 Andrew Cagney + + * std-config.h (WITH_ENVIRONMENT): Add USER_ENVIRONMENT which does + not include things such as the time base and events. + + * interrupt.c, sim_calls.c, cpu.h, vm.c, configure.in: Add UEA to + all environment switches for above. + + * psim.c (psim_create): ditto - new device tree node name is + /options/environment-architecture with values user, virtual and + operating. + +Tue Oct 31 21:31:32 1995 Andrew Cagney + + * ppc-opcode-stupid: Third example of use of opcode table - this + one expands all mtspr/mfspr and branch instructions. Appears to + give about a 10% gain in performance if everything enabled. Also + takes about 150mb of swap to build. + +Wed Nov 1 10:49:48 1995 Michael Meissner + + * emul_netbsd.c (do_exit): Print arguments and close parenthesis + if tracing, since exit doesn't go through emul_exit_call. + (do_read): Print arguments if tracing. + (do_write): Ditto. + (do_open): Ditto. + (do_break): Ditto. + (do_kill): Ditto. + (do_dup): Ditto. + (do_sigprocmask): Replace trace with printing arguments if + tracing. + (do_ioctl): Print arguments if tracing. + (do_umask): Ditto. + (do_dup2): Ditto. + (do_fcntl): Ditto. + (do_gettimeofday): Ditto. + (do_getrusage): Ditto. + (do_fstatfs): Ditto. + + * filter_filename.c: New file to provide filter_filename to strip + the directory prefix from a file. + * filter_filename.h: New include file to declare filter_filename. + + * debug.h: Include filter_filename.h. + (TRACE,DTRACE,ERROR): Use filter_filename on __FILE__. + + * misc.h: Include filter_filename.h. + (ASSERT): Use filter_filename on __FILE__. + + * igen.c (lf_print_my_prefix): Use filter_filename on the filename + argument. + + * Makefile.in: Add filter_filename support. + + * ppc-instructions (dcbi, icbi): Make these NOPs rather than + invalid instructions. + + * configure.in: Add support for more --enable-sim-* switches. + Use config.make and config.hdr to write to Makefile and config.h + respectively. Don't rewrite Makefile, just append to it. + * configure: Regenerate. + * config.{make,hdr}: New shell scripts. + + * Makefile.in: Remove all variables set by configure.in. + (psim.o): Depend on $(BUILT_SRC) also. + + * emul_netbsd.c (do_gettimeofday,do_getrusage): When comparing an + integer, use 0, not NULL. + +Tue Oct 31 15:20:04 1995 Michael Meissner + + * configure.in: Add support for --enable-sim-inline, + --enable-sim-bswap, --enable-sim-cflags, --enable-sim-complex, + --enable-sim-switch, --enable-sim-duplicate, --enable-sim-filter, + and --enable-sim-endian switch to control various Makefile + variables. + * configure: Regenerate from configure.in. + * Makefile.in: Add various Make variables that the various + switches alter. + + * std-config.h (DEFAULT_INLINE): Don't set this to 2 if using GCC + and optimizing by default. + +Fri Oct 27 19:26:27 1995 Andrew Cagney + + * bits.h (ROTL32, ROTL64): Were functions, made them macros, now + make them functions again. Appears 2.6.3 is confused by just a + macro. + +Thu Oct 26 18:31:58 1995 Andrew Cagney + + * ppc-endian.c (SWAP_8): Fix 8 byte swap! + + * psim.c (psim_create): Not correctly checking that runtime + configuration of things like ENDIAN, ENVIRONMENT and ALIGNMENT + matched the compiled in ones. + + * debug.h (ITRACE), igen.c: Tidy up more tracing flags - + trace_semantics is now different to trace_idecode, the former + checks the cache. + +Tue Oct 24 21:54:13 1995 Andrew Cagney + + * ppc-instructions (mtsrin): Missing instruction + * ppc-instructions (mfsrin): Missing instruction + * ppc-instructions (eieio): Missing instruction + +Tue Oct 24 20:55:29 1995 Andrew Cagney + + * build-psim: New shell script - see internals for usage, + simplifies the process of building custom simulators. + +Mon Oct 23 23:48:59 1995 Andrew Cagney + + * std-config.h (SEMANTICS_INLINE): Tidy up notes on each of the + INLINE macros. Make SEMANTICS_INLINE == 1 if DEFAULT_INLINE == 2. + Don't use DEFAULT_INLINE to define REGISTERS_INLINE DEVICES_INLINE + DEVICE_TREE_INLINE or INTERRUPTS_INLINE as none of these are on + the instruction or data critical paths. + + * FIXME: devices.c/emul_netbsd.c would benefit (slightly) from + the inclusion of device_tree.c/emul_generic.c. + +Mon Oct 23 00:31:50 1995 Andrew Cagney + + * os_emul.[hc], emul_generic.[hc], emul_netbsd.[hc]: replace + system.[hc]. Start of suport for multiple emulations and + emulation state (os_emul object). + + * emul_generic.[hc]: Start of code to implement proper system call + tracing (from spy). + +Sun Oct 22 21:33:51 1995 Andrew Cagney + + * cpu.h, cpu.c (cpu_init): New function, zero the registers before + the processor is started. Fixes problem of registers being + undefined when restarting from within gdb. + + * cpu.h, cpu.c (cpu_flush_icache): New function, flushes the + instruction cache (if present). Fixes problem of cpu caching gdb + breakpoint instructions. + + FIXME: PSIM sometimes aborts calling error(), it should instead + call sim_error() say which takes care of housekeeping such as + saving the CIA before calling error. + + * NOTE: cpu_flush_cache() instead of cpu_synchronize_context() is + used when restarting a simulation because the latter has the + unwanted side effect (well I as a kernel hacker think it is) of + performing an isync when the instruction stream doesn't contain + one. + +Sun Oct 22 19:27:48 1995 Andrew Cagney + + * mon.h (new), mon.c (new), std-config.h (WITH_MON): Performance + monitoring module. Counts both instructions issued and + load/stores. + + * NOTE: mon does not contain to count instruction loads as this + information is already available from the mon_issue() hook. + + * igen.c (lf_print_c_semantic), vm_n.h: Add counting code. + + * psim.h, psim.c (psim_create), cpu.h, cpu.c (cpu_create): Attach + a common monitor to each of the cpus. Delete + cpu_increment_number_of_insns() and cpu_get_number_of_insns() + replaced by copied code in mon.[hc]. + +Sun Oct 22 18:42:45 1995 Andrew Cagney + + * sim_calls.c, main.c, psim.c (psim_create): always create + `WITH_SMP' cpus. The actual number of CPU's active in a + simulation run is taken from the device node: /init/smp (an + integer). WITH_SMP changed to 2 (remember to put it back to 0). + +Fri Oct 20 17:26:54 1995 Andrew Cagney + + * system.c: More system call emulation. If code appears NetBSD + specific, make conditional to being compiled on a NetBSD system + (sigh). + +Wed Oct 18 23:02:20 1995 Andrew Cagney + + * Makefile.in, gen.c(delete), igen.c(new), dgen.c(new), + lf.[ch](new), table.[ch](new): Split into two generators - igen + that outputs the instruction tables and dgen that outputs the spr + tables. Add -f (filter out) flag to igen to filter out certain + instructions (ex 64 bit ones) from the created tables. Include + $(LIBIBERTY_LIB) in link options in case host lacks some libc + functions. + + * NOTE: igen, since it was originally written for the + PowerPC/RS6000, things the MSB is 0 and the LSB is 63{31}. + + * Makefile.in, std-config.h, ppc-cache-rules(new), + ppc-opcode-complex(new), ppc-opcode-simple(new): (for igen) Create + cache-rule and opcode-rule tables from macros found std-config.h. + Delete corresponding macro's from std-config.h. + + * igen.c (gen_itable_c, gen_itable_h), Makefile.in: code to output + an table of all the instructions. Code to output a type + enumerating all the instructin names. + + * igen.c(lf_print_c_semantic): Move call to increment instruction + counter so that it occures _after_ the instruction has been fully + validated, was double counting illegal/invalid instructions. Add + conditional so only compiled in when WITH_PROFILE enabled (enabled + by default). + + * igen.c, cpu.h, cpu.c(cpu_increment_number_of_insns): Include + itable.h, count individual instruction types not just total, + adjust reporting functions to output this. + + * ppc-instructions (64 bit Load Doubleword with Update Indexed): + Had 32./ instead of 31./ + + * ppc-instructions (64 bit Store Double Word Conditional Indexed): + bitrot - updated to use newer CR register operators. + + * ppc-instructions (64bit Floating Convert from Integer + Doubleword): Correct call to Round_Float(). + +Mon Oct 16 00:31:20 1995 Andrew Cagney + + * basics.h: #include "sim_callbacks.h" earlier so that its + prototypes are declared in all other header files. + + * bits.h, bits.c, idecode_expression.h (ROTL32, ROTL64): Update + doc in bits.h, remove dead code in bits.c, move ROTL32/ROTL64 into + bits.h. + + * cpu.c(cpu_add_commas), device_tree.h, device_tree.c(scand_*): + Add size of buffer argument to functions writing a string into a + buffer. Check for buffer overflow. + +Sun Oct 15 22:16:11 1995 Andrew Cagney + + * devices.h, devices.c, debug.h, debug.c: add macro's for tracing + of each device. Make parameter names consistent so macros work. + Use macro's in device functions. + + * device_tree.c, devices.h, devices.c: include path to device in a + devices node when creating it. + + * device_tree.c, debug.h, debug.c: Add tracing of `device-tree'. + + * core.c: add tracing of core-device, adjust parameter names in + core functions to be consistent with those in devices*. + +Sun Oct 15 20:33:20 1995 Andrew Cagney + + * debug.h, debug.c (trace_option): New function. Parses the trace + option, updating the trace array. + + * debug.h, debug.c (trace_usage): New function. Outputs the list + of all possible trace options. + + * sim_calls.c (sim_open), main.c (main): Use new trace_option() to + parse trace options specified with the simpler -t flag. Adjust + usage. + +Thu Oct 26 10:42:28 1995 Michael Meissner + + * Makefile.in (clean): Delete *.i and *.out files. + + * ppc-endian.c (SWAP_n): Add SET argument to allow use of SWAP + macros for either assignment or return. Fix SWAP_8 to use a + union, and two SWAP_4's. Delete SWAP_N, since nobody uses it now. + (ENDIAN_N): Add SET argument to SWAP_n calls. Delete macro defs + that hardwired swapping on/off, let optimizer delete dead code. + + * main.c (main): Add printf that we caught a signal and print out + the failing address. + +Thu Oct 19 21:43:39 1995 Fred Fish + + * Makefile.in: Remove tabs from otherwise empty line. + Confuses many non-GNU versions of "make". + +Wed Oct 18 08:51:25 1995 Michael Meissner + + * Makefile.in (clean): Delete files produced by gen. + +Mon Oct 16 17:34:24 1995 Michael Meissner + + * gen.c (lf_print_c_semantic_function): Move counting # of + instructions here so it works with caching. + (gen_idecode_c): Move from here. + +Wed Oct 11 17:13:15 1995 Andrew Cagney + + * gen.c, ppc-instructions, psim.c: Fix code for generating + cracking instruction cache. Delete the code that cached just the + result from doing an instruction lookup - this ran slower than no + cache at all. + +Fri Oct 13 09:58:43 1995 Michael Meissner + + * Makefile.in (gen.o): Include $(INLINE_CFLAGS). + + * debug.h (ppc_trace): Rename from trace, to avoid a conflict with + TCL when gdb is linked with the simulator. + * debug.c (ppc_trace): Ditto. + * sim_calls.c (sim_open): Change trace -> ppc_trace. + * main.c (main): Ditto. + + * cpu.c (cpu_add_commas): Remove extra static. + +Thu Oct 12 11:35:53 1995 Michael Meissner + + * Makefile.in (psim.o): Now that inlines are turned on, make + psim.o depend on all sources. + + * cpu.c (cpu_add_commas): New function to format a long with + commas. + (cpu_print_info): Use it to print number_of_insns. + + * ppc-endian.c (SWAP_n): New macros to speed up byte swapping for + 2, 4, and 8 bytes. + (ENDIAN_N): If both target and host byte orders are known, don't + bother testing CURRENT_{TARGET,HOST}_BYTE_ORDER. + + * ppc-endian.h (target specific H2T_n/T2H_n macros): Remove #if 0 + to allow target specific H2T_n/T2H_n macros to be used. + (htonl, ntohl): If compiled on a 486 by GCC and WITH_BSWAP is + non-zero, redefine the htonl/ntohl macros to use the BSWAP instead + of the 3 instruction sequence that runs on 386s. + + * std-config.h (WITH_{HOST,TARGET}_BYTE_ORDER): Don't override if + specified on the compile line. + (WITH_BSWAP): If not defined, define as 0. + + * Makefile.in (INLINE_CFLAGS): Add -DDEFAULT_INLINE=2 to add + default inline support. Pass INLINE_CFLAGS when compiling. + + * devices.{h,c} (unimp_device_ioctl): Use STATIC_DEVICES, not + INLINE_DEVICES since GCC doesn't like inline functions that + accept variable arguments. + (stack_ioctl_callback): Make function just static because GCC + doesn't like inline functions that accept variable arguments. + + * devices.h (STATIC_DEVICES): Define as empty if not defined. + + * inline.c: Correct pathnames of included C files to match current + implementation. + + * inline.h (STATIC_DEVICES): If DEVICES_INLINE is defined to be + non-zero, define STATIC_DEVICES to be static. + + * std-config.h (INLINE): If GNU C and optimizing, define this as + __inline__. + (DEFAULT_INLINE): If not defined, define as 0. + (ENDIAN_INLINE): If not defined, define as DEFAULT_INLINE. + ({CORE,VM,CPU,EVENTS,REGISTERS,INTERRUPTS}_INLINE): Ditto. + ({SPREG,IDECODE}_INLINE): Ditto. + +Wed Oct 11 17:13:15 1995 Andrew Cagney + + * ppc-instructions: Initial cut of floating point suport added. + Of note include - use of host IEEE floating point instructions, + use of PowerPC manual pseudo code to handle the FPSCR. It is not + currently a pretty sight. + + * memory_map.h, memory_map.c, memory_map_n.h, core.h, core.c: + merge into core.h, core.c, core_n.h. The type memory_map replaced + with core_map. This removes a level of pointer indirection when + translating an address. + + * memory_map.h, memory_map.c, memory_map_n.h: delete. + + * Makefile.in et.al (sorry): tweek to use new core, core_map and + core.h. + +Wed Oct 11 12:10:26 1995 Andrew Cagney + + * sim_calls.c, main.c: Add -g (trace_gdb) option, add tracing to + most of the other functions in sim_calls.c. + + * basics.h (CONCAT3), memory_map.c, memory_map_n.h, Makefile.in: + Add macros to better cover up `generic' code. Makes it possible + to step through the generic code! + + * vm.c, vm_n.h, Makefile.in: ditto + +Tue Oct 10 15:42:59 1995 Andrew Cagney + + * devices.h, devices.c, memory_map.h, memory_map.c: Changed + callback interface so that there is a read/write buffer but no + read/write_word. VEA default memory read/write handler sometimes + couldn't resolve an access and of those some were for a memory + fault and some were because gdb was making a bogus request. + + * devices.h, devices.c, memory_map.h, memory_map.c, vm.h, vm.c: + eliminate transfer_mode (raw or cooked) parameter from read/write + buffer. + +Fri Oct 6 20:23:56 1995 Andrew Cagney + + * ppc-instructions (fmul, fmuls): correct instruction format - had + FRB instead of FRC. + +Wed Oct 4 17:31:12 1995 Andrew Cagney + + * psim.c, device_tree.h, device_tree.c, devices.c (printd_*, + scand_*): new functions to parse/print fields in device names + while hiding any machine dependency. + + * devices.c, psim.c: Change the stack init code so that it is + handled by a device. Arguments passed across using a device ioctl + (hack). + + * devices.h, devices.c: device ioctl callback changed to allow a + variable number of arguments. This gives greater flexability and + greater chance of bugs. + +Tue Oct 3 22:01:56 1995 Andrew Cagney + + * main.c (printf_filtered, error): Missing va_end() to close off + variable argument use. + + * Makefile.in (tmp-gencode): comment out hack to get around some + versions of make not handling files being created as side-effects. + + * gen.c (lf_open): Add -n (real_file_name) option. Specifies an + alternative file name to use in output files for things like #line + macros. + + Makefile.in (tmp-gencode): Use gen -n so that debug info is + correct. + + * Makefile.in (TARGETLIB): Use this instead of libsim.a in the + Makefile. + +Sat Oct 7 22:40:59 1995 Michael Meissner + + * sim_calls.c (sim_set_callbacks): Define new function. + +Fri Oct 6 17:23:10 1995 Michael Meissner + + * psim.c (psim_print_info): Print exit status or signal number. + +Mon Oct 2 11:46:37 1995 Michael Meissner + + * cpu.c (struct _cpu): Add number_of_insns field to trace how many + instructions are executed. + (cpu_increment_number_of_insns): New function to increment the + number of instructions issued. + (cpu_get_number_of_insns): New function to return the number of + instructions issued. + (cpu_print_info): New function to print cpu related information. + At present, print the number of instructions executed. + + * gen_idecode_c: Emit call to cpu_increment_number_of_insns within + idecode_issue. + + * psim.c (psim_print_info): New function to iterate over each of + the CPU's calling cpu_print_info. + + * psim.h,cpu.h: Add new declarations. + + * sim_calls.c (sim_open): Add argument processing to add the same + switches main.c accepts for the standalone processor. + (sim_close): Call psim_print_info if -I. + + * main.c (main): Add comment saying to update sim_calls.c when + adding switches. Add -I to call psim_print_info when done. + (usage): Update usage message. + +Sun Oct 1 13:52:59 1995 Michael Meissner + + * main.c (printf_filtered): Correct to match new prototype. + +Sat Sep 30 20:47:05 1995 Michael Meissner + + * sim_callbacks.h (printf_filtered): Correct prototype. + +Thu Sep 21 16:26:49 1995 Michael Meissner + + * device_tree.c (OEA_MEMORY_SIZE): Define if not defined to + 0x100000. + (clayton_memory_size): Define as OEA_MEMORY_SIZE. + + * std-config.h (WITH_TRACE): Default to 1 now. + + * psim.c (write_stack_arguments): Don't write any stack arguments + if OEA. + + * main.c (main): Switch to using getopt. Make -p also set + trace_semantics. Make -a turn on all trace flags. Make -C turn + on console tracing. + + * device_tree.c (create_option_device_node): Assume a program is + OEA if the start address is < 4096, not just == 0. + +Wed Sep 20 13:36:06 1995 Ian Lance Taylor + + * Makefile.in (maintainer-clean): New synonym for realclean. + +Sun Sep 10 10:23:56 1995 Michael Tiemann + + * registers.c (register_description): Add gdb synonyms for cr + (cnd) and msr (ps). + +Fri Sep 8 13:16:10 1995 Ian Lance Taylor + + * Makefile.in (install): Don't install in $(tooldir). + + * configure.in: Call AC_CONFIG_HEADER. Don't try to use + bfd/hosts/*.h file or bfd/config/*.mh file. Call AC_PROG_CC and + AC_PROG_RANLIB. Substitute in values for CFLAGS, HDEFINES, AR, + and CC_FOR_BUILD. Call AC_CHECK_HEADERS for various header files. + Touch stamp.h if creating config.h. + * configure: Rebuild. + * config.in: New file, created by autoheader. + * Makefile.in (AR): Define as @AR@. + (CC): New variable, defined as @CC@. + (CFLAGS): Define as @CFLAGS@. + (CC_FOR_BUILD): New variable, defined as @CC_FOR_BUILD@. + (RANLIB): Define as @RANLIB@. + (HDEFINES, TDEFINES): New variables. + (@host_makefile_frag@): Remove. + (mostlyclean): Make the same as clean, not distclean. + (clean): Remove config.log. + (distclean): Remove config.h and stamp-h. + (Makefile): Don't depend upon @frags@. Just rebuild Makefile when + invoking config.status. + (config.h, stamp-h): New targets. + (gen, gen.o): Build with CC_FOR_BUILD, not CC. + (ppc-config.h): Rename from old config.h build. + * (basics.h,gen.c,ppc-endian.c,psim.c): Include ppc-config.h. + +Fri Sep 8 09:51:03 1995 Michael Meissner + + * configure{,.in}: Don't include sysdep.h from bfd, since bfd no + longer provides it. + * basics.h (sysdep.h): Don't include it. + * Makefile.in (BASICS_H): Remove sysdep.h. + +Wed Sep 6 13:25:42 1995 Andrew Cagney + + * core.c (core_add_data): First growth of bss was being put at + wrong address (0) instead of &end. + + * core.c (core_add_stack, core_add_data): Was not handling case + where bss/stack is grown across the current end-of-{bss,stack}. + +Wed Sep 6 00:46:10 1995 Andrew Cagney + + * system.c (system_call): Fix SYS_break - was aligning bss to a + page boundary instead of just an 8 byte one; On first call sbrk(0) + != sbrk(0). + +Thu Aug 24 14:48:54 1995 Michael Meissner + + * Makefile.in (install): Fix install rule. + +Tue Aug 22 09:31:18 1995 Michael Meissner + + * system.c (system_call): Add read support. + + * main.c (main): -t sets trace_device_tree. Correct usage message + to current reality. + + * device_tree.c (update_memory_node_for_section): Make tracing + output line up. If not code or readonly, assume that the section + is a data section and has read/write permissions. Add readonly + support. + + * core.c (create_core_from_addresses): Print end address in traces + and make tracing output line up. + + * Makefile.in: Rewrite from Makefile to work with the Cygnus + environment, and support compiling in a different directory than + the sources reside in. + + * ppc-endian.h: Rename from endian.h so that it doesn't get + confused with /usr/include/sys/endian.h on Linux. Add Linux + endian support. + + * ppc-endian.c: Rename to be consistant with ppc-endian.h. + Include ppc-endian.h, not endian.h. + + * basics.h (sysdep.h): Include sysdep.h that configure makes. + Include ppc-endian.h, not endian.h. + + * std-config.h: Rename from ppc-config. Put #ifndefs around most + configuration macros, so they can be overridden via CFLAGS. By + default, turn off tracing. + + * configure.in: Clone from other simulator targets. + * configure: Generate via autoconf from configure.in. + +Sat Aug 19 09:05:32 1995 Andrew Cagney + + * ppc-instructions: fix srawi (was geting XER[CA] real wrong). + + * interrupts.c (data_storage_interrupt): allow stack to grow by + upto one MB per increment. + + * ppc-instructions: divw was computing rA / rA not rA / rB + + * main.c (main): really stupid. Wasn't exiting with correct status + +Fri Aug 18 00:38:01 1995 Andrew Cagney + + * system.c (system_call): add system calls kill(2) and getpid(2). + + * main.c (main): Check/return exit status when simulation + finishes. + +Thu Aug 17 14:29:18 1995 Andrew Cagney + + * device_tree.c (create_option_device_node): Alignment rules (at + least for the moment) now are for strict alignment only for LE OEA + mode. (Because of compiler problems). + + * system.c (system_call) SYS_exit: Wasn't exiting with correct status. + +Thu Aug 17 01:16:38 1995 Andrew Cagney + + * vm.c (DEFINE_VM_DATA_MAP_WRITE_N): For miss aligned transfer + forgot to return. + + * system.c (system_call): didn't page align break argument before + determining increment break increment. + + * psim/ppc: Re-arange entire directory structure so that + everything lives in the one directory. While a pain for cleaning, + makes building across multiple architectures much simpler. + + * devices.c, device_tree.c: Added code that provides a simple + illustration of how an interrupt control device could be + implemented. + + * devices.c: Added code so that the dumb console device can read + (from stdin) as well as write to stdout. + diff --git a/sim/ppc/hw_com.c b/sim/ppc/hw_com.c new file mode 100644 index 00000000000..1153e1faac8 --- /dev/null +++ b/sim/ppc/hw_com.c @@ -0,0 +1,23 @@ +static unsigned +hw_com_io_write_buffer_callback(device *me, + const void *source, + int space, + unsigned_word addr, + unsigned nr_bytes, + cpu *processor, + unsigned_word cia) +{ + hw_com_device *hw_com = (hw_com_device*)device_data(me); + unsigned_1 val = *(unsigned_1*)source; + + switch ((int)addr & hw_com_offset_mask) { + + default: + error("hw_com_write_callback() internal error\n"); + + } + + return nr_bytes; +} + +#endif /* _HW_COM_ */ diff --git a/sim/ppc/hw_cpu.c b/sim/ppc/hw_cpu.c new file mode 100644 index 00000000000..5be8e25c220 --- /dev/null +++ b/sim/ppc/hw_cpu.c @@ -0,0 +1,145 @@ +/* This file is part of the program psim. + + Copyright (C) 1994-1996, Andrew Cagney + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + +#ifndef _HW_CPU_C_ +#define _HW_CPU_C_ + +#ifndef STATIC_INLINE_HW_CPU +#define STATIC_INLINE_HW_CPU STATIC_INLINE +#endif + +#include "device_table.h" +#include "hw_cpu.h" + +#include "interrupts.h" +#include "cpu.h" + + +/* CPU (HW) - Interface to a Processor + + Description: + + The CPU device provides the connection between the interrupt net + (linking the devices and the interrupt controller) and the + simulated model of each processor. This device contains interrupt + ports that correspond directly to the external interrupt stimulus + that can be sent to a given processor. Sending an interrupt to one + of the ports results in an interrupt being delivered to the + corresponding processor. + + Typically, an interrupt controller would have its inputs connected + to device interrupt sources and its outputs (sreset, int, et.al.) + connected to this device. + + Properties: + + cpu-nr = . Specify the processor (1..N) that this cpu + device node should control. */ + +typedef struct _hw_cpu_device { + int cpu_nr; + cpu *processor; +} hw_cpu_device; + +static const device_interrupt_port_descriptor hw_cpu_interrupt_ports[] = { + { "hreset", hw_cpu_hard_reset }, + { "sreset", hw_cpu_soft_reset }, + { "int", hw_cpu_external_interrupt }, + { "mci", hw_cpu_machine_check_interrupt }, + { "smi", hw_cpu_system_management_interrupt }, + { NULL } +}; + + +static void * +hw_cpu_create(const char *name, + const device_unit *unit_address, + const char *args, + device *parent) +{ + hw_cpu_device *hw_cpu = ZALLOC(hw_cpu_device); + return hw_cpu; +} + + +/* during address initialization ensure that any missing cpu + properties are added to this devices node */ + +static void +hw_cpu_init_address(device *me) +{ + hw_cpu_device *hw_cpu = (hw_cpu_device*)device_data(me); + /* populate the node with properties */ + /* clear our data */ + memset(hw_cpu, 0x0, sizeof(hw_cpu_device)); + hw_cpu->cpu_nr = device_find_integer_property(me, "cpu-nr"); + hw_cpu->processor = psim_cpu(device_system(me), hw_cpu->cpu_nr); +} + + +/* Take the interrupt and synchronize its delivery with the clock. If + we've not yet scheduled an interrupt for the next clock tick, take + the oportunity to do it now */ + +static void +hw_cpu_interrupt_event(device *me, + int my_port, + device *source, + int source_port, + int level, + cpu *processor, + unsigned_word cia) +{ + hw_cpu_device *hw_cpu = (hw_cpu_device*)device_data(me); + if (my_port < 0 || my_port >= hw_cpu_nr_interrupt_ports) + error("hw_cpu_interrupt_event_callback: interrupt port out of range %d\n", + my_port); + switch (my_port) { + /*case hw_cpu_hard_reset:*/ + /*case hw_cpu_soft_reset:*/ + case hw_cpu_external_interrupt: + external_interrupt(hw_cpu->processor, level); + break; + /*case hw_cpu_machine_check_interrupt:*/ + default: + error("hw_cpu_deliver_interrupt: unimplemented interrupt port %d\n", + my_port); + break; + } +} + + +static device_callbacks const hw_cpu_callbacks = { + { hw_cpu_init_address, }, /* init */ + { NULL, }, /* address */ + { NULL, }, /* io */ + { NULL, }, /* DMA */ + { hw_cpu_interrupt_event, NULL, hw_cpu_interrupt_ports }, /* interrupts */ + { NULL, NULL, }, +}; + +const device_descriptor hw_cpu_device_descriptor[] = { + { "hw-cpu", hw_cpu_create, &hw_cpu_callbacks }, + { "cpu", hw_cpu_create, &hw_cpu_callbacks }, + { NULL, }, +}; + +#endif /* _HW_CPU_C_ */ diff --git a/sim/ppc/hw_cpu.h b/sim/ppc/hw_cpu.h new file mode 100644 index 00000000000..11d0298ee12 --- /dev/null +++ b/sim/ppc/hw_cpu.h @@ -0,0 +1,34 @@ +/* This file is part of the program psim. + + Copyright (C) 1994-1996, Andrew Cagney + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + +#ifndef _HW_CPU_H_ +#define _HW_CPU_H_ + +enum { + hw_cpu_hard_reset, + hw_cpu_soft_reset, + hw_cpu_external_interrupt, + hw_cpu_machine_check_interrupt, + hw_cpu_system_management_interrupt, + hw_cpu_nr_interrupt_ports +}; + +#endif /* _HW_CPU_H_ */ diff --git a/sim/ppc/hw_eeprom.c b/sim/ppc/hw_eeprom.c new file mode 100644 index 00000000000..8a52e9dc41d --- /dev/null +++ b/sim/ppc/hw_eeprom.c @@ -0,0 +1,289 @@ +/* This file is part of the program psim. + + Copyright (C) 1994-1996, Andrew Cagney + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + +#ifndef _HW_EEPROM_C_ +#define _HW_EEPROM_C_ + +#ifndef STATIC_INLINE_HW_EEPROM +#define STATIC_INLINE_HW_EEPROM STATIC_INLINE +#endif + +#include "device_table.h" + +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif + +/* EEPROM - electricaly erasable programable memory + + Description: + + This device implements a small byte addressable EEPROM. + Programming is performed using the same write sequences as used by + modern EEPROM components. Writes occure in real time, the device + returning a progress value until the programing has been completed. + + Properties: + + reg =
. Determine where the device lives in the + parents address space. + + nr-sectors = . When erasing an entire sector is cleared + at a time. This specifies the number of sectors in the EEPROM + component. + + byte-write-delay = . Number of clock ticks before the + programming of a single byte completes. + + sector-start-delay = . When erasing sectors, the number + of clock ticks after the sector has been specified and the actual + erase process commences. + + erase-delay = . Number of clock ticks before an erase + program completes. */ + +typedef enum { + read_reset, + write_nr_2, + write_nr_3, + write_nr_4, + write_nr_5, + write_nr_6, + byte_program, + byte_programming, + chip_erase, chip_erasing, + sector_erase, sector_erasing, + sector_erase_suspend, + sector_erase_resume, +} eeprom_states; + +typedef struct _eeprom_device { + unsigned8 *memory; + unsigned sizeof_memory; + unsigned sector_size; + unsigned nr_sectors; + unsigned byte_write_delay; + unsigned sector_start_delay; + unsigned erase_delay; + signed64 programme_start_time; + unsigned program_byte_address; + eeprom_states state; +} eeprom_device; + +static void * +eeprom_create(const char *name, + const device_unit *unit_address, + const char *args, + device *parent) +{ + eeprom_device *eeprom = ZALLOC(eeprom_device); + return eeprom; +} + +typedef struct _eeprom_reg_spec { + unsigned32 base; + unsigned32 size; +} eeprom_reg_spec; + +static void +eeprom_init_address(device *me, + psim *system) +{ + eeprom_device *eeprom = (eeprom_device*)device_data(me); + const device_property *reg = device_find_array_property(me, "reg"); + const eeprom_reg_spec *spec = reg->array; + int nr_entries = reg->sizeof_array / sizeof(*spec); + + if ((reg->sizeof_array % sizeof(*spec)) != 0) + error("devices/%s reg property of incorrect size\n", device_name(me)); + if (nr_entries > 1) + error("devices/%s reg property contains multiple specs\n", + device_name(me)); + + /* initialize the eeprom */ + if (eeprom->memory == NULL) { + eeprom->sizeof_memory = BE2H_4(spec->size); + eeprom->memory = zalloc(eeprom->sizeof_memory); + } + else + memset(eeprom->memory, eeprom->sizeof_memory, 0); + + /* figure out the sectors in the eeprom */ + eeprom->nr_sectors = device_find_integer_property(me, "nr-sectors"); + eeprom->sector_size = eeprom->sizeof_memory / eeprom->nr_sectors; + if (eeprom->sector_size * eeprom->nr_sectors != eeprom->sizeof_memory) + error("device/%s nr-sectors does not evenly divide eeprom\n", + device_name(me)); + + /* timing */ + eeprom->byte_write_delay = device_find_integer_property(me, "byte-write-delay"); + eeprom->sector_start_delay = device_find_integer_property(me, "sector-start-delay"); + eeprom->erase_delay = device_find_integer_property(me, "erase-delay"); + + device_attach_address(device_parent(me), + device_name(me), + attach_callback, + 0 /*address space*/, + BE2H_4(spec->base), + eeprom->sizeof_memory, + access_read_write_exec, + me); +} + + +static unsigned +eeprom_io_read_buffer(device *me, + void *dest, + int space, + unsigned_word addr, + unsigned nr_bytes, + cpu *processor, + unsigned_word cia) +{ + eeprom_device *eeprom = (eeprom_device*)device_data(me); + int i; + for (i = 0; i < nr_bytes; i++) { + unsigned_word address = (addr + nr_bytes) % eeprom->sizeof_memory; + eeprom->memory[address] = eeprom_io_read_byte(address); + } + return nr_bytes; +} + +static void +eeprom_io_write_byte() +{ + switch (state) { + case read_reset: + if (address == 0x5555 && data = 0xaa) + state = first_write; + else + state = read_reset; + break; + case first_write: + if (address == 0x2aaa && data == 0x55) + state = second_write; + else + state = read_reset; /* issue warning */ + break; + case second_write: + if (address == 0x5555 && data == 0xf0) + state = read_reset; + else if (address == 0x5555 && data == 0x90) + state = auto_select; + else if (address == 0x5555 && data == 0xa0) + state = byte_program; + else if (address == 0x5555 && data == 0x80) + state = third_write; + else + state = read_reset; + break; + case fourth_write: + if (address == 0x5555 && data == 0xaa) + state = fith_write; + else + state = read_reset; + break; + case fith_write: + if (address == 0x2aaa && data == 0x55) + state = sixth_write; + else + state = read_reset; + break; + case sixth_write: + if (address == 0x5555 && data == 0x10) + state = chip_erase; + else + sector_erase(); + break; + case auto_select: + if (data == 0xf0) + state = read_reset; + else if (address == 0x5555 && data == 0xaa) + state = second_write; + else + state = read_reset; /* issue warning */ + break; + case sector_erase: + if (data == 0xb0) + state = sector_erase_suspend; + else + state = sector_erase; /* ignore */ + break; + case sector_erase_suspend: + if (data == 0x30) + state = sector_erase; + else + state = sector_erase_suspend; /* ignore */ + break; + case byte_program: + /* perform the byte program */ + program_address = address; + program_start = some_time(); + toggle = 0; + /* but only make things `0' and never 1 */ + byte[address] = data; + state = byte_programming; + break; + case byte_programming: + if (finished) + state = read_reset; + else + state = byte_programming; + break; + } +} + +static unsigned +eeprom_io_write_buffer(device *me, + const void *source, + int space, + unsigned_word addr, + unsigned nr_bytes, + cpu *processor, + unsigned_word cia) +{ + eeprom_device *eeprom = (eeprom_device*)device_data(me); + int i; + for (i = 0; i < nr_bytes; i++) { + unsigned_word address = (addr + nr_bytes) % eeprom->sizeof_memory; + eeprom_io_read_byte(address, eeprom->memory[address]); + } + return nr_bytes; +} + + + +static device_callbacks const eeprom_callbacks = { + { eeprom_init_address, }, + { NULL, }, /* address */ + { eeprom_io_read_buffer, eeprom_io_write_buffer }, /* IO */ +}; + +const device_descriptor eeprom_device_descriptor[] = { + { "eeprom", eeprom_create, &eeprom_callbacks }, + { NULL }, +}; + +#endif /* _HW_EEPROM_C_ */ diff --git a/sim/ppc/hw_iobus.c b/sim/ppc/hw_iobus.c new file mode 100644 index 00000000000..50012236df8 --- /dev/null +++ b/sim/ppc/hw_iobus.c @@ -0,0 +1,98 @@ +/* This file is part of the program psim. + + Copyright (C) 1994-1996, Andrew Cagney + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + +#ifndef _HW_IOBUS_C_ +#define _HW_IOBUS_C_ + +#ifndef STATIC_INLINE_HW_IOBUS +#define STATIC_INLINE_HW_IOBUS STATIC_INLINE +#endif + +#include "device_table.h" + + +/* Device: + + iobus@
- bus for attaching devices + + + Description: + + IOBUS provides a simple `local' bus for attaching (hanging) + programmed IO devices from. All child devices are mapped into this + devices parent address space (after adjusting for the iobus's base + address). + + + Properties: + + None. + + */ + +static void +hw_iobus_attach_address_callback(device *me, + const char *name, + attach_type type, + int space, + unsigned_word addr, + unsigned nr_bytes, + access_type access, + device *who) /*callback/default*/ +{ + unsigned_word hw_iobus_addr; + /* sanity check */ + if (space != 0) + error("hw_iobus_attach_address_callback() no space for %s/%s\n", + device_name(me), name); + /* get the bus address */ + if (device_unit_address(me)->nr_cells != 1) + error("hw_iobus_attach_address_callback() invalid address for %s\n", + device_name(me)); + hw_iobus_addr = device_unit_address(me)->cells[0]; + device_attach_address(device_parent(me), + device_name(me), + type, + 0 /*space*/, + hw_iobus_addr + addr, + nr_bytes, + access, + who); +} + + +static device_callbacks const hw_iobus_callbacks = { + { NULL, }, + { hw_iobus_attach_address_callback, }, + { NULL, }, /* IO */ + { NULL, }, /* DMA */ + { NULL, }, /* interrupt */ + { generic_device_unit_decode, + generic_device_unit_encode, } +}; + + +const device_descriptor hw_iobus_device_descriptor[] = { + { "iobus", NULL, &hw_iobus_callbacks }, + { NULL, }, +}; + +#endif /* _HW_IOBUS_ */ diff --git a/sim/ppc/hw_nvram.c b/sim/ppc/hw_nvram.c new file mode 100644 index 00000000000..fbd8e11517d --- /dev/null +++ b/sim/ppc/hw_nvram.c @@ -0,0 +1,234 @@ +/* This file is part of the program psim. + + Copyright (C) 1994-1996, Andrew Cagney + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + +#ifndef _HW_NVRAM_C_ +#define _HW_NVRAM_C_ + +#ifndef STATIC_INLINE_HW_NVRAM +#define STATIC_INLINE_HW_NVRAM STATIC_INLINE +#endif + +#include "device_table.h" + +#ifdef HAVE_TIME_H +#include +#endif + +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif + +/* NVRAM - non-volatile memory with optional clock. + + Description: + + This device implements a small byte addressable non-volatile memory + component. The component may include an optional real-time clock + at its upper addresses. + + Properties: + + reg =
. Determine where the device lives in the + parents address space. + + timezone = . Adjustment to current host's GMT (in secons) + that should be applied when updating the NVRAM's clock. */ + +typedef struct _hw_nvram_device { + unsigned8 *memory; + unsigned sizeof_memory; +#ifdef HAVE_TIME_H + time_t host_time; +#else + long host_time; +#endif + unsigned timezone; + /* useful */ + unsigned addr_year; + unsigned addr_month; + unsigned addr_date; + unsigned addr_day; + unsigned addr_hour; + unsigned addr_minutes; + unsigned addr_seconds; + unsigned addr_control; +} hw_nvram_device; + +static void * +hw_nvram_create(const char *name, + const device_unit *unit_address, + const char *args, + device *parent) +{ + hw_nvram_device *hw_nvram = ZALLOC(hw_nvram_device); + return hw_nvram; +} + +typedef struct _hw_nvram_reg_spec { + unsigned32 base; + unsigned32 size; +} hw_nvram_reg_spec; + +static void +hw_nvram_init_address(device *me) +{ + hw_nvram_device *hw_nvram = (hw_nvram_device*)device_data(me); + const device_property *reg = device_find_array_property(me, "reg"); + const hw_nvram_reg_spec *spec = reg->array; + int nr_entries = reg->sizeof_array / sizeof(*spec); + + if ((reg->sizeof_array % sizeof(*spec)) != 0) + error("devices/%s reg property of incorrect size\n", device_name(me)); + if (nr_entries > 1) + error("devices/%s reg property contains multiple specs\n", + device_name(me)); + + /* initialize the hw_nvram */ + if (hw_nvram->memory == NULL) { + hw_nvram->sizeof_memory = BE2H_4(spec->size); + hw_nvram->memory = zalloc(hw_nvram->sizeof_memory); + } + else + memset(hw_nvram->memory, hw_nvram->sizeof_memory, 0); + + hw_nvram->timezone = device_find_integer_property(me, "timezone"); + + hw_nvram->addr_year = hw_nvram->sizeof_memory - 1; + hw_nvram->addr_month = hw_nvram->sizeof_memory - 2; + hw_nvram->addr_date = hw_nvram->sizeof_memory - 3; + hw_nvram->addr_day = hw_nvram->sizeof_memory - 4; + hw_nvram->addr_hour = hw_nvram->sizeof_memory - 5; + hw_nvram->addr_minutes = hw_nvram->sizeof_memory - 6; + hw_nvram->addr_seconds = hw_nvram->sizeof_memory - 7; + hw_nvram->addr_control = hw_nvram->sizeof_memory - 8; + + device_attach_address(device_parent(me), + device_name(me), + attach_callback, + 0 /*address space*/, + BE2H_4(spec->base), + hw_nvram->sizeof_memory, + access_read_write_exec, + me); +} + +static int +hw_nvram_bcd(int val) +{ + return ((val / 10) << 4) + (val % 10); +} + +/* If reached an update interval and allowed, update the clock within + the hw_nvram. While this function could be implemented using events + it isn't on the assumption that the HW_NVRAM will hardly ever be + referenced and hence there is little need in keeping the clock + continually up-to-date */ +static void +hw_nvram_update_clock(hw_nvram_device *hw_nvram, cpu *processor) +{ +#ifdef HAVE_TIME_H + if (!(hw_nvram->memory[hw_nvram->addr_control] & 0xc0)) { + time_t host_time = time(NULL); + if (hw_nvram->host_time != host_time) { + time_t nvtime = hw_nvram->host_time + hw_nvram->timezone; + struct tm *clock = gmtime(&nvtime); + hw_nvram->host_time = host_time; + hw_nvram->memory[hw_nvram->addr_year] = hw_nvram_bcd(clock->tm_year); + hw_nvram->memory[hw_nvram->addr_month] = hw_nvram_bcd(clock->tm_mon + 1); + hw_nvram->memory[hw_nvram->addr_date] = hw_nvram_bcd(clock->tm_mday); + hw_nvram->memory[hw_nvram->addr_day] = hw_nvram_bcd(clock->tm_wday + 1); + hw_nvram->memory[hw_nvram->addr_hour] = hw_nvram_bcd(clock->tm_hour); + hw_nvram->memory[hw_nvram->addr_minutes] = hw_nvram_bcd(clock->tm_min); + hw_nvram->memory[hw_nvram->addr_seconds] = hw_nvram_bcd(clock->tm_sec); + } + } +#else + error("fixme - where do I find out GMT\n"); +#endif +} + +static void +hw_nvram_set_clock(hw_nvram_device *hw_nvram, cpu *processor) +{ + error ("fixme - how do I set the localtime\n"); +} + +static unsigned +hw_nvram_io_read_buffer(device *me, + void *dest, + int space, + unsigned_word addr, + unsigned nr_bytes, + cpu *processor, + unsigned_word cia) +{ + int i; + hw_nvram_device *hw_nvram = (hw_nvram_device*)device_data(me); + for (i = 0; i < nr_bytes; i++) { + unsigned address = (addr + i) % hw_nvram->sizeof_memory; + unsigned8 data = hw_nvram->memory[address]; + hw_nvram_update_clock(hw_nvram, processor); + ((unsigned8*)dest)[i] = data; + } + return nr_bytes; +} + +static unsigned +hw_nvram_io_write_buffer(device *me, + const void *source, + int space, + unsigned_word addr, + unsigned nr_bytes, + cpu *processor, + unsigned_word cia) +{ + int i; + hw_nvram_device *hw_nvram = (hw_nvram_device*)device_data(me); + for (i = 0; i < nr_bytes; i++) { + unsigned address = (addr + i) % hw_nvram->sizeof_memory; + unsigned8 data = ((unsigned8*)source)[i]; + if (address == hw_nvram->addr_control + && (data & 0x80) == 0 + && (hw_nvram->memory[address] & 0x80) == 0x80) + hw_nvram_set_clock(hw_nvram, processor); + else + hw_nvram_update_clock(hw_nvram, processor); + hw_nvram->memory[address] = data; + } + return nr_bytes; +} + +static device_callbacks const hw_nvram_callbacks = { + { hw_nvram_init_address, }, + { NULL, }, /* address */ + { hw_nvram_io_read_buffer, hw_nvram_io_write_buffer }, /* IO */ +}; + +const device_descriptor hw_nvram_device_descriptor[] = { + { "nvram", hw_nvram_create, &hw_nvram_callbacks }, + { NULL }, +}; + +#endif /* _HW_NVRAM_C_ */ diff --git a/sim/ppc/hw_pci_ide.c b/sim/ppc/hw_pci_ide.c new file mode 100644 index 00000000000..5057a291439 --- /dev/null +++ b/sim/ppc/hw_pci_ide.c @@ -0,0 +1 @@ +something goes here diff --git a/sim/ppc/hw_pic.c b/sim/ppc/hw_pic.c new file mode 100644 index 00000000000..3203f8c687b --- /dev/null +++ b/sim/ppc/hw_pic.c @@ -0,0 +1,98 @@ +/* ICU device: icu@
+ +
: read - processor nr +
: write - interrupt processor nr +
+ 4 : read - nr processors + + Single byte registers that control a simple ICU. + + Illustrates passing of events to parent device. Passing of + interrupts to an interrupt destination. */ + + +static unsigned +icu_io_read_buffer_callback(device *me, + void *dest, + int space, + unsigned_word addr, + unsigned nr_bytes, + cpu *processor, + unsigned_word cia) +{ + memset(dest, 0, nr_bytes); + switch (addr & 4) { + case 0: + *(unsigned_1*)dest = cpu_nr(processor); + break; + case 4: + *(unsigned_1*)dest = + device_find_integer_property(me, "/openprom/options/smp"); + break; + } + return nr_bytes; +} + + +static unsigned +icu_io_write_buffer_callback(device *me, + const void *source, + int space, + unsigned_word addr, + unsigned nr_bytes, + cpu *processor, + unsigned_word cia) +{ + unsigned_1 val = H2T_1(*(unsigned_1*)source); + /* tell the parent device that the interrupt lines have changed. + For this fake ICU. The interrupt lines just indicate the cpu to + interrupt next */ + device_interrupt_event(me, + val, /*my_port*/ + val, /*val*/ + processor, cia); + return nr_bytes; +} + +static void +icu_do_interrupt(event_queue *queue, + void *data) +{ + cpu *target = (cpu*)data; + /* try to interrupt the processor. If the attempt fails, try again + on the next tick */ + if (!external_interrupt(target)) + event_queue_schedule(queue, 1, icu_do_interrupt, target); +} + + +static void +icu_interrupt_event_callback(device *me, + int my_port, + device *source, + int source_port, + int level, + cpu *processor, + unsigned_word cia) +{ + /* the interrupt controller can't interrupt a cpu at any time. + Rather it must synchronize with the system clock before + performing an interrupt on the given processor */ + psim *system = cpu_system(processor); + cpu *target = psim_cpu(system, my_port); + if (target != NULL) { + event_queue *events = cpu_event_queue(target); + event_queue_schedule(events, 1, icu_do_interrupt, target); + } +} + +static device_callbacks const icu_callbacks = { + { generic_device_init_address, }, + { NULL, }, /* address */ + { icu_io_read_buffer_callback, + icu_io_write_buffer_callback, }, + { NULL, }, /* DMA */ + { icu_interrupt_event_callback, }, + { NULL, }, /* unit */ +}; + + diff --git a/sim/ppc/psim.texinfo b/sim/ppc/psim.texinfo new file mode 100644 index 00000000000..f81e46099c4 --- /dev/null +++ b/sim/ppc/psim.texinfo @@ -0,0 +1,1105 @@ +\input texinfo.tex @c -*-texinfo-*- +@comment %**start of header +@setfilename texinfo +@settitle Texinfo @value{edition} +@syncodeindex vr fn +@footnotestyle separate +@paragraphindent 2 +@smallbook +@comment %**end of header + +@c Set smallbook if printing in smallbook format so the example of the +@c smallbook font is actually written using smallbook; in bigbook, a kludge +@c is used for TeX output. +@set smallbook +@c @@clear smallbook + +@ignore +@ifinfo +@format +START-INFO-DIR-ENTRY +* Texinfo: (texinfo). The documentation format for the GNU Project. +END-INFO-DIR-ENTRY +@end format +@end ifinfo +@end ignore + +@set edition 2.21 +@set update-date 7 June 1995 +@set update-month June 1995 + +@c Experiment with smaller amounts of whitespace between chapters +@c and sections. +@tex +\global\chapheadingskip = 15pt plus 4pt minus 2pt +\global\secheadingskip = 12pt plus 3pt minus 2pt +\global\subsecheadingskip = 9pt plus 2pt minus 2pt +@end tex + +@c Experiment with smaller amounts of whitespace between paragraphs in +@c the 8.5 by 11 inch format. +@ifclear smallbook +@tex +\global\parskip 6pt plus 1pt +@end tex +@end ifclear + +@finalout + +@c Currently undocumented command, 5 December 1993: +@c +@c nwnode (Same as node, but no warnings; for `makeinfo'.) + +@ifinfo +This file documents Texinfo, a documentation system that uses a single +source file to produce both on-line information and a printed manual. + +Copyright (C) 1988, 1990, 1991, 1992, 1993, 1995 Free Software Foundation, Inc. + +This is the second edition of the Texinfo documentation,@* +and is consistent with version 2 of @file{texinfo.tex}. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). + +@end ignore +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the Free Software Foundation. +@end ifinfo + +@setchapternewpage odd + +@shorttitlepage Texinfo + +@titlepage +@c use the new format for titles +@title Texinfo +@subtitle The GNU Documentation Format +@subtitle Edition @value{edition}, for Texinfo Version Three +@subtitle @value{update-month} + +@author by Robert J. Chassell and Richard M. Stallman + +@comment Include the Distribution inside the titlepage so +@c that headings are turned off. + +@page +@vskip 0pt plus 1filll +Copyright @copyright{} 1988, 1990, 1991, 1992, 1993, 1995 Free Software Foundation, Inc. + +@sp 2 +This is the second edition of the Texinfo documentation,@* +and is consistent with version 2 of @file{texinfo.tex}. +@sp 2 + +Published by the Free Software Foundation @* +59 Temple Place Suite 330, @* +Boston, MA 02111-1307 USA @* +Printed copies are available for $15 each.@* +ISBN 1-882114-63-9 +@c ISBN number 1-882114-63-9 is for edition 2.20 of 28 February 1995 + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the Free Software Foundation. +@sp 2 +Cover art by Etienne Suvasa. +@end titlepage + +@ifinfo +@node Top, Copying, (dir), (dir) +@top Texinfo + +Texinfo is a documentation system that uses a single source file to +produce both on-line information and printed output.@refill + +The first part of this master menu lists the major nodes in this Info +document, including the @@-command and concept indices. The rest of +the menu lists all the lower level nodes in the document.@refill + +This is Edition @value{edition} of the Texinfo documentation, +@w{@value{update-date},} for Texinfo Version Three. +@end ifinfo + +@c Here is a spare copy of the chapter menu entry descriptions, +@c in case they are accidently deleted +@ignore +Your rights. +Texinfo in brief. +How to use Texinfo mode. +What is at the beginning of a Texinfo file? +What is at the end of a Texinfo file? +How to create chapters, sections, subsections, + appendices, and other parts. +How to provide structure for a document. +How to write nodes. +How to write menus. +How to write cross references. +How to mark words and phrases as code, + keyboard input, meta-syntactic + variables, and the like. +How to write quotations, examples, etc. +How to write lists and tables. +How to create indices. +How to insert @@-signs, braces, etc. +How to indicate results of evaluation, + expansion of macros, errors, etc. +How to force and prevent line and page breaks. +How to describe functions and the like in a uniform manner. +How to write footnotes. +How to specify text for either @TeX{} or Info. +How to print hardcopy. +How to create an Info file. +How to install an Info file +A list of all the Texinfo @@-commands. +Hints on how to write a Texinfo document. +A sample Texinfo file to look at. +Tell readers they have the right to copy + and distribute. +How to incorporate other Texinfo files. +How to write page headings and footings. +How to find formatting mistakes. +All about paragraph refilling. +A description of @@-Command syntax. +Texinfo second edition features. +A menu containing commands and variables. +A menu covering many topics. +@end ignore + +@menu +* Copying:: Your rights. +* Overview:: Texinfo in brief. +* Texinfo Mode:: How to use Texinfo mode. +* Beginning a File:: What is at the beginning of a Texinfo file? +* Ending a File:: What is at the end of a Texinfo file? +* Structuring:: How to create chapters, sections, subsections, + appendices, and other parts. +* Nodes:: How to write nodes. +* Menus:: How to write menus. +* Cross References:: How to write cross references. +* Marking Text:: How to mark words and phrases as code, + keyboard input, meta-syntactic + variables, and the like. +* Quotations and Examples:: How to write quotations, examples, etc. +* Lists and Tables:: How to write lists and tables. +* Indices:: How to create indices. +* Insertions:: How to insert @@-signs, braces, etc. +* Glyphs:: How to indicate results of evaluation, + expansion of macros, errors, etc. +* Breaks:: How to force and prevent line and page breaks. +* Definition Commands:: How to describe functions and the like + in a uniform manner. +* Footnotes:: How to write footnotes. +* Conditionals:: How to specify text for either @TeX{} or Info. +* Format/Print Hardcopy:: How to convert a Texinfo file to a file + for printing and how to print that file. +* Create an Info File:: Convert a Texinfo file into an Info file. +* Install an Info File:: Make an Info file accessible to users. +* Command List:: All the Texinfo @@-commands. +* Tips:: Hints on how to write a Texinfo document. +* Sample Texinfo File:: A sample Texinfo file to look at. +* Sample Permissions:: Tell readers they have the right to copy + and distribute. +* Include Files:: How to incorporate other Texinfo files. +* Headings:: How to write page headings and footings. +* Catching Mistakes:: How to find formatting mistakes. +* Refilling Paragraphs:: All about paragraph refilling. +* Command Syntax:: A description of @@-Command syntax. +* Obtaining TeX:: How to Obtain @TeX{}. +* New Features:: Texinfo second edition features. +* Command and Variable Index:: A menu containing commands and variables. +* Concept Index:: A menu covering many topics. + + --- The Detailed Node Listing --- + +Overview of Texinfo + +* Using Texinfo:: Create a conventional printed book + or an Info file. +* Info Files:: What is an Info file? +* Printed Books:: Characteristics of a printed book or manual. +* Formatting Commands:: @@-commands are used for formatting. +* Conventions:: General rules for writing a Texinfo file. +* Comments:: How to write comments and mark regions that + the formatting commands will ignore. +* Minimum:: What a Texinfo file must have. +* Six Parts:: Usually, a Texinfo file has six parts. +* Short Sample:: A short sample Texinfo file. +* Acknowledgements:: + +Using Texinfo Mode + +* Texinfo Mode Overview:: How Texinfo mode can help you. +* Emacs Editing:: Texinfo mode adds to GNU Emacs' general + purpose editing features. +* Inserting:: How to insert frequently used @@-commands. +* Showing the Structure:: How to show the structure of a file. +* Updating Nodes and Menus:: How to update or create new nodes and menus. +* Info Formatting:: How to format for Info. +* Printing:: How to format and print part or all of a file. +* Texinfo Mode Summary:: Summary of all the Texinfo mode commands. + +Updating Nodes and Menus + +* Updating Commands:: Five major updating commands. +* Updating Requirements:: How to structure a Texinfo file for + using the updating command. +* Other Updating Commands:: How to indent descriptions, insert + missing nodes lines, and update + nodes in sequence. + +Beginning a Texinfo File + +* Four Parts:: Four parts begin a Texinfo file. +* Sample Beginning:: Here is a sample beginning for a Texinfo file. +* Header:: The very beginning of a Texinfo file. +* Info Summary and Permissions:: Summary and copying permissions for Info. +* Titlepage & Copyright Page:: Creating the title and copyright pages. +* The Top Node:: Creating the `Top' node and master menu. +* Software Copying Permissions:: Ensure that you and others continue to + have the right to use and share software. + +The Texinfo File Header + +* First Line:: The first line of a Texinfo file. +* Start of Header:: Formatting a region requires this. +* setfilename:: Tell Info the name of the Info file. +* settitle:: Create a title for the printed work. +* setchapternewpage:: Start chapters on right-hand pages. +* paragraphindent:: An option to specify paragraph indentation. +* End of Header:: Formatting a region requires this. + +The Title and Copyright Pages + +* titlepage:: Create a title for the printed document. +* titlefont center sp:: The @code{@@titlefont}, @code{@@center}, + and @code{@@sp} commands. +* title subtitle author:: The @code{@@title}, @code{@@subtitle}, + and @code{@@author} commands. +* Copyright & Permissions:: How to write the copyright notice and + include copying permissions. +* end titlepage:: Turn on page headings after the title and + copyright pages. +* headings on off:: An option for turning headings on and off + and double or single sided printing. + +The `Top' Node and Master Menu + +* Title of Top Node:: Sketch what the file is about. +* Master Menu Parts:: A master menu has three or more parts. + +Ending a Texinfo File + +* Printing Indices & Menus:: How to print an index in hardcopy and + generate index menus in Info. +* Contents:: How to create a table of contents. +* File End:: How to mark the end of a file. + +Chapter Structuring + +* Tree Structuring:: A manual is like an upside down tree @dots{} +* Structuring Command Types:: How to divide a manual into parts. +* makeinfo top:: The @code{@@top} command, part of the `Top' node. +* chapter:: +* unnumbered & appendix:: +* majorheading & chapheading:: +* section:: +* unnumberedsec appendixsec heading:: +* subsection:: +* unnumberedsubsec appendixsubsec subheading:: +* subsubsection:: Commands for the lowest level sections. +* Raise/lower sections:: How to change commands' hierarchical level. + +Nodes + +* Two Paths:: Different commands to structure + Info output and printed output. +* Node Menu Illustration:: A diagram, and sample nodes and menus. +* node:: How to write a node, in detail. +* makeinfo Pointer Creation:: How to create node pointers with @code{makeinfo}. + +The @code{@@node} Command + +* Node Names:: How to choose node and pointer names. +* Writing a Node:: How to write an @code{@@node} line. +* Node Line Tips:: Keep names short. +* Node Line Requirements:: Keep names unique, without @@-commands. +* First Node:: How to write a `Top' node. +* makeinfo top command:: How to use the @code{@@top} command. +* Top Node Summary:: Write a brief description for readers. + +Menus + +* Menu Location:: Put a menu in a short node. +* Writing a Menu:: What is a menu? +* Menu Parts:: A menu entry has three parts. +* Less Cluttered Menu Entry:: Two part menu entry. +* Menu Example:: Two and three part menu entries. +* Other Info Files:: How to refer to a different Info file. + +Cross References + +* References:: What cross references are for. +* Cross Reference Commands:: A summary of the different commands. +* Cross Reference Parts:: A cross reference has several parts. +* xref:: Begin a reference with `See' @dots{} +* Top Node Naming:: How to refer to the beginning of another file. +* ref:: A reference for the last part of a sentence. +* pxref:: How to write a parenthetical cross reference. +* inforef:: How to refer to an Info-only file. + +@code{@@xref} + +* Reference Syntax:: What a reference looks like and requires. +* One Argument:: @code{@@xref} with one argument. +* Two Arguments:: @code{@@xref} with two arguments. +* Three Arguments:: @code{@@xref} with three arguments. +* Four and Five Arguments:: @code{@@xref} with four and five arguments. + +Marking Words and Phrases + +* Indicating:: How to indicate definitions, files, etc. +* Emphasis:: How to emphasize text. + +Indicating Definitions, Commands, etc. + +* Useful Highlighting:: Highlighting provides useful information. +* code:: How to indicate code. +* kbd:: How to show keyboard input. +* key:: How to specify keys. +* samp:: How to show a literal sequence of characters. +* var:: How to indicate a metasyntactic variable. +* file:: How to indicate the name of a file. +* dfn:: How to specify a definition. +* cite:: How to refer to a book that is not in Info. + +Emphasizing Text + +* emph & strong:: How to emphasize text in Texinfo. +* Smallcaps:: How to use the small caps font. +* Fonts:: Various font commands for printed output. +* Customized Highlighting:: How to define highlighting commands. + +Quotations and Examples + +* Block Enclosing Commands:: Use different constructs for + different purposes. +* quotation:: How to write a quotation. +* example:: How to write an example in a fixed-width font. +* noindent:: How to prevent paragraph indentation. +* Lisp Example:: How to illustrate Lisp code. +* smallexample & smalllisp:: Forms for the @code{@@smallbook} option. +* display:: How to write an example in the current font. +* format:: How to write an example that does not narrow + the margins. +* exdent:: How to undo the indentation of a line. +* flushleft & flushright:: How to push text flushleft or flushright. +* cartouche:: How to draw cartouches around examples. + +Making Lists and Tables + +* Introducing Lists:: Texinfo formats lists for you. +* itemize:: How to construct a simple list. +* enumerate:: How to construct a numbered list. +* Two-column Tables:: How to construct a two-column table. + +Making a Two-column Table + +* table:: How to construct a two-column table. +* ftable vtable:: How to construct a two-column table + with automatic indexing. +* itemx:: How to put more entries in the first column. + +Creating Indices + +* Index Entries:: Choose different words for index entries. +* Predefined Indices:: Use different indices for different kinds + of entry. +* Indexing Commands:: How to make an index entry. +* Combining Indices:: How to combine indices. +* New Indices:: How to define your own indices. + +Combining Indices + +* syncodeindex:: How to merge two indices, using @code{@@code} + font for the merged-from index. +* synindex:: How to merge two indices, using the + default font of the merged-to index. + +Special Insertions + +* Braces Atsigns Periods:: How to insert braces, @samp{@@} and periods. +* dmn:: How to format a dimension. +* Dots Bullets:: How to insert dots and bullets. +* TeX and copyright:: How to insert the @TeX{} logo + and the copyright symbol. +* minus:: How to insert a minus sign. +* math:: How to format a mathematical expression. + +Inserting @samp{@@}, Braces, and Periods + +* Inserting An Atsign:: +* Inserting Braces:: How to insert @samp{@{} and @samp{@}} +* Controlling Spacing:: How to insert the right amount of space + after punctuation within a sentence. + +Inserting Ellipsis, Dots, and Bullets + +* dots:: How to insert dots @dots{} +* bullet:: How to insert a bullet. + +Inserting @TeX{} and the Copyright Symbol + +* tex:: How to insert the @TeX{} logo. +* copyright symbol:: How to use @code{@@copyright}@{@}. + +Glyphs for Examples + +* Glyphs Summary:: +* result:: How to show the result of expression. +* expansion:: How to indicate an expansion. +* Print Glyph:: How to indicate printed output. +* Error Glyph:: How to indicate an error message. +* Equivalence:: How to indicate equivalence. +* Point Glyph:: How to indicate the location of point. + +Making and Preventing Breaks + +* Break Commands:: Cause and prevent splits. +* Line Breaks:: How to force a single line to use two lines. +* w:: How to prevent unwanted line breaks. +* sp:: How to insert blank lines. +* page:: How to force the start of a new page. +* group:: How to prevent unwanted page breaks. +* need:: Another way to prevent unwanted page breaks. + +Definition Commands + +* Def Cmd Template:: How to structure a description using a + definition command. +* Optional Arguments:: How to handle optional and repeated arguments. +* deffnx:: How to group two or more `first' lines. +* Def Cmds in Detail:: All the definition commands. +* Def Cmd Conventions:: Conventions for writing definitions. +* Sample Function Definition:: + +The Definition Commands + +* Functions Commands:: Commands for functions and similar entities. +* Variables Commands:: Commands for variables and similar entities. +* Typed Functions:: Commands for functions in typed languages. +* Typed Variables:: Commands for variables in typed languages. +* Abstract Objects:: Commands for object-oriented programming. +* Data Types:: The definition command for data types. + +Footnotes + +* Footnote Commands:: How to write a footnote in Texinfo. +* Footnote Styles:: Controlling how footnotes appear in Info. + +Conditionally Visible Text + +* Conditional Commands:: How to specify text for Info or @TeX{}. +* Using Ordinary TeX Commands:: You can use any and all @TeX{} commands. +* set clear value:: How to designate which text to format (for + both Info and @TeX{}); and how to set a + flag to a string that you can insert. + +@code{@@set}, @code{@@clear}, and @code{@@value} + +* ifset ifclear:: Format a region if a flag is set. +* value:: Replace a flag with a string. +* value Example:: An easy way to update edition information. + +Format and Print Hardcopy + +* Use TeX:: Use @TeX{} to format for hardcopy. +* Format with tex/texindex:: How to format in a shell. +* Format with texi2dvi:: A simpler way to use the shell. +* Print with lpr:: How to print. +* Within Emacs:: How to format and print from an Emacs shell. +* Texinfo Mode Printing:: How to format and print in Texinfo mode. +* Compile-Command:: How to print using Emacs's compile command. +* Requirements Summary:: @TeX{} formatting requirements summary. +* Preparing for TeX:: What you need to do to use @TeX{}. +* Overfull hboxes:: What are and what to do with overfull hboxes. +* smallbook:: How to print small format books and manuals. +* A4 Paper:: How to print on European A4 paper. +* Cropmarks and Magnification:: How to print marks to indicate the size + of pages and how to print scaled up output. + +Creating an Info File + +* makeinfo advantages:: @code{makeinfo} provides better error checking. +* Invoking makeinfo:: How to run @code{makeinfo} from a shell. +* makeinfo options:: Specify fill-column and other options. +* Pointer Validation:: How to check that pointers point somewhere. +* makeinfo in Emacs:: How to run @code{makeinfo} from Emacs. +* texinfo-format commands:: Two Info formatting commands written + in Emacs Lisp are an alternative + to @code{makeinfo}. +* Batch Formatting:: How to format for Info in Emacs Batch mode. +* Tag and Split Files:: How tagged and split files help Info + to run better. + +Installing an Info File + +* Directory file:: The top level menu for all Info files. +* New Info File:: Listing a new info file. +* Other Info Directories:: How to specify Info files that are + located in other directories. + +Sample Permissions + +* Inserting Permissions:: How to put permissions in your document. +* ifinfo Permissions:: Sample @samp{ifinfo} copying permissions. +* Titlepage Permissions:: Sample Titlepage copying permissions. + +Include Files + +* Using Include Files:: How to use the @code{@@include} command. +* texinfo-multiple-files-update:: How to create and update nodes and + menus when using included files. +* Include File Requirements:: What @code{texinfo-multiple-files-update} expects. +* Sample Include File:: A sample outer file with included files + within it; and a sample included file. +* Include Files Evolution:: How use of the @code{@@include} command + has changed over time. + +Page Headings + +* Headings Introduced:: Conventions for using page headings. +* Heading Format:: Standard page heading formats. +* Heading Choice:: How to specify the type of page heading. +* Custom Headings:: How to create your own headings and footings. + +Formatting Mistakes + +* makeinfo preferred:: @code{makeinfo} finds errors. +* Debugging with Info:: How to catch errors with Info formatting. +* Debugging with TeX:: How to catch errors with @TeX{} formatting. +* Using texinfo-show-structure:: How to use @code{texinfo-show-structure}. +* Using occur:: How to list all lines containing a pattern. +* Running Info-Validate:: How to find badly referenced nodes. + +Finding Badly Referenced Nodes + +* Using Info-validate:: How to run @code{Info-validate}. +* Unsplit:: How to create an unsplit file. +* Tagifying:: How to tagify a file. +* Splitting:: How to split a file manually. + +Second Edition Features + +* New Texinfo Mode Commands:: The updating commands are especially useful. +* New Commands:: Many newly described @@-commands. +@end menu + +@node Copying, Overview, Top, Top +@comment node-name, next, previous, up +@unnumbered Texinfo Copying Conditions +@cindex Copying conditions +@cindex Conditions for copying Texinfo + +The programs currently being distributed that relate to Texinfo include +portions of GNU Emacs, plus other separate programs (including +@code{makeinfo}, @code{info}, @code{texindex}, and @file{texinfo.tex}). +These programs are @dfn{free}; this means that everyone is free to use +them and free to redistribute them on a free basis. The Texinfo-related +programs are not in the public domain; they are copyrighted and there +are restrictions on their distribution, but these restrictions are +designed to permit everything that a good cooperating citizen would want +to do. What is not allowed is to try to prevent others from further +sharing any version of these programs that they might get from +you.@refill + + Specifically, we want to make sure that you have the right to give +away copies of the programs that relate to Texinfo, that you receive +source code or else can get it if you want it, that you can change these +programs or use pieces of them in new free programs, and that you know +you can do these things.@refill + + To make sure that everyone has such rights, we have to forbid you to +deprive anyone else of these rights. For example, if you distribute +copies of the Texinfo related programs, you must give the recipients all +the rights that you have. You must make sure that they, too, receive or +can get the source code. And you must tell them their rights.@refill + + Also, for our own protection, we must make certain that everyone finds +out that there is no warranty for the programs that relate to Texinfo. +If these programs are modified by someone else and passed on, we want +their recipients to know that what they have is not what we distributed, +so that any problems introduced by others will not reflect on our +reputation.@refill + + The precise conditions of the licenses for the programs currently +being distributed that relate to Texinfo are found in the General Public +Licenses that accompany them.@refill + +@node Overview, Texinfo Mode, Copying, Top +@comment node-name, next, previous, up +@chapter Overview of Texinfo +@cindex Overview of Texinfo +@cindex Texinfo overview + +@dfn{Texinfo}@footnote{Note that the first syllable of ``Texinfo'' is +pronounced like ``speck'', not ``hex''. This odd pronunciation is +derived from, but is not the same as, the pronunciation of @TeX{}. In +the word @TeX{}, the @samp{X} is actually the Greek letter ``chi'' +rather than the English letter ``ex''. Pronounce @TeX{} as if the +@samp{X} were the last sound in the name `Bach'; but pronounce Texinfo +as if the @samp{x} were a `k'. Spell ``Texinfo'' with a capital ``T'' +and write the other letters in lower case.} +is a documentation system that uses a single source file to produce both +on-line information and printed output. This means that instead of +writing two different documents, one for the on-line help or other on-line +information and the other for a typeset manual or other printed work, you +need write only one document. When the work is revised, you need revise +only one document. (You can read the on-line information, known as an +@dfn{Info file}, with an Info documentation-reading program.)@refill + +@menu +* Using Texinfo:: Create a conventional printed book + or an Info file. +* Info Files:: What is an Info file? +* Printed Books:: Characteristics of a printed book or manual. +* Formatting Commands:: @@-commands are used for formatting. +* Conventions:: General rules for writing a Texinfo file. +* Comments:: How to write comments and mark regions that + the formatting commands will ignore. +* Minimum:: What a Texinfo file must have. +* Six Parts:: Usually, a Texinfo file has six parts. +* Short Sample:: A short sample Texinfo file. +* Acknowledgements:: +@end menu + +@c ************************************************************************ + + + +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename psim.info +@settitle PSIM +@setchapternewpage odd +@c %**end of header + + + +@ifinfo +This file documents the program PSIM. + +Copyright (C) 1994-1996, Andrew Cagney. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@ignore +Permission is granted to process this file through Tex and print the +results, provided the printed document carries copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). + +@end ignore +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, subject to the terms +of the GNU General Public License, which includes the provision that the +entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions. +@end ifinfo + + +@titlepage +@title PSIM +@subtitle Model of the PowerPC Environments +@author Andrew Cagney + +@page +@vskip Opt plus ifill +Copyright @copyright{} 1994-1996, Andrew Cagney + +This is the first edition of the PSIM manual and is consistent with PSIM +version 1.0. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, subject to the terms +of the GNU General Public License, which includes the provision that the +entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions. +@end titlepage + + + +@menu + +* Copying:: Your rights and freedoms. +* First Chappeter:: Getting started .... +* Second Chapter:: Getting finished .... + + +@end menu + + +PSIM is a program written in extended ANSI-C that implements an +instruction level simulation of the PowerPC environment. It is freely +available in source code form under the terms of the GNU General +Public License (version 2 or later). + +The PowerPC Architecture is described as having three levels of +compliance: + + UEA - User Environment Architecture + VEA - Virtual Environment Architecture + OEA - Operating Environment Architecture + +PSIM both implements all three levels of the PowerPC and includes (for +each level) a corresponding simulated run-time environment. + +In addition, PSIM, to the execution unit level, models the performance +of most of the current PowerPC implementations (contributed by Michael +Meissner). This detailed performance monitoring (unlike many other +simulators) resulting in only a relatively marginal reduction in the +simulators performance. + + +A description of how to build PSIM is contained in the file: + + ftp://ftp.ci.com.au/pub/psim/INSTALL + or ftp://cambridge.cygnus.com/pub/psim/INSTALL + +while an overview of how to use PSIM is in: + + ftp://ftp.ci.com.au/pub/psim/RUN +or ftp://cambridge.cygnus.com/pub/psim/RUN + +This file is found in: + + ftp://ftp.ci.com.au/pub/psim/README +or ftp://cambridge.cygnus.com/pub/psim/README + + +Thanks goes firstly to: + + Corinthian Engineering Pty Ltd + Cygnus Support + Highland Logic Pty Ltd + +who provided the resources needed for making this software available +on the Internet. + +More importantly I'd like to thank the following individuals who each +contributed in their own unique way: + + Allen Briggs, Bett Koch, David Edelsohn, Gordon Irlam, + Michael Meissner, Bob Mercier, Richard Perini, Dale Rahn, + Richard Stallman, Mitchele Walker + + + Andrew Cagney + Feb, 1995 + + + ---------------------------------------------------------------------- + + + What features does PSIM include? + + Monitoring and modeling + + PSIM includes (thanks to Michael Meissner) + a detailed model of most of the PowerPC + implementations to the functional unit level. + + + SMP + + The PowerPC ISA defines SMP synchronizing instructions. + This simulator implements a limited, but functional, + subset of the PowerPC synchronization instructions + behaviour. Programs that restrict their synchronization + primitives to those that work with this functional + sub-set (eg P() and V()) are able to run on the SMP + version of PSIM. + + People intending to use this system should study + the code implementing the lwarx instruction. + + ENDIAN SUPPORT + + PSIM implements the PowerPC's big and little (xor + endian) modes and correctly simulates code that + switches between these two modes. + + In addition, psim can model a true little-endian + machine. + + ISA (Instruction Set Architecture) models + + PSIM includes a model of the UEA, VEA and OEA. This + includes the time base registers (VEA) and HTAB + and BATS (OEA). + + In addition, a preliminary model of the 64 bit + PowerPC architecture is implemented. + + IO Hardware + + PSIM's internals are based around the concept + of a Device Tree. This tree intentionally + resembles that of the Device Tree found in + OpenBoot firmware. PSIM is flexible enough + to allow the user to fully configure this device + tree (and consequently the hardware model) at + run time. + + Run-time environments: + + PSIM's UEA model includes emulation for BSD + based UNIX system calls. + + PSIM's OEA model includes emulation of either: + + o OpenBoot client interface + + o MOTO's BUG interface. + + + Floating point + + Preliminary support for floating point is included. + + + Who would be interested in PSIM? + + o the curious + + Using psim, gdb, gcc and binutils the curious + user can construct an environment that allows + them to play with PowerPC Environment without + the need for real hardware. + + + o the analyst + + PSIM includes many (contributed) monitoring + features which (unlike many other simulators) + do not come with a great penalty in performance. + + Thus the performance analyst is able to use + this simulator to analyse the performance of + the system under test. + + If PSIM doesn't monitor a components of interest, + the source code is freely available, and hence + there is no hinderance to changing things + to meet a specific analysts needs. + + + o the serious SW developer + + PSIM models all three levels of the PowerPC + Architecture: UEA, VEA and OEA. Further, + the internal design is such that PSIM can + be extended to support additional requirements. + + + What performance analysis measurements can PSIM perform? + + Below is the output from a recent analysis run + (contributed by Michael Meissner): + + For the following program: + + long + simple_rand () + { + static unsigned long seed = 47114711; + unsigned long this = seed * 1103515245 + 12345; + seed = this; + /* cut-cut-cut - see the file RUN.psim */ + } + + Here is the current output generated with the -I switch on a P90 + (the compiler used is the development version of GCC with a new + scheduler replacing the old one): + + CPU #1 executed 41,994 AND instructions. + CPU #1 executed 519,785 AND Immediate instructions. + . + . + . + CPU #1 executed 1 System Call instruction. + CPU #1 executed 207,746 XOR instructions. + + CPU #1 executed 23,740,856 cycles. + CPU #1 executed 10,242,780 stalls waiting for data. + CPU #1 executed 1 stall waiting for a function unit. + . + . + . + CPU #1 executed 3,136,229 branch functional unit instructions. + CPU #1 executed 16,949,396 instructions that were accounted for in timing info. + CPU #1 executed 871,920 data reads. + CPU #1 executed 971,926 data writes. + CPU #1 executed 221 icache misses. + CPU #1 executed 16,949,396 instructions in total. + + Simulator speed was 250,731 instructions/second + + + What motivated PSIM? + + As an idea, psim was first discussed seriously during mid + 1994. At that time its main objectives were: + + + o good performance + + Many simulators loose out by only providing + a binary interface to the internals. This + interface eventually becomes a bottle neck + in the simulators performance. + + It was intended that PSIM would avoid this + problem by giving the user access to the + full source code. + + Further, by exploiting the power of modern + compilers it was hoped that PSIM would achieve + good performance with out having to compromise + its internal design. + + + o practical portability + + Rather than try to be portable to every + C compiler on every platform, it was decided + that PSIM would restrict its self to supporting + ANSI compilers that included the extension + of a long long type. + + GCC is one such compiler, consequently PSIM + should be portable to any machine running GCC. + + + o flexibility in its design + + PSIM should allow the user to select the + features required and customise the build + accordingly. By having the source code, + the compiler is able to eliminate any un + used features of the simulator. + + After all, let the compiler do the work. + + + o SMP + + A model that allowed the simulation of + SMP platforms with out the large overhead + often encountered with such models. + + + PSIM achieves each of these objectives. + + + Is PSIM PowerPC Platform (PPCP) (nee CHRP) Compliant? + + No. + + Among other things it does not have an Apple ROM socket. + + + Could PSIM be extended so that it models a CHRP machine? + + Yes. + + PSIM has been designed with the CHRP spec in mind. To model + a CHRP desktop the following would need to be added: + + o An apple ROM socket :-) + + o Model of each of the desktop IO devices + + o An OpenPIC device. + + o RTAS (Run Time Abstraction Services). + + o A fully populated device tree. + + + Is the source code available? + + Yes. + + The source code to PSIM is available under the terms of + the GNU Public Licence. This allows you to distribute + the source code for free but with certain conditions. + + See the file: + + ftp://archie.au/gnu/COPYING + + For details of the terms and conditions. + + + Where do I send bugs or report problems? + + There is a mailing list (subscribe through majordomo@ci.com.au) at: + + powerpc-psim@ci.com.au + + If I get the ftp archive updated I post a note to that mailing list. + In addition your welcome to send bugs or problems either to me or to + that e-mail list. + + This list currently averages zero articles a day. + + + Does PSIM have any limitations or problems? + + PSIM can't run rs6000/AIX binaries - At present PSIM can only + simulate static executables. Since an AIX executable is + never static, PSIM is unable to simulate its execution. + + PSIM is still under development - consequently there are going + to be bugs. + + See the file BUGS (included in the distribution) for any + other outstanding issues. + -- 2.30.2