Commit graph

93 commits

Author SHA1 Message Date
Seth Morabito
6afef3fabf 3b2: Fix Coverity issues 2022-03-17 16:04:43 -07:00
Seth Morabito
c117a0bd06 3b2: Fix Coverity issues 2022-03-12 11:38:07 -08:00
Seth Morabito
0c7bf366ae 3b2: Support for SVR 2.0.5 diagnostics
The CTC and PORTS pump code for System V Release 2.0.5 for the 3B2 is
different from the pump code used by SVR 3, leading to PORTS and CTC
diagnostics failing to pass when running SVR2. This change adds
support for the pump code used in SVR 2.
2021-12-27 15:09:20 -08:00
Seth Morabito
74021166d3 3b2: Remove glibc-specific longjmp
At one point in the distant past, there was an unremembered
reason to prefer __libc_longjmp if it was available. It is no
longer needed, and has been removed from glibc in the most recent
versions.

Fixes #1088.
2021-10-23 14:32:10 -07:00
Seth Morabito
976ba05604 3b2: Allow force interrupt if not attached
This commit fixes an issue that caused floppy diagnostics to fail if
the floppy drive unit was not attached. The 3B2 floppy controller has
a "force interrupt" command that should run whether or not the floppy
unit is attached to an image.
2021-10-05 08:50:01 -07:00
Seth Morabito
9d849283a4 3B2: Interrupt Refactor and DEMON ROM
- This change introduces a full refactor of the interrupt subsystem
  for the system board (SBD) and the I/O bus (CIO). Interrupt decode
  should now be significantly faster, and not require an expensive
  calculation on every step.

- The TIMER device has been split into Rev 2 and Rev 3
  implementations.

- The optional 3B2/400 Debug Monitor ROMs can now be booted by passing
  the "DEMON" argument to the 3B2/400 simulator BOOT command. Any
  of the following will cause the Debug Monitor ROM to be booted
  instead of the standard 3B2/400 ROM:

     sim> BOOT DEMON
     sim> BOOT CPU DEMON
     sim> BOOT DEMON CPU
2021-08-24 06:35:49 -07:00
Mark Pizzolato
d1a720debd BuildROMs: Change name define logic to avoid conflicts
Each of the BOOT_CODE_SIZE, BOOT_CODE_FILENAME and BOOT_CODE_ARRAY names
are replaced whenever a BuildROMs generated file is included.
2021-08-23 13:36:04 -07:00
Mark Pizzolato
ae1472db79 Generated ROM Image includes: Updated for multiple ROM image support
The actual contents of the input ROM binary files and the contents of the
created arrays are unchanged.

Multiple ROM image include files can be included in the same source module
without the need for any #undef BOOT_CODE_SIZE, etc.
2021-08-23 12:26:45 -07:00
Seth Morabito
c02491f733 3B2: Header refactoring and cleanup
This change signficantly improves header hygiene in the 3B2 project by
moving global symbols out of 3b2_defs.h and into the appropriate
individual module header files.

Each compilation unit now includes:

  - its appropriate matching .h file
  - any other .h files necessary for linting and compilation

Each header file in turn includes 3b2_defs.h, which contains truly
global symbols, and which pulls in sim_defs.h and exports global
devices.
2021-08-11 19:43:51 -07:00
Seth Morabito
5fd9ee3909 3B2: Do not read from detached floppy
The Rev 3 firmware does not check floppy controller status before
commanding a sector read, which can lead to calling sim_disk_rdsect()
on a detached unit. With this checkin, the simulator will no longer
attempt a read or write if the floppy unit is not attached.
2021-08-10 19:34:35 -07:00
Seth Morabito
c0beba5498 3B2: Rev 3 Development Base
This change introduces initial support for the AT&T 3B2 Rev 3 platform, based
around the WE32200 CPU with up to 64MB of RAM and SCSI disk and tape support.

This simulator is experimental and not yet supported. It will not be built by
default, but can be built with:

     make 3b2-600

