Commit graph

375 commits

Author SHA1 Message Date
Mark Pizzolato
d291a6e838 Fix compiler identified array bounds issues 2012-12-21 12:55:57 -08:00
Mark Pizzolato
ca49c8c0b1 Fix for bug in help command when asking for help for command aliases. Reported by Darrell Pittman 2012-12-21 12:38:07 -08:00
Mark Pizzolato
f713a69ff9 Fix commit id display under MinGW compile 2012-12-20 16:42:33 -08:00
Mark Pizzolato
f8e68b70b5 Adding initial support to display the git commit id in the simulator code. 2012-12-20 15:04:37 -08:00
Mark Pizzolato
133b1b22b5 Revised comments 2012-12-19 12:49:08 -08:00
Mark Pizzolato
20ed6df379 Made the SET ENV command be SET ENVIRONMENT which will match both but be consistent with using commands which work as long as they are unambiguous. 2012-12-19 05:41:38 -08:00
Mark Pizzolato
50cf91d441 Merge branch 'SerialMux' and compiler suggested cleanup 2012-12-18 09:52:14 -08:00
Mark Pizzolato
762aacf7ad Merge branch 'Extra-VAXen' 2012-12-17 03:19:07 -08:00
Mark Pizzolato
cd0ef35bbf Added command alias SHOW MUX for SHOW MULTIPLEXOR. To avoid collision with simulators which may have devices named MUX, the device names/units are examined prior to the standard SHOW arguments. Simulators which have a device named MUX can't use the SHOW MUX alias. 2012-12-16 07:03:19 -08:00
Mark Pizzolato
0450a9b430 Compiler suggested cleanup 2012-12-15 07:56:42 -08:00
Mark Pizzolato
b466bdc9c6 Compiler warning cleanup 2012-12-13 13:41:57 -08:00
Mark Pizzolato
2b5ceae2be Added missing sim_cancel support for device simulation code using the sim_disk and sim_tape libraries and doing asynchronous I/O if asynchronous I/O is active 2012-12-12 10:58:19 -08:00
Mark Pizzolato
f3bc30aa39 Extended command argument substitution to allow large environment variable substitutions. 2012-12-08 15:24:10 -08:00
Mark Pizzolato
72ca9de180 Clang compiler cleanup for new sim_debug_bits 2012-12-06 08:15:14 -08:00
Mark Pizzolato
2c1d2b9a88 Fixed minor sim_debug_bits issues. 2012-12-05 20:47:34 -08:00
Mark Pizzolato
bcf0e8b19c Generalized sim_debug_u16 into sim_debug_bits and added support to display bit fields of variable size as well as bit states. 2012-12-04 09:32:40 -08:00
Mark Pizzolato
7c7df669ad Asynchronous Support
scp.c, scp.h
	- added sim_uname (Unit Name) API to simplify places which might want to display it (mostly debug messages).
	- added support for clock co-scheduling
	- added debugging to trace event queue activities

    sim_defs.h
	- added support for clock co-scheduling
	- added support for sim_uname (Thread local storage macro)
	- added support for debugging to trace event queue activities
	- simplified debug code by using sim_uname
	- fixed support macro for sim_is_active when asynch timers are in use

   sim_rev.h
	- fixed nested comments

    sim_tmxr.c, sim_tmxr.h
	- added support for clock co-scheduling
	- simplified debug code by using sim_uname
	- added support for devices which poll for output on different units

    sim_timer.c, sim_timer.h
	- added support for clock co-scheduling
	- fixed asynchronous clock calibration to smooth out calibration adjustments
	- simplified debug code by using sim_uname
	- added ability (when running with asynchronous support) to explicitly disable or enable asynchronous timer support.
	- changed sim_timer_inst_per_sec to return a double value since the result is always used in a double expression and integer overflow could occur under strange timing conditions

    vax/vax_stddev.c
	- converted from simulator specific clock co-scheduling to generic clock co-scheduling.

    vax/vax_cpu.c
	- added EVENT and ACTIVATE debug flag (SET CPU DEBUG=EVENT;ACTIVATE) support

    pdp11/pdp11_dz.c
	- converted from simulator specific clock co-scheduling to generic clock co-scheduling.

    pdp11/pdp11_vh.c
	- converted from simulator specific clock co-scheduling to generic clock co-scheduling.

    pdp11/pdp11_xq.c
	- converted from simulator specific clock co-scheduling to generic clock co-scheduling.
