feat: scheduling, usermode, shell

This commit is contained in:
2026-02-17 19:17:01 +01:00
parent 20fa8a9be2
commit 605fbcbe42
46 changed files with 2622 additions and 98 deletions
+13 -2
View File
@@ -10,6 +10,7 @@
#include <Io/IoPort.hpp>
#include <Terminal/Terminal.hpp>
#include <CppLib/Stream.hpp>
#include <Sched/Scheduler.hpp>
using namespace Kt;
@@ -34,9 +35,15 @@ namespace Timekeeping {
static volatile uint64_t g_tickCount = 0;
static uint32_t g_ticksPerMs = 0;
// Timer IRQ handler: increment tick count
static bool g_schedEnabled = false;
// Timer IRQ handler: increment tick count and drive scheduler
static void TimerHandler(uint8_t) {
g_tickCount = g_tickCount + 1;
if (g_schedEnabled) {
Sched::Tick();
}
}
// Use PIT channel 2 to create a precise delay for calibration.
@@ -128,10 +135,14 @@ namespace Timekeeping {
return g_tickCount; // 1 tick = 1 ms at 1000 Hz
}
void EnableSchedulerTick() {
g_schedEnabled = true;
}
void Sleep(uint64_t ms) {
uint64_t target = g_tickCount + ms;
while (g_tickCount < target) {
asm volatile("hlt");
}
}
};
};
+4 -1
View File
@@ -17,6 +17,9 @@ namespace Timekeeping {
// Get elapsed milliseconds since timer initialization
uint64_t GetMilliseconds();
// Enable scheduler tick (called after scheduler is initialized)
void EnableSchedulerTick();
// Busy-wait sleep for the given number of milliseconds
void Sleep(uint64_t ms);
};
};