summaryrefslogtreecommitdiffstats
path: root/mem/zone.h
diff options
context:
space:
mode:
Diffstat (limited to 'mem/zone.h')
-rw-r--r--mem/zone.h33
1 files changed, 26 insertions, 7 deletions
diff --git a/mem/zone.h b/mem/zone.h
index 7e863bf..c0b0f52 100644
--- a/mem/zone.h
+++ b/mem/zone.h
@@ -22,23 +22,42 @@ struct PhysicalMemoryZone
uintptr_t base;
uintptr_t limit;
- size_t npages_total;
- size_t npages_free;
-
struct BuddyMap freemap;
};
+/**Return the zone index for the given address
+ * @param addr address to look up
+ * @return zone index*/
+int mem_zone_for(uintptr_t addr);
+
+/**Return the lower bound for the given zone index.
+ * @param zone index into zones.
+ * @return lower bound.*/
+uintptr_t mem_zone_bound_lower(size_t zone);
+
+/**Return the upper bound for the given zone index.
+ * @param zone index into zones.
+ * @return upper bound.*/
+uintptr_t mem_zone_bound_upper(size_t zone);
+
+/**Return the number of pages free in the given zone.
+ * @param zone index into zones.
+ * @return number of free pages.*/
+size_t mem_zone_pages_free(size_t zone);
+
/** Using a given zone, reserve a range of physical addresses
* @param zone identifier of zone to modify
* @param base starting address to reserve
- * @param limit ending address to reserve*/
-void mem_zone_resv(size_t zone, uintptr_t base, uintptr_t limit);
+ * @param limit ending address to reserve
+ * @return error code or 0 if success */
+int mem_zone_resv(size_t zone, uintptr_t base, uintptr_t limit);
/** Using a given zone, free a range of physical addresses
* @param zone identifier of zone to modify
* @param base starting address to free
- * @param limit ending address to free*/
-void mem_zone_free(size_t zone, uintptr_t base, uintptr_t limit);
+ * @param limit ending address to free
+ * @return error code or 0 if success*/
+int mem_zone_free(size_t zone, uintptr_t base, uintptr_t limit);
/** Allocate a number of pages from the given zone
* @param zone identifier of the zone to modify