mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-19 09:30:56 +00:00
Add changes from Brian Johnson:
- Update MIPSpro compiler flags - Only define static variables if they are to be used - Try to lock the pthreads mutex prior to unlocking/destroying it
This commit is contained in:
parent
3711aa4520
commit
1477b501d1
@ -360,13 +360,13 @@ irix*)
|
|||||||
LIBS="$LIBS -laudio"
|
LIBS="$LIBS -laudio"
|
||||||
WANT_ESD=no
|
WANT_ESD=no
|
||||||
|
|
||||||
dnl Check if our compiler supports -Ofast (MIPSPro)
|
dnl Check if our compiler supports -IPA (MIPSPro)
|
||||||
HAVE_OFAST=no
|
HAVE_IPA=no
|
||||||
ocflags="$CFLAGS"
|
ocflags="$CFLAGS"
|
||||||
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'`
|
CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"`
|
||||||
AC_MSG_CHECKING(if "-Ofast" works)
|
AC_MSG_CHECKING(if "-IPA" works)
|
||||||
dnl Do a test compile of an empty function
|
dnl Do a test compile of an empty function
|
||||||
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no))
|
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
|
||||||
CFLAGS="$ocflags"
|
CFLAGS="$ocflags"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
@ -1092,12 +1092,12 @@ if [[ "x$HAVE_GCC27" = "xyes" ]]; then
|
|||||||
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
|
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Or if we have -Ofast
|
dnl Or if we have -IPA (MIPSPro compilers)
|
||||||
if [[ "x$HAVE_OFAST" = "xyes" ]]; then
|
if [[ "x$HAVE_IPA" = "xyes" ]]; then
|
||||||
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
|
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
|
||||||
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
|
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
|
||||||
CXXFLAGS="-LANG:std $CXXFLAGS"
|
CXXFLAGS="-LANG:std $CXXFLAGS"
|
||||||
LDFLAGS="$LDFLAGS -ipa"
|
LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Generate Makefile.
|
dnl Generate Makefile.
|
||||||
|
@ -94,7 +94,9 @@ extern void (*flush_icache)(int); // from compemu_support.cpp
|
|||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
const char ROM_FILE_NAME[] = "ROM";
|
const char ROM_FILE_NAME[] = "ROM";
|
||||||
|
#if !EMULATED_68K
|
||||||
const int SIG_STACK_SIZE = SIGSTKSZ; // Size of signal stack
|
const int SIG_STACK_SIZE = SIGSTKSZ; // Size of signal stack
|
||||||
|
#endif
|
||||||
const int SCRATCH_MEM_SIZE = 0x10000; // Size of scratch memory area
|
const int SCRATCH_MEM_SIZE = 0x10000; // Size of scratch memory area
|
||||||
|
|
||||||
|
|
||||||
@ -123,7 +125,9 @@ Display *x_display = NULL; // X11 display handle
|
|||||||
static uint8 last_xpram[XPRAM_SIZE]; // Buffer for monitoring XPRAM changes
|
static uint8 last_xpram[XPRAM_SIZE]; // Buffer for monitoring XPRAM changes
|
||||||
|
|
||||||
#ifdef HAVE_PTHREADS
|
#ifdef HAVE_PTHREADS
|
||||||
|
#if !EMULATED_68K
|
||||||
static pthread_t emul_thread; // Handle of MacOS emulation thread (main thread)
|
static pthread_t emul_thread; // Handle of MacOS emulation thread (main thread)
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool xpram_thread_active = false; // Flag: XPRAM watchdog installed
|
static bool xpram_thread_active = false; // Flag: XPRAM watchdog installed
|
||||||
static volatile bool xpram_thread_cancel = false; // Flag: Cancel XPRAM thread
|
static volatile bool xpram_thread_cancel = false; // Flag: Cancel XPRAM thread
|
||||||
@ -157,12 +161,14 @@ uint16 EmulatedSR; // Emulated bits of SR (supervisor bit and interrupt mask
|
|||||||
uint8 *ScratchMem = NULL; // Scratch memory for Mac ROM writes
|
uint8 *ScratchMem = NULL; // Scratch memory for Mac ROM writes
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(HAVE_PTHREADS)
|
||||||
static struct sigaction timer_sa; // sigaction used for timer
|
static struct sigaction timer_sa; // sigaction used for timer
|
||||||
|
|
||||||
#if defined(HAVE_TIMER_CREATE) && defined(_POSIX_REALTIME_SIGNALS)
|
#if defined(HAVE_TIMER_CREATE) && defined(_POSIX_REALTIME_SIGNALS)
|
||||||
#define SIG_TIMER SIGRTMIN
|
#define SIG_TIMER SIGRTMIN
|
||||||
static timer_t timer; // 60Hz timer
|
static timer_t timer; // 60Hz timer
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !HAVE_PTHREADS
|
||||||
|
|
||||||
#ifdef ENABLE_MON
|
#ifdef ENABLE_MON
|
||||||
static struct sigaction sigint_sa; // sigaction for SIGINT handler
|
static struct sigaction sigint_sa; // sigaction for SIGINT handler
|
||||||
@ -503,15 +509,15 @@ int main(int argc, char **argv)
|
|||||||
QuitEmulator();
|
QuitEmulator();
|
||||||
D(bug("Initialization complete\n"));
|
D(bug("Initialization complete\n"));
|
||||||
|
|
||||||
|
#if !EMULATED_68K
|
||||||
|
// (Virtual) supervisor mode, disable interrupts
|
||||||
|
EmulatedSR = 0x2700;
|
||||||
|
|
||||||
#ifdef HAVE_PTHREADS
|
#ifdef HAVE_PTHREADS
|
||||||
// Get handle of main thread
|
// Get handle of main thread
|
||||||
emul_thread = pthread_self();
|
emul_thread = pthread_self();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !EMULATED_68K
|
|
||||||
// (Virtual) supervisor mode, disable interrupts
|
|
||||||
EmulatedSR = 0x2700;
|
|
||||||
|
|
||||||
// Create and install stack for signal handlers
|
// Create and install stack for signal handlers
|
||||||
sig_stack = malloc(SIG_STACK_SIZE);
|
sig_stack = malloc(SIG_STACK_SIZE);
|
||||||
D(bug("Signal stack at %p\n", sig_stack));
|
D(bug("Signal stack at %p\n", sig_stack));
|
||||||
@ -821,7 +827,11 @@ struct B2_mutex {
|
|||||||
pthread_mutex_init(&m, &attr);
|
pthread_mutex_init(&m, &attr);
|
||||||
pthread_mutexattr_destroy(&attr);
|
pthread_mutexattr_destroy(&attr);
|
||||||
}
|
}
|
||||||
~B2_mutex() { pthread_mutex_unlock(&m); pthread_mutex_destroy(&m); }
|
~B2_mutex() {
|
||||||
|
pthread_mutex_trylock(&m); // Make sure it's locked before
|
||||||
|
pthread_mutex_unlock(&m); // unlocking it.
|
||||||
|
pthread_mutex_destroy(&m);
|
||||||
|
}
|
||||||
pthread_mutex_t m;
|
pthread_mutex_t m;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user