Author: sam
Date: Sun Jul  5 17:45:48 2009
New Revision: 195376
URL: http://svn.freebsd.org/changeset/base/195376

Log:
  Cleanup ALIGNED_POINTER:
  o add to platforms where it was missing (arm, i386, powerpc, sparc64, sun4v)
  o define as "1" on amd64 and i386 where there is no restriction
  o make the type returned consistent with ALIGN
  o remove _ALIGNED_POINTER
  o make associated comments consistent
  
  Reviewed by:  bde, imp, marcel
  Approved by:  re (kensmith)

Modified:
  head/sys/amd64/include/param.h
  head/sys/arm/include/param.h
  head/sys/i386/include/param.h
  head/sys/ia64/include/param.h
  head/sys/mips/include/param.h
  head/sys/powerpc/include/param.h
  head/sys/sparc64/include/param.h
  head/sys/sun4v/include/param.h

Modified: head/sys/amd64/include/param.h
==============================================================================
--- head/sys/amd64/include/param.h      Sun Jul  5 16:55:57 2009        
(r195375)
+++ head/sys/amd64/include/param.h      Sun Jul  5 17:45:48 2009        
(r195376)
@@ -47,12 +47,6 @@
  * Round p (pointer or byte index) up to a correctly-aligned value
  * for all data types (int, long, ...).   The result is u_long and
  * must be cast to any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits). 
- *
  */
 #ifndef _ALIGNBYTES
 #define        _ALIGNBYTES     (sizeof(long) - 1)
@@ -60,9 +54,6 @@
 #ifndef _ALIGN
 #define        _ALIGN(p)       (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES)
 #endif
-#ifndef _ALIGNED_POINTER
-#define        _ALIGNED_POINTER(p,t)   ((((u_long)(p)) & (sizeof(t)-1)) == 0)
-#endif
 
 #ifndef _NO_NAMESPACE_POLLUTION
 
@@ -87,7 +78,13 @@
 
 #define        ALIGNBYTES              _ALIGNBYTES
 #define        ALIGN(p)                _ALIGN(p)
-#define        ALIGNED_POINTER(p,t)    _ALIGNED_POINTER(p,t)
+/*
+ * ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits). 
+ */
+#define        ALIGNED_POINTER(p, t)   1
 
 /*
  * CACHE_LINE_SIZE is the compile-time maximum cache line size for an

Modified: head/sys/arm/include/param.h
==============================================================================
--- head/sys/arm/include/param.h        Sun Jul  5 16:55:57 2009        
(r195375)
+++ head/sys/arm/include/param.h        Sun Jul  5 17:45:48 2009        
(r195376)
@@ -80,6 +80,13 @@
 
 #define        ALIGNBYTES      _ALIGNBYTES
 #define        ALIGN(p)        _ALIGN(p)
+/*
+ * ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits). 
+ */
+#define        ALIGNED_POINTER(p, t)   ((((unsigned)(p)) & (sizeof(t)-1)) == 0)
 
 /*
  * CACHE_LINE_SIZE is the compile-time maximum cache line size for an

Modified: head/sys/i386/include/param.h
==============================================================================
--- head/sys/i386/include/param.h       Sun Jul  5 16:55:57 2009        
(r195375)
+++ head/sys/i386/include/param.h       Sun Jul  5 17:45:48 2009        
(r195376)
@@ -73,6 +73,13 @@
 
 #define ALIGNBYTES     _ALIGNBYTES
 #define ALIGN(p)       _ALIGN(p)
+/*
+ * ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits). 
+ */
+#define        ALIGNED_POINTER(p, t)   1
 
 /*
  * CACHE_LINE_SIZE is the compile-time maximum cache line size for an

Modified: head/sys/ia64/include/param.h
==============================================================================
--- head/sys/ia64/include/param.h       Sun Jul  5 16:55:57 2009        
(r195375)
+++ head/sys/ia64/include/param.h       Sun Jul  5 17:45:48 2009        
(r195376)
@@ -46,12 +46,6 @@
  * Round p (pointer or byte index) up to a correctly-aligned value for all
  * data types (int, long, ...).   The result is u_long and must be cast to
  * any desired pointer type.
- *
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits). 
- *
  */
 #ifndef _ALIGNBYTES
 #define        _ALIGNBYTES             15
@@ -59,9 +53,6 @@
 #ifndef _ALIGN
 #define        _ALIGN(p)               (((u_long)(p) + _ALIGNBYTES) &~ 
