git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix dependency check logic cause config always disabled
[lunaix-os.git]
/
lunaix-os
/
includes
/
lunaix
/
mm
/
page.h
diff --git
a/lunaix-os/includes/lunaix/mm/page.h
b/lunaix-os/includes/lunaix/mm/page.h
index 23d5c646dd5e13b6da907e45c8a1b00d90a82ca1..da7cab42fa42d8e6478638ac65a05e0d75a0ae57 100644
(file)
--- a/
lunaix-os/includes/lunaix/mm/page.h
+++ b/
lunaix-os/includes/lunaix/mm/page.h
@@
-284,6
+284,13
@@
vmap_range(pfn_t start, size_t npages, pte_attr_t prot)
return vmap_ptes_at(_pte, LFT_SIZE, npages);
}
return vmap_ptes_at(_pte, LFT_SIZE, npages);
}
+static inline void
+vunmap_range(pfn_t start, size_t npages)
+{
+ pte_t* ptep = mkptep_va(VMS_SELF, start);
+ vmm_set_ptes_contig(ptep, null_pte, LFT_SIZE, npages);
+}
+
/**
* @brief Allocate a page in kernel space.
/**
* @brief Allocate a page in kernel space.
@@
-296,4
+303,22
@@
vmap_range(pfn_t start, size_t npages, pte_attr_t prot)
pte_t
alloc_kpage_at(pte_t* ptep, pte_t pte, int order);
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 */
#endif /* __LUNAIX_PAGE_H */