Commit graph

87 commits

Author SHA1 Message Date
Mark Pizzolato
19bf1cdb90 Cleanup compiler warning about printf arguments 2012-04-27 12:27:16 -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
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
Mark Pizzolato
ab3af3062d - Changed asynch queue insertion and removal to use a lock free algorithm based only on InterlockedCompareExchangePointer. We can now use this lock free approach on IA64 host systems as well.
- Removed flawed logic which assumed that sim_interval was meaningful when referenced by an asynchronous thread.
- Adjust the event_time of events removed from the asynch queue to account for the average time spent on the queue before the event was noticed by the instruction execution thread.
- Added a sim_activate_notbefore function which specifies an rtime which is the earliest time the event should fire.
- Changed the 'wakeup from idle' logic to force an immediate asynch queue check if the wakeup was not due to a timeout (i.e. it was due to an asynch queue insertion).
- Fixed the descrip.mms to build asynchronous support on AXP and IA64 VMS with kernel threads enabled
2012-04-04 11:05:24 -07:00
Mark Pizzolato
7ea8831c7b Added do command default file extension for file being opened of '.sim' 2012-03-26 12:17:07 -07:00
Mark Pizzolato
8cc2ef03c7 Fixed regression in handling (ignoring) error conditions while processing simple do file. 2012-03-26 04:59:46 -07:00
Mark Pizzolato
027c921cfc More robust and correct readline support and fix to VMS build for HP2100 2012-03-25 15:55:36 -07:00
Mark Pizzolato
6e813b8364 Merge with v3.9-0-rc2 first pass 2012-03-24 19:46:37 -07:00
Mark Pizzolato
0270d0ea0d Cleanup based on reports from Michael Bloom 2012-03-22 12:20:00 -07:00
Mark Pizzolato
cf280ad8f7 Completing merge of v3.9-0-rc1 compile cleanups 2012-03-20 18:55:45 -07:00
Mark Pizzolato
2b43b358a8 Fix SHOW SHOW command to separate the SHOW options which are device specific and unit specific 2012-03-20 11:16:41 -07:00
Mark Pizzolato
fffad7c20e Merge changes from v3.9-0 rc1 2012-03-19 16:05:24 -07:00
Mark Pizzolato
9386369bd5 Made dynamic libreadline loading more robust for some systems 2012-02-28 17:56:41 -08:00
Mark Pizzolato
5efd8fe1b5 Fixed bug in save command. The issue is that attached units which are buffered in memory should also be flushed to storage as part of the save operation to make all the components of the save 'snapshot' consistent. 2012-02-02 07:30:40 -08:00
Mark Pizzolato
aa7c50eb38 Compiler cleanup for issues noticed during x64 compiles 2012-01-17 04:09:34 -08:00
Mark Pizzolato
5263a9e906 Added a sanity check to validate the modify time of the simulator image being restored by the 'restore' command with respect to the modify times of any files which are attached during the restore operation.
The logic here is based on the idea that a restore image contains the memory content for a running simulator, while the attached files contain the disk contents for that simulator.  If the disk contents have changed since the memory image was created then the two data sets are likely out of sync and disk details cached in memory (i.e. file system information, storage allocation, etc.) will likely result in corrupted disk structures if they are used.

The default behavior is to fail the restore operation if these inconsistencies are noticed.  This sanity check can be overridden if the restore command is invoked with the '-F' switch:  sim> restore -F simulator-state.file

