From 874c23f247c4aea9f8c1f9d7cd6a6a8a0ccce15f Mon Sep 17 00:00:00 2001 From: Greg Haerr Date: Sat, 23 Nov 2024 18:05:43 -0800 Subject: [PATCH 1/4] [cmds] Get hostdisasm working again --- elkscmd/Applications | 2 +- elkscmd/debug/.gitignore | 6 +++--- elkscmd/debug/Makefile | 8 ++++---- elkscmd/debug/disasm.h | 6 +++++- libc/ia16.inc | 2 +- libc/include/debug/instrument.h | 4 ++++ libc/include/debug/syms.h | 4 ++++ libc/watcom.inc | 2 +- 8 files changed, 23 insertions(+), 11 deletions(-) diff --git a/elkscmd/Applications b/elkscmd/Applications index c0eba45f9..3e62b5d73 100644 --- a/elkscmd/Applications +++ b/elkscmd/Applications @@ -214,6 +214,6 @@ basic/basic :basic :1200k advent/advent :other :1440c advent/advent.db ::lib/advent.db :other :1440c debug/disasm :other :1440k -debug/nm :other :1440c +debug/nm86 :other :1440c debug/system.sym ::lib/system.sym :other :1440c debug/testsym :other :1440c diff --git a/elkscmd/debug/.gitignore b/elkscmd/debug/.gitignore index 58b6974eb..819516bb2 100644 --- a/elkscmd/debug/.gitignore +++ b/elkscmd/debug/.gitignore @@ -1,7 +1,7 @@ *.o +disasm nm86 -nm +opcodes testsym -disasm hostdisasm -opcodes +hostnm diff --git a/elkscmd/debug/Makefile b/elkscmd/debug/Makefile index b997d81db..56d508c9a 100644 --- a/elkscmd/debug/Makefile +++ b/elkscmd/debug/Makefile @@ -18,9 +18,9 @@ LDFLAGS += -maout-symtab ############################################################################### -PRGS = testsym disasm nm opcodes +PRGS = testsym disasm nm86 opcodes -HOSTPRGS = nm86 hostdisasm +HOSTPRGS = hostnm86 hostdisasm HOSTCFLAGS += -I. -I$(TOPDIR)/elks/include SYMS_C = $(TOPDIR)/libc/debug/syms.c @@ -35,7 +35,7 @@ testsym: testsym.o disasm: dis.o disasm.o $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) -nm: nm86.o +nm86: nm86.o $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) system.sym: @@ -54,7 +54,7 @@ dis.o: dis.c nm86.o: nm86.c $(CC) $(CFLAGS) $(NOINSTFLAGS) -c -o $*.o $< -nm86: nm86.c $(SYMS_C) +hostnm86: nm86.c $(SYMS_C) $(HOSTCC) $(HOSTCFLAGS) -D__far= -o $@ $^ hostdisasm: dis.c disasm.c $(SYMS_C) diff --git a/elkscmd/debug/disasm.h b/elkscmd/debug/disasm.h index 307d93e38..60c0ca7af 100644 --- a/elkscmd/debug/disasm.h +++ b/elkscmd/debug/disasm.h @@ -1,6 +1,10 @@ /* ELKS disassembler header file */ -#define noinstrument __attribute__((no_instrument_function)) +#ifdef __ELKS__ +#include +#else +#define noinstrument +#endif /* to be defined by caller of disasm() */ char * noinstrument getsymbol(int seg, int offset); diff --git a/libc/ia16.inc b/libc/ia16.inc index 978c1b365..1b947afb9 100644 --- a/libc/ia16.inc +++ b/libc/ia16.inc @@ -1,7 +1,7 @@ # Makefile include for ia16-elf-gcc build INCLUDES=-I$(TOPDIR)/include -I$(TOPDIR)/libc/include -I$(TOPDIR)/elks/include -DEFINES=-D__LIBC__ +DEFINES=-D__LIBC__ -D__ELKS__ LIBOBJS=$(OBJS) INCS=$(INCLUDES) diff --git a/libc/include/debug/instrument.h b/libc/include/debug/instrument.h index 3caaff4ec..3f4851dc1 100644 --- a/libc/include/debug/instrument.h +++ b/libc/include/debug/instrument.h @@ -1,6 +1,10 @@ /* ELKS stack trace and instrumentation functions library */ /* Jan 2023 Greg Haerr */ +#ifdef __ELKS__ #include +#else +#define noinstrument +#endif /* calc_push_count returns */ #define BP_PUSHED 0x0100 diff --git a/libc/include/debug/syms.h b/libc/include/debug/syms.h index 78db91f74..c27c7e6f6 100644 --- a/libc/include/debug/syms.h +++ b/libc/include/debug/syms.h @@ -1,5 +1,9 @@ /* ELKS symbol table support */ +#ifdef __ELKS__ #include +#else +#define noinstrument +#endif /* symbol table format * | byte type | word address | byte symbol length | symbol | diff --git a/libc/watcom.inc b/libc/watcom.inc index 3f33c2036..4b46fcfd4 100644 --- a/libc/watcom.inc +++ b/libc/watcom.inc @@ -10,7 +10,7 @@ endif INCLUDES = -I$(TOPDIR)/libc/include -I$(TOPDIR)/elks/include INCLUDES += -I$(WATCOM)/h -DEFINES = -D__LIBC__ +DEFINES = -D__LIBC__ -D__ELKS__ LIBOBJS=$(OBJS:.o=.obj) include $(TOPDIR)/libc/watcom.model From a2e0bd277eec62c87abbdcde95b188e3cb5adb54 Mon Sep 17 00:00:00 2001 From: Greg Haerr Date: Sat, 23 Nov 2024 18:21:49 -0800 Subject: [PATCH 2/4] Cleanup --- elkscmd/debug/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elkscmd/debug/.gitignore b/elkscmd/debug/.gitignore index 819516bb2..4165e26e3 100644 --- a/elkscmd/debug/.gitignore +++ b/elkscmd/debug/.gitignore @@ -4,4 +4,4 @@ nm86 opcodes testsym hostdisasm -hostnm +hostnm86 From a331044444d5fc3a2c5b40cbd5687d165bd72077 Mon Sep 17 00:00:00 2001 From: Greg Haerr Date: Sat, 23 Nov 2024 18:41:15 -0800 Subject: [PATCH 3/4] Revert __ELKS__ addition --- libc/ia16.inc | 2 +- libc/include/debug/instrument.h | 2 +- libc/include/debug/syms.h | 2 +- libc/watcom.inc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libc/ia16.inc b/libc/ia16.inc index 1b947afb9..978c1b365 100644 --- a/libc/ia16.inc +++ b/libc/ia16.inc @@ -1,7 +1,7 @@ # Makefile include for ia16-elf-gcc build INCLUDES=-I$(TOPDIR)/include -I$(TOPDIR)/libc/include -I$(TOPDIR)/elks/include -DEFINES=-D__LIBC__ -D__ELKS__ +DEFINES=-D__LIBC__ LIBOBJS=$(OBJS) INCS=$(INCLUDES) diff --git a/libc/include/debug/instrument.h b/libc/include/debug/instrument.h index 3f4851dc1..fb8c8bbf0 100644 --- a/libc/include/debug/instrument.h +++ b/libc/include/debug/instrument.h @@ -1,6 +1,6 @@ /* ELKS stack trace and instrumentation functions library */ /* Jan 2023 Greg Haerr */ -#ifdef __ELKS__ +#if defined(__ia16__) || defined(__WATCOMC__) #include #else #define noinstrument diff --git a/libc/include/debug/syms.h b/libc/include/debug/syms.h index c27c7e6f6..6cee55fd8 100644 --- a/libc/include/debug/syms.h +++ b/libc/include/debug/syms.h @@ -1,5 +1,5 @@ /* ELKS symbol table support */ -#ifdef __ELKS__ +#if defined(__ia16__) || defined(__WATCOMC__) #include #else #define noinstrument diff --git a/libc/watcom.inc b/libc/watcom.inc index 4b46fcfd4..3f33c2036 100644 --- a/libc/watcom.inc +++ b/libc/watcom.inc @@ -10,7 +10,7 @@ endif INCLUDES = -I$(TOPDIR)/libc/include -I$(TOPDIR)/elks/include INCLUDES += -I$(WATCOM)/h -DEFINES = -D__LIBC__ -D__ELKS__ +DEFINES = -D__LIBC__ LIBOBJS=$(OBJS:.o=.obj) include $(TOPDIR)/libc/watcom.model From a1018c2bde3542135e36ed2e70b9c1810cb91ea2 Mon Sep 17 00:00:00 2001 From: Greg Haerr Date: Sat, 23 Nov 2024 18:51:09 -0800 Subject: [PATCH 4/4] Make hosthd also --- elkscmd/debug/disasm.h | 2 +- elkscmd/misc_utils/.gitignore | 3 ++- elkscmd/misc_utils/Makefile | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/elkscmd/debug/disasm.h b/elkscmd/debug/disasm.h index 60c0ca7af..232da4e3b 100644 --- a/elkscmd/debug/disasm.h +++ b/elkscmd/debug/disasm.h @@ -1,6 +1,6 @@ /* ELKS disassembler header file */ -#ifdef __ELKS__ +#if defined(__ia16__) || defined(__WATCOMC__) #include #else #define noinstrument diff --git a/elkscmd/misc_utils/.gitignore b/elkscmd/misc_utils/.gitignore index fe88c9d7a..9520484df 100644 --- a/elkscmd/misc_utils/.gitignore +++ b/elkscmd/misc_utils/.gitignore @@ -1,6 +1,5 @@ miniterm compress -hostcompress ed float tar @@ -15,3 +14,5 @@ uncompress uuencode uudecode zcat +hostcompress +hosthd diff --git a/elkscmd/misc_utils/Makefile b/elkscmd/misc_utils/Makefile index b73884fbd..6dbc23c84 100644 --- a/elkscmd/misc_utils/Makefile +++ b/elkscmd/misc_utils/Makefile @@ -9,7 +9,7 @@ include $(BASEDIR)/Makefile-rules #TODO: fix uncompress zcat lpfilter disabled PRGS = tar miniterm ed od hd time kilo mined sleep tty uuencode uudecode compress -HOSTPRGS = hostcompress +HOSTPRGS = hostcompress hosthd all: $(PRGS) @@ -54,6 +54,9 @@ uuencode: uuencode.o uudecode: uudecode.o $(LD) $(LDFLAGS) -o uudecode uudecode.o $(LDLIBS) +hosthd: hd.c + $(HOSTCC) $(HOSTCFLAGS) -D__far= hd.c -o $@ + hostcompress: compress.c $(HOSTCC) $(HOSTCFLAGS) compress.c -o $@