ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/spcflags.h
Revision: 1.2
Committed: 2002-09-01T16:32:02Z (21 years, 10 months ago) by gbeauche
Content type: text/plain
Branch: MAIN
Changes since 1.1: +7 -11 lines
Log Message:
Use B2_mutex instead of pthread mutexes when ENABLE_EXCLUSIVE_SPCFLAGS is
set. However, this is not used at the moment. Is there an advantage? People
may want to add arch-optimized SPCFLAGS_{SET,CLEAR}.

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