|
63 | 63 | #define CPU_LDST_H
|
64 | 64 |
|
65 | 65 | #include "exec/memopidx.h"
|
| 66 | +#include "qemu/int128.h" |
66 | 67 |
|
67 | 68 | #if defined(CONFIG_USER_ONLY)
|
68 | 69 | /* sparc32plus has 64bit long but 32bit space address
|
@@ -233,6 +234,92 @@ void cpu_stl_le_mmu(CPUArchState *env, abi_ptr ptr, uint32_t val,
|
233 | 234 | void cpu_stq_le_mmu(CPUArchState *env, abi_ptr ptr, uint64_t val,
|
234 | 235 | MemOpIdx oi, uintptr_t ra);
|
235 | 236 |
|
| 237 | +uint32_t cpu_atomic_cmpxchgb_mmu(CPUArchState *env, target_ulong addr, |
| 238 | + uint32_t cmpv, uint32_t newv, |
| 239 | + MemOpIdx oi, uintptr_t retaddr); |
| 240 | +uint32_t cpu_atomic_cmpxchgw_le_mmu(CPUArchState *env, target_ulong addr, |
| 241 | + uint32_t cmpv, uint32_t newv, |
| 242 | + MemOpIdx oi, uintptr_t retaddr); |
| 243 | +uint32_t cpu_atomic_cmpxchgl_le_mmu(CPUArchState *env, target_ulong addr, |
| 244 | + uint32_t cmpv, uint32_t newv, |
| 245 | + MemOpIdx oi, uintptr_t retaddr); |
| 246 | +uint64_t cpu_atomic_cmpxchgq_le_mmu(CPUArchState *env, target_ulong addr, |
| 247 | + uint64_t cmpv, uint64_t newv, |
| 248 | + MemOpIdx oi, uintptr_t retaddr); |
| 249 | +uint32_t cpu_atomic_cmpxchgw_be_mmu(CPUArchState *env, target_ulong addr, |
| 250 | + uint32_t cmpv, uint32_t newv, |
| 251 | + MemOpIdx oi, uintptr_t retaddr); |
| 252 | +uint32_t cpu_atomic_cmpxchgl_be_mmu(CPUArchState *env, target_ulong addr, |
| 253 | + uint32_t cmpv, uint32_t newv, |
| 254 | + MemOpIdx oi, uintptr_t retaddr); |
| 255 | +uint64_t cpu_atomic_cmpxchgq_be_mmu(CPUArchState *env, target_ulong addr, |
| 256 | + uint64_t cmpv, uint64_t newv, |
| 257 | + MemOpIdx oi, uintptr_t retaddr); |
| 258 | + |
| 259 | +#define GEN_ATOMIC_HELPER(NAME, TYPE, SUFFIX) \ |
| 260 | +TYPE cpu_atomic_ ## NAME ## SUFFIX ## _mmu \ |
| 261 | + (CPUArchState *env, target_ulong addr, TYPE val, \ |
| 262 | + MemOpIdx oi, uintptr_t retaddr); |
| 263 | + |
| 264 | +#ifdef CONFIG_ATOMIC64 |
| 265 | +#define GEN_ATOMIC_HELPER_ALL(NAME) \ |
| 266 | + GEN_ATOMIC_HELPER(NAME, uint32_t, b) \ |
| 267 | + GEN_ATOMIC_HELPER(NAME, uint32_t, w_le) \ |
| 268 | + GEN_ATOMIC_HELPER(NAME, uint32_t, w_be) \ |
| 269 | + GEN_ATOMIC_HELPER(NAME, uint32_t, l_le) \ |
| 270 | + GEN_ATOMIC_HELPER(NAME, uint32_t, l_be) \ |
| 271 | + GEN_ATOMIC_HELPER(NAME, uint64_t, q_le) \ |
| 272 | + GEN_ATOMIC_HELPER(NAME, uint64_t, q_be) |
| 273 | +#else |
| 274 | +#define GEN_ATOMIC_HELPER_ALL(NAME) \ |
| 275 | + GEN_ATOMIC_HELPER(NAME, uint32_t, b) \ |
| 276 | + GEN_ATOMIC_HELPER(NAME, uint32_t, w_le) \ |
| 277 | + GEN_ATOMIC_HELPER(NAME, uint32_t, w_be) \ |
| 278 | + GEN_ATOMIC_HELPER(NAME, uint32_t, l_le) \ |
| 279 | + GEN_ATOMIC_HELPER(NAME, uint32_t, l_be) |
| 280 | +#endif |
| 281 | + |
| 282 | +GEN_ATOMIC_HELPER_ALL(fetch_add) |
| 283 | +GEN_ATOMIC_HELPER_ALL(fetch_sub) |
| 284 | +GEN_ATOMIC_HELPER_ALL(fetch_and) |
| 285 | +GEN_ATOMIC_HELPER_ALL(fetch_or) |
| 286 | +GEN_ATOMIC_HELPER_ALL(fetch_xor) |
| 287 | +GEN_ATOMIC_HELPER_ALL(fetch_smin) |
| 288 | +GEN_ATOMIC_HELPER_ALL(fetch_umin) |
| 289 | +GEN_ATOMIC_HELPER_ALL(fetch_smax) |
| 290 | +GEN_ATOMIC_HELPER_ALL(fetch_umax) |
| 291 | + |
| 292 | +GEN_ATOMIC_HELPER_ALL(add_fetch) |
| 293 | +GEN_ATOMIC_HELPER_ALL(sub_fetch) |
| 294 | +GEN_ATOMIC_HELPER_ALL(and_fetch) |
| 295 | +GEN_ATOMIC_HELPER_ALL(or_fetch) |
| 296 | +GEN_ATOMIC_HELPER_ALL(xor_fetch) |
| 297 | +GEN_ATOMIC_HELPER_ALL(smin_fetch) |
| 298 | +GEN_ATOMIC_HELPER_ALL(umin_fetch) |
| 299 | +GEN_ATOMIC_HELPER_ALL(smax_fetch) |
| 300 | +GEN_ATOMIC_HELPER_ALL(umax_fetch) |
| 301 | + |
| 302 | +GEN_ATOMIC_HELPER_ALL(xchg) |
| 303 | + |
| 304 | +#undef GEN_ATOMIC_HELPER_ALL |
| 305 | +#undef GEN_ATOMIC_HELPER |
| 306 | + |
| 307 | +Int128 cpu_atomic_cmpxchgo_le_mmu(CPUArchState *env, target_ulong addr, |
| 308 | + Int128 cmpv, Int128 newv, |
| 309 | + MemOpIdx oi, uintptr_t retaddr); |
| 310 | +Int128 cpu_atomic_cmpxchgo_be_mmu(CPUArchState *env, target_ulong addr, |
| 311 | + Int128 cmpv, Int128 newv, |
| 312 | + MemOpIdx oi, uintptr_t retaddr); |
| 313 | + |
| 314 | +Int128 cpu_atomic_ldo_le_mmu(CPUArchState *env, target_ulong addr, |
| 315 | + MemOpIdx oi, uintptr_t retaddr); |
| 316 | +Int128 cpu_atomic_ldo_be_mmu(CPUArchState *env, target_ulong addr, |
| 317 | + MemOpIdx oi, uintptr_t retaddr); |
| 318 | +void cpu_atomic_sto_le_mmu(CPUArchState *env, target_ulong addr, Int128 val, |
| 319 | + MemOpIdx oi, uintptr_t retaddr); |
| 320 | +void cpu_atomic_sto_be_mmu(CPUArchState *env, target_ulong addr, Int128 val, |
| 321 | + MemOpIdx oi, uintptr_t retaddr); |
| 322 | + |
236 | 323 | #if defined(CONFIG_USER_ONLY)
|
237 | 324 |
|
238 | 325 | extern __thread uintptr_t helper_retaddr;
|
|
0 commit comments