Index: kernel/generic/include/macros.h
===================================================================
--- kernel/generic/include/macros.h	(revision 257ceb162f2809e8b5c6794f738a2679f9cae791)
+++ kernel/generic/include/macros.h	(revision e2650d358e06533dcf2c3cf90e673dffacd29dd3)
@@ -47,4 +47,5 @@
  * @param s2  Start address of the second interval.
  * @param sz2 Size of the second interval.
+ *
  */
 NO_TRACE static inline int overlaps(uintptr_t s1, size_t sz1, uintptr_t s2,
@@ -55,4 +56,21 @@
 	
 	return ((s1 < e2) && (s2 < e1));
+}
+
+/** Return true if the second interval is within the first interval.
+ *
+ * @param s1  Start address of the first interval.
+ * @param sz1 Size of the first interval.
+ * @param s2  Start address of the second interval.
+ * @param sz2 Size of the second interval.
+ *
+ */
+NO_TRACE static inline int iswithin(uintptr_t s1, size_t sz1, uintptr_t s2,
+    size_t sz2)
+{
+	uintptr_t e1 = s1 + sz1;
+	uintptr_t e2 = s2 + sz2;
+	
+	return ((s1 <= s2) && (e1 >= e2));
 }
 
@@ -74,5 +92,5 @@
 
 /* Compute overlapping of physical addresses */
-#define PA_overlaps(x, szx, y, szy) \
+#define PA_OVERLAPS(x, szx, y, szy) \
 	overlaps(KA2PA((x)), (szx), KA2PA((y)), (szy))
 
