On 06.12.23 09:46, Jan Beulich wrote:
On 06.12.2023 08:10, Juergen Gross wrote:Instead of defining get_unaligned() and put_unaligned() in a way that is only supporting architectures allowing unaligned accesses, use the same approach as the Linux kernel and let the compiler do the decision how to generate the code for probably unaligned data accesses.Update include/xen/unaligned.h from include/asm-generic/unaligned.h of the Linux kernel. The generated code has been checked to be the same on x86. Modify the Linux variant to not use underscore prefixed identifiers, avoid unneeded parentheses and drop the 24-bit accessors. Signed-off-by: Arnd Bergmann <a...@arndb.de> Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 803f4e1eab7a Signed-off-by: Juergen Gross <jgr...@suse.com>Acked-by: Jan Beulich <jbeul...@suse.com> Nevertheless ...@@ -15,67 +7,82 @@ #include <asm/byteorder.h> #endif-#define get_unaligned(p) (*(p))-#define put_unaligned(val, p) (*(p) = (val)) +/* + * This is the most generic implementation of unaligned accesses + * and should work almost anywhere. + */ + +#define get_unaligned_t_(type, ptr) ({ \..., do we need the trailing underscores here in addition to the already sufficiently clear _t suffixes? (Leaving aside that ..._t generally is to denote types, not macros or functions.)
Maybe we should just name it get_unaligned_type()? Juergen
OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature