Skip to content

Conversation

elprans
Copy link
Member

@elprans elprans commented Oct 27, 2017

Per report in #216 and https://bugs.debian.org/872408, the current
implementation may raise SIGBUS on ARM platforms that do not support
unaligned memory access.

Fix this by using a stack variable and memcpy, which gives the compiler
more opportunity to generate correct code. While at it, implement
hton* and ntoh* in terms of byteswap intrinsics with an open-coded
fallback. This drops the dependency on the platform's implementation,
which might not necessarily be consistently fast.

Smoke-tested locally on cross-compiled armv5tel-softfloat-linux-gnueabi
and armv6j-hardfloat-linux-gnueabi with QEMU TCG.

Fixes: #216.

@elprans elprans requested a review from 1st1 October 27, 2017 21:52
Per report in #216 and https://bugs.debian.org/872408, the current
implementation may raise SIGBUS on ARM platforms that do not support
unaligned memory access.

Fix this by using a stack variable and memcpy, which gives the compiler
more opportunity to generate correct code.  While at it, implement
hton* and ntoh* in terms of byteswap intrinsics with an open-coded
fallback.  This drops the dependency on the platform's implementation,
which might not necessarily be consistently fast.

Smoke-tested locally on cross-compiled armv5tel-softfloat-linux-gnueabi
and armv6j-hardfloat-linux-gnueabi with QEMU TCG.

Fixes: #216.
@elprans elprans merged commit c04576d into master Oct 31, 2017
@elprans elprans deleted the hton branch October 31, 2017 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants