1 |
asvitkine |
1.5 |
/* |
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 |
gbeauche |
1.1 |
|
23 |
|
|
#ifndef SPCFLAGS_H |
24 |
|
|
#define SPCFLAGS_H |
25 |
|
|
|
26 |
|
|
typedef uae_u32 spcflags_t; |
27 |
|
|
|
28 |
|
|
enum { |
29 |
|
|
SPCFLAG_STOP = 0x01, |
30 |
|
|
SPCFLAG_INT = 0x02, |
31 |
|
|
SPCFLAG_BRK = 0x04, |
32 |
|
|
SPCFLAG_TRACE = 0x08, |
33 |
|
|
SPCFLAG_DOTRACE = 0x10, |
34 |
|
|
SPCFLAG_DOINT = 0x20, |
35 |
gbeauche |
1.3 |
#if USE_JIT |
36 |
|
|
SPCFLAG_JIT_END_COMPILE = 0x40, |
37 |
|
|
SPCFLAG_JIT_EXEC_RETURN = 0x80, |
38 |
|
|
#else |
39 |
gbeauche |
1.1 |
SPCFLAG_JIT_END_COMPILE = 0, |
40 |
|
|
SPCFLAG_JIT_EXEC_RETURN = 0, |
41 |
gbeauche |
1.3 |
#endif |
42 |
|
|
|
43 |
gbeauche |
1.1 |
SPCFLAG_ALL = SPCFLAG_STOP |
44 |
|
|
| SPCFLAG_INT |
45 |
|
|
| SPCFLAG_BRK |
46 |
|
|
| SPCFLAG_TRACE |
47 |
|
|
| SPCFLAG_DOTRACE |
48 |
|
|
| SPCFLAG_DOINT |
49 |
|
|
| SPCFLAG_JIT_END_COMPILE |
50 |
gbeauche |
1.3 |
| SPCFLAG_JIT_EXEC_RETURN |
51 |
|
|
, |
52 |
|
|
|
53 |
gbeauche |
1.1 |
SPCFLAG_ALL_BUT_EXEC_RETURN = SPCFLAG_ALL & ~SPCFLAG_JIT_EXEC_RETURN |
54 |
|
|
}; |
55 |
|
|
|
56 |
|
|
#define SPCFLAGS_TEST(m) \ |
57 |
|
|
((regs.spcflags & (m)) != 0) |
58 |
|
|
|
59 |
|
|
/* Macro only used in m68k_reset() */ |
60 |
|
|
#define SPCFLAGS_INIT(m) do { \ |
61 |
|
|
regs.spcflags = (m); \ |
62 |
|
|
} while (0) |
63 |
|
|
|
64 |
|
|
#if !(ENABLE_EXCLUSIVE_SPCFLAGS) |
65 |
|
|
|
66 |
|
|
#define SPCFLAGS_SET(m) do { \ |
67 |
|
|
regs.spcflags |= (m); \ |
68 |
|
|
} while (0) |
69 |
|
|
|
70 |
|
|
#define SPCFLAGS_CLEAR(m) do { \ |
71 |
|
|
regs.spcflags &= ~(m); \ |
72 |
|
|
} while (0) |
73 |
|
|
|
74 |
gbeauche |
1.4 |
#elif (defined(__i386__) || defined(__x86_64__)) && defined(X86_ASSEMBLY) |
75 |
gbeauche |
1.1 |
|
76 |
|
|
#define HAVE_HARDWARE_LOCKS |
77 |
|
|
|
78 |
|
|
#define SPCFLAGS_SET(m) do { \ |
79 |
|
|
__asm__ __volatile__("lock\n\torl %1,%0" : "=m" (regs.spcflags) : "i" ((m))); \ |
80 |
|
|
} while (0) |
81 |
|
|
|
82 |
|
|
#define SPCFLAGS_CLEAR(m) do { \ |
83 |
|
|
__asm__ __volatile__("lock\n\tandl %1,%0" : "=m" (regs.spcflags) : "i" (~(m))); \ |
84 |
|
|
} while (0) |
85 |
|
|
|
86 |
gbeauche |
1.2 |
#else |
87 |
gbeauche |
1.1 |
|
88 |
|
|
#undef HAVE_HARDWARE_LOCKS |
89 |
|
|
|
90 |
gbeauche |
1.2 |
#include "main.h" |
91 |
|
|
extern B2_mutex *spcflags_lock; |
92 |
gbeauche |
1.1 |
|
93 |
|
|
#define SPCFLAGS_SET(m) do { \ |
94 |
gbeauche |
1.2 |
B2_lock_mutex(spcflags_lock); \ |
95 |
gbeauche |
1.1 |
regs.spcflags |= (m); \ |
96 |
gbeauche |
1.2 |
B2_unlock_mutex(spcflags_lock); \ |
97 |
gbeauche |
1.1 |
} while (0) |
98 |
|
|
|
99 |
|
|
#define SPCFLAGS_CLEAR(m) do { \ |
100 |
gbeauche |
1.2 |
B2_lock_mutex(spcflags_lock); \ |
101 |
gbeauche |
1.1 |
regs.spcflags &= ~(m); \ |
102 |
gbeauche |
1.2 |
B2_unlock_mutex(spcflags_lock); \ |
103 |
gbeauche |
1.1 |
} while (0) |
104 |
|
|
|
105 |
|
|
#endif |
106 |
|
|
|
107 |
|
|
#endif /* SPCFLAGS_H */ |