Re: [PATCH v13 04/18] target/s390x: Add helper functions for copy memory to and from guest

Ilya Leoshkevich <[email protected]> Tue, 4 Aug 2026 23:55:15 +0200
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>

On 8/3/26 18:12, Harald Freudenberger wrote:
> Add some simple helper functions to copy memory from guest to a local
> buffer and the other way around:
> 
> - read_guest_wrap_u8()
> - write_guest_wrap_u8()
> - read_guest_wrap_u32()
> - write_guest_wrap_u32()
> - read_guest_wrap_u64()
> - write_guest_wrap_u64()
> 
> The reader functions read from guest memory into an array of
> u8/u32/u64 with BE conversion. Similar the writer functions write an
> array of u8/u32/u64 into guest memory with BE conversion.
> 
> All these functions are intended to be used for the crypto
> implementations thus are located in crypto_helper.h.
> 
> Rework and simplify the sha 256 and sha 512 implementations to use
> these helper functions.
> 
> Signed-off-by: Harald Freudenberger <[email protected]>
> ---
>   target/s390x/tcg/cpacf_sha256.c  |  63 ++++---------------
>   target/s390x/tcg/cpacf_sha512.c  |  63 ++++---------------
>   target/s390x/tcg/crypto_helper.c |   1 +
>   target/s390x/tcg/crypto_helper.h | 100 +++++++++++++++++++++++++++++++
>   4 files changed, 123 insertions(+), 104 deletions(-)
>   create mode 100644 target/s390x/tcg/crypto_helper.h

Reviewed-by: Ilya Leoshkevich <[email protected]>