2012-11-12 15:33:35 -08:00
Mark Pizzolato
0b1b5f1ede scp.c - Added a 'set prompt "XXX"' command to change the prompt which is used while scp collects command input. 2012-11-05 15:14:00 -08:00
Mark Pizzolato
69666f1480 Fixed message reporting after command completion:
scp.c,scp.h - Gave priority to a command message handler to determine what values result in displayed messages and exported run_cmd_message for use by simulators which add simulator specific BOOT commands which leverage the run_cmd logic and should also leverage the run_cmd_message for message display

VAX/vax610_sysdev.c, vax730_sys.c, vax750_cmi.c, vax780_sbi.c - Added BOOT command message dispatch to run_cmd_message for simulators which perform preprocessing on BOOT activities but otherwise then dispatch to run_cmd.
2012-10-31 10:09:04 -07:00
Mark Pizzolato
99f042f7dc scp.c - Fixed RESTORE command to detach all attached devices before actually restoring. The goal here is to make restore behavior consistent without regard to the current VM state prior to the restore. 2012-10-24 12:56:03 -07:00
Mark Pizzolato
c2f03a7541 scp.c - Finished merge from master branch - addition of SET DEFAULT and SHOW DEFAULT command.
- Added CD and PWD commands as aliases of SET DEFAULT and SHOW DEFAULT
2012-10-23 14:23:45 -07:00
Mark Pizzolato
02cb620c9b Change to support serial ports on multiplexer devices without any changes to existing multiplexer device emulation code.
Added support for per line tcp listen ports.
Added support for per line outgoing tcp/telnet connections.

Removed DEV_NET from pdp11_dz and pdp11_vh emulators to allow proper restore of
2012-10-17 08:40:01 -07:00
Mark Pizzolato
24696892fd Merge branch 'DMC11' into SerialMux
Conflicts:
	scp.c
	sim_ether.c
	sim_ether.h
	sim_tmxr.c
