Changes

534 bytes added ,  08:22, 30 July 2015
no edit summary
Line 100: Line 100:  
| 0x7E
 
| 0x7E
 
| u8
 
| u8
| Thread type - kernel threads are 0-2 and are assigned values based on where in the kernel the thread is created.  All threads created outside the kernel environment are type 3.
+
| Thread affinity mask - set differently depending on whether the thread is created via svc call or from inside the kernel
 
|-
 
|-
 
| 0x80
 
| 0x80
Line 142: Line 142:  
| Pointer to linked list that has stolen it, or 0 if in normal list
 
| Pointer to linked list that has stolen it, or 0 if in normal list
 
|}
 
|}
 +
 +
 +
=Thread Affinity Mask=
 +
 +
If the thread is created via a call to SVC 8(CreateThread), which uses thread creation type 3, and the CPU ID is -2(meaning use the core specified in the exheader), the mask is just the affinity mask from the thread's owner KProcess.  If the CPU ID is -1(meaning any core), the affinity mask is set to 0xF on the New3DS and 0x3 on the Old3DS.  Otherwise, the affinity mask is (1 << cpu_id) | 1.
 +
 +
If the thread is created via a call by the kernel, which uses thread creation types 0-2, the checks for -1 and -2 are skipped and the mask is always (1 << cpu_id) | 1.
374

edits