1 |
/* |
2 |
* UAE - The Un*x Amiga Emulator |
3 |
* |
4 |
* MC68000 emulation |
5 |
* |
6 |
* Copyright 1995 Bernd Schmidt |
7 |
*/ |
8 |
|
9 |
#ifndef SPCFLAGS_H |
10 |
#define SPCFLAGS_H |
11 |
|
12 |
typedef uint32 spcflags_t; |
13 |
|
14 |
enum { |
15 |
SPCFLAG_STOP = 0x01, |
16 |
SPCFLAG_INT = 0x02, |
17 |
SPCFLAG_DOINT = 0x04, |
18 |
SPCFLAG_ENTER_MON = 0x08, |
19 |
#if USE_JIT |
20 |
SPCFLAG_JIT_END_COMPILE = 0x40, |
21 |
SPCFLAG_JIT_EXEC_RETURN = 0x80, |
22 |
#else |
23 |
SPCFLAG_JIT_END_COMPILE = 0, |
24 |
SPCFLAG_JIT_EXEC_RETURN = 0, |
25 |
#endif |
26 |
|
27 |
SPCFLAG_ALL = SPCFLAG_STOP |
28 |
| SPCFLAG_INT |
29 |
| SPCFLAG_DOINT |
30 |
| SPCFLAG_ENTER_MON |
31 |
| SPCFLAG_JIT_END_COMPILE |
32 |
| SPCFLAG_JIT_EXEC_RETURN |
33 |
, |
34 |
|
35 |
SPCFLAG_ALL_BUT_EXEC_RETURN = SPCFLAG_ALL & ~SPCFLAG_JIT_EXEC_RETURN |
36 |
}; |
37 |
|
38 |
#define SPCFLAGS_TEST(m) \ |
39 |
((sheepshaver_cpu::spcflags & (m)) != 0) |
40 |
|
41 |
/* Macro only used in m68k_reset() */ |
42 |
#define SPCFLAGS_INIT(m) do { \ |
43 |
sheepshaver_cpu::spcflags = (m); \ |
44 |
} while (0) |
45 |
|
46 |
#if !(ENABLE_EXCLUSIVE_SPCFLAGS) |
47 |
|
48 |
#define SPCFLAGS_SET(m) do { \ |
49 |
sheepshaver_cpu::spcflags |= (m); \ |
50 |
} while (0) |
51 |
|
52 |
#define SPCFLAGS_CLEAR(m) do { \ |
53 |
sheepshaver_cpu::spcflags &= ~(m); \ |
54 |
} while (0) |
55 |
|
56 |
#elif defined(__i386__) && defined(X86_ASSEMBLY) |
57 |
|
58 |
#define HAVE_HARDWARE_LOCKS |
59 |
|
60 |
#define SPCFLAGS_SET(m) do { \ |
61 |
__asm__ __volatile__("lock\n\torl %1,%0" : "=m" (sheepshaver_cpu::spcflags) : "i" ((m))); \ |
62 |
} while (0) |
63 |
|
64 |
#define SPCFLAGS_CLEAR(m) do { \ |
65 |
__asm__ __volatile__("lock\n\tandl %1,%0" : "=m" (sheepshaver_cpu::spcflags) : "i" (~(m))); \ |
66 |
} while (0) |
67 |
|
68 |
#else |
69 |
|
70 |
#undef HAVE_HARDWARE_LOCKS |
71 |
|
72 |
#include "main.h" |
73 |
extern B2_mutex *spcflags_lock; |
74 |
|
75 |
#define SPCFLAGS_SET(m) do { \ |
76 |
B2_lock_mutex(spcflags_lock); \ |
77 |
sheepshaver_cpu::spcflags |= (m); \ |
78 |
B2_unlock_mutex(spcflags_lock); \ |
79 |
} while (0) |
80 |
|
81 |
#define SPCFLAGS_CLEAR(m) do { \ |
82 |
B2_lock_mutex(spcflags_lock); \ |
83 |
sheepshaver_cpu::spcflags &= ~(m); \ |
84 |
B2_unlock_mutex(spcflags_lock); \ |
85 |
} while (0) |
86 |
|
87 |
#endif |
88 |
|
89 |
#endif /* SPCFLAGS_H */ |