Added registers for NetBSD x86_64 and other fixes

NetBSD current status:
Basilisk II: Builds and runs, but JIT doesn't work
SheepShaver: Doesn't work because of BSD mmap limitations
This commit is contained in:
robxnano 2022-10-08 01:15:06 +01:00
parent 1dd1d2713d
commit 2a74fdaab6
7 changed files with 65 additions and 2 deletions

View File

@ -302,6 +302,12 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[_REG_EIP]
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#elif (defined(__x86_64__) || defined(x86_64))
#include <sys/ucontext.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
#if (defined(powerpc) || defined(__powerpc__))
#include <sys/ucontext.h>
@ -799,6 +805,24 @@ enum {
X86_REG_EBP = _REG_EBP,
X86_REG_ESI = _REG_ESI,
X86_REG_EDI = _REG_EDI
#elif (defined(__x86_64__) || defined(x86_64))
X86_REG_EIP = _REG_RIP,
X86_REG_EAX = _REG_RAX,
X86_REG_ECX = _REG_RCX,
X86_REG_EDX = _REG_RDX,
X86_REG_EBX = _REG_RBX,
X86_REG_ESP = _REG_RSP,
X86_REG_EBP = _REG_RBP,
X86_REG_ESI = _REG_RSI,
X86_REG_EDI = _REG_RDI,
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
#endif
};
#endif

View File

@ -71,7 +71,7 @@ typedef unsigned long vm_uintptr_t;
#ifndef MAP_32BIT
#define MAP_32BIT 0
#endif
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__NetBSD__)
#define FORCE_MAP_32BIT MAP_FIXED
#else
#define FORCE_MAP_32BIT MAP_32BIT
@ -86,7 +86,7 @@ typedef unsigned long vm_uintptr_t;
#define MAP_EXTRA_FLAGS (MAP_32BIT)
#ifdef HAVE_MMAP_VM
#if (defined(__linux__) && defined(__i386__)) || defined(__FreeBSD__) || HAVE_LINKER_SCRIPT
#if (defined(__linux__) && defined(__i386__)) || defined(__FreeBSD__) || defined(__NetBSD__) || HAVE_LINKER_SCRIPT
/* Force a reasonnable address below 0x80000000 on x86 so that we
don't get addresses above when the program is run on AMD64.
NOTE: this is empirically determined on Linux/x86. */

View File

@ -618,6 +618,9 @@ mips-sony-bsd|mips-sony-newsos4)
*-*-freebsd*)
no_dev_ptmx=1
;;
*-*-netbsd*)
no_dev_ptmx=1
;;
esac
if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then

View File

@ -22,6 +22,11 @@ RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $");
#include <ctype.h>
#include <errno.h>
#include <fcntl.h> /* For O_NONBLOCK */
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <pwd.h>

View File

@ -302,6 +302,12 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[_REG_EIP]
#define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction
#elif (defined(__x86_64__) || defined(x86_64))
#include <sys/ucontext.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
#if (defined(powerpc) || defined(__powerpc__))
#include <sys/ucontext.h>
@ -799,6 +805,24 @@ enum {
X86_REG_EBP = _REG_EBP,
X86_REG_ESI = _REG_ESI,
X86_REG_EDI = _REG_EDI
#elif (defined(__x86_64__) || defined(x86_64))
X86_REG_EIP = _REG_RIP,
X86_REG_EAX = _REG_RAX,
X86_REG_ECX = _REG_RCX,
X86_REG_EDX = _REG_RDX,
X86_REG_EBX = _REG_RBX,
X86_REG_ESP = _REG_RSP,
X86_REG_EBP = _REG_RBP,
X86_REG_ESI = _REG_RSI,
X86_REG_EDI = _REG_RDI,
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
#endif
};
#endif

View File

@ -525,6 +525,9 @@ mips-sony-bsd|mips-sony-newsos4)
*-*-freebsd*)
no_dev_ptmx=1
;;
*-*-netbsd*)
no_dev_ptmx=1
;;
esac
if test -z "$no_dev_ptmx" ; then

View File

@ -54,6 +54,10 @@
# include <fcntl.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>