Make generate.py resuable outside of open-simh, as suggested and
motivated by Richard Cornwell's simulator repository.
- Make the "experimental" rule optional. Do not generate a Python
"KeyError" if the rule is missing.
- Add documentation on how to use the CMake infrastructure outside
of open-simh: Customize the packaging.py script, season to taste.
- Update the KA10 simulator customization, moving it to its own
Python script, simgen/pdp10_simulator.py. Preparatory move that
anticipates additional frontpanel and display options.
- generate.py option "--skip-orphans": Skip the orphaned simulator
check (i.e., don't cross-reference the simulators in packaging.py
with what was scraped from the makefile.)
- Add "TEST_ARGS" argument to CMake's add_simulator function so that the
IBM 1130 simulator can pass to "-g" on the command line to disable the
GUI when running RegisterSanityCheck, i.e.:
ibm1130 RegisterSanityCheck -g
This fixes an edge case Heisenbug encountered during Github CI/CD
tests where ibm1130 appears to hang indefinitely on the Windows
runners.
The cause is the GUI's Pump() thread function being prematurely
terminated before all GUI resources are acquired. The net result is an
infinite loop in the MS C runtime trying to exit the process with
unstable internal state. (Separate patch: synchronization across main
and Pump() threads to ensure resource acquisition completes.)
This issue never shows up on non-Windows platforms or the SIMH makefile.
- cmake/generator.py, cmake/simgen: Add a "test_args" keyword argument
to the BasicSimulator constructor that holds the tests argument
parameter emitted as the "TEST_ARGS" argument to a simulator's
add_simulator(). Ensure that the IBM 1130 emits 'TEST_ARG "-g"' in its
add_simulator().
- scp.c: reset_all_p() adds 'P' to the existing switches, versus saving
sim_switches and ONLY setting the 'P' power-up reset switch. Net effect
is that the IBM 1130 simulator actually sees the 'G' flag that inhibits
the GUI during the console device reset.
- Fix comma separator code segmentation fault: "ndigit - 3" can become a
very large unsigned number for ndigit < 3.
- dir_cmd: Allocate WildName from heap to reduce stack pressure.
- Github CI/CD: Remnant symlink issue reappeared, afflicting the
makefile-based build. For better or worse, the workaround is now
dependent on specific Python versions that must be removed, unlinked
and any remnant symlinks that HomeBrew decided it needed to install in
/usr/local/bin. The Python upgrade is triggered by the sdl2_ttf
package.
According to the Github image maintainers, this is an old, known issue
in macOS images that originates inside of Homebrew.
- Make sure that asynchronous mode can't be changed if devices using
sim_ether are already attached.
- Add missing DEV_ETHER type flag for the only sim_ether using device
that didn't already have it.
(Note: Reducing compiler warnings across all, but primarily LP64
platforms, is a long term objective.)
Reduce compiler warnings on LP64 platforms (macOS, Windows) and 32-bit
builds (Win32). Prefer 'size_t' for pointer arithmetic, array indexing
and extents; 'int' hasn't been used for these purposes for many years
and across many ANSI standards. N.B. that conversions from int or int32
to size_t cause the compiler to zero-extend the value, which is
inefficient.
Refactor printf() format modifiers into sim_printf_fmts.h. Add the
SIZE_T_FMT modifier for better portability, especially on LP64 platforms
where size_t is unsigned long and sizeof(size_t) > sizeof(int).
3B2: Fix known size_t printf() format.
Initialize de-dup'ed debug line buffer:
realloc(NULL, size) == malloc(size), which is uninitialized space.
This causes the Clang memory sanitizer to detect an attempt to read
uninitialized memory when debug_line_buf and debug_line_buf_last are
different lengths. While the uninitialized space may never actually be
compared, the memory sanitizer emits a strong hint to not do stupid.
The sanitizer trips in the i650 simulator on the first memcmp(),
debug_line_buf has 108 characters, debug_line_buf_last has 56
characters (uninitialized space follows the 56 characters, tripping
the sanitizer.)
- memset() debug_line_buf and debug_line_buf_last to zero so that
memcmp() will always gracefully return non-zero if somehow memcmp()
ends up going past the end of either buffer. Should never happen in
practice, but theory always gets mugged by reality.
- Keep track of debug_line_buf_last's comparison length (i.e., up to
the '\r') and only execute memcmp() when this length equals the
current debug_line_buf comparison length (end - endprefix + 1).
- Added a log deduplication test to "testlib" command to ensure that
nothing broke as a result of this fix.
Network ACL check in sim_addr_acl_check:
The memory sanitizer found an off-by-one bug in sim_addr_acl_check
while executing "testlib". This makes CIDR network ACLs functional,
e.g., "127.0.0.1/32" is interpreted properly and the associated
"testlib" test passes.
Move .git-commit-id.h include to where it's actually referenced in
scp.c to reduce the recompile overhead for build systems that track
build dependencies.
Ensure that headers that reference SIM_MAJOR include sim_rev.h as a
defensive coding practice.
Net effect: Reduces recompiled source to a minimum when .git-commit-id.h
is updated and removes the sim_defs.h > sim_rev.h > .git-commit-id.h
dependency subgraph. Everything includes sim_defs.h, so a change to
.git-commit-id.h causes a large recompile, vice what should just be a
scp.c recompile and simulator suite relink.
Does not impact makefile builds, since makefile builds will recompile
everything; dependency tracking is superfluous.
Fixes suggested by running the Clang memory santizer on the Github CI/CD
pipeline:
- sim_exp_check: Use calloc() to allocate and initialize the PCRE
captured string offset vector. Also check the offsets to ensure they
are captured substrings:
-- If a substring wasn't captured, the offset pair is { -1, -1 }.
(Of course, this would never happen in SIMH. :-)
-- Remove the corresponding "_EXPECT_MATCH_GROUP_{pat}" variable
from the environment when its substring isn't captured. unsetenv()
is locally implemented in scp.c, which sets the environment
variable to an empty string; it isn't actually removed.
Failure occurs in multiple tests.
- _sim_debug_write_flush: Ensure that debug_line_buf_last's underlying
buffer is initialized when realloc-ed. (i650 failure.)
- vid_version: Initialize local variables "compiled" and "running". MSan
claims that these aren't initialized. Reading the SDL source, the
patch level might not be initialized on some platforms. (multiple
sim_video tests.)
NOTE: Do not attempt to run interactive memory-santized simulators on
Linux platforms where ncurses <= 6.2+20201114-2. MSan detects
uninitialized variables within ncurses; newer versions of ncurses fix
them.
This is to prevent confusion when questions come in.
Plus, a little advertising never hurts.
The version output will now include "Open SIMH", and the version
number will be '4.1.*' rather than '4.0.*'.
AltairZ80 uses 0 for the VM-specific HLT instruction stop code.
SCP defines SCPE_OK as 0.
SCP uses 0 to mean all errors ("ON ERROR").
The command "ON 0" will generate "%SIM-ERROR: Invalid argument: 0".
This PR changes the HALT stop code from 0 to 5.
This avoids infecting SIMH with the GPL license, since readline,
very surprisingly, is GPL rather than LGPL.
The replacement package is "editline", which has a useable license.
- Rewrote get_rval, put_rval to support fields within arrays of structures
- REG "size" field now determines access size
- REG "maxval" field now determines maximum allowed value
Merge from v3.12
The PDP11 and VAX have length switches - B, W, and (VAX) L - to
override the default parsing of numberic display or input as words
(PDP11) or longwords (VAX CPU) or bytes (VAX byte devices).
This worked fine if every value is filled in. On the PDP11:
sim> ideposit -b 0-3
0: 1
1: 2
2: 3
3: 4
sim>
But if the user skips an input, IDEPOSIT advances by 2, not 1:
sim> ideposit -b 0-3
0: 1
1: (cr)
3: 4
sim>
This change now produces the correct behavior.
PDP-11 simulator V3.12-2
sim> id -b 0-3
0: 1
1:
2: 3
3: 4
sim>
Setting a unit to write locked specifically allows only read access.
- If this is done while a unit is attached, it is up to device logic to
limit write activity until it is detached.
- If this is done while a unit is not attached, a subsequent attach
opens the container read only.
UNIT_BUFABLE without UNIT_MUSTBUF means that uptr->filebuf is managed
outside of attach_unit's authority. The buffer copy must always be allocated
if UNIT_BUFABLE is set so that there is space to store the initial loaded copy.
Fix#1122
This is a global command possibly for folks who have configurations which
always explicitly specify the drive type they want a particular unit to be
before they attach a container to the unit. The side effect of this will
be to avoid the addition of drive type describing meta data to disk
containers.
This adds support for the "framer" device, which is a USB-connected
device built around a Raspberry Pico that connects to a synchronous
line, either RS-232 or DEC "integral modem" coax connection. It
implements the framing portion of DDCMP: clock recovery for the
integral modem case, byte sync, and DDCMP frame handling including
CRC. The actual DDCMP protocol state machine, with its handling of
sequencing, timeout and retransmit, etc. is left to the host
software. All the design files for the framer may be found at
https://github.com/pkoning2/ddcmp .
This commit adds code to drive the framer from the TMXR library,
allowing it to be used either from simulated DMC-11 or simulated
DUP-11 devices. Both have been tested, using RSTS/E, RSX-11/M+, and
TOPS-20.
Fixed the one-digit limit on eth<n> device names, the limit is now 2.
The original solution provided in response to #957 needs to be adjusted
to reflect that errno is only guaranteed to be set by fwrite() if an error
occurred. otherwise a non zero value may have been set by some other
call elsewhere in the program. All other cases where errno is explicitly
check in simh, it is only done after receiving a return status from a
system call.
Fix problem reported in #1108
Some dependent packages on some platforms may also define HAVE_DLOPEN
and that definition may have different syntax or semantics. This change
avoids the potential symbol conflict.
As reported in #1098