thread/process: Move TLS slot marking/freeing to the process class

Allows making several members of the process class private, it also
avoids going through Core::CurrentProcess() just to retrieve the owning
process.
This commit is contained in:
Lioncash 2018-09-21 01:26:29 -04:00
parent 1db1e013e0
commit acfc801d14
4 changed files with 89 additions and 68 deletions

View file

@ -176,8 +176,25 @@ public:
///////////////////////////////////////////////////////////////////////////////////////////////
// Memory Management
// Marks the next available region as used and returns the address of the slot.
VAddr MarkNextAvailableTLSSlotAsUsed(Thread& thread);
// Frees a used TLS slot identified by the given address
void FreeTLSSlot(VAddr tls_address);
ResultVal<VAddr> HeapAllocate(VAddr target, u64 size, VMAPermission perms);
ResultCode HeapFree(VAddr target, u32 size);
ResultCode MirrorMemory(VAddr dst_addr, VAddr src_addr, u64 size);
ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size);
VMManager vm_manager;
private:
explicit Process(KernelCore& kernel);
~Process() override;
// Memory used to back the allocations in the regular heap. A single vector is used to cover
// the entire virtual address space extents that bound the allocations, including any holes.
// This makes deallocation and reallocation of holes fast and keeps process memory contiguous
@ -197,17 +214,6 @@ public:
std::vector<std::bitset<8>> tls_slots;
std::string name;
ResultVal<VAddr> HeapAllocate(VAddr target, u64 size, VMAPermission perms);
ResultCode HeapFree(VAddr target, u32 size);
ResultCode MirrorMemory(VAddr dst_addr, VAddr src_addr, u64 size);
ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size);
private:
explicit Process(KernelCore& kernel);
~Process() override;
};
} // namespace Kernel