summaryrefslogtreecommitdiff
path: root/Kernel/VM/Region.h
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-12-21 23:21:58 -0700
committerAndreas Kling <kling@serenityos.org>2021-01-17 20:30:31 +0100
commit1d621ab1725d1eba0fafef4575aef72682cd57ad (patch)
treeb30a1d63d09e70722fe04a45c6e96522d3a295bc /Kernel/VM/Region.h
parent7581b64705ed3c5b3711c956504f278c2ea3899e (diff)
downloadserenity-1d621ab1725d1eba0fafef4575aef72682cd57ad.zip
Kernel: Some futex improvements
This adds support for FUTEX_WAKE_OP, FUTEX_WAIT_BITSET, FUTEX_WAKE_BITSET, FUTEX_REQUEUE, and FUTEX_CMP_REQUEUE, as well well as global and private futex and absolute/relative timeouts against the appropriate clock. This also changes the implementation so that kernel resources are only used when a thread is blocked on a futex. Global futexes are implemented as offsets in VMObjects, so that different processes can share a futex against the same VMObject despite potentially being mapped at different virtual addresses.
Diffstat (limited to 'Kernel/VM/Region.h')
-rw-r--r--Kernel/VM/Region.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h
index bd57b651f7..fef5e6ecff 100644
--- a/Kernel/VM/Region.h
+++ b/Kernel/VM/Region.h
@@ -192,6 +192,11 @@ public:
return m_offset_in_vmobject;
}
+ size_t offset_in_vmobject_from_vaddr(VirtualAddress vaddr) const
+ {
+ return m_offset_in_vmobject + vaddr.get() - this->vaddr().get();
+ }
+
size_t amount_resident() const;
size_t amount_shared() const;
size_t amount_dirty() const;