Changes

1,449 bytes added ,  01:29, 12 December 2016
no edit summary
Line 1: Line 1: −
[[Category:Kernel objects]]
+
[[Category:Kernel auto objects]]
 
class [[KResourceLimit]] extends [[KAutoObject]];
 
class [[KResourceLimit]] extends [[KAutoObject]];
   Line 19: Line 19:  
|-
 
|-
 
| 0x8
 
| 0x8
| u32
+
| s32
 
| Max Priority
 
| Max Priority
 
|-
 
|-
 
| 0xC
 
| 0xC
| u32
+
| s32
 
| Max commit
 
| Max commit
 
|-
 
|-
 
| 0x10
 
| 0x10
| u32
+
| s32
 
| Max thread
 
| Max thread
 
|-
 
|-
 
| 0x14
 
| 0x14
| u32
+
| s32
 
| Max event
 
| Max event
 
|-
 
|-
 
| 0x18
 
| 0x18
| u32
+
| s32
 
| Max mutex
 
| Max mutex
 
|-
 
|-
 
| 0x1C
 
| 0x1C
| u32
+
| s32
 
| Max semaphore
 
| Max semaphore
 
|-
 
|-
 
| 0x20
 
| 0x20
| u32
+
| s32
 
| Max timer
 
| Max timer
 
|-
 
|-
 
| 0x24
 
| 0x24
| u32
+
| s32
 
| Max shared memory
 
| Max shared memory
 
|-
 
|-
 
| 0x28
 
| 0x28
| u32
+
| s32
 
| Max address arbiter
 
| Max address arbiter
 
|-
 
|-
 
| 0x2C
 
| 0x2C
| u32
+
| s32
 
| Max CPU time
 
| Max CPU time
 
|-
 
|-
 
| 0x30
 
| 0x30
| u32
+
| s32
 
| Current Priority
 
| Current Priority
 
|-
 
|-
 
| 0x34
 
| 0x34
| u32
+
| s32
 
| Current commit
 
| Current commit
 
|-
 
|-
 
| 0x38
 
| 0x38
| u32
+
| s32
 
| Current thread
 
| Current thread
 
|-
 
|-
 
| 0x3C
 
| 0x3C
| u32
+
| s32
 
| Current event
 
| Current event
 
|-
 
|-
 
| 0x40
 
| 0x40
| u32
+
| s32
 
| Current mutex
 
| Current mutex
 
|-
 
|-
 
| 0x44
 
| 0x44
| u32
+
| s32
 
| Current semaphore
 
| Current semaphore
 
|-
 
|-
 
| 0x48
 
| 0x48
| u32
+
| s32
 
| Current timer
 
| Current timer
 
|-
 
|-
 
| 0x4C
 
| 0x4C
| u32
+
| s32
 
| Current shared memory
 
| Current shared memory
 
|-
 
|-
 
| 0x50
 
| 0x50
| u32
+
| s32
 
| Current address arbiter
 
| Current address arbiter
 
|-
 
|-
 
| 0x54
 
| 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 [[NCCH/Extended_Header#ARM11_Local_System_Capabilities|ARM11 Local System Capabilities]].
 +
 +
'''KPreemptionTimer''':
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Offset
 +
! Type
 +
!  Description
 +
|-
 +
| 0x0
 +
| u32
 +
| Max CPU time in ticks for preemption type 0 (default preemption type)
 +
|-
 +
| 0x4
 +
| u32
 +
| Current timer (in watchdog timer ticks)
 +
|-
 +
| 0x8
 
| u32
 
| u32
| Current CPU time
+
| Last remembered watchdog timer counter value
 
|-
 
|-
 +
| 0xC
 +
| u32
 +
| Max CPU time in ticks for preemption type 1
 
|}
 
|}
 +
 +
A call to svcSetResourceLimitValues with a limit value of 1000 for CPU time must be done first to set up some global variables and the associated [[KTimeableInterruptEvent]] instances, and another call needs to be made to actually enable preemption.
 +
 +
Preemption type 0: this is the default, preempts threads on core1 and allow them to run only 2ms * (timeLimit / 100).
 +
 +
Preemption type 1: ''seems'' to be borked, it was apparently intended to preempt threads on all cores but seems to only preempt the kernel thread running the preemptor itself and threads on core1... (time slice: 12.5ms * (timeLimit / 100))
 +
 +
"Firm" dev consoles can switch between these two types using svcKernelSetState type 6.
516

edits