1
0
mirror of https://github.com/PDP-10/klh10.git synced 2026-01-11 23:52:54 +00:00

Compare commits

...

95 Commits

Author SHA1 Message Date
Olaf Seibert
56001edd03 Use Ubuntu 24, phase out 20. 2025-12-19 13:18:45 +01:00
H. David Todd (Mac)
23477d7c9a Avoid using uninitialized 'pname' in 'pfopen()' 2025-12-18 17:13:42 -05:00
H. David Todd (Mac)
22b65518c5 Avoid using uninitialized 'pname' in 'pfopen()' 2025-12-18 11:29:38 -05:00
Olaf Seibert
ee96db1683 Use Ubuntu 22, phase out 18. 2024-03-13 18:02:27 +01:00
Björn Victor
cf87fd11aa
Implement Chaosnet broadcast for ifmeth=chudp (#72)
Implement broadcast for ifmeth=chudp, by simply sending the packet on all chudp links.
2024-03-12 20:06:34 +01:00
Björn Victor
4955fb89b6 Amend and correct 602e733 2023-01-16 12:16:12 +01:00
Björn Victor
510aedca29 Also non-ip-only tap devices want setup
tap-without-bridge devices are also useful if they (as in old times) are setup with the IP addresses given in the config. Without setup, this has to be done manually which is more awkward.
2023-01-16 09:21:27 +01:00
Björn Victor
602e7337c8 Update LHDH/IMP doc to match commit #a70af64 2023-01-16 08:55:06 +01:00
Olaf Seibert
23401611e0 Add step-by-step "host device" instructions for TOPS-10
Thanks to wgs777 who summarized how to patch a TOPS-10 monitor to use
the host device in the null task to save host CPU usage.
See issue https://github.com/PDP-10/-READ--THIS-/issues/38.
2022-04-16 19:49:05 +02:00
Olaf Seibert
c92bb5f104 Build all 3 emulators in the CI.
Before this build system cleanup, it would have built the same emulator
3 times, or something like that.
2021-08-17 14:26:35 +02:00
Olaf Seibert
41a850677a Remove some old build stuff. 2021-08-17 14:26:35 +02:00
Olaf Seibert
ea4eb1adf6 Always include "cenv.h" or "klh10.h" as very first.
"klh10.h" includes "cenv.h".
This is possibly needed on systems that need some defines before
including system headers, for Long File Support.
I either moved an existing include line up or added #include "cenv.h"
where none of these was included before.

Note that most of the definitions in the "cenv.h" file are, or should be,
obsolete. Where still relevant, they should be detected by the
configure script.
2021-08-17 14:23:11 +02:00
Olaf Seibert
39104e9cbf Fix a NULL argument to fprintf()
which was detected by gcc.
cp is NULL in the call because of the if() it is inside.
2021-08-15 15:00:37 +02:00
Rhialto The M
2b7daffb80
Merge pull request #63 from PDP-10/lars/ci
Update continuous integration
2021-08-15 14:35:58 +02:00
Lars Brinkhoff
861868f21d Add CI build using GitHub Actions. 2021-08-15 14:12:57 +02:00
Lars Brinkhoff
b3f7fa5e2e Remove Travis CI. 2021-08-15 13:55:45 +02:00
Lars Brinkhoff
8ad111f1a6 Remove Cirrus CI. 2021-08-15 13:55:32 +02:00
Rhialto The M
b5601a46c7
Merge pull request #61 from PDP-10/imp-ifmeth-default
IMP: Use reasonable interface methods
2021-08-07 14:26:56 +02:00
Björn Victor
a70af64860 IMP: Use reasonable interface methods
and also check for consistency. And fix a cut-and-paste error.
2021-08-05 11:05:58 +02:00
Rhialto The M
eb33d416d3
Merge pull request #60 from PDP-10/imp-ip-dynamic
Make the IMP respond to NOP pkts with IP info
2021-08-03 19:44:58 +02:00
Björn Victor
98fa6ee890 Comment to match 2021-08-03 16:49:59 +02:00
Björn Victor
7b86659847 Respond to NOP pkts with IP info
This allows ITS to pick up the IP configured here, instead of having to recompile ITS to match any change.
2021-08-03 16:29:19 +02:00
Olaf Seibert
2c674266ea Move stuff in the Makefiles around
so that the cpu model specific parts are moved (more than before) into
their own files.
2021-07-20 18:04:19 +02:00
Rhialto The M
d891e8290d
Merge pull request #55 from PDP-10/ch11-default-pcap
Default ifmeth=pcap
2021-07-06 19:09:25 +02:00
Björn Victor
58decf2a19 Document default 2021-07-06 17:25:40 +02:00
Björn Victor
3c7e11bda5 Default ifmeth=pcap
If no chudp-specific parameters given, and no ifmeth given, default to pcap.
2021-07-05 19:30:39 +02:00
Rhialto The M
f432d23c41
Merge pull request #54 from PDP-10/ch11-fix2
CH11: fix long-standing data corruption bug
2021-02-23 21:27:53 +01:00
Björn Victor
0a9e34c36f Update dvch11.txt 2021-02-23 08:31:29 +01:00
Björn Victor
efb657a55b Don't read another until this one is read
Instead of accepting new input pkts after checking that the input pkt is shaped OK, do it after actually reading the pkt to ITS. Otherwise read pkts can be overwritten while only partially read to ITS, leading to corruption of data.
2021-02-22 07:34:37 +01:00
Björn Victor
4af56464aa Fix 17-year-old spelling error
hopefully fixing horrible concurrency problems which appears on faster hardware(?).
2021-02-13 13:42:33 +01:00
Björn Victor
d6de1d64d3
Update dvch11.txt
aosnet.ch was replaced  by chaosnet.net
2021-02-08 17:04:16 +01:00
Rhialto The M
bde5dcdc27
Merge pull request #52 from PDP-10/ch11-fix
Correct pklen calculations for CH11
2020-09-01 19:01:47 +02:00
Björn Victor
0a67ea9ea2 Correct pklen calculations for CH11
I'm terribly sorry about this, which dates back to 2005 (or earlier). The effect is on packets >127 bytes (data), but only when receiving from Ethernet, as far as I can see, where a "trailer" is added at the wrong place, resulting in garbage at the ITS end. (I think I've seen this live occasionally.)
2020-09-01 09:08:02 +02:00
Rhialto The M
6ac420eede
Merge pull request #50 from PDP-10/fix-some-compiler-warnings
Clean up compiler warnings.
2020-08-30 21:17:08 +02:00
Olaf Seibert
91af8d0b6b Work around another couple of "nested comment" warning. 2020-08-29 22:45:09 +02:00
Olaf Seibert
94ec1830ca Attempt to clean up compiler warnings
as given in https://cirrus-ci.com/task/5117093567791104?command=main
2020-08-29 22:13:09 +02:00
Rhialto The M
03bc707d3b
Merge pull request #48 from PDP-10/ch11-fix
Stop CH11 from spontaneously retransmitting last pkt
2020-08-29 21:30:16 +02:00
Rhialto The M
7933ebc3f0
Merge pull request #49 from PDP-10/lars/freebsd
Upgrade Cirrus CI build to FreeBSD 12.1.
2020-08-29 21:18:26 +02:00
Lars Brinkhoff
552b33ac0f Upgrade Cirrus CI build to FreeBSD 12.1. 2020-08-29 19:54:45 +02:00
Björn Victor
c2d341945f Stop CH11 from spontaneously retransmitting last pkt
by noting that the output buffer was consumed on transmission done.
2020-08-28 13:32:51 +02:00
Olaf Seibert
b014407ffa Merge branch 'master' of github.com:PDP-10/klh10
* 'master' of github.com:PDP-10/klh10:
  FreeBSD build on Cirrus CI.
  Use PKG_CHECK_MODULES to locate libusb-1.0.
  Add DFKFB numbers from a real KL10.
2020-03-28 16:42:32 +01:00
Olaf Seibert
ff749f6d2e Fix some more -Wall warnings
(but there are many many more to go...)
2020-03-28 16:33:42 +01:00
Olaf Seibert
f5e506cc10 Copy the right size into the destination.
Fixes !45.
2020-03-28 16:16:57 +01:00
Lars Brinkhoff
2f478c2df2 FreeBSD build on Cirrus CI. 2020-02-26 07:01:04 +01:00
Lars Brinkhoff
b41d4b8ac7 Use PKG_CHECK_MODULES to locate libusb-1.0.
This works better on FreeBSD.
2020-02-26 07:01:04 +01:00
Lars Brinkhoff
77473114b3 Add DFKFB numbers from a real KL10. 2019-08-30 08:22:18 +02:00
Rhialto The M
fcf812e4d7
Merge pull request #39 from PDP-10/configure-lights
Configure lights
2018-09-15 21:18:04 +02:00
Olaf Seibert
b28505e70a Enable the lights for Travis CI. 2018-09-15 16:26:56 +02:00
Olaf Seibert
6a8a710ecf Change configure to control the compilation of the Panda lights.
This needs to check for libusb-1.0. Since this shouldn't be linked to
the auxiliary programs, add another Makefile variable to record it in:
CPULIBS.
Stub out calls to outb() if it is unavailable, so that it can at least
use libusb in that case.
2018-09-15 00:04:31 +02:00
Lars Brinkhoff
129e3d0f16 Use USB Panda Display.
Build with -DKLH10_DEV_LITES=1.  Use the KLH10 command "lights usb" to
enable this feature.
2018-09-14 06:40:59 +02:00
Rhialto The M
0402660bf0
Merge pull request #38 from Rhialto/more-cleanup-34
Clear file pointer when file is closed.
2018-09-08 16:13:03 +02:00
Olaf Seibert
c8bdff6d49 Clear file pointer when file is closed. 2018-09-07 18:44:32 +02:00
Rhialto The M
dc4751bc6f
Merge pull request #34 from atsampson/master
Add missing fclose after tape format detection.
2018-09-07 18:34:17 +02:00
Adam Sampson
591437d302 Add missing fclose after tape format detection.
Without this, doing something like:
  devmount mta0 /tmp/foo
  devunmount mta0
(i.e. without specifying fmt=bar to the devmount) will leak a FILE * and
file descriptor.
2018-05-12 12:35:34 +01:00
Björn Victor
678db7c80b
CH11 over Ether (#33)
Working chaos-over-ether implementation (in addition to Chaos-over-UDP). 

Also rename dpchudp => dpchaos, both in code, files and the device process, since it no longer only supports Chaos-over-UDP, but is more generic.

Update doc for CH11.
2018-04-15 21:33:10 +02:00
JohnForecast
60d02258cb
Merge pull request #32 from PDP-10/RaspberryPi
cenv.h must be the first include file
2018-04-09 17:18:02 -04:00
John Forecast
dad5719aeb cenv.h must be the first include so _FILE_OFFSET_BITS can affect system include files. 2018-04-09 11:23:40 -04:00
Olaf Seibert
d24efb8404 Point bugreports to the PDP-10 organisation, not to me personally. 2017-12-17 15:22:10 +01:00
Olaf Seibert
ba556fbd9d Fix incorrect identification to VDE (should be klh10 of course). 2017-12-14 20:37:08 +01:00
Lars Brinkhoff
2242d4f226 Remove limitation on 12 devices.
Falls back to the default, which is 20.
2017-12-14 20:24:33 +01:00
Olaf Seibert
9d13c2b5e5 Remove unneeded length check for interface name.
Since the length is checked in all other relevant places, the check here
is not needed, and was too strict for the "vde" case.
2017-12-10 17:37:00 +01:00
Olaf Seibert
e904b0b49e Increase the size for a device name
For the benefit of VDE.
For other interfacing methods, check that the name is at most IFNAMSIZ,
which should always have been checked, because of unexpected truncation.
2017-11-29 21:46:03 +01:00
Olaf Seibert
9d6add677a Add proper dependency on dpni20.h. 2017-11-29 21:10:07 +01:00
Lars Brinkhoff
e0a65234a6 Make console input more solid. 2017-10-26 22:38:58 +09:00
Björn Victor
6f268f9be7 Merge pull request #23 from PDP-10/bictorv-dynamic-chudp-fix
Make dynamic chudp work again.
2017-08-29 21:53:32 +02:00
Björn Victor
9d12eee32b Make dynamic chudp work again.
Supply size of socket to recvfrom call. This makes dynamic chudp work again. Also some minor modernisation.
2017-08-28 12:36:40 +02:00
Rhialto The M
3f3945f67b Merge pull request #22 from PDP-10/massbus-serial-numbers
Massbus serial numbers
2017-05-14 19:12:56 +02:00
Olaf Seibert
4690de5b02 Fix call to memset (discovered due to compiler warning from Travis) 2017-05-14 13:39:48 +02:00
Olaf Seibert
b60c1e88a2 And in the other file. Should work for n < 100. 2017-05-14 13:10:33 +02:00
Olaf Seibert
22e336c700 Should fix Issue #17. 2017-05-14 12:35:46 +02:00
Rhialto The M
87a3ea05c3 Merge pull request #16 from PDP-10/lars/ch11
Add Chaosnet device
2017-02-02 22:35:28 +01:00
Lars Brinkhoff
78fa98ac15 Add ch11 files and apply patch from http://victor.se/bjorn/its/ch11.tar.gz 2017-02-02 21:02:56 +01:00
Olaf Seibert
1cfe638d1c Merge branch 'master' of github.com:PDP-10/klh10 2017-01-29 16:39:24 +01:00
Rhialto The M
0527e3d9b9 Merge pull request #15 from PDP-10/lars/merge-rich
Merge changes from Rich Alderson.
2017-01-29 16:17:14 +01:00
Olaf Seibert
c3484ed92b Merge changes from Rich Alderson. 2017-01-27 22:12:43 +01:00
Olaf Seibert
2d96b28ec0 Unify duplicate code. 2017-01-23 23:45:58 +01:00
Olaf Seibert
a869dcdf6d Terminology clarification: "emulated host" is nowadays "guest"...
and it is running on the "host". The used term "emulated host" (as opposed to "hardware host") is somewhat confusing.
2017-01-23 23:42:58 +01:00
Olaf Seibert
f238169d61 Rewrite for clarity with fewer casts. 2017-01-23 23:42:58 +01:00
Olaf Seibert
d677598f66 Leave addresses on pre-configured TAP devices alone. 2017-01-23 23:42:58 +01:00
Olaf Seibert
372c24de14 Cleanup of unnecessarily copied locals. 2017-01-23 23:42:58 +01:00
Olaf Seibert
0abee1c6eb Extra safety return. 2017-01-23 20:37:38 +01:00
Olaf Seibert
bf53098417 Add description of tunaddr parameter. 2017-01-22 16:11:36 +01:00
Olaf Seibert
09ee2e73c8 This may well have been the cause of the shutdown problems of dpni20. 2017-01-21 23:29:15 +01:00
Olaf Seibert
2945263432 For the ni20, add subcommands to the "dev ni0 ..." command.
This may be useful for debugging, given the subcommands as currently made available.
The main loop command line parser is used to parse the subcommands. I don't think this is working for interactive subcommands yet.
2017-01-21 23:15:32 +01:00
Rhialto The M
a9fb096850 Merge pull request #11 from PDP-10/travis
Build and test in Travis CI
2016-12-22 23:08:03 +01:00
Lars Brinkhoff
5a37b7f49b Build and test in Travis CI. 2016-12-22 22:44:26 +01:00
Lars Brinkhoff
80eee8f112 Add really-quit command which quits without questions asked. 2016-12-22 22:34:16 +01:00
Rhialto The M
b48544ebc6 Merge pull request #10 from PDP-10/gitignore
Ignore generated files
2016-12-22 21:17:51 +01:00
Lars Brinkhoff
6e31ba8017 Ignore generated files configure and src/config.h.in. 2016-12-22 10:04:24 +01:00
Olaf Seibert
ff6ce33f28 #define IPC_[RW] if missing. 2016-12-17 14:14:13 +01:00
Olaf Seibert
d218e5b03f Replace 0600 in shmget(2) call with symbolic constants.
Inspired by Rich Alderson's MacOS 10.6.8 changes.
He used IPC_CREAT+IPC_PRIVATE+IPC_R+IPC_W.
However, IPC_PRIVATE is a special value for the key argument, not shmflg.
Furthermore, adding IPC_CREAT to the flags when the key is IPC_PRIVATE
seems unnecessary but should not harm.

See http://pubs.opengroup.org/onlinepubs/9699919799/functions/shmget.html
for the "IEEE Std 1003.1-2008, 2016 Edition" version of shmget(2).
2016-11-27 17:10:00 +01:00
Rhialto The M
8f37d8cf17 Merge pull request #6 from larsbrinkhoff/confflags
Make it possible to pass configuration flags from the environment.
2016-11-10 13:02:34 +01:00
Lars Brinkhoff
d4e70d8200 Make it possible to pass configuration flags from the environment.
Take user-defined configuration flags from environment variable CONFFLAGS_USR.
2016-11-10 12:58:05 +01:00
Olaf Seibert
7108b2c75c Make tape work when not using a device process, i.e. -DKLH10_DEV_DPTM03=0. 2016-11-09 23:49:00 +01:00
Olaf Seibert
842125be77 Bump version to 2.0k. 2016-03-01 01:29:55 +01:00
86 changed files with 4561 additions and 1220 deletions

31
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Build
on: [push, pull_request]
defaults:
run:
shell: bash
jobs:
build:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ ubuntu-22.04, ubuntu-24.04 ]
steps:
- uses: actions/checkout@v2
- name: Install dependencies
if: ${{runner.os == 'Linux'}}
run:
sudo apt-get install libusb-1.0-0-dev pkg-config
- name: Build
run: |
./autogen.sh
mkdir tmp
cd tmp
../configure --enable-lights
make
- name: Test
run: |
cd run/dfkfb
../../tmp/bld-kl/kn10-kl dfkfb.ini

7
.gitignore vendored
View File

