diff --git a/README.md b/README.md index 3a70d53e..ba743650 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ #### Updated HP2100 simulator from Dave Bryan. +### New Host Platform support - HP-UX and AIX + ### New Functionality #### Remote Console Facility diff --git a/makefile b/makefile index a56657ed..531cf2a8 100644 --- a/makefile +++ b/makefile @@ -7,6 +7,7 @@ # NetBSD # FreeBSD # HP-UX +# AIX # Windows (MinGW & cygwin) # Linux x86 targeting Android (using agcc script) # @@ -91,8 +92,8 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) endif endif ifeq (HP-UX,$(OSTYPE)) - ifneq (,$(shell what `which $(firstword $(GCC))` | grep -i compiler)) - COMPILER_NAME = $(strip $(shell what `which $(firstword $(GCC))` | grep -i compiler)) + ifneq (,$(shell what `which $(firstword $(GCC)) 2>&1`| grep -i compiler)) + COMPILER_NAME = $(strip $(shell what `which $(firstword $(GCC)) 2>&1` | grep -i compiler)) endif endif endif @@ -178,25 +179,37 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) PCAPLIB = wpcap LIBEXT = a else - ifeq (,$(findstring NetBSD,$(OSTYPE))) - ifneq (no ldconfig,$(wordlist 1,2,$(shell which ldconfig))) - LDSEARCH :=$(shell ldconfig -r | grep 'search directories' | awk '{print $$3}' | sed 's/:/ /g') + ifneq (,$(findstring AIX,$(OSTYPE))) + OS_LDFLAGS += -lm -lrt + ifeq (incopt,$(shell if $(TEST) -d /opt/freeware/include; then echo incopt; fi)) + INCPATH += /opt/freeware/include + OS_CCDEFS += -I/opt/freeware/include endif - ifneq (,$(LDSEARCH)) - LIBPATH := $(LDSEARCH) - else - ifeq (,$(strip $(LPATH))) - $(info *** Warning ***) - $(info *** Warning *** The library search path on your $(OSTYPE) platform can't be) - $(info *** Warning *** determined. This should be resolved before you can expect) - $(info *** Warning *** to have fully working simulators.) - $(info *** Warning ***) - $(info *** Warning *** You can specify your library paths via the LPATH environment) - $(info *** Warning *** variable.) - $(info *** Warning ***) + ifeq (libopt,$(shell if $(TEST) -d /opt/freeware/lib; then echo libopt; fi)) + LIBPATH += /opt/freeware/lib + OS_LDFLAGS += -L/opt/freeware/lib + endif + else + ifeq (,$(findstring NetBSD,$(OSTYPE))) + ifneq (no ldconfig,$(findstring no ldconfig,$(shell which ldconfig 2>&1))) + LDSEARCH :=$(shell ldconfig -r | grep 'search directories' | awk '{print $$3}' | sed 's/:/ /g') + endif + ifneq (,$(LDSEARCH)) + LIBPATH := $(LDSEARCH) else - LIBPATH = $(subst :, ,$(LPATH)) - OS_LDFLAGS += $(patsubst %,-L%,$(LIBPATH)) + ifeq (,$(strip $(LPATH))) + $(info *** Warning ***) + $(info *** Warning *** The library search path on your $(OSTYPE) platform can't be) + $(info *** Warning *** determined. This should be resolved before you can expect) + $(info *** Warning *** to have fully working simulators.) + $(info *** Warning ***) + $(info *** Warning *** You can specify your library paths via the LPATH environment) + $(info *** Warning *** variable.) + $(info *** Warning ***) + else + LIBPATH = $(subst :, ,$(LPATH)) + OS_LDFLAGS += $(patsubst %,-L%,$(LIBPATH)) + endif endif endif endif @@ -204,7 +217,11 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) LIBPATH += /usr/pkg/lib OS_LDFLAGS += -L/usr/pkg/lib -R/usr/pkg/lib endif - ifneq (,$(findstring NetBSD,$(OSTYPE))$(findstring FreeBSD,$(OSTYPE))) + ifeq (/usr/local/lib,$(findstring /usr/local/lib,$(LIBPATH))) + INCPATH += /usr/local/include + OS_CCDEFS += -I/usr/local/include + endif + ifneq (,$(findstring NetBSD,$(OSTYPE))$(findstring FreeBSD,$(OSTYPE))$(findstring AIX,$(OSTYPE))) LIBEXT = so else ifeq (HP-UX,$(OSTYPE)) @@ -260,7 +277,7 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) OS_LDFLAGS += -ldl $(info using libdl: $(call find_lib,dl) $(call find_include,dlfcn)) else - ifeq (BSD,$(findstring BSD,$(OSTYPE))) + ifneq (,$(findstring BSD,$(OSTYPE))$(findstring AIX,$(OSTYPE))) OS_CCDEFS += -DHAVE_DLOPEN=so $(info using libdl: $(call find_include,dlfcn)) else @@ -305,9 +322,21 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) NETWORK_FEATURES = - dynamic networking support using $(OSNAME) provided libpcap components endif else - NETWORK_CCDEFS = -DUSE_SHARED -I$(dir $(call find_include,pcap)) - NETWORK_FEATURES = - dynamic networking support using $(OSNAME) provided libpcap components - $(info using libpcap: $(call find_include,pcap)) + ifneq (,$(call find_lib,$(PCAPLIB))) + NETWORK_CCDEFS = -DUSE_SHARED -I$(dir $(call find_include,pcap)) + NETWORK_FEATURES = - dynamic networking support using $(OSNAME) provided libpcap components + $(info using libpcap: $(call find_include,pcap)) + else + LIBEXTSAVE := $(LIBEXT) + LIBEXT = a + ifneq (,$(call find_lib,$(PCAPLIB))) + NETWORK_CCDEFS = -DUSE_NETWORK -I$(dir $(call find_include,pcap)) + NETWORK_LDFLAGS = -L$(dir $(call find_lib,$(PCAPLIB))) -Wl,-R,$(dir $(call find_lib,$(PCAPLIB))) -l$(PCAPLIB) + NETWORK_FEATURES = - static networking support using $(OSNAME) provided libpcap components + $(info using libpcap: $(call find_lib,$(PCAPLIB)) $(call find_include,pcap)) + endif + LIBEXT = $(LIBEXTSAVE) + endif endif else # Look for package built from tcpdump.org sources with default install target (or cygwin winpcap) @@ -358,7 +387,7 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) ifneq (,$(call find_include,libvdeplug)) # Provide support for vde networking NETWORK_CCDEFS += -DUSE_VDE_NETWORK - NETWORK_LDFLAGS += -lvdeplug + NETWORK_LDFLAGS += -lvdeplug -R$(dir $(call find_lib,vdeplug)) -L$(dir $(call find_lib,vdeplug)) $(info using libvdeplug: $(call find_lib,vdeplug) $(call find_include,libvdeplug)) endif endif diff --git a/sim_defs.h b/sim_defs.h index de97ad74..1612c6ab 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -134,6 +134,9 @@ #ifdef RS #undef RS #endif +#ifdef PAGESIZE +#undef PAGESIZE +#endif #ifndef TRUE @@ -302,7 +305,7 @@ typedef uint32 t_addr; #define PV_RZRO 0 /* right, zero fill */ #define PV_RSPC 1 /* right, space fill */ -#define PV_RCOMMA 2 /* right, space fill. Comma separte every 3 */ +#define PV_RCOMMA 2 /* right, space fill. Comma separate every 3 */ #define PV_LEFT 3 /* left justify */ /* Default timing parameters */ @@ -740,7 +743,7 @@ extern int32 sim_asynch_latency; extern int32 sim_asynch_inst_latency; /* Thread local storage */ -#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__hpux) && !defined(__OpenBSD__) +#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__hpux) && !defined(__OpenBSD__) && !defined(_AIX) #define AIO_TLS __thread #elif defined(_MSC_VER) #define AIO_TLS __declspec(thread) diff --git a/sim_disk.c b/sim_disk.c index 816168ca..77dd0592 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -1928,7 +1928,7 @@ _set_errno_from_status (GetLastError ()); return SCPE_IOERR; } -#elif defined (__linux) || defined (__linux__) || defined (__sun) || defined (__sun__) || defined (__hpux) +#elif defined (__linux) || defined (__linux__) || defined (__sun) || defined (__sun__) || defined (__hpux) || defined (_AIX) #include #include diff --git a/sim_fio.c b/sim_fio.c index 9e29a8e4..a7fbec10 100644 --- a/sim_fio.c +++ b/sim_fio.c @@ -224,7 +224,7 @@ FILE *sim_fopen (const char *file, const char *mode) #if defined (VMS) return fopen (file, mode, "ALQ=32", "DEQ=4096", "MBF=6", "MBC=127", "FOP=cbt,tef", "ROP=rah,wbh", "CTX=stm"); -#elif (defined (__linux) || defined (__linux__) || defined (__hpux)) && !defined (DONT_DO_LARGEFILE) +#elif (defined (__linux) || defined (__linux__) || defined (__hpux) || defined (_AIX)) && !defined (DONT_DO_LARGEFILE) return fopen64 (file, mode); #else return fopen (file, mode); @@ -313,7 +313,7 @@ return (t_offset)fileaddr; /* Linux */ -#if defined (__linux) || defined (__linux__) || defined (__hpux) +#if defined (__linux) || defined (__linux__) || defined (__hpux) || defined (_AIX) #define S_SIM_IO_FSEEK_EXT_ 1 int sim_fseeko (FILE *st, t_offset xpos, int origin) { diff --git a/sim_fio.h b/sim_fio.h index be46661e..b59084d8 100644 --- a/sim_fio.h +++ b/sim_fio.h @@ -38,7 +38,7 @@ #define fxwrite(a,b,c,d) sim_fwrite (a, b, c, d) int32 sim_finit (void); -#if (defined (__linux) || defined (__linux__) || defined (__hpux) || \ +#if (defined (__linux) || defined (__linux__) || defined (__hpux) || defined (_AIX) || \ (defined (VMS) && (defined (__ALPHA) || defined (__ia64)) && (__DECC_VER >= 60590001)) || \ ((defined(__sun) || defined(__sun__)) && defined(_LARGEFILE_SOURCE)) || \ defined (_WIN32) || defined (__APPLE__) || \