This source file includes following definitions.
- cacheInvalidate
- 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 cacheInvalidateOn (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 static inline void cacheInvalidate (cpu_state_t * cpup, word24 addr) {
66 if (CACHE_ANY_ON ())
67 cacheInvalidateOn (cpup, addr);
68 }
69
70
71
72 static inline void cacheStoreNotify (cpu_state_t * cpup, word24 addr, word36 data) {
73 if (CACHE_ANY_ON ())
74 cacheStoreNotifyOn (cpup, addr, data);
75 }
76
77
78 static inline void cachePurgeAll (word24 addr) {
79 if (CACHE_ANY_ON ())
80 cachePurgeAllOn (addr);
81 }
82
83
84
85
86 # if defined(LOCKLESS)
87 static inline int cache_read_lock (cpu_state_t * cpup, word24 addr, word36 *data, const char * ctx) {
88 if (! CACHE_ANY_ON ()) {
89 return core_read_lock (cpup, addr, data, ctx);
90 }
91 return cache_read_lock_on (cpup, addr, data, ctx);
92 }
93
94 static inline int cache_write_unlock (cpu_state_t * cpup, word24 addr, word36 data, const char * ctx) {
95 return core_write_unlock (cpup, addr, data, ctx);
96 }
97 # endif
98
99 static inline int cache_read (cpu_state_t * cpup, word24 addr, word36 *data, const char * ctx) {
100 if (! CACHE_ANY_ON ()) {
101 return core_read (cpup, addr, data, ctx);
102 }
103 return cache_read_on (cpup, addr, data, ctx);
104 }
105
106 static inline int cache_read2 (cpu_state_t * cpup, word24 addr, word36 *even, word36 *odd, const char * ctx) {
107 if (! CACHE_ANY_ON ()) {
108 return core_read2 (cpup, addr, even, odd, ctx);
109 }
110 return cache_read2_on (cpup, addr, even, odd, ctx);
111 }
112
113 static inline void cache_readN (cpu_state_t * cpup, word24 addr, word36 * data, uint n, const char * ctx) {
114 if (! CACHE_ANY_ON ()) {
115 core_readN (cpup, addr, data, n, ctx);
116 return;
117 }
118 cache_readN_on (cpup, addr, data, n, ctx);
119 }
120
121 static inline int cache_write_zone (cpu_state_t * cpup, word24 addr, word36 data, const char * ctx) {
122 return core_write_zone (cpup, addr, data, NULL, ctx);
123 }
124
125 static inline int cache_write (cpu_state_t * cpup, word24 addr, word36 data, const char * ctx) {
126 return core_write (cpup, addr, data, ctx);
127 }
128
129 static inline void cache_writeN (cpu_state_t * cpup, word24 addr, word36 * data, uint n, const char * ctx) {
130 if (! CACHE_ANY_ON ()) {
131 core_writeN (cpup, addr, data, n, ctx);
132 return;
133 }
134 cache_writeN_on (cpup, addr, data, n, ctx);
135 }
136
137 static inline int cache_write2 (cpu_state_t * cpup, word24 addr, word36 even, word36 odd, const char * ctx) {
138 if (! CACHE_ANY_ON ())
139 return core_write2 (cpup, addr, even, odd, ctx);
140 return cache_write2_on (cpup, addr, even, odd, ctx);
141 }
142
143 #endif