@ -1,3 +1,5 @@
/configure
/aclocal.m4
bld/*/*.h
bld/*/*.o
bld/*/dpimp
@ -16,4 +18,9 @@ config.status
autom4te.cache
new
src/tags
src/config.h.in
tmp*/*
#*#
*/#*#
*.~*
*/*.~*

View File

@ -19,6 +19,7 @@ builddir=$(pwd)
cd "$srcdir"
srcdir=$(pwd)
aclocal # creates aclocal.m4 from configure.ac
autoconf # creates configure from configure.ac
autoheader # creates src/config.h.in from configure.ac

View File

@ -5,8 +5,8 @@ dnl This configure.ac script was created for Autoconf 2.69, but I
dnl tried it with one as old as 2.61, and that seemed to work fine.
AC_PREREQ([2.69])
AC_INIT([klh10], [2.0j-Rhialto], [https://github.com/Rhialto/klh10],
[], [https://github.com/Rhialto/klh10])
AC_INIT([klh10], [2.0l], [https://github.com/PDP-10/klh10],
[], [https://github.com/PDP-10/klh10])
AC_CONFIG_SRCDIR([src/klh10.h])
AC_CONFIG_HEADERS([src/config.h])
@ -35,6 +35,25 @@ do
done
CFLAGS="$NEWCFLAGS -g3 -O3"
# -------------------------------------------------------------------------
# Check whether we want LIGHTS support
# -------------------------------------------------------------------------
AC_ARG_ENABLE(lights,
AS_HELP_STRING([--enable-lights],[enable Panda lights (which requires libusb-1.0)]))
case "${enable_lights}" in
yes)
AC_MSG_NOTICE([Compiling with Panda lights support])
AC_DEFINE(KLH10_DEV_LITES, 1, [Set to 1 to enable Panda lights])
need_libusb=yes
;;
no | "")
AC_DEFINE(KLH10_DEV_LITES, 0, [Set to 0 to disable Panda lights])
;;
*) AC_MSG_ERROR([bad value ${enable_lights} for --enable-lights]) ;;
esac
# -------------------------------------------------------------------------
# Check whether we want VDE support
# -------------------------------------------------------------------------
@ -81,7 +100,18 @@ AC_CHECK_FUNC([nanosleep],
AC_CHECK_LIB([rt], [nanosleep])
])
# -lsocket and -lpcap should go into NETLIBS
case "${need_libusb}" in
yes)
# Check if libusb-1.0 is present, otherwise fail.
PKG_CHECK_MODULES([libusb], [libusb-1.0],
[AC_DEFINE([HAVE_LIBUSB_1_0], [1],
[Define if you have libusb-1.0.])],
[AC_MSG_ERROR([Lights require libusb-1.0, which I could not find.])])
;;
esac
# -lsocket, -lpcap and -lvdeplug should go into NETLIBS.
# NETLIBS is for libraries only needed by programs doing networking.
SAVE_LIBS="$LIBS"
LIBS=""
AC_CHECK_LIB([socket], [if_nameindex])
@ -100,7 +130,7 @@ AC_CHECK_HEADERS([arpa/inet.h errno.h fcntl.h limits.h netinet/in.h sgtty.h \
sys/socket.h sys/time.h termios.h unistd.h net/if_tun.h \
linux/if_tun.h linux/if_packet.h net/if_tap.h sys/mtio.h \
net/nit.h sys/dlpi.h net/if_dl.h net/if_types.h \
libvdeplug.h])
sys/io.h libvdeplug.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
@ -248,9 +278,12 @@ AC_SUBST([CPPFLAGS])
AC_SUBST([DESTDIR])
AC_SUBST([PREFIX])
AC_SUBST([LIBS])
AC_SUBST([CPULIBS])
AC_SUBST([NETLIBS])
AC_SUBST([MAKEFILE], [Makefile])
AC_SUBST([CENVFLAGS])
AC_SUBST([libusb_CFLAGS])
AC_SUBST([libusb_LIBS])
# -------------------------------------------------------------------------
# Output section. State which files are going to be constructed.

View File

@ -23,12 +23,12 @@ immediately run DFKFB without spending any time on installation or
configuration, and get an idea of how it compares with a real KL.
[1] Build a KN10-KL for your native platform.
$ cd <distrib>/bld/<platform>
$ make base-kl
$ cd <distrib>/tmp/bld-kl
$ make
[2] Go to the DFKFB directory, if present, and run it.
$ cd ../../run/dfkfb
$ ../../bld/<platform>/kn10-kl dfkfb.ini
$ ../../tmp/bld-kl/kn10-kl dfkfb.ini
[3] Compare output with other configurations, platforms, etc.
Strut or sulk as appropriate.
@ -51,6 +51,65 @@ Still, it's fun to see how many multiples of a real KL you can run at.
THE REAL THING
==============
These numbers are from the 1978 EK-0KL20-IN-001 "KL10-Based
DECSYSTEM-20 Installation Manual", pages 10-27 and 10-28.
1 - BASIC CLOCK IS 40 NS.
2 - INDEXING TAKES 40 NS.
3 - INDIRECT TAKES 280 NS.
4 - INDEXING AND INDIRECT TAKES 320 NS.
5 - MOVEI TAKES 320 NS.
6 - MOVE FROM AC TAKES 440 NS.
7 - MOVE FROM MEMORY TAKES 480 NS.
8 - HRR FROM MEMORY TAKES 520 NS.
9 - STEOM 0 TAKES 560 NS.
10 - JRST TAKES 360 NS.
11 - JSR TAKES 680 NS.
12 - PUSHJ TAKES 840 NS.
13 - ADD FROM MEMORY TAKES 520 NS.
14 - MUL (9 ADD/SUB - 18 SHIFTS) TAKES 2.52 uS.
15 - DIV TAKES 5.58 uS.
16 - FIX A FLOATING POINT ONE TAKES 1.04 uS.
17 - FLTR AN INTERGER ONE TAKES 1.84 uS.
18 - FAD (1 RIGHT SHIFT) TAKES 1.88 uS.
19 - FAD (8 SHIFT RIGHT - 3 LEFT) TAKES 2.16 uS.
20 - FMP (7 ADD/SUB - 14 SHIFTS) TAKES 2.80 uS.
21 - FDV TAKES 5.72 uS.
22 - DMOVE FROM MEMORY TAKES 880 NS.
23 - DFAD (1 RIGHT SHIFT) TAKES 2.44 uS.
24 - DFAD (8 SHIFT RIGHT - 1 LEFT) TAKES 2.44 uS.
25 - DFMP (7 ADD/SUB - 32 SHIFTS) TAKES 4.92 uS.
26 - DFDV TAKES 10.32 uS.
27 - CONO PI TAKES 1.92 uS.
28 - CONI PI TAKES 3.36 uS.
29 - DATAO APR TAKES 1.56 uS.
30 - DATAI APR TAKES 1.76 uS.
31 - MOVE TO MEMORY TAKES 680 NS.
32 - LOGICAL SHIFT (35 PLACES LEFT) TAKES 640 NS.
33 - LOGICAL SHIFT (35 PLACES RIGHT) TAKES 760 NS.
34 - LOGICAL SHIFT COMBINED (71 PLACES LEFT) TAKES 1.12 uS.
35 - LOGICAL SHIFT COMBINED (71 PLACES RIGHT) TAKES 1.16 uS.
36 - INCREMENT BYTE POINTER TAKES 1.00 uS.
37 - INCREMENT AND LOAD BYTE TAKES 1.44 uS.
38 - INCREMENT AND DEPOSIT BYTE TAKES 1.80 uS.
39 - JFCL TAKES 880 NS.
40 - CAI TAKES 480 NS.
41 - JUMP TAKES 480 NS.
42 - CAM TAKES 600 NS.
43 - EQV AC TO AC TAKES 480 NS.
44 - EQV MEMORY TO AC TAKES 520 NS.
45 - SETOB TAKES 680 NS.
46 - AOS TO MEMORY TAKES 840 NS.
47 - EXCHANGE AN AC WITH AN AC TAKES 640 NS.
48 - EXCHANGE AN AC WITH MEMORY TAKES 840 NS.
49 - EXECUTE TAKES 640 NS.
50 - BLT MEMORY TO MEMORY TAKES 1.92 uS.
51 - BLT AC TO MEMORY TAKES 1.88 mS.
52 - DATAI TAKES 10.00 uS.
53 - DATAO TAKES 10.00 uS.
KLH's original text follows:
Unfortunately, although I have output logs of DFKFB runs for a
variety of platforms, I do not have one for a real KL10 itself!
Hopefully someone will be able to contribute this from their archives.

View File

@ -104,7 +104,7 @@ function instruction. In context:
For a TOPS-10 monitor I would suggest replacing the instruction at
NULCOD+1 in CLOCK1.MAC (a SOJG 6,1) with the "IDLE" function
instruction. However, this has not been well tested and there may be
a more appropriate place.
a more appropriate place. See Appendix A (below) for one way to do this.
You can verify whether this function is working by observing the
process CPU usage on the host system. As long as the KN10 is not
@ -116,3 +116,44 @@ perhaps 5%. It will never be completely zero because all monitors
always maintain a clock interrupt that drives periodic updates and
scheduler checks.
Appendix A
Patching the TOPS-10 monitor
# Patch of :system.exe[1,4]
# Info at: https://alt.sys.pdp10.narkive.com/UCpN700h/how-to-rebuild-tops10-rel
# Replace "SOJG 6,1" to "CONO 740,1"
LOGIN 1,2
SET TTY VT100
.copy tops10.exe=dskb:system.exe[1,4]
.r filddt
File: tops10.exe/p
[Patching file DSKB:TOPS10.EXE[1,2]]
[36539 symbols loaded from file]
[ACs copied from CRSHAC to 0-17]
NULCOD+1/ SOJG W,P CONO 740,1
^Z
.rename [1,4].=tops10.exe
Files renamed:
DSKB:TOPS10.EXE
.kjob
^
quit
Notes: While on same line, after it displays: SOJG W,P
type in on same line without pressing spacebar: CONO 740,1
hit enter, CTRL Z to save and exit.
Add this to your klh10 startup ini:
vi twonky2.ini, and add this line after the last devdef:
;To keep host cpu% for kn-10, apply the patch and use this line below.
devdefine idler 740 host
Then apply patch everytime you boot up by typing TOPS10.EXE at the first BOOT>
./kn10-kl twonky2.ini
KLH10> go
Starting KN10 at loc 0703667...
BOOT V4(100)
BOOT>TOPS10.EXE
[Loading from DSKB:TOPS10.EXE[1,4]]

View File

@ -53,6 +53,8 @@ for other ports such as MacOS or Windows have not yet been written.
$ mkdir tmp; cd tmp
$ ../configure --bindir=$KLH10_HOME
Or, if the configure script has not been created yet:
$ ../autogen.sh --bindir=$KLH10_HOME
$ make -C bld-kl
$ make -C bld-ks
$ make -C bld-ks-its
@ -226,28 +228,32 @@ BUILDING FROM SOURCES
characteristics. Normally no manual settings are needed.
$ mkdir <some fresh directory>; cd <that same directory>
Usually the directory <distrib>/tmp is chosen for this.
$ <distrib>/configure
or, to create the configure script first,
$ <distrib>/autogen.sh
This will generate 3 subdirectories with a Makefile in each.
They differ only in their default target, so that the different
They differ only in their model, so that the different
models can easily be built independently.
Directory Target Builds this emulator
--------- ------ --------------------
bld-kl base-kl kn10-kl (KL10B - runs TOPS-10/20)
bld-ks base-ks kn10-ks (KS10 - runs TOPS-10/20)
bld-ks-its base-ks-its kn10-ks-its (KS10 - runs ITS)
bld-kl all kn10-kl (KL10B - runs TOPS-10/20)
bld-ks all kn10-ks (KS10 - runs TOPS-10/20)
bld-ks-its all kn10-ks-its (KS10 - runs ITS)
The pre-configure build directories are also still there, but they
are no longer maintained, and do not cover all possible host
OS and CPU options. These are in <distrib>/bld/<os><cpu>.
PORTING
=======
If you are trying to build things on a platform with no
readily applicable Makefile or "bld" subdirectory, you are essentially
doing a new port. Here are some guides.
If you are trying to build things on a platform where the
configure script does not run successfully, you are essentially doing a
new port. This should be rare, but here are some ancient guides.
[1] Unix systems are the easiest. Mac has been done for the KS.
A couple of people are eyeing a NT/W2K/XP port but it's not there yet.
@ -265,11 +271,11 @@ doing a new port. Here are some guides.
appropriate CENV_SYS_xxx and CENV_CPU_xxx flags, and build the
target "port-ks".
[5] Once that works, move up to the target "base-ks". This is more
[5] Once that works, move up to the target "all" in bld-ks. This is more
complex but still avoids trying to build the networking code, which
is the most unportable part.
[6] Finally, try "base-kl" or "base-ks-its", either of which will try to
[6] Finally, try "all" in bld-kl or bld-ks-its, either of which will try to
build network code. It's OK if the code doesn't actually work at
first as long as it compiles, since you can still run the KN10
whether the network device is up or down.
@ -286,7 +292,9 @@ If you do need to fix or modify any of the sources, read this file:
And please let me know about them! You can send bug fixes or ideas,
including suggestions for improving the current build & install
process, to me at <klh@alum.mit.edu>.
process, to me at <klh@alum.mit.edu>. For the current distribution,
going to https://github.com/PDP-10/klh10 would be more useful.
INSTALLING BINARIES
===================
@ -338,9 +346,9 @@ As distributed, there are three base machines:
Target CPU uCode Runs
------ --- ----- ----
base-kl KL10B v.442 TOPS-10, TOPS-20
base-ks KS10 v.130 TOPS-10, TOPS-20
base-ks-its KS10 v.262 ITS
kn10-kl KL10B v.442 TOPS-10, TOPS-20
kn10-ks KS10 v.130 TOPS-10, TOPS-20
kn10-ks-its KS10 v.262 ITS
The KL10B version provides emulation for the following:
@ -1016,6 +1024,11 @@ The parameters for the NI20 driver are:
address is correctly selected and is different from that of the
host OS.
[TUNADDR=<d.d.d.d>] Default: <none>
When using IFMETH=tun or tap, this will set the host-side address of the
tunnel. This should possibly be the address that the inner
operating system uses as its default gateway.
[DOARP=<boolean>] Default: TRUE
Only valid for a shared interface where IPADDR= is also specified.
DOARP says whether the driver should attempt to support ARP itself;
@ -1136,7 +1149,7 @@ The parameters for the NI20 driver are:
NOTES:
* Before bringing up a KN10 as a network host, you will need to carry
* Before bringing up a KN10 as a network node, you will need to carry
out all the usual procedures needed to register a host on your local network.
The fact that the "host" will be virtual rather than physical may be hard to
explain to bureaucratic minds; you don't need to try. Just pretend it's for
@ -1166,7 +1179,7 @@ some mechanism in the PDP-10 OS to stop and "reload" or restart the
NI. On TOPS-20 this is done with the <SYSTEM>KNILDR program.
* The most common problem with a shared interface is an
inability for the virtual host (KN10) to talk with the native host; it
inability for the virtual guest (KN10) to talk with the native host; it
depends on whether the native OS allows outbound ethernet packets to
be seen by other input processes, or vice versa. Some platforms allow
this (OSF/1), others don't (Solaris, Linux), and some used to but were
@ -1250,13 +1263,17 @@ The parameters for the LHDH driver are:
mit-mc 10.3.0.44
(RFC 846 lists these and many other historic IP addresses)
[GWADDR=<d.d.d.d>] Required
Must always be given. This tells the IMP where to send packets
[GWADDR=<d.d.d.d>] Required (if IFMETH is "pcap")
Must be given if IFMETH is "pcap". This tells the IMP where to send packets
that are not addressed to the same network as the ITS system
(as defined by the IPADDR parameter).
Normally the host platform can be specified, but a real gateway
is OK too.
[TUNADDR=<d.d.d.d>] Required (if IFMETH is "tun")
Must be given if IFMETH is "tun". This sets the host-side
address of the tunnel.
[IFMETH=<tun|tap|tap+bridge|pcap|vde>] Required
As with the NI20.
@ -1325,9 +1342,10 @@ DZ11 (TTY MUX): (KS only)
that this device will respond to IO instructions addressed to it,
but no TTY I/O actually happens.
CH11 (CHAOSNET): (KS only)
CH11 (CHAOSNET): (KS only, for ITS only)
This is another dummy device, only for ITS.
This is a Chaosnet device which can use Chaosnet on Ethernet
or tunnelling Chaosnet in UDP. See src/dvch11.txt.
As for the DZ11, the generic Unibus parameters must be provided.
HOST (Native Host): (KL & KS)

View File

@ -19,6 +19,50 @@ CONFFLAGS = -DKLH10_CPU_KLX=1 \
-DKLH10_APRID_SERIALNO=3600 \
-DKLH10_CLIENT=\"MyKL\"
all: kn10-kl DPROCS_KL ALL_UTILS
all base-kl: kn10-kl DPROCS_KL ALL_UTILS
####################################################################
##
## Basic KN10 configurations
##
# Modules needed for KL10 version.
OFILES_KL = klh10.o prmstr.o fecmd.o feload.o wfio.o osdsup.o \
kn10cpu.o kn10pag.o kn10clk.o opdata.o kn10ops.o \
inmove.o inhalf.o inblsh.o intest.o \
infix.o inflt.o inbyte.o injrst.o \
inexts.o inio.o kn10dev.o \
dvcty.o dvdte.o \
vdisk.o dvrpxx.o dvrh20.o \
vmtape.o dvtm03.o \
dvni20.o dpsup.o \
dvhost.o dvlites.o
kn10-kl: $(OFILES_KL)
$(LINKER) $(LDFLAGS) $(LDOUTF) kn10-kl $(OFILES_KL) $(LIBS) $(CPULIBS)
base-ks:
@echo "base-ks is not built in this directory."
base-ks-its:
@echo "base-ks-its is not built in this directory."
####################################################################
## Lintish versions to see how many compiler warnings we can generate
##
lint-kl:
$(MAKER) kn10-kl $(DPROCS_KL) $(BASE_UTILS) uexbconv \
"SRC = $(SRC)" \
"CC = $(CC)" \
"CFLAGS = $(CFLAGS) $(CFLAGS_AUX) $(CFLAGS_LINT)" \
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"CPULIBS = $(CPULIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = $(CONFFLAGS) $(CONFFLAGS_AUX) $(CONFFLAGS_USR)"
#---

View File

@ -16,10 +16,55 @@ CONFFLAGS = -DKLH10_CPU_KS=1 \
-DKLH10_MEM_SHARED=1 \
$(TINTFLAGS) \
$(DINTFLAGS) \
-DKLH10_APRID_SERIALNO=4097 -DKLH10_DEVMAX=12 \
-DKLH10_APRID_SERIALNO=4097 \
-DKLH10_CLIENT=\"MyITS\" \
-DVMTAPE_ITSDUMP=1
all: kn10-ks-its DPROCS_KSITS ALL_UTILS
all base-ks-its: kn10-ks-its DPROCS_KSITS ALL_UTILS
####################################################################
##
## Basic KN10 configurations
##
# Modules needed for KS10 version.
OFILES_KS = klh10.o prmstr.o fecmd.o feload.o wfio.o osdsup.o \
kn10cpu.o kn10pag.o kn10clk.o opdata.o kn10ops.o \
inmove.o inhalf.o inblsh.o intest.o \
infix.o inflt.o inbyte.o injrst.o \
inexts.o inio.o kn10dev.o dvuba.o \
dvcty.o \
vdisk.o dvrpxx.o dvrh11.o \
vmtape.o dvtm03.o \
dvlhdh.o dvdz11.o dvch11.o \
dpsup.o \
dvhost.o dvlites.o
kn10-ks-its: $(OFILES_KS)
$(LINKER) $(LDFLAGS) $(LDOUTF) kn10-ks-its $(OFILES_KS) $(LIBS) $(CPULIBS)
base-ks:
@echo "base-ks is not built in this directory."
base-kl:
@echo "base-kl is not built in this directory."
####################################################################
## Lintish versions to see how many compiler warnings we can generate
##
lint-ks-its:
$(MAKER) kn10-ks-its $(DPROCS_KSITS) $(BASE_UTILS) udlconv \
"SRC = $(SRC)" \
"CC = $(CC)" \
"CFLAGS = $(CFLAGS) $(CFLAGS_AUX) $(CFLAGS_LINT)" \
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"CPULIBS = $(CPULIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = $(CONFFLAGS) $(CONFFLAGS_AUX) $(CONFFLAGS_USR)"
#---

View File

@ -14,9 +14,54 @@ CONFFLAGS = -DKLH10_CPU_KS=1 \
-DKLH10_MEM_SHARED=1 \
$(TINTFLAGS) \
$(DINTFLAGS) \
-DKLH10_APRID_SERIALNO=4097 -DKLH10_DEVMAX=12 \
-DKLH10_APRID_SERIALNO=4097 \
-DKLH10_CLIENT=\"MyKS\"
all: kn10-ks DPROCS_KS ALL_UTILS
all base-ks: kn10-ks DPROCS_KS ALL_UTILS
####################################################################
##
## Basic KN10 configurations
##
# Modules needed for KS10 version.
OFILES_KS = klh10.o prmstr.o fecmd.o feload.o wfio.o osdsup.o \
kn10cpu.o kn10pag.o kn10clk.o opdata.o kn10ops.o \
inmove.o inhalf.o inblsh.o intest.o \
infix.o inflt.o inbyte.o injrst.o \
inexts.o inio.o kn10dev.o dvuba.o \
dvcty.o \
vdisk.o dvrpxx.o dvrh11.o \
vmtape.o dvtm03.o \
dvlhdh.o dvdz11.o dvch11.o \
dpsup.o \
dvhost.o dvlites.o
kn10-ks: $(OFILES_KS)
$(LINKER) $(LDFLAGS) $(LDOUTF) kn10-ks $(OFILES_KS) $(LIBS) $(CPULIBS)
base-ks-its:
@echo "base-ks-its is not built in this directory."
base-kl:
@echo "base-kl is not built in this directory."
####################################################################
## Lintish versions to see how many compiler warnings we can generate
##
lint-ks:
$(MAKER) kn10-ks $(DPROCS_KS) $(BASE_UTILS) \
"SRC = $(SRC)" \
"CC = $(CC)" \
"CFLAGS = $(CFLAGS) $(CFLAGS_AUX) $(CFLAGS_LINT)" \
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"CPULIBS = $(CPULIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = $(CONFFLAGS) $(CONFFLAGS_AUX) $(CONFFLAGS_USR)"
#---

View File

@ -18,13 +18,14 @@
SRC = @top_srcdir@/src
BLDSRC = @top_builddir@/src
CC = @CC@
CFLAGS = -c @CFLAGS@
CFLAGS = -c @CFLAGS@ @libusb_CFLAGS@
CPPFLAGS = @CPPFLAGS@ -I$(BLDSRC) -I$(SRC)
CFLAGS_LINT = -ansi -pedantic -Wall -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wredundant-decls
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
CPULIBS = @CPULIBS@ @libusb_LIBS@
NETLIBS = @NETLIBS@
prefix = @prefix@

View File

@ -1,68 +0,0 @@
#!/bin/sh
#
# Simple build script to build all 3 cpu models in one go.
#
# Usage: MAKE-ALL buildtarget
#
# where buildtarget is for example nbaxp (NetBSD for Alpha AXP, or
# any other little-endian 64-bit CPU).
DEFBUILD=nbaxp
# TOP=/some/where/klh10
# Remove "/bld" or "/bld/nbaxp" from current directory, if it's there.
# In the latter case, assume that as the build type by default.
# If none of these current directories apply, this script must be run
# from the $TOP directory, and the build will be for the host as
# indicated on the command line, or nbaxp by default.
case "${PWD}" in
*/bld)
TOP="${PWD%/bld}"
;;
*/bld/*)
DEFBUILD="${PWD##*/}"
TOP="${PWD%/bld/*}"
;;
*)
TOP="$PWD"
;;
esac
BUILD=${1-$DEFBUILD}
cd $TOP || exit 1
echo "This script builds all PDP-10 variants for host $BUILD."
buildone() {
(
model="$1"
export KLH10_HOME=$TOP/new/${BUILD}-${model}
mkdir -p ${KLH10_HOME}
cd bld/$BUILD
make clean
make base-${model} CONFFLAGS_AUX=-DKLH10_I_CIRC=1 || exit $?
make tapedd vdkfmt wxtest enaddr || exit $?
make install
)
}
if [ "x$MODEL" != "x" ]
then
echo "Building $MODEL"
buildone "$MODEL"
else
echo "Building KL"
buildone kl || exit $?
echo "Building KS"
buildone ks || exit $?
echo "Building KS-ITS"
buildone ks-its || exit $?
fi
cd bld/$BUILD; make clean

