From 7482de353b829bc1808dd146fa9d90b4ec38b28e Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 1 Oct 2022 20:20:40 +0100 Subject: [PATCH 01/13] Added sys/stat.h to sysdeps.h Needed on BSD for S_* ioctl constants and macros --- BasiliskII/src/Unix/sshpty.c | 4 ---- BasiliskII/src/Unix/sysdeps.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BasiliskII/src/Unix/sshpty.c b/BasiliskII/src/Unix/sshpty.c index 48e69dc7..351f7c8b 100644 --- a/BasiliskII/src/Unix/sshpty.c +++ b/BasiliskII/src/Unix/sshpty.c @@ -45,10 +45,6 @@ RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $"); # include #endif -#ifdef HAVE_SYS_STAT_H -# include /* For S_* constants and macros */ -#endif - #ifndef _PATH_TTY # define _PATH_TTY "/dev/tty" #endif diff --git a/BasiliskII/src/Unix/sysdeps.h b/BasiliskII/src/Unix/sysdeps.h index 459590e0..533865d6 100644 --- a/BasiliskII/src/Unix/sysdeps.h +++ b/BasiliskII/src/Unix/sysdeps.h @@ -51,6 +51,10 @@ # include #endif +#ifdef HAVE_SYS_STAT_H +# include /* For S_* constants and macros */ +#endif + #ifdef TIME_WITH_SYS_TIME # include # include From 01ba8564ed418180a120cf9f6e41d1cff8dbb961 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Mon, 3 Oct 2022 19:36:46 +0100 Subject: [PATCH 02/13] Improved UI support on FreeBSD --- BasiliskII/src/Unix/prefs_editor_gtk.cpp | 12 ++++++++---- BasiliskII/src/Unix/sys_unix.cpp | 7 +++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/BasiliskII/src/Unix/prefs_editor_gtk.cpp b/BasiliskII/src/Unix/prefs_editor_gtk.cpp index 53d45f61..dc8b7e6e 100644 --- a/BasiliskII/src/Unix/prefs_editor_gtk.cpp +++ b/BasiliskII/src/Unix/prefs_editor_gtk.cpp @@ -28,9 +28,13 @@ #include #include #include - +#include #include +#ifdef HAfVE_SYS_STAT_H +#include +#endif + #ifdef HAVE_GNOMEUI #include #endif @@ -414,12 +418,12 @@ static void mn_about(...) const char *authors[] = { "Christian Bauer", "Orlando Bassotto", - "Gwenolé Beauchesne", + "Gwenolé Beauchesne", "Marc Chabanas", "Marc Hellwig", "Biill Huey", "Brian J. Johnson", - "Jürgen Lachmann", + "Jürgen Lachmann", "Samuel Lander", "David Lawrence", "Lauri Pesonen", @@ -1291,7 +1295,7 @@ static GList *add_serial_names(void) #if defined(__linux__) if (strncmp(de->d_name, "ttyS", 4) == 0 || strncmp(de->d_name, "lp", 2) == 0) { #elif defined(__FreeBSD__) - if (strncmp(de->d_name, "cuaa", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) { + if (strncmp(de->d_name, "cua", 3) == 0 || strncmp(de->d_name, "lpt", 3) == 0) { #elif defined(__NetBSD__) if (strncmp(de->d_name, "tty0", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) { #elif defined(sgi) diff --git a/BasiliskII/src/Unix/sys_unix.cpp b/BasiliskII/src/Unix/sys_unix.cpp index 9cfc06ce..1f1c89a2 100755 --- a/BasiliskII/src/Unix/sys_unix.cpp +++ b/BasiliskII/src/Unix/sys_unix.cpp @@ -369,6 +369,9 @@ void SysAddCDROMPrefs(void) closedir(cd_dir); } } +#elif defined __FreeBSD__ + if (access("/cdrom", F_OK) == 0) + PrefsAddString("cdrom", "/cdrom"); #elif defined __MACOSX__ // There is no predefined path for CD-ROMs on MacOS X. Rather, we // define a single fake CD-ROM entry for the emulated MacOS. @@ -396,8 +399,8 @@ void SysAddSerialPrefs(void) PrefsAddString("serialb", "/dev/tts/1"); } #elif defined(__FreeBSD__) - PrefsAddString("seriala", "/dev/cuaa0"); - PrefsAddString("serialb", "/dev/cuaa1"); + PrefsAddString("seriala", "/dev/cuau0"); + PrefsAddString("serialb", "/dev/cuau1"); #elif defined(__NetBSD__) PrefsAddString("seriala", "/dev/tty00"); PrefsAddString("serialb", "/dev/tty01"); From 1dd1d2713d7a8740eaee1732c1d47f23b7c64209 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Wed, 5 Oct 2022 22:47:48 +0100 Subject: [PATCH 03/13] Fixes for building on FreeBSD and other platforms FreeBSD current status: Basilisk II: Builds and runs successfully using gcc and gmake SheepShaver: Doesn't work because FreeBSD doesn't support mapping the zero memory page. SheepShaver would only work on *BSD if the direct addressing mode worked. --- BasiliskII/src/Unix/sysdeps.h | 1 + SheepShaver/src/Unix/sysdeps.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/BasiliskII/src/Unix/sysdeps.h b/BasiliskII/src/Unix/sysdeps.h index 533865d6..d1e25229 100644 --- a/BasiliskII/src/Unix/sysdeps.h +++ b/BasiliskII/src/Unix/sysdeps.h @@ -42,6 +42,7 @@ #include #include #include +#include #ifdef HAVE_PTHREADS # include diff --git a/SheepShaver/src/Unix/sysdeps.h b/SheepShaver/src/Unix/sysdeps.h index fc045584..ac5d78ac 100644 --- a/SheepShaver/src/Unix/sysdeps.h +++ b/SheepShaver/src/Unix/sysdeps.h @@ -44,6 +44,7 @@ #include #include #include +#include #ifdef HAVE_PTHREADS # include @@ -170,6 +171,9 @@ typedef int64 intptr; #else #error "Unsupported size of pointer" #endif +#ifndef HAVE_LOFF_T +#define loff_t off_t +#endif // Define if the host processor supports fast unaligned load/stores #if defined __i386__ || defined __x86_64__ From 2a74fdaab6656f485684646f7a619e147526f361 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 8 Oct 2022 01:15:06 +0100 Subject: [PATCH 04/13] 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 --- BasiliskII/src/CrossPlatform/sigsegv.cpp | 24 +++++++++++++++++++++++ BasiliskII/src/CrossPlatform/vm_alloc.cpp | 4 ++-- BasiliskII/src/Unix/configure.ac | 3 +++ BasiliskII/src/Unix/sshpty.c | 5 +++++ SheepShaver/src/CrossPlatform/sigsegv.cpp | 24 +++++++++++++++++++++++ SheepShaver/src/Unix/configure.ac | 3 +++ SheepShaver/src/Unix/sysdeps.h | 4 ++++ 7 files changed, 65 insertions(+), 2 deletions(-) diff --git a/BasiliskII/src/CrossPlatform/sigsegv.cpp b/BasiliskII/src/CrossPlatform/sigsegv.cpp index 003f20cf..645ac73a 100644 --- a/BasiliskII/src/CrossPlatform/sigsegv.cpp +++ b/BasiliskII/src/CrossPlatform/sigsegv.cpp @@ -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 +#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 @@ -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 diff --git a/BasiliskII/src/CrossPlatform/vm_alloc.cpp b/BasiliskII/src/CrossPlatform/vm_alloc.cpp index 2f52f8f7..cb869034 100755 --- a/BasiliskII/src/CrossPlatform/vm_alloc.cpp +++ b/BasiliskII/src/CrossPlatform/vm_alloc.cpp @@ -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. */ diff --git a/BasiliskII/src/Unix/configure.ac b/BasiliskII/src/Unix/configure.ac index ac7a58fb..0791cb46 100755 --- a/BasiliskII/src/Unix/configure.ac +++ b/BasiliskII/src/Unix/configure.ac @@ -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 diff --git a/BasiliskII/src/Unix/sshpty.c b/BasiliskII/src/Unix/sshpty.c index 351f7c8b..fc0bf2ea 100644 --- a/BasiliskII/src/Unix/sshpty.c +++ b/BasiliskII/src/Unix/sshpty.c @@ -22,6 +22,11 @@ RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/19 07:18:56 deraadt Exp $"); #include #include #include /* For O_NONBLOCK */ + +#ifdef HAVE_SYS_STAT_H +#include +#endif + #include #include #include diff --git a/SheepShaver/src/CrossPlatform/sigsegv.cpp b/SheepShaver/src/CrossPlatform/sigsegv.cpp index 5353cd52..b1ed17eb 100644 --- a/SheepShaver/src/CrossPlatform/sigsegv.cpp +++ b/SheepShaver/src/CrossPlatform/sigsegv.cpp @@ -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 +#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 @@ -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 diff --git a/SheepShaver/src/Unix/configure.ac b/SheepShaver/src/Unix/configure.ac index f1f1fea3..6fd59033 100755 --- a/SheepShaver/src/Unix/configure.ac +++ b/SheepShaver/src/Unix/configure.ac @@ -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 diff --git a/SheepShaver/src/Unix/sysdeps.h b/SheepShaver/src/Unix/sysdeps.h index ac5d78ac..f6e43851 100644 --- a/SheepShaver/src/Unix/sysdeps.h +++ b/SheepShaver/src/Unix/sysdeps.h @@ -54,6 +54,10 @@ # include #endif +#ifdef HAVE_SYS_STAT_H +# include +#endif + #ifdef TIME_WITH_SYS_TIME # include # include From 604baaa289001363367a7b1eea41c00a5d112acf Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 8 Oct 2022 01:38:43 +0100 Subject: [PATCH 05/13] 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. --- BasiliskII/src/CrossPlatform/sigsegv.cpp | 25 +++++++++++++++++++++++ BasiliskII/src/Unix/configure.ac | 5 ++++- BasiliskII/src/Unix/ether_unix.cpp | 2 +- BasiliskII/src/Unix/serial_unix.cpp | 6 ++++++ BasiliskII/src/Unix/sshpty.c | 5 +++++ SheepShaver/src/CrossPlatform/sigsegv.cpp | 25 +++++++++++++++++++++++ SheepShaver/src/Unix/configure.ac | 8 +++++++- SheepShaver/src/Unix/prefs_editor_gtk.cpp | 4 ++++ 8 files changed, 77 insertions(+), 3 deletions(-) diff --git a/BasiliskII/src/CrossPlatform/sigsegv.cpp b/BasiliskII/src/CrossPlatform/sigsegv.cpp index 645ac73a..c297a0dd 100644 --- a/BasiliskII/src/CrossPlatform/sigsegv.cpp +++ b/BasiliskII/src/CrossPlatform/sigsegv.cpp @@ -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 +#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 diff --git a/BasiliskII/src/Unix/configure.ac b/BasiliskII/src/Unix/configure.ac index 0791cb46..427410a0 100755 --- a/BasiliskII/src/Unix/configure.ac +++ b/BasiliskII/src/Unix/configure.ac @@ -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 diff --git a/BasiliskII/src/Unix/ether_unix.cpp b/BasiliskII/src/Unix/ether_unix.cpp index db2a143b..19c95d4b 100644 --- a/BasiliskII/src/Unix/ether_unix.cpp +++ b/BasiliskII/src/Unix/ether_unix.cpp @@ -66,7 +66,7 @@ #include #include -#if defined(__FreeBSD__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__)) +#if defined(__FreeBSD__) || defined (__sun__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__)) #include #endif diff --git a/BasiliskII/src/Unix/serial_unix.cpp b/BasiliskII/src/Unix/serial_unix.cpp index 0f28ec7c..bafc14e3 100644 --- a/BasiliskII/src/Unix/serial_unix.cpp +++ b/BasiliskII/src/Unix/serial_unix.cpp @@ -21,12 +21,18 @@ #include "sysdeps.h" #include + +#ifdef HAVE_SYS_FILIO_H +#include +#endif + #include #include #include #include #include #include + #ifdef __linux__ #include #include diff --git a/BasiliskII/src/Unix/sshpty.c b/BasiliskII/src/Unix/sshpty.c index fc0bf2ea..18865900 100644 --- a/BasiliskII/src/Unix/sshpty.c +++ b/BasiliskII/src/Unix/sshpty.c @@ -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 diff --git a/SheepShaver/src/CrossPlatform/sigsegv.cpp b/SheepShaver/src/CrossPlatform/sigsegv.cpp index b1ed17eb..c42ec9df 100644 --- a/SheepShaver/src/CrossPlatform/sigsegv.cpp +++ b/SheepShaver/src/CrossPlatform/sigsegv.cpp @@ -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 +#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 diff --git a/SheepShaver/src/Unix/configure.ac b/SheepShaver/src/Unix/configure.ac index 6fd59033..b9e49639 100755 --- a/SheepShaver/src/Unix/configure.ac +++ b/SheepShaver/src/Unix/configure.ac @@ -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 diff --git a/SheepShaver/src/Unix/prefs_editor_gtk.cpp b/SheepShaver/src/Unix/prefs_editor_gtk.cpp index 03821908..da55d731 100644 --- a/SheepShaver/src/Unix/prefs_editor_gtk.cpp +++ b/SheepShaver/src/Unix/prefs_editor_gtk.cpp @@ -29,6 +29,10 @@ #include #include +#ifdef __sun__ +#include +#endif + #include #include "user_strings.h" From 094995722bd44fb40b704496d092be2afe527dc3 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 8 Oct 2022 03:04:33 +0100 Subject: [PATCH 06/13] Added register names for Linux x86_64 --- BasiliskII/src/CrossPlatform/sigsegv.cpp | 82 +++++++++++---------- BasiliskII/src/Unix/prefs_editor_gtk.cpp | 6 +- SheepShaver/src/CrossPlatform/sigsegv.cpp | 86 +++++++++++------------ 3 files changed, 83 insertions(+), 91 deletions(-) diff --git a/BasiliskII/src/CrossPlatform/sigsegv.cpp b/BasiliskII/src/CrossPlatform/sigsegv.cpp index c297a0dd..5e31f1fc 100644 --- a/BasiliskII/src/CrossPlatform/sigsegv.cpp +++ b/BasiliskII/src/CrossPlatform/sigsegv.cpp @@ -274,14 +274,14 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int #define SIGSEGV_REGISTER_FILE ((unsigned long *)SIGSEGV_CONTEXT_REGS), SIGSEGV_SPARC_GWINDOWS, SIGSEGV_SPARC_RWINDOW #define SIGSEGV_SKIP_INSTRUCTION sparc_skip_instruction #endif -#if defined(__i386__) +#if (defined(i386) || defined(__i386__)) #include #define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs) #define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[EIP] #define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS #define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction #endif -#if defined(__x86_64__) +#if (defined(x86_64) || defined(__x86_64__)) #include #define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs) #define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[REG_RIP] @@ -309,7 +309,7 @@ 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)) +#elif (defined(x86_64) || defined(__x86_64__)) #include #define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.__gregs) #define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[_REG_RIP] @@ -336,12 +336,12 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int #endif #if (defined(i386) || defined(__i386__)) #define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs) -#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[14] /* should use REG_EIP instead */ +#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__)) #define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs) -#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[16] /* should use REG_RIP instead */ +#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 #elif (defined(ia64) || defined(__ia64__)) @@ -765,38 +765,37 @@ handleExceptions(void *priv) #ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION // Decode and skip X86 instruction -#if (defined(i386) || defined(__i386__) || defined(_M_IX86)) || (defined(__x86_64__) || defined(_M_X64)) +#if (defined(i386) || defined(__i386__) || defined(_M_IX86) || defined(x86_64) || defined(__x86_64__) || defined(_M_X64)) #if defined(__linux__) enum { #if (defined(i386) || defined(__i386__)) - X86_REG_EIP = 14, - X86_REG_EAX = 11, - X86_REG_ECX = 10, - X86_REG_EDX = 9, - X86_REG_EBX = 8, - X86_REG_ESP = 7, - X86_REG_EBP = 6, - X86_REG_ESI = 5, - X86_REG_EDI = 4 -#endif -#if defined(__x86_64__) - X86_REG_R8 = 0, - X86_REG_R9 = 1, - X86_REG_R10 = 2, - X86_REG_R11 = 3, - X86_REG_R12 = 4, - X86_REG_R13 = 5, - X86_REG_R14 = 6, - X86_REG_R15 = 7, - X86_REG_EDI = 8, - X86_REG_ESI = 9, - X86_REG_EBP = 10, - X86_REG_EBX = 11, - X86_REG_EDX = 12, - X86_REG_EAX = 13, - X86_REG_ECX = 14, - X86_REG_ESP = 15, - X86_REG_EIP = 16 + X86_REG_EIP = REG_EIP, + X86_REG_EAX = REG_EAX, + X86_REG_ECX = REG_ECX, + X86_REG_EDX = REG_EDX, + X86_REG_EBX = REG_EBX, + X86_REG_ESP = REG_ESP, + X86_REG_EBP = REG_EBP, + X86_REG_ESI = REG_ESI, + X86_REG_EDI = REG_EDI +#elif (defined(x86_64) || 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 = REG_RDI, + X86_REG_ESI = REG_RSI, + X86_REG_EBP = REG_RBP, + X86_REG_EBX = REG_RBX, + X86_REG_EDX = REG_RDX, + X86_REG_EAX = REG_RAX, + X86_REG_ECX = REG_RCX, + X86_REG_ESP = REG_RSP, + X86_REG_EIP = REG_RIP #endif }; #endif @@ -812,7 +811,7 @@ enum { X86_REG_EBP = _REG_EBP, X86_REG_ESI = _REG_ESI, X86_REG_EDI = _REG_EDI -#elif (defined(__x86_64__) || defined(x86_64)) +#elif (defined(x86_64) || defined(__x86_64__)) X86_REG_EIP = _REG_RIP, X86_REG_EAX = _REG_RAX, X86_REG_ECX = _REG_RCX, @@ -845,8 +844,7 @@ enum { X86_REG_EBP = 2, X86_REG_ESI = 1, X86_REG_EDI = 0 -#endif -#if (defined(x86_64) || defined(__x86_64__)) +#elif (defined(x86_64) || defined(__x86_64__)) X86_REG_EDI = 0, X86_REG_ESI = 1, X86_REG_EDX = 2, @@ -869,7 +867,7 @@ enum { #endif #if defined(__OpenBSD__) enum { -#if defined(__i386__) +#if (defined(i386) || defined(__i386__)) // EDI is the first register we consider #define OREG(REG) offsetof(struct sigcontext, sc_##REG) #define DREG(REG) ((OREG(REG) - OREG(edi)) / 4) @@ -890,7 +888,7 @@ enum { #if defined(__sun__) // Same as for Linux, need to check for x86-64 enum { -#if defined(__i386__) +#if (defined(i386) || defined(__i386__)) X86_REG_EIP = EIP, X86_REG_EAX = EAX, X86_REG_ECX = ECX, @@ -900,7 +898,7 @@ enum { X86_REG_EBP = EBP, X86_REG_ESI = ESI, X86_REG_EDI = EDI -#elif defined(__x86_64__) +#elif (defined(x86_64) || defined(__x86_64__)) X86_REG_R8 = REG_R8, X86_REG_R9 = REG_R9, X86_REG_R10 = REG_R10, @@ -3309,7 +3307,7 @@ static sigsegv_return_t sigsegv_insn_handler(sigsegv_info_t *sip) // More sophisticated tests for instruction skipper static bool arch_insn_skipper_tests() { -#if (defined(i386) || defined(__i386__)) || (defined(__x86_64__) || defined(_M_X64)) +#if (defined(i386) || defined(__i386__) || defined(x86_64) || defined(__x86_64__) || defined(_M_X64)) static const unsigned char code[] = { 0x8a, 0x00, // mov (%eax),%al 0x8a, 0x2c, 0x18, // mov (%eax,%ebx,1),%ch @@ -3323,7 +3321,7 @@ static bool arch_insn_skipper_tests() 0x8b, 0x0c, 0x18, // mov (%eax,%ebx,1),%ecx 0x89, 0x00, // mov %eax,(%eax) 0x89, 0x0c, 0x18, // mov %ecx,(%eax,%ebx,1) -#if defined(__x86_64__) || defined(_M_X64) +#if defined(x86_64) || defined(__x86_64__) || defined(_M_X64) 0x44, 0x8a, 0x00, // mov (%rax),%r8b 0x44, 0x8a, 0x20, // mov (%rax),%r12b 0x42, 0x8a, 0x3c, 0x10, // mov (%rax,%r10,1),%dil diff --git a/BasiliskII/src/Unix/prefs_editor_gtk.cpp b/BasiliskII/src/Unix/prefs_editor_gtk.cpp index dc8b7e6e..eb843161 100644 --- a/BasiliskII/src/Unix/prefs_editor_gtk.cpp +++ b/BasiliskII/src/Unix/prefs_editor_gtk.cpp @@ -28,12 +28,8 @@ #include #include #include -#include -#include -#ifdef HAfVE_SYS_STAT_H -#include -#endif +#include #ifdef HAVE_GNOMEUI #include diff --git a/SheepShaver/src/CrossPlatform/sigsegv.cpp b/SheepShaver/src/CrossPlatform/sigsegv.cpp index c42ec9df..34c6c880 100644 --- a/SheepShaver/src/CrossPlatform/sigsegv.cpp +++ b/SheepShaver/src/CrossPlatform/sigsegv.cpp @@ -255,7 +255,7 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int #define SIGSEGV_FAULT_ADDRESS sip->si_addr #if (defined(sgi) || defined(__sgi)) #include -#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs) +#define SIGSEGV_CONTEXT_REGS (((ucontext_t*)scp)->uc_mcontext.gregs) #define SIGSEGV_FAULT_INSTRUCTION (unsigned long)SIGSEGV_CONTEXT_REGS[CTX_EPC] #if (defined(mips) || defined(__mips)) #define SIGSEGV_REGISTER_FILE &SIGSEGV_CONTEXT_REGS[CTX_EPC], &SIGSEGV_CONTEXT_REGS[CTX_R0] @@ -274,16 +274,16 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int #define SIGSEGV_REGISTER_FILE ((unsigned long *)SIGSEGV_CONTEXT_REGS), SIGSEGV_SPARC_GWINDOWS, SIGSEGV_SPARC_RWINDOW #define SIGSEGV_SKIP_INSTRUCTION sparc_skip_instruction #endif -#if defined(__i386__) +#if (defined(i386) || defined(__i386__)) #include #define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs) #define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[EIP] #define SIGSEGV_REGISTER_FILE (SIGSEGV_REGISTER_TYPE *)SIGSEGV_CONTEXT_REGS #define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction #endif -#if defined(__x86_64__) +#if (defined(x86_64) || defined(__x86_64__)) #include -#define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs) +#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 @@ -309,7 +309,7 @@ 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)) +#elif (defined(x86_64) || defined(__x86_64__)) #include #define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.__gregs) #define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[_REG_RIP] @@ -336,12 +336,12 @@ static void powerpc_decode_instruction(instruction_t *instruction, unsigned int #endif #if (defined(i386) || defined(__i386__)) #define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs) -#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[14] /* should use REG_EIP instead */ +#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__)) #define SIGSEGV_CONTEXT_REGS (((ucontext_t *)scp)->uc_mcontext.gregs) -#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_CONTEXT_REGS[16] /* should use REG_RIP instead */ +#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 #elif (defined(ia64) || defined(__ia64__)) @@ -765,38 +765,37 @@ handleExceptions(void *priv) #ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION // Decode and skip X86 instruction -#if (defined(i386) || defined(__i386__) || defined(_M_IX86)) || (defined(__x86_64__) || defined(_M_X64)) +#if (defined(i386) || defined(__i386__) || defined(_M_IX86) || defined(x86_64) || defined(__x86_64__) || defined(_M_X64)) #if defined(__linux__) enum { #if (defined(i386) || defined(__i386__)) - X86_REG_EIP = 14, - X86_REG_EAX = 11, - X86_REG_ECX = 10, - X86_REG_EDX = 9, - X86_REG_EBX = 8, - X86_REG_ESP = 7, - X86_REG_EBP = 6, - X86_REG_ESI = 5, - X86_REG_EDI = 4 -#endif -#if defined(__x86_64__) - X86_REG_R8 = 0, - X86_REG_R9 = 1, - X86_REG_R10 = 2, - X86_REG_R11 = 3, - X86_REG_R12 = 4, - X86_REG_R13 = 5, - X86_REG_R14 = 6, - X86_REG_R15 = 7, - X86_REG_EDI = 8, - X86_REG_ESI = 9, - X86_REG_EBP = 10, - X86_REG_EBX = 11, - X86_REG_EDX = 12, - X86_REG_EAX = 13, - X86_REG_ECX = 14, - X86_REG_ESP = 15, - X86_REG_EIP = 16 + X86_REG_EIP = REG_EIP, + X86_REG_EAX = REG_EAX, + X86_REG_ECX = REG_ECX, + X86_REG_EDX = REG_EDX, + X86_REG_EBX = REG_EBX, + X86_REG_ESP = REG_ESP, + X86_REG_EBP = REG_EBP, + X86_REG_ESI = REG_ESI, + X86_REG_EDI = REG_EDI +#elif (defined(x86_64) || 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 = REG_RDI, + X86_REG_ESI = REG_RSI, + X86_REG_EBP = REG_RBP, + X86_REG_EBX = REG_RBX, + X86_REG_EDX = REG_RDX, + X86_REG_EAX = REG_RAX, + X86_REG_ECX = REG_RCX, + X86_REG_ESP = REG_RSP, + X86_REG_EIP = REG_RIP #endif }; #endif @@ -812,7 +811,7 @@ enum { X86_REG_EBP = _REG_EBP, X86_REG_ESI = _REG_ESI, X86_REG_EDI = _REG_EDI -#elif (defined(__x86_64__) || defined(x86_64)) +#elif (defined(x86_64) || defined(__x86_64__)) X86_REG_EIP = _REG_RIP, X86_REG_EAX = _REG_RAX, X86_REG_ECX = _REG_RCX, @@ -845,8 +844,7 @@ enum { X86_REG_EBP = 2, X86_REG_ESI = 1, X86_REG_EDI = 0 -#endif -#if (defined(x86_64) || defined(__x86_64__)) +#elif (defined(x86_64) || defined(__x86_64__)) X86_REG_EDI = 0, X86_REG_ESI = 1, X86_REG_EDX = 2, @@ -869,7 +867,7 @@ enum { #endif #if defined(__OpenBSD__) enum { -#if defined(__i386__) +#if (defined(i386) || defined(__i386__)) // EDI is the first register we consider #define OREG(REG) offsetof(struct sigcontext, sc_##REG) #define DREG(REG) ((OREG(REG) - OREG(edi)) / 4) @@ -890,7 +888,7 @@ enum { #if defined(__sun__) // Same as for Linux, need to check for x86-64 enum { -#if defined(__i386__) +#if (defined(i386) || defined(__i386__)) X86_REG_EIP = EIP, X86_REG_EAX = EAX, X86_REG_ECX = ECX, @@ -900,7 +898,7 @@ enum { X86_REG_EBP = EBP, X86_REG_ESI = ESI, X86_REG_EDI = EDI -#elif defined(__x86_64__) +#elif (defined(x86_64) || defined(__x86_64__)) X86_REG_R8 = REG_R8, X86_REG_R9 = REG_R9, X86_REG_R10 = REG_R10, @@ -3394,7 +3392,7 @@ static sigsegv_return_t sigsegv_insn_handler(sigsegv_info_t *sip) // More sophisticated tests for instruction skipper static bool arch_insn_skipper_tests() { -#if (defined(i386) || defined(__i386__)) || (defined(__x86_64__) || defined(_M_X64)) +#if (defined(i386) || defined(__i386__) || defined(x86_64) || defined(__x86_64__) || defined(_M_X64)) static const unsigned char code[] = { 0x8a, 0x00, // mov (%eax),%al 0x8a, 0x2c, 0x18, // mov (%eax,%ebx,1),%ch @@ -3408,7 +3406,7 @@ static bool arch_insn_skipper_tests() 0x8b, 0x0c, 0x18, // mov (%eax,%ebx,1),%ecx 0x89, 0x00, // mov %eax,(%eax) 0x89, 0x0c, 0x18, // mov %ecx,(%eax,%ebx,1) -#if defined(__x86_64__) || defined(_M_X64) +#if defined(x86_64) || defined(__x86_64__) || defined(_M_X64) 0x44, 0x8a, 0x00, // mov (%rax),%r8b 0x44, 0x8a, 0x20, // mov (%rax),%r12b 0x42, 0x8a, 0x3c, 0x10, // mov (%rax,%r10,1),%dil From 6da609938e5430c08903a43576ce6a5eb79e5c99 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:18:36 +0100 Subject: [PATCH 07/13] Merge prefs_unix.cpp Replaced SheepShaver's prefs_unix.cpp with a symlink to Basilisk II's version, and used ifdefs to account for the remaining differences. --- BasiliskII/src/Unix/prefs_unix.cpp | 33 +++- SheepShaver/src/Unix/prefs_unix.cpp | 272 +--------------------------- 2 files changed, 27 insertions(+), 278 deletions(-) mode change 100644 => 120000 SheepShaver/src/Unix/prefs_unix.cpp diff --git a/BasiliskII/src/Unix/prefs_unix.cpp b/BasiliskII/src/Unix/prefs_unix.cpp index 75ac72d2..11c52b24 100644 --- a/BasiliskII/src/Unix/prefs_unix.cpp +++ b/BasiliskII/src/Unix/prefs_unix.cpp @@ -1,7 +1,7 @@ /* * prefs_unix.cpp - Preferences handling, Unix specific stuff * - * Basilisk II (C) 1997-2008 Christian Bauer + * Basilisk II, SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +20,7 @@ #include "sysdeps.h" #include +#include #include using std::string; @@ -27,7 +28,16 @@ using std::string; // Platform-specific preferences items prefs_desc platform_prefs_items[] = { +#ifdef SHEEPSHAVER + {"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"}, + {"etherconfig", TYPE_STRING, false, "path of network config script"}, + {"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"}, + {"keycodefile", TYPE_STRING, false, "path of keycode translation file"}, + {"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"}, + {"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"}, +#else {"fbdevicefile", TYPE_STRING, false, "path of frame buffer device specification file"}, +#endif {"dsp", TYPE_STRING, false, "audio output (dsp) device name"}, {"mixer", TYPE_STRING, false, "audio mixer device name"}, {"idlewait", TYPE_BOOLEAN, false, "sleep when idle"}, @@ -38,11 +48,19 @@ prefs_desc platform_prefs_items[] = { }; // Standard file names and paths +#ifdef SHEEPSHAVER +static const char PREFS_FILE_NAME[] = "/.sheepshaver_prefs"; +static const char XDG_PREFS_FILE_NAME[] = "/prefs"; +static const char XPRAM_FILE_NAME[] = "/.sheepshaver_nvram"; +static const char XDG_XPRAM_FILE_NAME[] = "/nvram"; +static const char XDG_CONFIG_SUBDIR[] = "/SheepShaver"; +#else static const char PREFS_FILE_NAME[] = "/.basilisk_ii_prefs"; static const char XDG_PREFS_FILE_NAME[] = "/prefs"; static const char XPRAM_FILE_NAME[] = "/.basilisk_ii_xpram"; static const char XDG_XPRAM_FILE_NAME[] = "/xpram"; static const char XDG_CONFIG_SUBDIR[] = "/BasiliskII"; +#endif // Prefs file name and path string UserPrefsPath; @@ -87,8 +105,8 @@ static void exit_if_dir(const string& path) } if ((info.st_mode & S_IFDIR) != 0) { - fprintf(stderr, "ERROR: Cannot open %s (Is a directory)\n", prefs_name.c_str()); - exit(1); + fprintf(stderr, "ERROR: Cannot open %s (Is a directory)\n", prefs_name.c_str()); + exit(1); } } @@ -119,6 +137,7 @@ static bool load_prefs_file(const string& path, bool exit_on_failure) * 3. From $HOME/.basilisk_ii_prefs if it exists * 4. From $XDG_CONFIG_HOME/BasiliskII/prefs if it exists * 5. Create a new prefs file at $XDG_CONFIG_HOME/BasiliskII/prefs + * (or the equivalent paths for SheepShaver) * If $XDG_CONFIG_HOME doesn't exist, $HOME/.config is used instead, * in accordance with XDG Base Directory Specification: * https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html @@ -135,7 +154,7 @@ void LoadPrefs(const char* vmdir) prefs_name = string(vmdir) + XDG_PREFS_FILE_NAME; xpram_name = string(vmdir) + XDG_XPRAM_FILE_NAME; if (load_prefs_file(prefs_name, true)) - return; + return; } // --config was specified @@ -144,7 +163,7 @@ void LoadPrefs(const char* vmdir) prefs_name = UserPrefsPath; xpram_name = get_dir(&prefs_name) + XPRAM_FILE_NAME; if (load_prefs_file(prefs_name, true)) - return; + return; } // Load .basilisk_ii_prefs from $HOME if it exists @@ -153,7 +172,7 @@ void LoadPrefs(const char* vmdir) prefs_name = home_dir + PREFS_FILE_NAME; xpram_name = home_dir + XPRAM_FILE_NAME; if (load_prefs_file(prefs_name, false)) - return; + return; } // If no other prefs file exists, try the $XDG_CONFIG_HOME directory @@ -162,7 +181,7 @@ void LoadPrefs(const char* vmdir) prefs_name = xdg_config_dir + XDG_PREFS_FILE_NAME; xpram_name = xdg_config_dir + XDG_XPRAM_FILE_NAME; if (load_prefs_file(prefs_name, false)) - return; + return; } // No prefs file, save defaults in $XDG_CONFIG_HOME directory diff --git a/SheepShaver/src/Unix/prefs_unix.cpp b/SheepShaver/src/Unix/prefs_unix.cpp deleted file mode 100644 index f8784b09..00000000 --- a/SheepShaver/src/Unix/prefs_unix.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/* - * prefs_unix.cpp - Preferences handling, Unix specific stuff - * - * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "sysdeps.h" -#include -#include -using std::string; - -#include "prefs.h" - -// Platform-specific preferences items -prefs_desc platform_prefs_items[] = { - {"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"}, - {"etherconfig", TYPE_STRING, false, "path of network config script"}, - {"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"}, - {"keycodefile", TYPE_STRING, false, "path of keycode translation file"}, - {"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"}, - {"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"}, - {"dsp", TYPE_STRING, false, "audio output (dsp) device name"}, - {"mixer", TYPE_STRING, false, "audio mixer device name"}, - {"idlewait", TYPE_BOOLEAN, false, "sleep when idle"}, -#ifdef USE_SDL_VIDEO - {"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"}, -#endif - {NULL, TYPE_END, false, NULL} // End of list -}; - -// Standard file names and paths -static const char PREFS_FILE_NAME[] = "/.sheepshaver_prefs"; -static const char XDG_PREFS_FILE_NAME[] = "/prefs"; -static const char XPRAM_FILE_NAME[] = "/.sheepshaver_nvram"; -static const char XDG_XPRAM_FILE_NAME[] = "/nvram"; -static const char XDG_CONFIG_SUBDIR[] = "/SheepShaver"; - -// Prefs file name and path -string UserPrefsPath; -static string home_dir; -static string xdg_config_dir; -static string prefs_name; -extern string xpram_name; - -static string get_xdg_config_dir(void) -{ - char *env; - if (env = getenv("XDG_CONFIG_HOME")) - return string(env) + XDG_CONFIG_SUBDIR; - if (env = getenv("HOME")) - return string(env) + "/.config" + XDG_CONFIG_SUBDIR; - return ""; -} - -static string get_home_dir(void) -{ - char *env; - if(env = getenv("HOME")) - return string(env); - return "."; // last resort, use the current directory -} - -static string get_dir(string *path) -{ - int pos = path->find_last_of('/'); - if (pos == 0) - return ""; // file is in root folder - if (pos == std::string::npos) - return "."; // file is in current folder - return path->substr(0, pos); -} - -static void exit_if_dir(const string& path) -{ - struct stat info; - if (stat(path.c_str(), &info) != 0){ - return; - } - if ((info.st_mode & S_IFDIR) != 0) - { - fprintf(stderr, "ERROR: Cannot open %s (Is a directory)\n", prefs_name.c_str()); - exit(1); - } -} - -static bool load_prefs_file(const string& path, bool exit_on_failure) -{ - exit_if_dir(path); - FILE *prefs = fopen(path.c_str(), "r"); - if (prefs != NULL) - { - LoadPrefsFromStream(prefs); - fclose(prefs); - printf("Using prefs file at %s\n", prefs_name.c_str()); - return true; - } - else if (exit_on_failure) - { - fprintf(stderr, "ERROR: Could not load prefs file from %s (%s)\n", - path.c_str(), strerror(errno)); - exit(1); - } - return false; -} - -/* - * Look for prefs file in the following locations (in order of priority): - * 1. From vmdir/.sheepshaver_prefs if a vmdir has been specified - * 2. From path specified with --config command line - * 3. From $HOME/.sheepshaver_prefs if it exists - * 4. From $XDG_CONFIG_HOME/SheepShaver/prefs if it exists - * 5. Create a new prefs file at $XDG_CONFIG_HOME/SheepShaver/prefs - * If $XDG_CONFIG_HOME doesn't exist, $HOME/.config is used instead, - * in accordance with XDG Base Directory Specification: - * https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html - */ - -void LoadPrefs(const char* vmdir) -{ - home_dir = get_home_dir(); - xdg_config_dir = get_xdg_config_dir(); - - // vmdir was specified on the command line - if (vmdir) - { - prefs_name = string(vmdir) + XDG_PREFS_FILE_NAME; - xpram_name = string(vmdir) + XDG_XPRAM_FILE_NAME; - if (load_prefs_file(prefs_name, true)) - return; - } - - // --config was specified - if (!UserPrefsPath.empty()) - { - prefs_name = UserPrefsPath; - xpram_name = get_dir(&prefs_name) + XPRAM_FILE_NAME; - if (load_prefs_file(prefs_name, true)) - return; - } - - // Load .basilisk_ii_prefs from $HOME if it exists - if (!home_dir.empty()) - { - prefs_name = home_dir + PREFS_FILE_NAME; - xpram_name = home_dir + XPRAM_FILE_NAME; - if (load_prefs_file(prefs_name, false)) - return; - } - - // If no other prefs file exists, try the $XDG_CONFIG_HOME directory - if (!xdg_config_dir.empty()) - { - prefs_name = xdg_config_dir + XDG_PREFS_FILE_NAME; - xpram_name = xdg_config_dir + XDG_XPRAM_FILE_NAME; - if (load_prefs_file(prefs_name, false)) - return; - } - - // No prefs file, save defaults in $XDG_CONFIG_HOME directory -#ifdef __linux__ - PrefsAddString("cdrom", "/dev/cdrom"); -#endif - printf("No prefs file found, creating new one at %s\n", prefs_name.c_str()); - SavePrefs(); -} - -static bool is_dir(const string& path) -{ - struct stat info; - if (stat(path.c_str(), &info) != 0){ - return false; - } - return (info.st_mode & S_IFDIR) != 0; -} - -static bool create_directories(const string& path, mode_t mode) -{ - if (mkdir(path.c_str(), mode) == 0) - return true; - - switch (errno) - { - case ENOENT: - { - int pos = path.find_last_of('/'); - if (pos == std::string::npos) - return false; - if (!create_directories(path.substr(0,pos),mode)) - return false; - } - return 0 == mkdir(path.c_str(),mode); - - case EEXIST: - return is_dir(path); - default: - return false; - } -} - -/* - * Save preferences to settings file - */ - -void SavePrefs(void) -{ - FILE *f; - string prefs_dir = get_dir(&prefs_name); - if (!prefs_dir.empty() && !is_dir(prefs_dir)) - { - create_directories(prefs_dir, 0700); - } - if ((f = fopen(prefs_name.c_str(), "w")) != NULL) - { - SavePrefsToStream(f); - fclose(f); - } - else - { - fprintf(stderr, "WARNING: Unable to save %s (%s)\n", - prefs_name.c_str(), strerror(errno)); - } -} - -/* - * Add defaults of platform-specific prefs items - * You may also override the defaults set in PrefsInit() - */ - -void AddPlatformPrefsDefaults(void) -{ - PrefsAddBool("keycodes", false); - PrefsReplaceString("extfs", "/"); - PrefsReplaceInt32("mousewheelmode", 1); - PrefsReplaceInt32("mousewheellines", 3); -#ifdef __linux__ - if (access("/dev/sound/dsp", F_OK) == 0) - { - PrefsReplaceString("dsp", "/dev/sound/dsp"); - } - else - { - PrefsReplaceString("dsp", "/dev/dsp"); - } - if (access("/dev/sound/mixer", F_OK) == 0) - { - PrefsReplaceString("mixer", "/dev/sound/mixer"); - } - else - { - PrefsReplaceString("mixer", "/dev/mixer"); - } -#else - PrefsReplaceString("dsp", "/dev/dsp"); - PrefsReplaceString("mixer", "/dev/mixer"); -#endif - PrefsAddBool("idlewait", true); -} diff --git a/SheepShaver/src/Unix/prefs_unix.cpp b/SheepShaver/src/Unix/prefs_unix.cpp new file mode 120000 index 00000000..eba7c265 --- /dev/null +++ b/SheepShaver/src/Unix/prefs_unix.cpp @@ -0,0 +1 @@ +../../../BasiliskII/src/Unix/prefs_unix.cpp \ No newline at end of file From fdeb8617dac37205c40aa42d6fd0eb7e25616e56 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:20:13 +0100 Subject: [PATCH 08/13] Remove unnecessary warning if xpram file doesn't exist --- BasiliskII/src/Unix/xpram_unix.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/BasiliskII/src/Unix/xpram_unix.cpp b/BasiliskII/src/Unix/xpram_unix.cpp index dcf9c0bf..29b9aeea 100644 --- a/BasiliskII/src/Unix/xpram_unix.cpp +++ b/BasiliskII/src/Unix/xpram_unix.cpp @@ -41,11 +41,6 @@ void LoadXPRAM(const char* vmdir) read(fd, XPRAM, XPRAM_SIZE); close(fd); } - else - { - fprintf(stderr, "WARNING: Unable to load %s (%s)\n", - xpram_name.c_str(), strerror(errno)); - } } /* From 4b58ce3ea80902285c4b0d063ffe12fce4294159 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 8 Oct 2022 17:55:42 +0100 Subject: [PATCH 09/13] Added xpram_unix.cpp to SheepShaver "make links" --- SheepShaver/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SheepShaver/Makefile b/SheepShaver/Makefile index 0a511ff3..2cae1c49 100644 --- a/SheepShaver/Makefile +++ b/SheepShaver/Makefile @@ -68,7 +68,7 @@ links: Unix/vhd_unix.cpp \ Unix/extfs_unix.cpp Unix/serial_unix.cpp \ Unix/sshpty.h Unix/sshpty.c Unix/strlcpy.h Unix/strlcpy.c \ - Unix/sys_unix.cpp Unix/timer_unix.cpp Unix/xpram_unix.cpp \ + Unix/sys_unix.cpp Unix/timer_unix.cpp Unix/xpram_unix.cpp Unix/prefs_unix.cpp \ Unix/semaphore.h Unix/posix_sem.cpp Unix/config.sub Unix/config.guess Unix/m4 \ Unix/keycodes Unix/tunconfig Unix/clip_unix.cpp Unix/Irix/audio_irix.cpp \ Unix/Linux/scsi_linux.cpp Unix/Linux/NetDriver Unix/ether_unix.cpp \ From f61701df3c8bf2c44243097d0d76bdbb171e4a84 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 8 Oct 2022 18:37:43 +0100 Subject: [PATCH 10/13] Fixes for compatibility with older Linux versions - Check for both -no_pie and -no-pie flags to disable position-independent code. - Use AC_PROG_CC_C99 to force C99 standard. --- BasiliskII/src/Unix/configure.ac | 24 +++++++++++++++++++----- SheepShaver/src/Unix/configure.ac | 18 ++++++++++++------ 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/BasiliskII/src/Unix/configure.ac b/BasiliskII/src/Unix/configure.ac index 427410a0..a62dd9e4 100755 --- a/BasiliskII/src/Unix/configure.ac +++ b/BasiliskII/src/Unix/configure.ac @@ -218,7 +218,7 @@ if [[ "x$HAVE_I386" = "xyes" ]]; then fi dnl Checks for programs. -AC_PROG_CC +AC_PROG_CC_C99 AC_PROG_CC_C_O AC_PROG_CPP AC_PROG_CXX @@ -1123,6 +1123,24 @@ AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", fi dnl HAVE_MMAP_VM +dnl Check if we can disable position-independent code +AC_CACHE_CHECK([for flag to disable position-independent code], + ac_cv_no_pie, [ + saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,-no-pie" + AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ + ac_cv_no_pie="-no-pie"],[ + LDFLAGS="$saved_LDFLAGS -Wl,-no_pie" + AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ + ac_cv_no_pie="-no_pie"],[ + ac_cv_no_pie="none" + ]) + ]) + if [[ "$ac_cv_no_pie" = "none" ]]; then + LDFLAGS="$saved_LDFLAGS" + fi +]) + dnl Check if we can modify the __PAGEZERO segment for use as Low Memory AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000], ac_cv_pagezero_hack, [ @@ -1473,10 +1491,6 @@ if [[ "x$OS_TYPE" = "xdarwin" ]]; then fi fi -if [[ "x$OS_TYPE" = "xlinux" ]]; then - LDFLAGS="$LDFLAGS -no-pie" -fi - dnl Enable VOSF screen updates with this feature is requested and feasible if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.]) diff --git a/SheepShaver/src/Unix/configure.ac b/SheepShaver/src/Unix/configure.ac index b9e49639..10df4bb3 100755 --- a/SheepShaver/src/Unix/configure.ac +++ b/SheepShaver/src/Unix/configure.ac @@ -75,7 +75,7 @@ AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX d AC_ARG_WITH(sdl1, [ --with-sdl1 use SDL 1.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=1], []) dnl Checks for programs. -AC_PROG_CC +AC_PROG_CC_C99 AC_PROG_CPP AC_PROG_CXX AC_PROG_MAKE_SET @@ -988,13 +988,19 @@ AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm, fi dnl HAVE_MMAP_VM dnl Check if we can disable position-independent code -AC_CACHE_CHECK([how to disable position-independent code], +AC_CACHE_CHECK([for flag to disable position-independent code], ac_cv_no_pie, [ - ac_cv_no_pie='-Wl,-no_pie' saved_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $ac_cv_no_pie" - AC_TRY_LINK(,,,[ac_cv_no_pie="cannot"]) - if [[ "$ac_cv_no_pie" = "cannot" ]]; then + LDFLAGS="$LDFLAGS -Wl,-no-pie" + AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ + ac_cv_no_pie="-no-pie"],[ + LDFLAGS="$saved_LDFLAGS -Wl,-no_pie" + AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ + ac_cv_no_pie="-no_pie"],[ + ac_cv_no_pie="none" + ]) + ]) + if [[ "$ac_cv_no_pie" = "none" ]]; then LDFLAGS="$saved_LDFLAGS" fi ]) From cb67534d28d21cd706990747e976c4f3e631f302 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Mon, 10 Oct 2022 14:50:04 +0100 Subject: [PATCH 11/13] Changed conftests for disabling position-independent code Basilisk II (Intel Mac): uses -Wl,-no_pie flag Basilisk II (other): uses -no-pie flag if available SheepShaver: Does not use either flag --- BasiliskII/src/Unix/configure.ac | 14 +++++--------- SheepShaver/src/Unix/configure.ac | 18 ------------------ 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/BasiliskII/src/Unix/configure.ac b/BasiliskII/src/Unix/configure.ac index a62dd9e4..c035f84d 100755 --- a/BasiliskII/src/Unix/configure.ac +++ b/BasiliskII/src/Unix/configure.ac @@ -1124,19 +1124,15 @@ AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", fi dnl HAVE_MMAP_VM dnl Check if we can disable position-independent code -AC_CACHE_CHECK([for flag to disable position-independent code], +AC_CACHE_CHECK([whether the compiler supports -no-pie], ac_cv_no_pie, [ saved_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -Wl,-no-pie" + LDFLAGS="$LDFLAGS -no-pie" AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ - ac_cv_no_pie="-no-pie"],[ - LDFLAGS="$saved_LDFLAGS -Wl,-no_pie" - AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ - ac_cv_no_pie="-no_pie"],[ - ac_cv_no_pie="none" - ]) + ac_cv_no_pie="yes"],[ + ac_cv_no_pie="no" ]) - if [[ "$ac_cv_no_pie" = "none" ]]; then + if [[ "$ac_cv_no_pie" = "no" ]]; then LDFLAGS="$saved_LDFLAGS" fi ]) diff --git a/SheepShaver/src/Unix/configure.ac b/SheepShaver/src/Unix/configure.ac index 10df4bb3..071426f4 100755 --- a/SheepShaver/src/Unix/configure.ac +++ b/SheepShaver/src/Unix/configure.ac @@ -987,24 +987,6 @@ AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm, fi dnl HAVE_MMAP_VM -dnl Check if we can disable position-independent code -AC_CACHE_CHECK([for flag to disable position-independent code], - ac_cv_no_pie, [ - saved_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -Wl,-no-pie" - AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ - ac_cv_no_pie="-no-pie"],[ - LDFLAGS="$saved_LDFLAGS -Wl,-no_pie" - AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ - ac_cv_no_pie="-no_pie"],[ - ac_cv_no_pie="none" - ]) - ]) - if [[ "$ac_cv_no_pie" = "none" ]]; then - LDFLAGS="$saved_LDFLAGS" - fi -]) - dnl Check if we can modify the __PAGEZERO segment for use as Low Memory AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x3000], ac_cv_pagezero_hack, [ From 0118e99764a5cb1e4e84dd51382d8fd44a8d2962 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Tue, 11 Oct 2022 15:55:57 +0100 Subject: [PATCH 12/13] Basilisk II: Skip test for -no-pie flag in macOS --- BasiliskII/src/Unix/configure.ac | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/BasiliskII/src/Unix/configure.ac b/BasiliskII/src/Unix/configure.ac index c035f84d..19307fa2 100755 --- a/BasiliskII/src/Unix/configure.ac +++ b/BasiliskII/src/Unix/configure.ac @@ -1123,19 +1123,21 @@ AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", fi dnl HAVE_MMAP_VM -dnl Check if we can disable position-independent code -AC_CACHE_CHECK([whether the compiler supports -no-pie], - ac_cv_no_pie, [ - saved_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -no-pie" - AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ - ac_cv_no_pie="yes"],[ - ac_cv_no_pie="no" +if [[ "$OS_TYPE" != "darwin" ]]; then + dnl Check if we can disable position-independent code + AC_CACHE_CHECK([whether the compiler supports -no-pie], + ac_cv_no_pie, [ + saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -no-pie" + AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ + ac_cv_no_pie="yes"],[ + ac_cv_no_pie="no" + ]) + if [[ "$ac_cv_no_pie" = "no" ]]; then + LDFLAGS="$saved_LDFLAGS" + fi ]) - if [[ "$ac_cv_no_pie" = "no" ]]; then - LDFLAGS="$saved_LDFLAGS" - fi -]) +fi dnl Check if we can modify the __PAGEZERO segment for use as Low Memory AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000], From ae9d917d5e8a902a2194135b3ed5d5272588c31b Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Tue, 11 Oct 2022 17:27:24 +0100 Subject: [PATCH 13/13] Apply NetBSD pkgsrc patches Patches obtained from https://github.com/NetBSD/pkgsrc/blob/trunk/emulators/BasiliskII/ --- BasiliskII/src/Unix/prefs_unix.cpp | 3 +++ BasiliskII/src/Unix/sysdeps.h | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/BasiliskII/src/Unix/prefs_unix.cpp b/BasiliskII/src/Unix/prefs_unix.cpp index 11c52b24..a9daba85 100644 --- a/BasiliskII/src/Unix/prefs_unix.cpp +++ b/BasiliskII/src/Unix/prefs_unix.cpp @@ -278,6 +278,9 @@ void AddPlatformPrefsDefaults(void) { PrefsReplaceString("mixer", "/dev/mixer"); } +#elif defined (__NetBSD__) + PrefsReplaceString("dsp", "/dev/audio"); + PrefsReplaceString("mixer", "/dev/mixer"); #else PrefsReplaceString("dsp", "/dev/dsp"); PrefsReplaceString("mixer", "/dev/mixer"); diff --git a/BasiliskII/src/Unix/sysdeps.h b/BasiliskII/src/Unix/sysdeps.h index d1e25229..a4a7ed97 100644 --- a/BasiliskII/src/Unix/sysdeps.h +++ b/BasiliskII/src/Unix/sysdeps.h @@ -122,11 +122,6 @@ #ifdef HAVE_PTHREADS #define USE_PTHREADS_SERVICES #endif -#if EMULATED_68K -#if defined(__NetBSD__) -#define USE_CPU_EMUL_SERVICES -#endif -#endif #ifdef USE_CPU_EMUL_SERVICES #undef USE_PTHREADS_SERVICES #endif