- if (!proc->mm.regions) {
- llist_init_head(®ion->head);
- proc->mm.regions = region;
- }
- else {
- llist_append(&proc->mm.regions->head, ®ion->head);
+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 = start + length - 1 };
+ return region;
+}
+
+void
+region_add(vm_regions_t* lead, struct mm_region* vmregion)
+{
+ if (llist_empty(lead)) {
+ llist_append(lead, &vmregion->head);
+ return;