123 |
|
static pthread_t tick_thread; // 60Hz thread |
124 |
|
static pthread_attr_t tick_thread_attr; // 60Hz thread attributes |
125 |
|
|
126 |
– |
#if EMULATED_68K |
126 |
|
static pthread_mutex_t intflag_lock = PTHREAD_MUTEX_INITIALIZER; // Mutex to protect InterruptFlags |
127 |
< |
#endif |
127 |
> |
#define LOCK_INTFLAGS pthread_mutex_lock(&intflag_lock) |
128 |
> |
#define UNLOCK_INTFLAGS pthread_mutex_unlock(&intflag_lock) |
129 |
> |
|
130 |
> |
#else |
131 |
> |
|
132 |
> |
#define LOCK_INTFLAGS |
133 |
> |
#define UNLOCK_INTFLAGS |
134 |
> |
|
135 |
|
#endif |
136 |
|
|
137 |
|
#if !EMULATED_68K |
674 |
|
extern void m68k_dumpstate(uaecptr *nextpc); |
675 |
|
m68k_dumpstate(&nextpc); |
676 |
|
#endif |
677 |
+ |
VideoQuitFullScreen(); |
678 |
|
char *arg[4] = {"mon", "-m", "-r", NULL}; |
679 |
|
mon(3, arg); |
680 |
|
QuitEmulator(); |
683 |
|
|
684 |
|
|
685 |
|
/* |
686 |
+ |
* Mutexes |
687 |
+ |
*/ |
688 |
+ |
|
689 |
+ |
#ifdef HAVE_PTHREADS |
690 |
+ |
|
691 |
+ |
struct B2_mutex { |
692 |
+ |
B2_mutex() { pthread_mutex_init(&m, NULL); } |
693 |
+ |
~B2_mutex() { pthread_mutex_unlock(&m); pthread_mutex_destroy(&m); } |
694 |
+ |
pthread_mutex_t m; |
695 |
+ |
}; |
696 |
+ |
|
697 |
+ |
B2_mutex *B2_create_mutex(void) |
698 |
+ |
{ |
699 |
+ |
return new B2_mutex; |
700 |
+ |
} |
701 |
+ |
|
702 |
+ |
void B2_lock_mutex(B2_mutex *mutex) |
703 |
+ |
{ |
704 |
+ |
pthread_mutex_lock(&mutex->m); |
705 |
+ |
} |
706 |
+ |
|
707 |
+ |
void B2_unlock_mutex(B2_mutex *mutex) |
708 |
+ |
{ |
709 |
+ |
pthread_mutex_unlock(&mutex->m); |
710 |
+ |
} |
711 |
+ |
|
712 |
+ |
void B2_delete_mutex(B2_mutex *mutex) |
713 |
+ |
{ |
714 |
+ |
delete mutex; |
715 |
+ |
} |
716 |
+ |
|
717 |
+ |
#else |
718 |
+ |
|
719 |
+ |
struct B2_mutex { |
720 |
+ |
int dummy; |
721 |
+ |
}; |
722 |
+ |
|
723 |
+ |
B2_mutex *B2_create_mutex(void) |
724 |
+ |
{ |
725 |
+ |
return new B2_mutex; |
726 |
+ |
} |
727 |
+ |
|
728 |
+ |
void B2_lock_mutex(B2_mutex *mutex) |
729 |
+ |
{ |
730 |
+ |
} |
731 |
+ |
|
732 |
+ |
void B2_unlock_mutex(B2_mutex *mutex) |
733 |
+ |
{ |
734 |
+ |
} |
735 |
+ |
|
736 |
+ |
void B2_delete_mutex(B2_mutex *mutex) |
737 |
+ |
{ |
738 |
+ |
delete mutex; |
739 |
+ |
} |
740 |
+ |
|
741 |
+ |
#endif |
742 |
+ |
|
743 |
+ |
|
744 |
+ |
/* |
745 |
|
* Interrupt flags (must be handled atomically!) |
746 |
|
*/ |
747 |
|
|
750 |
|
#if EMULATED_68K |
751 |
|
void SetInterruptFlag(uint32 flag) |
752 |
|
{ |
753 |
< |
#ifdef HAVE_PTHREADS |
688 |
< |
pthread_mutex_lock(&intflag_lock); |
753 |
> |
LOCK_INTFLAGS; |
754 |
|
InterruptFlags |= flag; |
755 |
< |
pthread_mutex_unlock(&intflag_lock); |
691 |
< |
#else |
692 |
< |
InterruptFlags |= flag; // Pray that this is an atomic operation... |
693 |
< |
#endif |
755 |
> |
UNLOCK_INTFLAGS; |
756 |
|
} |
757 |
|
|
758 |
|
void ClearInterruptFlag(uint32 flag) |
759 |
|
{ |
760 |
< |
#ifdef HAVE_PTHREADS |
699 |
< |
pthread_mutex_lock(&intflag_lock); |
760 |
> |
LOCK_INTFLAGS; |
761 |
|
InterruptFlags &= ~flag; |
762 |
< |
pthread_mutex_unlock(&intflag_lock); |
702 |
< |
#else |
703 |
< |
InterruptFlags &= ~flag; |
704 |
< |
#endif |
762 |
> |
UNLOCK_INTFLAGS; |
763 |
|
} |
764 |
|
#endif |
765 |
|
|
1255 |
|
for (int i=0; i<8; i++) |
1256 |
|
printf(" a%d %08x\n", i, state->ss_frame.f_regs[i+8]); |
1257 |
|
|
1258 |
+ |
VideoQuitFullScreen(); |
1259 |
|
#ifdef ENABLE_MON |
1260 |
|
char *arg[4] = {"mon", "-m", "-r", NULL}; |
1261 |
|
mon(3, arg); |