View File

@ -1,2 +0,0 @@
#!/bin/sh
make base-kl CONFFLAGS_AUX=-DKLH10_I_CIRC=1

View File

@ -1 +0,0 @@
../../src/Mk-fbppc.mk

View File

@ -1,2 +0,0 @@
#!/bin/sh
make base-kl CONFFLAGS_AUX=-DKLH10_I_CIRC=1

View File

@ -1 +0,0 @@
../../src/Mk-fbx86.mk

View File

@ -1 +0,0 @@
../../src/Mk-lnaxp.mk

View File

@ -1,2 +0,0 @@
#!/bin/sh
make -k base-kl CONFFLAGS_AUX="-DKLH10_I_CIRC=1"

View File

@ -1 +0,0 @@
../../src/Mk-lnx86.mk

View File

@ -1,2 +0,0 @@
#!/bin/sh
make base-kl CONFFLAGS_AUX=-DKLH10_I_CIRC=1

View File

@ -1 +0,0 @@
../../src/Mk-lnxarm.mk

View File

@ -1,2 +0,0 @@
#!/bin/sh
make base-kl CONFFLAGS_AUX=-DKLH10_I_CIRC=1

View File

@ -1 +0,0 @@
../../src/Mk-lnxppc.mk

View File

@ -1,5 +0,0 @@
#!/bin/sh
make base-kl CONFFLAGS_AUX=-DKLH10_I_CIRC=1
# or
# make base-ks CONFFLAGS_AUX=-DKLH10_I_CIRC=1
# make base-ks-its CONFFLAGS_AUX=-DKLH10_I_CIRC=1

View File

@ -1 +0,0 @@
../../src/Mk-nbaxp.mk

View File

@ -1,4 +0,0 @@
#!/bin/sh
export KL10HOME=/scratch/tops20/emulators/panda-dist/i386
make base-kl CONFFLAGS_AUX=-DKLH10_I_CIRC=1
#make base-ks-its CONFFLAGS_AUX=-DKLH10_I_CIRC=1

View File

@ -1 +0,0 @@
../../src/Mk-nbx86.mk

View File

@ -1,2 +0,0 @@
#!/bin/sh
make base-kl CONFFLAGS_AUX=-DKLH10_I_CIRC=1

View File

@ -1 +0,0 @@
../../src/Mk-osfaxp.mk

View File

@ -1,2 +0,0 @@
#!/bin/sh
make base-kl CONFFLAGS_AUX=-DKLH10_I_CIRC=1

View File

@ -1 +0,0 @@
../../src/Mk-solsparc.mk

View File

@ -1,46 +0,0 @@
# KLH10 Makefile for FreeBSD on PPC
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
# Local config setup, for BSD "make"!
# Recursively invokes make with right params for local platform.
# Build definitions
SRC = ../../src
CFLAGS = -c -g3 -O3 -I. -I$(SRC)
CFLAGS_LINT = -ansi -pedantic -Wall -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wredundant-decls
# Source definitions
CENVFLAGS = -DCENV_CPU_PPC=1 -DCENV_SYS_FREEBSD=1 -DCENV_CPUF_BIGEND=1
# Any target with no customized rule here is simply passed on to the
# standard Makefile. If no target is specified, "usage" is passed on
# to generate a helpful printout.
usage:
@make -f $(SRC)/Makefile.mk usage
install:
@make -f $(SRC)/Makefile.mk install-unix
kn10-ks kn10-kl base-ks-its base-ks base-kl lint-ks-its lint-ks lint-kl port-ks kl0i-sync kl0i-rtmopt tapedd vdkfmt wxtest wfconv udlconv uexbconv enaddr dlmunch clean:
@make -f $(SRC)/Makefile.mk $@ \
"SRC=$(SRC)" \
"CFLAGS=$(CFLAGS)" \
"CFLAGS_LINT=$(CFLAGS_LINT)" \
"CENVFLAGS=$(CENVFLAGS)"

View File

@ -1,47 +0,0 @@
# KLH10 Makefile for FreeBSD on i386
# $Id: Mk-fbx86.mk,v 2.4 2002/04/24 18:03:32 klh Exp $
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
# Local config setup, for BSD "make"!
# Recursively invokes make with right params for local platform.
# Build definitions
SRC = ../../src
CFLAGS = -c -g3 -O3 -I. -I$(SRC)
CFLAGS_LINT = -ansi -pedantic -Wall -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wredundant-decls
# Source definitions
CENVFLAGS = -DCENV_CPU_I386=1 -DCENV_SYS_FREEBSD=1
# Any target with no customized rule here is simply passed on to the
# standard Makefile. If no target is specified, "usage" is passed on
# to generate a helpful printout.
usage:
@make -f $(SRC)/Makefile.mk usage
install:
@make -f $(SRC)/Makefile.mk install-unix
$(.TARGETS):
@make -f $(SRC)/Makefile.mk $@ \
"SRC=$(SRC)" \
"CFLAGS=$(CFLAGS)" \
"CFLAGS_LINT=$(CFLAGS_LINT)" \
"CENVFLAGS=$(CENVFLAGS)"

View File

@ -1,45 +0,0 @@
# KLH10 Makefile for Linux on amd64 / x86_64 / Alpha
# (or any other little-endian 64-bit cpu)
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
# Local config setup, for GNU "make"!
# Recursively invokes make with right params for local platform.
# Build definitions
SRC = ../../src
CFLAGS = -c -g3 -O3 -I. -I$(SRC)
CFLAGS_LINT = -ansi -pedantic -Wall -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wredundant-decls
# Source definitions
CENVFLAGS = -DCENV_CPU_ALPHA=1 -DCENV_SYS_LINUX=1 -DKLH10_DEV_LITES=1 \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
# Any target with no customized rule here is simply passed on to the
# standard Makefile. If no target is specified, "usage" is passed on
# to generate a helpful printout.
usage .DEFAULT:
@make -f $(SRC)/Makefile.mk $@ \
"SRC=$(SRC)" \
"CFLAGS=$(CFLAGS)" \
"CFLAGS_LINT=$(CFLAGS_LINT)" \
"CENVFLAGS=$(CENVFLAGS)"
install:
make -f $(SRC)/Makefile.mk install-unix

View File

@ -1,46 +0,0 @@
# KLH10 Makefile for Linux on i386
# $Id: Mk-lnx86.mk,v 2.5 2002/04/24 18:03:04 klh Exp $
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
# Local config setup, for GNU "make"!
# Recursively invokes make with right params for local platform.
# Build definitions
SRC = ../../src
CFLAGS = -c -g3 -O3 -I. -I$(SRC)
CFLAGS_LINT = -ansi -pedantic -Wall -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wredundant-decls
# Source definitions
CENVFLAGS = -DCENV_CPU_I386=1 -DCENV_SYS_LINUX=1 -DKLH10_DEV_LITES=1 \
-DKLH10_NET_TUN=1 \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
# Any target with no customized rule here is simply passed on to the
# standard Makefile. If no target is specified, "usage" is passed on
# to generate a helpful printout.
usage .DEFAULT:
@make -f $(SRC)/Makefile.mk $@ \
"SRC=$(SRC)" \
"CFLAGS=$(CFLAGS)" \
"CFLAGS_LINT=$(CFLAGS_LINT)" \
"CENVFLAGS=$(CENVFLAGS)"
install:
make -f $(SRC)/Makefile.mk install-unix

View File

@ -1,44 +0,0 @@
# KLH10 Makefile for Linux on ARM
# $Id: Mk-lnxarm.mk,v 2.4 2002/04/24 18:17:05 klh Exp $
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
# Local config setup, for GNU "make"!
# Recursively invokes make with right params for local platform.
# Build definitions
SRC = ../../src
CFLAGS = -c -g3 -O3 -I. -I$(SRC)
CFLAGS_LINT = -ansi -pedantic -Wall -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wredundant-decls
# Source definitions
CENVFLAGS = -DCENV_CPU_ARM=1 -DCENV_SYS_LINUX=1
# Any target with no customized rule here is simply passed on to the
# standard Makefile. If no target is specified, "usage" is passed on
# to generate a helpful printout.
usage .DEFAULT:
@make -f $(SRC)/Makefile.mk $@ \
"SRC=$(SRC)" \
"CFLAGS=$(CFLAGS)" \
"CFLAGS_LINT=$(CFLAGS_LINT)" \
"CENVFLAGS=$(CENVFLAGS)"
install:
make -f $(SRC)/Makefile.mk install-unix

View File

@ -1,44 +0,0 @@
# KLH10 Makefile for Linux on PowerPC
# $Id: Mk-lnxppc.mk,v 2.4 2002/04/24 18:19:53 klh Exp $
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
# Local config setup, for GNU "make"!
# Recursively invokes make with right params for local platform.
# Build definitions
SRC = ../../src
CFLAGS = -c -g3 -O3 -I. -I$(SRC)
CFLAGS_LINT = -ansi -pedantic -Wall -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wredundant-decls
# Source definitions
CENVFLAGS = -DCENV_CPU_PPC=1 -DCENV_SYS_LINUX=1 -DCENV_CPUF_BIGEND=1
# Any target with no customized rule here is simply passed on to the
# standard Makefile. If no target is specified, "usage" is passed on
# to generate a helpful printout.
usage .DEFAULT:
@make -f $(SRC)/Makefile.mk $@ \
"SRC=$(SRC)" \
"CFLAGS=$(CFLAGS)" \
"CFLAGS_LINT=$(CFLAGS_LINT)" \
"CENVFLAGS=$(CENVFLAGS)"
install:
make -f $(SRC)/Makefile.mk install-unix

View File

@ -1,67 +0,0 @@
# KLH10 Makefile for NetBSD on amd64 / x86_64 / Alpha
# (or any other little-endian 64-bit cpu)
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
# Local config setup, for BSD "make"!
# Recursively invokes make with right params for local platform.
# Build definitions
SRC = ../../src
CFLAGS = -c -g3 -O3
CFLAGS_LINT = -ansi -pedantic -Wall -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wredundant-decls
# Source definitions
CENVFLAGS = -DCENV_CPU_ALPHA=1 -DCENV_SYS_NETBSD=1 -include netbsd-sucks.h \
-DKLH10_NET_PCAP=1 \
-DKLH10_NET_TUN=1 \
-DKLH10_NET_TAP=1 \
-DKLH10_NET_BRIDGE=1
# Any target with no customized rule here is simply passed on to the
# standard Makefile. If no target is specified, "usage" is passed on
# to generate a helpful printout.
usage:
@make -f $(SRC)/Makefile.mk usage
install:
@make -f $(SRC)/Makefile.mk install-unix
$(.TARGETS): netbsd-sucks.h
@make -f $(SRC)/Makefile.mk $@ \
"SRC=$(SRC)" \
"CFLAGS=$(CFLAGS)" \
"CFLAGS_LINT=$(CFLAGS_LINT)" \
"CENVFLAGS=$(CENVFLAGS)"
# This auxiliary file is needed to get around a bug in the NetBSD
# /usr/include files. <stdio.h> includes <sys/types.h> which includes
# <machine/types.h> which incorrectly exposes a typedef of vaddr_t (normally
# a kernel only type), thus conflicting with KLH10's vaddr_t.
# By including this file ahead of any other source files (see the -include
# in CENVFLAGS) we can nullify the typedef.
# And while we're at it, blast paddr_t for the same reason.
netbsd-sucks.h:
@echo '/* DO NOT EDIT - dynamically generated, see Makefile */' > $@
@echo "#define vaddr_t _kernel_vaddr_t" >> $@
@echo "#define paddr_t _kernel_paddr_t" >> $@
@echo "#include <sys/types.h>" >> $@
@echo "#undef paddr_t" >> $@
@echo "#undef vaddr_t" >> $@

View File

@ -1,63 +0,0 @@
# KLH10 Makefile for NetBSD on i386
# $Id: Mk-nbx86.mk,v 2.5 2002/04/26 05:56:48 klh Exp $
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
# Local config setup, for BSD "make"!
# Recursively invokes make with right params for local platform.
# Build definitions
SRC = ../../src
CFLAGS = -c -g3 -O3 -ggdb
CFLAGS_LINT = -ansi -pedantic -Wall -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wredundant-decls
# Source definitions
CENVFLAGS = -DCENV_CPU_I386=1 -DCENV_SYS_NETBSD=1 -include netbsd-sucks.h
# Any target with no customized rule here is simply passed on to the
# standard Makefile. If no target is specified, "usage" is passed on
# to generate a helpful printout.
usage:
@make -f $(SRC)/Makefile.mk usage
install:
@make -f $(SRC)/Makefile.mk install-unix
$(.TARGETS): netbsd-sucks.h
@make -f $(SRC)/Makefile.mk $@ \
"SRC=$(SRC)" \
"CFLAGS=$(CFLAGS)" \
"CFLAGS_LINT=$(CFLAGS_LINT)" \
"CENVFLAGS=$(CENVFLAGS)"
# This auxiliary file is needed to get around a bug in the NetBSD
# /usr/include files. <stdio.h> includes <sys/types.h> which includes
# <machine/types.h> which incorrectly exposes a typedef of vaddr_t (normally
# a kernel only type), thus conflicting with KLH10's vaddr_t.
# By including this file ahead of any other source files (see the -include
# in CENVFLAGS) we can nullify the typedef.
# And while we're at it, blast paddr_t for the same reason.
netbsd-sucks.h:
@echo '/* DO NOT EDIT - dynamically generated, see Makefile */' > $@
@echo "#define vaddr_t _kernel_vaddr_t" >> $@
@echo "#define paddr_t _kernel_paddr_t" >> $@
@echo "#include <sys/types.h>" >> $@
@echo "#undef paddr_t" >> $@
@echo "#undef vaddr_t" >> $@

View File

@ -1,48 +0,0 @@
# KLH10 Makefile for NeXT on M68x
# $Id: Mk-nxt.mk,v 2.4 2001/11/10 21:28:59 klh Exp $
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
#####
# WARNING: This platform is no longer supported! Its makefile is
# retained only as a guide in case anyone wants to re-port it.
#####
# Local config setup.
# Recursively invokes make with right params for local platform.
# Build definitions
CC=gcc
CFLAGS = -c -finline-functions -fomit-frame-pointer -O -O2 -pipe
SRC = ../../src
CFLAGS_LINT =
# Source definitions
CENVFLAGS = -DCENV_CPU_M68=1 -DCENV_SYS_NEXT=1
BASELIST = ks-t20
default:
@echo "Must specify a target, one of \"$(BASELIST)\""
$(BASELIST):
make -f $(SRC)/Makefile.mk kn10-ks wfconv tapedd vdkfmt
"SRC=$(SRC)" "CENVFLAGS=$(CENVFLAGS)"
"CONFFLAGS =
-DWORD10_USEGCCSPARC=1 \
-DKLH10_CPU_KS=1 \
-DKLH10_SYS_T20=1 \
$(TSYNCFLAGS) -DKLH10_CTYIO_INT=0"

View File

@ -1,52 +0,0 @@
# KLH10 Makefile for OSF/1 (DU, Tru64) on amd64 / x86_64 / Alpha
# (or any other little-endian 64-bit cpu)
# $Id: Mk-osfaxp.mk,v 2.3 2001/11/10 21:28:59 klh Exp $
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
# Local config setup, for OSF1/DU/Tru64 "make"!
# Recursively invokes make with right params for local platform.
# Build definitions
# librt.a is necessary in order to get memlk (mlockall).
# May also want -non_shared in LDFLAGS to avoid OSF version problems.
SRC = ../../src
CFLAGS = -c -g3 -O -std1 -I. -I$(SRC)
CFLAGS_LINT =
LDFLAGS =
LIBS = -lrt
# Source definitions
CENVFLAGS = -DCENV_CPU_ALPHA=1 -DCENV_SYS_DECOSF=1
# Targets
# Any target with no customized rule here is simply passed on to the
# standard Makefile. If no target is specified, "usage" is passed on
# to generate a helpful printout.
usage .DEFAULT:
@make -f $(SRC)/Makefile.mk $@ \
"SRC=$(SRC)" \
"CFLAGS=$(CFLAGS)" \
"CFLAGS_LINT=$(CFLAGS_LINT)" \
"CENVFLAGS=$(CENVFLAGS)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBS=$(LIBS)"
install:
make -f $(SRC)/Makefile.mk install-unix

View File

@ -1,61 +0,0 @@
# KLH10 Makefile for Solaris on SUN Sparc (using SUN's cc)
# $Id: Mk-solsparc-cc.mk,v 2.3 2002/04/24 08:03:02 klh Exp $
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
# Local config setup, for SUN's make & compiler.
# Recursively invokes make with right params for local platform.
# WARNING! DO NOT USE THIS for SUN C 4.2 and possibly others.
# Note: these simple compile flags are known to work for Solaris 5 and 8
# (SunOS 5.5.1 and 5.8); using "-fast" fails on 5.8.
# Libraries are harder; -lrt doesn't exist on 5.5.1 and will have to
# be removed or modified if not building for 5.8.
# -lsocket and -lnsl are needed only for osdnet.c.
# -lrt is needed for nanosleep().
# Build definitions
# These LIBS are needed only for things using osdnet.c.
CC = /opt/SUNWspro/bin/cc
CFLAGS = -c -g -O
LIBS = -lsocket -lnsl -lrt
CONFFLAGS_AUX=-DWORD10_USEHUN=1
# Source definitions
SRC = ../../src
CENVFLAGS = -DCENV_CPU_SPARC=1 -DCENV_SYS_SOLARIS=1 \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
# Targets
# Any target with no customized rule here is simply passed on to the
# standard Makefile. If no target is specified, "usage" is passed on
# to generate a helpful printout.
usage .DEFAULT:
@make -f $(SRC)/Makefile.mk $@ \
"CC=$(CC)" \
"SRC=$(SRC)" \
"CFLAGS=$(CFLAGS)" \
"CFLAGS_LINT=$(CFLAGS_LINT)" \
"CENVFLAGS=$(CENVFLAGS)" \
"CONFFLAGS_AUX=$(CONFFLAGS_AUX)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBS=$(LIBS)"
install:
make -f $(SRC)/Makefile.mk install-unix

View File

