feat: further kernel power and power optimizations

This commit is contained in:
2026-04-21 20:51:12 +02:00
parent d1fffecff6
commit 0dfb3e8dbb
31 changed files with 895 additions and 52 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ namespace Montauk {
for (int i = 0; ver[i]; i++) outInfo->osVersion[i] = ver[i];
outInfo->osVersion[5] = '\0';
outInfo->apiVersion = 2;
outInfo->apiVersion = 3;
outInfo->maxProcesses = Sched::MaxProcesses;
}
};
+16
View File
@@ -0,0 +1,16 @@
/*
* Input.hpp
* SYS_INPUT_WAIT syscall
* Copyright (c) 2026 Daniel Hammer
*/
#pragma once
#include <Drivers/Input/InputEvents.hpp>
namespace Montauk {
static uint64_t Sys_InputWait(uint64_t observedSerial, uint64_t timeoutMs) {
return Drivers::InputEvents::WaitForChange(observedSerial, timeoutMs);
}
}
+4 -1
View File
@@ -28,6 +28,7 @@
#include "Random.hpp" // SYS_GETRANDOM
#include "MemInfo.hpp" // SYS_MEMSTATS
#include "Device.hpp" // SYS_DEVLIST, SYS_DISKINFO
#include "Input.hpp" // SYS_INPUT_WAIT
#include "Storage.hpp" // SYS_PARTLIST, SYS_DISKREAD, SYS_DISKWRITE
#include "Window.hpp" // SYS_WINCREATE, SYS_WINDESTROY, SYS_WINPRESENT, SYS_WINPOLL, SYS_WINENUM, SYS_WINMAP, SYS_WINSENDEVENT, SYS_WINRESIZE, SYS_WINSETSCALE, SYS_WINGETSCALE
#include "Audio.hpp" // SYS_AUDIOOPEN, SYS_AUDIOCLOSE, SYS_AUDIOWRITE, SYS_AUDIOCTL
@@ -439,6 +440,8 @@ namespace Montauk {
UserMemory::IsUserPtr(frame->arg4) ? (uint64_t*)frame->arg4 : nullptr);
case SYS_CLIPBOARD_CLEAR:
return Sys_ClipboardClear();
case SYS_INPUT_WAIT:
return (int64_t)Sys_InputWait(frame->arg1, frame->arg2);
default:
return -1;
}
@@ -465,7 +468,7 @@ namespace Montauk {
Hal::WriteMSR(Hal::IA32_FMASK, 0x200);
Kt::KernelLogStream(Kt::OK, "Syscall") << "SYSCALL/SYSRET initialized (LSTAR="
<< kcp::hex << (uint64_t)SyscallEntry << kcp::dec << ", 64 syscalls)";
<< kcp::hex << (uint64_t)SyscallEntry << kcp::dec << ", 124 syscall slots)";
}
}
+3
View File
@@ -219,6 +219,9 @@ namespace Montauk {
static constexpr uint64_t SYS_CLIPBOARD_GET_TEXT = 121;
static constexpr uint64_t SYS_CLIPBOARD_CLEAR = 122;
/* Input.hpp */
static constexpr uint64_t SYS_INPUT_WAIT = 123;
static constexpr uint32_t CLIPBOARD_MAX_TEXT_BYTES = 256 * 1024;
static constexpr uint32_t IPC_SIGNAL_READABLE = 1u << 0;