Kernel: Difference between revisions
As evidenced by 0xFFFFFFFFBFC23DA4 |
m Hexkyz moved page Kernel objects to Kernel: Use this page for general kernel documentation |
||
(25 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
Size: 0x10 | Size: 0x10 | ||
[5.0.0] Size: 0x20 | |||
[6.0.0] Size: 0x30 | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Type || Description | |||
|- | |||
| 0 || * || Vtable | |||
|- | |||
| 8 || u32 || ReferenceCount | |||
|} | |||
[5.0.0]: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Type || Description | |||
|- | |||
| 0 || * || Vtable | |||
|- | |||
| 8 || u32 || ReferenceCount | |||
|- | |||
| 0x10 || KLinkedListNode || Intrusive list, links to other instances of the same class (managed by a KObjectAllocator). | |||
|} | |||
[6.0.0]: | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 9: | Line 35: | ||
|- | |- | ||
| 8 || u32 || ReferenceCount | | 8 || u32 || ReferenceCount | ||
|- | |||
| 0x10 || [[#KRedBlackTreeNode]] || Intrusive red-black tree node, replaces the Intrusive list node from previous versions. | |||
|} | |} | ||
= KSynchronizationObject = | = KSynchronizationObject = | ||
Size: 0x28 | Size: 0x28 | ||
[5.0.0] Size: 0x38 | |||
[6.0.0] Size: 0x48 | |||
Inherits from: [[#KAutoObject]] | Inherits from: [[#KAutoObject]] | ||
Line 50: | Line 82: | ||
= KLockedList = | = KLockedList = | ||
Size: 0x28 | Size: 0x28 | ||
[5.0.0]? Size: 0x20 | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 64: | Line 98: | ||
|} | |} | ||
[5.0.0]?: | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 71: | Line 104: | ||
! Offset || Type || Description | ! Offset || Type || Description | ||
|- | |- | ||
| 0 || [[#KLinkedListNode]]* || Prev | | 0 || [[#KLinkedListNode]] || List | ||
|- | |||
| 0x10 || [[#KMutex]] || Mutex | |||
|- | |||
| 0x18 || u64 || MaxCount | |||
|} | |||
= KLinkedListNode = | |||
Size: 0x10 | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Type || Description | |||
|- | |||
| 0 || [[#KLinkedListNode]]* || Prev | |||
|- | |- | ||
| 8 || [[#KLinkedListNode]]* || Next | | 8 || [[#KLinkedListNode]]* || Next | ||
Line 100: | Line 147: | ||
|} | |} | ||
= | = KRedBlackTreeNode = | ||
Size: 0x20 | |||
Note: This is BSD sys/tree.h's RB_ENTRY(...). | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Offset || Type || Description | ||
|- | |- | ||
| | | 0 || KRedBlackTreeNode* || Left Child | ||
|- | |- | ||
| | | 8 || KRedBlackTreeNode* || Right Child | ||
|- | |- | ||
| 0x58 || KSchedulerObject2 || Inheritance | | 0x10 || KRedBlackTreeNode* || Parent | ||
|- | |||
| 0x18 || int || Color | |||
|} | |||
= KRedBlackTree = | |||
Size: 0x8 | |||
Note: This is BSD sys/tree.h's RB_HEAD(..., KRedBlackTreeNode); | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Type || Description | |||
|- | |||
| 0 || KRedBlackTreeNode* || Root | |||
|- | |||
|} | |||
= KThread = | |||
[1.0.0] Size: 0x620 | |||
[5.0.0]? Size: 0x6C0 | |||
Inherits from: [[#KSynchronizationObject]], [[#KSchedulerObject0]], [[#KSchedulerObject1]], [[#KSchedulerObject2]] | |||
<div style="display: inline-block"> | |||
{| class="wikitable" border="1" | |||
|- | |||
! 1.0.0 Offset || Type || Description | |||
|- | |||
| 0 || [[#KSynchronizationObject]] || Inheritance | |||
|- | |||
| 0x28 || KSchedulerObject0 || Inheritance | |||
|- | |||
| 0x48 || KSchedulerObject1 || Inheritance | |||
|- | |||
| 0x58 || KSchedulerObject2 || Inheritance | |||
|- | |- | ||
| 0x70 || KThreadContext || Context | | 0x70 || KThreadContext || Context | ||
Line 164: | Line 243: | ||
| 0x5A8 || KLinkedListNode || NodeFor__ThreadsOnSameCore | | 0x5A8 || KLinkedListNode || NodeFor__ThreadsOnSameCore | ||
|- | |- | ||
| 0x5B8 || | | 0x5B8 || [[#KThread]]* || | ||
|- | |- | ||
| 0x5C0 || [[#KThread]]* || CondVar_SelfPtr | | 0x5C0 || [[#KThread]]* || CondVar_SelfPtr | ||
Line 219: | Line 298: | ||
[3.0.0] Size: 0x2580 | [3.0.0] Size: 0x2580 | ||
[5.0.0] Size: 0x4600 | |||
Inherits from: [[#KSynchronizationObject]] | Inherits from: [[#KSynchronizationObject]] | ||
Line 229: | Line 310: | ||
| 0 || [[#KSynchronizationObject]] || Inheritance | | 0 || [[#KSynchronizationObject]] || Inheritance | ||
|- | |- | ||
| 0x28 || | | 0x28 || KProcessTerminationMessage || Sent to mailbox 0 when self-terminating. | ||
|- | |- | ||
| 0x38 || [[#KMemoryManager]] || MemoryManager | | 0x38 || [[#KMemoryManager]] || MemoryManager | ||
Line 301: | Line 382: | ||
| 0x55C || u32 || UnusedZero | | 0x55C || u32 || UnusedZero | ||
|- | |- | ||
| 0x560 || u64[ | | 0x560 || u64[2] || UnusedZeroes | ||
|- | |||
| 0x570 || u64 || TotalTimeRunning | |||
|- | |||
| 0x578 || u64[5] || UnusedZeroes | |||
|- | |- | ||
| 0x5A0 || u64 || UnusedZero | | 0x5A0 || u64 || UnusedZero | ||
Line 316: | Line 401: | ||
| 0 || [[#KSynchronizationObject]] || Inheritance | | 0 || [[#KSynchronizationObject]] || Inheritance | ||
|- | |- | ||
| 0x28 || | | 0x28 || KProcessTerminationMessage || Sent to mailbox 0 when self-terminating. | ||
|- | |- | ||
| 0x38 || [[#KMemoryManager]] || MemoryManager | | 0x38 || [[#KMemoryManager]] || MemoryManager | ||
Line 517: | Line 602: | ||
[2.0.0] Size: 8 | [2.0.0] Size: 8 | ||
[5.0.0] Size: 0x10 | |||
<div style="display: inline-block"> | <div style="display: inline-block"> | ||
Line 541: | Line 628: | ||
|- | |- | ||
| 4 || u32 || ObjectCompressedPtr | | 4 || u32 || ObjectCompressedPtr | ||
|} | |||
</div> | |||
<div style="display: inline-block; vertical-align:top;"> | |||
{| class="wikitable" border="1" | |||
|- | |||
! 5.0.0 Offset || Type || Description | |||
|- | |||
| 0 || u16 || HandleId | |||
|- | |||
| 2 || u16 || ObjectType | |||
|- | |||
| 8 || [[#KAutoObject]]* || object | |||
|} | |} | ||
</div> | </div> | ||
Line 587: | Line 687: | ||
[2.0.0] Size: 0xC8 | [2.0.0] Size: 0xC8 | ||
[5.0.0] Size: 0xF8? | |||
<div style="display: inline-block"> | <div style="display: inline-block"> | ||
Line 710: | Line 812: | ||
</div> | </div> | ||
= | <div style="display: inline-block; vertical-align:top;"> | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! 5.0.0 Offset | ||
! Type | ! Type | ||
! Description | ! Description | ||
|- | |- | ||
| 0 || | | 0 || * || Vtable | ||
|- | |||
| 8 || u64 || AddrSpaceMinAddr | |||
|- | |- | ||
| | | 0x10 || u64 || AddrSpaceMaxAddr | ||
|- | |- | ||
| | | 0x18 || u64 || HeapRegionBaseAddr | ||
| | |||
|- | |- | ||
| 0x20 || u64 || HeapRegionEndAddr | |||
|- | |- | ||
| | | 0x28 || u64 || HeapCurAddr | ||
|- | |- | ||
| | | 0x30 || u64 || MapRegionBaseAddr | ||
|- | |- | ||
| | | 0x38 || u64 || MapRegionEndAddr | ||
|- | |- | ||
| 0x40 || u64 || NewMapRegionBaseAddr | |||
|- | |- | ||
| | | 0x48 || u64 || NewMapRegionEndAddr | ||
|- | |- | ||
| | | 0x50 || u64 || TlsIoRegionBaseAddr | ||
|- | |||
| 0x58 || u64 || TlsIoRegionEndAddr | |||
|- | |||
| 0x60 || u64 || HeapMaxAllocation | |||
|- | |||
| 0x68 || || | |||
|- | |||
| 0x70 || || | |||
|- | |||
| 0x78 || [[#KMutex]] || Mutex | |||
|- | |||
| 0x80 || [[#KPageTable]] || PageTable | |||
|- | |||
| 0x90 || [[#KMemoryBlockManager]] || MemoryBlockManager | |||
|- | |- | ||
| | | 0xA8 || u32 || ? | ||
|- | |- | ||
| | | 0xAC || u32 || AddressSpaceWidth (32/36/39) | ||
|- | |- | ||
| | | 0xB0 || [[#KLinkedList]]? || | ||
|- | |- | ||
| | | 0xC8 || || | ||
|- | |- | ||
| | | 0xD0 || || | ||
|- | |- | ||
| | | 0xD8 || ptr || | ||
|- | |- | ||
| | | 0xE0 || u64 || TranslationTableBaseRegister0 val | ||
|- | |- | ||
| | | 0xE8 || u64 || TranslationControlRegister val | ||
|- | |- | ||
| | | 0xF0 || u32 || AsidTagValue | ||
|} | |} | ||
</div> | |||
== | == KPageTable == | ||
Size: | Size: 0x10 | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 783: | Line 884: | ||
! Description | ! Description | ||
|- | |- | ||
| 0 || | | 0 || void* || RawPageTablePtr | ||
|- | |- | ||
| 8 || | | 8 || bool || | ||
|- | |- | ||
| | | 0xC || u32 || AddrSpaceSizeInGb | ||
|} | |||
== KMemoryBlockManager == | |||
Size: 0x18 | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
! Offset | |||
! Type | |||
! Description | |||
|- | |- | ||
| | | 0 || [[#KMemoryBlock]]* || MemoryBlockList | ||
|- | |- | ||
| | | 8 || u64 || MaxAddr | ||
|- | |- | ||
| | | 0x10 || u64 || MinAddr | ||
|} | |} | ||
= | == KMemoryBlock == | ||
Size: | Size: 0x40 | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 811: | Line 916: | ||
! Description | ! Description | ||
|- | |- | ||
| 0 || [[# | | 0 || [[#KLinkedListNode]]<[[#KMemoryBlock]] *> || NodeFor__MemoryBlockList | ||
|- | |- | ||
| 0x10 || | | 0x10 || || | ||
|- | |||
| 0x18 || || | |||
|- | |||
| 0x20 || u64 || BaseAddress | |||
|- | |||
| 0x28 || u64 || NumOfPages | |||
|- | |- | ||
| | | 0x30 || u32 || State | ||
|- | |- | ||
| | | 0x34 || u16 || IpcRefCount [?] | ||
|- | |- | ||
| | | 0x36 || u16 || DeviceMapRefCount | ||
|- | |- | ||
| | | 0x38 || u8 || Permission | ||
|- | |- | ||
| | | 0x39 || u8 || UnkAttribute | ||
|- | |- | ||
| | | 0x3A || u8 || Attribute | ||
|} | |} | ||
= | == KMemoryBlockInfo == | ||
Size: 0x20 | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Type | |||
! Description | |||
{| class="wikitable" border="1" | |- | ||
| 0 || u64 || BaseAddress | |||
|- | |- | ||
| 8 || u64 || Size | |||
|- | |- | ||
| | | 0x10 || u32 || State | ||
|- | |- | ||
| | | 0x14 || u8 || Permission | ||
|- | |- | ||
| | | 0x15 || u8 || Attribute | ||
|- | |- | ||
| | | 0x16 || u8 || UnkAttribute | ||
|- | |- | ||
| | | 0x18 || u16 || IpcRefCount [?] | ||
|- | |- | ||
| | | 0x1A || u16 || DeviceMapRefCount | ||
|} | |} | ||
= KTransferMemory = | |||
{| class="wikitable" border="1" | Size: 0x48 | ||
Inherits from: [[#KAutoObject]] | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
! | ! Offset | ||
! Type | |||
! Description | |||
|- | |- | ||
| 0 || [[#KAutoObject]] || Inheritance | | 0 || [[#KAutoObject]] || Inheritance | ||
Line 863: | Line 980: | ||
| 0x10 || KMemoryBlockList || Blocks | | 0x10 || KMemoryBlockList || Blocks | ||
|- | |- | ||
| 0x28 || [[# | | 0x28 || [[#KProcess]]* || OwnerProcess | ||
|- | |||
| 0x30 || u64 || BaseAddress | |||
|- | |- | ||
| | | 0x38 || KMutex || Mutex | ||
|- | |- | ||
| | | 0x40 || int || Permission | ||
|- | |- | ||
| | | 0x44 || bool || HasInited | ||
|- | |- | ||
| | | 0x45 || bool || IsMapped | ||
|} | |} | ||
= KSharedMemory = | |||
[1.0.0] Size: 0x40 | |||
[2.0.0] Size: 0x48 | |||
[ | |||
Inherits from: [[#KAutoObject]] | Inherits from: [[#KAutoObject]] | ||
<div style="display: inline-block;"> | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset || Type || Description | ! 1.0.0 Offset || Type || Description | ||
|- | |- | ||
| 0 || [[#KAutoObject]] || Inheritance | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| | | 0x10 || KMemoryBlockList || Blocks | ||
|- | |- | ||
| | | 0x28 || [[#KProcess]]* || OwnerProcess | ||
|- | |- | ||
| | | 0x30 || int || LocalPermission | ||
|- | |- | ||
| | | 0x34 || int || RemotePermission | ||
|- | |- | ||
| | | 0x38 || bool || HasInited | ||
|} | |} | ||
</div> | |||
= | <div style="display: inline-block; vertical-align:top;"> | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! 2.0.0 Offset || Type || Description | ||
|- | |- | ||
| 0 || [[#KAutoObject]] || Inheritance | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| 0x10 || | | 0x10 || KMemoryBlockList || Blocks | ||
|- | |- | ||
| | | 0x28 || [[#KResourceLimit]]* || OwnerResourceLimit | ||
|- | |||
| 0x30 || u64 || OwnerProcessPid | |||
|- | |- | ||
| | | 0x38 || int || LocalPermission | ||
|- | |- | ||
| | | 0x3C || int || RemotePermission | ||
|- | |- | ||
| | | 0x40 || bool || HasInited | ||
|} | |} | ||
= | </div> | ||
Size: | |||
= KJitMemory = | |||
[4.0.0+] Size: 0x58 | |||
Inherits from: [[# | Inherits from: [[#KAutoObject]] | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! Offset || Type || Description | ||
|- | |- | ||
| 0 || [[# | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| | | 0x20 || KMemoryBlockList || Blocks | ||
|- | |- | ||
| 0x38 || [[# | | 0x38 || [[#KProcess]]* || SrcProcessPtr | ||
|- | |- | ||
| 0x48 || [[# | | 0x40 || u64 || SrcAddr | ||
|- | |||
| 0x48 || [[#KMutex]] || Mutex | |||
|- | |||
| 0x50 || u8 || HasInit | |||
|- | |||
| 0x51 || u8 || HasMappedSlave | |||
|- | |||
| 0x52 || u8 || HasMappedMaster | |||
|} | |} | ||
== | = KPort = | ||
Size: | [1.0.0] Size: 0xA8 | ||
[7.0.0] Size: 0x110 | |||
Inherits from: [[#KAutoObject]] | |||
<div style="display: inline-block;"> | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! 1.0.0 Offset | ||
! Type | ! Type | ||
! Description | ! Description | ||
|- | |- | ||
| 0 || [[# | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| | | 0x10 || [[#KServerPort]] || ServerSide | ||
|- | |- | ||
| | | 0x60 || [[#KClientPort]] || ClientSide | ||
|- | |- | ||
| | | 0x98 || u64 || | ||
|- | |||
| 0xA0 || bool || HasInited | |||
|- | |||
| 0xA1 || bool || IsLight | |||
|} | |} | ||
</div> | |||
= | <div style="display: inline-block; vertical-align:top;"> | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! 7.0.0 Offset | ||
! Type | ! Type | ||
! Description | ! Description | ||
Line 979: | Line 1,105: | ||
| 0 || [[#KAutoObject]] || Inheritance | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| | | 0x30 || [[#KServerPort]] || ServerSide | ||
|- | |||
| 0xA0 || [[#KClientPort]] || ClientSide | |||
|- | |||
| 0xF8 || u64 || | |||
|- | |||
| 0x100 || char* || NamePtr | |||
|- | |- | ||
| | | 0x108 || bool || HasInited | ||
|- | |- | ||
| | | 0x109 || bool || IsLight | ||
|} | |} | ||
</div> | |||
== | == KServerPort == | ||
Size: | Size: 0x50 | ||
Inherits from: [[#KSynchronizationObject]] | Inherits from: [[#KSynchronizationObject]] | ||
Line 993: | Line 1,126: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! Offset | ||
! Type | |||
! Description | |||
|- | |- | ||
| 0 || [[#KSynchronizationObject]] || Inheritance | | 0 || [[#KSynchronizationObject]] || Inheritance | ||
|- | |- | ||
| 0x28 || KLinkedListNode || | | 0x28 || [[#KLinkedListNode]] || IncomingConnections | ||
|- | |- | ||
| 0x38 || [[# | | 0x38 || [[#KLinkedListNode]] || IncomingLightConnections | ||
|- | |- | ||
| | | 0x48 || [[#KPort]]* || Parent | ||
|} | |} | ||
== | == KClientPort == | ||
Size: | Size: 0x38 | ||
Inherits from: [[#KSynchronizationObject]] | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! Offset | ||
! Type | |||
! Description | |||
|- | |- | ||
| 0 || | | 0 || [[#KSynchronizationObject]] || Inheritance | ||
|- | |- | ||
| | | 0x28 || u32 || NumSessions | ||
|- | |- | ||
| | | 0x2C || u32 || MaxSessions | ||
|- | |- | ||
| | | 0x30 || [[#KPort]]* || Parent | ||
| | |} | ||
| | |||
= KSession = | |||
Size: 0xB0 | |||
Inherits from: [[#KAutoObject]] | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
! Offset | |||
! Type | |||
! Description | |||
|- | |- | ||
| | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| | | 0x10 || [[#KServerSession]] || ServerSide | ||
|- | |- | ||
| | | 0x70 || [[#KClientSession]] || ClientSide | ||
|- | |- | ||
| | | 0xA8 || bool || HasInited | ||
|} | |} | ||
== | == KServerSession == | ||
Size: | Size: 0x60 | ||
Inherits from: [[#KSynchronizationObject]] | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,047: | Line 1,188: | ||
! Offset || Type || Description | ! Offset || Type || Description | ||
|- | |- | ||
| 0 || | | 0 || [[#KSynchronizationObject]] || Inheritance | ||
|- | |||
| 0x28 || KLinkedListNode || NodeFor__IncomingConnections | |||
|- | |- | ||
| | | 0x38 || [[#KSession*]] || Parent | ||
|- | |- | ||
| | | 0x40 || KLinkedListNode<[[#KSessionRequest]]*> || RequestList | ||
|- | |- | ||
| | | 0x50 || [[#KSessionRequest]]* || ActiveRequest | ||
|- | |- | ||
| 0x58 || [[#KMutex]] || lock | |||
|} | |} | ||
== | === KSessionRequest === | ||
Size: | Size: 0x158 | ||
Inherits from: [[#KAutoObject]] | Inherits from: [[#KAutoObject]] | ||
Line 1,064: | Line 1,208: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! Offset || Type || Description | ||
|- | |- | ||
| 0 || [[#KAutoObject]] || Inheritance | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| 0x10 || | | 0x10 || KLinkedListNode || NodeFor__RequestList | ||
|- | |- | ||
| | | 0x20 || [[#KBufferDescriptor]][8] || BufferTable | ||
|- | |- | ||
| | | 0x120 || [[#KBufferDescriptor]]* || ExternalBufferTable | ||
|- | |- | ||
| | | 0x128 || u8 || NumSendBuffers | ||
|- | |- | ||
| | | 0x129 || u8 || NumRecvBuffers | ||
|- | |||
| 0x12A || u8 || NumExchBuffers | |||
|- | |||
| 0x130 || [[#KThread]]* || SenderThread | |||
|- | |||
| 0x138 || u64 || InitiallyZero | |||
|- | |||
| 0x140 || [[#KWritableEvent]]* || ForAsyncEvent | |||
|- | |||
| 0x148 || u64 || CustomCmdbufAddr | |||
|- | |||
| 0x150 || u64 || CustomCmdbufSize | |||
|} | |} | ||
= | === KBufferDescriptor === | ||
Size: | Size: 0x20 | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! Offset || Type || Description | ||
|- | |- | ||
| 0 || | | 0 || u64 || UserVirtAddr | ||
|- | |- | ||
| | | 8 || u64 || Size | ||
|- | |- | ||
| | | 0x10 || u64 || | ||
|- | |||
| 0x18 || u64 || BufferMemoryState | |||
|- | |- | ||
|} | |} | ||
== | == KClientSession == | ||
Size: | Size: 0x38 | ||
Inherits from: [[#KAutoObject]] | Inherits from: [[#KAutoObject]] | ||
Line 1,114: | Line 1,265: | ||
| 0 || [[#KAutoObject]] || Inheritance | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| 0x10 || | | 0x10 || [[#KSession]]* || Parent | ||
|- | |||
| 0x18 || bool || HasInited | |||
|- | |||
| 0x20 || [[#KClientPort]]* || ParentPort | |||
|- | |- | ||
| | | 0x28 || || | ||
|- | |- | ||
| | | 0x30 || [[#KProcess]]* || CreatorProcess | ||
|} | |} | ||
= | = KLightSession = | ||
Size: | Size: 0xA8 | ||
Inherits from: [[#KAutoObject]] | Inherits from: [[#KAutoObject]] | ||
Line 1,134: | Line 1,289: | ||
| 0 || [[#KAutoObject]] || Inheritance | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| 0x10 || [[# | | 0x10 || [[#KLightSessionServer]] || ServerSide | ||
|- | |- | ||
| | | 0x68 || [[#KLightSessionClient]] || ClientSide | ||
|- | |- | ||
| | | 0xA0 || bool || HasInited | ||
|} | |} | ||
= | == KLightServerSession == | ||
Size: | Size: 0x58 | ||
Inherits from: [[#KAutoObject]] | Inherits from: [[#KAutoObject]] | ||
Line 1,158: | Line 1,309: | ||
| 0 || [[#KAutoObject]] || Inheritance | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| 0x10 || | | 0x10 || KLinkedListNode || NodeFor__IncomingLightConnections | ||
|- | |- | ||
| | | 0x20 || [[#KLightSession]] || Parent | ||
|- | |- | ||
| | | 0x28 || u64[6] || | ||
|} | |} | ||
== | == KLightClientSession == | ||
Size: 0x38 | Size: 0x38 | ||
Inherits from: [[# | Inherits from: [[#KAutoObject]] | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,178: | Line 1,327: | ||
! Description | ! Description | ||
|- | |- | ||
| 0 || [[# | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |||
| 0x10 || [[#KLightSession]]* || Parent | |||
|- | |- | ||
| | | 0x18 || bool || HasInited | ||
|- | |- | ||
| 0x30 || [[# | | 0x20 || [[#KClientPort]]* || Port | ||
|- | |||
| 0x28 || || | |||
|- | |||
| 0x30 || [[#KProcess]]* || CreatorProcess | |||
|} | |} | ||
= | = KEvent = | ||
Size: | Size: 0x70 | ||
Inherits from: [[#KAutoObject]] | Inherits from: [[#KAutoObject]] | ||
Line 1,198: | Line 1,353: | ||
| 0 || [[#KAutoObject]] || Inheritance | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| 0x10 || [[# | | 0x10 || [[#KReadableEvent]] || ReadableEvent | ||
|- | |||
| 0x48 || [[#KWritableEvent]] || WritableEvent | |||
|- | |||
| 0x60 || [[#KProcess]]* || Creator | |||
|- | |||
| 0x68 || bool || HasInited | |||
|} | |} | ||
== | == KReadableEvent == | ||
Size: 0x38 | |||
Inherits from: [[#KSynchronizationEvent]] | |||
Inherits from: [[# | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Offset | ||
! Type | |||
! Description | |||
|- | |- | ||
| 0 || [[# | | 0 || [[#KSynchronizationObject]] || Inheritance | ||
|- | |- | ||
| | | 0x28 || bool || | ||
|- | |- | ||
| | | 0x30 || [[#KEvent]]* || Parent | ||
|} | |} | ||
== KWritableEvent == | |||
Size: 0x18 | |||
Inherits from: [[#KAutoObject]] | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Offset | ||
! Type | |||
! Description | |||
|- | |- | ||
| 0 || [[# | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| | | 0x10 || [[#KEvent]]* || Parent | ||
|} | |} | ||
== | == KInterruptEvent == | ||
[1.0.0] Size: | [1.0.0] Size: 0x50 | ||
[2.0.0] Size: | |||
[2.0.0] Size: 0x48 | |||
Inherits from: [[#KReadableEvent]] | |||
<div style="display: inline-block;"> | <div style="display: inline-block;"> | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset || Type || Description | ! 1.0.0 Offset || Type || Description | ||
|- | |||
| 0 || [[#KReadableEvent]] || Inheritance | |||
|- | |- | ||
| | | 0x38 || [[#KInterruptReceiver]] || Receiver | ||
|- | |- | ||
| | | 0x48 || u32 || IrqId (or -1) | ||
|} | |} | ||
</div> | </div> | ||
Line 1,254: | Line 1,419: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset || Type || Description | ! 2.0.0 Offset || Type || Description | ||
|- | |- | ||
| 0 || | | 0 || [[#KReadableEvent]] || Inheritance | ||
|- | |- | ||
| | | 0x38 || [[#KInterruptReceiver]]* || Receiver | ||
|- | |- | ||
| | | 0x40 || u32 || IrqId (or -1) | ||
|- | |- | ||
| | | 0x44 || bool || IsIrqRegistered | ||
|} | |} | ||
</div> | </div> | ||
= | === KInterruptReceiver === | ||
Size: | [1.0.0] Size: 0x10 | ||
[2.0.0] Size: 0x20 | |||
<div style="display: inline-block;"> | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset | ! Offset || Type || Description | ||
|- | |- | ||
| 0 || | | 0 || * || Vtable | ||
|- | |- | ||
| | | 8 || u64 || | ||
|} | |||
</div> | |||
<div style="display: inline-block; vertical-align:top;"> | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Type || Description | ||
|- | |- | ||
| | | 0 || * || Vtable | ||
|- | |- | ||
| | | 8 || u64 || InitiallyZero | ||
|- | |- | ||
| 0x68 || bool || HasInited | | 0x10 || [[#KInterruptEvent]]* || IrqEventPtr | ||
|- | |||
| 0x18 || s32 || IrqId | |||
|} | |||
</div> | |||
= KDeviceAddressSpace = | |||
Size: 0x70 | |||
Inherits from: [[#KAutoObject]] | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Type | |||
! Description | |||
|- | |||
| 0 || [[#KAutoObject]] || Inheritance | |||
|- | |||
| 0x10 || [[#KMutex]] || Mutex | |||
|- | |||
| 0x18 || [[#KSmmuManager]] || Manager | |||
|- | |||
| 0x58 || u64 || BaseAddress | |||
|- | |||
| 0x60 || u64 || Size | |||
|- | |||
| 0x68 || bool || HasInited | |||
|} | |} | ||
Line 1,465: | Line 1,660: | ||
= KObjectAllocator = | = KObjectAllocator = | ||
Size: 0x50 | Size: 0x50 | ||
[5.0.0]? Size: 0x48 | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,494: | Line 1,690: | ||
|} | |} | ||
5.0.0 (?): | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Type || Description | |||
|- | |||
| 0 || void* || FreeListHead | |||
|- | |||
| 0x8 || u64 || SingleObjectSize | |||
|- | |||
| 0x10 || void* || HeapPtr | |||
|- | |||
| 0x18 || void* || Start (equal to HeapPtr on init) | |||
|- | |||
| 0x20 || void* || End | |||
|} | |||
= KPageTableAllocator = | = KPageTableAllocator = | ||
Line 1,542: | Line 1,753: | ||
! Offset || Type || Description | ! Offset || Type || Description | ||
|- | |- | ||
| 0 || [[# | | 0 || [[#KInterruptReceiver]]* || Receiver | ||
|- | |||
| 8 || u8 || State0 | |||
|- | |||
| 9 || u8 || State1 | |||
|} | |||
= KDebug = | |||
Size: 0x50 | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Type || Description | |||
|- | |||
| 0 || [[#KSynchronizationObject]] || Inheritance | |||
|- | |||
| 0x28 || [[#KLinkedListNode]]<[[#KDebugEvent]]> || EventList | |||
|- | |||
| 0x38 || u32 || Flags | |||
|- | |||
| 0x40 || [[#KProcess]]* || ProcessPtr | |||
|- | |||
| 0x48 || [[#KMutex]] || Mutex | |||
|} | |||
== KDebugEvent == | |||
Size: 0x60 | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Type || Description | |||
|- | |||
| 0 || [[#KLinkedListNode]]<[[#KDebugEvent]] *> || NodeFor__EventList | |||
|- | |||
| 0x10 || u32 || EventType | |||
|- | |||
| 0x14 || u32 || ThreadId | |||
|- | |||
| 0x18 || u32 || Flags | |||
|- | |||
| 0x1C || u16 || | |||
|- | |||
| 0x1E || bool || | |||
|- | |||
| 0x20 || ... || ... | |||
|} | |||
= KManagedPort = | |||
Size: 0x28 | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Type || Description | |||
|- | |||
| 0 || [[#KLinkedListNode]]<[[#KManagedPort]] *> || NodeFor__ManagedPortList | |||
|- | |||
| 0x10 || char[12] || PortName | |||
|- | |||
| 0x20 || [[#KClientPort]]* || ClientPort | |||
|} | |||
= Slab Information = | |||
The Horizon/NX kernel keeps all objects in slab allocators, that can allocate a fixed amount of each. Attempting to allocate an object when the slab heap is full will result in an error 0xCE01 (Resource Exhaustion). | |||
{| class="wikitable" border="1" | |||
|- | |||
! Object || Slab Count | |||
|- | |||
| KEvent || 600 | |||
|- | |||
| KInterruptEvent || 100 | |||
|- | |||
| KProcess || 80 | |||
|- | |||
| KThread || 700 | |||
|- | |- | ||
| | | KPort || 200 | ||
|- | |- | ||
| | | KSharedMemory || 80 | ||
|- | |- | ||
| KTransferMemory || 200 | |||
|- | |- | ||
| | | KDeviceAddressSpace || 300 | ||
|- | |- | ||
| | | KDebug || 4 | ||
|- | |- | ||
| | | KSession || 800 | ||
|- | |- | ||
| | | KLightSession || 100 | ||
|- | |- | ||
| | | KLinkedListEntry<void*> || 17 231 | ||
|- | |- | ||
| KLinkedListNode || 4 000 | |||
|- | |- | ||
| | | KMemoryBlock (System) || 20 000 | ||
|- | |- | ||
| | | KMemoryBlock (Other) || 10 000 | ||
|- | |- | ||
| | | KTlsPageManager || 167 | ||
|- | |- | ||
| | | KManagedPort || 7 | ||
|- | |- | ||
| | | KDebugEvent || 704 | ||
|- | |- | ||
| | | KSessionRequest || 1 600 | ||
|- | |- | ||
| | | KResourceLimit || 5 | ||
|} | |} |