feat: various power and thermal optimizations, fix Printers app regression

This commit is contained in:
2026-04-20 16:00:52 +02:00
parent ad68f99b74
commit d1fffecff6
10 changed files with 250 additions and 65 deletions
+15 -3
View File
@@ -41,7 +41,7 @@ namespace Sched {
uint64_t savedRsp;
uint64_t stackBase; // Bottom of allocated kernel stack (lowest address)
uint64_t entryPoint;
uint64_t sliceRemaining; // Ticks left in current time slice
uint64_t sliceRemaining; // Milliseconds left in current time slice
uint64_t pml4Phys; // Physical address of per-process PML4
uint64_t kernelStackTop; // Top of kernel stack (for TSS RSP0 / SYSCALL)
uint64_t userStackTop; // User-space stack top
@@ -87,8 +87,12 @@ namespace Sched {
int Spawn(const char* vfsPath, const char* args = nullptr);
void Schedule();
// Called from the APIC timer handler on every tick (per-CPU).
void Tick();
// True when there is runnable work somewhere in the process table.
bool HasReadyProcesses();
// Called from the APIC timer handler with the elapsed time for that CPU's
// tick interval. The BSP runs at 1 ms; APs may use a coarser interval.
void Tick(uint32_t elapsedMs = 1);
// Get the PID of the currently running process (-1 if idle)
int GetCurrentPid();
@@ -112,6 +116,14 @@ namespace Sched {
// timeoutMs == 0 means wait indefinitely.
void BlockOnObject(void* object, uint64_t timeoutMs = 0);
// BSP-only scheduler housekeeping: wake expired sleepers and reclaim
// terminated process resources.
void RunBspMaintenance();
// Return the earliest blocked sleep/object timeout deadline in ticks,
// or 0 when no timed waits are pending.
uint64_t GetNextDeadlineTick();
// Wake any processes blocked on the given object.
void WakeObjectWaiters(void* object);