--- SheepShaver/src/Unix/sysdeps.h 2004/11/22 22:40:26 1.35 +++ SheepShaver/src/Unix/sysdeps.h 2005/03/27 13:41:46 1.41 @@ -1,7 +1,7 @@ /* * sysdeps.h - System dependent definitions for Linux * - * SheepShaver (C) 1997-2004 Christian Bauer and Marc Hellwig + * SheepShaver (C) 1997-2005 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 @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,17 @@ # endif #endif +// Fix offsetof() on FreeBSD and GCC >= 3.4 +#if defined(__FreeBSD__) && defined(__cplusplus) +#undef offsetof +/* The cast to "char &" below avoids problems with user-defined + "operator &", which can appear in a POD type. */ +#define offsetof(TYPE, MEMBER) \ + (__offsetof__ (reinterpret_cast \ + (&reinterpret_cast \ + (static_cast (0)->MEMBER)))) +#endif + // Define for external components #define SHEEPSHAVER 1 @@ -70,6 +82,7 @@ // Otherwise, use Direct Addressing mode if NATMEM_OFFSET is set #if !defined(EMULATED_PPC) #define REAL_ADDRESSING 1 +#include "ppc_asm.tmpl" #elif defined(__CYGWIN__) #define DIRECT_ADDRESSING 1 #define DIRECT_ADDRESSING_HACK 1 @@ -397,11 +410,17 @@ typedef struct timespec tm_time_t; typedef struct timeval tm_time_t; #endif +// High-precision timing +#if defined(HAVE_PTHREADS) && defined(HAVE_CLOCK_NANOSLEEP) && 0 +#define PRECISE_TIMING 1 +#define PRECISE_TIMING_POSIX 1 +#endif + // Timing functions extern uint64 GetTicks_usec(void); extern void Delay_usec(uint32 usec); -#if defined(HAVE_PTHREADS) || (defined(__linux__) && defined(__powerpc__)) +#if defined(HAVE_PTHREADS) || ((defined(__linux__) || defined(__NetBSD__)) && defined(__powerpc__)) // Setup pthread attributes extern void Set_pthread_attr(pthread_attr_t *attr, int priority); #endif