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, 1 month 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

# User Rev Content
1 gbeauche 1.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 gbeauche 1.3 #if USE_JIT
22     SPCFLAG_JIT_END_COMPILE = 0x40,
23     SPCFLAG_JIT_EXEC_RETURN = 0x80,
24     #else
25 gbeauche 1.1 SPCFLAG_JIT_END_COMPILE = 0,
26     SPCFLAG_JIT_EXEC_RETURN = 0,
27 gbeauche 1.3 #endif
28    
29 gbeauche 1.1 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 gbeauche 1.3 | SPCFLAG_JIT_EXEC_RETURN
37     ,
38    
39 gbeauche 1.1 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 gbeauche 1.4 #elif (defined(__i386__) || defined(__x86_64__)) && defined(X86_ASSEMBLY)
61 gbeauche 1.1
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 gbeauche 1.2 #else
73 gbeauche 1.1
74     #undef HAVE_HARDWARE_LOCKS
75    
76 gbeauche 1.2 #include "main.h"
77     extern B2_mutex *spcflags_lock;
78 gbeauche 1.1
79     #define SPCFLAGS_SET(m) do { \
80 gbeauche 1.2 B2_lock_mutex(spcflags_lock); \
81 gbeauche 1.1 regs.spcflags |= (m); \
82 gbeauche 1.2 B2_unlock_mutex(spcflags_lock); \
83 gbeauche 1.1 } while (0)
84    
85     #define SPCFLAGS_CLEAR(m) do { \
86 gbeauche 1.2 B2_lock_mutex(spcflags_lock); \
87 gbeauche 1.1 regs.spcflags &= ~(m); \
88 gbeauche 1.2 B2_unlock_mutex(spcflags_lock); \
89 gbeauche 1.1 } while (0)
90    
91     #endif
92    
93     #endif /* SPCFLAGS_H */