On 05/26/2016 09:08 AM, Peter Maydell wrote: > > Apologies for the lack of any backtraces in the output, but > this is almost certainly the result of trying to do le64_to_cpu() > or cpu_to_le64() on a buffer which isn't necessarily aligned > (usually some pointer into guest memory). Use the functions > ldq_le_p() and stq_le_p() instead, which will handle a > potentially misaligned pointer for you. (There are similar > functions for other access widths too.)
Since these functions are constructed by ## token pasting, it's very hard to grep .h files to see what variations-on-a-theme are actually available, nor is the documentation clear on what they all do (in-place vs. copy, pass a value vs. a pointer, ...). It might be a nice bite-sized task to beef up the documentation and at least call out ALL of the endian-conversion functions in a nice comment (to make it greppable), along with this tidbit of information on which forms are optimized but require alignment, vs. work anywhere but potentially slower. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature