1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-03-25 01:36:19 +00:00

Compare commits

...

19 Commits

Author SHA1 Message Date
Nick Briggs
3a4a94344a Merge branch 'master' into nhb-pcap-ethernet 2026-03-19 17:06:05 -07:00
Nick Briggs
9259716e9a Merge pull request #544 from Interlisp/fgh_redo-linux-makefiles
Consolidate PRs 542 and 543 and slightly update:  Redo linux makefiles to include libbsd where necessary and to abstract out common parts and share them across all linux-y makefiles
2026-03-19 14:47:23 -07:00
Nick Briggs
519c13891b Fixes missing quoting for sh -c 2026-03-19 12:33:02 -07:00
Nick Briggs
ee21e482a7 Invoke "command" with /bin/sh -c from makefile to avoid not-found errors 2026-03-19 11:16:16 -07:00
Frank Halasz
bbe011c583 Take geminis suggestion on getting glibc version number in linux-common.mk 2026-03-18 01:27:16 -07:00
Frank Halasz
54c81a3762 Fixed comment in linux-compiler.mk 2026-03-18 01:15:21 -07:00
Frank Halasz
6c20a5c635 Fixed comment in linux-compiler.mk 2026-03-18 01:03:32 -07:00
Frank Halasz
1195048b1b Ooops. Took out debugging code. 2026-03-18 00:51:03 -07:00
Frank Halasz
7a286a8f1f Fix sed script in linux-common.mk 2026-03-18 00:50:14 -07:00
Frank Halasz
034c52b86f In CMakelists, limit use of libbsd for linux to cases where libc does not include strlcat 2026-03-18 00:25:28 -07:00
Frank Halasz
a26cafcbda Change USE_GCC=T/USE_CLANG=T to USE_COMPILER=clang/gcc for linux-y makefiles 2026-03-18 00:01:24 -07:00
Frank Halasz
c6f3ba4305 Including all suggestions made by Gemeni code check. Now includes linking to libbsd (if requested) only if glibc < version 2.38 since glibc >= 2.38 includes strlcat and friends. 2026-03-17 23:02:12 -07:00
Frank Halasz
3430574f61 More updates to github actions to account for deprecation of Node 20. 2026-03-14 20:43:13 -07:00
Frank Halasz
07e009cf08 Update github actions to latest versions to account for deprecation of node 20. 2026-03-14 19:37:40 -07:00
Frank Halasz
25654fa090 For Linux makefiles, automated selection of gcc versus clang compiler depending on whats installed. Refactored Linux makefiles to simplify top level makefiles with slightly more complicated common makefiles. Makefiles for Cygwin and WSL1 all rewritten to use the common linux makefiles code. 2026-03-13 23:51:50 -07:00
Nick Briggs
5432d73819 Adds generation of SIGIO on X11 connection if O_ASYNC defined 2025-12-11 09:18:40 -08:00
Nick Briggs
a074c4a3c0 Adds required include of <string.h> for strncpy in non-BYTESWAP compilations. 2025-12-07 21:11:39 -08:00
Nick Briggs
cdaa7b6889 Cleans up the interrupt state structure to match Lisp naming
Adds names for individual interrupt-in-progress bits in the
struct interrupt_state to match the structure defined in Lisp.

Adjusts the base datatype to DLword to make clear the size and
alignment of interrupt bits in the structure.
2025-12-07 18:39:59 -08:00
Nick Briggs
eedc8a504a Uses endian independent structure layouts to access returned ethernet packet length field 2025-10-31 15:38:54 -07:00
31 changed files with 252 additions and 304 deletions

View File

@@ -13,7 +13,7 @@ jobs:
matrix: matrix:
os: [macos-11, macos-12, ubuntu-22.04, ubuntu-20.04] os: [macos-11, macos-12, ubuntu-22.04, ubuntu-20.04]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v6
- name: Install X11 dependencies on MacOS - name: Install X11 dependencies on MacOS
if: ${{ runner.os == 'macOS'}} if: ${{ runner.os == 'macOS'}}
run: brew install --cask xquartz run: brew install --cask xquartz
@@ -28,7 +28,7 @@ jobs:
# runs-on: [self-hosted, linux, ARM] # runs-on: [self-hosted, linux, ARM]
# if: ${{ github.repository == 'Interlisp/maiko' }} # if: ${{ github.repository == 'Interlisp/maiko' }}
# steps: # steps:
# - uses: actions/checkout@v3 # - uses: actions/checkout@v6
# - name: Build # - name: Build
# working-directory: bin # working-directory: bin
# run: ./makeright x # run: ./makeright x
@@ -41,7 +41,7 @@ jobs:
env: env:
BUILD_TYPE: Release BUILD_TYPE: Release
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v6
- name: Show CMake version - name: Show CMake version
run: cmake --version run: cmake --version
- name: Install X11 dependencies on MacOS - name: Install X11 dependencies on MacOS

