1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-13 23:27:12 +00:00

63 Commits

Author SHA1 Message Date
Nick Briggs
0c7b1cccd4
Merge pull request #514 from Interlisp/cleanup-USHORT-bitfields
Remove USHORT and direct "unsigned short" uses in struct bitfields
2024-10-15 19:27:13 -07:00
Nick Briggs
fae5c4956e
Cleanup in the "version array" handling in the {DSK} device (#513)
* Remove useless VersionArray parameter in maintain_version()

The 2nd argument, FileName *varray, is only ever NULL, so
remove it and simplify the code.

* Remove useless and unused VersionArray cache mechanism

* Simplify setting of file times on file close

The futimes(fd, ...) function allows changing the times of a file with
reference to an open file descriptor which allows us to avoid trying to
find a pathname by which utimes(path, ...) would operate on the inode
corresponding to the fd we have just closed.

* Remove unnecessary temporary variable for VersionArray

* In get_version_array() do not mix array and pointer access to VersionArray

* Improve {DSK} device handling of files with many versions

Somewhat dynamically allocate the version array storage, in chunks of
VERSIONARRAYCHUNKLENGTH (currently 200) allowing for up to
VERSIONARRAYMAXLENGTH (currently 2000) entries before reporting an
error. These numbers could be adjusted, or the limit could be removed.

Sorts the version array in descending order of version number to
improve the performance of check_vless_link() which stats every file
in the version array until it finds one linked to the versionless name
(which should be the highest version).  Sorting, and tracking the
number of active entries, also allows for future optimization of other
operations that currently walk through the version array.

* futimens() appears more widely available than futimes() - so use it

* Rework caching of version array for files

While enumerating the entries in a directory is relatively fast,
on some systems (macOS) stat() of a file is slow.
While there is not general agreement on the name in the stat structure
of the timespec field for the modification time, POSIX specifies it
as "st_mtim", and it is possible to #define st_mtim to be the
system-specific name in "version.h" (macOS: st_mtimespec).

* FindHighestVersion can make use of sorted order of filename/version cache

Since the list of filename and versions is maintained in descending order
by version number (see get_version_array) the highest version is trivially
located at index 0 of the filename array.
2024-10-14 14:15:02 -07:00
Nick Briggs
b88ea87fa8 Remove USHORT definition and replace uses with DLword
USHORT unnecessarily duplicates the DLword type that represents a
single Lisp 16-bit word.
2024-10-14 12:57:02 -07:00
devhawala
82577ce951
Dodo Nethub support (#445)
* added support for XNS networking via Dodo-Nethub

* NetHub connection now optional (only if -nh-host is given); released NetHub-related changes to 'ether.c' to the public domain

* Added file using-dodo-networking-with-maiko.md

Documentation for building and using the Dodo-networking addition to Maiko

* Added support for running Maiko unter cygwin/x86_64-x

* Migrate Addr68k/NativeAlignment{2,4} in Nethub code, move timer/async defines to platform.h

* added missing include <netinet/in.h> for FreeBSD

* updated 'compile-flags' with added flags

* splitted ether.c in 3 (_common, _sunos, _nethub)

* reworks/modifications for nbriggs' pull-request review comments

* addintional additions for nbriggs' pull-request review comments

* get the Lisp packet lengths with 'LispInt2CInt'

* renamed variables in dblwordsSwap to indicate it's about double-words

* fixed wrong preprocessor directive unnoticed by clang

* added networking choice option to cmake build, fix to printf warning

- for cmake specify the networking to use with -DMAIKO_NETWORK_TYPE=<type>
- with <type> one of: NONE, SUN_DLPI, SUN_NIT, NETHUB
- e.g.: cmake .. -DMAIKO_NETWORK_TYPE=NETHUB

* integrated improvement to sendPacket() proposed by nbriggs

* integrated fix for SIGBUS on 32-bit big-endian, provided by nbriggs

* MAIKO_ENABLE_ETHERNET should not be unconditionally set on Solaris systems

* Receiving an ethernet packet is an ether interrupt but not an i/o interrupt.

Co-authored-by: dev hawala <devhawala@x.y>
Co-authored-by: Nick Briggs <nicholas.h.briggs@gmail.com>
2022-10-11 14:21:55 -07:00
Nick Briggs
3d9f090e70
Cleanup of includes and related changes based on include-what-you-use diagnostics (#436)
Remove unused #define PERCENT_OF_SCREEN in MyWindow.h
Move structures for dir.c to dirdefs.h where they are used
Resolve S_CHAR vs S_CHARACTER in favor of S_CHARACTER and cleanup #defines
Fix  = vs == bug in FSDEBUG code in dir.c
Eliminate duplicate/unused constant definitions in gcr.c
Declare static internal function bytecmp in mkatom.c
Update many source and include files to include headers for what they use
2022-08-10 11:07:57 -07:00
Nick Briggs
008ce703e7 Use inttypes.h to provide uintptr_t/intptr_t of machine dependent size for UNSIGNED/INT declarations 2022-01-22 15:16:36 -08:00
Nick Briggs
e1efc860c4 Prefer typedef over #define where it can be used for type definitions 2021-12-09 14:48:52 -08:00
Nick Briggs
377a6f3f47
Rewrite keyboard and async I/O handling to improve performance and reduce dependency on async I/O signals (#392)
* Rewrite keyboard and async I/O handling to improve performance and reduce dependency on async I/O signals

Replaces the SIGIO handler, which used to process X events in the interrupt context, with
a stub routine that sets a flag to signal processing is required.
Actual event processing is moved to the main dispatch loop where Lisp periodic interrupts
are handled.

Removes the X connection file descriptor from the set of fds contributing to SIGIO events
and moves the processing of X events to where the Lisp periodic interrupt is handled in
the main dispatch loop.  This code is already guarded by a check for XPending() so can
be called regardless of whether any file descriptors are known to be ready.

Actual processing of async I/O events and X events are handled by procedures
process_io_events() and process_Xevents() respectively.  For the most part these are
a renaming of getsignaldata() and getXsignaldata().

The Lisp periodic timer (VTALRM) was set to operate with a 25000 us period (40 Hz),
but on modern hardware it is possible to run this timer with a period of 10000 us (100 Hz)

Incidentally, a bug was noted (and fixed) in the X event handling code for motion events:
Mouse motion without any keyboard activity should not add an entry to the keyboard event
ring buffer as these events do not represent a key state change.
Since the ring buffer is of limited size, when it is filled new events are ignored
until the buffered events are processed.  This resulted in the loss of a key/mouse button
transition (up or down) if the mouse was moved about "too much" between keyboard events.

A few incidental cleanups were also made:
  - KBDEventFlg initialization fixed (wrong semantic type)
  - Event_Req renamed to IO_Signalled (more appropriate name)
  - int_io_open() sets up process (self) to handle SIGIO generated by O_ASYNC operations
  - LOCK_X_EVENTS turned off since X library calls can no longer happen in an interrupt context

* Use of O_ASYNC must depend on the symbol being defined (looking at you, Cygwin)

* Add SA_RESTART flag to sigaction for SIGVTALRM periodic interrupt

* LOCK_X_UPDATE is no longer needed and should not be defined by default for Solaris in version.h
2021-09-02 12:42:51 -07:00
Nick Briggs
d482cc461c
Address older versions of C compiler which don't have __BYTE_ORDER__ (#335)
* Address older versions of C compiler which don't have __BYTE_ORDER__

* Checking for __GNUC__ is not sufficient to determine if builtins are available.

* Add makefile fragment for 32-bit PowerPC on Mac OSX build, and ignore the build directories.

* Add comment describing use of __BIG/LITTLE_ENDIAN__ definition
2021-02-06 20:51:42 -08:00
Nick Briggs
f7113d53ee
Remove provision for offline assembler peephole optimizations on SunOS3/4 (#304)
We no longer need to run a separate peephole optimization pass over the
compiler generated or hand-coded assembler for SunOS3 and SunOS4 on 68K or SPARC

We remove the preprocessor symbols and code controlled by them
	SUN4_OS4_IL
	SUN3_OS3_IL
	SUN3_OS4_IL
and	SUN3_OS3_OR_OS4_IL
2021-01-26 16:44:40 -08:00
Bruce Mitchener
cc060be1c7
Remove assembly fn call optimizations. (#276)
These were for old platforms and not used in recent history.

There's no NOASMFNCALL flag as there's no more asm fn call code.
2021-01-24 16:39:32 -08:00
Bruce Mitchener
95b482d5d5
Use gcc / clang overflow builtins. (#142)
* Use gcc / clang overflow builtins.

This avoids expensive checks for overflow that employ undefined
behavior.

This is a step along the way towards replacing the old hand-written
assembler that did the same thing in terms of using the CPU's
overflow detection.

* Remove unimplemented SPARC asm for multiplication, divide, and remainder.

This wasn't implemented before, and for multiplication, it is now
implemented for gcc and friends using overflow detection.

* Remove USE_INLINE_ARITH.

Now that we have the compiler built-ins for detecting overflow,
we don't need custom assembly for it for each platform.

For now, we keep, but still don't use, the code that do a hot
path through the dispatch loop for some math. This code isn't
actually running or in use, but it is separate from how the
other inline arithmetic was being performed. These are the
`fast_op_*` functions that are implemented in assembler.
2021-01-21 00:27:31 -08:00
Bruce Mitchener
0010a02cb1
Disallow UNALIGNED_FETCH_OK on ARM, not LINUX. (#258)
UNALIGNED_FETCH_OK shouldn't be set for an entire OS, but
based on the CPU architecture.

Some ARM systems don't allow unaligned reads. x86 and x86_64
do, so update how we configure this.
2021-01-21 02:26:47 +00:00
Bruce Mitchener
addaad51fc
Remove SunOS4 removal of __inline__. (#253) 2021-01-20 17:28:06 +00:00
Bruce Mitchener
6c1bfeaf79
Use MAIKO_ARCH_SPARC rather than sparc. (#252) 2021-01-19 23:50:03 -08:00
Bruce Mitchener
0a057dec6b
Delete code related to NATIVETRAN feature. (#232)
* Delete code related to NATIVETRAN feature.

This was obsolete work that had been done for generating
native code from the bytecode.

Closes Interlisp/medley#89.

* Remove unused SaveD6.
2021-01-19 17:57:53 -08:00
Bruce Mitchener
0fbf5e8281
Rename NOETHER to MAIKO_ENABLE_ETHERNET. (#219)
Like the renaming of NOFORN, this gets rid of some double
negatives. It also removes some patterns where we had:

```
    #ifdef NOETHER
    #else
    ...
    #endif
```

and replaces them with:

```
    #ifdef MAIKO_ENABLE_ETHERNET
    ...
    #endif
```
2021-01-13 17:54:54 +00:00
Bruce Mitchener
d3efbc3441
Remove HAS_GETHOSTID. (#218)
This is only true on DOS now. It was previously true on older
unsupported platforms, but they are gone now.
2021-01-12 20:10:21 -08:00
Bruce Mitchener
7145f0d380
Rename NOFORN to MAIKO_ENABLE_FOREIGN_FUNCTION_INTERFACE. (#217)
This lets us get rid of double-negatives, which are confusing,
and starts a naming scheme that is easier to see when something
is a Maiko flag versus something else.
2021-01-12 20:04:23 -08:00
Bruce Mitchener
7b979dd789
Add maiko/platform.h to detect OS + CPU. (#216)
This also adds a bit to the `-info` output to say which OS and CPU
are being targeted.

This can be used in subsequent commits to drive whether or not
we need `BYTESWAP` and whether or not unaligned memory access
is okay.

We'll be able to remove per-platform defines from all of the
makefiles and cmake.
2021-01-13 03:01:49 +00:00
Bruce Mitchener
ec04803b53
Switch s_char uses to signed char. Remove s_char alias. (#208) 2021-01-11 19:00:33 -08:00
Bruce Mitchener
5a8f20c0ca
Default NOFORN to defined. (#209)
The NOFORN flag controls foreign function interface code, which
was written using the dld_* APIs which haven't existed in years.

There was a GNU dld that provided this API, but it was withdrawn
in 2006.

If this code is to be re-enabled, it will have to be changed to
use the `dlopen` family of APIs.
2021-01-11 18:17:42 -08:00
Alex Segura
68d7908ee6
Support building on OpenBSD, x86-64 (#207)
* Support building on OpenBSD, x86-64

* Clean up OpenBSD Makefile

* Add OpenBSD to cmake build

* Use clang as CC for OpenBSD

Co-authored-by: Alex Segura <alex@lispm.dev>
2021-01-11 17:10:57 -08:00
Bruce Mitchener
2dcdf14334
Migrate to POSIX signals. (#190)
This removes SYSVSIGNALS as we're always and only using POSIX
signals now.

Some platform differences have been papered over. We used to
only ignore SIGPIPE when using BSD signals, but we now ignore
it all the time.

While the SIGFPE code will now compile, it hasn't been updated
to work on modern OSes fully yet as it will need to enable
the correct FP exceptions.
2021-01-09 04:55:39 +00:00
Nick Briggs
a093d80fa5
Add include guards to all the include files in inc/ which were missing them. (#189)
As a prerequisite for cleaning up some other include issues, all the
include files in inc/ should have an include guard.  All the xxxdefs.h
were created with them, but most older files were not.
2021-01-07 03:06:42 +00:00
Bruce Mitchener
cb815c34a1
Remove REGISTER define. (#184)
This was used to indicate that the value was allowed to live
in a register. Compilers are much better now and can handle
this themselves.

This helps get rid of more platform-specific ifdef-ery.
2021-01-05 10:26:22 -08:00
Bruce Mitchener
848177aa95
The SYSVONLY flag is no longer used or needed. (#153)
Welcome to the world of being mostly POSIX!
2020-12-31 17:13:05 -08:00
Bruce Mitchener
f1647df8b1
Default to NOETHER, only enable on Solaris. (#149)
* Default to NOETHER, only enable on Solaris.

* DOS: NOETHER controlled by inc/version.h

We set NOETHER by default on DOS, so no need for it here in the
build system.
2020-12-31 01:33:58 +00:00
Bruce Mitchener
7f7952cbad
Remove USETIMEFN define. (#143)
In the past, we didn't use `gettimeofday()` on all non-DOS platforms
because it wasn't available, so we had to fall back to `time()`.
Those days are long gone and we have `gettimeofday()` on all non-DOS
platforms.

This also removes some code that used `times()` when it used `time()`.
This leaves us using `getrusage()` on all non-DOS platforms. This,
much like `gettimeofday()`, is now available everywhere. Not all of
the fields used here are guaranteed by POSIX, but the ones used
here shouldn't be an issue for now.
2020-12-30 14:38:58 -08:00
Bruce Mitchener
01926fc232
NEW_STORAGE is no longer new. (#135)
* Always follow NEW_STORAGE code paths.

This removes the code paths for the pre-NEW_STORAGE code.

* Remove NEW_STORAGE from build system.

The code no longer refers to `NEW_STORAGE`, so we can remove
this from the build system.
2020-12-28 10:10:43 -08:00
Bruce Mitchener
0880b2f3dd
Remove UNSAFE flag. (#134)
This flag was for SunOS 3 and 4 on sun3 hardware (68k).

It enabled some unsafe optimizations via assembler. This hasn't
actually been built since the DOS port (since the header for this
was renamed, but the code in `xc.c` wasn't updated).

The optimizations here made assumptions that were specific to the
68k hardware and register allocation. They aren't likely to be
of much use moving forward, and we've got plenty of safe performance
improvements from the last 30 years of hardware advances.
2020-12-26 20:53:47 +00:00
Bruce Mitchener
bf2855be58
Use the real gethostid on Solaris. (#121)
* Use the real gethostid on Solaris.

Solaris has this, so we might as well use it like we do on other
platforms. This value is used in response to queries from it from
Lisp.

* Improve undefining of HAS_GETHOSTID.

Enable it on Solaris in `inc/version.h`. This file already
disables it on DOS, so no need to do so again in `src/initsout.c`.
2020-12-23 19:55:58 -08:00
Bruce Mitchener
3ef2d12115
Use memset instead of bzero. (#131) 2020-12-23 10:34:27 -08:00
Bruce Mitchener
0c8ae869b9
Remove comment reference to SIGNED_CHARS define. (#126)
None exists or is used, so no need to discuss it.
2020-12-22 23:17:28 -08:00
Bruce Mitchener
1b9a90add6
Remove XWINDOWS define from FreeBSD, Linux, and macOS builds. (#124)
The right define is `XWINDOW` which is already defined via the
build system.
2020-12-22 23:08:00 -08:00
Bruce Mitchener
be88851eaf
Remove USE_UTIME. (#87)
This wasn't enabled and the corresponding code wouldn't have
compiled. The `utime()` function is also deprecated in POSIX.

This used to be enabled for HPUX and RISCOS.
2020-12-16 11:06:14 -08:00
Bruce Mitchener
c196393879
Remove unused BSD_COMP define from SunOS5 config. (#70) 2020-12-15 10:17:11 -08:00
Bruce Mitchener
7e2e1399e3
inc/version.h: Remove some old/unused workarounds. (#57) 2020-12-14 22:10:30 -08:00
Bruce Mitchener
857100a29a
Remove AIX on PS/2 platform support. (#50) 2020-12-14 18:14:59 -08:00
Bruce Mitchener
7d2de5e4de
Remove define direct dirent workarounds. (#47)
This also removes a workaround for L_SET, as well as some of the
dirent member fields.
2020-12-14 12:16:59 -08:00
Bruce Mitchener
fd0e12e855
Remove AIX RS/6000 platform support. (#46)
AIX on PS/2 will be removed separately.
2020-12-14 12:13:38 -08:00
Bruce Mitchener
9c01d39812
Use waitpid, not wait3, etc. (#44)
This removes code that uses `union wait` status in favor of code
that uses `int` status. This has been the correct way since
SvR4, BSD 4.3, POSIX.
2020-12-14 09:58:28 -08:00
Bruce Mitchener
2dba7492af
Begin to remove ISC platform support. (#40)
We don't want to modify emulation code yet as ISC support included
a number of other things, including some i386 code that isn't used
on other platforms, but is still useful as a reference.
2020-12-13 22:31:58 -08:00
Bruce Mitchener
7119613aee
Remove RISCOS platform support. (#39) 2020-12-14 01:38:57 +00:00
Bruce Mitchener
33a42736d4
Remove OSF1 / DEC3100 platform support. (#36)
This also removes support for the DEC3100 keyboard, but leaves a
constant behind for it as I'm not sure about re-numbering.
[NBriggs: keyboard type numbers are stored within all sysouts.  Do not renumber supported keyboards, do not reuse previously used keyboard numbers]
2020-12-13 10:22:43 -08:00
Nick Briggs
cfec521c33 Remove unused VOID 2020-12-12 23:44:12 -08:00
Bruce Mitchener
1c912ff57e
Remove HP platform support. (#34)
This removes code related to HP9000, HPTIMERBUG, and HPUX defines.

It leaves KB_HP9000 for now as I'm not sure about renumbering
those constants.

This should not impact any of the core emulation code.
2020-12-13 05:35:53 +00:00
Bruce Mitchener
750d84c78c
Remove SGI Irix platform support. (#33)
This platform had no emulation-related changes.

Remove code for IRIX40, INDIGO definitions.

In disk code, simplify a chain of #ifdef's around fsync handling.
2020-12-13 02:57:07 +00:00
Bruce Mitchener
292809694e
Remove platform support for Apollo/Domain. (#30) 2020-12-13 02:07:08 +00:00
Bruce Mitchener
d6d2a3371a
Use getcwd() instead of getwd(). (#20)
getwd() has been deprecated for a long time and getcwd() should
be used instead.
2020-12-10 17:24:21 +00:00