[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/13] hw/xtensa/xtfpga: Replace memcpy()+tswap32() by stl_endian
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 08/13] hw/xtensa/xtfpga: Replace memcpy()+tswap32() by stl_endian_p() |
Date: |
Mon, 30 Sep 2024 09:34:45 +0200 |
Replace a pair of memcpy() + tswap32() by stl_endian_p(),
which also swap the value using target endianness.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/xtensa/xtfpga.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index 228f00b045..521fe84b01 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -438,11 +438,9 @@ static void xtfpga_init(const XtfpgaBoardDesc *board,
MachineState *machine)
const size_t boot_sz = TARGET_BIG_ENDIAN ? sizeof(boot_be)
: sizeof(boot_le);
uint8_t *boot = TARGET_BIG_ENDIAN ? boot_be : boot_le;
- uint32_t entry_pc = tswap32(entry_point);
- uint32_t entry_a2 = tswap32(tagptr);
- memcpy(boot + 4, &entry_pc, sizeof(entry_pc));
- memcpy(boot + 8, &entry_a2, sizeof(entry_a2));
+ stl_endian_p(TARGET_BIG_ENDIAN, boot + 4, entry_point);
+ stl_endian_p(TARGET_BIG_ENDIAN, boot + 8, tagptr);
cpu_physical_memory_write(env->pc, boot, boot_sz);
}
} else {
--
2.45.2
- [PATCH 00/13] hw: Add ld/st_endian() APIs, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 06/13] tests/tcg/plugins: 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 04/13] hw/mips: Pass BlCpuCfg argument to bootloader 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 09/13] exec/memory_ldst_phys: Introduce ld/st_endian_phys() API, Philippe Mathieu-Daudé, 2024/09/30
- [PATCH 08/13] hw/xtensa/xtfpga: Replace memcpy()+tswap32() by stl_endian_p(),
Philippe Mathieu-Daudé <=
- [PATCH 12/13] hw/pci/pci_device: Introduce ld/st_endian_pci_dma() 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
- [PATCH 07/13] hw/xtensa/xtfpga: Remove TARGET_BIG_ENDIAN #ifdef'ry, 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 05/13] hw/mips: Add cpu_is_bigendian field to BlCpuCfg structure, 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