Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 May 2009 02:39:13 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r192177 - projects/mips/sys/mips/include
Message-ID:  <200905160239.n4G2dD8U041748@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gonzo
Date: Sat May 16 02:39:13 2009
New Revision: 192177
URL: http://svn.freebsd.org/changeset/base/192177

Log:
  - Add MIPS_IS_KSEG0_ADDR, MIPS_IS_KSEG1_ADDR and MIPS_IS_VALID_PTR
      macroses thet check if address belongs to KSEG0, KSEG1 or both
      of them respectively.

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

Modified: projects/mips/sys/mips/include/cpu.h
==============================================================================
--- projects/mips/sys/mips/include/cpu.h	Sat May 16 02:34:03 2009	(r192176)
+++ projects/mips/sys/mips/include/cpu.h	Sat May 16 02:39:13 2009	(r192177)
@@ -72,6 +72,15 @@
 #define	MIPS_KSEG0_TO_PHYS(x)		((unsigned)(x) & MIPS_PHYS_MASK)
 #define	MIPS_KSEG1_TO_PHYS(x)		((unsigned)(x) & MIPS_PHYS_MASK)
 
+#define	MIPS_IS_KSEG0_ADDR(x)					\
+	(((vm_offset_t)(x) >= MIPS_KSEG0_START) &&		\
+	    ((vm_offset_t)(x) <= MIPS_KSEG0_END))
+#define	MIPS_IS_KSEG1_ADDR(x)					\
+	(((vm_offset_t)(x) >= MIPS_KSEG1_START) &&		\
+	    ((vm_offset_t)(x) <= MIPS_KSEG1_END))
+#define	MIPS_IS_VALID_PTR(x)		(MIPS_IS_KSEG0_ADDR(x) || \
+						MIPS_IS_KSEG1_ADDR(x))
+
 /*
  *  Status register.
  */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905160239.n4G2dD8U041748>