From a630855b7e5849243217a50575c2024fb2d1ec86 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Thu, 26 Mar 2026 21:39:03 -0500 Subject: [PATCH] Serial libraries added to DVX. --- Makefile | 8 +++-- config/serial.dep | 2 ++ core/platform/dvxPlatformDos.c | 14 +++++++++ serial/Makefile | 56 ++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 config/serial.dep create mode 100644 serial/Makefile diff --git a/Makefile b/Makefile index 6e1ee64..12cbb6d 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,9 @@ # Builds the full DVX stack: core library, task switcher, # bootstrap loader, text help library, widgets, shell, and apps. -.PHONY: all clean core tasks loader texthelp listhelp widgets shell taskmgr apps tools +.PHONY: all clean core tasks loader texthelp listhelp widgets shell taskmgr serial apps tools -all: core tasks loader texthelp listhelp widgets shell taskmgr apps tools +all: core tasks loader texthelp listhelp widgets shell taskmgr serial apps tools core: $(MAKE) -C core @@ -31,6 +31,9 @@ shell: core tasks taskmgr: shell $(MAKE) -C taskmgr +serial: core tasks + $(MAKE) -C serial + tools: $(MAKE) -C tools @@ -46,6 +49,7 @@ clean: $(MAKE) -C widgets clean $(MAKE) -C shell clean $(MAKE) -C taskmgr clean + $(MAKE) -C serial clean $(MAKE) -C apps clean $(MAKE) -C tools clean -rmdir obj 2>/dev/null diff --git a/config/serial.dep b/config/serial.dep new file mode 100644 index 0000000..2afaca0 --- /dev/null +++ b/config/serial.dep @@ -0,0 +1,2 @@ +libtasks +libdvx diff --git a/core/platform/dvxPlatformDos.c b/core/platform/dvxPlatformDos.c index 86e56ff..216a9f4 100644 --- a/core/platform/dvxPlatformDos.c +++ b/core/platform/dvxPlatformDos.c @@ -2323,6 +2323,10 @@ extern void *__emutls_get_address(void *); // dvxLog lives in dvx.exe (loaderMain.c) extern void dvxLog(const char *fmt, ...); +// DPMI/go32 internals needed by the serial driver (rs232) +#include +#include + extern void *stbds_arrgrowf(void *a, size_t elemsize, size_t addlen, size_t min_cap); extern void stbds_arrfreef(void *a); extern void stbds_hmfree_func(void *a, size_t elemsize); @@ -2389,6 +2393,16 @@ DXE_EXPORT_TABLE(sDxeExportTable) // --- dvx logging (lives in dvx.exe, used by all modules) --- DXE_EXPORT(dvxLog) + // --- DPMI/go32 (needed by rs232 serial driver) --- + DXE_EXPORT(__dpmi_get_segment_base_address) + DXE_EXPORT(__dpmi_lock_linear_region) + DXE_EXPORT(__dpmi_unlock_linear_region) + DXE_EXPORT(_go32_dpmi_allocate_iret_wrapper) + DXE_EXPORT(_go32_dpmi_free_iret_wrapper) + DXE_EXPORT(_go32_dpmi_get_protected_mode_interrupt_vector) + DXE_EXPORT(_go32_dpmi_set_protected_mode_interrupt_vector) + DXE_EXPORT(_go32_info_block) + // --- memory --- // --- memory (tracked wrappers replace libc for DXE code) --- { "_calloc", (void *)dvxCalloc }, diff --git a/serial/Makefile b/serial/Makefile new file mode 100644 index 0000000..f6faa57 --- /dev/null +++ b/serial/Makefile @@ -0,0 +1,56 @@ +# DVX Serial Stack Makefile for DJGPP cross-compilation +# +# Builds serial.lib -- combines rs232, packet, security, and seclink +# into a single DXE library loaded by the DVX system. + +DJGPP_PREFIX = $(HOME)/djgpp/djgpp +CC = $(DJGPP_PREFIX)/bin/i586-pc-msdosdjgpp-gcc +DXE3GEN = PATH=$(DJGPP_PREFIX)/bin:$(PATH) DJDIR=$(DJGPP_PREFIX)/i586-pc-msdosdjgpp $(DJGPP_PREFIX)/i586-pc-msdosdjgpp/bin/dxe3gen +CFLAGS = -O2 -Wall -Wextra -march=i486 -mtune=i586 -I../rs232 -I../packet -I../security -I../seclink -I../core -I../core/platform -I../tasks + +OBJDIR = ../obj/serial +LIBSDIR = ../bin/libs + +SRCS = ../rs232/rs232.c ../packet/packet.c ../security/security.c ../seclink/secLink.c +OBJS = $(OBJDIR)/rs232.o $(OBJDIR)/packet.o $(OBJDIR)/security.o $(OBJDIR)/secLink.o +TARGET = $(LIBSDIR)/serial.lib + +.PHONY: all clean + +all: $(TARGET) $(LIBSDIR)/serial.dep + +$(LIBSDIR)/serial.dep: ../config/serial.dep | $(LIBSDIR) + sed 's/$$/\r/' $< > $@ + +$(TARGET): $(OBJS) | $(LIBSDIR) + $(DXE3GEN) -o $(LIBSDIR)/serial.dxe \ + -E _rs232 -E _pkt -E _secLink -E _secDh -E _secCipher -E _secRng \ + -U $(OBJS) + mv $(LIBSDIR)/serial.dxe $@ + +$(OBJDIR)/rs232.o: ../rs232/rs232.c | $(OBJDIR) + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJDIR)/packet.o: ../packet/packet.c | $(OBJDIR) + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJDIR)/security.o: ../security/security.c | $(OBJDIR) + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJDIR)/secLink.o: ../seclink/secLink.c | $(OBJDIR) + $(CC) $(CFLAGS) -c -o $@ $< + +$(OBJDIR): + mkdir -p $(OBJDIR) + +$(LIBSDIR): + mkdir -p $(LIBSDIR) + +# Dependencies +$(OBJDIR)/rs232.o: ../rs232/rs232.c ../rs232/rs232.h +$(OBJDIR)/packet.o: ../packet/packet.c ../packet/packet.h ../rs232/rs232.h +$(OBJDIR)/security.o: ../security/security.c ../security/security.h +$(OBJDIR)/secLink.o: ../seclink/secLink.c ../seclink/secLink.h ../rs232/rs232.h ../packet/packet.h ../security/security.h + +clean: + rm -f $(OBJS) $(TARGET) $(LIBSDIR)/serial.dep