sweep through entire page table to free up intermediate tables
[lunaix-os.git] / lunaix-os / includes / lunaix / mm / page.h
index 0f9fb0c0aacff04179c5587aaca31ba7f9c3a9c2..da7cab42fa42d8e6478638ac65a05e0d75a0ae57 100644 (file)
@@ -303,4 +303,22 @@ vunmap_range(pfn_t start, size_t npages)
 pte_t 
 alloc_kpage_at(pte_t* ptep, pte_t pte, int order);
 
+static inline void*
+vmalloc_page(int order)
+{
+    struct leaflet* leaf = alloc_leaflet(0);
+    if (!leaf) {
+        return NULL;
+    }
+
+    return (void*)vmap(leaf, KERNEL_DATA);
+}
+
+static inline void
+vmfree(void* ptr)
+{
+    struct leaflet* leaf = ppfn_leaflet(pfn((ptr_t)ptr));
+    leaflet_return(leaf);
+}
+
 #endif /* __LUNAIX_PAGE_H */