@ -1,60 +0,0 @@
# KLH10 Makefile for Solaris on SUN Sparc
# $Id: Mk-solsparc.mk,v 2.6 2002/04/24 18:25:59 klh Exp $
#
# Copyright © 2001 Kenneth L. Harrenstien
# All Rights Reserved
#
# This file is part of the KLH10 Distribution. Use, modification, and
# re-distribution is permitted subject to the terms in the file
# named "LICENSE", which contains the full text of the legal notices
# and should always accompany this Distribution.
#
# This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
#
# This notice (including the copyright and warranty disclaimer)
# must be included in all copies or derivations of this software.
#
#####################################################################
# Local config setup, for GNU "make"!
# Recursively invokes make with right params for local platform.
# Note: this makefile forces the use of GCC; SUN C 4.2 proved to have
# bugs. For a makefile that does use the SUN compiler, use
# Mk-solsparc-cc.mk instead.
# Build definitions
# -lsocket and -lnsl are needed only for osdnet.c.
# -lrt is needed for nanosleep().
CC=gcc
CFLAGS = -c -g -O3
LIBS = -lsocket -lnsl -lrt
CFLAGS_LINT = -ansi -pedantic -Wall -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wredundant-decls
CONFFLAGS_AUX= -DWORD10_USEGCCSPARC=1
# Source definitions
SRC = ../../src
CENVFLAGS = -DCENV_CPU_SPARC=1 -DCENV_SYS_SOLARIS=1 \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
# Targets
# Any target with no customized rule here is simply passed on to the
# standard Makefile. If no target is specified, "usage" is passed on
# to generate a helpful printout.
usage .DEFAULT:
@make -f $(SRC)/Makefile.mk $@ \
"CC=$(CC)" \
"SRC=$(SRC)" \
"CFLAGS=$(CFLAGS)" \
"CFLAGS_LINT=$(CFLAGS_LINT)" \
"CENVFLAGS=$(CENVFLAGS)" \
"CONFFLAGS_AUX=$(CONFFLAGS_AUX)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBS=$(LIBS)"
install:
make -f $(SRC)/Makefile.mk install-unix

View File

@ -15,5 +15,4 @@ set sw=400100,,0
go
; Quit when done
quit
really-quit

View File

@ -16,33 +16,12 @@
#
#####################################################################
# KLH10 Makefile scheme
#
# <dist>/src/
# Makefile - Top-level makefile for in-src build (not recommended)
# Makefile.mk - All generic rules and definitions
# Mk-<plat>.mk - Platform-specific definitions
#
# <dist>/bld/<plat>
# Makefile -> ../../src/Mk-<plat>.mk
# (or local version thereof)
# [any locally munged .h files]
#
# Each top-level makefile should define at least the following:
# SRC = <location of source dir>
#
#####################################################################
# Basic default definitions.
# Normally these will be overridden by build-specific make
# invocations, by any of:
# (1) concatenation fragments generated by the configure script
# in front of this Makefile.mk
# (2) concatenation of a platform-specific makefile of the
# form "Mk-<plat>.mk"
# (the most recent defs override these defaults)
# (3) command line definitions, which override those from any files.
# (2) command line definitions, which override those from any files.
# Generic compile/link flags
# Suitable for plain vanilla Unix but normally overridden.
@ -55,6 +34,7 @@ LINKER ?= $(CC)
LDFLAGS ?=
LDOUTF ?= -o
LIBS ?=
CPULIBS ?=
NETLIBS ?= -lpcap
# Variables specific to this makefile setup
@ -64,28 +44,25 @@ MAKE_CENV ?=
CENVFLAGS ?=
CONFFLAGS ?=
CONFFLAGS_AUX ?=
CONFFLAGS_USR ?=
MAKEFILE ?= $(SRC)/Makefile.mk
MAKER = make -f $(MAKEFILE) $(MAKE_CENV)
BUILDMOD = $(CC) $(CFLAGS) $(CFLAGS_AUX) $(CPPFLAGS) \
$(CENVFLAGS) $(CONFFLAGS) $(CONFFLAGS_AUX)
$(CENVFLAGS) $(CONFFLAGS) $(CONFFLAGS_AUX) $(CONFFLAGS_USR)
## Default if no target given to make.
## Give some help
##
default:
@echo 'Intended to be invoked from a bld/<conf>/ directory, look'
@echo 'at bld/*/Makefile for examples.'
## Default if no target given to bld/<conf> invocation
##
usage:
@echo 'Use "make <target>", eg "make base-kl"'
@echo 'Normally the target is one of these 3 base configs:'
@echo ' base-kl KL10 version for TOPS (kn10-kl and utils)'
@echo ' base-ks KS10 version for TOPS (kn10-ks and utils)'
@echo ' base-ks-its KS10 version for ITS (kn10-ks-its and utils)'
usage help:
@echo 'Use "make <target>", eg "make all"'
@echo 'Normally the target is:'
@echo ' all KL10 version and all utilities'
@echo 'Or these KN10 versions, in the appropriate directory:'
@echo ' kn10-kl KL10 version for TOPS'
@echo ' kn10-ks KS10 version for TOPS'
@echo ' kn10-ks-its KS10 version for ITS'
@echo 'Or these utilities:'
@echo ' tapedd Tape copy & conversion'
@echo ' vdkfmt Virtual disk copy & conversion'
@ -107,10 +84,12 @@ showdefs:
@echo "CPPFLAGS= $(CPPFLAGS)"
@echo "LDFLAGS = $(LDFLAGS)"
@echo "LIBS = $(LIBS)"
@echo "CPULIBS = $(CPULIBS)"
@echo "NETLIBS = $(NETLIBS)"
@echo "CENVFLAGS = $(CENVFLAGS)"
@echo "CONFFLAGS = $(CONFFLAGS)"
@echo "CONFFLAGS_AUX = $(CONFFLAGS_AUX)"
@echo "CONFFLAGS_USR = $(CONFFLAGS_USR)"
@echo "BUILDMOD = $(BUILDMOD)"
@echo "KLH10_HOME = $(KLH10_HOME)"
@ -166,38 +145,12 @@ CONFS = cenv.h klh10.h word10.h wfio.h fecmd.h feload.h \
dvrh20.h dvrpxx.h dvtm03.h dvni20.h dvhost.h dvlites.h \
vmtape.h vdisk.h config.h
# Modules needed for KL10 version.
OFILES_KL = klh10.o prmstr.o fecmd.o feload.o wfio.o osdsup.o \
kn10cpu.o kn10pag.o kn10clk.o opdata.o kn10ops.o \
inmove.o inhalf.o inblsh.o intest.o \
infix.o inflt.o inbyte.o injrst.o \
inexts.o inio.o kn10dev.o \
dvcty.o dvdte.o \
vdisk.o dvrpxx.o dvrh20.o \
vmtape.o dvtm03.o \
dvni20.o dpsup.o \
dvhost.o dvlites.o
# Modules needed for KS10 version.
OFILES_KS = klh10.o prmstr.o fecmd.o feload.o wfio.o osdsup.o \
kn10cpu.o kn10pag.o kn10clk.o opdata.o kn10ops.o \
inmove.o inhalf.o inblsh.o intest.o \
infix.o inflt.o inbyte.o injrst.o \
inexts.o inio.o kn10dev.o dvuba.o \
dvcty.o \
vdisk.o dvrpxx.o dvrh11.o \
vmtape.o dvtm03.o \
dvlhdh.o dvdz11.o dvch11.o \
dpsup.o \
dvhost.o dvlites.o
# Device Processes (DPs) built concurrently with KN10
DPROCS_KL = dprpxx dptm03 dpni20
DPROCS_KS = dprpxx dptm03
DPROCS_KSITS = dprpxx dptm03 dpimp
DPROCS_KSITS = dprpxx dptm03 dpimp dpchaos
# Base utility programs, independent of KN10
@ -244,21 +197,6 @@ DINTFLAGS = \
-DKLH10_CTYIO_INT=1
####################################################################
##
## Basic KN10 configurations
##
kn10-ks: $(OFILES_KS)
$(LINKER) $(LDFLAGS) $(LDOUTF) kn10-ks $(OFILES_KS) $(LIBS)
kn10-ks-its: $(OFILES_KS)
$(LINKER) $(LDFLAGS) $(LDOUTF) kn10-ks-its $(OFILES_KS) $(LIBS)
kn10-kl: $(OFILES_KL)
$(LINKER) $(LDFLAGS) $(LDOUTF) kn10-kl $(OFILES_KL) $(LIBS)
####################################################################
## Auxiliary action targets
@ -288,6 +226,8 @@ install:
mv ${KLH10_HOME}/dpni20 ${KLH10_HOME}/flushed; fi
@if [ -x ${KLH10_HOME}/dpimp ]; then \
mv ${KLH10_HOME}/dpimp ${KLH10_HOME}/flushed; fi
@if [ -x ${KLH10_HOME}/dpchaos ]; then \
mv ${KLH10_HOME}/dpchaos ${KLH10_HOME}/flushed; fi
@if [ -x kn10-ks ]; then cp -p kn10-ks ${KLH10_HOME}/; fi
@if [ -x kn10-ks-its ]; then cp -p kn10-ks-its ${KLH10_HOME}/; fi
@if [ -x kn10-kl ]; then cp -p kn10-kl ${KLH10_HOME}/; fi
@ -295,6 +235,7 @@ install:
@if [ -x dptm03 ]; then cp -p dptm03 ${KLH10_HOME}/; fi
@if [ -x dpni20 ]; then cp -p dpni20 ${KLH10_HOME}/; fi
@if [ -x dpimp ]; then cp -p dpimp ${KLH10_HOME}/; fi
@if [ -x dpchaos ]; then cp -p dpchaos ${KLH10_HOME}/; fi
@if [ -x enaddr ]; then cp -p enaddr ${KLH10_HOME}/; fi
@if [ -x tapedd ]; then cp -p tapedd ${KLH10_HOME}/; fi
@if [ -x udlconv ]; then cp -p udlconv ${KLH10_HOME}/; fi
@ -304,92 +245,6 @@ install:
@if [ -x wxtest ]; then cp -p wxtest ${KLH10_HOME}/; fi
@echo "Done!"
####################################################################
## Specific KLH10 configurations
##
## Provided as a convenience, not intended to satisfy all
## possible platforms or configurations.
# Standard setup for KS ITS
#
base-ks-its:
$(MAKER) kn10-ks-its $(DPROCS_KSITS) $(BASE_UTILS) udlconv \
"SRC = $(SRC)" \
"CC = $(CC)" \
"CFLAGS = $(CFLAGS) $(CFLAGS_AUX)" \
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = \
-DKLH10_CPU_KS=1 \
-DKLH10_SYS_ITS=1 \
-DKLH10_EVHS_INT=1 \
-DKLH10_DEV_DPTM03=1 \
-DKLH10_DEV_DPRPXX=1 \
-DKLH10_DEV_DPIMP=1 \
-DKLH10_SIMP=0 \
-DKLH10_MEM_SHARED=1 \
$(TINTFLAGS) \
$(DINTFLAGS) \
-DKLH10_APRID_SERIALNO=4097 -DKLH10_DEVMAX=12 \
-DKLH10_CLIENT=\\\"MyITS\\\" \
$(CONFFLAGS_AUX) \
-DVMTAPE_ITSDUMP=1 "
# Standard setup for KS (TOPS-20, maybe TOPS-10)
#
base-ks:
$(MAKER) kn10-ks $(DPROCS_KS) $(BASE_UTILS) \
"SRC = $(SRC)" \
"CC = $(CC)" \
"CFLAGS = $(CFLAGS) $(CFLAGS_AUX)" \
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = \
-DKLH10_CPU_KS=1 \
-DKLH10_SYS_T20=1 \
-DKLH10_EVHS_INT=1 \
-DKLH10_DEV_DPTM03=1 \
-DKLH10_DEV_DPRPXX=1 \
-DKLH10_MEM_SHARED=1 \
$(TINTFLAGS) \
$(DINTFLAGS) \
-DKLH10_APRID_SERIALNO=4097 -DKLH10_DEVMAX=12 \
-DKLH10_CLIENT=\\\"MyKS\\\" \
$(CONFFLAGS_AUX) "
# Standard setup for KL (TOPS-10 and TOPS-20)
#
base-kl:
$(MAKER) kn10-kl $(DPROCS_KL) $(BASE_UTILS) uexbconv \
"SRC = $(SRC)" \
"CC = $(CC)" \
"CFLAGS = $(CFLAGS) $(CFLAGS_AUX)" \
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = \
-DKLH10_CPU_KLX=1 \
-DKLH10_SYS_T20=1 \
-DKLH10_EVHS_INT=1 \
-DKLH10_DEV_DPNI20=1 \
-DKLH10_DEV_DPTM03=1 \
-DKLH10_DEV_DPRPXX=1 \
-DKLH10_MEM_SHARED=1 \
-DKLH10_RTIME_OSGET=1 \
-DKLH10_ITIME_INTRP=1 \
-DKLH10_CTYIO_INT=1 \
-DKLH10_APRID_SERIALNO=3600 \
-DKLH10_CLIENT=\\\"MyKL\\\" \
$(CONFFLAGS_AUX) "
###
# On Sat, 26 Dec 2009, Jean-Marc Bourguet posted:
@ -415,45 +270,6 @@ base-kl:
#
# -- Mark --
####################################################################
## Lintish versions to see how many compiler warnings we can generate
##
lint-ks-its:
$(MAKER) kn10-ks-its $(DPROCS_KSITS) $(BASE_UTILS) udlconv \
"SRC = $(SRC)" \
"CC = $(CC)" \
"CFLAGS = $(CFLAGS) $(CFLAGS_AUX) $(CFLAGS_LINT)" \
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = $(CONFFLAGS) $(CONFFLAGS_AUX)"
lint-ks:
$(MAKER) kn10-ks $(DPROCS_KS) $(BASE_UTILS) \
"SRC = $(SRC)" \
"CC = $(CC)" \
"CFLAGS = $(CFLAGS) $(CFLAGS_AUX) $(CFLAGS_LINT)" \
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = $(CONFFLAGS) $(CONFFLAGS_AUX)"
lint-kl:
$(MAKER) kn10-kl $(DPROCS_KL) $(BASE_UTILS) uexbconv \
"SRC = $(SRC)" \
"CC = $(CC)" \
"CFLAGS = $(CFLAGS) $(CFLAGS_AUX) $(CFLAGS_LINT)" \
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = $(CONFFLAGS) $(CONFFLAGS_AUX)"
####################################################################
## KLH10 versions for diagnostics and debugging.
@ -472,15 +288,17 @@ port-ks:
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"CPULIBS = $(CPULIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = \
-DKLH10_CPU_KS=1 \
-DKLH10_SYS_T20=1 \
-DKLH10_RTIME_SYNCH=1 \
-DKLH10_APRID_SERIALNO=4097 -DKLH10_DEVMAX=12 \
-DKLH10_APRID_SERIALNO=4097 \
-DKLH10_CLIENT=\\\"MyKS\\\" \
$(CONFFLAGS_AUX) "
$(CONFFLAGS_AUX) \
$(CONFFLAGS_USR) "
# Build KL0 with KI paging, for running diagnostics.
@ -498,6 +316,7 @@ kl0i-sync:
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"CPULIBS = $(CPULIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = \
@ -511,7 +330,8 @@ kl0i-sync:
-DKLH10_RTIME_SYNCH=1 \
-DKLH10_ITIME_SYNCH=1 \
-DKLH10_CTYIO_INT=0 \
$(CONFFLAGS_AUX) "
$(CONFFLAGS_AUX) \
$(CONFFLAGS_USR) "
# KL0 with KI paging - Realtime & optimized, good for timing diagnostics.
#
@ -523,6 +343,7 @@ kl0i-rtmopt:
"CPPFLAGS = $(CPPFLAGS)" \
"LDFLAGS = $(LDFLAGS)" \
"LIBS = $(LIBS)" \
"CPULIBS = $(CPULIBS)" \
"NETLIBS = $(NETLIBS)" \
"CENVFLAGS = $(CENVFLAGS)" \
"CONFFLAGS = \
@ -536,7 +357,16 @@ kl0i-rtmopt:
-DKLH10_RTIME_OSGET=1 \
-DKLH10_ITIME_INTRP=1 \
-DKLH10_CTYIO_INT=0 \
$(CONFFLAGS_AUX) "
$(CONFFLAGS_AUX) \
$(CONFFLAGS_USR) "
# --------- CHUDP subprocess (ITS KS only; counterpart for dvch11)
#
dpchaos.o: $(SRC)/dpchaos.c $(SRC)/dpchaos.h $(SRC)/dpsup.h
$(BUILDMOD) $(SRC)/dpchaos.c
dpchaos: dpchaos.o dpsup.o
$(LINKER) $(LDFLAGS) $(LDOUTF) dpchaos dpchaos.o dpsup.o $(LIBS) $(NETLIBS)
####################################################################
@ -606,7 +436,7 @@ dpimp: dpimp.o dpsup.o
## Needs CONFFLAGS just for optional VMTAPE_ITSDUMP.
##
tapedd.o: $(SRC)/tapedd.c $(SRC)/vmtape.c $(SRC)/vmtape.h $(BLDSRC)/config.h
$(CC) $(CFLAGS) $(CPPFLAGS) $(CENVFLAGS) $(CONFFLAGS) $(SRC)/tapedd.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(CENVFLAGS) $(CONFFLAGS) $(CONFFLAGS_AUX) $(CONFFLAGS_USR) $(SRC)/tapedd.c
tapedd: tapedd.o wfio.o prmstr.o
$(LINKER) $(LDFLAGS) $(LDOUTF) tapedd tapedd.o wfio.o prmstr.o $(LIBS)
@ -660,7 +490,7 @@ uexbconv: uexbconv.o
## ENADDR - Ethernet interface test & manipulation
## May require CONFFLAGS to force a particular osdnet config.
enaddr.o: $(SRC)/enaddr.c $(SRC)/osdnet.h $(SRC)/osdnet.c $(BLDSRC)/config.h
$(CC) $(CFLAGS) $(CPPFLAGS) $(CENVFLAGS) $(CONFFLAGS) $(SRC)/enaddr.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(CENVFLAGS) $(CONFFLAGS) $(CONFFLAGS_AUX) $(CONFFLAGS_USR) $(SRC)/enaddr.c
enaddr: enaddr.o
$(LINKER) $(LDFLAGS) $(LDOUTF) enaddr enaddr.o $(NETLIBS) $(LIBS)
@ -680,7 +510,7 @@ dpsup.o: $(SRC)/dpsup.c $(SRC)/dpsup.h \
$(SRC)/osdsup.h $(SRC)/word10.h $(BLDSRC)/config.h
$(BUILDMOD) $(SRC)/dpsup.c
dvch11.o: $(SRC)/dvch11.c $(SRC)/dvch11.h $(BLDSRC)/config.h
dvch11.o: $(SRC)/dvch11.c $(SRC)/dvch11.h $(SRC)/dpchaos.h $(BLDSRC)/config.h
$(BUILDMOD) $(SRC)/dvch11.c
dvcty.o: $(SRC)/dvcty.c $(SRC)/dvcty.h $(BLDSRC)/config.h
@ -701,7 +531,7 @@ dvlites.o: $(SRC)/dvlites.c $(SRC)/dvlites.h $(BLDSRC)/config.h
dvlhdh.o: $(SRC)/dvlhdh.c $(SRC)/dvlhdh.h $(BLDSRC)/config.h
$(BUILDMOD) $(SRC)/dvlhdh.c
dvni20.o: $(SRC)/dvni20.c $(SRC)/dvni20.h $(BLDSRC)/config.h
dvni20.o: $(SRC)/dvni20.c $(SRC)/dvni20.h $(SRC)/dpni20.h $(BLDSRC)/config.h
$(BUILDMOD) $(SRC)/dvni20.c
dvrh11.o: $(SRC)/dvrh11.c $(SRC)/dvrh11.h $(BLDSRC)/config.h

View File

@ -37,10 +37,9 @@
** CENV_SYS_x = target OS
** CENV_SYSF_x = target OS features
**
** Note that the CPU and SYS are expected to be explicitly specified by
** a command line definition. If no setting is detected this code tries
** a few simple checks, but it is not an error if nothing is set; the
** includer may have portable defaults.
** Note that most of the definitions in this file are, or should be,
** obsolete. Where still relevant, they should be detected by the
** configure script.
*/
#ifndef CENV_INCLUDED

99
src/cmdline.h Normal file
View File