Also added logging of all erro messages produced during a restore operation to both stdout and a simulator log file if it is being used.
2012-01-11 10:58:00 -08:00
Mark Pizzolato
6079add9e7 make output of 'show show' command consistent with other help output (lowercase primary commands). 2012-01-10 20:18:12 -08:00
Mark Pizzolato
de9facf9cc Added echo/log output of the results of a goto command to make it easier to read what happened in a simulator log file. Also flushed log files when starting instruction execution. 2011-12-17 08:36:11 -08:00
Mark Pizzolato
754934bb6b Added SIM_NAME as an environment variable while a simulator is executing. This can then be used by "do" scripts and/or in the context of host shell commands invoked with "!". 2011-12-17 08:32:39 -08:00
Mark Pizzolato
01369c13da Added sim_ttisatty to support reasonable behaviour (i.e. avoid in infinite loop) in the main command input loop when EOF is detected and input is coming from a file (or a null device: /dev/null or NUL:) This may happen when a simulator is running in a background process. 2011-12-07 10:01:07 -08:00
Mark Pizzolato
de5997608d Added missing command argument substitution for command lines read directly from stdin. Also, added new "set environment name=val" command which is potentially useful for scripting. 2011-12-01 10:00:14 -08:00
Mark Pizzolato
421fce7798 Added missing implementation of "set nobreak". The help set showed this as valid, but it wasn't defined. 2011-11-30 02:56:19 -08:00
Mark Pizzolato
db7e04e0df Cleanup of readline and static libpcap support after multi-platform testing. 2011-11-17 13:06:36 -08:00
Mark Pizzolato
8b01b90008 Generalized readline support to dynamically load the readline library and avoid the symbol conflicts which happen on some platforms and some simulators with a global PC variable. 2011-11-17 08:46:15 -08:00
Mark Pizzolato
f84c6109de Added useful diagnostic when restore operation fails due to inability to attach a device 2011-10-31 10:25:11 -07:00
Mark Pizzolato
c38eacd0c8 Fixed throttling in several ways:
- Sleep for the observed clock tick size while throttling
                        - Recompute the throttling wait once every 10 seconds
                          to account for varying instruction mixes during
                          different phases of a simulator execution or to
                          accommodate the presence of other load on the host
                          system.
                        - Each of the pre-existing throttling modes (Kcps,
                          Mcps, and %) all compute the appropriate throttling
                          interval dynamically.  These dynamic computations
                          assume that 100% of the host CPU is dedicated to
                          the current simulator during this computation.
                          This assumption may not always be true and under
                          certain conditions may never provide a way to
                          correctly determine the appropriate throttling
                          wait.  An additional throttling mode has been added
                          which allows the simulator operator to explicitly
                          state the desired throttling wait parameters.
                          These are specified by:
                                 SET THROT insts/delay
                          where 'insts' is the number of instructions to
                          execute before sleeping for 'delay' milliseconds.
2011-10-25 03:52:24 -07:00
Mark Pizzolato
2753c4a3dc Fixed DO command to properly return and display status from nested invocations. 2011-09-26 11:09:08 -07:00
Mark Pizzolato
034e749fce Added SET ASYNCH and SET NOASYNCH commands to dynamically enable or disable Asynchronous I/O support 2011-09-25 08:16:40 -07:00
Mark Pizzolato
312bc9a967 Added signal catching of SIGHUP and SIGTERM to cause simulator STOP. This will facilitate running a simulator as a 'service' on *nix platforms, given a sufficiently flexible simulator .ini file. 2011-09-22 14:43:42 -07:00
Mark Pizzolato
e70278eabf VAX: Fixed idle conditions for various versions of Ultrix, Quasijarus-4.3BSD, NetBSD and OpenBSD.
Note: Since NetBSD and OpenBSD are still actively developed operating systems, new versions of
these OSes are moving targets with regard to providing idle detection.  At this time, recent versions
of OpenBSD have veered from the traditional OS idle approach taken in the other BSD derived OSes.
Determining a reasonable idle detection pattern does not seem possible for these versions.
2011-09-21 07:13:35 -07:00
Mark Pizzolato
9e220f1138 Cleaned up VMS builds using various versions of the Dec/Compaq/HP C compilers 2011-06-04 04:29:00 -07:00
Mark Pizzolato
338ad5147b Extend help text for SET CONSOLE to describe all of the settable console options 2011-06-03 09:25:49 -07:00
Mark Pizzolato
31bf337ded Fix sim_debug to display actual instruction count. 2011-06-01 09:23:14 -07:00
Mark Pizzolato
f7b53a5fe9 Fixed sim_idle to account for a reasonable number of cycles which have passed when an asynchrnous event terminated the idle wait.
Also corrected the text of a printf which described the units of the asynch latency variable as nano seconds instead of microseconds.
2011-04-22 05:47:26 -07:00
Mark Pizzolato
db99885bfe scp - Added expansion of %STATUS% and %TSTATUS% in do command
arguments.  STATUS is the numeric value of the last
        command error status and TSTATUS is the text message
        relating to the last command error status
