ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/spcflags.h
Revision: 1.4
Committed: 2005-06-06T18:49:51Z (19 years, 5 months ago) by gbeauche
Content type: text/plain
Branch: MAIN
CVS Tags: nigel-build-19, nigel-build-17
Changes since 1.3: +1 -1 lines
Log Message:
Add support for hardware locks on x86_64 too

File Contents

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