+#include <sys/mm/mempart.h>
+
+#include <klibc/string.h>
+
+struct mm_region*
+region_create(ptr_t start, ptr_t end, u32_t attr)
+{
+ assert_msg(PG_ALIGNED(start), "not page aligned");
+ assert_msg(PG_ALIGNED(end), "not page aligned");
+ struct mm_region* region = valloc(sizeof(struct mm_region));
+ *region =
+ (struct mm_region){ .attr = attr, .start = start, .end = end - 1 };
+ return region;
+}
+
+struct mm_region*
+region_create_range(ptr_t start, size_t length, u32_t attr)
+{
+ assert_msg(PG_ALIGNED(start), "not page aligned");
+ assert_msg(PG_ALIGNED(length), "not page aligned");
+ struct mm_region* region = valloc(sizeof(struct mm_region));
+ *region = (struct mm_region){ .attr = attr,
+ .start = start,
+ .end = ROUNDUP(start + length, MEM_PAGE) };
+ return region;
+}
+
+struct mm_region*
+region_dup(struct mm_region* origin)