Or by using the 3B2-600 Windows Visual Studio project.
2021-08-09 11:08:35 -07:00
Seth Morabito
3943f9b24f 3B2: Add DGMON SBD diagnostic tests
This commit adds support for automatically running DGMON SBD diagnostic tests
on build.

Additionally, a small bug is fixed in simulator boot caused by failure to
parse boot switches.
2021-07-31 12:22:27 -07:00
Seth Morabito
92ff16ca7b 3B2: Rename files in prep for Rev 3 support
This change lays the groundwork for adding support for Rev 3 3B2 models,
which includes the Model 500, Model 600, and Model 1000.

Rather than use the fixed strings "400" and "1000" in file names, the
strings "rev2" and "rev3" will be used, which allows greater flexibility
to implement various system configurations more easily.

Additionally, this change adds a copy of the Debug Monitor (DEMON) ROM
image for the Rev 2 board, to be used soon in a later checkin.
2021-05-12 10:56:39 -07:00
Seth Morabito
9bf37d3d6b 3B2: Don't clobber number of serial lines
Serial line setup was inadvertantly clobbering the number of lines on
initial setup, leading to potential invalid configuration.
2021-04-24 08:50:09 -07:00
Mark Pizzolato
68e407ba0f ALL: Correct help text in "SET <unit> LOCKED" MTAB entries 2021-04-19 15:22:15 -07:00
Mark Pizzolato
a015e44c10 ALL: Standardize writelock behavior adding global UNIT_WLK & UNIT_WPRT
Historically this functionality was reimplemented within each
DEVICE simulator often with slightly different implementations
and inconsistencies.  Solving this globally within SCP required
changes in many places, but should henceforth be reasonably
managed.

As discussed in #1034
2021-04-19 10:58:51 -07:00
Mark Pizzolato
2676404b36 3B2, BESM6, PDP10, PDP11: Remove redundant include of time.h 2020-10-30 14:16:52 -07:00
Seth Morabito
bf6ec441f5 3b2: Removed compiler warnings. 2020-10-19 11:33:14 -07:00
Seth Morabito
28b8b3a91a 3b2: Fix clang warnings
Explicitly cast booleans to t_uint64 before doing logical negation.
2020-09-08 06:30:16 -07:00
Mark Pizzolato
ae825c9afb All: Declare sim_stop_messages as an array SCPE_BASE long
This avoids a potential invalid pointer dereference when formatting
the return value from sim_instr() if it is < SCPE_BASE but greater
than the previously defined static array size.sizeof

Update simh.doc to reflect this generic change.
2020-09-02 15:56:07 -07:00
Mark Pizzolato
b121950aba 3B2: Avoid adding disk information details to IFLOPPY disk images.
Floppy disk images are potentially used as a medium of data exchange
between some hosts and simulators and the disk information can confuse
this process.

As discussed in #847
2020-05-03 11:58:21 -07:00
Mark Pizzolato
c76086bc00 3B2: Properly set drive type for IDISK device disks
As reported in #847
2020-05-02 10:32:05 -07:00
Seth Morabito
1a3e5af755 3b2: Refactoring in preparation for Rev 3
Refactor in preparation for the addition of a Rev 3 simulator for the
3B2/1000 system.

This change also includes a full cleanup of the rat's-nest of includes
and externs that plagued the 3B2 simulator and made it difficult to
understand and maintain. Headers are now required in the following
order:

  compilation unit -> "3b2_defs.h" -> {... dependencies ...}

Finally, HELP has been added to the CPU device.
2020-03-26 15:12:08 -07:00
Seth Morabito
814ce9ea2a 3b2: Fix incorrect register width
Several registers in the TIMERS device were described
as being 16 bits wide, when they are in fact 8 bits wide.
2020-02-26 17:27:11 -08:00
Seth Morabito
ce627dc10d 3b2: Remove unnecessary branch condition 2019-11-17 10:41:11 -08:00
Seth Morabito
0f72a160fe 3b2: Fix coverity issues 2019-10-20 13:27:16 -07:00
Seth Morabito
731d99cf65 3b2: CMP{W|H|B} instruction fix
The WE32100 supports expanded datatypes for its opcodes, allowing an
opcode to override the default size (byte/halfword/word) expected by the
instruction. For example:

        CMPH &0x10000,{uword}-8(%fp)