_ALIGNBYTES)
 #endif
-#ifndef _ALIGNED_POINTER
-#define _ALIGNED_POINTER(p,t)  ((((u_long)(p)) & (sizeof(t)-1)) == 0)
-#endif
 
 #ifndef _NO_NAMESPACE_POLLUTION
 
@@ -84,20 +75,15 @@
 #define MAXCPU         1
 #endif
 
+#define        ALIGNBYTES              _ALIGNBYTES
+#define        ALIGN(p)                _ALIGN(p)
 /*
- * Round p (pointer or byte index) up to a correctly-aligned value for all
- * data types (int, long, ...).   The result is u_long and must be cast to
- * any desired pointer type.
- *
  * ALIGNED_POINTER is a boolean macro that checks whether an address
  * is valid to fetch data elements of type t from on this architecture.
  * This does not reflect the optimal alignment, just the possibility
  * (within reasonable limits). 
- *
  */
-#define        ALIGNBYTES              _ALIGNBYTES
-#define        ALIGN(p)                _ALIGN(p)
-#define ALIGNED_POINTER(p,t)   _ALIGNED_POINTER(p,t)
+#define        ALIGNED_POINTER(p,t)    ((((u_long)(p)) & (sizeof(t)-1)) == 0)
 
 /*
  * CACHE_LINE_SIZE is the compile-time maximum cache line size for an

Modified: head/sys/mips/include/param.h
==============================================================================
--- head/sys/mips/include/param.h       Sun Jul  5 16:55:57 2009        
(r195375)
+++ head/sys/mips/include/param.h       Sun Jul  5 17:45:48 2009        
(r195376)
@@ -84,10 +84,16 @@
  */
 #define        _ALIGNBYTES     7
 #define        _ALIGN(p)       (((u_int)(p) + _ALIGNBYTES) &~ _ALIGNBYTES)
-#define        ALIGNED_POINTER(p, t)   ((((u_int32_t)(p)) & (sizeof (t) - 1)) 
== 0)
 
 #define        ALIGNBYTES      _ALIGNBYTES
 #define        ALIGN(p)        _ALIGN(p)
+/*
+ * ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits). 
+ */
+#define        ALIGNED_POINTER(p, t)   ((((unsigned)(p)) & (sizeof (t) - 1)) 
== 0)
 
 /*
  * CACHE_LINE_SIZE is the compile-time maximum cache line size for an

Modified: head/sys/powerpc/include/param.h
==============================================================================
--- head/sys/powerpc/include/param.h    Sun Jul  5 16:55:57 2009        
(r195375)
+++ head/sys/powerpc/include/param.h    Sun Jul  5 17:45:48 2009        
(r195376)
@@ -78,6 +78,13 @@
 
 #define        ALIGNBYTES      _ALIGNBYTES
 #define        ALIGN(p)        _ALIGN(p)
+/*
+ * ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits). 
+ */
+#define        ALIGNED_POINTER(p, t)   ((((unsigned)(p)) & (sizeof (t) - 1)) 
== 0)
 
 /*
  * CACHE_LINE_SIZE is the compile-time maximum cache line size for an

Modified: head/sys/sparc64/include/param.h
==============================================================================
--- head/sys/sparc64/include/param.h    Sun Jul  5 16:55:57 2009        
(r195375)
+++ head/sys/sparc64/include/param.h    Sun Jul  5 17:45:48 2009        
(r195376)
@@ -70,6 +70,13 @@
 
 #define ALIGNBYTES     _ALIGNBYTES
 #define ALIGN(p)       _ALIGN(p)
+/*
+ * ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits). 
+ */
+#define        ALIGNED_POINTER(p, t)   ((((u_long)(p)) & (sizeof (t) - 1)) == 
0)
 
 /*
  * CACHE_LINE_SIZE is the compile-time maximum cache line size for an

Modified: head/sys/sun4v/include/param.h
==============================================================================
--- head/sys/sun4v/include/param.h      Sun Jul  5 16:55:57 2009        
(r195375)
+++ head/sys/sun4v/include/param.h      Sun Jul  5 17:45:48 2009        
(r195376)
@@ -70,6 +70,13 @@
 
 #define ALIGNBYTES     _ALIGNBYTES
 #define ALIGN(p)       _ALIGN(p)
+/*
+ * ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits). 
+ */
+#define        ALIGNED_POINTER(p, t)   ((((u_long)(p)) & (sizeof (t) - 1)) == 
0)
 
 /*
  * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to