mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +00:00
Kernel: Make VirtualRangeAllocator return KResultOr<VirtualRange>
This achieves two things: - The allocator can report more specific errors - Callers can (and now do) use TRY() :^)
This commit is contained in:
@@ -1190,13 +1190,10 @@ KResult Thread::make_thread_specific_region(Badge<Process>)
|
||||
if (!process().m_master_tls_region)
|
||||
return KSuccess;
|
||||
|
||||
auto range = process().address_space().allocate_range({}, thread_specific_region_size());
|
||||
if (!range.has_value())
|
||||
return ENOMEM;
|
||||
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(range.value(), "Thread-specific", PROT_READ | PROT_WRITE));
|
||||
|
||||
m_thread_specific_range = range.value();
|
||||
m_thread_specific_range = 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();
|
||||
|
||||
Reference in New Issue
Block a user