View File

@@ -34,7 +34,7 @@ jobs:
steps: steps:
# Checkout maiko # Checkout maiko
- name: Checkout maiko - name: Checkout maiko
uses: actions/checkout@v3 uses: actions/checkout@v6
# Setup docker environment variables # Setup docker environment variables
- name: Setup Docker Environment Variables - name: Setup Docker Environment Variables
@@ -49,18 +49,18 @@ jobs:
# Setup the Docker Machine Emulation environment. # Setup the Docker Machine Emulation environment.
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@master uses: docker/setup-qemu-action@v4
with: with:
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
# Setup the Docker Buildx funtion # Setup the Docker Buildx funtion
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@master uses: docker/setup-buildx-action@v4
# Login to ghcr.io # Login to ghcr.io
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v4
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
@@ -71,7 +71,7 @@ jobs:
# #
- name: Build Docker Images for Push to GHCR - name: Build Docker Images for Push to GHCR
if: ${{ true }} if: ${{ true }}
uses: docker/build-push-action@v4 uses: docker/build-push-action@v7
with: with:
builder: ${{ steps.buildx.outputs.name }} builder: ${{ steps.buildx.outputs.name }}
build-args: | build-args: |

View File

@@ -123,7 +123,7 @@ jobs:
steps: steps:
# Checkout the actions for this repo owner # Checkout the actions for this repo owner
- name: Checkout Actions - name: Checkout Actions
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
repository: ${{ github.repository_owner }}/.github repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }} path: ./Actions_${{ github.sha }}
@@ -157,7 +157,7 @@ jobs:
steps: steps:
# Checkout the actions for this repo owner # Checkout the actions for this repo owner
- name: Checkout Actions - name: Checkout Actions
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
repository: ${{ github.repository_owner }}/.github repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }} path: ./Actions_${{ github.sha }}
@@ -165,7 +165,7 @@ jobs:
# Checkout the branch # Checkout the branch
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v6
# Setup release tag # Setup release tag
- name: Setup Release Tag - name: Setup Release Tag
@@ -185,14 +185,14 @@ jobs:
# Setup the Docker Machine Emulation environment. # Setup the Docker Machine Emulation environment.
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v4
with: with:
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
# Setup the Docker Buildx funtion # Setup the Docker Buildx funtion
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v4
# Do the Docker Build using the Dockerfile in the repository we # Do the Docker Build using the Dockerfile in the repository we
# checked out. Save the results in a directory under /tmp to be used # checked out. Save the results in a directory under /tmp to be used
@@ -204,7 +204,7 @@ jobs:
# Dockerfile, NOT HERE IN THE WORKFLOW. # Dockerfile, NOT HERE IN THE WORKFLOW.
# #
- name: Build Docker Image and Save It Locally - name: Build Docker Image and Save It Locally
uses: docker/build-push-action@v4 uses: docker/build-push-action@v7
with: with:
builder: ${{ steps.buildx.outputs.name }} builder: ${{ steps.buildx.outputs.name }}
build-args: | build-args: |
@@ -246,7 +246,7 @@ jobs:
# Push Release to github # Push Release to github
- name: Push the release - name: Push the release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1.21.0
with: with:
allowUpdates: true allowUpdates: true
artifacts: artifacts:
@@ -280,11 +280,11 @@ jobs:
# Checkout the branch # Checkout the branch
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v6
# Checkout the actions for this repo owner # Checkout the actions for this repo owner
- name: Checkout Actions - name: Checkout Actions
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
repository: ${{ github.repository_owner }}/.github repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }} path: ./Actions_${{ github.sha }}
@@ -376,7 +376,7 @@ jobs:
# Push Release # Push Release
- name: Push the release - name: Push the release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1.21.0
with: with:
allowUpdates: true allowUpdates: true
artifacts: artifacts:
@@ -434,13 +434,13 @@ jobs:
# Checkout the branch # Checkout the branch
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
path: cygwin\maiko path: cygwin\maiko
# Checkout the actions for this repo owner # Checkout the actions for this repo owner
- name: Checkout Actions - name: Checkout Actions
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
repository: ${{ github.repository_owner }}/.github repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }} path: ./Actions_${{ github.sha }}
@@ -470,7 +470,7 @@ jobs:
# Push Release to github # Push Release to github
- name: Push the release - name: Push the release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1.21.0
with: with:
allowUpdates: true allowUpdates: true
artifacts: artifacts:
@@ -501,7 +501,7 @@ jobs:
# Checkout the actions for this repo owner # Checkout the actions for this repo owner
- name: Checkout Actions - name: Checkout Actions
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
repository: ${{ github.repository_owner }}/.github repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }} path: ./Actions_${{ github.sha }}
@@ -530,7 +530,7 @@ jobs:
# Checkout the maiko branch # Checkout the maiko branch
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v6
# Setup release tag # Setup release tag
- name: Setup Release Tag - name: Setup Release Tag
@@ -547,7 +547,7 @@ jobs:
# Push Release to github # Push Release to github
- name: Push the release - name: Push the release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1.21.0
with: with:
allowUpdates: true allowUpdates: true
artifacts: ${{ steps.tag.outputs.release_tag }}-emscripten.tgz artifacts: ${{ steps.tag.outputs.release_tag }}-emscripten.tgz
@@ -573,7 +573,7 @@ jobs:
steps: steps:
# Checkout the actions for this repo owner # Checkout the actions for this repo owner
- name: Checkout Actions - name: Checkout Actions
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
repository: ${{ github.repository_owner }}/.github repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }} path: ./Actions_${{ github.sha }}

View File

@@ -37,9 +37,12 @@ IF(NEED_LIB_M)
ENDIF() ENDIF()
IF (CMAKE_SYSTEM_NAME STREQUAL "Linux") IF (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(PkgConfig REQUIRED) CHECK_LIBRARY_EXISTS(c strlcat "" NO_NEED_FOR_LIBBSD)
pkg_check_modules(LIBBSD-OVERLAY REQUIRED IMPORTED_TARGET "libbsd-overlay") IF(NOT NO_NEED_FOR_LIBBSD)
SET(MAIKO_LIBRARIES ${MAIKO_LIBRARIES} PkgConfig::LIBBSD-OVERLAY) find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBBSD-OVERLAY REQUIRED IMPORTED_TARGET "libbsd-overlay")
SET(MAIKO_LIBRARIES ${MAIKO_LIBRARIES} PkgConfig::LIBBSD-OVERLAY)
ENDIF()
ENDIF() ENDIF()
SET (MAIKO_RELEASE 351 CACHE STRING "Release version to build. Release: 115, 200, 201, 210, 300, 350, 351") SET (MAIKO_RELEASE 351 CACHE STRING "Release version to build. Release: 115, 200, 201, 210, 300, 350, 351")
@@ -540,12 +543,29 @@ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/../" CACHE PATH "Installation prefix" FORCE) set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/../" CACHE PATH "Installation prefix" FORCE)
ENDIF() ENDIF()
execute_process( execute_process(
COMMAND sh -c "echo $(../bin/osversion).$(../bin/machinetype)" COMMAND sh "${CMAKE_SOURCE_DIR}/bin/osversion"
OUTPUT_VARIABLE release_dir OUTPUT_VARIABLE os_ver
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE res
) )
if(NOT res EQUAL 0)
message(FATAL_ERROR "osversion script failed")
endif()
execute_process(
COMMAND sh "${CMAKE_SOURCE_DIR}/bin/machinetype"
OUTPUT_VARIABLE machine_type
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE res
)
if(NOT res EQUAL 0)
message(FATAL_ERROR "machinetype script failed")
endif()
set(release_dir "${os_ver}.${machine_type}")
INSTALL(TARGETS lde DESTINATION ${release_dir}) INSTALL(TARGETS lde DESTINATION ${release_dir})
IF(MAIKO_DISPLAY_X11) IF(MAIKO_DISPLAY_X11)
INSTALL(TARGETS ldex ldeinit DESTINATION ${release_dir}) INSTALL(TARGETS ldex ldeinit DESTINATION ${release_dir})
ENDIF() ENDIF()

View File

@@ -1,15 +1,47 @@
# Common Options for All Linuxes # Common Options for All Linuxes
CC = gcc $(GCC_CFLAGS) include linux-compiler.mk
# CC = clang $(CLANG_CFLAGS)
include linux-libbsd.mk BSD_CFLAGS :=
BSD_LDFLAGS :=
ifeq ($(USE_LIBBSD),T)
# Use LIBBSD - but only if glibc < 2.38
# Because we only need strlcat, strlcpy and friends from libbsd
# and they are included in glibc from 2.38 on.
GLIBC_VERSION := $(shell getconf GNU_LIBC_VERSION | sed 's/glibc //')
GLIBC_CHECK := 0
ifneq ($(GLIBC_VERSION),)
GLIBC_CHECK := $(shell echo "$(GLIBC_VERSION) >= 2.38" | bc)
endif
ifneq ($(GLIBC_CHECK),1)
include linux-libbsd.mk
endif
endif
# OPTFLAGS is normally -O2. ifeq ($(USE_DISPLAY),x)
OPTFLAGS = -O2 -g3 include linux-x.mk
DEFAULT_TARGET := ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex
endif
ifeq ($(USE_DISPLAY),sdl)
include linux-sdl.mk
DEFAULT_TARGET := ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
endif
ifeq ($(USE_DISPLAY),init)
include linux-x.mk
DEFAULT_TARGET := ../$(OSARCHNAME)/ldeinit
endif
OPTFLAGS ?= -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) $(BSD_CFLAGS) $(ADDITIONAL_DFLAGS) DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) $(BSD_CFLAGS) $(ADDITIONAL_DFLAGS)
LDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS) LDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS)
LDELDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS)
ifeq ($(USE_DISPLAY),x)
LDELDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS)
else
LDELDFLAGS = -lc -lm $(BSD_LDFLAGS)
endif
OBJECTDIR = ../$(RELEASENAME)/ OBJECTDIR = ../$(RELEASENAME)/
default: $(DEFAULT_TARGET)

37
bin/linux-compiler.mk Normal file
View File

@@ -0,0 +1,37 @@
# Select whether to use clang or gcc
# Priority
# 1. If USE_COMPILER=gcc or USE_COMPILER=clang on make command line use the requested compiler.
# 2. If clang is installed use it.
# 3. Use gcc
EXISTS_GCC := $(shell /bin/sh -c "command -v gcc")
EXISTS_CLANG := $(shell /bin/sh -c "command -v clang")
ifeq ($(or $(EXISTS_GCC),$(EXISTS_CLANG)),)
$(error "Cannot find compiler: neither gcc nor clang. Exiting.")
endif
COMPILER :=
ifeq ($(USE_COMPILER),clang)
ifeq ($(EXISTS_CLANG),)
$(error "USE_COMPILER=clang, but cannot find the clang compiler. Exiting")
endif
COMPILER := clang
else ifeq ($(USE_COMPILER),gcc)
ifeq ($(EXISTS_GCC),)
$(error "USE_COMPILER=gcc given, but cannot find the gcc compiler. Exiting")
endif
COMPILER := gcc
else ifneq ($(EXISTS_CLANG),)
COMPILER := clang
else
COMPILER := gcc
endif
ifeq ($(COMPILER),)
$(error "Oops. Trying to select gcc or clang but should never get here")
endif
ifeq ($(COMPILER),gcc)
CC := gcc $(GCC_CFLAGS)
else
CC := clang $(CLANG_CFLAGS)
endif

View File

@@ -4,7 +4,7 @@
ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),cleanup) ifneq ($(MAKECMDGOALS),cleanup)
CHK_PKG_CONFIG := $(shell command -v pkg-config) CHK_PKG_CONFIG := $(shell /bin/sh -c "command -v pkg-config")
ifeq ($(CHK_PKG_CONFIG),) ifeq ($(CHK_PKG_CONFIG),)
# pkg-config not found, print an error # pkg-config not found, print an error
$(error "pkg-config not found. Please install it to build this project.") $(error "pkg-config not found. Please install it to build this project.")
@@ -12,13 +12,15 @@ ifneq ($(MAKECMDGOALS),clean)
CHK_LIBBSD_DEV := $(shell pkg-config --exists libbsd-overlay && echo true) CHK_LIBBSD_DEV := $(shell pkg-config --exists libbsd-overlay && echo true)
ifneq ($(CHK_LIBBSD_DEV),true) ifneq ($(CHK_LIBBSD_DEV),true)
$(error "libbsd-dev (or libbsd-devel) package not found. Please install it to build this project.") $(error "libbsd-dev (or libbsd-devel) package not found. Please install it to build this project.")
endif endif
endif
endif
BSD_CFLAGS = $(shell pkg-config --cflags libbsd-overlay) BSD_CFLAGS := $(shell pkg-config --cflags libbsd-overlay)
BSD_LDFLAGS := $(shell pkg-config --libs libbsd-overlay)
endif # clean
endif # cleanup
BSD_LDFLAGS = $(shell pkg-config --libs libbsd-overlay)

View File

@@ -10,5 +10,5 @@ XFILES = $(OBJECTDIR)sdl.o
# #
XFLAGS = -DSDL=2 XFLAGS = -DSDL=2
XLDFLAGS = -lSDL2 XLDFLAGS ?= -lSDL2

View File