2011-04-20 11:11:22 -07:00
Mark Pizzolato
e3d3544f4d Changed sim_rest to defer attaching devices until after device register contents have been restored.
This is needed since an attach operation may behave differently depending on the state of other variables.
2011-04-19 16:28:59 -07:00
Mark Pizzolato
d81365b7af Compile cleanups.
i1620_sys.c - fixed printf calls without a format argument.
ibm1130_cr.c - fixed printf calls without a format argument.
scp.c - corrected argument types
vax780_sbi.c - corrected argument types
vax_sysdev.c - corrected argument types
pdp11_tu.c - Fixed t_addr printouts for 64b big-endian systems
sim_console.c - fixed formats to consistently print file names
2011-04-19 16:18:26 -07:00
Mark Pizzolato
fe8b1f06de Merge branch 'FastAsynchIO' into simhv38-2-rc2
Conflicts:
	PDP11/pdp11_tq.c
	PDP11/pdp11_ts.c
	PDP11/pdp11_xq.h
	VAX/vax780_sbi.c
	VAX/vax_cpu.c
	makefile
	scp.c
	sim_defs.h
	sim_ether.c
	sim_timer.c
2011-04-15 10:47:35 -07:00
Mark Pizzolato
87157dc737 Merge branch 'BufferedConsole' into simhv3.8-2.rc2
Conflicts:
	scp.c
	sim_console.c
	sim_tmxr.c
2011-04-15 09:22:37 -07:00
Mark Pizzolato
8eb9caff10 Merge branch 'ControlFlow' into simv3.8-2-rc2
Conflicts:
	scp.c
2011-04-15 09:19:29 -07:00
Mark Pizzolato
87c3e3452f Added Asynch I/O and Disk Support for various Disk formats
I’ve always wanted to have the option to have simulated devices behave
more naturally with respect to I/O operations.  By more naturally I
mean that the current simulator model I/O is either polled (for asynchronous
things link Muxes and Network), or it is performed in the middle of some
instruction execution taking possibly many milliseconds (disk and/or tapes).
The existing model creates quite deterministic behavior which helps to debug
and understand issues, but it trades off potential instruction execution
while performing these I/O operations in between instruction execution.

To address this concept (while still retaining the potential advantages of
the original model), I’ve designed an Asynch I/O model extension for simh.
In order to flesh-out and debug this design, I’ve also refactored several
devices to utilize this capability.  Please read the attached
0readmeAsynchIO.txt file for concept details about the approach.

In order to make disk devices easy to implement (within or without the
AsynchIO framework), I’ve created a sim_disk.c  library which is modeled
on the sim_tape.c library to generalize disk I/O like tape I/O is
generalized in sim_tape.c.  This sim_disk.c library now provides that
natural place to implement support for various disk implementation formats
(just like sim_tape support several formats, and one day will be the place
to add direct physical tape access). The current sim_disk library provides
the framework for direct support of 3 different disk formats:
    1) standard simh disk format
    2) platform specific physical disk access
and 3) platform independent Virtual Disk format.
The Virtual Disk format is an implementation of the format described in
the ”Microsoft Virtual Hard Disk (VHD) Image Format Specification”.  The
VHD specification is available for anyone to implement under the "Microsoft
Open Specification Promise" described at
http://www.microsoft.com/interop/osp/default.mspx.
The VHD implementation includes support for:
    1) Fixed sized disks
    2) Dynamically expanding disks
and 3) Differencing Disks.
Dynamically expanding disks don’t change their “Virtual Size”, but they
don’t consume disk space on the containing storage until the virtual
sectors in the disk are actually written to (i.e. an RA81 or RA92 VHD
with a VMS installed on it may initially only contain 30+ MB of files,
and the resulting VHD will be 30+ MB).  The VHD format contains meta data
which describes the virtual device.  Amongst this meta data is the simh
device type which the VHD was originally created as.  This metadata is
therefore available whenever that VHD is attached to an emulated disk
device in the future so the device type & size can be automatically be
configured.

