KResourceLimit

KResourceLimit

class KResourceLimit extends KAutoObject;

Size : 0x74 bytes

OffsetTypeDescription
0x0u32Pointer to vtable
0x4u32Reference count
0x8s32Max Priority
0xCs32Max commit
0x10s32Max thread
0x14s32Max event
0x18s32Max mutex
0x1Cs32Max semaphore
0x20s32Max timer
0x24s32Max shared memory
0x28s32Max address arbiter
0x2Cs32Max CPU time
0x30s32Current Priority
0x34s32Current commit
0x38s32Current thread
0x3Cs32Current event
0x40s32Current mutex
0x44s32Current semaphore
0x48s32Current timer
0x4Cs32Current shared memory
0x50s32Current address arbiter
0x54s32Current CPU time
0x58KObjectMutexMutex
0x60KPreemptionTimerPreemption 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.

KPreemptionTimer:

OffsetTypeDescription
0x0u32Max CPU time in ticks for preemption type 0 (default preemption type)
0x4u32Current timer (in watchdog timer ticks)
0x8u32Last remembered watchdog timer counter value
0xCu32Max 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.

Category:Kernel auto objects