Hi all,

This series adds cpu_tswap() functions and then uses them in semihosting
to properly swap bytes based on the runtime-configurable endianness.

The semihosting ABI [1] states:
> Multi-byte values in memory must be formatted as pure little-endian or pure
> big-endian to match the endianness mapping configuration of the processor.

This series ensures that semihosting data is properly byte-swapped if
the guest's CPU is currently in a different runtime-configurable
endianness than the host's CPU.

This is my first series submitted to QEMU, so please tell me if I have
overlooked anything or should squash the two commits.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3258
Buglink: https://github.com/taiki-e/semihosting/issues/18

[1]: 
https://github.com/ARM-software/abi-aa/blob/2025Q1/semihosting/semihosting.rst#the-semihosting-interface

Thanks for your work!
Martin Kröning

Signed-off-by: Martin Kröning <[email protected]>
---
Martin Kröning (2):
      include/exec: Provide the cpu_tswap() functions
      semihosting/uaccess: Use the cpu_tswap() functions

 include/exec/tswap.h          | 30 ++++++++++++++++++++++++++++++
 include/semihosting/uaccess.h |  8 ++++----
 2 files changed, 34 insertions(+), 4 deletions(-)
---
base-commit: 0fc482b73d8e085d1375b4e17b0647fd2e6fe8f0
change-id: 20260106-semihosting-cpu-tswap-b47debe274e2

Best regards,
-- 
Martin Kröning <[email protected]>


Reply via email to