This source file includes following definitions.
- cacheStoreNotify
- cachePurgeAll
- cache_read_lock
- cache_write_unlock
- cache_read
- cache_read2
- cache_readN
- cache_write_zone
- cache_write
- cache_writeN
- cache_write2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #if !defined(DPS8_CACHE_H)
22 # define DPS8_CACHE_H
23
24
25 # define BLK_ADDR(ADDR) ((ADDR) & (word24) 077777774)
26
27 void cacheReset (cpu_state_t * cpup);
28 void cacheCpuReset (cpu_state_t * cpup);
29 bool cacheConfigured (cpu_state_t * cpup);
30 void cacheConfigChanged (cpu_state_t * cpup, bool was);
31 void cacheUpdateAnyOn (void);
32 void cacheClearStarted (cpu_state_t * cpup);
33 void cacheInvalidate (cpu_state_t * cpup, word24 addr);
34 void cachePurgeOthers (cpu_state_t * cpup, word24 addr);
35 void cacheStoreNotifyOn (cpu_state_t * cpup, word24 addr, word36 data);
36 void cacheStoreBadParity (cpu_state_t * cpup, word24 addr);
37 void cachePurgeAllOn (word24 addr);
38 void cacheStats (uint cpuNo);
39 word36 cacheDirWord (cpu_state_t * cpup, word24 y);
40
41 # if defined(LOCKLESS)
42 int cache_read_lock_on (cpu_state_t * cpup, word24 addr, word36 *data, const char * ctx);
43 # endif
44 int cache_read_on (cpu_state_t * cpup, word24 addr, word36 *data, const char * ctx);
45 int cache_read2_on (cpu_state_t * cpup, word24 addr, word36 *even, word36 *odd, const char * ctx);
46 void cache_writeN_on (cpu_state_t * cpup, word24 addr, word36 * data, uint n, const char * ctx);
47 void cache_readN_on (cpu_state_t * cpup, word24 addr, word36 * data, uint n, const char * ctx);
48 int cache_write2_on (cpu_state_t * cpup, word24 addr, word36 even, word36 odd, const char * ctx);
49
50
51
52
53
54
55
56 # if defined(THREADZ) || defined(LOCKLESS)
57 extern atomic_bool cacheAnyOn;
58 # define CACHE_ANY_ON() UNLIKELY (atomic_load_explicit (& cacheAnyOn, memory_order_relaxed))
59 # else
60 extern bool cacheAnyOn;
61 # define CACHE_ANY_ON() UNLIKELY (cacheAnyOn)
62 # endif
63
64
65
66 static inline void cacheStoreNotify (cpu_state_t * cpup, word24 addr, word36 data) {
67 if (CACHE_ANY_ON ())
68 cacheStoreNotifyOn (cpup, addr, data);
69 }
70
71
72 static inline void cachePurgeAll (word24 addr) {
73 if (CACHE_ANY_ON ())
74 cachePurgeAllOn (addr);
75 }
76
77
78
79
80 # if defined(LOCKLESS)
81 static inline int cache_read_lock (cpu_state_t * cpup, word24 addr, word36 *data, const char * ctx) {
82 if (! CACHE_ANY_ON ()) {
83 return core_read_lock (cpup, addr, data, ctx);
84 }
85 return cache_read_lock_on (cpup, addr, data, ctx);
86 }
87
88 static inline int cache_write_unlock (cpu_state_t * cpup, word24 addr, word36 data, const char * ctx) {
89 return core_write_unlock (cpup, addr, data, ctx);
90 }
91 # endif
92
93 static inline int cache_read (cpu_state_t * cpup, word24 addr, word36 *data, const char * ctx) {
94 if (! CACHE_ANY_ON ()) {
95 return core_read (cpup, addr, data, ctx);
96 }
97 return cache_read_on (cpup, addr, data, ctx);
98 }
99
100 static inline int cache_read2 (cpu_state_t * cpup, word24 addr, word36 *even, word36 *odd, const char * ctx) {
101 if (! CACHE_ANY_ON ()) {
102 return core_read2 (cpup, addr, even, odd, ctx);
103 }
104 return cache_read2_on (cpup, addr, even, odd, ctx);
105 }
106
107 static inline void cache_readN (cpu_state_t * cpup, word24 addr, word36 * data, uint n, const char * ctx) {
108 if (! CACHE_ANY_ON ()) {
109 core_readN (cpup, addr, data, n, ctx);
110 return;
111 }
112 cache_readN_on (cpup, addr, data, n, ctx);
113 }
114
115 static inline int cache_write_zone (cpu_state_t * cpup, word24 addr, word36 data, const char * ctx) {
116 return core_write_zone (cpup, addr, data, NULL, ctx);
117 }
118
119 static inline int cache_write (cpu_state_t * cpup, word24 addr, word36 data, const char * ctx) {
120 return core_write (cpup, addr, data, ctx);
121 }
122
123 static inline void cache_writeN (cpu_state_t * cpup, word24 addr, word36 * data, uint n, const char * ctx) {
124 if (! CACHE_ANY_ON ()) {
125 core_writeN (cpup, addr, data, n, ctx);
126 return;
127 }
128 cache_writeN_on (cpup, addr, data, n, ctx);
129 }
130
131 static inline int cache_write2 (cpu_state_t * cpup, word24 addr, word36 even, word36 odd, const char * ctx) {
132 if (! CACHE_ANY_ON ())
133 return core_write2 (cpup, addr, even, odd, ctx);
134 return cache_write2_on (cpup, addr, even, odd, ctx);
135 }
136
137 #endif