Date: Sat, 21 May 2016 16:52:38 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300375 - head/sys/arm/include Message-ID: <201605211652.u4LGqcnw013156@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Sat May 21 16:52:38 2016 New Revision: 300375 URL: https://svnweb.freebsd.org/changeset/base/300375 Log: Adjust _ALIGNBYTES to the proper value for arm and armv6 arches. Modern compilers can emit arm instructions that require 8-byte alignment. The alignment-sensitive instructions were added in armv5, which has to be supported by our combined v4/v5 kernels, so the value is set uncoditionally for all arm architecture versions. Also adjust the comment to explain in more detail why the macros have the form and values they do. Per advice from bde@, maintain the unsignedness of the value of _ALIGNBYTES (but do so using his second choice of allowing sizeof() to supply the unsignedness, rather than just hardcoding '8U', which in my mind would require an even more verbose comment to explain why it's right). Also explain in the comment that the resulting type of _ALIGN() is equivelent to uinptr_t on arm (32-bit unsigned int), but it's purposely spelled as "unsigned" to avoid problems with including other header files. Even including machine/_types.h to allow use of __uintptr_t causes compilation failures because of this header being included (indirectly) in asm code. The discussion that led to this change (albeit at a glacial pace) is at https://lists.freebsd.org/pipermail/svn-src-head/2014-November/064593.html Modified: head/sys/arm/include/_align.h Modified: head/sys/arm/include/_align.h ============================================================================== --- head/sys/arm/include/_align.h Sat May 21 15:38:40 2016 (r300374) +++ head/sys/arm/include/_align.h Sat May 21 16:52:38 2016 (r300375) @@ -42,11 +42,11 @@ #define _ARM_INCLUDE__ALIGN_H_ /* - * Round p (pointer or byte index) up to a correctly-aligned value - * for all data types (int, long, ...). The result is unsigned int - * and must be cast to any desired pointer type. + * Round p (pointer or byte index) up to the hardware-required alignment which + * is sufficient for any data type, pointer or numeric. The resulting type + * is equivelent to arm's uintptr_t (but is purposely spelled "unsigned" here). */ -#define _ALIGNBYTES (sizeof(int) - 1) +#define _ALIGNBYTES (sizeof(long long) - 1) #define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) #endif /* !_ARM_INCLUDE__ALIGN_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605211652.u4LGqcnw013156>