2012-10-16 15:50:38 -07:00
Mark Pizzolato
30ce7fdbaa Revised the socket library sim_sock(.c & .h) to support both IPv4 and IPv6 leveraging the RFC3493 APIs.
All dependent code has been updated to use the revised interfaces.
2012-09-28 15:34:55 -07:00
Andrea Bonomi
405c70bccd set default/show default commands fix 2012-08-28 07:40:42 +02:00
Andrea Bonomi
a1a6a8a40d show_default fix 2012-08-23 17:18:31 +02:00
Andrea Bonomi
715bc12d3b show default & set default command added
Hello,
I fixed the show/set default commands and tested on the following host
platform: OSX(x64), Linux(arm), FreeBSD(x86), Windows(x64),
OpenVMS(VAX).
The commands are very simple and the code is the same for all the  *nix
and VMS, and it is a little different for Windows.
Andrea
2012-08-21 12:50:27 +02:00
Mark Pizzolato
030d790b4c Asynchronous Timer Support
scp.c, scp.h
	- Change the sim_clock_queue event list to be terminated by the value QUEUE_LIST_END instead of NULL.  This allows easy determination of whether a unit is on a list since when it is not on a list the next pointer is NULL.
	- standardized the usage of UPDATE_SIM_TIME
	- Added support for internal/pseudo devices to support the TIMER and CON-TEL pseudo devices (to enable and disable debugging)
	- Reverted to the prior "SET CONSOLE DEBUG" command semantics since the console debug can be manipulated via the generic "SET <dev> DEBUG" command (i.e. SET CON-TEL DEBUG=TRC;XMT;RCV)
	- Changed "SHOW TIMERS" to "SHOW CLOCKS" to display the current calibrated timer information
	- Added sim_is_active_bool API to return the boolean active status avoiding the potential work walking the list when most callers aren't interested in the event firing time
	- Fixed run_boot_prep to properly record the not queued status of any units which are removed from the sim_clock_queue during initialization
	- Added display of DEBUG, NODEBUG options to the SHOW SHOW command

    sim_timer.c, sim_timer.h
	- Added asynchronous timer capabilities with support for calibration and idling
	- Added internal/pseudo device to support debugging of Idle, Calibration and asynch timer activites.
	- Added suppression of timer calibration when idling has occurred

    sim_tmxr.c, sim_tmxr.h
	- Added tmxr_activate_after and macro definition for sim_activate_after to invoke it for proper behavior with multiplexer devices
	- Added all polling units to the standard timer queue when dropping back to the simulator command prompt to accommodate the potential to disable asynch mode
	- Fixed synchronization to operate with pthread synchronized asynch queue and proper stopping of poll when dropping back to the simulator command prompt
	- Fixed calls to select to have a timeout with properly ranged tv_usec values and dealt with possible EINTR return from select

    sim_console.c, sim_console.h
	- Changed internal/pseudo console telnet device name to CON=TEL
	- Reverted to the prior "SET CONSOLE DEBUG" command semantics since the console debug can be manipulated via the generic "SET <dev> DEBUG" command (i.e. SET CON-TEL DEBUG=TRC;XMT;RCV)
	- Fixed synchronization to operate with pthread synchronized asynch queue and proper stopping of poll when dropping back to the simulator command prompt
	- Fixed calls to select to have a timeout with properly ranged tv_usec values

    sim_defs.h
	- Added necessary unit fields to support asynchronous timing activities
	- Added asynchronous macros to support async timing activities
	- Fixed asynch pthread only macros (not using AIO_INTRINSICS).
	- Fixed the definition of the UDATA macro which was never adjusted to accommodate the insertion of 2 extra fields in the unit structure and thus made the initialization of the unit wait field meaningless.
	- Changed the NOQUEUE_WAIT value from 10000 to 1000000.  This is only used when the sim_clock_queue is empty, which normally never happens on any simulator since they all have clocks and/or other frequently polling devices.  With asynchronous multiplexer and timing support the queue is often empty and this value is then used when calculating idling delays.  If it is too small, idling will be inefficient.  Being large should not be a problem otherwise.

    Interdata/id16_cpu.c
	- removed test of sim_idle_enab before calling sim_idle

    Interdata/id32_cpu.c
	- removed test of sim_idle_enab before calling sim_idle

    vax/vax_cpu.c
	- removed test of sim_idle_enab before calling sim_idle

    vax/vax_stddev.c
	- converted CLK device to use the internal timer service API sim_activate_after to leverage asynchronous timing when available
2012-05-26 07:16:04 -07:00
Mark Pizzolato
7c38b83d7c Asynchronous Multiplexer and Console Support
scp.c, scp.h, sim_defs.h
     - Added commands:
          SHOW MULTIPLEXER (MUX)
          SHOW TIMERS
     - Added facilities/APIs:
          sim_activate_after - time specific event scheduling (vs instruction scheduling) API visible, optional separate thread implementation in a later revision
     - Changed Commands:
          SET CONSOLE DEBUG no longer affects global debugging, but merely debugging for the console subsystem.  Use SET DEBUG and SET NODEBUG to affect global debugging.
     - Added Asynchronous polling support

sim_tmxr.h, sim_tmxr.c
     - Added Asynchronous capabilities to the multiplexer subsystem to avoid polling for input and to deliver input data instantly when it arrives instead of delaying for up to one or more full simulated clock ticks.
     - Added debug trace support
     - Added statistic tracking of total bytes transmitted on each line
     - Added more aggressive attempts to flush transmit buffers when they fill before dropping tranmitted characters
     - Fixed status return of tmxr_putc_ln to return SCPE_LOST if the transmitting line isn't connected or buffered.

sim_console.h, sim_console.c
     - Fixed issue where connections to console telnet sessions would succeed for the first connection, but hang indefinitely for additional connects without rejecting due to all lines being busy.  This is handled by using an internal device and unit to hang the required polling on.  Connection polls happen once per second.
     - Added console debugging/trace support.
     - Added Asynchronous capabilities to the console subsystem to avoid polling for input and to deliver input data instantly when it arrives instead of delaying for up to one or more full simulated clock ticks.
     - Added tmxr_set_console_input_unit() API to support asynchronous simulator console I/O

sim_timer.h, sim_timer.c
     - Added SHOW TIMERS support
     - Added mechanism to capture the timer the simulator uses for its clock tick and make this timer globally available for other uses

PDP11/pdp11_dz.c
     - Added debug trace support

PDP11/pdp11_vh.c
     - Added debug trace support
     - Changed timing mechanisms to not assume that the count unit service routine calls measures the passage of time, and created a separate unit to measure time.

VAX/vax_stddev.c
     - Added call to tmxr_set_console_input_unit to leverage Asynchronous console I/O
2012-05-12 13:42:44 -07:00
Mark Pizzolato
54ad020b4e Fixed potential memory leaks on error paths in scp.c/sim_rest (Peter Schorn) 2012-05-05 09:23:19 -07:00
Mark Pizzolato
ff4f1d3a02 Fix error message reporting when command not found. 2012-05-02 07:17:45 -07:00
Mark Pizzolato
e3bdb12aeb Simplified conditions when a do command file error message is printed 2012-04-30 13:48:47 -07:00
Mark Pizzolato
ee235a6c37 Fixed conditions when error messages are displayed while processing do commands 2012-04-30 05:53:55 -07:00
Mark Pizzolato
7830a327f0 Added a -O switch to the programs arguments which will enable global ON inheritance. 2012-04-29 21:26:36 -07:00
Mark Pizzolato
0f8e6cfe95 Cleanup for warning messages produced by the clang C compiler. Mostly adding parentheses in conditional assignments and clarification parentheses in complex boolean expressions. 2012-04-29 11:59:44 -07:00
Mark Pizzolato
19bf1cdb90 Cleanup compiler warning about printf arguments 2012-04-27 12:27:16 -07:00
Mark Pizzolato
c77bdb20f1 Added scp SHOW SERIAL command
Fixed Ethernet formatting of open device names
Fixed serial generic naming to accomodate for the fact that an OS list of serial devices might not include devices which are already opened.
2012-04-25 17:04:48 -07:00
Mark Pizzolato
7929c11792 Merge branch 'master' into SerialMux 2012-04-25 12:19:11 -07:00
Mark Pizzolato
83172116e8 Added SHOW ETHERNET command and extended eth_show to track and display open ethernet devices 2012-04-25 05:29:50 -07:00
Mark Pizzolato
31df5e8db2 Added a mechanism for commands to optionally handle their message printing via a separate dispatch in the command table. This is currently used by run_cmd to handle unsuppressed status returns. 2012-04-25 05:24:53 -07:00
Mark Pizzolato
ad9cd1b51c Numerous Control Flow Fixes:
Fixed do file line numbers in messages to properly track after nested do command files.
Generalized do file command echoing to always include the do file line number
Fixed SET ON which was broken when SET ON INHERIT and SET ON NOINHERIT was added.
Fixed ON INHERIT behaviors for global ini files.
Added SET QUIET and SET NOQUIET commands
Added -Q flag to DO command file processing which sets quiet mode while that command file executes
Changed generic include file name to simh.ini from simh.rc to be consistent with other include files
Changed generic include file to come from the user HOME or HOMEPATH directory and if not found, the current default directory
Fixed format string used to provide quotes around arguments containing spaces while producing %* expansion.
Fixed return from do_cmd to return the status from the last command executed
2012-04-24 12:16:38 -07:00
Mark Pizzolato
bc36e9dde5 Adds serial port support to the multiplexer library.
It also modifies the HP 2100 and PDP11 multiplexers to add serial support as demonstrations of the capability that, one day, might be extended to all simulators.  I have tested the HP support, but I relied on Holger Veit to test the DEC stuff, so I can't guarantee that it works.  I also relied on Holger to test under Linux, so the same caveat applies.

    The changes needed in the device simulators are relatively small.  For example, if you look at the patches for "hp2100_baci.c", you'll note that most of them are documentation changes.  The only things of note are:

 - an expansion of the TMXR initializer

 - additional code in the "attach" routine to try attaching a serial port
   if attaching a socket fails

 - additional code in the "detach" routine for the same reasons

The HP MPX device (hp2100_mpx.c) needs a tiny bit of additional support from the ATTACH and DETACH commands.  Specifically, SCP was modified to set a flag ("sim_unit_ref") to indicate whether ATTACH MPX or ATTACH MPX0 was done, i.e., to differentiate between a device and a unit attach (recall that SCP treats these as both referring to unit 0).  This is needed because the socket attaches (logically) to the device, whereas a serial port attaches to a line.  Without this flag, the attach routine cannot differentiate between ATTACH MPX and ATTACH MPX0, as the distinction is lost by the time the VM's attach routine is called.  This support isn't needed for the HP MUX device because the socket attaches to a different device than the lines do.

    MPX also requires a bit more work due to the capability to mix serial and Telnet lines on the same multiplexer (BACI is a single-line terminal device).

    The attached PDF contains revisions to the "Writing a Simulator for the SIMH System" publication that documents the additions and changes to the multiplexer library for serial port support.  User documentation for serial port support currently exists only in the initial comments in "sim_tmxr.c"; I will add the appropriate text to the "SIMH User's Guide" if we decide to add this to the release version.
2012-04-19 19:18:15 -07:00
Mark Pizzolato
c6c9e0c3ac Fixed arguments to sprintf when constructing the expansion of %*. Found by Maurizio De Tommaso. 2012-04-12 12:18:23 -07:00
Mark Pizzolato
79d0e25848 Fixed printf of error messages which had parameters in the wrong order (found by Maurizio De Tommaso) 2012-04-12 12:11:01 -07:00
Mark Pizzolato
330839888d Removed redundant {sim_name}.rc initialization file. 2012-04-12 09:59:32 -07:00
Mark Pizzolato
fc8856805d Added a default initializing file simh.rc to the files automatically loaded when a simulator starts
Fixed ASSERT command to require a condition operator (from Dave Bryan)
2012-04-11 19:26:27 -07:00
Mark Pizzolato
95a1cb71df Added a generic non simulator specific startup include file (simh.rc) to be processed.
Corrected the ON INHERIT behavior to not allow nested procedures to change the ON INHERITance state.
2012-04-11 10:46:43 -07:00
Mark Pizzolato
33567b474d Sanity check when detaching a undetached unit. fro Dave Bryan. 2012-04-10 08:09:48 -07:00
Mark Pizzolato
fd702e407b Made automatic startup file be named {sim_name}.rc (i.e. hp2100.rc or vax.rc, etc.) 2012-04-10 07:02:49 -07:00
Mark Pizzolato
a339dae651 Extensive Control Flow Enhancements:
Added Message Suppression flag for status values, including providing a -Q option to the RETURN command to return with a message suppressed status
Added Do command file default extension of .sim (from Dave Bryan)
Added -O option to DO command file invocation which causes the caller's ON state and actions to be inherited in the newly called DO command file
Added Command Line expansion to include a %* which expands to the whole set of arguments (%1 ... %9)
Relaxed Command Line argument substitution (delimited by %'s) which cause environment variable lookups to first lookup the literal name provided and if that fails, lookup the name upcased.
Added a SIM_VERIFY special Command Line expansion variable which expands to "-V" when command echoing is active
Added a SIM_MESSAGE special Command Line expansion variable which expands to "-Q" when error message display is suppressed
Added Command Aliasing, which causes the initial token on a command line to be looked up in the environment variable table, and if it exists to substitute the expansion for the initial token.
Changed environment variable defining (with SET ENV variable=value) to always upcase the variable name.
Added SHIFT command which shifts the numbered argument variables %1 ... %9 to the left by one (%1 becomes what was %2, etc.)
Added CALL command which will call a routine (label) in the currently executing command file
Added SET VERIFY and SET NOVERIFY commands which enable or disable DO command echoing
Added SET MESSAGE and SET NOMESSAGE commands which globally enable or disable the display of status messages when commands (or Do Commands) return with unsuccessful status
Added SET ON INHERIT and SET ON NOINHERIT to globally enable inheritance of ON state and actions when DO commands are invoked
Added PROCEED and IGNORE commands which are do nothing but return success.  These can be used in specific ON actions to possibly ignore particular return status values
Added DO command file line number to error messages which are displayed while processing DO command files
Expanded the DO command nesting level to 20 to potentially allow for more nesting due to the extensive use of CALL commands are used
2012-04-10 05:38:12 -07:00