Kernel/Threads: Dynamically allocate the TLS region for threads in the BASE region of the linear heap.
Each thread gets a 0x200-byte area from the 0x1000-sized page, when all 8 thread slots in a single page are used up, the kernel allocates a new page to hold another 8 entries. This is consistent with what the real kernel does.
This commit is contained in:
parent
3e7e8daf59
commit
d192fb066d
5 changed files with 74 additions and 28 deletions
|
@ -140,8 +140,11 @@ public:
|
|||
|
||||
MemoryRegionInfo* memory_region = nullptr;
|
||||
|
||||
/// Bitmask of the used TLS slots
|
||||
std::bitset<300> used_tls_slots;
|
||||
/// The Thread Local Storage area is allocated as processes create threads,
|
||||
/// each TLS area is 0x200 bytes, so one page (0x1000) is split up in 8 parts, and each part
|
||||
/// holds the TLS for a specific thread. This vector contains which parts are in use for each page as a bitmask.
|
||||
/// This vector will grow as more pages are allocated for new threads.
|
||||
std::vector<std::bitset<8>> tls_slots;
|
||||
|
||||
VAddr GetLinearHeapAreaAddress() const;
|
||||
VAddr GetLinearHeapBase() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue