Changeset 93878 in vbox
- Timestamp:
- Feb 21, 2022 8:52:59 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllAImplC.cpp
r93877 r93878 1344 1344 * XADD and LOCK XADD. 1345 1345 */ 1346 1347 IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u64,(uint64_t *puDst, uint64_t *puReg, uint32_t *pfEFlags)) 1348 { 1349 uint64_t uDst = *puDst; 1350 uint64_t uResult = uDst; 1351 iemAImpl_add_u64(&uResult, *puReg, pfEFlags); 1352 *puDst = uResult; 1353 *puReg = uDst; 1354 } 1355 1356 1357 IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u64_locked,(uint64_t *puDst, uint64_t *puReg, uint32_t *pfEFlags)) 1358 { 1359 uint64_t uOld = ASMAtomicUoReadU64(puDst); 1360 uint64_t uResult; 1361 uint32_t fEflTmp; 1362 do 1363 { 1364 uResult = uOld; 1365 fEflTmp = *pfEFlags; 1366 iemAImpl_add_u64(&uResult, *puReg, &fEflTmp); 1367 } while (!ASMAtomicCmpXchgExU64(puDst, uResult, uOld, &uOld)); 1368 *puReg = uOld; 1369 *pfEFlags = fEflTmp; 1370 } 1371 1372 # if !defined(RT_ARCH_X86) || defined(IEM_WITHOUT_ASSEMBLY) 1373 1374 IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u32,(uint32_t *puDst, uint32_t *puReg, uint32_t *pfEFlags)) 1375 { 1376 uint32_t uDst = *puDst; 1377 uint32_t uResult = uDst; 1378 iemAImpl_add_u32(&uResult, *puReg, pfEFlags); 1379 *puDst = uResult; 1380 *puReg = uDst; 1381 } 1382 1383 1384 IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u32_locked,(uint32_t *puDst, uint32_t *puReg, uint32_t *pfEFlags)) 1385 { 1386 uint32_t uOld = ASMAtomicUoReadU32(puDst); 1387 uint32_t uResult; 1388 uint32_t fEflTmp; 1389 do 1390 { 1391 uResult = uOld; 1392 fEflTmp = *pfEFlags; 1393 iemAImpl_add_u32(&uResult, *puReg, &fEflTmp); 1394 } while (!ASMAtomicCmpXchgExU32(puDst, uResult, uOld, &uOld)); 1395 *puReg = uOld; 1396 *pfEFlags = fEflTmp; 1397 } 1398 1399 1400 IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u16,(uint16_t *puDst, uint16_t *puReg, uint32_t *pfEFlags)) 1401 { 1402 uint16_t uDst = *puDst; 1403 uint16_t uResult = uDst; 1404 iemAImpl_add_u16(&uResult, *puReg, pfEFlags); 1405 *puDst = uResult; 1406 *puReg = uDst; 1407 } 1408 1409 1410 IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u16_locked,(uint16_t *puDst, uint16_t *puReg, uint32_t *pfEFlags)) 1411 { 1412 uint16_t uOld = ASMAtomicUoReadU16(puDst); 1413 uint16_t uResult; 1414 uint32_t fEflTmp; 1415 do 1416 { 1417 uResult = uOld; 1418 fEflTmp = *pfEFlags; 1419 iemAImpl_add_u16(&uResult, *puReg, &fEflTmp); 1420 } while (!ASMAtomicCmpXchgExU16(puDst, uResult, uOld, &uOld)); 1421 *puReg = uOld; 1422 *pfEFlags = fEflTmp; 1423 } 1424 1425 1426 IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u8,(uint8_t *puDst, uint8_t *puReg, uint32_t *pfEFlags)) 1427 { 1428 uint8_t uDst = *puDst; 1429 uint8_t uResult = uDst; 1430 iemAImpl_add_u8(&uResult, *puReg, pfEFlags); 1431 *puDst = uResult; 1432 *puReg = uDst; 1433 } 1434 1435 1436 IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u8_locked,(uint8_t *puDst, uint8_t *puReg, uint32_t *pfEFlags)) 1437 { 1438 uint8_t uOld = ASMAtomicUoReadU8(puDst); 1439 uint8_t uResult; 1440 uint32_t fEflTmp; 1441 do 1442 { 1443 uResult = uOld; 1444 fEflTmp = *pfEFlags; 1445 iemAImpl_add_u8(&uResult, *puReg, &fEflTmp); 1446 } while (!ASMAtomicCmpXchgExU8(puDst, uResult, uOld, &uOld)); 1447 *puReg = uOld; 1448 *pfEFlags = fEflTmp; 1449 } 1450 1346 #define EMIT_XADD(a_cBitsWidth, a_Type) \ 1347 IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u ## a_cBitsWidth,(a_Type *puDst, a_Type *puReg, uint32_t *pfEFlags)) \ 1348 { \ 1349 a_Type uDst = *puDst; \ 1350 a_Type uResult = uDst; \ 1351 iemAImpl_add_u ## a_cBitsWidth(&uResult, *puReg, pfEFlags); \ 1352 *puDst = uResult; \ 1353 *puReg = uDst; \ 1354 } \ 1355 \ 1356 IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u ## a_cBitsWidth ## _locked,(a_Type *puDst, a_Type *puReg, uint32_t *pfEFlags)) \ 1357 { \ 1358 a_Type uOld = ASMAtomicUoReadU ## a_cBitsWidth(puDst); \ 1359 a_Type uResult; \ 1360 uint32_t fEflTmp; \ 1361 do \ 1362 { \ 1363 uResult = uOld; \ 1364 fEflTmp = *pfEFlags; \ 1365 iemAImpl_add_u ## a_cBitsWidth(&uResult, *puReg, &fEflTmp); \ 1366 } while (!ASMAtomicCmpXchgExU ## a_cBitsWidth(puDst, uResult, uOld, &uOld)); \ 1367 *puReg = uOld; \ 1368 *pfEFlags = fEflTmp; \ 1369 } 1370 EMIT_XADD(64, uint64_t) 1371 # if !defined(RT_ARCH_X86) || defined(IEM_WITHOUT_ASSEMBLY) 1372 EMIT_XADD(32, uint32_t) 1373 EMIT_XADD(16, uint16_t) 1374 EMIT_XADD(8, uint8_t) 1451 1375 # endif /* !defined(RT_ARCH_X86) || defined(IEM_WITHOUT_ASSEMBLY) */ 1376 1452 1377 #endif 1453 1378
Note:
See TracChangeset
for help on using the changeset viewer.