Sim_disk_attach is used by device emulations to attach a simh/vhd/raw
device to a simulated device.  The following simh command switches
are used by the sim_disk_attach API:

    -R          Attach Read Only.
    -E          Must Exist (if not specified an attempt to create the
                indicated virtual disk will be attempted).
    -F          Open the indicated disk container in a specific format
                (default is to autodetect VHD defaulting to simh if the
                indicated container is not a VHD).
    -X          When creating a VHD, create a fixed sized VHD (vs a
                Dynamically expanding one).
    -C          Create a VHD and copy its contents from another disk
                (simh, VHD, or RAW format).
    -D          Create a Differencing VHD (relative to an already
                existing VHD disk)

Examples:

    sim> show rq
    RQ, address=20001468-2000146B*, no vector, 4 units
      RQ0, 159MB, not attached, write enabled, RD54, autosize, SIMH format
      RQ1, 159MB, not attached, write enabled, RD54, autosize, SIMH format
      RQ2, 159MB, not attached, write enabled, RD54, autosize, SIMH format
      RQ3, 409KB, not attached, write enabled, RX50, autosize, SIMH format
    sim> atta rq0 RA81.vhd
    sim> show rq0
    RQ0, 456MB, attached to RA81.vhd, write enabled, RA81, autosize, VHD format
    sim> set rq2 ra92
    sim> att rq2 -f vhd RA92.vhd
    RQ2: creating new file
    sim> sho rq2
    RQ2, 1505MB, attached to RA92.vhd, write enabled, RA92, autosize, VHD format
    sim> ! dir RA92.vhd
     Volume in drive H is New Volume
     Volume Serial Number is F8DE-510C

     Directory of H:\Data

    04/14/2011  12:57 PM             5,120 RA92.vhd
                   1 File(s)          5,120 bytes
                   0 Dir(s)   3,074,412,544 bytes free
    sim> atta rq3 -c RA92-1.vhd RA92.vhd
    sim> atta rq3 -c RA92-1.vhd RA92.vhd
    RQ3: creating new virtual disk 'RA92-1.vhd'
    RQ3: Copied 1505MB.  99% complete.
    RQ3: Copied 1505MB. Done.
    sim> sh rq3
    RQ3, 1505MB, attached to RA92-1.vhd, write enabled, RA92, autosize, VHD format
    sim>  ! dir RA92*
     Volume in drive H is New Volume
     Volume Serial Number is F8DE-510C

     Directory of H:\Data

    04/14/2011  01:12 PM             5,120 RA92-1.vhd
    04/14/2011  12:58 PM             5,120 RA92.vhd
                   2 File(s)         10,240 bytes
                   0 Dir(s)   3,074,404,352 bytes free
    sim> sho rq2
    RQ2, 1505MB, not attached, write enabled, RA92, autosize, VHD format
    sim> set rq2 ra81
    sim> set rq2 noauto
    sim> sho rq2
    RQ2, 456MB, not attached, write enabled, RA81, noautosize, VHD format
    sim> set rq2 format=simh
    sim> sho rq2
    RQ2, 456MB, not attached, write enabled, RA81, noautosize, SIMH format
    sim> atta rq2 -c RA81-Copy.vhd VMS055.dsk
    RQ2: creating new virtual disk 'RA81-Copy.vhd'
    RQ2: Copied 456MB.  99% complete.
    RQ2: Copied 456MB. Done.
    sim> sho rq2
    RQ2, 456MB, attached to RA81-Copy.vhd, write enabled, RA81, noautosize, VHD format
    sim> det rq2
    sim> ! dir RA81-Copy.vhd
     Volume in drive H is New Volume
     Volume Serial Number is F8DE-510C

     Directory of H:\Data

    04/14/2011  01:22 PM       178,304,512 RA81-Copy.vhd
                   1 File(s)    178,304,512 bytes
                   0 Dir(s)   2,896,097,280 bytes free
    sim> ! dir VMS055.dsk
     Volume in drive H is New Volume
     Volume Serial Number is F8DE-510C

     Directory of H:\Data

    03/08/2011  01:42 PM       403,663,872 VMS055.dsk
                   1 File(s)    403,663,872 bytes
                   0 Dir(s)   2,896,097,280 bytes free
    sim>
2011-04-15 08:49:18 -07:00