Kernel: Difference between revisions
No edit summary |
m Hexkyz moved page Kernel objects to Kernel: Use this page for general kernel documentation |
||
(16 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
= KAutoObject = | = KAutoObject = | ||
Size: 0x10 | Size: 0x10 | ||
[5.0.0] Size: 0x20 | [5.0.0] Size: 0x20 | ||
[6.0.0] Size: 0x30 | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 13: | Line 16: | ||
[5.0.0]: | [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 23: | Line 36: | ||
| 8 || u32 || ReferenceCount | | 8 || u32 || ReferenceCount | ||
|- | |- | ||
| 0x10 || | | 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 130: | 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 || | | 0 || KRedBlackTreeNode* || Left Child | ||
|- | |- | ||
| | | 8 || KRedBlackTreeNode* || Right Child | ||
|- | |- | ||
| 0x48 || KSchedulerObject1 || 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 | | 0x58 || KSchedulerObject2 || Inheritance | ||
Line 195: | Line 243: | ||
| 0x5A8 || KLinkedListNode || NodeFor__ThreadsOnSameCore | | 0x5A8 || KLinkedListNode || NodeFor__ThreadsOnSameCore | ||
|- | |- | ||
| 0x5B8 || | | 0x5B8 || [[#KThread]]* || | ||
|- | |- | ||
| 0x5C0 || [[#KThread]]* || CondVar_SelfPtr | | 0x5C0 || [[#KThread]]* || CondVar_SelfPtr | ||
Line 554: | 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 578: | 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 1,005: | Line 1,068: | ||
= KPort = | = KPort = | ||
Size: 0xA8 | [1.0.0] Size: 0xA8 | ||
[7.0.0] Size: 0x110 | |||
Inherits from: [[#KAutoObject]] | 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 | ||
Line 1,027: | Line 1,094: | ||
| 0xA1 || bool || IsLight | | 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 | ||
|- | |- | ||
| 0 || [[# | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| 0x28 || [[#KLinkedListNode]] || IncomingConnections | | 0x30 || [[#KServerPort]] || ServerSide | ||
|- | |||
| 0xA0 || [[#KClientPort]] || ClientSide | |||
|- | |||
| 0xF8 || u64 || | |||
|- | |||
| 0x100 || char* || NamePtr | |||
|- | |||
| 0x108 || bool || HasInited | |||
|- | |||
| 0x109 || bool || IsLight | |||
|} | |||
</div> | |||
== KServerPort == | |||
Size: 0x50 | |||
Inherits from: [[#KSynchronizationObject]] | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Type | |||
! Description | |||
|- | |||
| 0 || [[#KSynchronizationObject]] || Inheritance | |||
|- | |||
| 0x28 || [[#KLinkedListNode]] || IncomingConnections | |||
|- | |- | ||
| 0x38 || [[#KLinkedListNode]] || IncomingLightConnections | | 0x38 || [[#KLinkedListNode]] || IncomingLightConnections | ||
Line 1,107: | Line 1,198: | ||
| 0x50 || [[#KSessionRequest]]* || ActiveRequest | | 0x50 || [[#KSessionRequest]]* || ActiveRequest | ||
|- | |- | ||
| 0x58 || || | | 0x58 || [[#KMutex]] || lock | ||
|} | |} | ||
=== KSessionRequest === | === KSessionRequest === | ||
Size: 0x158 | Size: 0x158 | ||
Inherits from: [[#KAutoObject]] | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,117: | Line 1,210: | ||
! Offset || Type || Description | ! Offset || Type || Description | ||
|- | |- | ||
| 0 || | | 0 || [[#KAutoObject]] || Inheritance | ||
|- | |- | ||
| 0x10 || KLinkedListNode || NodeFor__RequestList | | 0x10 || KLinkedListNode || NodeFor__RequestList | ||
Line 1,660: | Line 1,753: | ||
! Offset || Type || Description | ! Offset || Type || Description | ||
|- | |- | ||
| 0 || [[# | | 0 || [[#KInterruptReceiver]]* || Receiver | ||
|- | |- | ||
| 8 || u8 || State0 | | 8 || u8 || State0 | ||
Line 1,705: | Line 1,798: | ||
|- | |- | ||
| 0x20 || ... || ... | | 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 | |||
|} | |} |