summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorPeter Maydell2018-06-15 15:57:14 +0200
committerPeter Maydell2018-06-15 16:23:34 +0200
commitafa4f6653dca095f63f3fe7f2001e9334f5676c1 (patch)
tree5d3b9c27711a2b3ef5eaa2635593921092e32ae9 /docs
parentCODING_STYLE: Define our preferred form for multiline comments (diff)
downloadqemu-afa4f6653dca095f63f3fe7f2001e9334f5676c1.tar.gz
qemu-afa4f6653dca095f63f3fe7f2001e9334f5676c1.tar.xz
qemu-afa4f6653dca095f63f3fe7f2001e9334f5676c1.zip
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 <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20180611171007.4165-2-peter.maydell@linaro.org
Diffstat (limited to 'docs')
-rw-r--r--docs/devel/loads-stores.rst15
1 files changed, 15 insertions, 0 deletions
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
- ``\<ldf\?[us]\?[bwlq]\(_[hbl]e\)\?_p\>``
- ``\<stf\?[bwlq]\(_[hbl]e\)\?_p\>``
+ - ``\<ldn_\([hbl]e\)?_p\>``
+ - ``\<stn_\([hbl]e\)?_p\>``
``cpu_{ld,st}_*``
~~~~~~~~~~~~~~~~~