[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/13] tests/tcg/plugins: Use the ld/st_endian_p() API
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 06/13] tests/tcg/plugins: Use the ld/st_endian_p() API |
Date: |
Mon, 30 Sep 2024 09:34:43 +0200 |
Refactor to use the recently introduced ld/st_endian_p() API
No logical change intended.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/tcg/plugins/mem.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/tests/tcg/plugins/mem.c b/tests/tcg/plugins/mem.c
index b0fa8a9f27..3586d05587 100644
--- a/tests/tcg/plugins/mem.c
+++ b/tests/tcg/plugins/mem.c
@@ -163,13 +163,9 @@ static void update_region_info(uint64_t region, uint64_t
offset,
{
uint16_t *p = (uint16_t *) &ri->data[offset];
if (is_store) {
- if (be) {
- stw_be_p(p, value.data.u16);
- } else {
- stw_le_p(p, value.data.u16);
- }
+ stw_endian_p(be, p, value.data.u16);
} else {
- uint16_t val = be ? lduw_be_p(p) : lduw_le_p(p);
+ uint16_t val = lduw_endian_p(be, p);
unseen_data = val != value.data.u16;
}
break;
@@ -178,13 +174,9 @@ static void update_region_info(uint64_t region, uint64_t
offset,
{
uint32_t *p = (uint32_t *) &ri->data[offset];
if (is_store) {
- if (be) {
- stl_be_p(p, value.data.u32);
- } else {
- stl_le_p(p, value.data.u32);
- }
+ stl_endian_p(be, p, value.data.u32);
} else {
- uint32_t val = be ? ldl_be_p(p) : ldl_le_p(p);
+ uint32_t val = ldl_endian_p(be, p);
unseen_data = val != value.data.u32;
}
break;
@@ -193,13 +185,9 @@ static void update_region_info(uint64_t region, uint64_t
offset,
{
uint64_t *p = (uint64_t *) &ri->data[offset];
if (is_store) {
- if (be) {
- stq_be_p(p, value.data.u64);
- } else {
- stq_le_p(p, value.data.u64);
- }
+ stq_endian_p(be, p, value.data.u64);
} else {
- uint64_t val = be ? ldq_be_p(p) : ldq_le_p(p);
+ uint64_t val = ldq_endian_p(be, p);
unseen_data = val != value.data.u64;
}
break;
--
2.45.2
- [PATCH 00/13] hw: Add ld/st_endian() APIs, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 04/13] hw/mips: Pass BlCpuCfg argument to bootloader API, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 07/13] hw/xtensa/xtfpga: Remove TARGET_BIG_ENDIAN #ifdef'ry, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 08/13] hw/xtensa/xtfpga: Replace memcpy()+tswap32() by stl_endian_p(), Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 12/13] hw/pci/pci_device: Introduce ld/st_endian_pci_dma() API, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 01/13] qemu/bswap: Introduce ld/st_endian_p() API, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 13/13] hw/net/tulip: Use ld/st_endian_pci_dma() API, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 02/13] hw/virtio/virtio-access: Use the ld/st_endian_p() API, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 10/13] hw/virtio/virtio-access: Use ld/st_endian_phys() API, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 05/13] hw/mips: Add cpu_is_bigendian field to BlCpuCfg structure, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 06/13] tests/tcg/plugins: Use the ld/st_endian_p() API,
Philippe Mathieu-Daudé <=
- [PATCH 09/13] exec/memory_ldst_phys: Introduce ld/st_endian_phys() API, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 03/13] target/arm/ptw: Use the ld/st_endian_p() API, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 11/13] hw/pci/pci_device: Add PCI_DMA_DEFINE_LDST_END() macro, Philippe Mathieu-Daudé, 2024/09/30