Without the {uword} marker, this instruction would only compare the
lower 2 bytes of -8(%fp) against the lower two bytes of the constant
value 0x10000, since the CMPH instruction compares halfwords. However,
with the {uword} marker, the CMPH instruction promotes the opcode from a
halfword to an unsigned word, sign extending if appropriate.

The CMP{W|H|B} instruction implementation in the 3B2 simulator was
ignoring any expanded type markers on its opcodes when checking whether
to set the "N" (negative) bit in the PSW, leading to a failure in
compiling GCC. This fix causes the instruction to honor the expanded
datatype in this case.
2019-09-01 11:45:45 -07:00
Seth Morabito
e4e7071b6a 3b2: Improve NI performance
This change implements asynchronous (non-polling) mode for NI Ethernet
packet receive.
2019-08-25 20:39:48 -07:00
Seth Morabito
eaf34fe2c6 3b2: Add correct CTC subdevice information 2019-08-20 06:56:50 -07:00
Seth Morabito
9736cc3116 3b2: STRCPY fix, CTC and NI cleanup
- The previous fix for STRCPY introduced a new bug. STRCPY must always
  copy the final NULL terminator of the string, but must NOT increment
  the source or destination pointers for the NULL terminator.

- The CTC simulation did not correctly support streaming mode, which
  can in some cases request reads that are not on 512-byte block
  boundaries.

- To begin to support System V Release 4 UNIX, the NI card (called EMD
  under SVR4) needed to support several more CRC codes for pump code.
2019-08-15 08:07:49 -07:00
Seth Morabito
ab27a53014 3b2: Fix STRCPY instruction
STRCPY must increment both source and destination pointers (R0 and R1).
2019-08-11 22:49:17 -07:00
Seth Morabito
6554e0a4ab 3b2: Fix Windows build warnings
Fixed several possible loss of precision warnings when implicitly
casting t_uint64 to uint32.
2019-07-20 20:05:32 -07:00
Seth Morabito
292898e9f4 3b2: Fix critical MAU issues
- A bug in the Square Root implementation could lead to
  an infinite loop.

- Incorrect rounding was used when MAU destination register
  was single or double word.

- Fix Coverity-discovered issues.
2019-07-19 16:34:32 -07:00
Seth Morabito
61bdbd5d93 3b2: Provide precalibration program
This change adds a small infinite loop program that will be used by
the simulator to establish a reasonable guess at the host's
performance in order to precalibrate the system timer.
2019-07-01 13:21:56 -07:00
Seth Morabito
dd715e609e 3b2: unsigned addition overflow
- Integer addition of unsigned types could fail to set the
  overflow flag, leading to errors in the SVR3 floating point
  emulation library that rely on the overflow flag to detect
  carry out of high bit on unsigned addition. This change
  will correctly set the V flag if the high bit should be
  carried out on an add.
2019-06-29 19:40:57 -07:00
Seth Morabito
571c8f96a5 3b2: WE32106 Math Acceleration Unit (MAU)
This change adds support for the WE32106 Math Acceleration Unit (MAU).
The WE32106 is an IEEE-754 1985 compatible floating point math
acceleration unit that was an optional component on the 3B2/310 and
3B2/400.

The MAU is implemented using software floating point routines.  As
always, there may be bugs, but the MAU currently passes extensive
floating point tests with exactly the same results as a real 3B2/400
equipped with a physical MAU, so I hope these are few.
2019-06-29 08:45:27 -07:00
Seth Morabito
efea3f86a7 3b2: Fix for compilation warning
Fixes a compilation warning in 3b2_sysdev.c caused by a lack of an
explicit cast from 'void *' to 'struct timer_ctr *'
2019-06-09 14:12:02 -07:00
Seth Morabito
8832511204 3b2: Correct behavior for NI attach and detach
Previously, the NI ethernet device expected to do all
autoconfiguration at attach time. Furthermore, if attaching failed for
some reason (e.g., permission issues on a tap device, etc.) the card
would be left autoconfigured, but in a broken state that could lead to
reading uninitialized memory.

