KSynchronizationObject and subclasses.
Kernel Auto Objects
Kernel Auto Objects
KAddressArbiter
class KAddressArbiter extends KAutoObject;
Size : 0x14 bytes
Offset | Type | Description |
---|---|---|
0x0 | u32 | Pointer to vtable |
0x4 | u32 | Reference count |
0x8 | KThread* | Last |
0xC | KThread* | First |
0x10 | KProcess* | Process |
KAutoObject
KAutoObject represents a reference counted object that destroys itself when there are no more references to it.
Size : 0x8 bytes
Offset | Type | Description |
---|---|---|
0x0 | u32 | Pointer to vtable |
0x4 | u32 | Reference count |
Class Definition #
class KAutoObject {
public:
u32 m_referenceCount; // 0x4
protected:
virtual ~KAutoObject() { }
};
KCodeSet
class KCodeSet extends KAutoObject;
Size : 0x64 bytes
Offset | Type | Description |
---|---|---|
0x0 | u32 | Pointer to vtable |
0x4 | u32 | Reference count |
0x8 | KCodeSetMemDescriptor | Memory section info for .text |
0x1C | KCodeSetMemDescriptor | Memory section info for .rodata |
0x30 | KCodeSetMemDescriptor | Memory section info for .data |
0x44 | u32 | Total .text pages |
0x48 | u32 | Total .rodata pages |
0x4C | u32 | Total RW pages (.bss + .data) |
0x50 | u64 | Process name as 8-byte string |
0x58 | u16 | ? |
0x5A | u16 | ? |
0x5C | u64 | TitleID |
KCodeSetMemDescriptor #
Sections too large to fit into any available memory blocks will be split across multiple memory blocks with a KBlockInfo instance for each. This is described by the memory section info struct:
KPort
class KPort extends KAutoObject;
Size : 0x48 bytes
Offset | Type | Description |
---|---|---|
0x0 | u32 | Pointer to vtable |
0x4 | u32 | Reference count |
0x8 | u32 | Pointer to KServerPort vtable |
0xC | u32 | KServerPort Reference count |
0x10 | u32 | Node count for threads |
0x14 | KLinkedListNode* | Pointer to first KLinkedListNode in the list of threads that sync with this object |
0x18 | KLinkedListNode* | Pointer to last KLinkedListNode in the list of threads that sync with this object |
0x1C | u32 | Node count for sessions |
0x20 | KLinkedListNode* | Pointer to first KLinkedListNode in the list of KServerSessions associated with this port |
0x24 | KLinkedListNode* | Pointer to last KLinkedListNode in the list of KServerSessions associated with this port |
0x28 | KPort* | Pointer to parent KPort |
0x2C | u32 | Pointer to KClientPort vtable |
0x30 | u32 | KClientPort Reference count |
0x34 | u32 | Node count for threads |
0x38 | KLinkedListNode* | Pointer to first KLinkedListNode in the list of threads that sync with this object |
0x3C | KLinkedListNode* | Pointer to last KLinkedListNode in the list of threads that sync with this object |
0x40 | s16 | Current connection count to port |
0x42 | s16 | Max connection count to port |
0x44 | KPort* | Pointer to the parent port object; |
KResourceLimit
class KResourceLimit extends KAutoObject;
Size : 0x74 bytes
Offset | Type | Description |
---|---|---|
0x0 | u32 | Pointer to vtable |
0x4 | u32 | Reference count |
0x8 | s32 | Max Priority |
0xC | s32 | Max commit |
0x10 | s32 | Max thread |
0x14 | s32 | Max event |
0x18 | s32 | Max mutex |
0x1C | s32 | Max semaphore |
0x20 | s32 | Max timer |
0x24 | s32 | Max shared memory |
0x28 | s32 | Max address arbiter |
0x2C | s32 | Max CPU time |
0x30 | s32 | Current Priority |
0x34 | s32 | Current commit |
0x38 | s32 | Current thread |
0x3C | s32 | Current event |
0x40 | s32 | Current mutex |
0x44 | s32 | Current semaphore |
0x48 | s32 | Current timer |
0x4C | s32 | Current shared memory |
0x50 | s32 | Current address arbiter |
0x54 | s32 | Current CPU time |
0x58 | KObjectMutex | Mutex |
0x60 | KPreemptionTimer | Preemption timer for the current core, see below |
There are 4 KResourceLimit objects created on the kernel heap. Each is used for a different category specified by the exheader’s resource limit category specifier in the exheader ARM11 Local System Capabilities.
KSession
class KSession extends KAutoObject;
Size : 0x4C bytes
Offset | Type | Description |
---|---|---|
0x0 | u32 | Pointer to vtable |
0x4 | u32 | Reference count |
0x20 | KThread* | X ? |
0x24 | KThread* | Y ? |
0x2C | KThread* | Z ? |
It seems X=Y=Z. X, Y and Z can be NULL.
Structure for at least 5.0.0-11 NATIVE_FIRM upward:
Size : 0x4C bytes ( KAutoObject, KServerSession, KClientSession, sequentially):
Offset | Type | |
---|---|---|
0x0 | KAutoObject | u32 |
0x4 | u32 | |
0x8 | KServerSession | u32 |
0xC | u32 | |
0x10 | u32 | |
0x14 | KLinkedListNode* | |
0x18 | KLinkedListNode* | |
0x1C | KSession* | |
0x20 | KThread* | |
0x24 | KThread* | |
0x28 | KThread* | |
0x2C | KClientSession | u32 |
0x30 | u32 | |
0x34 | u32 | |
0x38 | KLinkedListNode* | |
0x3C | KLinkedListNode* | |
0x40 | KSession* | |
0x44 | u32 | |
0x48 | KClientPort* |
Session status:
KSharedMemory
class KSharedMemory extends KAutoObject and KLinkedList;
Size : 0x28 bytes
Offset | Type | Description |
---|---|---|
0x0 | u32 | Pointer to vtable |
0x4 | u32 | Reference count |
0x8 | u32 | Node count for KBlockInfo objects |
0xC | KLinkedListNode* | Pointer to first KLinkedListNode in the list of KBlockInfo objects associated with this KSharedMemory object |
0x10 | KLinkedListNode* | Pointer to last KLinkedListNode in the list of KBlockInfo objects associated with this KSharedMemory object |
0x14 | KProcess* | Owner |
0x18 | u32 | Owner permissions |
0x1C | u32 | Other processes’ permissions for this block |
0x20 | u8 | Set after KBlockInfo is generated for the KSharedMemory |
0x21 | s8 | Set after all KBlockInfo is generated |
0x22 | u8 | Unknown |
0x24 | u32 | Address |