summaryrefslogtreecommitdiff
path: root/Kernel/Thread.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-04-03 17:12:39 +0200
committerAndreas Kling <kling@serenityos.org>2022-04-03 21:51:58 +0200
commit07f3d09c55226bd3f2e1ad7139521268a347d136 (patch)
tree26e9e4b3f4bea1fd317004e83f9063bd8d315141 /Kernel/Thread.cpp
parente852a69a069de6176cd6ff3534d5a606d383f396 (diff)
downloadserenity-07f3d09c55226bd3f2e1ad7139521268a347d136.zip
Kernel: Make VM allocation atomic for userspace regions
This patch move AddressSpace (the per-process memory manager) to using the new atomic "place" APIs in RegionTree as well, just like we did for MemoryManager in the previous commit. This required updating quite a few places where VM allocation and actually committing a Region object to the AddressSpace were separated by other code. All you have to do now is call into AddressSpace once and it'll take care of everything for you.
Diffstat (limited to 'Kernel/Thread.cpp')
-rw-r--r--Kernel/Thread.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index c23c9fd4a2..100db817e8 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -1419,10 +1419,9 @@ ErrorOr<void> Thread::make_thread_specific_region(Badge<Process>)
if (!process().m_master_tls_region)
return {};
- auto range = TRY(process().address_space().try_allocate_range({}, thread_specific_region_size()));
- auto* region = TRY(process().address_space().allocate_region(range, "Thread-specific", PROT_READ | PROT_WRITE));
+ auto* region = TRY(process().address_space().allocate_region({}, thread_specific_region_size(), PAGE_SIZE, "Thread-specific", PROT_READ | PROT_WRITE));
- m_thread_specific_range = range;
+ m_thread_specific_range = region->range();
SmapDisabler disabler;
auto* thread_specific_data = (ThreadSpecificData*)region->vaddr().offset(align_up_to(process().m_master_tls_size, thread_specific_region_alignment())).as_ptr();