This change fixes those bugs, and allows the device to be attached and
detached more freely. The card is now autoconfigured when it is
enabled.  Attaching and detaching are analogous to connecting or
disconnecting an ethernet transceiver from the physical device.
2019-04-29 08:21:52 -07:00
Seth Morabito
7455d28126 3b2: Soft-power shutdown via TIMER command
This change enables the simulator to be shut down cleanly via a
soft-power shutdown command. This is implemented in the real 3B2/400
through the sanity timer, which, if it reaches zero, sets a bus timeout
flag in the CSR and issues an interrupt at IPL 15. The operating
system (System V UNIX) treats this as a shutdown request and enters
runlevel 0.

To use this change in a SIMH startup script, for example to implement a
3B2 simulator as a service, one could add these commands:

    # [... simulator setup ...]
    BOOT
    SET TIMER SHUTDOWN
    CONTINUE
    EXIT

On catching a SIGTERM, SIGINT, or SIGHUP, the simulator would return to
SCP control, set the soft power shutdown flag, and then continue
simulator execution. After the system is cleanly shut down, the
simulator would then exit back to the operating system.
2019-04-13 11:36:02 -07:00
Seth Morabito
726a07b547 3b2: Fix Coverity identified issues
This change also addresses some unused function parameter warnings
issued by GNU Flycheck (not generally used by the build process, but
useful when editing files with Flycheck enabled)
2019-03-20 10:13:30 -07:00
Seth Morabito
b0a4fb443c 3b2: NI 10Base5 Ethernet Device
- Implements an Ethernet device ("NI", for "Network Interface")
    for the 3B2 simulator.
2019-03-09 14:32:21 -08:00
Seth Morabito
ae0cad26e4 3b2: Make floppy controller a DEV_DISK device
- Formerly, the floppy controller buffered an entire diskette image
  in memory using the unit buffer, and flushed it out on detach or
  shutdown. This worked well enough, but it's better to have the
  device use the SIMH disk sector read and write routines and
  behave like a true disk.

- Read Only (Write Protect) logic has also been enabled in the
  floppy controller, allowing users to mount images that do not
  have write permissions.

- The IF (Integrated Floppy) and ID (Integrated Disk)
  device names were poorly chosen. They conflict with built-in
  scp commands and mess up the help system. This commit
  changes them to IFLOPPY and IDISK, respectively.

  NOTE!! THIS IS A BREAKING CONFIG CHANGE!!
2019-01-13 22:25:26 -08:00
Seth Morabito
6e7127d954 3b2: Properly initialize DMAC Current Word Count
- The DMAC controller "Current Word Count" expects to decrement
  beyond 0 to 0xffff. Its initial value should also be 0xffff.
  Setting the initial value to 0 introduced a very subtle bug
  related to DUART self-test following a soft power reset.
2018-12-13 19:50:20 -08:00
Seth Morabito
3f7e473b79 3b2: Fix for erratic CONTTY behavior 2018-08-22 17:13:48 -07:00
Seth Morabito
71ee25be1a 3B2: Remove unused code, move static declarations
This change cleans up warnings issued when compiled with
-Wall.

- Removed unused functions and variables.
- Moved static declarations out of headers and into source files
- Added braces around initialization where suggested.
2018-08-19 12:37:31 -07:00
Seth Morabito
5ae2e4c49d 3b2: Fix for overwriting kernel memory 2018-08-19 12:37:18 -07:00
Mark Pizzolato
0a7c9de1e1 TMXR: Change rx and tx delta values to be usecs including the speed factor 2018-06-13 04:51:34 -07:00
Seth Morabito
0fa5807e1d 3b2: Fix coverity scan issues 2018-05-28 11:58:42 -07:00
Seth Morabito
d725954568 3b2: Tighten floppy timing
This change fixes a critical floppy booting issue.
2018-05-22 15:23:51 -07:00
Seth Morabito
d88aa077ff 3b2: Expand tabs 2018-05-21 17:54:09 -07:00