Changes

Jump to navigation Jump to search
7,779 bytes removed ,  19:37, 10 December 2016
no edit summary
Line 1: Line 1: −
[[Category:Kernel objects]]
+
[[Category:Kernel synchronization objects]]
class [[KProcess]] extends [[KSynchronizationObject]];
+
[[Category:Kernel interrupt events]]
 +
class [[KProcess]] extends [[KSynchronizationObject]] and [[KSendableInterruptEvent]];
   −
Size : 0x260 bytes
+
Size : 0x270 (N3DS) / 0x268 bytes (O3DS post 8.x) / 0x260 bytes (O3DS pre 8.x). 0x4D8 bytes on ARM9.
 +
The only field that changed is the [[KProcessHwInfo]] member instance. The definition of KProcess remain identical in all cases.
   −
{| class="wikitable" border="1"
+
The listed offsets are N3DS-only.
|-
  −
!  Offset
  −
! Type
  −
!  Description
  −
|-
  −
| 0x0
  −
| u32
  −
| Pointer to vtable
  −
|-
  −
| 0x4
  −
| u32
  −
| Reference count
  −
|-
  −
| 0x8
  −
| u32
  −
| Count of KThreads that sync with this object - number of nodes in the linked list below
  −
|-
  −
| 0xC
  −
| KLinkedListNode*
  −
| Pointer to first KLinkedListNode in node list of KThreads that sync with this object
  −
|-
  −
| 0x10
  −
| KLinkedListNode*
  −
| Pointer to last KLinkedListNode in node list of KThreads that sync with this object
  −
|-
  −
| 0x1C
  −
| KThread*
  −
| 0 or pointer to the thread the currently does something with the process object.
  −
|-
  −
| 0x20
  −
| s16
  −
| ?
  −
|-
  −
| 0x30
  −
| KLinkedListNode*
  −
| Pointer to first KLinkedListNode in list of KMemoryBlocks used by the process
  −
|-
  −
| 0x34
  −
| KLinkedListNode*
  −
| Pointer to last KLinkedListNode in list of KMemoryBlocks used by the process
  −
|-
  −
| 0x40
  −
| u32
  −
| Translation table base
  −
|-
  −
| 0x44
  −
| u8
  −
| Context ID
  −
|-
  −
| 0x50
  −
| u32
  −
| Size of the MMU table
  −
|-
  −
| 0x54
  −
| u32
  −
| Virtual address of the MMU table for this process
  −
|-
  −
| 0x58
  −
| u32
  −
| Total size of all thread context pages (0xFF4xxxxx) owned by threads that belong to this process
  −
|-
  −
| 0x5C
  −
| u32
  −
| Number of KThreadLocalPages used by this KProcess
  −
|-
  −
| 0x60
  −
| KLinkedListNode*
  −
| Pointer to first KLinkedListNode in the list of KThreadLocalPages
  −
|-
  −
| 0x64
  −
| KLinkedListNode*
  −
| Pointer to last KLinkedListNode in the list of KThreadLocalPages
  −
|-
  −
| 0x6C
  −
| s32
  −
| Ideal processor
  −
|-
  −
| 0x74
  −
| u32
  −
| Pointer to resource limits for process.
  −
|-
  −
| 0x79
  −
| u8
  −
| Proc affinity mask
  −
|-
  −
| 0x7C
  −
| u32
  −
| Number of threads which belong to this process.
  −
|-
  −
| 0x80
  −
| 0x10-bytes
  −
| SVC access control mask from the exheader kernel descriptors. This is copied to the [[Memory_layout#0xFF4XX000|0xFF4XX000]] area when creating threads, which is the actual data the SVC-handler checks for SVC-access-control.
  −
|-
  −
| 0x90
  −
| 0x10-bytes
  −
| Interrupt flags- 32 interrupts per word, 4 words, 0x80 interrupts total divided evenly across 4 words
  −
|-
  −
| 0xA0
  −
| u32
  −
| Kernel flags from the exheader kernel descriptors.
  −
|-
  −
| 0xA4
  −
| u16
  −
| Handle table size from the exheader kernel descriptors. When this is 0, handle table is stored in WRAM.
  −
|-
  −
| 0xA6
  −
| u16
  −
| Kernel release version field, from the exheader kernel descriptors.
  −
|-
  −
| 0xA8
  −
| u32
  −
| Pointer to [[KCodeSet]] instance
  −
|-
  −
| 0xAC
  −
| u32
  −
| Process id, this always begins at 0x0 for the first process.
  −
|-
  −
| 0xB0
  −
| u32
  −
| Kernel flags from the exheader kernel descriptors.
  −
|-
  −
| 0xB8
  −
| KThread*
  −
| Pointer to the process's main (?) thread.
  −
|-
  −
| 0xCC
  −
| KProcessHandleTable
  −
| Process handle table. until 0x1C4 or longer
  −
|-
  −
| 0x224
  −
| u32
  −
| ?
  −
|}
  −
 
  −
 
  −
Structure starting with [[8.0.0-18]] NATIVE_FIRM:
  −
 
  −
Size : 0x268 bytes
  −
 
  −
{| class="wikitable" border="1"
  −
|-
  −
!  Offset
  −
! Type
  −
!  Description
  −
|-
  −
| 0x0
  −
| u32
  −
| Pointer to vtable
  −
|-
  −
| 0x4
  −
| u32
  −
| Reference count
  −
|-
  −
| 0x8
  −
| u32
  −
| Count of KThreads that sync with this object - number of nodes in the linked list below
  −
|-
  −
| 0xC
  −
| KLinkedListNode*
  −
| Pointer to first KLinkedListNode in node list of KThreads that sync with this object
  −
|-
  −
| 0x10
  −
| KLinkedListNode*
  −
| Pointer to last KLinkedListNode in node list of KThreads that sync with this object
  −
|-
  −
| 0x1C
  −
| KThread*
  −
| Thread currently running kernel code to act on this process
  −
|-
  −
| 0x20
  −
| s16
  −
| This is used to record errors that occur when the thread above is set as the thread running code for the process
  −
|-
  −
| 0x22
  −
| u16
  −
| Unused, alignment
  −
|-
  −
| 0x24
  −
| u8
  −
| TLB entries for process need invalidating on core0
  −
|-
  −
| 0x28
  −
| u8
  −
| TLB entries for process need invalidating on core1
  −
|-
  −
| 0x2C
  −
| u32
  −
| Count of KMemoryBlocks owned by the process
  −
|-
  −
| 0x30
  −
| KLinkedListNode*
  −
| Pointer to first KLinkedListNode in list of KMemoryBlocks used by the process
  −
|-
  −
| 0x34
  −
| KLinkedListNode*
  −
| Pointer to last KLinkedListNode in list of KMemoryBlocks used by the process
  −
|-
  −
| 0x40
  −
| u32
  −
| Translation table base
  −
|-
  −
| 0x44
  −
| u8
  −
| Context ID
  −
|-
  −
| 0x46
  −
| bool
  −
| Process is the currently loaded game/app
  −
|-
  −
| 0x4C
  −
| u32
  −
| End of userland virtual memory for the process
  −
|-
  −
| 0x50
  −
| u32*
  −
| [[Memory_layout|LINEAR]] memory virtual address(userland) base for this process.
  −
|-
  −
| 0x58
  −
| u32
  −
| Size of the MMU table
  −
|-
  −
| 0x5C
  −
| u32
  −
| Virtual address of the MMU table for this process
  −
|-
  −
| 0x60
  −
| u32
  −
| Total size of all thread context pages (0xFF4xxxxx) owned by threads that belong to this process
  −
|-
  −
| 0x64
  −
| u32
  −
| Number of KThreadLocalPages used by this KProcess
  −
|-
  −
| 0x68
  −
| KLinkedListNode*
  −
| Pointer to first KLinkedListNode in the list of KThreadLocalPages
  −
|-
  −
| 0x6C
  −
| KLinkedListNode*
  −
| Pointer to last KLinkedListNode in the list of KThreadLocalPages
  −
|-
  −
| 0x74
  −
| s32
  −
| Ideal processor for this process
  −
|-
  −
| 0x78
  −
| KDebug*
  −
| KDebug object created from svc 60 to debug the process
  −
|-
  −
| 0x7C
  −
| KResourceLimit*
  −
| Pointer to resource limits for process.
  −
|-
  −
| 0x80
  −
| u8
  −
| Normally 1 to indicate process is open/available.  Set to 2 to indicate process is exiting/closing and 3 to indicate exited/closed.
  −
|-
  −
| 0x81
  −
| u8
  −
| Process affinity mask
  −
|-
  −
| 0x82
  −
| u16
  −
| Unused, alignment
  −
|-
  −
| 0x84
  −
| s16
  −
| Number of threads which belong to this process.
  −
|-
  −
| 0x86
  −
| s16
  −
| Max number of threads which can belong to this process.
  −
|-
  −
| 0x88
  −
| 0x10-bytes
  −
| SVC access control mask from the exheader kernel descriptors. This is copied to the [[Memory_layout#0xFF4XX000|0xFF4XX000]] area when creating threads, which is the actual data the SVC-handler checks for SVC-access-control.
  −
|-
  −
| 0x98
  −
| u32[4]
  −
| Interrupt available flags- 32 interrupts per word, 4 words, 0x80 interrupts total divided evenly across 4 words
  −
|-
  −
| 0xA8
  −
| u32
  −
| Kernel flags from the exheader kernel descriptors.
  −
|-
  −
| 0xAC
  −
| u16
  −
| Handle table size from the exheader kernel descriptors. When this is 0, handle table is stored in WRAM.
  −
|-
  −
| 0xAE
  −
| u16
  −
| Kernel release version field, from the exheader kernel descriptors.
  −
|-
  −
| 0xB0
  −
| u32
  −
| Pointer to [[KCodeSet]] instance
  −
|-
  −
| 0xB4
  −
| u32
  −
| Process id, this always begins at 0x0 for the first process.
  −
|-
  −
| 0xB8
  −
| s64
  −
| Process creation time as tick count
  −
|-
  −
| 0xC0
  −
| KThread*
  −
| Pointer to the process's main thread.
  −
|-
  −
| 0xC4
  −
| u32[4]
  −
| Interrupt enabled flags- 32 interrupts per word, 4 words, 0x80 interrupts total divided evenly across 4 words
  −
|-
  −
| 0xD4
  −
| KProcessHandleTable
  −
| This is the data for tracking and using all of the KProcess's handles.
  −
|-
  −
| 0xEC
  −
| HandleData[0x28]
  −
| These internal HandleData entries are only used if the exheader's handle table size is 0
  −
|-
  −
| 0x22C
  −
| u32
  −
| Unused (From here up, everything is set to 0 on creation, has 0 written to it again during process creation, and is never used again.)
  −
|-
  −
| 0x230
  −
| u64
  −
| Unused
  −
|-
  −
| 0x238
  −
| u64
  −
| Unused
  −
|-
  −
| 0x240
  −
| u64
  −
| Unused
  −
|-
  −
| 0x248
  −
| u64
  −
| Unused
  −
|-
  −
| 0x250
  −
| u64
  −
| Unused
  −
|-
  −
| 0x258
  −
| u64
  −
| Unused
  −
|-
  −
| 0x260
  −
| u64
  −
| Unused
  −
|}
  −
 
  −
 
  −
Structure starting with [[8.1.0-0 New3DS]] NATIVE_FIRM:
  −
 
  −
Size : 0x270 bytes (0x4D8 bytes on ARM9)
      
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 371: Line 15:  
|-
 
|-
 
| 0x0
 
| 0x0
| u32
+
| void**
 
| Pointer to vtable
 
| Pointer to vtable
 
|-
 
|-
Line 391: Line 35:  
|-
 
|-
 
| 0x14
 
| 0x14
| u32
+
| [[KSendableInterruptEvent]]
| Unknown
+
| Interrupt event (*this) sent to terminate the process
|-
  −
| 0x18
  −
| u32
  −
| Unknown
   
|-
 
|-
 
| 0x1C
 
| 0x1C
| KThread*
+
| [[KProcessHwInfo]]
| Thread currently running kernel code to act on this process
+
| Process hardware/context info. Used to manage segmentation, etc.
|-
  −
| 0x20
  −
| s16
  −
| This is used to record errors that occur when the thread above is set as the thread running code for the process
  −
|-
  −
| 0x22
  −
| u16
  −
| Unused, alignment
  −
|-
  −
| 0x24
  −
| u8
  −
| TLB entries for process need invalidating on core0
  −
|-
  −
| 0x28
  −
| u8
  −
| TLB entries for process need invalidating on core1
  −
|-
  −
| 0x2C
  −
| u8
  −
| TLB entries for process need invalidating on core2
  −
|-
  −
| 0x30
  −
| u8
  −
| TLB entries for process need invalidating on core3
  −
|-
  −
| 0x34
  −
| u32
  −
| Count of KMemoryBlocks owned by the process
  −
|-
  −
| 0x38
  −
| KLinkedListNode*
  −
| Pointer to first KLinkedListNode in list of KMemoryBlocks used by the process
  −
|-
  −
| 0x3C
  −
| KLinkedListNode*
  −
| Pointer to last KLinkedListNode in list of KMemoryBlocks used by the process
  −
|-
  −
| 0x40
  −
| u32
  −
| Unknown
  −
|-
  −
| 0x44
  −
| u32
  −
| Unknown
  −
|-
  −
| 0x48
  −
| u32
  −
| Translation table base
  −
|-
  −
| 0x4C
  −
| u8
  −
| Context ID
  −
|-
  −
| 0x4E
  −
| bool
  −
| Process is the currently loaded game/app
  −
|-
  −
| 0x50
  −
| u32
  −
| Unknown
  −
|-
  −
| 0x54
  −
| u32
  −
| End of userland virtual memory for the process
  −
|-
  −
| 0x58
  −
| u32*
  −
| [[Memory_layout|LINEAR]] memory virtual address(userland) base for this process.
  −
|-
  −
| 0x5C
  −
| u32
  −
| Unknown
  −
|-
  −
| 0x60
  −
| u32
  −
| Size of the MMU table
  −
|-
  −
| 0x64
  −
| u32
  −
| Virtual address of the MMU table for this process
   
|-
 
|-
 
| 0x68
 
| 0x68
 
| u32
 
| u32
| Total size of all thread context pages (0xFF4xxxxx) owned by threads that belong to this process
+
| Total size of all [[Memory_layout#0xFF4XX000|Thread Context]] pages owned by threads that belong to this process
 
|-
 
|-
 
| 0x6C
 
| 0x6C
 
| u32
 
| u32
| Number of KThreadLocalPages used by this KProcess
+
| Number of [[KThreadLocalPage|KThreadLocalPages]] used by this KProcess
 
|-
 
|-
 
| 0x70
 
| 0x70
Line 508: Line 68:  
| 0x80
 
| 0x80
 
| KDebug*
 
| KDebug*
| KDebug object created from svc 60 to debug the process
+
| KDebug object created from [[SVC|svc 0x60]] to debug the process
 
|-
 
|-
 
| 0x84
 
| 0x84
Line 516: Line 76:  
| 0x88
 
| 0x88
 
| u8
 
| u8
| Normally 1 to indicate process is open/available. Set to 2 to indicate process is exiting/closing and 3 to indicate exited/closed.
+
| Normally 1 to indicate process is open/available. Set to 2 to indicate process is exiting/closing and 3 to indicate exited/closed.
 
|-
 
|-
 
| 0x89
 
| 0x89
Line 532: Line 92:  
| 0x8E
 
| 0x8E
 
| s16
 
| s16
| Max number of threads which can belong to this process.
+
| Max number of threads which can belong to this process. This is always 0.
 
|-
 
|-
 
| 0x90
 
| 0x90
 
| 0x10-bytes
 
| 0x10-bytes
| SVC access control mask from the exheader kernel descriptors. This is copied to the [[Memory_layout#0xFF4XX000|0xFF4XX000]] area when creating threads, which is the actual data the SVC-handler checks for SVC-access-control.
+
| SVC access control mask from the exheader kernel descriptors. This is copied to the [[Memory_layout#0xFF4XX000|Thread Context]] area when creating threads, which is the actual data the SVC-handler checks for SVC-access-control.
 
|-
 
|-
 
| 0xA0
 
| 0xA0
Line 575: Line 135:  
|-
 
|-
 
| 0xDC
 
| 0xDC
| KProcessHandleTable
+
| [[KProcess#KProcessHandleTable|KProcessHandleTable]]
 
| This is the data for tracking and using all of the KProcess's handles.
 
| This is the data for tracking and using all of the KProcess's handles.
|-
  −
| 0xF4
  −
| HandleData[0x28]
  −
| These internal HandleData entries are only used if the exheader's handle table size is 0
   
|-
 
|-
 
| 0x234
 
| 0x234
Line 616: Line 172:       −
KProcessHandleTable info struct:
+
= KProcessHandleTable =
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 624: Line 181:  
|-
 
|-
 
| 0x0
 
| 0x0
| HandleData*
+
| HandleDescriptor*
 
| Pointer to the process's handle table.
 
| Pointer to the process's handle table.
 
|-
 
|-
Line 636: Line 193:  
|-
 
|-
 
| 0x8
 
| 0x8
| HandleData*
+
| HandleDescriptor*
| Pointer to the next open HandleData entry in the handle table.  
+
| Pointer to the next open HandleDescriptor entry in the handle table.  
 
|-
 
|-
 
| 0xC
 
| 0xC
Line 648: Line 205:  
|-
 
|-
 
| 0x10
 
| 0x10
| KThread*
+
| [[KObjectMutex]]
| Thread that is running the current code
+
| Mutex
|-
  −
| 0x14
  −
| s16
  −
| Track errors for the running thread above.
  −
|-
  −
| 0x16
  −
| s16
  −
| Unused, alignment
   
|-
 
|-
 
| 0x18
 
| 0x18
| HandleData[0x28]
+
| HandleDescriptor[0x28]
| This small handle data table, internal to the KProcess, is only used in certain processes that don't have an external handle data table in FCRAM.  It is all zeros in most processes.
+
| This small handle data table, internal to the KProcess, is only used in certain processes that don't have an external handle descriptor table in FCRAM.  It is all zeros in most processes.
 
|}
 
|}
   −
 
+
= HandleDescriptor =
HandleData struct:
   
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 687: Line 235:  
On table creation, each entry in the handle data table is populated with a pointer to the next entry in the table.  When a new handle is created, that pointer is moved into offset 0x8 of the KProcessHandleTable info struct to use for generation of the next handle.
 
On table creation, each entry in the handle data table is populated with a pointer to the next entry in the table.  When a new handle is created, that pointer is moved into offset 0x8 of the KProcessHandleTable info struct to use for generation of the next handle.
   −
The final handle that gets returned when a handle is created is (handle_index | (handle_total << 15)), basically they take the index into the handle data table and OR that with the total handle count << 15.  This returned value is the one that gets passed back to the running application and is used to look up the HandleData entry in the table.
+
The final handle that gets returned when a handle is created is (handle_index | (handle_total << 15)), basically they take the index into the handle data table and OR that with the total handle count << 15.  This returned value is the one that gets passed back to the running application and is used to look up the HandleDescriptor entry in the table.
516

edits

Navigation menu