@ -0,0 +1,99 @@
/* CMDLINE.H - header file for command line processing functions
*/
/* Copyright © 1992, 1993, 2001 Kenneth L. Harrenstien
** Copyright © 2017 Olaf Seibert
** All Rights Reserved
**
** This file is part of the KLH10 Distribution. Use, modification, and
** re-distribution is permitted subject to the terms in the file
** named "LICENSE", which contains the full text of the legal notices
** and should always accompany this Distribution.
**
** This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
**
** This notice (including the copyright and warranty disclaimer)
** must be included in all copies or derivations of this software.
*/
#ifndef CMDBUFLEN
# define CMDBUFLEN 512
#endif
#ifndef CMDMAXARG
# define CMDMAXARG 10
#endif
struct cmd_s {
struct cmkey_s *cmd_keys;/* Command table */
int cmd_flags; /* State flags */
char *cmd_prm; /* Pointer to command prompt */
char *cmd_buf; /* Pointer to start of buffer */
size_t cmd_blen; /* Size of buffer */
int cmd_left; /* # chars left for current cmd being input */
char *cmd_inp; /* Input deposit pointer */
char *cmd_rdp; /* Readout pointer */
size_t cmd_rleft; /* # chars left to read */
/* Provide all command routines with their desired arguments */
char *cmd_arglin; /* Original pointer to start of args on line */
int cmd_argc; /* # of tokens */
char *cmd_argv[CMDMAXARG+1]; /* Array of token pointers */
char *cmd_tdp; /* Next free loc in token buffer */
size_t cmd_tleft; /* # chars free in token buffer */
char cmd_tokbuf[CMDBUFLEN+CMDMAXARG];
#if 0
char *cmd_wbf; /* Pointer to work buffer */
size_t cmd_wblen; /* Size in chars */
char *cmd_wbp; /* Current deposit ptr */
size_t cmd_wbleft; /* # chars left */
#endif
};
#define CMDF_ACTIVE 01 /* Activation char seen, execute accumulated cmd */
#define CMDF_INACCUM 02 /* In accumulation phase */
#define CMDF_NOPRM 040 /* Disable prompt */
struct cmkey_s {
char *cmk_key;
union cmnode *cmk_p;
};
struct cmrtn_s {
void (*cmr_vect)(struct cmd_s *); /* Function to call */
int cmr_flgs; /* Misc flags */
char *cmr_synt; /* Arg syntax */
char *cmr_help; /* Short one-line help */
char *cmr_desc; /* Long description */
};
#define CMRF_NOARG 01 /* Command takes no args */
#define CMRF_TOKS 010 /* Command wants whole line tokenized, via cm */
#define CMRF_TLIN 020 /* Command wants overall line arg, via cm */
#define CMRF_CMPTR 040 /* Command wants just cmd state ptr */
union cmnode { /* All possible nodes for a keyword */
struct cmrtn_s cmn_rtn;
};
/* Predeclarations */
void cmdinit(struct cmd_s *, struct cmkey_s *, char *, char *, size_t);
int cmdexec(struct cmd_s *);
int cmdaccum(struct cmd_s *);
struct cmkey_s *cmdkeylookup(char *, struct cmkey_s *, struct cmkey_s **);
char *cmdlsetup(struct cmd_s *);
char *cmdlcopy(struct cmd_s *cm, char *line);
void fc_gques(struct cmd_s *cm);
void fc_ghelp(struct cmd_s *cm);
/* CMDDEF is used to define top-level commands. It does not accumulate
** them into a table (C is far too puny for that) but gathers together
** various information that a higher-level table can then point to.
*/
#define CMDDEF(deflab, func, flgs, argsyn, minihelp, longdesc) \
static void func(struct cmd_s *); \
static struct cmrtn_s deflab = { func, flgs, argsyn, minihelp, longdesc };
#define KEYSBEGIN(name) struct cmkey_s name[] = {
#define KEYDEF(key,nod) { key, (union cmnode *)(&nod) },
#define KEYSEND { 0, 0 } };

1587
src/dpchaos.c Normal file

File diff suppressed because it is too large Load Diff

133
src/dpchaos.h Normal file
View File

@ -0,0 +1,133 @@
/* DPCHAOS.H - Definitions for CHAOS process
*/
/* Copyright © 2005 Björn Victor and Kenneth L. Harrenstien
** All Rights Reserved
**
** This file may become part of the KLH10 Distribution. Use, modification, and
** re-distribution is permitted subject to the terms in the file
** named "LICENSE", which contains the full text of the legal notices
** and should always accompany this Distribution.
**
** This software is provided "AS IS" with NO WARRANTY OF ANY KIND.
**
** This notice (including the copyright and warranty disclaimer)
** must be included in all copies or derivations of this software.
*/
#ifndef DPCHAOS_INCLUDED
#define DPCHAOS_INCLUDED 1
#ifndef DPSUP_INCLUDED
# include "dpsup.h"
#endif
#ifndef OSDNET_INCLUDED
# include "osdnet.h"
#endif
/* Version of DPCHAOS-specific shared memory structure */
#define DPCHAOS_VERSION DPC_VERSION(2,0,0) /* 2.0.0 */
#define IFNAM_LEN PATH_MAX /* at least IFNAMSIZ! */
#ifndef DPCHAOS_CHIP_MAX
# define DPCHAOS_CHIP_MAX 10
#endif
/* Chaos ARP list */
// @@@@ implement something to show the table
#define CHARP_MAX 16
#define CHARP_MAX_AGE (60*5) // ARP cache limit
struct charp_ent {
u_char charp_eaddr[ETHER_ADDR_LEN];
u_short charp_chaddr;
time_t charp_age;
};
/* If a dynamically added CHIP entry is older than this (seconds), it can get updated */
#ifndef DPCHAOS_CHIP_DYNAMIC_AGE_LIMIT
# define DPCHAOS_CHIP_DYNAMIC_AGE_LIMIT (60*5)
#endif
/* Chaos/IP mapping entry - see ch_chip */
struct dpchaos_chip {
unsigned int dpchaos_chip_chaddr; /* Chaos address */
struct in_addr dpchaos_chip_ipaddr; /* IP address */
in_port_t dpchaos_chip_ipport; /* IP port */
time_t dpchaos_chip_lastrcvd; /* When last received, if dynamically added */
};
/* DPCHAOS-specific stuff */
/* C = controlling parent sets, D = Device proc sets */
/* If both, 1st letter indicates inital setter */
struct dpchaos_s {
struct dpc_s dpchaos_dpc; /* CD Standard DPC portion */
int dpchaos_ver; /* C Version of shared struct */
int dpchaos_attrs; /* C Attribute flags */
char dpchaos_ifnam[IFNAM_LEN]; /* CD Interface name if any */
char dpchaos_ifmeth[16]; /* C Interface method */
int dpchaos_ifmeth_chudp; /* C Interface method is CHUDP? */
unsigned short dpchaos_myaddr; /* C my Chaos address */
unsigned char dpchaos_eth[6]; /* CD Ethernet address of interface */
/* probably not used */
int dpchaos_inoff; /* C Offset in buffer of input (I->H) data */
int dpchaos_outoff; /* D Offset in buffer of output (H->I) data */
int dpchaos_backlog; /* C Max sys backlog of rcvd packets */
int dpchaos_dedic; /* C TRUE if dedicated ifc, else shared */
in_port_t dpchaos_port; /* C port for CHUDP protocol */
/* Chaos/IP mapping */
int dpchaos_chip_tlen; /* C table length */
struct dpchaos_chip dpchaos_chip_tbl[DPCHAOS_CHIP_MAX];
// ARP table
struct charp_ent charp_list[CHARP_MAX]; /* D arp table */
int charp_len; /* D arp table length */
};
/* Buffer offset:
CHUDP protocol header is 4 bytes; read/write data after those
*/
struct chudp_header {
char chudp_version;
char chudp_function;
char chudp_arg1;
char chudp_arg2;
};
/* CHUDP protocol port - should perhaps be registered? */
#define CHUDP_PORT 42042
/* Protocol version */
#define CHUDP_VERSION 1
/* Protocol function codes */
#define CHUDP_PKT 1 /* Chaosnet packet */
#ifndef ETHERTYPE_CHAOS
# define ETHERTYPE_CHAOS 0x0804
#endif
// old names for new, new names for old?
#ifndef ARPOP_RREQUEST
#define ARPOP_RREQUEST ARPOP_REVREQUEST // 3 /* request protocol address given hardware */
#endif
#ifndef ARPOP_RREPLY
#define ARPOP_RREPLY ARPOP_REVREPLY // 4 /* response giving protocol address */
#endif
#include "dvch11.h"
#define DPCHAOS_CHUDP_DATAOFFSET (sizeof(struct chudp_header)) // 4 bytes
#define DPCHAOS_ETHER_DATAOFFSET (sizeof(struct ether_header)) // 6+6+2=16 bytes
// room for protocol header + Chaos header + max Chaos data + Chaos hw trailer
#define DPCHAOS_MAXLEN (DPCHAOS_ETHER_DATAOFFSET+CHAOS_HEADERSIZE+CHAOS_MAXDATA+CHAOS_HW_TRAILERSIZE+42) /* some slack */
#define DPCHAOS_CH_DESTOFF 4 /* offset to dest addr in chaos pkt */
#define DPCHAOS_CH_FC 2 /* offset to forwarding count */
/* Commands to and from DP and KLH10 CH11 driver */
/* From 10 to DP */
#define DPCHAOS_RESET 0 /* Reset DP */
#define DPCHAOS_SPKT 1 /* Send data packet to ethernet */
/* From DP to 10 */
#define DPCHAOS_INIT 1 /* DP->10 Finished init */
#define DPCHAOS_RPKT 2 /* DP->10 Received data packet from net */
#endif /* ifndef DPCHUDP_INCLUDED */

View File

@ -208,14 +208,14 @@ default for every OS that implements /dev/tun.
*/
#include "klh10.h" /* Get config params */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <stdarg.h>
#include "klh10.h" /* Get config params */
/* This must precede any other OSD includes to ensure that DECOSF gets
the right flavor sockaddr (sigh)
*/
@ -322,6 +322,7 @@ void ether_write(struct eth_header *, unsigned char *, int);
void ihl_frag(int, unsigned char *);
void ihl_hhsend(struct dpimp_s *, int, unsigned char *);
static void ihl_hhsend_nop(struct dpimp_s *dpimp);
void dumppkt(unsigned char *, int);
/* Error and diagnostic output */
@ -637,7 +638,7 @@ void
net_init(struct dpimp_s *dpimp)
{
struct ifreq ifr;
char *ifnam_for_ipaddr; /* which interface to ask IP addr/netmask */
char *ifnam_for_ipaddr = NULL;/* which interface to ask IP addr/netmask */
if (osn_iftab_init() <= 0)
esfatal(0, "Couldn't find interface information");
@ -824,7 +825,6 @@ struct bpf_program *
pfbuild(void *arg, struct in_addr *ipa)
{
struct dpimp_s *dpimp = (struct dpimp_s *)arg;
unsigned char *ucp = (unsigned char *)ipa;
struct bpf_program *pfp = &bpf_pfilter;
struct bpf_insn *p;
@ -1183,12 +1183,11 @@ arp_req(struct in_addr *ipa)
static int ethbuild = 0, arpbuild = 0;
static struct eth_header eh;
static struct offset_ether_arp arp;
struct arpent *at;
struct ether_addr ea;
/* Store request in cache */
memset((char *)&ea, 0, sizeof(ea));
at = arp_tnew(*ipa, &ea, 0); /* Say incomplete with 0 flag */
arp_tnew(*ipa, &ea, 0); /* Say incomplete with 0 flag */
/* Build ethernet header if haven't already */
if (!ethbuild) {
@ -1208,7 +1207,7 @@ arp_req(struct in_addr *ipa)
arp.arp.arp_op = htons(ARPOP_REQUEST); /* Type REQUEST */
ea_set(arp.arp.arp_sha, &ihost_ea); /* Sender hdw addr */
memcpy((char *)arp.arp.arp_spa, /* Sender IP addr */
(char *)&ihost_ip, sizeof(arp.arp.arp_sha));
(char *)&ihost_ip, sizeof(arp.arp.arp_spa));
arpbuild = TRUE;
}
@ -1419,6 +1418,11 @@ imptohost(struct dpimp_s *dpimp)
ether_hdr_offset = ETHER_HDRSIZ;
}
// wait here for first NOP received
dp_xswait(dpx);
// then send a NOP reply to host
ihl_hhsend_nop(dpimp);
for (;;) {
/* Make sure that buffer is free before clobbering it */
dp_xswait(dpx); /* Wait until buff free */
@ -1542,6 +1546,57 @@ unsigned char ihobuf[SIH_HSIZ+SI_LDRSIZ] = {
};
static void
ihl_hhsend_nop(struct dpimp_s *dpimp)
/* Send NOP response to host */
{
struct dpx_s *dpx = dp_dpxfr(&dp);
size_t off, max;
unsigned int m;
int cnt, nmsiz = 0;
unsigned char *ea = (unsigned char *)&ehost_ip;
unsigned char *buff = dp_xsbuff(dpx, &max); /* get initial buffer ptr */
dp_xswait(dpx); /* wait until buff free */
off = 0; // hmm
memset(buff, 0, SIH_HSIZ+SI_LDRSIZ);
// fill buff with NOP leader with IP info
buff[SIH_HSIZ+SIL_FMT] = 017; // format
// could use SIL_HTY which is next to the rest, but this is easy to test IMP in ITS.
buff[SIH_HSIZ+SIL_NET] = ea[0]; // network, "currently set to zero"
buff[SIH_HSIZ+SIL_TYP] = SIMT_NOP; // message type
// source host and imp
buff[SIH_HSIZ+SIL_HST] = ea[1];
buff[SIH_HSIZ+SIL_IMP1] = ea[2];
buff[SIH_HSIZ+SIL_IMP0] = ea[3];
if (ihost_nm.s_addr == 0)
// the netmask for tun really shouldn't matter.
nmsiz = 24;
else {
// calculate netmask size - is there a cleverer way?
m = ihost_nm.s_addr;
if (m != 0) {
while ((m & 1) == 0) m >>= 1;
}
while (((m & 1) == 1) && (nmsiz < 32)) {
nmsiz++;
m >>= 1;
}
}
// abuse these bits which are not used by NOP normally (handling type)
buff[SIH_HSIZ+SIL_HTY] = nmsiz;
if (DBGFLG)
fprintf(stderr,"IMP: sending NOP (ehost %#x, imask %#x) with address %d.%d.%d.%d and mask size %d\r\n",
ntohl(ehost_ip.s_addr), ntohl(ihost_nm.s_addr),
buff[SIH_HSIZ+SIL_NET], buff[SIH_HSIZ+SIL_HST], buff[SIH_HSIZ+SIL_IMP1], buff[SIH_HSIZ+SIL_IMP0],
buff[SIH_HSIZ+SIL_HTY]);
// send it off
cnt = SIH_HSIZ + SI_LDRSIZ;
dpimp->dpimp_inoff = off;
dp_xsend(dpx, DPIMP_RPKT, cnt+off);
if (DBGFLG)
fprintf(stderr, "[dpimp-R: sent NOP RPKT %d+%d]", (int)off, cnt);
}
void
ihl_hhsend(struct dpimp_s *dpimp,
int cnt,
@ -1711,6 +1766,8 @@ hosttoimp(struct dpimp_s *dpimp)
kill(cpupid, swurgsig); /* Wake host (cpu) up */
}
# endif
#else
(void)res;
#endif
break;
@ -1726,6 +1783,10 @@ hosttoimp(struct dpimp_s *dpimp)
/* A real IMP would examine this to see how much padding to
** add onto its leaders. However, ITS never wants any.
*/
if (DBGFLG) fprintf(stderr, "[dpimp-W: NOP]\r\n");
// respond with a NOP including IP address and mask
// #### NOTE: using dpxfr to let imptohost proceed, instead of dvlhdh doing it
dp_xrdone(dp_dpxfr(&dp));
break;
case SIMT_DERR: /* Error in Data (has msg-id) */

View File

@ -93,7 +93,7 @@
/* Version of DPIMP-specific shared memory structure */
#define DPIMP_VERSION ((1<<10) | (1<<5) | (3)) /* 1.1.3 */
#define DPIMP_VERSION ((1<<10) | (1<<5) | (4)) /* 1.1.4 */
#define IFNAM_LEN 16 /* at least IFNAMSIZ! */

View File

@ -144,6 +144,8 @@ The following general situations are possible:
(Unsure yet if Solaris needs this)
*/
#include "klh10.h" /* For config params */
#include <stdio.h>
#include <errno.h>
#include <string.h>
@ -152,8 +154,6 @@ The following general situations are possible:
#include <poll.h> /* For NetBSD mainly */
#include "klh10.h" /* For config params */
/* This must precede any other OSD includes to ensure that DECOSF gets
the right flavor sockaddr (sigh)
*/
@ -440,6 +440,8 @@ main(int argc, char **argv)
#endif
progname = progname_r; /* Reset progname to indicate identity */
ethtoten(dpni); /* Child process handles input from net */
return 1; /* Do not fall through here, ever */
}
progname = progname_w; /* Reset progname to indicate identity */
tentoeth(dpni); /* Parent process handles output to net */
@ -463,12 +465,12 @@ void net_init(struct dpni20_s *dpni)
/* Get the IP address for the tunnel, if specified */
memcpy((char *)&tun_ip, (char *)&dpni->dpni_tun, 4);
/* Ensure network device name, if specified, isn't too long */
if (dpni->dpni_ifnam[0] && (strlen(dpni->dpni_ifnam)
>= sizeof(ifr.ifr_name))) {
esfatal(0, "interface name \"%s\" too long - max %d",
dpni->dpni_ifnam, (int)sizeof(ifr.ifr_name));
}
/* We should ensure that network device name, if specified, isn't too long.
** For some usages however, this isn't really a device name,
** so we can't really check it here.
** In the paths where a shorter limit holds, there should be a specific
** extra check for sizeof(ifr.ifr_name), IFNAMSIZ, or equivalent.
**/
/* Determine network device to use, if none was specified (this only
** works for shared devices, as dedicated ones will be "down" and
@ -1363,6 +1365,7 @@ void tentoeth(struct dpni20_s *dpni)
break;
case DPNI_QUIT:
/* Attempt to quit the device process gracefully */
if (DBGFLG)
dbprint("QUIT");
return;

View File

@ -34,8 +34,8 @@
/* Version of DPNI20-specific shared memory structure */
#define DPNI20_VERSION DPC_VERSION(1,1,2) /* 1.1.2 */
#define IFNAM_LEN 16 /* at least IFNAMSIZ! */
#define DPNI20_VERSION DPC_VERSION(1,1,3) /* 1.1.3 */
#define IFNAM_LEN PATH_MAX /* at least IFNAMSIZ! */
/* DPNI20-specific stuff */
/* C = controlling parent sets, D = Device proc sets */

View File

@ -39,13 +39,14 @@ size, and configuration.
*/
#include "klh10.h" /* For config params */
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h> /* For malloc */
#include <stdarg.h>
#include "klh10.h" /* For config params */
#include "word10.h"
#include "dpsup.h" /* General DP defs */
#include "dprpxx.h" /* RPXX specific defs */

View File

@ -207,14 +207,14 @@ So, algorithm (on DECOSF anyway) should be:
should remain HARDON.
*/
#include "klh10.h" /* For config params */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <stdarg.h>
#include "klh10.h" /* For config params */
#if CENV_SYS_UNIX
# include <unistd.h>
# include <sys/types.h>

File diff suppressed because it is too large Load Diff

View File

@ -37,11 +37,11 @@ extern struct device *dvch11_init(FILE *, char *);
/* CH11 addresses & assignments for KS10:
CH11 Address Vector UBA# BR-Level
#1 0764140 0270 3 4 or 5 (dunno which)
#1 0764140 0270 3 4 or 5 (dunno which) [6, according to CHXCHN in ITS]
etc(?) (some) 0230
*/
#define UB_CH11_BR 5
#define UB_CH11_BR 6 /* See CHXCHN in ITS */
#define UB_CH11_VEC 0270 /* CH11 Interrupt Vector */
#define UB_CH11 0764140 /* CH11 Unibus Address (on UBA #3) */
@ -107,4 +107,9 @@ extern struct device *dvch11_init(FILE *, char *);
#define UB_CH11END (UB_CHXMT+2) /* First addr not used by CH11 regs */
#define CHAOS_HW_TRAILERSIZE (6) /* "hw" trailer bytes */
#define CHAOS_HEADERSIZE (4*4) /* chaos packet header size */
#define CHAOS_MAXDATA 488 /* Max data bytes per packet #### incl header? */
#endif /* ifndef DVCH11_INCLUDED */

100
src/dvch11.txt Normal file
View File

