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
|
@ -100,15 +100,9 @@ enum : VAddr {
|
|||
SHARED_PAGE_SIZE = 0x00001000,
|
||||
SHARED_PAGE_VADDR_END = SHARED_PAGE_VADDR + SHARED_PAGE_SIZE,
|
||||
|
||||
// TODO(yuriks): The size of this area is dynamic, the kernel grows
|
||||
// it as more and more threads are created. For now we'll just use a
|
||||
// hardcoded value.
|
||||
/// Area where TLS (Thread-Local Storage) buffers are allocated.
|
||||
TLS_AREA_VADDR = 0x1FF82000,
|
||||
TLS_ENTRY_SIZE = 0x200,
|
||||
TLS_AREA_SIZE = 300 * TLS_ENTRY_SIZE + 0x800, // Space for up to 300 threads + round to page size
|
||||
TLS_AREA_VADDR_END = TLS_AREA_VADDR + TLS_AREA_SIZE,
|
||||
|
||||
|
||||
/// Equivalent to LINEAR_HEAP_VADDR, but expanded to cover the extra memory in the New 3DS.
|
||||
NEW_LINEAR_HEAP_VADDR = 0x30000000,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue