From afa4f6653dca095f63f3fe7f2001e9334f5676c1 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 15 Jun 2018 14:57:14 +0100 Subject: bswap: Add new stn_*_p() and ldn_*_p() memory access functions There's a common pattern in QEMU where a function needs to perform a data load or store of an N byte integer in a particular endianness. At the moment this is handled by doing a switch() on the size and calling the appropriate ld*_p or st*_p function for each size. Provide a new family of functions ldn_*_p() and stn_*_p() which take the size as an argument and do the switch() themselves. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20180611171007.4165-2-peter.maydell@linaro.org --- docs/devel/loads-stores.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'docs/devel') diff --git a/docs/devel/loads-stores.rst b/docs/devel/loads-stores.rst index 6a990cc243..57d8c524bf 100644 --- a/docs/devel/loads-stores.rst +++ b/docs/devel/loads-stores.rst @@ -53,9 +53,24 @@ The ``_{endian}`` infix is omitted for target-endian accesses. The target endian accessors are only available to source files which are built per-target. +There are also functions which take the size as an argument: + +load: ``ldn{endian}_p(ptr, sz)`` + +which performs an unsigned load of ``sz`` bytes from ``ptr`` +as an ``{endian}`` order value and returns it in a uint64_t. + +store: ``stn{endian}_p(ptr, sz, val)`` + +which stores ``val`` to ``ptr`` as an ``{endian}`` order value +of size ``sz`` bytes. + + Regexes for git grep - ``\`` - ``\`` + - ``\`` + - ``\`` ``cpu_{ld,st}_*`` ~~~~~~~~~~~~~~~~~ -- cgit v1.2.3-55-g7522