@ -0,0 +1,100 @@
================================
CHAOS is restored!
or
CH11 support for ITS in KLH10
================================
The ch11 device in KLH10 for ITS, which was originally just a dummy
inteface to keep ITS running, is now a functional Unibus Chaosnet
device, which supports Chaosnet-on-Ethernet and Chaosnet-over-UDP.
It does not support SPY (promiscuous) mode, or LUP (loopback), but ITS
doesn't seem to use/need these.
Latest update: 2021-02-23
Like other KLH10 network devices, ch11 works together with a Device
Process which communicates with the device and reads/writes network
data. It can do it in two ways:
Firstly, by implementing Chaosnet over Ethernet (protocol nr 0x0804) and handling
ARP for that protocol (cf RFC 826). This uses one of the packet filtering
implementations (currently only pcap) provided by osdnet. (Only Ethernet II
headers are supported, not 802.3.)
No routing is handled, that's done by ITS - this code uses the
Chaosnet trailer provided by ITS to decide where to send pkts.
(On Ethernet, no Chaosnet trailer is included.)
Secondly, it can do it by using a Chaos-over-UDP tunnel. A 4-byte
protocol header is added, with only one defined function code yet
(sending a Chaos packet). The "original" Chaos trailer (destination,
source, and checksum) is also added.
The protocol, CHUDP, by default uses UDP port 42042, but this can be
configured in case, e.g., that port doesn't pass through your
firewall.
Configuration parameters:
The basic configuration parameters:
devdef chaos ub3 ch11 addr=764140 br=6 vec=270
ITS seems to think the "br" param should be 6, not 5 as used in the
old dummy device definition (see CHXCHN in ITS).
More parameters:
myaddr=oooo
defines the octal Chaosnet address of the interface.
This needs to match the address configured in ITS (see MYCHAD
in SYSTEM;CONFIG >)
ifmeth=meth
where meth is "chudp" or "pcap", selects the link
implementation to use (Chaos-over-UDP or Chaos-on-Ethernet).
For "chudp":
chudpport=dddddd
sets the local UDP port to use for Chaos-over-UDP. The default is 42042.
chip=oooo/hhhhhhhh
defines a remote Chaos-over-UDP host with the octal Chaos address oooo,
and the IPv4 address or hostname hhhhhhhh. If a hostname is
used, the first IPv4 address returned is used. (Rather than
listing all your friends' ITS hosts directly, I suggest joining the
Global Chaosnet and just list its central router. See
https://chaosnet.net.)
If chudpport or chip parameters are given, the ifmeth defaults to chudp,
otherwise to pcap.
If a CHUDP packet is received from an unknown host, a Chaos/IP mapping
is dynamically added to the table, so return traffic can find its way.
This is useful e.g. if you accept connections from other ITSes without
static IP addresses. (You can avoid this feature, and potentially
filling your table, by using a firewall.)
To make use of the interface, you need to recompile ITS after defining
CHAOSP, MYCHAD, NINDX, and CH11P in SYSTEM;CONFIG (and following the
instructions in distrib.its, of course). See also BEWARE note below.
Don't forget to compile SYSENG;@CHAOS and install as DEVICE;ATSIGN
CHAOS. Don't forget to keep names of your friends' ITSes in
SYSEN2;MLDEV, SYSENG;@DEV, etc.
*BEWARE*:
If you have both CHAOSP and IMPP, you run into a bug which results in
all non-local IP packets being routed via Chaosnet... (unfortunately
noone is listenting at Chaos address 3040).
The bug is caused by the IPMASK macro defined and used in
SYSTEM;CONFIG, which results in the netmask NM%CHA being zero, which
matches anything. The easy fix is to change the line
IFN CHAOSP,DEFOPT NM%CHA==<IPMASK IMPUS4> ; Set default netmask for it
to
IFN CHAOSP,DEFOPT NM%CHA==<IPADDR 255,255,0,0> ; Set default netmask for it
but the real fix would be to the IPMASK macro.
----------------
See https://chaosnet.net for much much more information, and
https://github.com/bictorv/chaosnet-bridge for a bridging/routing
program for Chaosnet.
Cheers,
Bjorn Victor (bjorn@victor.se)

View File

@ -25,9 +25,10 @@
*
*/
#include "klh10.h"
#include <stdio.h>
#include "klh10.h"
#include "kn10def.h"
#include "kn10ops.h"
#include "fecmd.h"
@ -182,15 +183,15 @@ cty_sin(int cnt)
register vmptr_t vp;
register int ch, oldch;
if ((ch = fe_ctyin()) < 0) /* Get single char */
return 0; /* None left */
vp = vm_physmap(FECOM_CTYIN);
oldch = vm_pgetrh(vp); /* See if ready for next char */
if (oldch & 0400)
fprintf(stderr, "[CTYI: %o => %o, old %o]",
ch, ch | 0400, oldch);
else if (cpu.fe.fe_ctydebug)
return cnt;
if ((ch = fe_ctyin()) < 0) /* Get single char */
return 0; /* None left */
if (cpu.fe.fe_ctydebug)
fprintf(stderr, "[CTYI: %o]", ch);
/* Drop char in FE communication area */

View File

@ -401,6 +401,27 @@ lhdh_conf(FILE *f, char *s, struct lhdh *lh)
return FALSE;
}
// Default the interface method based on arguments given
if (lh->lh_ifmeth == NULL) {
if (lh->lh_tunadr[0] != '\0') {
fprintf(f, "IMP assuming \"tun\" interface method since \"tunaddr\" parameter given\n");
lh->lh_ifmeth = s_dup("tun");
}
else if (lh->lh_gwadr[0] != '\0') {
fprintf(f, "IMP assuming \"pcap\" interface method since \"gwaddr\" parameter given\n");
lh->lh_ifmeth = s_dup("pcap");
}
}
// The check for consistency
if ((lh->lh_gwadr[0] != '\0') && strcmp(lh->lh_ifmeth,"pcap") != 0) {
fprintf(f, "%%%% IMP: \"gwaddr\" parameter is only used with \"pcap\" interface method\n");
return FALSE;
}
else if ((lh->lh_tunadr[0] != '\0') && strcmp(lh->lh_ifmeth,"pcap") == 0) {
fprintf(f, "%%%% IMP: \"tunaddr\" parameter is not used with \"pcap\" interface method\n");
return FALSE;
}
return ret;
}
@ -1074,7 +1095,7 @@ imp_init(register struct lhdh *lh, FILE *of)
if (lh->lh_ifmeth) /* Pass on interface method if any */
strncpy(dpc->dpimp_ifmeth, lh->lh_ifmeth, sizeof(dpc->dpimp_ifmeth)-1);
else
dpc->dpimp_ifnam[0] = '\0'; /* No specific interface */
dpc->dpimp_ifmeth[0] = '\0'; /* No specific method */
memcpy((char *)dpc->dpimp_ip, /* Set our IP address for filter */
lh->lh_ipadr, 4);
memcpy((char *)dpc->dpimp_gw, /* Set our GW address for IMP */
@ -1293,7 +1314,9 @@ imp_incheck(register struct lhdh *lh)
switch (dp_xrcmd(dpx)) {
case DPIMP_INIT:
/* Do stuff to turn on IMP ready line? */
#if 0 // #### NOTE: let hosttoimp do this when the first NOP arrives
dp_xrdone(dpx); /* ACK it */
#endif
return 0; /* No actual input */
case DPIMP_RPKT: /* Input packet ready! */

View File

@ -22,6 +22,9 @@
#include "klh10.h"
#include <stdio.h>
#include <string.h>
#if !KLH10_DEV_LITES && CENV_SYS_DECOSF
/* Stupid gubbish needed to prevent OSF/1 AXP compiler from
** halting merely because compiled file is empty!
@ -31,7 +34,19 @@ static int decosfcclossage;
#if KLH10_DEV_LITES /* Moby conditional for entire file */
#if HAVE_LIBUSB_1_0
#include <libusb.h>
#endif
/*
* For now, assume that having <sys/io.h> is equivalent to having
* outb(). That may not be exactly true but it's the code we have.
*/
#ifdef HAVE_SYS_IO_H
#include <sys/io.h>
#else
static inline int ioperm(int a, int b, int c) { return -1; }
static inline void outb(int a, int b) {}
#endif
#include "dvlites.h"
@ -171,8 +186,110 @@ static const unsigned char control[8] = {
static int port = 0; /* parallel port, normally LPT1 (0x378) */
static int unit = -1; /* currently selected unit */
static libusb_device_handle *lights_handle = NULL;
static unsigned int lights_left = 0;
static unsigned int lights_right = 0;
static int lights_aux = 0;
#define USB_CFG_VENDOR_ID 0xc0, 0x16
#define USB_CFG_DEVICE_ID 0xdf, 0x05
#define USB_CFG_DEVICE_NAME 'P','a','n','d','a',' ','D','i','s','p','l','a','y',
#define USB_CFG_DEVICE_NAME_LEN 13
static libusb_device_handle *get_panda_handle(libusb_device **devs)
{
libusb_device *dev;
libusb_device_handle *handle = NULL;
int i = 0;
int r;
int found = 0;
int openable = 0;
unsigned char prod[256];
char devname[USB_CFG_DEVICE_NAME_LEN] = {USB_CFG_DEVICE_NAME};
unsigned char rawVid[2] = {USB_CFG_VENDOR_ID};
unsigned char rawPid[2] = {USB_CFG_DEVICE_ID};
int vid = rawVid[0] + 256 * rawVid[1];
int pid = rawPid[0] + 256 * rawPid[1];
while ((dev = devs[i++]) != NULL) {
struct libusb_device_descriptor desc;
libusb_get_device_descriptor(dev, &desc); /* this always succeeds */
// Do the VID and PID match?
if (desc.idVendor == vid && desc.idProduct == pid) {
found = 1;
r = libusb_open(dev, &handle);
// If we can't open it, keep trying.
// There may be a device with the same pid and vid but not a Panda Display
if (r < 0) {
continue;
}
openable = 1;
r = libusb_get_string_descriptor_ascii(handle, desc.iProduct, prod, sizeof prod);
if (r < 0) {
libusb_close(handle);
return NULL;
}
// Here we have something that matches the free
// VID and PID offered by Objective Development.
// Now we need to Check device name to see if it
// really is a Panda Display.
if ((0 == strncmp((char *)prod, devname, USB_CFG_DEVICE_NAME_LEN)) &&
(desc.idVendor == vid) &&
(desc.idProduct == pid)) {
return handle;
}
libusb_close(handle);
}
}
if (found) {
if (openable)
fprintf (stderr, "Found USB device matching 16c0:05df, but it isn't a Panda Display\n");
else
fprintf (stderr, "Found something that might be a Panda Display, but couldn't open it.\n");
}
return NULL;
}
static int lites_init_usb (void)
{
libusb_device **devs;
libusb_context *ctx = NULL;
ssize_t cnt;
int r, i, pos;
if (lights_handle != NULL)
return 1;
r = libusb_init(&ctx);
if (r < 0)
return 0;
cnt = libusb_get_device_list(ctx, &devs);
if (cnt < 0)
return 0;
lights_handle = get_panda_handle(devs);
if (lights_handle == NULL)
return 0;
if (libusb_kernel_driver_active(lights_handle, 0) == 1)
libusb_detach_kernel_driver(lights_handle, 0);
r = libusb_claim_interface(lights_handle, 0);
if(r < 0)
return 0;
return 1;
}
/* One-time initialization
* Accepts: port base register
* Returns: T if success, NIL if failure
@ -182,8 +299,11 @@ int lites_init (unsigned int prt)
{
int ret;
unsigned int i;
if (prt == 0)
return lites_init_usb ();
/* enable access to the port */
if (ret = !ioperm (prt,PORT_MAX,ENABLE)) {
if ((ret = !ioperm (prt,PORT_MAX,ENABLE))) {
port = prt; /* access granted, note port */
outb (0,port+PORT_CONTROL); /* initialize the displays */
for (i = 0; i <= UNIT_MAX; --i) {
@ -277,6 +397,34 @@ static void lites_wreg (unsigned char reg,unsigned char data)
outb (control[reg],port + PORT_CONTROL);
}
}
static void lights_latch (void)
{
unsigned char buffer[8];
if (lights_handle == NULL)
return;
buffer[0] = (lights_left >> 14) & 0037;
buffer[1] = (lights_left >> 6) & 0377;
buffer[2] = (lights_left << 2) & 0374;
buffer[2] |= (lights_right >> 16) & 0003;
buffer[3] = (lights_right >> 8) & 0377;
buffer[4] = lights_right & 0377;
buffer[5] = (lights_aux << 4) & 0340;
buffer[6] = 0;
buffer[7] = 0;
libusb_control_transfer(lights_handle,
LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT,
LIBUSB_REQUEST_SET_CONFIGURATION,
0x0000,
0,
buffer,
sizeof buffer,
5000);
}
/* Routines specific to the primary display lights */
@ -291,6 +439,14 @@ static unsigned char byte0 = 0; /* save of aux bits and high 4 pgm lites */
void lights_pgmlites (unsigned long lh,unsigned long rh)
{
unsigned char data[5];
if (lights_handle) {
lights_left = lh;
lights_right = rh;
lights_latch ();
return;
}
lites_setdisplay (UNIT_PGM); /* select program display lights unit */
/* calculate MSB with aux bits */
byte0 = data[0] = ((lh >> 14) & 0xf) | (byte0 & 0xe0);

View File

@ -55,6 +55,7 @@ static int decosfcclossage;
#include "kn10dev.h"
#include "kn10ops.h"
#include "dvni20.h"
#include "cmdline.h"
#include "prmstr.h" /* For parameter parsing */
#if KLH10_DEV_DPNI20 /* Event handling and dev sub-proc stuff! */
@ -238,6 +239,7 @@ static w10_t ni20_datai(struct device *d);
static int ni20_init(struct device *d, FILE *of);
static void ni20_reset(struct device *d);
static void ni20_powoff(struct device *d);
static int ni20_cmd(struct device *d, FILE *of, char *cmdline);
#if KLH10_DEV_DPNI20
static void ni20_evhsdon(struct device *d, struct dvevent_s *evp);
static void ni20_evhrwak(struct device *d, struct dvevent_s *evp);
@ -327,22 +329,11 @@ static char *niprmtab[] = {
static int pareth(char *cp, unsigned char *adr);
static int parip(char *cp, unsigned char *adr);
/* NI20_CONF - Parse configuration string and set defaults.
** At this point, device has just been created, but not yet bound
** or initialized.
** NOTE that some strings are dynamically allocated! Someday may want
** to clean them up nicely if config fails or device is uncreated.
/* Set defaults for all configurable parameters
*/
static int
ni20_conf(FILE *f, char *s, struct ni20 *ni)
static void
ni20_conf_clear(struct ni20 *ni)
{
int i, ret = TRUE;
struct prmstate_s prm;
char buff[200];
long lval;
/* First set defaults for all configurable parameters */
DVDEBUG(ni) = FALSE;
ni->ni_ifnam = NULL;
ni->ni_ifmeth = NULL;
@ -363,6 +354,22 @@ ni20_conf(FILE *f, char *s, struct ni20 *ni)
ni->ni_dpidly = 5; /* Conservative 5-second timeout for T10/T20 */
ni->ni_dpdbg = FALSE;
#endif
}
/* NI20_CONF - Parse configuration string and set defaults.
** At this point, device has just been created, but not yet bound
** or initialized.
** NOTE that some strings are dynamically allocated! Someday may want
** to clean them up nicely if config fails or device is uncreated.
*/
static int
ni20_conf(FILE *f, char *s, struct ni20 *ni)
{
int i, ret = TRUE;
struct prmstate_s prm;
char buff[200];
long lval;
prm_init(&prm, buff, sizeof(buff),
s, strlen(s),
@ -620,12 +627,14 @@ dvni20_create(FILE *f, char *s)
ni->ni_dv.dv_coni = ni20_coni;
ni->ni_dv.dv_datao = ni20_datao;
ni->ni_dv.dv_datai = ni20_datai;
ni->ni_dv.dv_cmd = ni20_cmd;
ni->ni_dv.dv_bind = NULL; /* Not a controller!! */
ni->ni_dv.dv_init = ni20_init; /* Set up own post-bind init */
ni->ni_dv.dv_reset = ni20_reset; /* System reset (clear stuff) */
ni->ni_dv.dv_powoff = ni20_powoff; /* Power-off cleanup */
ni20_conf_clear(ni); /* Set all defaults */
if (!ni20_conf(f, s, ni)) /* Do configuration stuff */
return NULL;
@ -769,16 +778,16 @@ ni20_reset(struct device *d)
ni20_clear((struct ni20 *)d);
}
/* NI20_QUIT - Tells the IMP process to quit
/* NI20_QUIT - Tells the DPNI20 process to quit
** and clean up resources such as networking tunnels.
*/
static void
ni20_quit(struct ni20 *ni)
{
struct dpx_s *dpx = &(ni->ni_dp.dp_adr->dpc_frdp);
struct dpx_s *dpx = &(ni->ni_dp.dp_adr->dpc_todp);
/* Make sure we can send the message, or just skip it if not */
if (ni->ni_dpstate) {
if (ni->ni_dpstate && ni->ni_dp.dp_chpid) {
if (DVDEBUG(ni))
fprintf(NIDBF(ni), " [Sending QUIT to NI20]");
@ -788,7 +797,7 @@ ni20_quit(struct ni20 *ni)
}
} else {
if (DVDEBUG(ni))
fprintf(NIDBF(ni), "[No need to send QUIT to NI20]");
fprintf(NIDBF(ni), "[No need to send QUIT to NI20; pid=%d, state=%d]", ni->ni_dp.dp_chpid, ni->ni_dpstate);
}
}
@ -3442,6 +3451,172 @@ ni20_ioend(register struct device *drv,
/* Now if no errors, check for secondary TCR and initiate it? */
}
#endif /* 0 */
/*
** "dev ni0 xxx" subcommands
*/
struct cmd_ni20_s {
struct cmd_s ni20_cmd;
struct ni20 *ni20_dev;
FILE *ni20_of;
};
CMDDEF(cd_ques, fc_ques, CMRF_NOARG, NULL,
"How to get help for the DEV NIx subcommand", "")
CMDDEF(cd_help, fc_help, CMRF_TOKS, NULL,
"Basic help for the DEV NIx subcommands", "")
CMDDEF(cd_init, fc_init, CMRF_NOARG, NULL,
"Initialize the NI20 unit", "")
CMDDEF(cd_start, fc_start, CMRF_NOARG, NULL,
"Start the NI20 unit", "")
CMDDEF(cd_stop, fc_stop, CMRF_NOARG, NULL,
"Stop the NI20 unit", "")
CMDDEF(cd_powoff,fc_powoff, CMRF_NOARG, NULL,
"Power the NI20 unit off", "")
CMDDEF(cd_set, fc_set, CMRF_TLIN, NULL,
"Dynamically change config settings (not all will work!)", "")
#if KLH10_DEV_DPNI20
CMDDEF(cd_dpquit,fc_dpquit, CMRF_NOARG, NULL,
"Tell the Device Proc to quit", "")
CMDDEF(cd_dpstart,fc_dpstart,CMRF_NOARG, NULL,
"Start the Device Process for the NI20 unit", "")
#endif /* KLH10_DEV_DPNI20 */
KEYSBEGIN(ni20keys)
KEYDEF("?", cd_ques)
KEYDEF("help", cd_help)
KEYDEF("init", cd_init)
KEYDEF("start", cd_start)
KEYDEF("stop", cd_stop)
KEYDEF("powoff", cd_powoff)
KEYDEF("set", cd_set)
#if KLH10_DEV_DPNI20
KEYDEF("dpstart", cd_dpstart)
KEYDEF("dpquit", cd_dpquit)
#endif /* KLH10_DEV_DPNI20 */
KEYSEND
static int
ni20_cmd(struct device *d, FILE *of, char *cmdline)
{
static struct cmd_ni20_s ni20_command;
static char cmdbuf[CMDBUFLEN]; /* Original command string buffer */
ni20_command.ni20_dev = (struct ni20 *)d;
ni20_command.ni20_of = of;
cmdinit(&ni20_command.ni20_cmd, ni20keys, "NI20> ",
cmdbuf, sizeof(cmdbuf));
cmdlcopy(&ni20_command.ni20_cmd, cmdline);
cmdexec(&ni20_command.ni20_cmd);
}
static void
fc_ques(struct cmd_s *cm)
{
fc_gques(cm);
}
static void
fc_help(struct cmd_s *cm)
{
fc_ghelp(cm);
}
static void
fc_init(struct cmd_s *cm0)
{
struct cmd_ni20_s *cm = (struct cmd_ni20_s *)cm0;
ni20_init(&cm->ni20_dev->ni_dv, cm->ni20_of);
}
static void
fc_start(struct cmd_s *cm0)
{
struct cmd_ni20_s *cm = (struct cmd_ni20_s *)cm0;
ni20_start(cm->ni20_dev);
}
static void
fc_stop(struct cmd_s *cm0)
{
struct cmd_ni20_s *cm = (struct cmd_ni20_s *)cm0;
ni20_stop(cm->ni20_dev);
}
static void
fc_powoff(struct cmd_s *cm0)
{
struct cmd_ni20_s *cm = (struct cmd_ni20_s *)cm0;
ni20_powoff(&cm->ni20_dev->ni_dv);
}
static void
fc_set(struct cmd_s *cm0)
{
struct cmd_ni20_s *cm = (struct cmd_ni20_s *)cm0;
ni20_conf(cm->ni20_of, cm0->cmd_arglin, cm->ni20_dev);
}
#if KLH10_DEV_DPNI20
static void
fc_dpstart(struct cmd_s *cm0)
{
struct cmd_ni20_s *cm = (struct cmd_ni20_s *)cm0;
struct ni20 *ni = cm->ni20_dev;
FILE *of = cm->ni20_of;
fprintf(of, "[starting DP \"%s\"...", ni->ni_dpname);
/* HORRIBLE UGLY HACK: for AXP OSF/1 and perhaps other systems,
** the virtual-runtime timer of setitimer() remains in effect even
** for the child process of a fork()! To avoid this, we must
** temporarily turn the timer off, then resume it after the fork
** is safely out of the way.
**
** Otherise, the timer would go off and the unexpected signal would
** chop down the DP subproc without any warning!
**
** Later this should be done in DPSUP.C itself, when I can figure a
** good way to tell whether the code is part of the KLH10 or a DP
** subproc.
*/
clk_suspend(); /* Clear internal clock if one */
int res = dp_start(&ni->ni_dp, ni->ni_dpname);
clk_resume(); /* Resume internal clock if one */
if (!res) {
fprintf(of, " Start of DP \"%s\" failed!]\r\n",
ni->ni_dpname);
} else {
fprintf(of, " started!]\r\n");
}
/* Set state to "running", assume disabled.
*/
ni->ni_state = NI20_ST_RUN; /* Running disabled */
ni->ni_dpstate = TRUE; /* Not quite matching other uses,
* but required for dpquit() */
}
static void
fc_dpquit(struct cmd_s *cm0)
{
struct cmd_ni20_s *cm = (struct cmd_ni20_s *)cm0;
ni20_quit(cm->ni20_dev);
}
#endif /* KLH10_DEV_DPNI20 */
/* Massbus Data Channel routines.
**

View File

@ -287,8 +287,8 @@ rp_conf(FILE *f, char *s, struct rpdev *rp)
rp->rp_iswrite = TRUE;
partyp(rp, DVRP_DEFAULT_DISK); /* Default disk config */
RPREG(rp, RHR_SN) = /* Serial Number register (BCD) */
(((1 / 1000)%10) << 12)
| (((6 / 100)%10) << 8)
(((1600 / 1000)%10) << 12)
| (((1600 / 100)%10) << 8)
| (((nrps / 10)%10) << 4)
| (((nrps )%10) );
rp->rp_bufsec = 4; /* # sectors in buffer */

View File

@ -239,7 +239,8 @@ static void tm_attn(struct tmdev *tm);
static void tm_ssint(struct tmdev *tm);
static void tm_space(struct tmdev *tm, int revf);
static int tm_io(struct tmdev *tm, int dirf);
static void tm_ssel(struct tmdev *tm), tm_ssta(struct tmdev *tm);
static void tm_ssel(struct tmdev *tm);
static void tm_ssta(struct tmdev *tm);
static int tm_filbuf(struct tmdev *tm);
static int tm_flsbuf(struct tmdev *tm, int revf);
static void tm_showbuf(struct tmdev *tm,
@ -299,8 +300,8 @@ tm03_conf(FILE *f, char *s, struct tmdev *tm)
tm->tm_typ = TM_DTTM03; /* Say formatter is TM03 for now */
tm->tm_styp = TM_DT45; /* Say slave is TU45 for now */
TMREG(tm, RHR_SN) = /* Serial Number register (BCD) */
(((9 / 1000)%10) << 12)
| (((9 / 100)%10) << 8)
(((9900 / 1000)%10) << 12)
| (((9900 / 100)%10) << 8)
| (((ntms / 10)%10) << 4)
| (((ntms )%10) );
#if KLH10_DEV_DPTM03
@ -1668,9 +1669,15 @@ tm_cmddon(register struct tmdev *tm)
** Use the dp status, rather than the register, in case the OS
** happens to have another slave selected, as TOPS-20 will initially.
*/
#if KLH10_DEV_DPTM03
int mounted = tm->tm_sdptm->dptm_mol;
#else
int mounted = vmt_ismounted(&(tm->tm_vmt)); /* Get state */
#endif /* KLH10_DEV_DPTM03 */
fprintf(DVDBF(tm), "[%s: Tape %s]\r\n",
tm->tm_dv.dv_name,
(tm->tm_sdptm->dptm_mol) ? "online" : "offline");
mounted ? "online" : "offline");
}
TMREG(tm, RHR_STS) |= TM_SSSC; /* Set SSC - slave changed state */
tm_attn(tm);

View File

@ -50,13 +50,14 @@
+AB:0:0:2:0:0
*/
#include "cenv.h"
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "cenv.h"
#include "rcsid.h"
#include "osdnet.h"

View File

@ -25,6 +25,8 @@
*
*/
#include "klh10.h"
#include <stdio.h>
#include <stdlib.h> /* Malloc and friends */
#include <string.h>
@ -34,7 +36,6 @@
#include <time.h>
#include <stdarg.h> /* For error-reporting functions */
#include "klh10.h"
#include "kn10mac.h" /* FLD macros */
#include "kn10def.h"
#include "kn10dev.h"

View File

@ -25,6 +25,8 @@
/* Loads executables into physical memory.
*/
#include "cenv.h"
#include <stdio.h>
#include <stdlib.h> /* Malloc and friends */
#include <string.h>

View File

@ -28,8 +28,8 @@
/* See CODING.TXT for guidelines to coding instruction routines. */
#include <stddef.h>
#include "klh10.h"
#include <stddef.h>
#include "kn10def.h" /* Machine defs */
#include "kn10ops.h" /* PDP-10 ops */
@ -261,7 +261,9 @@ insdef(i_extend)
#elif KLH10_CPU_KS
# if (IX_N == 040 || IX_N == 020) /* Faster check if power of 2 */
if (LHGET(xw) & (((~(IX_N-1))<<9) | (AC_MASK<<5))) /* Check op and AC fields */
# define IX_MASK ((~(unsigned int)(IX_N-1))<<9)
if (LHGET(xw) & (IX_MASK | (AC_MASK<<5))) /* Check op and AC fields */
# undef IX_MASK
# else
if (xop >= IX_N || (LHGET(xw) & (AC_MASK<<5))) /* Check op, AC field */
# endif

View File

@ -38,6 +38,8 @@
*
*/
#include "klh10.h"
#include <stdio.h>
#include <stdlib.h> /* Malloc and friends */
#include <string.h>
@ -47,7 +49,6 @@
#include <time.h>
#include <stdarg.h> /* For error-reporting functions */
#include "klh10.h"
#include "kn10mac.h" /* FLD macros */
#include "kn10def.h"
#include "kn10dev.h"
@ -56,6 +57,7 @@
#include "wfio.h"
#include "fecmd.h"
#include "feload.h"
#include "cmdline.h"
#include "prmstr.h"
#include "dvcty.h" /* For cty_ functions */
@ -151,87 +153,15 @@ static int cminchar(void); /* Funct to read from file or TTY */
#define CMDQCHAR '\\' /* Quote char for token parsing */
#ifndef CMDBUFLEN
# define CMDBUFLEN 512
#endif
#ifndef CMDMAXARG
# define CMDMAXARG 10
#endif
struct cmd_s {
int cmd_flags; /* State flags */
char *cmd_prm; /* Pointer to command prompt */
char *cmd_buf; /* Pointer to start of buffer */
size_t cmd_blen; /* Size of buffer */
int cmd_left; /* # chars left for current cmd being input */
char *cmd_inp; /* Input deposit pointer */
char *cmd_rdp; /* Readout pointer */
size_t cmd_rleft; /* # chars left to read */
/* Provide all command routines with their desired arguments */
char *cmd_arglin; /* Original pointer to start of args on line */
int cmd_argc; /* # of tokens */
char *cmd_argv[CMDMAXARG+1]; /* Array of token pointers */
char *cmd_tdp; /* Next free loc in token buffer */
size_t cmd_tleft; /* # chars free in token buffer */
char cmd_tokbuf[CMDBUFLEN+CMDMAXARG];
#if 0
char *cmd_wbf; /* Pointer to work buffer */
size_t cmd_wblen; /* Size in chars */
char *cmd_wbp; /* Current deposit ptr */
size_t cmd_wbleft; /* # chars left */
#endif
} command;
#define CMDF_ACTIVE 01 /* Activation char seen, execute accumulated cmd */
#define CMDF_INACCUM 02 /* In accumulation phase */
#define CMDF_NOPRM 040 /* Disable prompt */
static char cmdbuf[CMDBUFLEN]; /* Original command string buffer */
#if 0
static char cmdwbf[CMDBUFLEN]; /* Working buffer */
#endif
struct cmkey_s {
char *cmk_key;
union cmnode *cmk_p;
};
struct cmrtn_s {
void (*cmr_vect)(struct cmd_s *); /* Function to call */
int cmr_flgs; /* Misc flags */
char *cmr_synt; /* Arg syntax */
char *cmr_help; /* Short one-line help */
char *cmr_desc; /* Long description */
};
#define CMRF_NOARG 01 /* Command takes no args */
#define CMRF_TOKS 010 /* Command wants whole line tokenized, via cm */
#define CMRF_TLIN 020 /* Command wants overall line arg, via cm */
#define CMRF_CMPTR 040 /* Command wants just cmd state ptr */
union cmnode { /* All possible nodes for a keyword */
struct cmrtn_s cmn_rtn;
};
/* Predeclarations */
void cmdinit(struct cmd_s *, char *, char *, size_t);
int cmdexec(struct cmd_s *);
int cmdaccum(struct cmd_s *);
struct cmkey_s *cmdkeylookup(char *, struct cmkey_s *, struct cmkey_s **);
char *cmdlsetup(struct cmd_s *);
static void slinlim(char *);
/* CMDDEF is used to define top-level commands. It does not accumulate
** them into a table (C is far too puny for that) but gathers together
** various information that a higher-level table can then point to.
*/
#define CMDDEF(deflab, func, flgs, argsyn, minihelp, longdesc) \
static void func(struct cmd_s *); \
static struct cmrtn_s deflab = { func, flgs, argsyn, minihelp, longdesc };
static struct cmd_s command;
CMDDEF(cd_ques, fc_ques, CMRF_NOARG, NULL,
"How to get help", "")
@ -239,6 +169,8 @@ CMDDEF(cd_help, fc_help, CMRF_TOKS, NULL,
"Basic help", "")
CMDDEF(cd_quit, fc_quit, CMRF_NOARG, NULL,
"Quit emulator", "")
CMDDEF(cd_rquit, fc_rquit, CMRF_NOARG, NULL,
"Really quit!", "")
CMDDEF(cd_load, fc_load, CMRF_TOKS, "<file>",
"Load binary into KN10", "")
CMDDEF(cd_dump, fc_dump, CMRF_TOKS, "<file>",
@ -316,20 +248,17 @@ CMDDEF(cd_devwait,fc_devwait, CMRF_TLIN,
"[<devid>] [<secs>]",
"Wait for device (or all devs)", "")
#if KLH10_DEV_LITES
CMDDEF(cd_lights, fc_lights, CMRF_TLIN, "<hexaddr>",
CMDDEF(cd_lights, fc_lights, CMRF_TLIN, "<hexaddr>|usb",
"Set console lights I/O base address", "")
#endif
#define KEYSBEGIN(name) struct cmkey_s name[] = {
#define KEYDEF(key,nod) { key, (union cmnode *)(&nod) },
#define KEYSEND { 0, 0 } };
KEYSBEGIN(fectbkeys)
KEYDEF("?", cd_ques)
KEYDEF("help", cd_help)
KEYDEF("exit", cd_quit)
KEYDEF("quit", cd_quit)
KEYDEF("really-quit", cd_rquit)
KEYDEF("load", cd_load)
KEYDEF("dump", cd_dump)
KEYDEF("go", cd_go)
@ -522,7 +451,7 @@ fe_cmdloop(void)
/* Determine new prompt if necessary */
if (cmdpromptnew || (omode != cpu.fe.fe_mode)) {
cmdinit(&command, fe_cmprompt(cpu.fe.fe_mode),
cmdinit(&command, fectbkeys, fe_cmprompt(cpu.fe.fe_mode),
cmdbuf, sizeof(cmdbuf));
omode = cpu.fe.fe_mode;
prompted = FALSE;
@ -607,6 +536,14 @@ fc_quit(struct cmd_s *cm)
os_exit(0);
}
void
fc_rquit(struct cmd_s *cm)
{
dev_term();
mem_term();
os_exit(0);
}
/* FE_SHUTDOWN - Attempt to bring down PDP-10 OS and quit emulator as
** gracefully as possible *without* any user interaction.
**
@ -825,10 +762,12 @@ static int cmdargs_all(struct cmd_s *cm);
static int cmdargs_n(struct cmd_s *cm, int n);
void cmdinit(struct cmd_s *cm,
struct cmkey_s *keys,
char *prompt,
char *ibuf,
size_t ilen)
{
cm->cmd_keys = keys;
cm->cmd_flags = 0;
cm->cmd_prm = prompt;
cm->cmd_buf = ibuf;
@ -948,7 +887,7 @@ cmdexec(struct cmd_s *cm)
/* Have token, see if it's a command */
stolower(cp); /* Force lowercase for lookup */
argc = s_keylookup(cp, fectbkeys, sizeof(struct cmkey_s),
argc = s_keylookup(cp, cm->cmd_keys, sizeof(struct cmkey_s),
(void *)&key, (void *)&key2);
if (argc <= 0) {
printf("Unknown command: \"%s\"\n", cp);
@ -994,7 +933,10 @@ cmdexec(struct cmd_s *cm)
return 1;
}
/*
** Fetch a command line from the front end console, or from a command
** file.
*/
char *
cmdlsetup(struct cmd_s *cm)
{
@ -1039,6 +981,30 @@ cmdlsetup(struct cmd_s *cm)
return cp;
}
/* CMDLCOPY - Copy a command line into the previously indicated buffer.
*/
char *
cmdlcopy(struct cmd_s *cm, char *line)
{
int len = strlen(line);
if (len > cm->cmd_blen) {
len = cm->cmd_blen - 1;
}
if (cpu.fe.fe_debug)
fprintf(stderr, "[cmdlcopy]");
strncpy(cm->cmd_buf, line, len);
cm->cmd_buf[len] = '\0';
cm->cmd_rdp = cm->cmd_buf;
cm->cmd_inp = cm->cmd_buf + len;
cm->cmd_rleft = len;
cm->cmd_left = cm->cmd_blen - len;
return cm->cmd_buf;
}
/* CMDFLS - Flush whitespace from current command pos
*/
@ -1147,6 +1113,12 @@ fc_ques(struct cmd_s *cm)
printf("Type \"help\" or \"help <command>\" for help.\n");
}
void
fc_gques(struct cmd_s *cm)
{
fc_ques(cm);
}
static void
helpline(register struct cmkey_s *kp)
{
@ -1176,13 +1148,13 @@ fc_help(struct cmd_s *cm)
cp = cm->cmd_argv[0];
if (!cp || !*cp) { /* If no specific arg, show everything */
for (kp = fectbkeys; kp->cmk_key; ++kp) {
for (kp = cm->cmd_keys; kp->cmk_key; ++kp) {
helpline(kp);
}
return;
}
(void) s_keylookup(cp, (voidp_t)fectbkeys, sizeof(struct cmkey_s),
(void) s_keylookup(cp, (voidp_t)cm->cmd_keys, sizeof(struct cmkey_s),
(voidp_t *)&kp, (voidp_t *)&key2);
if (!kp) {
printf("Unknown command: \"%s\"\n", cp);
@ -1196,12 +1168,18 @@ fc_help(struct cmd_s *cm)
}
/* More than one match, show each one */
for (kp = fectbkeys; kp->cmk_key; ++kp) {
for (kp = cm->cmd_keys; kp->cmk_key; ++kp) {
if (smatch(cp, kp->cmk_key) > 0)
helpline(kp);
}
}
void
fc_ghelp(struct cmd_s *cm)
{
fc_help(cm);
}
/* SLINLIM - Limit string to 1 line by chopping it at first EOL seen.
*/
static void
@ -2756,18 +2734,24 @@ fc_dump(struct cmd_s *cm)
}
#if KLH10_DEV_LITES
/* FC_LIGHTS - Sets console lights I/O base address
** Currently only allow LPT1 and LPT2 ports on PC.
*/
static void
fc_lights(struct cmd_s *cm)
{
#if KLH10_DEV_LITES /* Moby conditional for entire file */
unsigned long port = 0;
int c;
char *sloc = cm->cmd_arglin;
if (sloc && *sloc) {
if (strcasecmp(sloc, "usb") == 0) {
if (!lites_init(0))
printf("?Can't init lights -- probably not root\n");
return;
}
while(isxdigit(c = *sloc++)) {
port *= 16;
port += c - (isdigit(c) ? '0' : (islower(c) ? 'a' : 'A'));
@ -2781,8 +2765,8 @@ fc_lights(struct cmd_s *cm)
}
}
printf("?Bad address\n");
#endif /* KLH10_DEV_LITES */
}
#endif /* KLH10_DEV_LITES */
/* Instruction printing routines */

View File

@ -1092,6 +1092,8 @@ clk_itusset(int32 usec)
case CLKENT_ST_MQUIET:
ce->cke_oticks = clk_usec2tick(ce->cke_usec);
break;
default:
break;
}
}

View File

@ -37,10 +37,11 @@
*
*/
#include "klh10.h"
#include <stdio.h>
#include <setjmp.h> /* For setjmp, longjmp */
#include "klh10.h"
#include "osdsup.h"
#include "kn10def.h"
#include "kn10ops.h"

View File

@ -27,12 +27,13 @@
** definition that is used to help initialize other devices.
*/
#include "klh10.h"
#include <stdio.h> /* For stderr */
#include <ctype.h>
#include <string.h>
#include <stdlib.h> /* For malloc/free */
#include "klh10.h"
#include "osdsup.h"
#include "kn10def.h"
#include "kn10dev.h"
@ -293,7 +294,7 @@ extern struct device *dvlhdh_create(FILE *f, char *s);
extern struct device *dvdz11_init(FILE *f, char *s);
#endif
#if KLH10_DEV_CH11
extern struct device *dvch11_init(FILE *f, char *s);
extern struct device *dvch11_create(FILE *f, char *s);
#endif
/* Table binding static device driver modules with their names
@ -329,7 +330,7 @@ static struct dvdrv_s dvdrvtab[KLH10_DEVMAX+1] = {
{ "dz11", dvdz11_init, NULL, NULL, "DZ11 dummy (Unibus)" },
#endif
#if KLH10_DEV_CH11
{ "ch11", dvch11_init, NULL, NULL, "Chaosnet dummy (Unibus)" },
{ "ch11", dvch11_create, NULL, NULL, "Chaosnet interface (Unibus)" },
#endif
{ NULL, NULL, NULL }
};

View File

@ -25,14 +25,17 @@
*
*/
#include "klh10.h"
#include <stdio.h>
#include <string.h>
#include "klh10.h"
#include "osdsup.h"
#include "kn10def.h"
#include "kn10ops.h"
#if KLH10_DEV_LITES
#include "dvlites.h"
#endif
#include "klh10exp.h"
#include "kn10cpu.h"
@ -1492,7 +1495,10 @@ ioinsdef(io_do_pi)
register w10_t w;
w = vm_read(e); /* get lights data */
#if KLH10_DEV_LITES
lights_pgmlites(LHGET(w), RHGET(w));
#endif
return PCINC_1;
}

View File

@ -626,7 +626,7 @@ iodef(IOINOP(0700, 07), NULL, IO_SO_APR, io_so_apr, IF_IO) /* SO APR, */
iodef(IOINOP(0700, 012),"SBDIAG",IO_SBDIAG,io_sbdiag,IF_IO) /* BO PI, */
#endif
/* DATAO PI, - (KA/KI: Disp data on console lites) */
iodef(IOINOP(0700, 013), NULL, IO_DO_PI, io_do_pi, IF_IO) /* DO PI, */
iodef(IOINOP(0700, 013), "WRLI", IO_DO_PI, io_do_pi, IF_IO) /* DO PI, */
iodef(IOINOP(0700, 014), "WRPI", IO_WRPI, io_wrpi, IF_IO) /* CO PI, */
iodef(IOINOP(0700, 015), "RDPI", IO_RDPI, io_rdpi, IF_IO) /* CI PI, */
iodef(IOINOP(0700, 016), NULL, IO_SZ_PI, io_sz_pi, IF_IO) /* SZ PI, */

View File

@ -24,10 +24,11 @@
#define EXTDEF /* Definitions, not declarations! */
#include "klh10.h"
#include <stddef.h> /* For NULL */
#include <stdio.h> /* For op_init error reporting */
#include "klh10.h"
#include "kn10def.h"
#include "opdefs.h"

View File

@ -163,7 +163,6 @@ ip_adrsprint(char *cp, unsigned char *ia)
/* Our own internal table of interface entries.
*/
static int iftab_initf = 0;
static int iftab_nifs = 0;
static struct ifent iftab[NETIFC_MAX];
@ -185,7 +184,7 @@ osn_iftab_init(void)
struct ifent *ife;
/* Start out with empty table */
memset(&iftab[0], sizeof(iftab), 0);
memset(&iftab[0], 0, sizeof(iftab));
iftab_nifs = 0;
#if HAVE_GETIFADDRS
@ -449,6 +448,9 @@ osn_iflookup(char *ifnam)
int i = 0;
struct ifent *ife = iftab;
if (!ifnam)
return NULL;
for (; i < iftab_nifs; ++i, ++ife)
if (strcmp(ifnam, ife->ife_name) == 0)
return ife;
@ -561,7 +563,7 @@ set_proc_variable(char *template, char *ifname, char *value)
#endif /* CENV_SYS_LINUX */
/* OSN_ARP_STUFF - stuff emulated-host ARP entry into kernel.
/* OSN_ARP_STUFF - stuff emulated-guest ARP entry into kernel.
** The code assumes that if an ARP entry already exists in the
** kernel for the given IP address, it will be reset to this new
** setting rather than (eg) failing.
@ -845,6 +847,10 @@ osn_ifeaget2(char *ifnam, /* Interface name */
{
char eastr[OSN_EASTRSIZ];
if (strlen(ifnam) >= IFNAMSIZ) {
efatal(1, "interface name '%s' too long (more than %d chars)", ifnam, IFNAMSIZ);
}
#if CENV_SYS_DECOSF /* Direct approach */
{
int ownsock = FALSE;
@ -890,8 +896,20 @@ osn_ifeaget2(char *ifnam, /* Interface name */
return TRUE;
}
static struct eth_addr emhost_ea = /* Emulated host ether addr for tap */
{ 0xf2, 0x0b, 0xa4, 0xff, 0xff, 0xff };
static struct eth_addr emguest_ea = /* Emulated guest ether addr for tap */
{{ 0xf2, 0x0b, 0xa4, 0xff, 0xff, 0xff }};
static
void
init_emguest_ea(void)
{
if (emguest_ea.ea_octets[5] == 0xFF) {
time_t t = time(NULL);
emguest_ea.ea_octets[5] = t & 0xFE;
emguest_ea.ea_octets[4] = (t >> 8) & 0xFF;
emguest_ea.ea_octets[3] = (t >> 16) & 0xFF;
}
}
/* OSN_PFEAGET - get physical ethernet address for an open packetfilter FD.
*
@ -902,8 +920,6 @@ osn_pfeaget(struct pfdata *pfdata, /* Packetfilter data */
char *ifnam, /* Interface name (sometimes needed) */
unsigned char *eap) /* Where to write ether address */
{
int fd = pfdata->pf_fd;
if (pfdata->pf_meth == PF_METH_TAP ||
pfdata->pf_meth == PF_METH_VDE) {
@ -911,13 +927,8 @@ osn_pfeaget(struct pfdata *pfdata, /* Packetfilter data */
* irrelevant, it is on the other side of the "wire".
* Our own address is something we can make up completely.
*/
if (emhost_ea.ea_octets[5] == 0xFF) {
time_t t = time(NULL);
emhost_ea.ea_octets[5] = t & 0xFE;
emhost_ea.ea_octets[4] = (t >> 8) & 0xFF;
emhost_ea.ea_octets[3] = (t >> 16) & 0xFF;
}
ea_set(eap, &emhost_ea); /* Return the ether address */
init_emguest_ea();
ea_set(eap, &emguest_ea); /* Return the ether address */
return TRUE;
}
@ -1150,7 +1161,7 @@ osn_ifeaset(struct pfdata *pfdata, /* Packetfilter data */
if (pfdata->pf_meth == PF_METH_TAP ||
pfdata->pf_meth == PF_METH_VDE) {
ea_set(&emhost_ea, newpa);
ea_set(&emguest_ea, newpa);
return TRUE;
}
@ -1320,8 +1331,6 @@ osn_ifmcset(struct pfdata *pfdata,
}
} else {
/* Doing promiscuous stuff */
int flags;
if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
syserr(errno, "SIOCGIFFLAGS failed for interface \"%s\"", ifnam);
goto bad;
@ -1445,6 +1454,11 @@ osn_pfinit_pcap(struct pfdata *pfdata, struct osnpf *osnpf, void *pfarg)
ifnam = ife->ife_name;
}
if (strlen(ifnam) >= IFNAMSIZ) {
efatal(1, "interface name '%s' (more than %d chars)", ifnam, IFNAMSIZ);
}
pfdata->pf_meth = PF_METH_PCAP;
pfdata->pf_read = osn_pfread_pcap;
pfdata->pf_write = osn_pfwrite_pcap;
@ -1691,20 +1705,19 @@ pfopen(char *basename, struct tuntap_context *tt_ctx, struct osnpf *osnpf)
(void) snprintf(pfname, BASENAMESIZE, "%s%d", basename, i++);
fd = open(pfname, O_RDWR, 0);
} while (fd < 0 && errno == EBUSY); /* If device busy, keep looking */
}
if (fd < 0) {
/* Note possible error meanings:
ENOENT - no such filename
ENXIO - not configured in kernel
*/
esfatal(1, "Couldn't find or open packetfilter device, last tried %s",
pfname);
}
if (fd >= 0) {
basenamecpy(osnpf->osnpf_ifnam, pfname, IFNAM_LEN);
} else {
/* Note possible error meanings:
ENOENT - no such filename
ENXIO - not configured in kernel
*/
esfatal(1, "Couldn't find or open packetfilter device, last tried %s",
pfname);
};
};
tt_ctx->my_tap = TRUE;
basenamecpy(osnpf->osnpf_ifnam, pfname, IFNAM_LEN);
return fd; /* Success! */
}
@ -1785,6 +1798,10 @@ osn_pfinit_tuntap(struct pfdata *pfdata, struct osnpf *osnpf, void *arg)
char *basename = "";
int s;
if (strlen(osnpf->osnpf_ifnam) >= IFNAMSIZ) {
efatal(1, "interface name '%s' (more than %d chars)", osnpf->osnpf_ifnam, IFNAMSIZ);
}
strncpy(tt_ctx.saved_ifnam, osnpf->osnpf_ifnam, IFNAM_LEN);
if (DP_DBGFLG)
@ -1872,19 +1889,19 @@ osn_pfinit_tuntap(struct pfdata *pfdata, struct osnpf *osnpf, void *arg)
address ranges reserved for LAN-only (non-Internet) use, such as
10.0.0.44.
However, if planning to allow other machines to access the virtual
host, probably best to use an address suitable for the same LAN
guest, probably best to use an address suitable for the same LAN
subnet as the hardware host.
Unclear yet whether it works to use the host's own address; it at
least allows the configuration to happen.
Second address is "remote" -- the one the emulated host is using.
Second address is "remote" -- the one the emulated guest is using.
It should probably match the same network as the local address,
especially if planning to connect from other machines.
This is only needed for TUNNEL devices, not TAP devices.
This is only needed for TUNNEL devices, not tap+bridge devices.
*/
#if CENV_SYS_LINUX /* [BV: Linux tun device] */
if (pfdata->pf_ip4_only) {
#if CENV_SYS_LINUX /* [BV: Linux tun/tap device with tunaddr set] */
if (memcmp((char *)&ipremote, "\0\0\0\0", IP_ADRSIZ) != 0) {
char cmdbuff[128]; /* "Hacky" but simple method */
int res;
@ -1902,31 +1919,48 @@ osn_pfinit_tuntap(struct pfdata *pfdata, struct osnpf *osnpf, void *arg)
#else /* not CENV_SYS_LINUX */
{
/* Internal method */
struct ifaliasreq ifra;
struct ifreq ifr;
/* Delete first (only) IP address for this device, if any.
Ignore errors.
*/
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, ifnam, sizeof(ifr.ifr_name));
if (ioctl(s, SIOCDIFADDR, &ifr) < 0) {
if (DP_DBGFLG)
syserr(errno, "osn_pfinit_tuntap SIOCDIFADDR failed; usual for new interfaces.");
if (tt_ctx.my_tap || pfdata->pf_ip4_only) {
/*
* Delete first (only) IP address for this device, if any.
* Ignore errors.
* Don't do this on pre-existing taps, since they may have
* an address for routing, and we don't want to foil that.
*/
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, ifnam, sizeof(ifr.ifr_name));
if (ioctl(s, SIOCDIFADDR, &ifr) < 0) {
if (DP_DBGFLG)
syserr(errno, "osn_pfinit_tuntap SIOCDIFADDR failed; usual for new interfaces.");
}
/* Later perhaps set some address as configured by the user
* on the tap device... maybe from tunaddr=1.2.3.4 which is
* in iplocal. But that needs finding the broadcast address.
*/
}
if (pfdata->pf_ip4_only) {
/*
* Then set the point-to-point addresses for the tunnel.
*/
struct ifaliasreq ifra;
memset(&ifra, 0, sizeof(ifra));
strncpy(ifra.ifra_name, ifnam, sizeof(ifra.ifra_name));
((struct sockaddr_in *)(&ifra.ifra_addr))->sin_len = sizeof(struct sockaddr_in);
((struct sockaddr_in *)(&ifra.ifra_addr))->sin_family = AF_INET;
((struct sockaddr_in *)(&ifra.ifra_addr))->sin_addr = iplocal;
((struct sockaddr_in *)(&ifra.ifra_broadaddr))->sin_len = sizeof(struct sockaddr_in);
((struct sockaddr_in *)(&ifra.ifra_broadaddr))->sin_family = AF_INET;
((struct sockaddr_in *)(&ifra.ifra_broadaddr))->sin_addr = ipremote;
struct sockaddr_in *a = (struct sockaddr_in *)&ifra.ifra_addr;
a->sin_len = sizeof(struct sockaddr_in);
a->sin_family = AF_INET;
a->sin_addr = iplocal;
a = (struct sockaddr_in *)&ifra.ifra_broadaddr;
a->sin_len = sizeof(struct sockaddr_in);
a->sin_family = AF_INET;
a->sin_addr = ipremote;
if (ioctl(s, SIOCAIFADDR, &ifra) < 0) {
esfatal(1, "osn_pfinit_tuntap SIOCAIFADDR failed");
}
@ -2019,9 +2053,7 @@ pfopen_create(char *basename, struct tuntap_context *tt_ctx, struct osnpf *osnpf
int tapfd;
int res;
char cmdbuff[128];
struct ifent *ife;
int s;
int i;
char *ifnam = osnpf->osnpf_ifnam;
if (DP_DBGFLG)
@ -2135,16 +2167,16 @@ void
tap_bridge_close(struct tuntap_context *tt_ctx)
{
if (tt_ctx->my_tap) {
int s, res;
int s;
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
esfatal(1, "tap_bridge_close: socket() failed");
}
/* Destroy bridge */
res = ioctl(s, SIOCIFDESTROY, &tt_ctx->br_ifr);
ioctl(s, SIOCIFDESTROY, &tt_ctx->br_ifr);
/* Destroy tap */
res = ioctl(s, SIOCIFDESTROY, &tt_ctx->tap_ifr);
ioctl(s, SIOCIFDESTROY, &tt_ctx->tap_ifr);
close(s);
}
@ -2192,6 +2224,10 @@ bridge_create(struct tuntap_context *tt_ctx, struct osnpf *osnpf)
error("Can't find name of bridge: $KLH10_NET_BRIDGE is unset. Trying with \"%s\"", br_name);
}
if (strlen(br_name) >= IFNAMSIZ) {
error("$KLH10_NET_BRIDGE too long (more than %d chars)", IFNAMSIZ);
}
if ((s = socket(AF_LOCAL, SOCK_STREAM, 0)) < 0) {
esfatal(1, "bridge_create: socket() failed");
}
@ -2271,7 +2307,7 @@ osn_pfinit_vde(struct pfdata *pfdata, struct osnpf *osnpf, void *pfarg)
memset(&voa, 0, sizeof(voa));
if (!(pfdata->pf_handle = (void*) vde_open(devname, "simh", &voa))) {
if (!(pfdata->pf_handle = (void*) vde_open(devname, "klh10", &voa))) {
syserr(errno, "Can't open VDE device \"%s\"", devname);
} else {
pfdata->pf_fd = vde_datafd((VDECONN*)(pfdata->pf_handle));
@ -2348,13 +2384,13 @@ osn_virt_ether(struct pfdata *pfdata, struct osnpf *osnpf)
/* Now optionally determine ethernet address.
This amounts to what if anything we should put in the native
host's ARP tables.
- If we only intend to use the net between the virtual host and
- If we only intend to use the net between the virtual guest and
its hardware host, then no ARP hackery is needed.
- However, if the intent is to allow traffic between the virtual
host and other machines on the LAN or Internet, then an ARP
entry is required. It must advertise the virtual host's IP
guest and other machines on the LAN or Internet, then an ARP
entry is required. It must advertise the virtual guest's IP
address, using one of the hardware host's ethernet addresses
so any packets on the LAN for the virtual host will at least
so any packets on the LAN for the virtual guest will at least
wind up arriving at the hardware host it's running on.
*/
@ -2374,13 +2410,8 @@ osn_virt_ether(struct pfdata *pfdata, struct osnpf *osnpf)
* irrelevant, it is on the other side of the "wire".
* Our own address is something we can make up completely.
*/
if (emhost_ea.ea_octets[5] == 0xFF) {
time_t t = time(NULL);
emhost_ea.ea_octets[5] = t & 0xFE;
emhost_ea.ea_octets[4] = (t >> 8) & 0xFF;
emhost_ea.ea_octets[3] = (t >> 16) & 0xFF;
}
ea_set(&osnpf->osnpf_ea, &emhost_ea); /* Return the ether address */
init_emguest_ea();
ea_set(&osnpf->osnpf_ea, &emguest_ea); /* Return the ether address */
char *ifnam = osnpf->osnpf_ifnam; /* alias for the persisting copy */
struct ifent *tap_ife = osn_ifcreate(ifnam);
@ -2398,11 +2429,11 @@ osn_virt_ether(struct pfdata *pfdata, struct osnpf *osnpf)
if (ife) {
/* Need to determine ether addr of our default interface, then
publish an ARP entry mapping the virtual host to the same
publish an ARP entry mapping the virtual guest to the same
ether addr.
*/
/* Use emhost_ea as set up above */
/* Use emguest_ea as set up above */
} else {
/* ARP hackery will be handled by IP masquerading and packet forwarding. */
#if 1 /*OSN_USE_IPONLY*/ /* TOPS-20 does not like NI20 with made up address? */

View File

@ -43,11 +43,12 @@
*
*/
#include "klh10.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* For strrchr */
#include "klh10.h"
#include "kn10def.h"
#include "osdsup.h"
#include "kn10ops.h"
@ -913,7 +914,7 @@ os_rtmget(register osrtm_t *art)
{
#if HAVE_SETITIMER /* && HAVE_GETTIMEOFDAY ; implied */
static osrtm_t os_last_rtm = {0,0};
if (!gettimeofday(art, (struct timezone *)NULL) == 0)
if (gettimeofday(art, (struct timezone *)NULL) != 0)
return FALSE;
/* did time go backwards? */
if ((os_last_rtm.tv_sec > art->tv_sec) ||
@ -1619,8 +1620,17 @@ os_mmcreate(register size_t memsiz,
/* Create a shared mem seg. Set perms to owner-only RW.
** Note shmget will lose grossly if on a system where its size arg
** (defined as a u_int) is less than 32 bits!
** POSIX doesn't define symbolic constants for the permissions
** but in http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_07_01
** does define the values, which match plain file permission bits.
*/
if ((shmid = shmget(IPC_PRIVATE, (u_int)memsiz, 0600)) == -1) {
#ifndef IPC_R
#define IPC_R 0400
#endif
#ifndef IPC_W
#define IPC_W 0200
#endif
if ((shmid = shmget(IPC_PRIVATE, (u_int)memsiz, IPC_CREAT|IPC_R|IPC_W)) == -1) {
fprintf(stderr, "[os_mmcreate: shmget failed for %ld bytes - %s]\n",
(long)memsiz, os_strerror(errno));
return FALSE;

View File

@ -27,6 +27,8 @@
** hence must avoid any dependencies on other code.
*/
#include "cenv.h" /* Just in case of LFS */
#include <stdio.h>
#include <stdlib.h> /* Malloc and friends */
#include <string.h>
@ -66,7 +68,7 @@ int prm_varset(char **acp,
if (!(cp = strchr(cp, '='))) {
if (ef)
fprintf(ef, "Bad syntax for \"%s\", must be <var>=<value>\n", cp);
fprintf(ef, "Bad syntax for \"%s\", must be <var>=<value>\n", *acp);
return FALSE;
}

View File

@ -46,6 +46,8 @@
** this; OSDTAP.C could complete it.
*/
#include "cenv.h"
#include <string.h>
#include <fcntl.h>
#include <signal.h>

View File

@ -162,6 +162,8 @@ Lisp format, the -right- thing to do is to do this all from Maclisp!
*/
#include "cenv.h"
#include <stdio.h>
#include <ctype.h>
#include <string.h>

View File

@ -59,6 +59,8 @@ and output as bytes in the following order by the code at SAVGRC:
<jrst>,,<saddr> => 0,,<addr> => <xxxx><B3><B2><B1><B0> hi 4 bits dropped
*/
#include "cenv.h" /* Just in case of LFS */
#include <stdio.h>
#include "word10.h"

View File

@ -28,13 +28,14 @@
*
*/
#include "cenv.h"
#include <stdio.h>
#include <stdlib.h> /* For malloc */
#include <stdarg.h>
#include <string.h>
#include "rcsid.h"
#include "cenv.h"
#include "word10.h"
#include "osdsup.h"
#include "vdisk.h"

View File

@ -34,6 +34,8 @@
**
*/
#include "cenv.h"
#include <string.h>
#include <fcntl.h>
#include <signal.h>
@ -44,7 +46,6 @@
#include <sys/file.h> /* For open() flags */
#include "rcsid.h"
#include "cenv.h"
#include "osdsup.h"
#include "vdisk.h" /* Include virtual disk stuff */

View File

@ -105,6 +105,8 @@ hardware devices so as to finally provide a consistent interface.
*/
#include "klh10.h"
#include <errno.h>
#include <string.h>
#include <stdlib.h> /* For malloc */
@ -114,7 +116,6 @@ hardware devices so as to finally provide a consistent interface.
#include <stdarg.h> /* For error-reporting functions */
#include <limits.h>
#include "klh10.h"
#include "osdsup.h"
#include "word10.h"
#include "wfio.h" /* For word-based file i/o */
@ -871,6 +872,7 @@ vmt_rdmount(register struct vmtape *t,
}
/* Oops, doesn't look like a control file. Try data. */
fclose(cf);
cf = NULL;
if (cfn != ta->vmta_path)
free(cfn);
cfn = NULL;
@ -886,6 +888,8 @@ vmt_rdmount(register struct vmtape *t,
return FALSE;
}
dfn = ta->vmta_path;
fclose(df);
df = NULL;
}
havefmt:
if (vmtfmttab[fmt].tf_flags & (VMTFF_CTL | VMTFF_XCTL)) {
@ -1801,6 +1805,9 @@ vmt_rspace(register struct vmtape *t,
while (tpc_recfwd(t) > 0
&& !t->mt_eof && !t->mt_eot && --cnt) ;
break;
default:
/* Unexpected tape format value */
break;
}
t->mt_frames = origcnt - cnt;
return TRUE;
@ -3067,6 +3074,10 @@ vmt_rput(register struct vmtape *t,
return FALSE;
}
break;
default:
/* Unexpected tape format value */
break;
}
return vmt_ioend(t);
}
@ -3096,6 +3107,9 @@ vmt_eput(register struct vmtape *t,
case VMT_FMT_TPS:
/* Possible but not implemented yet */
break;
default:
/* Unexpected tape format value */
break;
}
return TRUE;
}

View File

@ -40,6 +40,8 @@
*/
#include "cenv.h" /* Just in case of LFS */
#include <stdio.h>
#include <stdlib.h> /* Malloc and friends */
#include <string.h>

View File

@ -44,6 +44,8 @@ guaranteed to be complete or reliable, and it's time-consuming to do
this for all possible variations.
*/
#include "cenv.h" /* Just in case of LFS */
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>