@@ -1,26 +1,9 @@
# Options for Linux, Intel x86_64 and X-Window # Options for Linux, Intel x86_64 and X-Window
CC = gcc -m64 $(GCC_CFLAGS) -I/usr/local/include GCC_CFLAGS := -m64 $(GCC_CFLAGS) -I/usr/local/include
#CC = clang -m64 $(CLANG_CFLAGS) CLANG_CFLAGS := -m64 $(CLANG_CFLAGS) -I/usr/local/include
USE_DISPLAY=sdl
USE_LIBBSD=F
XLDFLAGS := -L/usr/local/lib -lSDL2
XFILES = $(OBJECTDIR)sdl.o include linux-common.mk
#
# For SDL version 2
# -DSDL=2 in XFLAGS and -lSDL2 in LDFLAGS
# For SDL version 3
# -DSDL=3 in XFLAGS and -lSDL3 in LDFLAGS
#
XFLAGS = -DSDL=2
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE)
LDFLAGS = -lm -L/usr/local/lib -lSDL2
#
LDELDFLAGS =
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@@ -1,28 +1,9 @@
# Options for Linux, Intel x86_64 and X-Window # Options for Cygwin, Intel x86_64 and X-Window
#CC = gcc -m64 $(GCC_CFLAGS) GCC_CFLAGS := -m64 $(GCC_CFLAGS)
CC = clang -m64 $(CLANG_CFLAGS) CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
USE_DISPLAY=x
USE_LIBBSD=F
XFILES = $(OBJECTDIR)xmkicon.o \ include linux-common.mk
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE)
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -1,12 +1,9 @@
# Options for Linux, aarch64 processor, X windows, for INIT processing # Options for Linux, aarch64 processor, X windows, for INIT processing
include linux-x.mk OPTFLAGS = -O0 -g
DEBUGFLAGS = DEBUGFLAGS =
ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT
USE_LIBBSD=T
USE_DISPLAY=init
include linux-common.mk include linux-common.mk
OPTFLAGS = -O0 -g
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -1,12 +1,9 @@
# Options for Linux, x86 processor, X windows, for INIT processing # Options for Linux, x86 processor, X windows, for INIT processing
include linux-x.mk OPTFLAGS = -O0 -g
DEBUGFLAGS = DEBUGFLAGS =
ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT
USE_LIBBSD=T
USE_DISPLAY=init
include linux-common.mk include linux-common.mk
OPTFLAGS = -O0 -g
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -1,29 +1,9 @@
# Options for Windows System for Linux v1, aarch64 processor, X windows, for INIT processing # Options for Windows System for Linux v1, aarch64 processor, X windows, for INIT processing
CC = gcc $(GCC_CFLAGS)
#CC = clang $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -DXWINDOW
# OPTFLAGS is normally -O2, for INIT we want unoptimized in case we need to debug it
OPTFLAGS = -O0 -g OPTFLAGS = -O0 -g
DEBUGFLAGS = DEBUGFLAGS =
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=$(RELEASE) -DNOVERSION -DINIT -D__wsl1__ ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT -D__wsl1__
USE_LIBBSD=T
USE_DISPLAY=init
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd include linux-common.mk
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -1,29 +1,9 @@
# Options for Windows System for Linux v1, Intel x86_64 processor, X windows, for INIT processing # Options for Windows System for Linux v1, Intel x86_64 processor, X windows, for INIT processing
CC = gcc $(GCC_CFLAGS)
#CC = clang $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -DXWINDOW
# OPTFLAGS is normally -O2, for INIT we want unoptimized in case we need to debug it
OPTFLAGS = -O0 -g OPTFLAGS = -O0 -g
DEBUGFLAGS = DEBUGFLAGS =
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=$(RELEASE) -DNOVERSION -DINIT -D__wsl1__ ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT -D__wsl1__
USE_LIBBSD=T
USE_DISPLAY=init
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd include linux-common.mk
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -1,10 +1,8 @@
# Options for Linux, Intel 386/486 and SDL # Options for Linux, Intel 386/486 and SDL
GCC_CFLAGS := -m64 $(GCC_CFLAGS) GCC_CFLAGS := -m32 $(GCC_CFLAGS)
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS) CLANG_CFLAGS := -m32 $(CLANG_CFLAGS)
USE_DISPLAY=sdl
include linux-sdl.mk USE_LIBBSD=T
include linux-common.mk include linux-common.mk
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@@ -2,9 +2,7 @@
GCC_CFLAGS := -m32 $(GCC_CFLAGS) GCC_CFLAGS := -m32 $(GCC_CFLAGS)
CLANG_CFLAGS := -m32 $(CLANG_CFLAGS) CLANG_CFLAGS := -m32 $(CLANG_CFLAGS)
USE_DISPLAY=x
include linux-x.mk USE_LIBBSD=T
include linux-common.mk include linux-common.mk
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -1,7 +1,6 @@
# Options for Linux, ARM64 and SDL # Options for Linux, ARM64 and SDL
include linux-sdl.mk USE_DISPLAY=sdl
USE_LIBBSD=T
include linux-common.mk include linux-common.mk
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@@ -1,7 +1,6 @@
# Options for Linux, aarch64 and X-Window # Options for Linux, aarch64 and X-Window
include linux-x.mk USE_DISPLAY=x
USE_LIBBSD=T
include linux-common.mk include linux-common.mk
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -1,7 +1,6 @@
# Options for Linux, ARMv7 and SDL # Options for Linux, ARMv7 and SDL
include linux-sdl.mk USE_DISPLAY=sdl
USE_LIBBSD=T
include linux-common.mk include linux-common.mk
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@@ -1,7 +1,6 @@
# Options for Linux, ARMv7 and X-Window # Options for Linux, ARMv7 and X-Window
include linux-x.mk USE_DISPLAY=x
USE_LIBBSD=T
include linux-common.mk include linux-common.mk
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -2,9 +2,7 @@
GCC_CFLAGS := -m64 $(GCC_CFLAGS) GCC_CFLAGS := -m64 $(GCC_CFLAGS)
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS) CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
USE_DISPLAY=sdl
include linux-sdl.mk USE_LIBBSD=T
include linux-common.mk include linux-common.mk
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@@ -2,9 +2,8 @@
GCC_CFLAGS := -m64 $(GCC_CFLAGS) GCC_CFLAGS := -m64 $(GCC_CFLAGS)
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS) CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
USE_DISPLAY=x
include linux-x.mk USE_LIBBSD=T
include linux-common.mk include linux-common.mk
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -1,25 +1,7 @@
# Options for Windows System for Linux v1, ARM64 and SDL # Options for Windows System for Linux v1, ARM64 and SDL
CC = gcc $(GCC_CFLAGS) USE_DISPLAY=sdl
#CC = clang $(CLANG_CFLAGS) USE_LIBBSD=T
ADDITIONAL_DFLAGS := -D__wsl1__
XFILES = $(OBJECTDIR)sdl.o include linux-common.mk
#
# For SDL version 2
# -DSDL=2 in SDLFLAGS and -lSDL2 in LDFLAGS
# For SDL version 3
# -DSDL=3 in SDLFLAGS and -lSDL3 in LDFLAGS
#
SDLFLAGS = -DSDL=2
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(SDLFLAGS) -DRELEASE=$(RELEASE) -D__wsl1__
LDFLAGS = -lSDL2 -lm -lbsd
LDELDFLAGS = -lbsd
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@@ -1,27 +1,7 @@
# Options for Windows System for Linux v1, aarch64 and X-Window # Options for Windows System for Linux v1, aarch64 and X-Window
CC = gcc $(GCC_CFLAGS) USE_DISPLAY=x
#CC = clang $(CLANG_CFLAGS) USE_LIBBSD=T
ADDITIONAL_DFLAGS := -D__wsl1__
XFILES = $(OBJECTDIR)xmkicon.o \ include linux-common.mk
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) -D__wsl1__
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -1,25 +1,9 @@
# Options for Windows System for Linux v1, Intel x86_64 and SDL # Options for Windows System for Linux v1, Intel x86_64 and SDL
CC = gcc -m64 $(GCC_CFLAGS) GCC_CFLAGS := -m64 $(GCC_CFLAGS)
# CC = clang -m64 $(CLANG_CFLAGS) CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
USE_DISPLAY=sdl
USE_LIBBSD=T
ADDITIONAL_DFLAGS := -D__wsl1__
XFILES = $(OBJECTDIR)sdl.o include linux-common.mk
#
# For SDL version 2
# -DSDL=2 in XFLAGS and -lSDL2 in LDFLAGS
# For SDL version 3
# -DSDL=3 in XFLAGS and -lSDL3 in LDFLAGS
#
XFLAGS = -DSDL=2
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) -D__wsl1__
LDFLAGS = -lm -lSDL2 -lbsd
LDELDFLAGS = -lbsd
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl

View File

@@ -1,28 +1,9 @@
# Options for Windows System for Linux v1, Intel x86_64 and X-Window # Options for Windows System for Linux v1, Intel x86_64 and X-Window
CC = gcc -m64 $(GCC_CFLAGS) GCC_CFLAGS := -m64 $(GCC_CFLAGS)
# CC = clang -m64 $(CLANG_CFLAGS) CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
USE_DISPLAY=x
USE_LIBBSD=T
ADDITIONAL_DFLAGS := -D__wsl1__
XFILES = $(OBJECTDIR)xmkicon.o \ include linux-common.mk
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) -D__wsl1__
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -65,21 +65,28 @@ typedef struct closure_type {
#endif /* BIGVM */ #endif /* BIGVM */
typedef struct interrupt_state { /* Interrupt-request mask to communicate with INTERRUPTED */ typedef struct interrupt_state { /* Interrupt-request mask to communicate with INTERRUPTED */
unsigned LogFileIO : 1; /* console msg arrived to print */ DLword LogFileIO : 1; /* console msg arrived to print */
unsigned ETHERInterrupt : 1; /* 10MB activity happened */ DLword ETHERInterrupt : 1; /* 10MB activity happened */
unsigned IOInterrupt : 1; /* I/O happened (not used yet) */ DLword IOInterrupt : 1; /* I/O happened (not used yet) */
unsigned gcdisabled : 1; DLword gcdisabled : 1;
unsigned vmemfull : 1; DLword vmemfull : 1;
unsigned stackoverflow : 1; DLword stackoverflow : 1;
unsigned storagefull : 1; DLword storagefull : 1;
unsigned waitinginterrupt : 1; DLword waitinginterrupt : 1;
unsigned nil : 8; /* mask of ints being processed */ DLword P_LogFileIO : 1; /* interrupts awaiting processing, cleared by Lisp */
DLword P_ETHERInterrupt : 1;
DLword P_IOInterrupt : 1;
DLword P_gcdisabled : 1;
DLword P_vmemfull : 1;
DLword P_stackoverflow : 1;
DLword P_storagefull : 1;
DLword P_waitinginterrupt : 1;
DLword intcharcode; DLword intcharcode;
} INTSTAT; } INTSTAT;
typedef struct interrupt_state_2 { /* alternate view of the interrupt state */ typedef struct interrupt_state_2 { /* alternate view of the interrupt state */
unsigned pendingmask : 8; DLword pendingmask : 8;
unsigned handledmask : 8; DLword handledmask : 8;
DLword nil; DLword nil;
} INTSTAT2; } INTSTAT2;
@@ -204,21 +211,28 @@ typedef struct closure_type {
typedef struct interrupt_state { /* Interrupt-request mask to communicate with INTERRUPTED */ typedef struct interrupt_state { /* Interrupt-request mask to communicate with INTERRUPTED */
DLword intcharcode; DLword intcharcode;
unsigned nil : 8; DLword P_waitinginterrupt : 1; /* interrupts awaiting processing, cleared by Lisp */
unsigned waitinginterrupt : 1; DLword P_storagefull : 1;
unsigned storagefull : 1; DLword P_stackoverflow : 1;
unsigned stackoverflow : 1; DLword P_vmemfull : 1;
unsigned vmemfull : 1; DLword P_gcdisabled : 1;
unsigned gcdisabled : 1; DLword P_IOInterrupt : 1;
unsigned IOInterrupt : 1; /* I/O happened (not used yet) */ DLword P_ETHERInterrupt : 1;
unsigned ETHERInterrupt : 1; /* 10MB activity happened */ DLword P_LogFileIO : 1;
unsigned LogFileIO : 1; /* console msg arrived to print */ DLword waitinginterrupt : 1;
DLword storagefull : 1;
DLword stackoverflow : 1;
DLword vmemfull : 1;
DLword gcdisabled : 1;
DLword IOInterrupt : 1; /* I/O happened (not used yet) */
DLword ETHERInterrupt : 1; /* 10MB activity happened */
DLword LogFileIO : 1; /* console msg arrived to print */
} INTSTAT; } INTSTAT;
typedef struct interrupt_state_2 { /* alternate view of the interrupt state */ typedef struct interrupt_state_2 { /* alternate view of the interrupt state */
DLword nil; DLword nil;
unsigned handledmask : 8; DLword handledmask : 8;
unsigned pendingmask : 8; DLword pendingmask : 8;
} INTSTAT2; } INTSTAT2;
struct state { struct state {

View File

@@ -11,6 +11,7 @@
#include <errno.h> #include <errno.h>
#include <limits.h> /* for NAME_MAX */ #include <limits.h> /* for NAME_MAX */
#include <dirent.h> /* for MAXNAMLEN */ #include <dirent.h> /* for MAXNAMLEN */
#include <string.h> /* for strncpy in non-BYTESWAP case */
#include "lispemul.h" /* for DLword */ #include "lispemul.h" /* for DLword */
#include "commondefs.h" /* for error */ #include "commondefs.h" /* for error */

View File

@@ -297,12 +297,10 @@ static int recvPacket(void) {
#if defined(BYTESWAP) #if defined(BYTESWAP)
log_debug((" recvPacket() :: byte-swapping %d bytes at %p\n", bLen, (void *)ether_buf)); log_debug((" recvPacket() :: byte-swapping %d bytes at %p\n", bLen, (void *)ether_buf));
dblwordsSwap(ether_buf, bLen); dblwordsSwap(ether_buf, bLen);
IOPage->dlethernet[2] = bLen;
#else #else
log_debug((" recvPacket() :: %d bytes at %p\n", bLen, (void *)ether_buf)); log_debug((" recvPacket() :: %d bytes at %p\n", bLen, (void *)ether_buf));
IOPage->dlethernet[3] = bLen;
#endif #endif
((DLETHERCSB *)IOPage->dlethernet)->DLFIRSTICB = blen;
ether_bsize = 0; ether_bsize = 0;

View File

@@ -477,7 +477,7 @@ int *ether_debug(void) {
estat[0] = 0; estat[0] = 0;
if (ether_fd < 0) return (NIL); if (ether_fd < 0) return (NIL);
printf("fd %d bsize %d buf %p icb %X in %d out %d\n ", ether_fd, ether_bsize, (void *)ether_buf, printf("fd %d bsize %d buf %p icb %X in %d out %d\n ", ether_fd, ether_bsize, (void *)ether_buf,
IOPage->dlethernet[3], ether_in, ether_out); ((DLETHERCSB *)IOPage->dlethernet)->DLFIRSTICB, ether_in, ether_out);
#endif /* MAIKO_ENABLE_ETHERNET */ #endif /* MAIKO_ENABLE_ETHERNET */
return (estat); return (estat);
@@ -542,7 +542,7 @@ LispPTR check_ether(void) {
memcpy(&ether_buf[0], &nit_buf[nitpos], fromlen); memcpy(&ether_buf[0], &nit_buf[nitpos], fromlen);
ether_bsize = 0; /* deactivate receiver */ ether_bsize = 0; /* deactivate receiver */
ether_in++; ether_in++;
IOPage->dlethernet[3] = fromlen; ((DLETHERCSB *)IOPage->dlethernet)->DLFIRSTICB = fromlen;
DBPRINT( DBPRINT(
("Found packet len %d, at pos %d in buflen %d.\n", fromlen, nitpos, nitlen)); ("Found packet len %d, at pos %d in buflen %d.\n", fromlen, nitpos, nitlen));
nitpos += fromlen; nitpos += fromlen;
@@ -586,7 +586,7 @@ LispPTR check_ether(void) {
memcpy(&ether_buf[0], nit_buf, data.len); memcpy(&ether_buf[0], nit_buf, data.len);
ether_bsize = 0; ether_bsize = 0;
ether_in++; ether_in++;
IOPage->dlethernet[3] = data.len; ((DLETHERCSB *)IOPage->dlethernet)->DLFIRSTICB = data.len;
((INTSTAT *)NativeAligned4FromLAddr(*INTERRUPTSTATE_word))->ETHERInterrupt = 1; ((INTSTAT *)NativeAligned4FromLAddr(*INTERRUPTSTATE_word))->ETHERInterrupt = 1;
ETHEREventCount++; ETHEREventCount++;
Irq_Stk_Check = Irq_Stk_End = 0; Irq_Stk_Check = Irq_Stk_End = 0;
@@ -649,7 +649,7 @@ LispPTR get_packet(void) {
memcpy(&ether_buf[0], &nit_buf[nitpos], fromlen); memcpy(&ether_buf[0], &nit_buf[nitpos], fromlen);
ether_bsize = 0; /* deactivate receiver */ ether_bsize = 0; /* deactivate receiver */
ether_in++; ether_in++;
IOPage->dlethernet[3] = fromlen; ((DLETHERCSB *)IOPage->dlethernet)->DLFIRSTICB = fromlen;
DBPRINT(("Found packet len %d, at pos %d in buflen %d.\n", fromlen, nitpos, nitlen)); DBPRINT(("Found packet len %d, at pos %d in buflen %d.\n", fromlen, nitpos, nitlen));
nitpos += fromlen; nitpos += fromlen;
return (ATOM_T); return (ATOM_T);
@@ -683,7 +683,7 @@ LispPTR get_packet(void) {
memcpy(&ether_buf[0], nit_buf, data.len); memcpy(&ether_buf[0], nit_buf, data.len);
ether_bsize = 0; ether_bsize = 0;
ether_in++; ether_in++;
IOPage->dlethernet[3] = data.len; ((DLETHERCSB *)IOPage->dlethernet)->DLFIRSTICB = data.len;
return (ATOM_T); return (ATOM_T);
} }
} else if (errno != EWOULDBLOCK) } else if (errno != EWOULDBLOCK)

View File

@@ -17,6 +17,8 @@
#include <stdbool.h> // for false, bool, true #include <stdbool.h> // for false, bool, true
#include <stdio.h> // for NULL #include <stdio.h> // for NULL
#include <stdlib.h> // for exit #include <stdlib.h> // for exit
#include <fcntl.h> // for fcntl, O_ASYNC, ...
#include <unistd.h> // for getpid
#include "adr68k.h" // for NativeAligned4FromLAddr #include "adr68k.h" // for NativeAligned4FromLAddr
#include "dbprint.h" // for TPRINT #include "dbprint.h" // for TPRINT
#include "devif.h" // for (anonymous), MRegion, DspInterface, OUTER_S... #include "devif.h" // for (anonymous), MRegion, DspInterface, OUTER_S...
@@ -248,6 +250,7 @@ DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, unsigned width_hint, u
unsigned depth_hint) unsigned depth_hint)
{ {
Screen *Xscreen; Screen *Xscreen;
int xfd;
dsp->identifier = Display_Name; /* This is a hack. The display name */ dsp->identifier = Display_Name; /* This is a hack. The display name */
/* has to dealt with in a more */ /* has to dealt with in a more */
@@ -360,5 +363,12 @@ DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, unsigned width_hint, u
break; break;
} }
XInitImage(&dsp->ScreenBitmap); XInitImage(&dsp->ScreenBitmap);
#if defined(O_ASYNC)
xfd = ConnectionNumber(dsp->display_id);
if (fcntl(xfd, F_SETOWN, getpid()) == -1) perror("X_init: fcntl F_SETOWN error");
if (fcntl(xfd, F_SETFL, fcntl(xfd, F_GETFL, 0) | O_ASYNC) == -1) perror("X_init: fcntl F_SETFL O_ASYNC error");
#endif
return (dsp); return (dsp);
} }