1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

Kernel: Remove allocate_region() functions that don't take a Range

Let's force callers to provide a VM range when allocating a region.
This makes ENOMEM error handling more visible and removes implicit
VM allocation which felt a bit magical.
This commit is contained in:
Andreas Kling 2021-01-26 14:13:57 +01:00
parent d697d33fa6
commit 1e25d2b734
5 changed files with 41 additions and 25 deletions

View file

@ -1041,7 +1041,11 @@ KResult Thread::make_thread_specific_region(Badge<Process>)
if (!process().m_master_tls_region)
return KSuccess;
auto region_or_error = process().allocate_region({}, thread_specific_region_size(), "Thread-specific", PROT_READ | PROT_WRITE);
auto range = process().allocate_range({}, thread_specific_region_size());
if (!range.is_valid())
return ENOMEM;
auto region_or_error = process().allocate_region(range, "Thread-specific", PROT_READ | PROT_WRITE);
if (region_or_error.is_error())
return region_or_error.error();