summaryrefslogtreecommitdiff
path: root/include/qemu/bswap.h
AgeCommit message (Collapse)AuthorFilesLines
2014-03-02bswap: Modify prototypes of st[wl]_{le, be}_p (avoid type conversions)Stefan Weil1-4/+4
The functions use uint16_t or uint32_t values, so show this in the function prototypes. Non-optimizing compilers will avoid unnecessary type conversions when generating calls of these inline functions. stq_le_p, stq_be_p already use similar prototypes. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-03-02bswap: Modify prototype of stb_p (avoid type conversions)Stefan Weil1-1/+1
The function uses an uint8_t value, so show this in the function prototype. Non-optimizing compilers will avoid unnecessary type conversions from (u)int8_t to int and back to uint8_t when generating calls of this inline function. stw_p, stl_p and stq_p already use similar prototypes. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-11-05bswap.h: Remove cpu_to_32wu()Peter Maydell1-7/+0
Replace the legacy cpu_to_32wu() with stl_p(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1383669517-25598-10-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-11-05bswap.h: Remove cpu_to_be64wu()Peter Maydell1-5/+0
Replace the legacy cpu_to_be64wu() with stq_be_p(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1383669517-25598-9-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-11-05bswap.h: Remove cpu_to_be32wu()Peter Maydell1-5/+0
Replace the legacy cpu_to_be32wu() with stl_be_p(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1383669517-25598-8-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-11-05bswap.h: Remove cpu_to_be16wu()Peter Maydell1-5/+0
Replace the legacy cpu_to_be16wu() with stw_be_p(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1383669517-25598-7-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-11-05bswap.h: Remove be32_to_cpupu()Peter Maydell1-5/+0
Replace the legacy be32_to_cpupu() with ldl_be_p(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1383669517-25598-6-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-11-05bswap.h: Remove le32_to_cpupu()Peter Maydell1-5/+0
Replace the legacy le32_to_cpupu() with ldl_le_p(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1383669517-25598-5-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-11-05bswap.h: Remove le16_to_cpupu()Peter Maydell1-5/+0
Replace the legacy le16_to_cpupu() with lduw_le_p(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1383669517-25598-4-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-11-05bswap.h: Remove cpu_to_le32wu()Peter Maydell1-5/+0
Replace the legacy cpu_to_le32wu() with stl_le_p(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1383669517-25598-3-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-11-05bswap.h: Remove cpu_to_le16wu()Peter Maydell1-5/+0
Replace the legacy cpu_to_le16wu() with stw_le_p(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1383669517-25598-2-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-04-19bswap: fix compiler warningAlexey Kardashevskiy1-0/+1
The bswap functions use memcpy but the bswap.h header itself does not seem to include it in some configuration such as cross compiling for powerpc64 on x86_64 machine. The patch explicitly includes string.h. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-02-06bswap: Fix width of swap in leul_to_cpuRichard Henderson1-2/+10
The misnamed HOST_LONG_BITS is really HOST_POINTER_BITS. Here we're explicitly using an unsigned long, rather than uintptr_t, so it is more correct to select the swap size via ULONG_MAX. Acked-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-16bswap: improve gluingBlue Swirl1-10/+10
OpenBSD system compiler (gcc 4.2.1) has problems with concatenation of macro arguments in macro functions: CC aes.o In file included from /src/qemu/include/qemu-common.h:126, from /src/qemu/aes.c:30: /src/qemu/include/qemu/bswap.h: In function 'leul_to_cpu': /src/qemu/include/qemu/bswap.h:461: warning: implicit declaration of function 'bswapHOST_LONG_BITS' /src/qemu/include/qemu/bswap.h:461: warning: nested extern declaration of 'bswapHOST_LONG_BITS' Function leul_to_cpu() is only used in kvm-all.c, so the warnings are not fatal on OpenBSD without -Werror. Fix by applying glue(). Also add do {} while(0) wrapping and fix semicolon use while at it. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-12bswap: Rewrite cpu_to_<endian><type>u with {ld,st}<type>_<endian>_pRichard Henderson1-94/+53
We've now optimized the ld/st versions; reuse that for the "legacy" versions. Always use inlines so that we get the type checking that we expect. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-01-12bswap: Rewrite all ld<type>_<endian>_p functionsRichard Henderson1-270/+30
Use the new host endian unaligned access functions instead of open coding byte-by-byte references. Remove assembly special cases for i386 and ppc -- we've now exposed the operation to the compiler sufficiently for these to be optimized automatically. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-01-12bswap: Add host endian unaligned access functionsRichard Henderson1-1/+50
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-01-12bswap: Tidy base definitions of bswapNRichard Henderson1-42/+30
Move the bswap_N -> bswapN wrappers inside CONFIG_BYTESWAP_H. Change the ultimate fallback defintions from macros to inline functions. The proper types recieved by the function arguments means we can remove unnecessary casts, making the code more readable. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-19fpu: move public header file to include/fpuPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-0/+713
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>