Difference between revisions of "Kernel"

From Nintendo Switch Brew
Jump to navigation Jump to search
(KRedBlackTree/KRedBlackTreeNode (note: these are just BSD tree.h types).)
(35 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"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 9: Line 23:
 
|-
 
|-
 
| 8 || u32 || ReferenceCount
 
| 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"
 +
|-
 +
! Offset || Type || Description
 +
|-
 +
| 0 || * || Vtable
 +
|-
 +
| 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 22: Line 54:
 
| 0 || [[#KAutoObject]] || Inheritance
 
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 0x10 || u64 || ThreadSyncNum
+
| 0x10 || [[#KLinkedList]] || ThreadSyncList
|-
 
| 0x18 || [[#KLinkedListNode]] || ThreadSyncList
 
 
|}
 
|}
  
Line 52: Line 82:
 
= KLockedList =
 
= KLockedList =
 
Size: 0x28
 
Size: 0x28
 +
 +
[5.0.0]? Size: 0x20
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 64: Line 96:
 
|-
 
|-
 
| 0x20 || u64 || MaxCount
 
| 0x20 || u64 || MaxCount
 +
|}
 +
 +
[5.0.0]?:
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Type || Description
 +
|-
 +
| 0 || [[#KLinkedListNode]] || List
 +
|-
 +
| 0x10 || [[#KMutex]] || Mutex
 +
|-
 +
| 0x18 || u64 || MaxCount
 
|}
 
|}
  
Line 78: Line 123:
 
|}
 
|}
  
= KListEntry =
+
= KLinkedListEntry =
Size: 0x18
+
Size: 0x10 + <code>sizeof(T)</code>
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 87: Line 132:
 
| 0 || [[#KLinkedListNode]] || NodeFor__List
 
| 0 || [[#KLinkedListNode]] || NodeFor__List
 
|-
 
|-
| 0x10 || T* || Ptr
+
| 0x10 || T || Data
 
|}
 
|}
  
= KThread =
+
= KLinkedList =
[1.0.0] Size: 0x620
+
Size: 0x18
  
Inherits from: [[#KSynchronizationObject]], [[#KSchedulerObject0]], [[#KSchedulerObject1]], [[#KSchedulerObject2]]
 
 
<div style="display: inline-block">
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! 1.0.0 Offset || Type || Description
+
! Offset || Type || Description
 
|-
 
|-
| 0 || [[#KSynchronizationObject]] || Inheritance
+
| 0 || u64 || Count
 
|-
 
|-
| 0x28 || KSchedulerObject0 || Inheritance
+
| 8 || [[#KLinkedListNode]] || Bounds (first, last)
 +
|}
 +
 
 +
= KRedBlackTreeNode =
 +
Size: 0x20
 +
 
 +
Note: This is BSD sys/tree.h's RB_ENTRY(...).
 +
 
 +
{| class="wikitable" border="1"
 
|-
 
|-
| 0x48 || KSchedulerObject1 || Inheritance
+
! Offset || Type || Description
 
|-
 
|-
| 0x58 || KSchedulerObject2 || Inheritance
+
| 0 || KRedBlackTreeNode* || Left Child
 
|-
 
|-
| 0x70 || KThreadContext || Context
+
| 8 || KRedBlackTreeNode* || Right Child
 
|-
 
|-
| 0x2F0 || u64 || CoreMask
+
| 0x10 || KRedBlackTreeNode* || Parent
 
|-
 
|-
| 0x2F8 || u64 || CoreMaskOverride
+
| 0x18 || int || Color
 +
|}
 +
 
 +
= KRedBlackTree =
 +
Size: 0x8
 +
 
 +
Note: This is BSD sys/tree.h's RB_HEAD(..., KRedBlackTreeNode);
 +
 
 +
{| class="wikitable" border="1"
 
|-
 
|-
| 0x300 || u64 || ThreadId
+
! Offset || Type || Description
 
|-
 
|-
| 0x308 || u64 ||
+
| 0 || KRedBlackTreeNode* || Root
 
|-
 
|-
| 0x310 || [[#KSynchronizationObject]]* || SignalledObjectPtr
+
|}
 +
 
 +
= 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"
 
|-
 
|-
| 0x318 || u64 ||
+
! 1.0.0 Offset || Type || Description
 
|-
 
|-
| 0x320 || u64 ||
+
| 0 || [[#KSynchronizationObject]] || Inheritance
 +
|-
 +
| 0x28 || KSchedulerObject0 || Inheritance
 +
|-
 +
| 0x48 || KSchedulerObject1 || Inheritance
 +
|-
 +
| 0x58 || KSchedulerObject2 || Inheritance
 +
|-
 +
| 0x70 || KThreadContext || Context
 +
|-
 +
| 0x2F0 || u64 || CoreMask
 +
|-
 +
| 0x2F8 || u64 || CoreMaskOverride
 +
|-
 +
| 0x300 || u64 || ThreadId
 +
|-
 +
| 0x308 || u64 || TotalTimeRunning
 +
|-
 +
| 0x310 || [[#KSynchronizationObject]]* || SignalledObjectPtr
 +
|-
 +
| 0x318 || u64 ||
 +
|-
 +
| 0x320 || u64 || CondVar_CondVarUserAddr
 
|-
 
|-
 
| 0x328 || u64 || Entrypoint
 
| 0x328 || u64 || Entrypoint
 
|-
 
|-
| 0x330 || u64 ||
+
| 0x330 || u64 || CondVar_MutexUserAddr
 
|-
 
|-
| 0x338 || [[#KProcess*]] || ProcessPtr
+
| 0x338 || [[#KProcess]]* || ProcessPtr
 
|-
 
|-
 
| 0x340 || void* || KernelThreadStack
 
| 0x340 || void* || KernelThreadStack
Line 140: Line 229:
 
| 0x360 || [[#KSynchronizationObject]]*[0x40] || SyncObjects
 
| 0x360 || [[#KSynchronizationObject]]*[0x40] || SyncObjects
 
|-
 
|-
| 0x560 || u64 ||
+
| 0x560 || [[#KThread]]* || CondVar_NextThreadPtr
 
|-
 
|-
| 0x568 || u64 ||
+
| 0x568 || [[#KThread]]* || CondVar_PrevThreadPtr
 
|-
 
|-
| 0x570 || [[#KSynchronizationObject]] || SignalledObjectPtr?
+
| 0x570 || [[#KSynchronizationObject]]* || SignalledObjectPtr?
 
|-
 
|-
 
| 0x578 || KLinkedListNode ||
 
| 0x578 || KLinkedListNode ||
Line 154: Line 243:
 
| 0x5A8 || KLinkedListNode || NodeFor__ThreadsOnSameCore
 
| 0x5A8 || KLinkedListNode || NodeFor__ThreadsOnSameCore
 
|-
 
|-
| 0x5B8 || u64 ||
+
| 0x5B8 || [[#KThread]]* ||
 
|-
 
|-
| 0x5C0 || u64 ||
+
| 0x5C0 || [[#KThread]]* || CondVar_SelfPtr
 
|-
 
|-
 
| 0x5C8 || u64 ||
 
| 0x5C8 || u64 ||
Line 164: Line 253:
 
| 0x5D8 || u64 ||
 
| 0x5D8 || u64 ||
 
|-
 
|-
| 0x5E0 || u32 ||
+
| 0x5E0 || u32 || CondVar_WaitThreadHandle
 
|-
 
|-
 
| 0x5E4 || u32 || SchedulingFlags_Default
 
| 0x5E4 || u32 || SchedulingFlags_Default
Line 186: Line 275:
 
| 0x608 || u8 || State
 
| 0x608 || u8 || State
 
|-
 
|-
| 0x609 || u8 || IsRunning
+
| 0x609 || u8 || ShallBeTerminated
 
|-
 
|-
 
| 0x60A || u8 ||
 
| 0x60A || u8 ||
Line 209: Line 298:
  
 
[3.0.0] Size: 0x2580
 
[3.0.0] Size: 0x2580
 +
 +
[5.0.0] Size: 0x4600
  
 
Inherits from: [[#KSynchronizationObject]]
 
Inherits from: [[#KSynchronizationObject]]
Line 219: Line 310:
 
| 0 || [[#KSynchronizationObject]] || Inheritance
 
| 0 || [[#KSynchronizationObject]] || Inheritance
 
|-
 
|-
| 0x28 || KProcessScheduler || Scheduler
+
| 0x28 || KProcessTerminationMessage || Sent to mailbox 0 when self-terminating.
 
|-
 
|-
 
| 0x38 || [[#KMemoryManager]] || MemoryManager
 
| 0x38 || [[#KMemoryManager]] || MemoryManager
Line 225: Line 316:
 
| 0xF0 || u64 || TotalMemUsage
 
| 0xF0 || u64 || TotalMemUsage
 
|-
 
|-
| 0xF8 || u64 || TlsPagesListCount
+
| 0xF8 || [[#KLinkedList]]<[[#KTlsPageManager]]*>> || TlsPagesList
|-
 
| 0x100 || [[#KLinkedList]]<[[#KListEntry]]<[[#TlsPageManager]]>> || TlsPagesList
 
 
|-
 
|-
 
| 0x110 || s32 || DefaultCpuCore
 
| 0x110 || s32 || DefaultCpuCore
Line 241: Line 330:
 
| 0x138 || [[#KMutex]] || ThreadingMutex
 
| 0x138 || [[#KMutex]] || ThreadingMutex
 
|-
 
|-
| 0x140 || [[#KLinkedListNode]]<[[#KThread]]> || ThreadArbiterList
+
| 0x140 || [[#KLinkedListNode]]<[[#KThread]] *> || ThreadArbiterList
 
|-
 
|-
 
| 0x150 || KLinkedListNode ||
 
| 0x150 || KLinkedListNode ||
Line 277: Line 366:
 
| 0x278 || u64 || MaxTotalMemUsage
 
| 0x278 || u64 || MaxTotalMemUsage
 
|-
 
|-
| 0x280 || u32 || From_CreateProcessInfo_0xC
+
| 0x280 || u32 || ProcessCategory (0: regular title, 1: kernel built-in)
 
|-
 
|-
 
| 0x288 || [[#KProcessHandleTable]] || HandleTable
 
| 0x288 || [[#KProcessHandleTable]] || HandleTable
Line 283: Line 372:
 
| 0x528 || void* || UsermodeExceptionTlsArea
 
| 0x528 || void* || UsermodeExceptionTlsArea
 
|-
 
|-
| 0x530 || [[#KLinkedListNode]]<[[#KThread]]> || ExceptionThreadList
+
| 0x530 || [[#KLinkedListNode]]<[[#KThread]] *> || ExceptionThreadList
 
|-
 
|-
 
| 0x540 || [[#KThread]]* || ExceptionThread
 
| 0x540 || [[#KThread]]* || ExceptionThread
 
|-
 
|-
| 0x548 || [[#KLinkedListNode]]<[[#KThread]]> || ThreadList
+
| 0x548 || [[#KLinkedListNode]]<[[#KThread]] *> || ThreadList
 
|-
 
|-
 
| 0x558 || bool || HasStarted
 
| 0x558 || bool || HasStarted
Line 293: Line 382:
 
| 0x55C || u32 || UnusedZero
 
| 0x55C || u32 || UnusedZero
 
|-
 
|-
| 0x560 || u64[8] || UnusedZeroes
+
| 0x560 || u64[2] || UnusedZeroes
 +
|-
 +
| 0x570 || u64 || TotalTimeRunning
 +
|-
 +
| 0x578 || u64[5] || UnusedZeroes
 
|-
 
|-
 
| 0x5A0 || u64 || UnusedZero
 
| 0x5A0 || u64 || UnusedZero
Line 308: Line 401:
 
| 0 || [[#KSynchronizationObject]] || Inheritance
 
| 0 || [[#KSynchronizationObject]] || Inheritance
 
|-
 
|-
| 0x28 || KProcessScheduler || Scheduler
+
| 0x28 || KProcessTerminationMessage || Sent to mailbox 0 when self-terminating.
 
|-
 
|-
 
| 0x38 || [[#KMemoryManager]] || MemoryManager
 
| 0x38 || [[#KMemoryManager]] || MemoryManager
Line 314: Line 407:
 
| 0x100 || u64 || TotalMemUsage
 
| 0x100 || u64 || TotalMemUsage
 
|-
 
|-
| 0x108 || u64 || TlsPagesListCount
+
| 0x108 || [[#KLinkedList]]<[[#KTlsPageManager]]*> || TlsPagesList
|-
 
| 0x100 || [[#KLinkedList]]<[[#KListEntry]]<[[#TlsPageManager]]>> || TlsPagesList
 
 
|-
 
|-
 
| 0x120 || s32 || DefaultCpuCore
 
| 0x120 || s32 || DefaultCpuCore
Line 330: Line 421:
 
| 0x148 || [[#KMutex]] || ThreadingMutex
 
| 0x148 || [[#KMutex]] || ThreadingMutex
 
|-
 
|-
| 0x150 || [[#KLinkedListNode]]<[[#KThread]]> || ThreadArbiterList
+
| 0x150 || [[#KLinkedListNode]]<[[#KThread]] *> || ThreadArbiterList
 
|-
 
|-
 
| 0x160 || KLinkedListNode ||
 
| 0x160 || KLinkedListNode ||
Line 366: Line 457:
 
| 0x288 || u64 || MaxTotalMemUsage
 
| 0x288 || u64 || MaxTotalMemUsage
 
|-
 
|-
| 0x290 || u32 || From_CreateProcessInfo_0xC
+
| 0x290 || u32 || ProcessCategory (0: regular title, 1: kernel built-in)
 
|-
 
|-
 
| 0x298 || u64[5] || Unused [?]
 
| 0x298 || u64[5] || Unused [?]
Line 374: Line 465:
 
| 0x2380 || void* || UsermodeExceptionTlsArea
 
| 0x2380 || void* || UsermodeExceptionTlsArea
 
|-
 
|-
| 0x2388 || [[#KLinkedListNode]]<[[#KThread]]> || ExceptionThreadList
+
| 0x2388 || [[#KLinkedListNode]]<[[#KThread]] *> || ExceptionThreadList
 
|-
 
|-
 
| 0x2398 || [[#KThread]]* || ExceptionThread
 
| 0x2398 || [[#KThread]]* || ExceptionThread
 
|-
 
|-
| 0x23A0 || [[#KLinkedListNode]]<[[#KThread]]> || ThreadList
+
| 0x23A0 || [[#KLinkedListNode]]<[[#KThread]] *> || ThreadList
 
|-
 
|-
| 0x23B0 || [[#KLinkedListNode]]<[[#KSharedMemoryRef]]> || MappedSharedMemoriesList
+
| 0x23B0 || [[#KLinkedListNode]]<[[#KSharedMemoryRef]] *> || MappedSharedMemoriesList
 
|-
 
|-
 
| 0x23C0 || bool || HasStarted
 
| 0x23C0 || bool || HasStarted
Line 412: Line 503:
 
</div>
 
</div>
  
== KProcessCapabilities ==
+
== KTlsPageManager ==
Size: 0xB0
+
Size: 0x20
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Type
 +
! Description
 +
|-
 +
| 0 || void* || TlsPagePtr
 +
|-
 +
| 8 || [[#KProcess*]] || ProcessPtr
 +
|-
 +
| 0x10 || u32 || UsageCount
 +
|-
 +
| 0x14 || u8[8] || IsSlotFree
 +
|}
 +
 
 +
== KProcessCapabilities ==
 +
Size: 0xB0
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 493: Line 602:
  
 
[2.0.0] Size: 8
 
[2.0.0] Size: 8
 +
 +
[6.0.0]? Size: 0x10
  
 
<div style="display: inline-block">
 
<div style="display: inline-block">
Line 520: Line 631:
 
</div>
 
</div>
  
=== KSpinLock ===
+
<div style="display: inline-block; vertical-align:top;">
[1.0.0] Size: 0x1
 
 
 
[2.0.0] Size: 0x40
 
 
 
<div style="display: inline-block">
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! 1.0.0 Offset || Type || Description
+
! 6.0.0 Offset || Type || Description
 +
|-
 +
| 0 || u16 || HandleId
 
|-
 
|-
| 0 || u8 || IsBusy
+
| 2 || u8 || ObjectType
|}
+
|-
 +
| 4 || u32 || ObjectCompressedPtr
 +
|-
 +
| 8 || ptr || ?
 +
|}
 +
</div>
 +
 
 +
=== KSpinLock ===
 +
[1.0.0] Size: 0x1
 +
 
 +
[2.0.0] Size: 0x40
 +
 
 +
<div style="display: inline-block">
 +
{| class="wikitable" border="1"
 +
|-
 +
! 1.0.0 Offset || Type || Description
 +
|-
 +
| 0 || u8 || IsBusy
 +
|}
 
</div>
 
</div>
  
Line 552: Line 678:
 
! Offset || Type || Description
 
! Offset || Type || Description
 
|-
 
|-
| 0 || [[#KLinkedListNode]]<[[#KSharedMemoryRef]]> || NodeFor__MappedSharedMemoriesList
+
| 0 || [[#KLinkedListNode]]<[[#KSharedMemoryRef]] *> || NodeFor__MappedSharedMemoriesList
 
|-
 
|-
 
| 0x10 || [[#KSharedMemory*]] || SharedMem
 
| 0x10 || [[#KSharedMemory*]] || SharedMem
Line 563: Line 689:
  
 
[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 686: Line 814:
 
</div>
 
</div>
  
== KPageTable ==
+
<div style="display: inline-block; vertical-align:top;">
Size: 0x10
 
 
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset
+
! 5.0.0 Offset
 
! Type
 
! Type
 
! Description
 
! Description
 
|-
 
|-
| 0 || void* || RawPageTablePtr
+
| 0 || * || Vtable
 
|-
 
|-
| 8 || bool ||
+
| 8 || u64 || AddrSpaceMinAddr
 
|-
 
|-
| 0xC || u32 || AddrSpaceSizeInGb
+
| 0x10 || u64 || AddrSpaceMaxAddr
|}
 
 
 
== KMemoryBlockManager ==
 
Size: 0x18
 
 
 
{| class="wikitable" border="1"
 
 
|-
 
|-
! Offset
+
| 0x18 || u64 || HeapRegionBaseAddr
! Type
 
! Description
 
 
|-
 
|-
| 0 || [[#KMemoryBlock]]* || MemoryBlockList
+
| 0x20 || u64 || HeapRegionEndAddr
 
|-
 
|-
| 8 || u64 || MaxAddr
+
| 0x28 || u64 || HeapCurAddr
 
|-
 
|-
| 0x10 || u64 || MinAddr
+
| 0x30 || u64 || MapRegionBaseAddr
|}
 
 
 
== KMemoryBlock ==
 
Size: 0x40
 
 
 
{| class="wikitable" border="1"
 
 
|-
 
|-
! Offset
+
| 0x38 || u64 || MapRegionEndAddr
! Type
+
|-
! Description
+
| 0x40 || u64 || NewMapRegionBaseAddr
 +
|-
 +
| 0x48 || u64 || NewMapRegionEndAddr
 +
|-
 +
| 0x50 || u64 || TlsIoRegionBaseAddr
 +
|-
 +
| 0x58 || u64 || TlsIoRegionEndAddr
 +
|-
 +
| 0x60 || u64 || HeapMaxAllocation
 +
|-
 +
| 0x68 ||  ||
 +
|-
 +
| 0x70 ||  ||
 +
|-
 +
| 0x78 || [[#KMutex]] || Mutex
 
|-
 
|-
| 0 || [[#KLinkedListNode]]<[[#KMemoryBlock]]> || NodeFor__MemoryBlockList
+
| 0x80 || [[#KPageTable]] || PageTable
 
|-
 
|-
| 0x10 || ||
+
| 0x90 || [[#KMemoryBlockManager]] || MemoryBlockManager
 
|-
 
|-
| 0x18 || ||
+
| 0xA8 || u32 || ?
 
|-
 
|-
| 0x20 || u64 || BaseAddress
+
| 0xAC || u32 || AddressSpaceWidth (32/36/39)
 
|-
 
|-
| 0x28 || u64 || NumOfPages
+
| 0xB0 || [[#KLinkedList]]? ||  
 
|-
 
|-
| 0x30 || u32 || State
+
| 0xC8 || ||  
 
|-
 
|-
| 0x34 || u16 || IpcRefCount [?]
+
| 0xD0 || ||  
 
|-
 
|-
| 0x36 || u16 || DeviceMapRefCount
+
| 0xD8 || ptr ||  
 
|-
 
|-
| 0x38 || u8 || Permission
+
| 0xE0 || u64 || TranslationTableBaseRegister0 val
 
|-
 
|-
| 0x39 || u8 || UnkAttribute
+
| 0xE8 || u64 || TranslationControlRegister val
 
|-
 
|-
| 0x3A || u8 || Attribute
+
| 0xF0 || u32 || AsidTagValue
 
|}
 
|}
 +
</div>
  
== KMemoryBlockInfo ==
+
== KPageTable ==
Size: 0x20
+
Size: 0x10
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 759: Line 886:
 
! Description
 
! Description
 
|-
 
|-
| 0 || u64 || BaseAddress
+
| 0 || void* || RawPageTablePtr
 
|-
 
|-
| 8 || u64 || Size
+
| 8 || bool ||
 
|-
 
|-
| 0x10 || u32 || State
+
| 0xC || u32 || AddrSpaceSizeInGb
|-
 
| 0x14 || u8 || Permission
 
|-
 
| 0x15 || u8 || Attribute
 
|-
 
| 0x16 || u8 || UnkAttribute
 
|-
 
| 0x18 || u16 || IpcRefCount [?]
 
|-
 
| 0x1A || u16 || DeviceMapRefCount
 
 
|}
 
|}
  
= KTransferMemory =
+
== KMemoryBlockManager ==
Size: 0x48
+
Size: 0x18
 
 
Inherits from: [[#KAutoObject]]
 
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 787: Line 902:
 
! Description
 
! Description
 
|-
 
|-
| 0 || [[#KAutoObject]] || Inheritance
+
| 0 || [[#KMemoryBlock]]* || MemoryBlockList
 +
|-
 +
| 8 || u64 || MaxAddr
 
|-
 
|-
| 0x10 || KMemoryBlockList || Blocks
+
| 0x10 || u64 || MinAddr
 +
|}
 +
 
 +
== KMemoryBlock ==
 +
Size: 0x40
 +
 
 +
{| class="wikitable" border="1"
 
|-
 
|-
| 0x28 || [[#KProcess]]* || OwnerProcess
+
! Offset
 +
! Type
 +
! Description
 
|-
 
|-
| 0x30 || u64 || BaseAddress
+
| 0 || [[#KLinkedListNode]]<[[#KMemoryBlock]] *> || NodeFor__MemoryBlockList
 
|-
 
|-
| 0x38 || KMutex || Mutex
+
| 0x10 || ||
 
|-
 
|-
| 0x40 || int || Permission
+
| 0x18 || ||
 
|-
 
|-
| 0x44 || bool || HasInited
+
| 0x20 || u64 || BaseAddress
 
|-
 
|-
| 0x45 || bool || IsMapped
+
| 0x28 || u64 || NumOfPages
|}
 
 
 
= KSharedMemory =
 
[1.0.0] Size: 0x40
 
 
 
[2.0.0] Size: 0x48
 
 
 
Inherits from: [[#KAutoObject]]
 
 
 
<div style="display: inline-block;">
 
{| class="wikitable" border="1"
 
 
|-
 
|-
! 1.0.0 Offset || Type || Description
+
| 0x30 || u32 || State
 
|-
 
|-
| 0 || [[#KAutoObject]] || Inheritance
+
| 0x34 || u16 || IpcRefCount [?]
 
|-
 
|-
| 0x10 || KMemoryBlockList || Blocks
+
| 0x36 || u16 || DeviceMapRefCount
 
|-
 
|-
| 0x28 || [[#KProcess]]* || OwnerProcess
+
| 0x38 || u8 || Permission
 
|-
 
|-
| 0x30 || int || LocalPermission
+
| 0x39 || u8 || UnkAttribute
 
|-
 
|-
| 0x34 || int || RemotePermission
+
| 0x3A || u8 || Attribute
|-
 
| 0x38 || bool || HasInited
 
 
|}
 
|}
</div>
 
  
<div style="display: inline-block; vertical-align:top;">
+
== KMemoryBlockInfo ==
 +
Size: 0x20
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! 2.0.0 Offset || Type || Description
+
! Offset
 +
! Type
 +
! Description
 +
|-
 +
| 0 || u64 || BaseAddress
 
|-
 
|-
| 0 || [[#KAutoObject]] || Inheritance
+
| 8 || u64 || Size
 
|-
 
|-
| 0x10 || KMemoryBlockList || Blocks
+
| 0x10 || u32 || State
 
|-
 
|-
| 0x28 || [[#KResourceLimit]]* || OwnerResourceLimit
+
| 0x14 || u8 || Permission
 
|-
 
|-
| 0x30 || u64 || OwnerProcessPid
+
| 0x15 || u8 || Attribute
 
|-
 
|-
| 0x38 || int || LocalPermission
+
| 0x16 || u8 || UnkAttribute
 
|-
 
|-
| 0x3C || int || RemotePermission
+
| 0x18 || u16 || IpcRefCount [?]
 
|-
 
|-
| 0x40 || bool || HasInited
+
| 0x1A || u16 || DeviceMapRefCount
 
|}
 
|}
  
</div>
+
= KTransferMemory =
 
+
Size: 0x48
= KPort =
 
Size: 0xA8
 
  
 
Inherits from: [[#KAutoObject]]
 
Inherits from: [[#KAutoObject]]
Line 865: Line 980:
 
| 0 || [[#KAutoObject]] || Inheritance
 
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 0x10 || [[#KServerPort]] || ServerSide
+
| 0x10 || KMemoryBlockList || Blocks
 +
|-
 +
| 0x28 || [[#KProcess]]* || OwnerProcess
 +
|-
 +
| 0x30 || u64 || BaseAddress
 
|-
 
|-
| 0x60 || [[#KClientPort]] || ClientSide
+
| 0x38 || KMutex || Mutex
 
|-
 
|-
| 0x98 || u64 ||
+
| 0x40 || int || Permission
 
|-
 
|-
| 0xA0 || bool || HasInited
+
| 0x44 || bool || HasInited
 
|-
 
|-
| 0xA1 || bool || IsLight
+
| 0x45 || bool || IsMapped
 
|}
 
|}
  
== KServerPort ==
+
= KSharedMemory =
Size: 0x50
+
[1.0.0] Size: 0x40
 +
 
 +
[2.0.0] Size: 0x48
  
Inherits from: [[#KSynchronizationObject]]
+
Inherits from: [[#KAutoObject]]
  
 +
<div style="display: inline-block;">
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset
+
! 1.0.0 Offset || Type || Description
! Type
 
! Description
 
 
|-
 
|-
| 0 || [[#KSynchronizationObject]] || Inheritance
+
| 0 || [[#KAutoObject]] || Inheritance
 +
|-
 +
| 0x10 || KMemoryBlockList || Blocks
 +
|-
 +
| 0x28 || [[#KProcess]]* || OwnerProcess
 
|-
 
|-
| 0x28 || [[#KLinkedListNode]] || IncomingConnections
+
| 0x30 || int || LocalPermission
 
|-
 
|-
| 0x38 || [[#KLinkedListNode]] || IncomingLightConnections
+
| 0x34 || int || RemotePermission
 
|-
 
|-
| 0x48 || [[#KPort]]* || Parent
+
| 0x38 || bool || HasInited
 
|}
 
|}
 +
</div>
  
== KClientPort ==
+
<div style="display: inline-block; vertical-align:top;">
Size: 0x38
 
 
 
Inherits from: [[#KSynchronizationObject]]
 
 
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset
+
! 2.0.0 Offset || Type || Description
! Type
 
! Description
 
 
|-
 
|-
| 0 || [[#KSynchronizationObject]] || Inheritance
+
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 0x28 || u32 || NumSessions
+
| 0x10 || KMemoryBlockList || Blocks
 
|-
 
|-
| 0x2C || u32 || MaxSessions
+
| 0x28 || [[#KResourceLimit]]* || OwnerResourceLimit
 +
|-
 +
| 0x30 || u64 || OwnerProcessPid
 +
|-
 +
| 0x38 || int || LocalPermission
 +
|-
 +
| 0x3C || int || RemotePermission
 
|-
 
|-
| 0x30 || [[#KPort]]* || Parent
+
| 0x40 || bool || HasInited
 
|}
 
|}
  
= KSession =
+
</div>
Size: 0xB0
+
 
 +
= KJitMemory =
 +
[4.0.0+] Size: 0x58
  
 
Inherits from: [[#KAutoObject]]
 
Inherits from: [[#KAutoObject]]
Line 923: Line 1,050:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset
+
! Offset || Type || Description
! Type
 
! Description
 
 
|-
 
|-
 
| 0 || [[#KAutoObject]] || Inheritance
 
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 0x10 || [[#KServerSession]] || ServerSide
+
| 0x20 || KMemoryBlockList || Blocks
 +
|-
 +
| 0x38 || [[#KProcess]]* || SrcProcessPtr
 +
|-
 +
| 0x40 || u64 || SrcAddr
 +
|-
 +
| 0x48 || [[#KMutex]] || Mutex
 +
|-
 +
| 0x50 || u8 || HasInit
 
|-
 
|-
| 0x70 || [[#KClientSession]] || ClientSide
+
| 0x51 || u8 || HasMappedSlave
 
|-
 
|-
| 0xA8 || bool || HasInited
+
| 0x52 || u8 || HasMappedMaster
 
|}
 
|}
  
== KServerSession ==
+
= KPort =
Size: 0x60
+
[1.0.0] Size: 0xA8
 +
 
 +
[7.0.0] Size: 0x110
 +
 
 +
Inherits from: [[#KAutoObject]]
  
Inherits from: [[#KSynchronizationObject]]
 
  
 +
<div style="display: inline-block;">
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset || Type || Description
+
! 1.0.0 Offset
 +
! Type
 +
! Description
 
|-
 
|-
| 0 || [[#KSynchronizationObject]] || Inheritance
+
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 0x28 || KLinkedListNode || NodeFor__IncomingConnections
+
| 0x10 || [[#KServerPort]] || ServerSide
 
|-
 
|-
| 0x38 || [[#KSession*]] || Parent
+
| 0x60 || [[#KClientPort]] || ClientSide
 
|-
 
|-
| 0x40 || KLinkedListNode<[[#KSessionRequest]]*> || RequestList
+
| 0x98 || u64 ||
 
|-
 
|-
| 0x50 || [[#KSessionRequest]]* || ActiveRequest
+
| 0xA0 || bool || HasInited
 
|-
 
|-
| 0x58 || ||
+
| 0xA1 || bool || IsLight
 
|}
 
|}
 +
</div>
  
=== KSessionRequest ===
+
<div style="display: inline-block; vertical-align:top;">
Size: 0x158
 
 
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset || Type || Description
+
! 7.0.0 Offset
 +
! Type
 +
! Description
 
|-
 
|-
| 0 || * || Vtable
+
| 0 || [[#KAutoObject]] || Inheritance
|-
 
| 0x10 || KLinkedListNode ||  NodeFor__RequestList
 
|-
 
| 0x20 || [[#KBufferDescriptor]][8] || BufferTable
 
 
|-
 
|-
| 0x120 || [[#KBufferDescriptor]]* || ExternalBufferTable
+
| 0x30 || [[#KServerPort]] || ServerSide
 
|-
 
|-
| 0x128 || u8 || NumSendBuffers
+
| 0xA0 || [[#KClientPort]] || ClientSide
 
|-
 
|-
| 0x129 || u8 || NumRecvBuffers
+
| 0xF8 || u64 ||
 
|-
 
|-
| 0x12A || u8 || NumExchBuffers
+
| 0x100 || char* || NamePtr
 
|-
 
|-
| 0x130 || [[#KThread]]* || SenderThread
+
| 0x108 || bool || HasInited
 
|-
 
|-
| 0x138 || u64 || InitiallyZero
+
| 0x109 || bool || IsLight
|-
 
| 0x140 || [[#KWritableEvent]]* || ForAsyncEvent
 
|-
 
| 0x148 || u64 || CustomCmdbufAddr
 
|-
 
| 0x150 || u64 || CustomCmdbufSize
 
 
|}
 
|}
 +
</div>
  
=== KBufferDescriptor ===
+
== KServerPort ==
Size: 0x20
+
Size: 0x50
 +
 
 +
Inherits from: [[#KSynchronizationObject]]
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset || Type || Description
+
! Offset
 +
! Type
 +
! Description
 
|-
 
|-
| 0 || u64 || UserVirtAddr
+
| 0 || [[#KSynchronizationObject]] || Inheritance
 
|-
 
|-
| 8 || u64 || Size
+
| 0x28 || [[#KLinkedListNode]] || IncomingConnections
 
|-
 
|-
| 0x10 || u64 ||  
+
| 0x38 || [[#KLinkedListNode]] || IncomingLightConnections
|-
 
| 0x18 || u64 || BufferMemoryState
 
 
|-
 
|-
 +
| 0x48 || [[#KPort]]* || Parent
 
|}
 
|}
  
== KClientSession ==
+
== KClientPort ==
 
Size: 0x38
 
Size: 0x38
  
Inherits from: [[#KAutoObject]]
+
Inherits from: [[#KSynchronizationObject]]
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 1,018: Line 1,152:
 
! Description
 
! Description
 
|-
 
|-
| 0 || [[#KAutoObject]] || Inheritance
+
| 0 || [[#KSynchronizationObject]] || Inheritance
 
|-
 
|-
| 0x10 || [[#KSession]]* || Parent
+
| 0x28 || u32 || NumSessions
 
|-
 
|-
| 0x18 || bool || HasInited
+
| 0x2C || u32 || MaxSessions
 
|-
 
|-
| 0x20 || [[#KClientPort]]* || ParentPort
+
| 0x30 || [[#KPort]]* || Parent
|-
+
|}
| 0x28 || ||
 
|-
 
| 0x30 || [[#KProcess]]* || CreatorProcess
 
|}
 
  
= KLightSession =
+
= KSession =
Size: 0xA8
+
Size: 0xB0
  
 
Inherits from: [[#KAutoObject]]
 
Inherits from: [[#KAutoObject]]
Line 1,044: Line 1,174:
 
| 0 || [[#KAutoObject]] || Inheritance
 
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 0x10 || [[#KLightSessionServer]] || ServerSide
+
| 0x10 || [[#KServerSession]] || ServerSide
 
|-
 
|-
| 0x68 || [[#KLightSessionClient]] || ClientSide
+
| 0x70 || [[#KClientSession]] || ClientSide
 
|-
 
|-
| 0xA0 || bool || HasInited
+
| 0xA8 || bool || HasInited
 
|}
 
|}
  
== KLightServerSession ==
+
== KServerSession ==
Size: 0x58
+
Size: 0x60
  
Inherits from: [[#KAutoObject]]
+
Inherits from: [[#KSynchronizationObject]]
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset
+
! Offset || Type || Description
! Type
 
! Description
 
 
|-
 
|-
| 0 || [[#KAutoObject]] || Inheritance
+
| 0 || [[#KSynchronizationObject]] || Inheritance
 
|-
 
|-
| 0x10 || KLinkedListNode || NodeFor__IncomingLightConnections
+
| 0x28 || KLinkedListNode || NodeFor__IncomingConnections
 +
|-
 +
| 0x38 || [[#KSession*]] || Parent
 +
|-
 +
| 0x40 || KLinkedListNode<[[#KSessionRequest]]*> || RequestList
 
|-
 
|-
| 0x20 || [[#KLightSession]] || Parent
+
| 0x50 || [[#KSessionRequest]]* || ActiveRequest
 
|-
 
|-
| 0x28 || u64[6] ||
+
| 0x58 || [[#KMutex]] || lock
 
|}
 
|}
  
== KLightClientSession ==
+
=== KSessionRequest ===
Size: 0x38
+
Size: 0x158
  
 
Inherits from: [[#KAutoObject]]
 
Inherits from: [[#KAutoObject]]
Line 1,078: Line 1,210:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset
+
! Offset || Type || Description
! Type
 
! Description
 
 
|-
 
|-
 
| 0 || [[#KAutoObject]] || Inheritance
 
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 0x10 || [[#KLightSession]]* || Parent
+
| 0x10 || KLinkedListNode ||  NodeFor__RequestList
 +
|-
 +
| 0x20 || [[#KBufferDescriptor]][8] || BufferTable
 
|-
 
|-
| 0x18 || bool || HasInited
+
| 0x120 || [[#KBufferDescriptor]]* || ExternalBufferTable
 
|-
 
|-
| 0x20 || [[#KClientPort]]* || Port
+
| 0x128 || u8 || NumSendBuffers
 
|-
 
|-
| 0x28 || ||
+
| 0x129 || u8 || NumRecvBuffers
 
|-
 
|-
| 0x30 || [[#KProcess]]* || CreatorProcess
+
| 0x12A || u8 || NumExchBuffers
 +
|-
 +
| 0x130 || [[#KThread]]* || SenderThread
 +
|-
 +
| 0x138 || u64 || InitiallyZero
 +
|-
 +
| 0x140 || [[#KWritableEvent]]* || ForAsyncEvent
 +
|-
 +
| 0x148 || u64 || CustomCmdbufAddr
 +
|-
 +
| 0x150 || u64 || CustomCmdbufSize
 
|}
 
|}
  
= KEvent =
+
=== KBufferDescriptor ===
Size: 0x70
+
Size: 0x20
 
 
Inherits from: [[#KAutoObject]]
 
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset
+
! Offset || Type || Description
! Type
 
! Description
 
 
|-
 
|-
| 0 || [[#KAutoObject]] || Inheritance
+
| 0 || u64 || UserVirtAddr
 
|-
 
|-
| 0x10 || [[#KReadableEvent]] || ReadableEvent
+
| 8 || u64 || Size
 
|-
 
|-
| 0x48 || [[#KWritableEvent]] || WritableEvent
+
| 0x10 || u64 ||  
 
|-
 
|-
| 0x60 || [[#KProcess]]* || Creator
+
| 0x18 || u64 || BufferMemoryState
 
|-
 
|-
| 0x68 || bool || HasInited
 
 
|}
 
|}
  
== KReadableEvent ==
+
== KClientSession ==
 
Size: 0x38
 
Size: 0x38
  
Inherits from: [[#KSynchronizationEvent]]
+
Inherits from: [[#KAutoObject]]
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 1,128: Line 1,265:
 
! Description
 
! Description
 
|-
 
|-
| 0 || [[#KSynchronizationObject]] || Inheritance
+
| 0 || [[#KAutoObject]] || Inheritance
 +
|-
 +
| 0x10 || [[#KSession]]* || Parent
 +
|-
 +
| 0x18 || bool || HasInited
 +
|-
 +
| 0x20 || [[#KClientPort]]* || ParentPort
 
|-
 
|-
| 0x28 || bool ||
+
| 0x28 || ||
 
|-
 
|-
| 0x30 || [[#KEvent]]* || Parent
+
| 0x30 || [[#KProcess]]* || CreatorProcess
 
|}
 
|}
  
== KWritableEvent ==
+
= KLightSession =
Size: 0x18
+
Size: 0xA8
  
 
Inherits from: [[#KAutoObject]]
 
Inherits from: [[#KAutoObject]]
Line 1,148: Line 1,291:
 
| 0 || [[#KAutoObject]] || Inheritance
 
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 0x10 || [[#KEvent]]* || Parent
+
| 0x10 || [[#KLightSessionServer]] || ServerSide
|}
+
|-
 +
| 0x68 || [[#KLightSessionClient]] || ClientSide
 +
|-
 +
| 0xA0 || bool || HasInited
 +
|}
  
== KInterruptEvent ==
+
== KLightServerSession ==
[1.0.0] Size: 0x50
+
Size: 0x58
  
[2.0.0] Size: 0x48
+
Inherits from: [[#KAutoObject]]
  
Inherits from: [[#KReadableEvent]]
 
 
<div style="display: inline-block;">
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! 1.0.0 Offset || Type || Description
+
! Offset
 +
! Type
 +
! Description
 +
|-
 +
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 0 || [[#KReadableEvent]] || Inheritance
+
| 0x10 || KLinkedListNode || NodeFor__IncomingLightConnections
 
|-
 
|-
| 0x38 || [[#KInterruptReceiver]] || Receiver
+
| 0x20 || [[#KLightSession]] || Parent
 
|-
 
|-
| 0x48 || u32 || IrqId (or -1)
+
| 0x28 || u64[6] ||
 
|}
 
|}
</div>
 
  
<div style="display: inline-block; vertical-align:top;">
+
== KLightClientSession ==
 +
Size: 0x38
 +
 
 +
Inherits from: [[#KAutoObject]]
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! 2.0.0 Offset || Type || Description
+
! Offset
 +
! Type
 +
! Description
 +
|-
 +
| 0 || [[#KAutoObject]] || Inheritance
 +
|-
 +
| 0x10 || [[#KLightSession]]* || Parent
 
|-
 
|-
| 0 || [[#KReadableEvent]] || Inheritance
+
| 0x18 || bool || HasInited
 
|-
 
|-
| 0x38 || [[#KInterruptReceiver]]* || Receiver
+
| 0x20 || [[#KClientPort]]* || Port
 
|-
 
|-
| 0x40 || u32 || IrqId (or -1)
+
| 0x28 || ||
 
|-
 
|-
| 0x44 || bool || IsIrqRegistered
+
| 0x30 || [[#KProcess]]* || CreatorProcess
 
|}
 
|}
</div>
 
  
=== KInterruptReceiver ===
+
= KEvent =
[1.0.0] Size: 0x10
+
Size: 0x70
[2.0.0] Size: 0x20
+
 
 +
Inherits from: [[#KAutoObject]]
  
<div style="display: inline-block;">
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset || Type || Description
+
! Offset
 +
! Type
 +
! Description
 
|-
 
|-
| 0 || * || Vtable
+
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 8 || u64 ||
+
| 0x10 || [[#KReadableEvent]] || ReadableEvent
|}
 
</div>
 
 
 
<div style="display: inline-block; vertical-align:top;">
 
{| class="wikitable" border="1"
 
 
|-
 
|-
! Offset || Type || Description
+
| 0x48 || [[#KWritableEvent]] || WritableEvent
 
|-
 
|-
| 0 || * || Vtable
+
| 0x60 || [[#KProcess]]* || Creator
 
|-
 
|-
| 8 || u64 || InitiallyZero
+
| 0x68 || bool || HasInited
|-
 
| 0x10 || [[#KInterruptEvent]]* || IrqEventPtr
 
|-
 
| 0x18 || s32 || IrqId
 
 
|}
 
|}
</div>
 
  
= KDeviceAddressSpace =
+
== KReadableEvent ==
Size: 0x70
+
Size: 0x38
  
Inherits from: [[#KAutoObject]]
+
Inherits from: [[#KSynchronizationEvent]]
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 1,227: Line 1,375:
 
! Description
 
! Description
 
|-
 
|-
| 0 || [[#KAutoObject]] || Inheritance
+
| 0 || [[#KSynchronizationObject]] || Inheritance
 
|-
 
|-
| 0x10 || [[#KMutex]] || Mutex
+
| 0x28 || bool ||
 
|-
 
|-
| 0x18 || [[#KSmmuManager]] || Manager
+
| 0x30 || [[#KEvent]]* || Parent
|-
 
| 0x58 || u64 || BaseAddress
 
|-
 
| 0x60 || u64 || Size
 
|-
 
| 0x68 || bool || HasInited
 
 
|}
 
|}
  
[1.0.0] It was called KAddressSpace.
+
== KWritableEvent ==
 +
Size: 0x18
  
== KSmmuManager ==
+
Inherits from: [[#KAutoObject]]
Size: 0x40
 
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 1,251: Line 1,393:
 
! Description
 
! Description
 
|-
 
|-
| 0 || u8[4] || PageTableAsids
+
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 8 || void*[4] || PageDirectories
+
| 0x10 || [[#KEvent]]* || Parent
|-
 
| 0x28 || u64 || AttachedDevicesMask
 
|-
 
| 0x30 || u32 || RegVal32Bit
 
|-
 
| 0x34 || u32 || RegVal32BitEmpty
 
|-
 
| 0x38 || u32 || RegVal36Bit
 
|-
 
| 0x3C || u32 || RegVal36BitEmpty
 
 
|}
 
|}
  
= KResourceLimit =
+
== KInterruptEvent ==
Size: 0x68
+
[1.0.0] Size: 0x50
 +
 
 +
[2.0.0] Size: 0x48
  
Inherits from: [[#KAutoObject]]
+
Inherits from: [[#KReadableEvent]]
  
 +
<div style="display: inline-block;">
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset
+
! 1.0.0 Offset || Type || Description
! Type
 
! Description
 
 
|-
 
|-
| 0 || [[#KAutoObject]] || Inheritance
+
| 0 || [[#KReadableEvent]] || Inheritance
 
|-
 
|-
| 0x10 || u64[5] || CurrentValue
+
| 0x38 || [[#KInterruptReceiver]] || Receiver
 
|-
 
|-
| 0x38 || u64[5] || LimitValue
+
| 0x48 || u32 || IrqId (or -1)
|-
 
| 0x60 || [[#KMutex]] || Mutex
 
 
|}
 
|}
 +
</div>
  
= KPoolManager =
+
<div style="display: inline-block; vertical-align:top;">
[1.0.0] Size: 0x380
 
 
 
[2.0.0] Size: 0x450
 
 
 
<div style="display: inline-block;">
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! 1.0.0 Offset || Type || Description
+
! 2.0.0 Offset || Type || Description
 
|-
 
|-
| 0 || [[#KPoolAllocator]][3] || Allocator
+
| 0 || [[#KReadableEvent]] || Inheritance
 
|-
 
|-
| 0x348 || [[#KPoolRefManager]] || RefManager
+
| 0x38 || [[#KInterruptReceiver]]* || Receiver
 
|-
 
|-
| 0x368 || u64 || AllocationCounter
+
| 0x40 || u32 || IrqId (or -1)
 
|-
 
|-
| 0x370 || u64 ||
+
| 0x44 || bool || IsIrqRegistered
|-
 
| 0x378 || [[#KMutex]] || Mutex
 
 
|}
 
|}
 
</div>
 
</div>
  
<div style="display: inline-block; vertical-align:top;">
+
=== KInterruptReceiver ===
 +
[1.0.0] Size: 0x10
 +
[2.0.0] Size: 0x20
 +
 
 +
<div style="display: inline-block;">
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! 2.0.0 Offset || Type || Description
+
! Offset || Type || Description
 
|-
 
|-
| 0 || [[#KPoolAllocator]] || Allocator0
+
| 0 || * || Vtable
 
|-
 
|-
| 0x220 || [[#KPartitionInfo]]* || PartitionInfo0
+
| 8 || u64 ||
|-
 
| 0x228 || [[#KPoolAllocator]] || Allocator1
 
|-
 
| 0x448 || [[#KPartitionInfo]]* || PartitionInfo1
 
 
|}
 
|}
 
</div>
 
</div>
  
== KPoolAllocator ==
+
<div style="display: inline-block; vertical-align:top;">
[1.0.0] Size: 0x118
 
 
 
[2.0.0] Size: 0x220
 
 
 
<div style="display: inline-block;">
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! 1.0.0 Offset || Type || Description
+
! Offset || Type || Description
 
|-
 
|-
| 0 || void* || MemoryBase
+
| 0 || * || Vtable
 
|-
 
|-
| 8 || u64 || MemorySize
+
| 8 || u64 || InitiallyZero
 
|-
 
|-
| 0x10 || s32 || NumPools
+
| 0x10 || [[#KInterruptEvent]]* || IrqEventPtr
 
|-
 
|-
| 0x18 || [[#KPool]][8] || Pools
+
| 0x18 || s32 || IrqId
 
|}
 
|}
 
</div>
 
</div>
  
<div style="display: inline-block; vertical-align:top;">
+
= KDeviceAddressSpace =
 +
Size: 0x70
 +
 
 +
Inherits from: [[#KAutoObject]]
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! 2.0.0 Offset || Type || Description
+
! Offset
 +
! Type
 +
! Description
 +
|-
 +
| 0 || [[#KAutoObject]] || Inheritance
 +
|-
 +
| 0x10 || [[#KMutex]] || Mutex
 
|-
 
|-
| 0 || void* || MemoryBase
+
| 0x18 || [[#KSmmuManager]] || Manager
 
|-
 
|-
| 8 || u64 || MemorySize
+
| 0x58 || u64 || BaseAddress
 
|-
 
|-
| 0x10 || [[#KPool]][8] || Pools
+
| 0x60 || u64 || Size
 
|-
 
|-
| 0x210 || s32 || NumPools
+
| 0x68 || bool || HasInited
 
|}
 
|}
</div>
 
  
=== KPool ===
+
[1.0.0] It was called KAddressSpace.
[1.0.0] Size: 0x20
 
  
[2.0.0] Size: 0x40
+
== KSmmuManager ==
 +
Size: 0x40
  
<div style="display: inline-block;">
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! 1.0.0 Offset || Type || Description
+
! Offset
 +
! Type
 +
! Description
 +
|-
 +
| 0 || u8[4] || PageTableAsids
 +
|-
 +
| 8 || void*[4] || PageDirectories
 +
|-
 +
| 0x28 || u64 || AttachedDevicesMask
 
|-
 
|-
| 0 || KPoolHeader* || FirstFreeChunk
+
| 0x30 || u32 || RegVal32Bit
 
|-
 
|-
| 8 || u64 ||
+
| 0x34 || u32 || RegVal32BitEmpty
 
|-
 
|-
| 0x10 || u64 ||
+
| 0x38 || u32 || RegVal36Bit
 
|-
 
|-
| 0x18 || void* || SingletonTableEntryPtr
+
| 0x3C || u32 || RegVal36BitEmpty
 
|}
 
|}
</div>
 
  
<div style="display: inline-block; vertical-align:top;">
+
= KResourceLimit =
 +
Size: 0x68
 +
 
 +
Inherits from: [[#KAutoObject]]
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! 2.0.0 Offset || Type || Description
+
! Offset
 +
! Type
 +
! Description
 
|-
 
|-
| 0 || KPoolHeader* || FirstFreeChunk
+
| 0 || [[#KAutoObject]] || Inheritance
 
|-
 
|-
| 8 || u64 ||
+
| 0x10 || u64[5] || CurrentValue
 
|-
 
|-
| 0x10 || u64 ||
+
| 0x38 || u64[5] || LimitValue
 
|-
 
|-
| 0x18 || void* || SingletonTableEntryPtr
+
| 0x60 || [[#KMutex]] || Mutex
|-
 
| 0x20 || [[#KPool]]* || Parent
 
|-
 
| 0x30 || u64[2] || DmaProtectionKey
 
 
|}
 
|}
</div>
 
  
== KPoolRefManager ==
+
= KPoolManager =
[1.0.0] Size: 0x20
+
[1.0.0] Size: 0x380
  
 +
[2.0.0] Size: 0x450
 +
 +
<div style="display: inline-block;">
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset || Type || Description
+
! 1.0.0 Offset || Type || Description
 +
|-
 +
| 0 || [[#KPoolAllocator]][3] || Allocator
 
|-
 
|-
| 0 || [[#KPoolManager]]* || Parent
+
| 0x348 || [[#KPoolRefManager]] || RefManager
 
|-
 
|-
| 8 || void* || PoolBase
+
| 0x368 || u64 || AllocationCounter
 
|-
 
|-
| 0x10 || u64 || MaxPage
+
| 0x370 || u64 ||
 
|-
 
|-
| 0x18 || u16* || RefCountTable
+
| 0x378 || [[#KMutex]] || Mutex
 
|}
 
|}
 +
</div>
  
= KObjectAllocator =
+
<div style="display: inline-block; vertical-align:top;">
Size: 0x50
 
 
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset || Type || Description
+
! 2.0.0 Offset || Type || Description
|-
+
|-
| 0 || [[#KLockedList]] || LockedList  
+
| 0 || [[#KPoolAllocator]] || Allocator0
|-
+
|-
| 0x28 || [[#KSlabHeap]] || SlabHeap  
+
| 0x220 || [[#KPartitionInfo]]* || PartitionInfo0
 +
|-
 +
| 0x228 || [[#KPoolAllocator]] || Allocator1
 +
|-
 +
| 0x448 || [[#KPartitionInfo]]* || PartitionInfo1
 +
|}
 +
</div>
 +
 
 +
== KPoolAllocator ==
 +
[1.0.0] Size: 0x118
 +
 
 +
[2.0.0] Size: 0x220
 +
 
 +
<div style="display: inline-block;">
 +
{| class="wikitable" border="1"
 +
|-
 +
! 1.0.0 Offset || Type || Description
 +
|-
 +
| 0 || void* || MemoryBase
 +
|-
 +
| 8 || u64 || MemorySize
 +
|-
 +
| 0x10 || s32 || NumPools
 +
|-
 +
| 0x18 || [[#KPool]][8] || Pools
 +
|}
 +
</div>
 +
 
 +
<div style="display: inline-block; vertical-align:top;">
 +
{| class="wikitable" border="1"
 +
|-
 +
! 2.0.0 Offset || Type || Description
 +
|-
 +
| 0 || void* || MemoryBase
 +
|-
 +
| 8 || u64 || MemorySize
 +
|-
 +
| 0x10 || [[#KPool]][8] || Pools
 +
|-
 +
| 0x210 || s32 || NumPools
 +
|}
 +
</div>
 +
 
 +
=== KPool ===
 +
[1.0.0] Size: 0x20
 +
 
 +
[2.0.0] Size: 0x40
 +
 
 +
<div style="display: inline-block;">
 +
{| class="wikitable" border="1"
 +
|-
 +
! 1.0.0 Offset || Type || Description
 +
|-
 +
| 0 || KPoolHeader* || FirstFreeChunk
 +
|-
 +
| 8 || u64 ||
 +
|-
 +
| 0x10 || u64 ||
 +
|-
 +
| 0x18 || void* || SingletonTableEntryPtr
 +
|}
 +
</div>
 +
 
 +
<div style="display: inline-block; vertical-align:top;">
 +
{| class="wikitable" border="1"
 +
|-
 +
! 2.0.0 Offset || Type || Description
 +
|-
 +
| 0 || KPoolHeader* || FirstFreeChunk
 +
|-
 +
| 8 || u64 ||
 +
|-
 +
| 0x10 || u64 ||
 +
|-
 +
| 0x18 || void* || SingletonTableEntryPtr
 +
|-
 +
| 0x20 || [[#KPool]]* || Parent
 +
|-
 +
| 0x30 || u64[2] || DmaProtectionKey
 +
|}
 +
</div>
 +
 
 +
== KPoolRefManager ==
 +
[1.0.0] Size: 0x20
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Type || Description
 +
|-
 +
| 0 || [[#KPoolManager]]* || Parent
 +
|-
 +
| 8 || void* || PoolBase
 +
|-
 +
| 0x10 || u64 || MaxPage
 +
|-
 +
| 0x18 || u16* || RefCountTable
 +
|}
 +
 
 +
= KObjectAllocator =
 +
Size: 0x50
 +
[5.0.0]? Size: 0x48
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Type || Description
 +
|-
 +
| 0 || [[#KLockedList]] || LockedList  
 +
|-
 +
| 0x28 || [[#KSlabHeap]] || SlabHeap  
 +
|}
 +
 
 +
 
 +
= KSlabHeap =
 +
Size: 0x28
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Type || Description
 +
|-
 +
| 0 || void* || FreeListHead
 +
|-
 +
| 0x8 || u64 ||
 +
|-
 +
| 0x10 || void* || HeapPtr
 +
|-
 +
| 0x18 || u64 || TotalHeapSize
 +
|-
 +
| 0x20 || u64 || SingleObjectSize
 +
|}
 +
 
 +
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 =
 +
Size: 0x30
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Type || Description
 +
|-
 +
| 0 || u64 ||
 +
|-
 +
| 0x10 || u16* || RefCountTable
 +
|-
 +
| 0x10 || void* || BaseAddress
 +
|-
 +
| 0x18 || u64 || Size
 +
|-
 +
| 0x20 || u64 ||
 +
|-
 +
| 0x28 || u64 ||
 +
|}
 +
 
 +
= KIrqManager =
 +
[1.0.0] Size: 0x1608
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Type || Description
 +
|-
 +
| 0 || [[#KIrqEntry]][32] || Core0Irq
 +
|-
 +
| 0x200 || [[#KIrqEntry]][32] || Core1Irq
 +
|-
 +
| 0x400 || [[#KIrqEntry]][32] || Core2Irq
 +
|-
 +
| 0x600 || [[#KIrqEntry]][32] || Core3Irq
 +
|-
 +
| 0x800 || [[#KIrqEntry]][224] || SharedIrqs
 +
|-
 +
| 0x1600 || [[#KMutex]] || Mutex
 +
|}
 +
 
 +
== KIrqEntry ==
 +
[1.0.0] Size: 0x10
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Type || Description
 +
|-
 +
| 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 =
= KSlabHeap =
 
 
Size: 0x28
 
Size: 0x28
  
Line 1,433: Line 1,809:
 
! Offset || Type || Description
 
! Offset || Type || Description
 
|-
 
|-
| 0 || void* || FreeListHead
+
| 0 || [[#KLinkedListNode]]<[[#KManagedPort]] *> || NodeFor__ManagedPortList
|-
 
| 0x8 || u64 ||
 
 
|-
 
|-
| 0x10 || void* || HeapPtr
+
| 0x10 || char[12] || PortName
 
|-
 
|-
| 0x18 || u64 || TotalHeapSize
+
| 0x20 || [[#KClientPort]]* || ClientPort
|-
 
| 0x20 || u64 || SingleObjectSize
 
 
|}
 
|}
  
 +
= Slab Information =
  
= KPageTableAllocator =
+
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).
Size: 0x30
 
 
 
{| class="wikitable" border="1"
 
|-
 
! Offset || Type || Description
 
|-
 
| 0 || u64 ||
 
|-
 
| 0x10 || u16* || RefCountTable
 
|-
 
| 0x10 || void* || BaseAddress
 
|-
 
| 0x18 || u64 || Size
 
|-
 
| 0x20 || u64 ||
 
|-
 
| 0x28 || u64 ||
 
|}
 
 
 
= KIrqManager =
 
[1.0.0] Size: 0x1608
 
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Offset || Type || Description
+
! Object || Slab Count
 
|-
 
|-
| 0 || [[#KIrqEntry]][32] || Core0Irq
+
| KEvent || 600
 
|-
 
|-
| 0x200 || [[#KIrqEntry]][32] || Core1Irq
+
| KInterruptEvent || 100
 
|-
 
|-
| 0x400 || [[#KIrqEntry]][32] || Core2Irq
+
| KProcess || 80
|-
 
| 0x600 || [[#KIrqEntry]][32] || Core3Irq
 
|-
 
| 0x800 || [[#KIrqEntry]][224] || SharedIrqs
 
|-
 
| 0x1600 || [[#KMutex]] || Mutex
 
|}
 
 
 
== KIrqEntry ==
 
[1.0.0] Size: 0x10
 
 
 
{| class="wikitable" border="1"
 
|-
 
! Offset || Type || Description
 
 
|-
 
|-
| 0 || [[#KIrqReciever*]] || Receiver
+
| KThread || 700
 
|-
 
|-
| 8 || u8 || State0
+
| KPort || 200
 
|-
 
|-
| 9 || u8 || State1
+
| KSharedMemory || 80
|}
 
 
 
= KDebug =
 
Size: 0x50
 
 
 
{| class="wikitable" border="1"
 
 
|-
 
|-
! Offset || Type || Description
+
| KTransferMemory || 200
 
|-
 
|-
| 0 || [[#KSynchronizationObject]] || Inheritance
+
| KDeviceAddressSpace || 300
 
|-
 
|-
| 0x28 || [[#KLinkedListNode]]<[[#KDebugEvent]]> || EventList
+
| KDebug || 4
 
|-
 
|-
| 0x38 || u32 || Flags
+
| KSession || 800
 
|-
 
|-
| 0x40 || [[#KProcess]]* || ProcessPtr
+
| KLightSession || 100
 
|-
 
|-
| 0x48 || [[#KMutex]] || Mutex
+
| KLinkedListEntry<void*> || 17 231
|}
 
 
 
== KDebugEvent ==
 
Size: 0x60
 
 
 
{| class="wikitable" border="1"
 
 
|-
 
|-
! Offset || Type || Description
+
| KLinkedListNode || 4 000
 
|-
 
|-
| 0 || [[#KLinkedListNode]]<[[#KDebugEvent]]> || NodeFor__EventList
+
| KMemoryBlock (System) || 20 000
 
|-
 
|-
| 0x10 || u32 || EventType
+
| KMemoryBlock (Other) || 10 000
 
|-
 
|-
| 0x14 || u32 || ThreadId
+
| KTlsPageManager || 167
 
|-
 
|-
| 0x18 || u32 || Flags
+
| KManagedPort || 7
 
|-
 
|-
| 0x1C || u16 ||
+
| KDebugEvent || 704
 
|-
 
|-
| 0x1E || bool ||
+
| KSessionRequest || 1 600
 
|-
 
|-
| 0x20 || ... || ...
+
| KResourceLimit || 5
 
|}
 
|}

Revision as of 15:35, 16 July 2019

KAutoObject

Size: 0x10

[5.0.0] Size: 0x20

[6.0.0] Size: 0x30

Offset Type Description
0 * Vtable
8 u32 ReferenceCount

[5.0.0]:

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]:

Offset Type Description
0 * Vtable
8 u32 ReferenceCount
0x10 #KRedBlackTreeNode Intrusive red-black tree node, replaces the Intrusive list node from previous versions.

KSynchronizationObject

Size: 0x28

[5.0.0] Size: 0x38

[6.0.0] Size: 0x48

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x10 #KLinkedList ThreadSyncList

KMutex

Size: 0x8

Offset Type Description
0 u64 OwnerTag

KRecursiveLock

Size: 0x18

Offset Type Description
0 #KThread * Owner
8 s32 Count


KLockedList

Size: 0x28

[5.0.0]? Size: 0x20

Offset Type Description
0 u64 Count
8 #KLinkedListNode List
0x18 #KMutex Mutex
0x20 u64 MaxCount

[5.0.0]?:

Offset Type Description
0 #KLinkedListNode List
0x10 #KMutex Mutex
0x18 u64 MaxCount

KLinkedListNode

Size: 0x10

Offset Type Description
0 #KLinkedListNode* Prev
8 #KLinkedListNode* Next

KLinkedListEntry

Size: 0x10 + sizeof(T)

Offset Type Description
0 #KLinkedListNode NodeFor__List
0x10 T Data

KLinkedList

Size: 0x18

Offset Type Description
0 u64 Count
8 #KLinkedListNode Bounds (first, last)

KRedBlackTreeNode

Size: 0x20

Note: This is BSD sys/tree.h's RB_ENTRY(...).

Offset Type Description
0 KRedBlackTreeNode* Left Child
8 KRedBlackTreeNode* Right Child
0x10 KRedBlackTreeNode* Parent
0x18 int Color

KRedBlackTree

Size: 0x8

Note: This is BSD sys/tree.h's RB_HEAD(..., KRedBlackTreeNode);

Offset Type Description
0 KRedBlackTreeNode* Root

KThread

[1.0.0] Size: 0x620 [5.0.0]? Size: 0x6C0

Inherits from: #KSynchronizationObject, #KSchedulerObject0, #KSchedulerObject1, #KSchedulerObject2

1.0.0 Offset Type Description
0 #KSynchronizationObject Inheritance
0x28 KSchedulerObject0 Inheritance
0x48 KSchedulerObject1 Inheritance
0x58 KSchedulerObject2 Inheritance
0x70 KThreadContext Context
0x2F0 u64 CoreMask
0x2F8 u64 CoreMaskOverride
0x300 u64 ThreadId
0x308 u64 TotalTimeRunning
0x310 #KSynchronizationObject* SignalledObjectPtr
0x318 u64
0x320 u64 CondVar_CondVarUserAddr
0x328 u64 Entrypoint
0x330 u64 CondVar_MutexUserAddr
0x338 #KProcess* ProcessPtr
0x340 void* KernelThreadStack
0x348 u64
0x350 void* TlsKernelPtr
0x358 void* TlsPhysicalPtr
0x360 #KSynchronizationObject*[0x40] SyncObjects
0x560 #KThread* CondVar_NextThreadPtr
0x568 #KThread* CondVar_PrevThreadPtr
0x570 #KSynchronizationObject* SignalledObjectPtr?
0x578 KLinkedListNode
0x588 KLinkedListNode
0x598 KLinkedListNode NodeFor__ThreadList
0x5A8 KLinkedListNode NodeFor__ThreadsOnSameCore
0x5B8 #KThread*
0x5C0 #KThread* CondVar_SelfPtr
0x5C8 u64
0x5D0 u64
0x5D8 u64
0x5E0 u32 CondVar_WaitThreadHandle
0x5E4 u32 SchedulingFlags_Default
0x5E8 u32 WaitSync_RetVal
0x5EC u32
0x5F0 u32 ActualPriority
0x5F4 u32
0x5F8 u32
0x5FC u32
0x600 u32 WantedPriority
0x604 u32 CpuCore
0x608 u8 State
0x609 u8 ShallBeTerminated
0x60A u8
0x60B u8
0x60C u8
0x60D u8
0x60E u8 HasExited
0x60F u8 HasCpuCoreOverride
... ... ...

KProcess

[1.0.0] Size: 0x5B0

[2.0.0] Size: 0x2480

[3.0.0] Size: 0x2580

[5.0.0] Size: 0x4600

Inherits from: #KSynchronizationObject

1.0.0 Offset Type Description
0 #KSynchronizationObject Inheritance
0x28 KProcessTerminationMessage Sent to mailbox 0 when self-terminating.
0x38 #KMemoryManager MemoryManager
0xF0 u64 TotalMemUsage
0xF8 #KLinkedList<#KTlsPageManager*>> TlsPagesList
0x110 s32 DefaultCpuCore
0x118 #KDebug* Debug
0x120 #KResourceLimit* ResourceLimit
0x128 u32 State
0x130 #KMutex ProcessMutex
0x138 #KMutex ThreadingMutex
0x140 #KLinkedListNode<#KThread *> ThreadArbiterList
0x150 KLinkedListNode
0x160 u64[4] RandomEntropy
0x180 u8 HasStateChanged
0x181 u8 HasInitialized
0x182 u8 IsSystem
0x183 u8[12+1] ProcessName
0x190 u16 NumberOfCreatedThreads
0x192 u16 ThreadingRelatedInitiallyZero
0x194 u32 ProcessFlags
0x198 #KProcessCapabilities Capabilities
0x248 u64 TitleId
0x250 u64 ProcessId
0x258 u64 CreatedTickstamp
0x260 u64 Entrypoint
0x268 u64 CodeMemUsage
0x270 u64 DynamicMemUsage
0x278 u64 MaxTotalMemUsage
0x280 u32 ProcessCategory (0: regular title, 1: kernel built-in)
0x288 #KProcessHandleTable HandleTable
0x528 void* UsermodeExceptionTlsArea
0x530 #KLinkedListNode<#KThread *> ExceptionThreadList
0x540 #KThread* ExceptionThread
0x548 #KLinkedListNode<#KThread *> ThreadList
0x558 bool HasStarted
0x55C u32 UnusedZero
0x560 u64[2] UnusedZeroes
0x570 u64 TotalTimeRunning
0x578 u64[5] UnusedZeroes
0x5A0 u64 UnusedZero
0x5A8 u64 UnusedZero
2.0.0 Offset Type Description
0 #KSynchronizationObject Inheritance
0x28 KProcessTerminationMessage Sent to mailbox 0 when self-terminating.
0x38 #KMemoryManager MemoryManager
0x100 u64 TotalMemUsage
0x108 #KLinkedList<#KTlsPageManager*> TlsPagesList
0x120 s32 DefaultCpuCore
0x128 #KDebug* Debug
0x130 #KResourceLimit* ResourceLimit
0x138 u32 State
0x140 #KMutex ProcessMutex
0x148 #KMutex ThreadingMutex
0x150 #KLinkedListNode<#KThread *> ThreadArbiterList
0x160 KLinkedListNode
0x170 u64[4] RandomEntropy
0x190 u8 HasStateChanged
0x191 u8 HasInitialized
0x192 u8 IsSystem
0x193 u8[12+1] ProcessName
0x1A0 u16 NumberOfCreatedThreads
0x1A2 u16 ThreadingRelatedInitiallyZero
0x1A4 u32 ProcessFlags
0x1A8 #KProcessCapabilities Capabilities
0x258 u64 TitleId
0x260 u64 ProcessId
0x268 u64 CreatedTickstamp
0x270 u64 Entrypoint
0x278 u64 CodeMemUsage
0x280 u64 DynamicMemUsage
0x288 u64 MaxTotalMemUsage
0x290 u32 ProcessCategory (0: regular title, 1: kernel built-in)
0x298 u64[5] Unused [?]
0x2C0 #KProcessHandleTable HandleTable
0x2380 void* UsermodeExceptionTlsArea
0x2388 #KLinkedListNode<#KThread *> ExceptionThreadList
0x2398 #KThread* ExceptionThread
0x23A0 #KLinkedListNode<#KThread *> ThreadList
0x23B0 #KLinkedListNode<#KSharedMemoryRef *> MappedSharedMemoriesList
0x23C0 bool HasStarted
0x23C1 bool HasException
0x23C4 u32 ExceptionEnum0
0x23C8 u64 ExceptionEnum1
0x23D0 u64 ExceptionThreadUnkInfo0
0x23D8 u64 BreakArg0
0x23E0 u64 BreakArg1
0x23E8 u64 BreakArg2
0x23F0 u64 ExceptionThreadUnkInfo1
0x23F8 u32 UnusedZero
0x2400 u64[8] UnusedZeroes
0x2440 u64 UnusedZero
0x2448 u64 UnusedZero
0x2450 u64[6] Unused [?]

KTlsPageManager

Size: 0x20

Offset Type Description
0 void* TlsPagePtr
8 #KProcess* ProcessPtr
0x10 u32 UsageCount
0x14 u8[8] IsSlotFree

KProcessCapabilities

Size: 0xB0

Offset Type Description
0 u8[16] SvcAccessMask
0x10 u8[128] IrqAccessMask
0x90 u64 AllowedCpuIdBitmask
0x98 u64 AllowedThreadPrioBitmask
0xA0 u32 DebuggingFlags
0xA4 u32 HandleTableSize
0xA8 u32 KernelReleaseVersion
0xAC u32 ApplicationType

KProcessHandleTable

[1.0.0] Size: 0x2A0

[2.0.0] Size: 0x20C0

1.0.0 Offset Type Description
0 #KHandleEntry* TablePtr
8 #KHandleEntry* NextFreeEntry
0x10 #KHandleEntry[40] InternalTable
0x290 u16 Size
0x292 u16 MaxUsageAtOnce
0x294 u16 IdCounter
0x296 u16 NumActiveSlots
0x298 #KSpinLock Lock
2.0.0 Offset Type Description
0 #KHandleEntry* TablePtr
8 #KHandleEntry* NextFreeEntry
0x10 #KHandleEntry[1024] InternalTable
0x2010 u16 Size
0x2012 u16 MaxUsageAtOnce
0x2014 u16 IdCounter
0x2016 u16 NumActiveSlots
0x2040 #KSpinLock Lock

KHandleEntry

[1.0.0] Size: 0x10

[2.0.0] Size: 8

[6.0.0]? Size: 0x10

1.0.0 Offset Type Description
0 u16 HandleId
2 u8 ObjectType
8 #KAutoObject* Object
2.0.0 Offset Type Description
0 u16 HandleId
2 u8 ObjectType
4 u32 ObjectCompressedPtr
6.0.0 Offset Type Description
0 u16 HandleId
2 u8 ObjectType
4 u32 ObjectCompressedPtr
8 ptr ?

KSpinLock

[1.0.0] Size: 0x1

[2.0.0] Size: 0x40

1.0.0 Offset Type Description
0 u8 IsBusy
2.0.0 Offset Type Description
0 u16
0x20 u16

KSharedMemoryRef

[2.0.0] Size: 0x40

Offset Type Description
0 #KLinkedListNode<#KSharedMemoryRef *> NodeFor__MappedSharedMemoriesList
0x10 #KSharedMemory* SharedMem
0x18 u64 InitiallyZero

KMemoryManager

[1.0.0] Size: 0xB8

[2.0.0] Size: 0xC8

[5.0.0] Size: 0xF8?

1.0.0 Offset Type Description
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 HeapMaxAllocation
0x48 #KMutex Mutex
0x50 #KPageTable PageTable
0x60 #KMemoryBlockManager MemoryBlockManager
0x78 bool IsKernel
0x79 bool IsSystem
0x7A bool IsAddrSpace36Bit
0x7B bool HasAslr
0x7C u32 Is_0x59_If_Cfg12_Bit0_ElseZero
0x80 u32 Is_0x5A_If_Cfg12_Bit0_ElseZero
0x84 u32 Is_0x58_If_Cfg12_Bit0_ElseZero
0x88
0x90
0x98
0xA0 u64 TranslationTableBaseRegister0
0xA8 u64 TranslationControlRegister
0xB0 u8 AsidTagValue
2.0.0 Offset Type Description
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 #KMutex Mutex
0x70 #KPageTable PageTable
0x80 #KMemoryBlockManager MemoryBlockManager
0x98 u32 AddressSpaceWidth (32/36/39)
0x9C bool IsKernel
0x9D bool IsSystem
0x9E bool HasAslr
0xA0 u32 PoolPartition
0xA4 u32 Is_0x5A_If_Cfg12_Bit0_ElseZero
0xA8 u32 Is_0x59_If_Cfg12_Bit0_ElseZero
0xAC u32 Is_0x58_If_Cfg12_Bit0_ElseZero
0xB0 u64 TranslationTableBaseRegister0
0xB8 u64 TranslationControlRegister
0xC0 u32 AsidTagValue
5.0.0 Offset Type Description
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

KPageTable

Size: 0x10

Offset Type Description
0 void* RawPageTablePtr
8 bool
0xC u32 AddrSpaceSizeInGb

KMemoryBlockManager

Size: 0x18

Offset Type Description
0 #KMemoryBlock* MemoryBlockList
8 u64 MaxAddr
0x10 u64 MinAddr

KMemoryBlock

Size: 0x40

Offset Type Description
0 #KLinkedListNode<#KMemoryBlock *> NodeFor__MemoryBlockList
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

Offset Type Description
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

Size: 0x48

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x10 KMemoryBlockList Blocks
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

1.0.0 Offset Type Description
0 #KAutoObject Inheritance
0x10 KMemoryBlockList Blocks
0x28 #KProcess* OwnerProcess
0x30 int LocalPermission
0x34 int RemotePermission
0x38 bool HasInited
2.0.0 Offset Type Description
0 #KAutoObject Inheritance
0x10 KMemoryBlockList Blocks
0x28 #KResourceLimit* OwnerResourceLimit
0x30 u64 OwnerProcessPid
0x38 int LocalPermission
0x3C int RemotePermission
0x40 bool HasInited

KJitMemory

[4.0.0+] Size: 0x58

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x20 KMemoryBlockList Blocks
0x38 #KProcess* SrcProcessPtr
0x40 u64 SrcAddr
0x48 #KMutex Mutex
0x50 u8 HasInit
0x51 u8 HasMappedSlave
0x52 u8 HasMappedMaster

KPort

[1.0.0] Size: 0xA8

[7.0.0] Size: 0x110

Inherits from: #KAutoObject


1.0.0 Offset Type Description
0 #KAutoObject Inheritance
0x10 #KServerPort ServerSide
0x60 #KClientPort ClientSide
0x98 u64
0xA0 bool HasInited
0xA1 bool IsLight
7.0.0 Offset Type Description
0 #KAutoObject Inheritance
0x30 #KServerPort ServerSide
0xA0 #KClientPort ClientSide
0xF8 u64
0x100 char* NamePtr
0x108 bool HasInited
0x109 bool IsLight

KServerPort

Size: 0x50

Inherits from: #KSynchronizationObject

Offset Type Description
0 #KSynchronizationObject Inheritance
0x28 #KLinkedListNode IncomingConnections
0x38 #KLinkedListNode IncomingLightConnections
0x48 #KPort* Parent

KClientPort

Size: 0x38

Inherits from: #KSynchronizationObject

Offset Type Description
0 #KSynchronizationObject Inheritance
0x28 u32 NumSessions
0x2C u32 MaxSessions
0x30 #KPort* Parent

KSession

Size: 0xB0

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x10 #KServerSession ServerSide
0x70 #KClientSession ClientSide
0xA8 bool HasInited

KServerSession

Size: 0x60

Inherits from: #KSynchronizationObject

Offset Type Description
0 #KSynchronizationObject Inheritance
0x28 KLinkedListNode NodeFor__IncomingConnections
0x38 #KSession* Parent
0x40 KLinkedListNode<#KSessionRequest*> RequestList
0x50 #KSessionRequest* ActiveRequest
0x58 #KMutex lock

KSessionRequest

Size: 0x158

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
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: 0x20

Offset Type Description
0 u64 UserVirtAddr
8 u64 Size
0x10 u64
0x18 u64 BufferMemoryState

KClientSession

Size: 0x38

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x10 #KSession* Parent
0x18 bool HasInited
0x20 #KClientPort* ParentPort
0x28
0x30 #KProcess* CreatorProcess

KLightSession

Size: 0xA8

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x10 #KLightSessionServer ServerSide
0x68 #KLightSessionClient ClientSide
0xA0 bool HasInited

KLightServerSession

Size: 0x58

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x10 KLinkedListNode NodeFor__IncomingLightConnections
0x20 #KLightSession Parent
0x28 u64[6]

KLightClientSession

Size: 0x38

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x10 #KLightSession* Parent
0x18 bool HasInited
0x20 #KClientPort* Port
0x28
0x30 #KProcess* CreatorProcess

KEvent

Size: 0x70

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x10 #KReadableEvent ReadableEvent
0x48 #KWritableEvent WritableEvent
0x60 #KProcess* Creator
0x68 bool HasInited

KReadableEvent

Size: 0x38

Inherits from: #KSynchronizationEvent

Offset Type Description
0 #KSynchronizationObject Inheritance
0x28 bool
0x30 #KEvent* Parent

KWritableEvent

Size: 0x18

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x10 #KEvent* Parent

KInterruptEvent

[1.0.0] Size: 0x50

[2.0.0] Size: 0x48

Inherits from: #KReadableEvent

1.0.0 Offset Type Description
0 #KReadableEvent Inheritance
0x38 #KInterruptReceiver Receiver
0x48 u32 IrqId (or -1)
2.0.0 Offset Type Description
0 #KReadableEvent Inheritance
0x38 #KInterruptReceiver* Receiver
0x40 u32 IrqId (or -1)
0x44 bool IsIrqRegistered

KInterruptReceiver

[1.0.0] Size: 0x10 [2.0.0] Size: 0x20

Offset Type Description
0 * Vtable
8 u64
Offset Type Description
0 * Vtable
8 u64 InitiallyZero
0x10 #KInterruptEvent* IrqEventPtr
0x18 s32 IrqId

KDeviceAddressSpace

Size: 0x70

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x10 #KMutex Mutex
0x18 #KSmmuManager Manager
0x58 u64 BaseAddress
0x60 u64 Size
0x68 bool HasInited

[1.0.0] It was called KAddressSpace.

KSmmuManager

Size: 0x40

Offset Type Description
0 u8[4] PageTableAsids
8 void*[4] PageDirectories
0x28 u64 AttachedDevicesMask
0x30 u32 RegVal32Bit
0x34 u32 RegVal32BitEmpty
0x38 u32 RegVal36Bit
0x3C u32 RegVal36BitEmpty

KResourceLimit

Size: 0x68

Inherits from: #KAutoObject

Offset Type Description
0 #KAutoObject Inheritance
0x10 u64[5] CurrentValue
0x38 u64[5] LimitValue
0x60 #KMutex Mutex

KPoolManager

[1.0.0] Size: 0x380

[2.0.0] Size: 0x450

1.0.0 Offset Type Description
0 #KPoolAllocator[3] Allocator
0x348 #KPoolRefManager RefManager
0x368 u64 AllocationCounter
0x370 u64
0x378 #KMutex Mutex
2.0.0 Offset Type Description
0 #KPoolAllocator Allocator0
0x220 #KPartitionInfo* PartitionInfo0
0x228 #KPoolAllocator Allocator1
0x448 #KPartitionInfo* PartitionInfo1

KPoolAllocator

[1.0.0] Size: 0x118

[2.0.0] Size: 0x220

1.0.0 Offset Type Description
0 void* MemoryBase
8 u64 MemorySize
0x10 s32 NumPools
0x18 #KPool[8] Pools
2.0.0 Offset Type Description
0 void* MemoryBase
8 u64 MemorySize
0x10 #KPool[8] Pools
0x210 s32 NumPools

KPool

[1.0.0] Size: 0x20

[2.0.0] Size: 0x40

1.0.0 Offset Type Description
0 KPoolHeader* FirstFreeChunk
8 u64
0x10 u64
0x18 void* SingletonTableEntryPtr
2.0.0 Offset Type Description
0 KPoolHeader* FirstFreeChunk
8 u64
0x10 u64
0x18 void* SingletonTableEntryPtr
0x20 #KPool* Parent
0x30 u64[2] DmaProtectionKey

KPoolRefManager

[1.0.0] Size: 0x20

Offset Type Description
0 #KPoolManager* Parent
8 void* PoolBase
0x10 u64 MaxPage
0x18 u16* RefCountTable

KObjectAllocator

Size: 0x50 [5.0.0]? Size: 0x48

Offset Type Description
0 #KLockedList LockedList
0x28 #KSlabHeap SlabHeap


KSlabHeap

Size: 0x28

Offset Type Description
0 void* FreeListHead
0x8 u64
0x10 void* HeapPtr
0x18 u64 TotalHeapSize
0x20 u64 SingleObjectSize

5.0.0 (?):

Offset Type Description
0 void* FreeListHead
0x8 u64 SingleObjectSize
0x10 void* HeapPtr
0x18 void* Start (equal to HeapPtr on init)
0x20 void* End

KPageTableAllocator

Size: 0x30

Offset Type Description
0 u64
0x10 u16* RefCountTable
0x10 void* BaseAddress
0x18 u64 Size
0x20 u64
0x28 u64

KIrqManager

[1.0.0] Size: 0x1608

Offset Type Description
0 #KIrqEntry[32] Core0Irq
0x200 #KIrqEntry[32] Core1Irq
0x400 #KIrqEntry[32] Core2Irq
0x600 #KIrqEntry[32] Core3Irq
0x800 #KIrqEntry[224] SharedIrqs
0x1600 #KMutex Mutex

KIrqEntry

[1.0.0] Size: 0x10

Offset Type Description
0 #KInterruptReceiver* Receiver
8 u8 State0
9 u8 State1

KDebug

Size: 0x50

Offset Type Description
0 #KSynchronizationObject Inheritance
0x28 #KLinkedListNode<#KDebugEvent> EventList
0x38 u32 Flags
0x40 #KProcess* ProcessPtr
0x48 #KMutex Mutex

KDebugEvent

Size: 0x60

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

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).

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