Added registers for OpenIndiana x86_64 and other fixes

OpenIndiana/illumos is based on OpenSolaris 10 and
uses the Solaris code paths.
Current status:
Basilisk II: Working but cannot ignore illegal instructions
SheepShaver: Doesn't compile because of same problem
If the SIGSEGV skip instruction handler were fixed, both
programs would likely work.
This commit is contained in:
robxnano 2022-10-08 01:38:43 +01:00
parent 2a74fdaab6
commit 604baaa289
8 changed files with 77 additions and 3 deletions

View File

@ -281,6 +281,13 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#endif
#if defined(__x86_64__)
#include <sys/regset.h>
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs)
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[REG_RIP]
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#endif
#endif
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#if (defined(i386) || defined(__i386__))
@ -893,6 +900,24 @@ enum {
X86_REG_EBP = EBP,
X86_REG_ESI = ESI,
X86_REG_EDI = EDI
#elif defined(__x86_64__)
X86_REG_R8 = REG_R8,
X86_REG_R9 = REG_R9,
X86_REG_R10 = REG_R10,
X86_REG_R11 = REG_R11,
X86_REG_R12 = REG_R12,
X86_REG_R13 = REG_R13,
X86_REG_R14 = REG_R14,
X86_REG_R15 = REG_R15,
X86_REG_EDI = EDI,
X86_REG_ESI = ESI,
X86_REG_EBP = EBP,
X86_REG_EBX = EBX,
X86_REG_EDX = EDX,
X86_REG_EAX = EAX,
X86_REG_ECX = ECX,
X86_REG_ESP = ESP,
X86_REG_EIP = REG_RIP
#endif
};
#endif

View File

@ -774,8 +774,11 @@ netbsd*)
ETHERSRC=ether_unix.cpp
;;
solaris*)
AUDIOSRC=Solaris/audio_solaris.cpp
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
dnl Needed for sys/socket.h
LIBS="$LIBS -lsocket -lnsl"
dnl Needed for SDL2
CXXFLAGS="$CXXFLAGS -std=c++11"
;;
irix*)
AUDIOSRC=Irix/audio_irix.cpp

View File

@ -66,7 +66,7 @@
#include <map>
#include <string>
#if defined(__FreeBSD__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__))
#if defined(__FreeBSD__) || defined (__sun__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__))
#include <net/if.h>
#endif

View File

@ -21,12 +21,18 @@
#include "sysdeps.h"
#include <sys/ioctl.h>
#ifdef HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif
#include <sys/stat.h>
#include <sys/wait.h>
#include <pthread.h>
#include <semaphore.h>
#include <termios.h>
#include <errno.h>
#ifdef __linux__
#include <linux/lp.h>
#include <linux/major.h>

View File

@ -74,7 +74,12 @@ RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $");
#define fatal(x) do { printf("Fatal error: %s", x); return 0; } while(0)
#endif /* not in BasiliskII */
#ifdef __sun__
#define mysig_t sig_atomic_t
#else
#define mysig_t sig_t
#endif
#define mysignal signal
#include <signal.h>

View File

@ -281,6 +281,13 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#endif
#if defined(__x86_64__)
#include <sys/regset.h>
#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs)
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[REG_RIP]
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#endif
#endif
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#if (defined(i386) || defined(__i386__))
@ -893,6 +900,24 @@ enum {
X86_REG_EBP = EBP,
X86_REG_ESI = ESI,
X86_REG_EDI = EDI
#elif defined(__x86_64__)
X86_REG_R8 = REG_R8,
X86_REG_R9 = REG_R9,
X86_REG_R10 = REG_R10,
X86_REG_R11 = REG_R11,
X86_REG_R12 = REG_R12,
X86_REG_R13 = REG_R13,
X86_REG_R14 = REG_R14,
X86_REG_R15 = REG_R15,
X86_REG_EDI = EDI,
X86_REG_ESI = ESI,
X86_REG_EBP = EBP,
X86_REG_EBX = EBX,
X86_REG_EDX = EDX,
X86_REG_EAX = EAX,
X86_REG_ECX = ECX,
X86_REG_ESP = ESP,
X86_REG_EIP = REG_RIP
#endif
};
#endif

View File

@ -46,7 +46,7 @@ AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [d
esac],
[WANT_GTK="gtk2 gtk"])
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=no])
AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes or 'precompiled'], [DYNGEN_CC=$withval])
AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes or 'precompiled'], [DYNGEN_CC=$withval], [DYNGEN_CC=precompiled])
AC_ARG_WITH(bincue,
AS_HELP_STRING([--with-bincue], [Allow cdrom image files in bin/cue mode]))
@ -656,6 +656,12 @@ netbsd*)
EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S"
fi
;;
solaris*)
dnl Needed for sys/socket.h
LDFLAGS="$LDFLAGS -lsocket -lnsl"
dnl Needed for SDL2
CXXFLAGS="$CXXFLAGS -std=c++11"
;;
darwin*)
ETHERSRC=ether_unix.cpp
if [[ "x$EMULATED_PPC" = "xno" ]]; then

View File

@ -29,6 +29,10 @@
#include <net/if.h>
#include <net/if_arp.h>
#ifdef __sun__
#include <sys/sockio.h>
#endif
#include <cerrno>
#include "user_strings.h"