This is the initial iteration of cleaning up simh of appending the
"footers" to disk images: it does not allow to emit any new "footers",
yet it does not change the behavior as to how any existing "footers"
are treated internally. Also, even though sim_disk.c currently builds
the "footer" for any attached disk container, with this patch, it is
only kept in-memory, and never gets written to (appended / updated)
the actual container.
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.
Move the PowerShell code from .github/workflow/cmake-builds.yml into its
own script, cmake/github_v141_xp.ps1, to keep cmake-buils.yml readable.
The script also facilitates synchronizng with the Chocolatey installer's
Wait-VSIstallerProcesses function easier (from which this this code is
derived.)
cmake-builds.yml: Check the output from Get-VSSetupInstance and
Set-VSSetupInstance. Empty (or null) output indicates that the v141_xp
install did not complete successfully. Build process will bail when that
happens.
cmake/v141_xp_install.ps1: Unused and now unnecessary script.
Running earlier XXDP tests revealed that a technique of concurrent command
initiation and continued housekeeping for the command completion was used in
the old code.
For example, code could initiate a SEEK command for a drive, and knowing that
CS_DONE (and thus, an interrupt) is coming in about 16us, it would then go
ahead and clear a flag, which registers that the interrupt has occurred
(expected to be set to 1 by the ISR). If CS_DONE is set by the implementation
at the function initiation immediately, that would mean that the interrupt
could be triggered before the next instruction, and the flag would be set by
the ISR right away. The main code, however, would proceed with the the flag
clear as the following instruction, thus, never detecting the interrupt down
the road.
Since this technique was in existence, it is better to introduce a delay for
setting CS_DONE in the "fast" initiation commands like SEEK and HOME, to
accommodate the software that was relying on it.
So far, however, no issues were encountered in testing (except one), where
this delay mattered, but it's hard to tell if it would not be needed at all.
All I/O commands always delay CS_DONE already because they were never supposed
to be immediate.
Since the time for CS_DONE in initiation commands was documented at 16us, the
introduced delay is set to 10 instructions, which usually took more than that
to execute. But the interrupt flag clear case would be covered, as well as
the counted waits, which used some 25+-iteration tight loops for "drive ready",
before flagging a time-out (so the delay cannot be longer, either).
It also looks like more modern code never used any such tricks, so for it, it
should not matter if CS_DONE was slightly delayed or not.
The currently used backlog of (1) effectively disables any two or more
simultanueously incoming connections at the kernel level, because the
backlog parameter only allows 1 such connection. Yet since terminal
multiplexers can handle tens of clients, it's not technically impossible to
have more than one incoming request to be received at any particular moment
(for two different "lines"). A reasonable backlog of more than 1 safeguards
that the "extra" connections won't be refused outright, and postpones that
decision to be made by simh (not the kernel) -- for example, when, say, all
multiplexer lines are busy, with an explanation (which states so) rather than
just the infamous "Connection reset by peer" (effected by the kernel reset).
This patch increases the backlog to 64.
17 777 740 - 17 777 742, read-only error address registers,
and 17 777 764, a read-only System ID register,
and are not handled in the CPU70_wr() routine, which means for these
addresses the routine returns NXM, which then translates to "bus timeout"
(no response to address), and then, as a result, trap to vector 4.
That is incorrect, IMO.
These locations are read-only yet the address gets decoded, and even
though writing does not have any effect, the write routine for these
addresses should return SCPE_OK.
Having run the device code thru XXDP and some other OS's and scenarios
rigorously, a bunch of discrepancies were found, which need to be addressed
by this rather extensive patch.
1. Each unit must implement its own "drive status" register, to be able to
track per-drive errors / conditions correctly;
2. Fixed INT_SET() / INT_CLR() in RPCS write function (wrong order of the "if"
conditions);
3. Some behavior was implemented not exactly how it was expected from the real
hardware, such as:
a. Post-I/O register values in RPDA and RPCA (including the corner case of
pack overflow);
b. I/O stacking, which wasn't mentioned in any available documentation, but
only XXDP listings;
c. RESET/IDLE function must be accepted for a "busy" controller;
d. HOME function must always execute, even when "device ready" is not set
(e.g. when SEEK error detected);
e. SEEK incomplete should not respond with "device ready" (however, the
condition can be cleared by HOME, d.);
f. WLOA-induced write-lock violation wasn't reflected in "device status".
4. Some timing was off so that the device worked "too fast" -- this was fixed
(except for the pathological cases when the races are in the actual test
code, and cannot be logically fixed);
5. WLOA setup command bug was fixed;
6. Added more code comments found per the above peculiarities.
SEL32: Update Ping and ICMP support code to use correct packet size.
SEL32: Update SetupNet script to support latest Fedora release.
SEL32: Improve disk write speed.
SEL32: Add .tap file reassignent support in sel32_mt.c.
sim_instr does not completely follow the outline in the SIMH v3
developer docs. It does not decrease sim_interval in readin mode.
Fixing this, I cleaned up some other things:
- Move the decrease of sim_interval to after the check for breakpoints,
but before the check for ios. This ensures that sim_interval will
decrease any time an instruction executes in normal mode, or readin
mode executes, or ios is set and the CPU is waiting for ios to clear.
(Except the CPU should be clearing ios itself, not waiting for ios to
clear, but that fix requires a complete redesign of the I/O routines
and belongs in another branch.)
- Correctly handle all four combinations of mod_tst and mod_rdin.
- When changing from readin mode to normal mode, if cpu_set_mode returns
an error, stop with the same error. If cpu_set_mode returns SCPE_OK,
either stop or continue execution, depending on the word read from tape.
- In petr_boot and in the readin mode code in sim_instr, if the
PETR is not attached to a file, return SCPE_UNATT. Never try to read
from an unattached unit; I believe this reads standard input and
prevents ^E from working.
Overall control structure inside the while (reason == 0) loop:
- When stopping due to an error, break out of the while loop where
possible.
- After handling "ios is set", continue, don't run readin/test/normal-
mode code.
- After handling one readin operation, if the code didn't break out
of the while loop, continue, don't run normal-mode code.
and pad with cry. When it decoded cry, it printed a "TO DO" message.
http://bitsavers.org/pdf/mit/tx-0/memos/M-5001-19_macros_Apr60.pdf
derives a simple algorithm for cry. Implement that, remove the test
for cry from the pad code, and reformat the debug messages.
The same change appears in sim_instr and sim_opr_orig.
- find gnu-getopt when installed by homebrew in /opt
- invoke realpath only on known path components
(needed for some realpath implementation(s))
(relevant when build-flavor directory does not yet exist)
Adds 6850 DCD status latch to M2SIO devices.
Adds vector interrupt support to M2SIO devices.
Removes CTS inactive transmit disable from PMMI device.
Adds IMSAI-style programmed output to CPU/SIO devices.
SET CPU PO will display "PO: AREG" upon an "OUT 0FFH"
instruction.
SET CPU NOPO will disable the function (default).
Corrects problem with Mode 0 interrupts.
When the CPU receives an interrupt, it pushes the current
program counter on the stack. The current implementation
of Mode 0 was performing interrupt processing after fetching
the next opcode from RAM, which also increases the PC by 1.
This caused PC+1 to be pushed on the stack. The interrupt
processing is now done prior to fetching the next opcode,
preserving the correct program counter.
If the total sectors exceeds 127Gb this is not possible, but normal
simh disks are smaller and the largest user settable size via RAUSER
is just under 1Tb. The excessive size case (>127Gb) will have a CHS
of 0xFFFF10FF.
simh never cares about the CHS Disk Geometry value in the VHD footer
data structure, but other applications which do care about the CHS
value using the previously incorrect value as the capacity of the disk
even though the Current Size indicated in the footer may have been
larger.
Remove windows_build.yml due to a MS compiler enforcement change. Build
fails because libpng16.lib was compiled with a different compiler
version (VS 2008?) relative to the current VS 2022 installed in the
Github windows-latest runner.
MS decided that libraries must be compiled with a compatible compiler,
preferably the compiler-in-use. While not conclusively traced to a MS
trouble ticket, it seems reasonable to assume there exists a trouble
ticket wherein an older MS compiler generated code that was incompatible
with VS 2022, thereby necessitating the enforcement (speculation: LTO
instrumentation, for example?)
- Bump SIMH_VERSION_MINOR in CMakeLists.txt. This propagates down
through the rest of the CMake infrastructure.
- README-CMake.md, cmake/{GitHub-release.md,cmake-builder.sh}: Update
documentation. (Prettiness.)
- vcpkg.json: Update simh version-string. (Consistency.)
NOTE: Github CI/CD: There has to be an automated way to update version
numbers; researching.
PDP11/pdp11_rq.c re-uses ->filebuf as a sector buffer (under the #defined
name rqxb) and allocates it as such. If an RQ disk is detached and
another attached, this buffer would be lost and the pointer reset to
NULL. sim_disk.c would only allocate the buffer if UNIT_BUFABLE is set,
which means to buffer the whole disk. Since this rightly isn't set on RQ
disks, the pointer would remain NULL and segfaults would ensue. See
open-simh issue 274.
add comment about safe re-use of filebuf
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.
- Give appveyor.yml some much needed attention. Specifically, work
around the CMake build termination when the issuing the "CMake is too
old to produce packages" warning message. There's something funky with
how Appveyor's runtime interacts with PowerShell and
warning/diagnostic output ends up terminating builds unexpectedly.
Appveyor's technical support says to write the CI/CD script using the
old DOS CMD interpreter, not PowerShell.
- Cut down the number of builds. Older Visual Studio VM images are still
in the appveyor.yml matrix, just commented out.
- dep-locate.cmake: Update dependency library version numbers to reflect
recent releases for libpng16, SDL and SDL_ttf. This affects the XP
"legacy" CMake builds on Github CI/CD, Appveyor's VS 2017 and earlier
VM images that build the minimal SIMH dependency library support
(i.e., environments where vcpkg is known not to work.)
VS installer's startup is not instantaneous and there's some lag in the
CI/CD pipeline. Adjust strategy to wait for startup (20 seconds max) to
make the script more robust. (Doesn't seem to get triggered, but that
doesn't mean it won't happen in the future.)
Add the the following command line flags:
--force: Forces VS instance termination, if any are running.
(Unclear impact. Paranoia.)
--norestart: Delay reboot, if reboot needed. (Probable reason why
(Most likely reason why installs were incomplete.)
--installWhileDownloading: Self-explanitory. (Unclear impact.)
"Get-VSSetupInstance/Select-VSSetupInstance" will report a VS
instance ID if successful, e.g.:
DEBUG: Get-VSSetupInstance/Select-VSSetupInstance
InstanceId : 8d19910a
DisplayName : Visual Studio Enterprise 2022
InstallationVersion : 17.6.33815.320
InstallationPath : C:\Program Files\Microsoft Visual Studio\2022\Enterprise
InstallDate : 6/20/2023 9:38:11 PM
Useful output in the GH CI/CD log for future debugging.