svn commit: r195357 - projects/mips/sys/mips/include

Warner Losh imp at FreeBSD.org
Sun Jul 5 07:01:34 UTC 2009


Author: imp
Date: Sun Jul  5 07:01:34 2009
New Revision: 195357
URL: http://svn.freebsd.org/changeset/base/195357

Log:
  Use uintptr_t rather than unsigned here for 64-bit correctness.

Modified:
  projects/mips/sys/mips/include/param.h

Modified: projects/mips/sys/mips/include/param.h
==============================================================================
--- projects/mips/sys/mips/include/param.h	Sun Jul  5 07:00:51 2009	(r195356)
+++ projects/mips/sys/mips/include/param.h	Sun Jul  5 07:01:34 2009	(r195357)
@@ -146,12 +146,13 @@
 /*
  * Conversion macros
  */
-#define	mips_round_page(x)	((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
-#define	mips_trunc_page(x)	((unsigned)(x) & ~(NBPG-1))
-#define	mips_btop(x)		((unsigned)(x) >> PGSHIFT)
-#define	mips_ptob(x)		((unsigned)(x) << PGSHIFT)
+#define	mips_round_page(x)	((((uintptr_t)(x)) + NBPG - 1) & ~(NBPG-1))
+#define	mips_trunc_page(x)	((uintptr_t)(x) & ~(NBPG-1))
+#define	mips_btop(x)		((uintptr_t)(x) >> PGSHIFT)
+#define	mips_ptob(x)		((uintptr_t)(x) << PGSHIFT)
 #define	round_page		mips_round_page
 #define	trunc_page		mips_trunc_page
+/* XXXimp: Is unsigned long the right cast type here? PA can be > 32bits */
 #define	atop(x)			((unsigned long)(x) >> PAGE_SHIFT)
 #define	ptoa(x)			((unsigned long)(x) << PAGE_SHIFT)
 


More information about the svn-src-projects mailing list