aboutsummaryrefslogtreecommitdiff
path: root/include/arch
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-09 17:35:56 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-09 17:35:56 +0300
commit298636079d912d0936f8156a609fe74b839c547b (patch)
treee0c22ce0e7b7c8a29e3937616076e8fb327fde8b /include/arch
parente134202611a50b358c147c92bfb8a7f443030b8b (diff)
downloadkmi-298636079d912d0936f8156a609fe74b839c547b.tar.gz
kmi-298636079d912d0936f8156a609fe74b839c547b.zip
allow mapping null page
+ User has to 'free' the 0 page before it becomes accessible to mapping. Probably worth noting that this is likely VERY niche and mainly concerns stuff like certain kinds of emulators that I'm still eons from implementing, but still. Unbacked pages can also be useful for some kinds of notifications, like 'if someone writes to this page, please report it to me with this ID' or whatever, I remember seeing some discussion about it somewhere but that's also not really relevant for the moment. Most significantly, at least with the current design, after the null page is freed it becomes available for use to regular req_mem() calls, so users should probably using locks around memory requests. That's probably a good idea anyway as internally the kernal has to lock the virtual memory, and without a scheduler it might cause threads to spin for a while in the kernel which is rather bad.
Diffstat (limited to 'include/arch')
-rw-r--r--include/arch/vmem.h15
1 files changed, 5 insertions, 10 deletions
diff --git a/include/arch/vmem.h b/include/arch/vmem.h
index a19f555..1674e95 100644
--- a/include/arch/vmem.h
+++ b/include/arch/vmem.h
@@ -24,9 +24,6 @@
/**
* Map one virtual page to physical page.
*
- * If \ref INFO_SEFF is returned, the caller is responsible for synchronizing
- * all other threads that are in the same virtual address space.
- *
* The caller is responsible for checking that both virtual and physical page of
* the correct order are available.
*
@@ -35,7 +32,8 @@
* @param vaddr Virtual address to map page to.
* @param flags Page flags.
* @param order Order of page.
- * @return \ref INFO_SEFF when top level table modified, \ref OK otherwise.
+ * @return \ref OK when succesful, possibly \ref ERR_OOMEM if we don't have
+ * enough pages to create the mapping.
*/
stat_t map_vpage(struct vmem *branch, pm_t paddr, vm_t vaddr, vmflags_t flags,
enum mm_order order);
@@ -56,8 +54,7 @@ stat_t unmap_vpage(struct vmem *branch, vm_t vaddr);
* @param branch Branch in which to work.
* @param vaddr Virtual address of page.
* @param flags Flags to set.
- * @return \ref ERR_NF if no page could be found at \p vaddr,
- * \ref INFO_SEFF if modification has side effects, otherwise \ref OK.
+ * @return \ref ERR_NF if no page could be found at \p vaddr, otherwise \ref OK.
*/
stat_t set_vpage_flags(struct vmem *branch, vm_t vaddr, vmflags_t flags);
@@ -68,7 +65,7 @@ stat_t set_vpage_flags(struct vmem *branch, vm_t vaddr, vmflags_t flags);
* @param vaddr Virtual address of page.
* @param flags Flags to clear.
* @return \ref ERR_NF if no page could be found at \p vaddr,
- * \ref INFO_SEFF if modification has side effects, otherwise \ref OK.
+ * otherwise \ref OK.
*/
stat_t clear_vpage_flags(struct vmem *branch, vm_t vaddr, vmflags_t flags);
@@ -82,9 +79,7 @@ stat_t clear_vpage_flags(struct vmem *branch, vm_t vaddr, vmflags_t flags);
* @param vaddr Virtual address of map to modify.
* @param paddr Physical address to map to.
* @param flags Flags to set.
- * @return \ref ERR_NF if no virtual page is found at \c vaddr.
- * \ref INFO_SEFF if modding takes place in top page table but otherwise
- * succesful, \ref OK otherwise.
+ * @return \ref ERR_NF if no virtual page is found at \c vaddr, \ref OK otherwise.
*/
stat_t mod_vpage(struct vmem *branch, vm_t vaddr, pm_t paddr, vmflags_t flags);