From e2dda6e50615c6442e448c9739ebe4aa36bf3afe Mon Sep 17 00:00:00 2001 From: John Paul Adrian Glaubitz Date: Tue, 12 Jul 2016 09:40:25 +0200 Subject: [PATCH 1/2] Add generic platform support for Linux/m68k --- configure.in | 11 +++++++++++ src/jrd/common.h | 4 +++- src/jrd/inf_pub.h | 1 + src/jrd/pag.cpp | 10 ++++++---- src/jrd/utl.cpp | 4 ++-- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/configure.in b/configure.in index fe2cc11d0aa..4cbced57a44 100644 --- a/configure.in +++ b/configure.in @@ -354,6 +354,17 @@ dnl CPU_TYPE=ppc64 SHRLIB_EXT=so ;; + m68k*-*-linux*) + MAKEFILE_PREFIX=linux_generic + INSTALL_PREFIX=linux + PLATFORM=LINUX + AC_DEFINE(LINUX, 1, [Define this if OS is Linux]) + AC_DEFINE(M68K, 1, [Define this if CPU is M68k]) + LOCK_MANAGER_FLG=Y + EDITLINE_FLG=Y + SHRLIB_EXT=so + ;; + *-*-linux* | *-*-gnu*) MAKEFILE_PREFIX=linux_generic INSTALL_PREFIX=linux diff --git a/src/jrd/common.h b/src/jrd/common.h index ae548809297..a7b04c8a3eb 100644 --- a/src/jrd/common.h +++ b/src/jrd/common.h @@ -200,7 +200,9 @@ #define IMPLEMENTATION isc_info_db_impl_linux_ppc64el /* 85 */ #endif /* PPC64EL */ - +#ifdef M68K +#define IMPLEMENTATION isc_info_db_impl_linux_m68k /* 86 */ +#endif /* M68K */ #endif /* LINUX */ diff --git a/src/jrd/inf_pub.h b/src/jrd/inf_pub.h index de6bec31f29..8e7884aace5 100644 --- a/src/jrd/inf_pub.h +++ b/src/jrd/inf_pub.h @@ -217,6 +217,7 @@ enum info_db_implementations isc_info_db_impl_linux_alpha = 83, isc_info_db_impl_linux_arm64 = 84, isc_info_db_impl_linux_ppc64el = 85, + isc_info_db_impl_linux_m68k = 86, isc_info_db_impl_last_value // Leave this LAST! }; diff --git a/src/jrd/pag.cpp b/src/jrd/pag.cpp index 7756ae8a8cb..aac1d0180de 100644 --- a/src/jrd/pag.cpp +++ b/src/jrd/pag.cpp @@ -165,10 +165,10 @@ static const int CLASS_LINUX_HPPA = 40; // LINUX/HPPA static const int CLASS_LINUX_ALPHA = 41; // LINUX/ALPHA static const int CLASS_LINUX_ARM64 = 42; // LINUX/ARM64 static const int CLASS_LINUX_PPC64EL = 43; // LINUX/PowerPc64EL - +static const int CLASS_LINUX_M68K = 44; // LINUX/M68K static const int CLASS_MAX10 = CLASS_LINUX_AMD64; // This should not be changed, no new ports with ODS10 -static const int CLASS_MAX = CLASS_LINUX_PPC64EL; +static const int CLASS_MAX = CLASS_LINUX_M68K; // ARCHITECTURE COMPATIBILITY CLASSES @@ -269,8 +269,8 @@ static const ArchitectureType archMatrix[CLASS_MAX + 1] = archBigEndian, // CLASS_LINUX_HPPA archLittleEndian, // CLASS_LINUX_ALPHA archLittleEndian, // CLASS_LINUX_ARM64 - archLittleEndian // CLASS_LINUX_PPC64EL - + archLittleEndian, // CLASS_LINUX_PPC64EL + archBigEndian // CLASS_LINUX_M68K }; #ifdef __sun @@ -338,6 +338,8 @@ const SSHORT CLASS = CLASS_LINUX_ALPHA; const SSHORT CLASS = CLASS_LINUX_ARM64; #elif defined(PPC64EL) const SSHORT CLASS = CLASS_LINUX_PPC64EL; +#elif defined(M68K) +const SSHORT CLASS = CLASS_LINUX_M68K; #else #error no support on other hardware for Linux #endif diff --git a/src/jrd/utl.cpp b/src/jrd/utl.cpp index 63263a0a3d3..26c9228c84f 100644 --- a/src/jrd/utl.cpp +++ b/src/jrd/utl.cpp @@ -229,8 +229,8 @@ static const TEXT* const impl_implementation[] = "Firebird/linux HPPA", // 82 "Firebird/linux ALPHA", // 83 "Firebird/linux ARM64", // 84 - "Firebird/linux PPC64EL" // 85 - + "Firebird/linux PPC64EL", // 85 + "Firebird/linux M68K" // 86 }; From b45ce698c5ef4003cb1f77b0370463d01e4a57f1 Mon Sep 17 00:00:00 2001 From: Michael Karcher Date: Tue, 12 Jul 2016 09:44:46 +0200 Subject: [PATCH 2/2] Include sem_t when determining values for FB_ALIGNMENT and FB_DOUBLE_ALIGN On m68k, 'long long' is 16-bit aligned while 'sem_t' is 32-bit aligned and we must therefore include 'sem_t' when determining the values for FB_ALIGNMENT and FB_DOUBLE_ALIGN. Otherwise, the futex system call will fail on these systems. --- configure.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 4cbced57a44..ea278d69330 100644 --- a/configure.in +++ b/configure.in @@ -967,10 +967,11 @@ AC_CHECK_MEMBER([struct dirent.d_type], dnl EKU: try to determine the alignment of long and double dnl replaces FB_ALIGNMENT and FB_DOUBLE_ALIGN in src/jrd/common.h AC_MSG_CHECKING(alignment of long) -AC_TRY_RUN([main () { +AC_TRY_RUN([#include +main () { struct s { char a; - long long b; + union { long long x; sem_t y; } b; }; exit((int)&((struct s*)0)->b); }], ac_cv_c_alignment=$ac_status, ac_cv_c_alignment=$ac_status)