Thread Local Region: Difference between revisions

No edit summary
No edit summary
 
Line 16: Line 16:
| [[IPC_Marshalling|IPC]] command buffer.
| [[IPC_Marshalling|IPC]] command buffer.
|-
|-
| [8.0.0+] 0x100
| 0x100
| 0x2
| 0x2
| DisableCounter
| [8.0.0+] DisableCounter
| If userland sets this to non-zero, kernel will pin the thread and disallow calls to almost all SVCs.
| If userland sets this to non-zero, kernel will pin the thread and disallow calls to almost all SVCs.
|-
|-
| [8.0.0+] 0x102
| 0x102
| 0x2
| 0x2
| InterruptFlag
| [8.0.0+] InterruptFlag
| If a context switch would have occurred when user disable count was non-zero, kernel will set this to 1. This signifies that the user must call [[SVC#SynchronizePreemptionState|SynchronizePreemptionState]] to unpin itself and regain access other SVCs.
| If a context switch would have occurred when user disable count was non-zero, kernel will set this to 1. This signifies that the user must call [[SVC#SynchronizePreemptionState|SynchronizePreemptionState]] to unpin itself and regain access other SVCs.
|-
|-
| 0x104
| 0x104
| 0x4
| 0x1
| Reserved
| [14.0.0+] CacheMaintenanceFlag
|
|
|-
|-
| 0x108
| 0x105
| 0x78
| 0x7B
| Reserved
| Reserved
|
|
Line 69: Line 69:
| 0x8
| 0x8
| ThreadType
| ThreadType
| Pointer to [[Thread_Local_Region#ThreadType|thread type]].
| Pointer to [[#ThreadType|thread type]].
|}
|}


= Userland context =
= Userland context =
== OsBootParamter ==
== OsResourceManager ==
This is "nn::os::detail::g_OsBootParamter".
This is "nn::os::detail::OsResourceManager".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 83: Line 83:
! Description
! Description
|-
|-
| 0x00
| 0x0
| 0x04
| 0x14
|
| [[#RngManager|RngManager]]
| Main thread handle.
|
|-
| 0x14
| 0x4
| Reserved
|
|-
| 0x18
| 0x28
| [[#AslrSpaceManager|AslrSpaceManager]]
|
|-
| 0x40
| 0x28
| [[#StackGuardManager|StackGuardManager]]
|
|-
| 0x68
| 0x1F0
| [[#ThreadManager|ThreadManager]]
|
|-
| 0x258
| 0x110
| [[#TlsManager|TlsManager]]
|
|-
| 0x368
| 0x1
| [[#TickManager|TickManager]]
|  
|-
|-
| 0x04
| 0x369
| 0x04
| 0x7
|
| Reserved
| Always 0.
|  
|-
|-
| 0x08
| 0x370
| 0x30
| 0x30
|
| [[#MemoryHeapManager|MemoryHeapManager]]
| Empty.
|
|-
| 0x3A0
| 0x48
| [[#VammManager|VammManager]]
|  
|}
|}


== OsResourceManagerStorage ==
=== RngManager ===
This is "nn::os::detail::g_OsResourceManagerStorage".
This is "nn::os::detail::RngManager".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 109: Line 144:
! Description
! Description
|-
|-
| 0x00
| 0x0
| 0x04
| 0x4
|
| CriticalSection
| Always 0.
|  
|-
|-
| 0x04
| 0x4
| 0x10
| 0x10
|
| Random
| Process PRNG.
|  
|}
 
=== AslrSpaceManager ===
This is "nn::os::detail::AslrSpaceManager".
 
{| class="wikitable" border="1"
|-
|-
| 0x14
! Offset
| 0x04
! Size
|
! Name
| Padding.
! Description
|-
|-
| 0x18
| 0x0
| 0x08
| 0x20
|
| [[#AddressSpaceAllocator|Allocator]]
| Always set to 0.
|  
|-
|-
| 0x20
| 0x20
| 0x08
| 0x1
|
| Impl
| [[SVC#GetInfo|AddressSpaceStart]] right shifted by 0x0C.
|  
|-
| 0x21
| 0x7
| Reserved
|
|}
 
=== StackGuardManager ===
This is "nn::os::detail::StackGuardManager".
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Name
! Description
|-
|-
| 0x28
| 0x0
| 0x08
| 0x20
|
| [[#AddressSpaceAllocator|Allocator]]
| AddressSpaceEnd ([[SVC#GetInfo|AddressSpaceStart]] + [[SVC#GetInfo|AddressSpaceSize]]) right shifted by 0x0C and aligned to AddressSpaceAlign.
|  
|-
|-
| 0x30
| 0x20
| 0x08
| 0x1
|
| Impl
| AddressSpaceAlign right shifted by 0x0C.
|  
|-
|-
| 0x38
| 0x21
| 0x08
| 0x7
|
| Reserved
| Always 0.
|  
|}
 
=== ThreadManager ===
This is "nn::os::detail::ThreadManager".
 
{| class="wikitable" border="1"
|-
|-
| 0x40
! Offset
| 0x08
! Size
|
! Name
| Always set to 0.
! Description
|-
|-
| 0x48
| 0x0
| 0x08
| 0x1
|
| Impl
| [[SVC#GetInfo|MapRegionBased]] right shifted by 0x0C.
|  
|-
|-
| 0x50
| 0x1
| 0x08
| 0x7
|
| Reserved
| MapRegionEnd ([[SVC#GetInfo|MapRegionBased]] + [[SVC#GetInfo|MapRegionSize]]) right shifted by 0x0C and aligned to MapRegionAlign.
|  
|-
|-
| 0x58
| 0x8
| 0x08
| 0x1C0
|
| [[#ThreadType|MainThread]]
| MapRegionAlign right shifted by 0x0C.
|  
|-
|-
| 0x60
| 0x1C8
| 0x08
| 0x4
|
| CriticalSection
| Always 0.
|  
|-
|-
| 0x68
| 0x1CC
| 0x08
| 0x4
|
| Reserved
| Always 0.
|  
|-
|-
| 0x70
| 0x1D0
| 0x1D0
|
| 0x10
| Main [[Thread_Local_Region#ThreadType|thread type]].
| AllThreadsList
|
|-
| 0x1E0
| 0x8
| TotalThreadStackSize
|
|-
| 0x1E8
| 0x4
| NumCreatedThreads
|
|-
| 0x1EC
| 0x4
| Reserved
|
|}
 
=== TlsManager ===
This is "nn::os::detail::TlsManager".
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Name
! Description
|-
| 0x0
| 0x4
| NumUsedTlsSlots
|
|-
| 0x4
| 0x4
| Reserved
|
|-
| 0x8
| 0x100
| TlsDestructorArray
|
|-
| 0x108
| 0x4
| TlsCriticalSection
|
|-
| 0x10C
| 0x4
| Reserved
|
|}
 
=== TickManager ===
This is "nn::os::detail::TickManager".
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Name
! Description
|-
| 0x0
| 0x1
| Impl
|
|}
 
=== MemoryHeapManager ===
This is "nn::os::detail::MemoryHeapManager".
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Name
! Description
|-
| 0x0
| 0x8
| HeapAddress
|
|-
| 0x8
| 0x8
| HeapSize
|
|-
| 0x10
| 0x8
| UsedHeapSize
|
|-
| 0x18
| 0x10
| FreeMemoryList
|
|-
| 0x28
| 0x4
| CriticalSection
|
|-
| 0x2C
| 0x4
| Impl
|
|}
 
=== VammManager ===
This is "nn::os::detail::VammManager".
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Name
! Description
|-
| 0x0
| 0x8
| ReservedRegionAddress
|
|-
| 0x8
| 0x8
| ReservedRegionSize
|
|-
|-
| 0x240
| 0x10
| 0x08
| 0x30
|
| ReaderWriterLock
| Pointer to main [[Thread_Local_Region#ThreadType|thread type]].
|  
|-
|-
| 0x248
| 0x40
| 0x08
| 0x8
|
| RegionManager
| Unknown.
|  
|}
 
=== AddressSpaceAllocator ===
This is "nn::os::detail::AddressSpaceAllocator".
 
{| class="wikitable" border="1"
|-
|-
| 0x250
! Offset
| 0x08
! Size
|
! Name
| Unknown.
! Description
|-
|-
| 0x258
| 0x0
| 0x130
| 0x4
|
| CriticalSection
| Always empty?
|  
|-
|-
| 0x388
| 0x4
| 0x08
| 0x4
|
| Reserved
| Pointer to [[Thread_Local_Region#OsResourceManagerStorage|resource manager storage]] + 0x388.
|  
|-
|-
| 0x390
| 0x8
| 0x08
| 0x8
|
| BeginPage
| Pointer to [[Thread_Local_Region#OsResourceManagerStorage|resource manager storage]] + 0x388.
|  
|-
|-
| 0x398
| 0x10
| 0x08
| 0x8
|
| EndPage
| Always 0.
|  
|-
|-
| 0x3A0
| 0x18
| 0x08
| 0x8
|
| GuardPageCount
| Always 0.
|  
|}
|}