HP-UX port supplied by Mikulas Patocka
This commit is contained in:
parent
bc40f6abde
commit
eb101e3881
9 changed files with 66 additions and 10 deletions
|
@ -75,7 +75,7 @@
|
||||||
#define UNIT_CPU_V_SWITCHER (UNIT_V_UF+6) /* switcher 8086 <--> 8080/Z80 enabled */
|
#define UNIT_CPU_V_SWITCHER (UNIT_V_UF+6) /* switcher 8086 <--> 8080/Z80 enabled */
|
||||||
#define UNIT_CPU_SWITCHER (1 << UNIT_CPU_V_SWITCHER)
|
#define UNIT_CPU_SWITCHER (1 << UNIT_CPU_V_SWITCHER)
|
||||||
|
|
||||||
#if defined (__linux) || defined (__linux__) || defined(__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD__) || defined (__APPLE__)
|
#if defined (__linux) || defined (__linux__) || defined(__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD__) || defined (__APPLE__) || defined (__hpux)
|
||||||
#define UNIX_PLATFORM 1
|
#define UNIX_PLATFORM 1
|
||||||
#else
|
#else
|
||||||
#define UNIX_PLATFORM 0
|
#define UNIX_PLATFORM 0
|
||||||
|
|
19
makefile
19
makefile
|
@ -6,6 +6,7 @@
|
||||||
# OpenBSD
|
# OpenBSD
|
||||||
# NetBSD
|
# NetBSD
|
||||||
# FreeBSD
|
# FreeBSD
|
||||||
|
# HP-UX
|
||||||
# Windows (MinGW & cygwin)
|
# Windows (MinGW & cygwin)
|
||||||
# Linux x86 targeting Android (using agcc script)
|
# Linux x86 targeting Android (using agcc script)
|
||||||
#
|
#
|
||||||
|
@ -153,7 +154,17 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
|
||||||
ifneq (,$(findstring NetBSD,$(OSTYPE))$(findstring FreeBSD,$(OSTYPE)))
|
ifneq (,$(findstring NetBSD,$(OSTYPE))$(findstring FreeBSD,$(OSTYPE)))
|
||||||
LIBEXT = so
|
LIBEXT = so
|
||||||
else
|
else
|
||||||
LIBEXT = a
|
ifeq (HP-UX,$(OSTYPE))
|
||||||
|
ifeq (ia64,$(shell uname -m))
|
||||||
|
LIBEXT = so
|
||||||
|
else
|
||||||
|
LIBEXT = sl
|
||||||
|
endif
|
||||||
|
OS_CCDEFS += -D_HPUX_SOURCE -D_LARGEFILE64_SOURCE
|
||||||
|
NO_LTO = 1
|
||||||
|
else
|
||||||
|
LIBEXT = a
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -438,7 +449,11 @@ ifneq ($(DONT_USE_READER_THREAD),)
|
||||||
NETWORK_OPT += -DDONT_USE_READER_THREAD
|
NETWORK_OPT += -DDONT_USE_READER_THREAD
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CC_STD = -std=c99
|
ifeq (HP-UX,$(OSTYPE))
|
||||||
|
CC_STD = -std=gnu99
|
||||||
|
else
|
||||||
|
CC_STD = -std=c99
|
||||||
|
endif
|
||||||
CC_OUTSPEC = -o $@
|
CC_OUTSPEC = -o $@
|
||||||
CC = $(GCC) $(CC_STD) -U__STRICT_ANSI__ $(CFLAGS_G) $(CFLAGS_O) $(CFLAGS_GIT) -I . $(OS_CCDEFS) $(ROMS_OPT)
|
CC = $(GCC) $(CC_STD) -U__STRICT_ANSI__ $(CFLAGS_G) $(CFLAGS_O) $(CFLAGS_GIT) -I . $(OS_CCDEFS) $(ROMS_OPT)
|
||||||
LDFLAGS = $(OS_LDFLAGS) $(NETWORK_LDFLAGS) $(LDFLAGS_O)
|
LDFLAGS = $(OS_LDFLAGS) $(NETWORK_LDFLAGS) $(LDFLAGS_O)
|
||||||
|
|
6
scp.c
6
scp.c
|
@ -781,7 +781,7 @@ static CTAB cmd_table[] = {
|
||||||
{ NULL, NULL, 0 }
|
{ NULL, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32) || defined(__hpux)
|
||||||
static
|
static
|
||||||
int setenv(const char *envname, const char *envval, int overwrite)
|
int setenv(const char *envname, const char *envval, int overwrite)
|
||||||
{
|
{
|
||||||
|
@ -789,8 +789,12 @@ int setenv(const char *envname, const char *envval, int overwrite)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
sprintf(envstr, "%s=%s", envname, envval);
|
sprintf(envstr, "%s=%s", envname, envval);
|
||||||
|
#if defined(_WIN32)
|
||||||
r = _putenv(envstr);
|
r = _putenv(envstr);
|
||||||
free(envstr);
|
free(envstr);
|
||||||
|
#else
|
||||||
|
r = putenv(envstr);
|
||||||
|
#endif
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
17
sim_defs.h
17
sim_defs.h
|
@ -120,6 +120,21 @@
|
||||||
#undef MEM_MAPPED /* avoid macro name collision */
|
#undef MEM_MAPPED /* avoid macro name collision */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* avoid macro names collisions */
|
||||||
|
#ifdef MAX
|
||||||
|
#undef MAX
|
||||||
|
#endif
|
||||||
|
#ifdef MIN
|
||||||
|
#undef MIN
|
||||||
|
#endif
|
||||||
|
#ifdef PMASK
|
||||||
|
#undef PMASK
|
||||||
|
#endif
|
||||||
|
#ifdef RS
|
||||||
|
#undef RS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
@ -700,7 +715,7 @@ extern int32 sim_asynch_latency;
|
||||||
extern int32 sim_asynch_inst_latency;
|
extern int32 sim_asynch_inst_latency;
|
||||||
|
|
||||||
/* Thread local storage */
|
/* Thread local storage */
|
||||||
#if defined(__GNUC__) && !defined(__APPLE__)
|
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__hpux)
|
||||||
#define AIO_TLS __thread
|
#define AIO_TLS __thread
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
#define AIO_TLS __declspec(thread)
|
#define AIO_TLS __declspec(thread)
|
||||||
|
|
10
sim_ether.c
10
sim_ether.c
|
@ -1877,6 +1877,16 @@ if (1) {
|
||||||
pthread_cond_init (&dev->writer_cond, NULL);
|
pthread_cond_init (&dev->writer_cond, NULL);
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
||||||
|
#if defined(__hpux)
|
||||||
|
{
|
||||||
|
/* libpcap needs sizeof(long) * 8192 bytes on the stack */
|
||||||
|
size_t stack_size;
|
||||||
|
const size_t min_stack_size = sizeof(long) * 8192 * 3 / 2;
|
||||||
|
if (!pthread_attr_getstacksize(&attr, &stack_size) && stack_size < min_stack_size) {
|
||||||
|
pthread_attr_setstacksize(&attr, min_stack_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
pthread_create (&dev->reader_thread, &attr, _eth_reader, (void *)dev);
|
pthread_create (&dev->reader_thread, &attr, _eth_reader, (void *)dev);
|
||||||
pthread_create (&dev->writer_thread, &attr, _eth_writer, (void *)dev);
|
pthread_create (&dev->writer_thread, &attr, _eth_writer, (void *)dev);
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
|
|
|
@ -219,7 +219,7 @@ FILE *sim_fopen (const char *file, const char *mode)
|
||||||
#if defined (VMS)
|
#if defined (VMS)
|
||||||
return fopen (file, mode, "ALQ=32", "DEQ=4096",
|
return fopen (file, mode, "ALQ=32", "DEQ=4096",
|
||||||
"MBF=6", "MBC=127", "FOP=cbt,tef", "ROP=rah,wbh", "CTX=stm");
|
"MBF=6", "MBC=127", "FOP=cbt,tef", "ROP=rah,wbh", "CTX=stm");
|
||||||
#elif defined (USE_INT64) && defined (USE_ADDR64) && (defined (__linux) || defined (__linux__))
|
#elif defined (USE_INT64) && defined (USE_ADDR64) && (defined (__linux) || defined (__linux__) || defined (__hpux))
|
||||||
return fopen64 (file, mode);
|
return fopen64 (file, mode);
|
||||||
#else
|
#else
|
||||||
return fopen (file, mode);
|
return fopen (file, mode);
|
||||||
|
@ -312,7 +312,7 @@ return (t_addr)fileaddr;
|
||||||
|
|
||||||
/* Linux */
|
/* Linux */
|
||||||
|
|
||||||
#if defined (__linux) || defined (__linux__)
|
#if defined (__linux) || defined (__linux__) || defined (__hpux)
|
||||||
#define _SIM_IO_FSEEK_EXT_ 1
|
#define _SIM_IO_FSEEK_EXT_ 1
|
||||||
|
|
||||||
int sim_fseek (FILE *st, t_addr xpos, int origin)
|
int sim_fseek (FILE *st, t_addr xpos, int origin)
|
||||||
|
|
|
@ -49,6 +49,9 @@
|
||||||
#elif defined (__unix__) || defined(__APPLE__) /* UNIX definitions */
|
#elif defined (__unix__) || defined(__APPLE__) /* UNIX definitions */
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#ifdef __hpux
|
||||||
|
#include <sys/modem.h>
|
||||||
|
#endif
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
12
sim_sock.c
12
sim_sock.c
|
@ -148,6 +148,12 @@ typedef size_t socklen_t;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__hpux)
|
||||||
|
#if !defined(EAI_OVERFLOW)
|
||||||
|
#define EAI_OVERFLOW EAI_FAIL
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
|
typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
|
||||||
static getnameinfo_func p_getnameinfo;
|
static getnameinfo_func p_getnameinfo;
|
||||||
|
|
||||||
|
@ -779,10 +785,12 @@ SOCKET sim_accept_conn (SOCKET master, char **connectaddr)
|
||||||
int32 sta, err;
|
int32 sta, err;
|
||||||
#if defined (macintosh) || defined (__linux) || defined (__linux__) || \
|
#if defined (macintosh) || defined (__linux) || defined (__linux__) || \
|
||||||
defined (__APPLE__) || defined (__OpenBSD__) || \
|
defined (__APPLE__) || defined (__OpenBSD__) || \
|
||||||
defined(__NetBSD__) || defined(__FreeBSD__)
|
defined(__NetBSD__) || defined(__FreeBSD__) || \
|
||||||
|
(defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED))
|
||||||
socklen_t size;
|
socklen_t size;
|
||||||
#elif defined (_WIN32) || defined (__EMX__) || \
|
#elif defined (_WIN32) || defined (__EMX__) || \
|
||||||
(defined (__ALPHA) && defined (__unix__))
|
(defined (__ALPHA) && defined (__unix__)) || \
|
||||||
|
defined (__hpux)
|
||||||
int size;
|
int size;
|
||||||
#else
|
#else
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
|
@ -41,7 +41,8 @@
|
||||||
#define HAVE_STRUCT_TIMESPEC 1 /* OSX defined the structure but doesn't tell us */
|
#define HAVE_STRUCT_TIMESPEC 1 /* OSX defined the structure but doesn't tell us */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CLOCK_REALTIME)
|
/* on HP-UX, CLOCK_REALTIME is enum, not preprocessor define */
|
||||||
|
#if !defined(CLOCK_REALTIME) && !defined(__hpux)
|
||||||
#define CLOCK_REALTIME 1
|
#define CLOCK_REALTIME 1
|
||||||
#define NEED_CLOCK_GETTIME 1
|
#define NEED_CLOCK_GETTIME 1
|
||||||
#if !defined(HAVE_STRUCT_TIMESPEC)
|
#if !defined(HAVE_STRUCT_TIMESPEC)
|
||||||
|
|
Loading…
Add table
Reference in a new issue