1 |
< |
/* |
2 |
< |
* UAE - The Un*x Amiga Emulator |
3 |
< |
* |
4 |
< |
* MC68000 emulation |
5 |
< |
* |
6 |
< |
* Copyright 1995 Bernd Schmidt |
7 |
< |
*/ |
1 |
> |
/* |
2 |
> |
* UAE - The Un*x Amiga Emulator |
3 |
> |
* |
4 |
> |
* MC68000 emulation |
5 |
> |
* |
6 |
> |
* Copyright 1995 Bernd Schmidt |
7 |
> |
* |
8 |
> |
* This program is free software; you can redistribute it and/or modify |
9 |
> |
* it under the terms of the GNU General Public License as published by |
10 |
> |
* the Free Software Foundation; either version 2 of the License, or |
11 |
> |
* (at your option) any later version. |
12 |
> |
* |
13 |
> |
* This program is distributed in the hope that it will be useful, |
14 |
> |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
> |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
> |
* GNU General Public License for more details. |
17 |
> |
* |
18 |
> |
* You should have received a copy of the GNU General Public License |
19 |
> |
* along with this program; if not, write to the Free Software |
20 |
> |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
> |
*/ |
22 |
|
|
23 |
|
#ifndef SPCFLAGS_H |
24 |
|
#define SPCFLAGS_H |
32 |
|
SPCFLAG_TRACE = 0x08, |
33 |
|
SPCFLAG_DOTRACE = 0x10, |
34 |
|
SPCFLAG_DOINT = 0x20, |
35 |
+ |
#if USE_JIT |
36 |
+ |
SPCFLAG_JIT_END_COMPILE = 0x40, |
37 |
+ |
SPCFLAG_JIT_EXEC_RETURN = 0x80, |
38 |
+ |
#else |
39 |
|
SPCFLAG_JIT_END_COMPILE = 0, |
40 |
|
SPCFLAG_JIT_EXEC_RETURN = 0, |
41 |
+ |
#endif |
42 |
+ |
|
43 |
|
SPCFLAG_ALL = SPCFLAG_STOP |
44 |
|
| SPCFLAG_INT |
45 |
|
| SPCFLAG_BRK |
47 |
|
| SPCFLAG_DOTRACE |
48 |
|
| SPCFLAG_DOINT |
49 |
|
| SPCFLAG_JIT_END_COMPILE |
50 |
< |
| SPCFLAG_JIT_EXEC_RETURN, |
50 |
> |
| SPCFLAG_JIT_EXEC_RETURN |
51 |
> |
, |
52 |
> |
|
53 |
|
SPCFLAG_ALL_BUT_EXEC_RETURN = SPCFLAG_ALL & ~SPCFLAG_JIT_EXEC_RETURN |
54 |
|
}; |
55 |
|
|
71 |
|
regs.spcflags &= ~(m); \ |
72 |
|
} while (0) |
73 |
|
|
74 |
< |
#elif defined(__i386__) && defined(X86_ASSEMBLY) |
74 |
> |
#elif (defined(__i386__) || defined(__x86_64__)) && defined(X86_ASSEMBLY) |
75 |
|
|
76 |
|
#define HAVE_HARDWARE_LOCKS |
77 |
|
|
83 |
|
__asm__ __volatile__("lock\n\tandl %1,%0" : "=m" (regs.spcflags) : "i" (~(m))); \ |
84 |
|
} while (0) |
85 |
|
|
86 |
< |
#elif defined(HAVE_PTHREADS) |
86 |
> |
#else |
87 |
|
|
88 |
|
#undef HAVE_HARDWARE_LOCKS |
89 |
|
|
90 |
< |
#include <pthread.h> |
91 |
< |
extern pthread_mutex_t spcflags_lock; |
90 |
> |
#include "main.h" |
91 |
> |
extern B2_mutex *spcflags_lock; |
92 |
|
|
93 |
|
#define SPCFLAGS_SET(m) do { \ |
94 |
< |
pthread_mutex_lock(&spcflags_lock); \ |
94 |
> |
B2_lock_mutex(spcflags_lock); \ |
95 |
|
regs.spcflags |= (m); \ |
96 |
< |
pthread_mutex_unlock(&spcflags_lock); \ |
96 |
> |
B2_unlock_mutex(spcflags_lock); \ |
97 |
|
} while (0) |
98 |
|
|
99 |
|
#define SPCFLAGS_CLEAR(m) do { \ |
100 |
< |
pthread_mutex_lock(&spcflags_lock); \ |
100 |
> |
B2_lock_mutex(spcflags_lock); \ |
101 |
|
regs.spcflags &= ~(m); \ |
102 |
< |
pthread_mutex_unlock(&spcflags_lock); \ |
102 |
> |
B2_unlock_mutex(spcflags_lock); \ |
103 |
|
} while (0) |
104 |
|
|
83 |
– |
#else |
84 |
– |
|
85 |
– |
#error "Can't handle spcflags atomically!" |
86 |
– |
|
105 |
|
#endif |
106 |
|
|
107 |
|
#endif /* SPCFLAGS_H */ |